query_id
stringlengths
32
32
query
stringlengths
7
4.32k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
9647b873210526979d097a3177472b54
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be nonnil.
[ { "docid": "9c2d961928bdb3023072044093f37168", "score": "0.0", "text": "func (in *TFControlList) DeepCopyInto(out *TFControlList) {\n\t*out = *in\n\tout.TypeMeta = in.TypeMeta\n\tout.ListMeta = in.ListMeta\n\tif in.Items != nil {\n\t\tin, out := &in.Items, &out.Items\n\t\t*out = make([]TFControl, len(*in))\n\t\tfor i := range *in {\n\t\t\t(*in)[i].DeepCopyInto(&(*out)[i])\n\t\t}\n\t}\n\treturn\n}", "title": "" } ]
[ { "docid": "333b67297f915fbee5d71b6723b8df18", "score": "0.8142836", "text": "func (in *Info) DeepCopyInto(out *Info) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "f7ee0334cf371f5b56a7f278fbc645b8", "score": "0.8141666", "text": "func (in *ValueFrom) DeepCopyInto(out *ValueFrom) {\n\t*out = *in\n}", "title": "" }, { "docid": "7301f5678de7282507f88cf56a8f5020", "score": "0.8119778", "text": "func (in *Version) DeepCopyInto(out *Version) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "c6850f95c4b786dfb720021fee99aac3", "score": "0.81081915", "text": "func (in *Version) DeepCopyInto(out *Version) {\n\t*out = *in\n}", "title": "" }, { "docid": "a082503dcbc413c6f686bfa34ed34463", "score": "0.80567133", "text": "func (in *NodeInterface) DeepCopyInto(out *NodeInterface) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "6e59956356edd23c7f64e8d77c6e2e2a", "score": "0.8052569", "text": "func (in *ValueFrom) DeepCopyInto(out *ValueFrom) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "6e59956356edd23c7f64e8d77c6e2e2a", "score": "0.8052569", "text": "func (in *ValueFrom) DeepCopyInto(out *ValueFrom) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "8efd0808623d9b730fb7e61f70087c8f", "score": "0.8049092", "text": "func (in *Container) DeepCopyInto(out *Container) {\n\t*out = *in\n}", "title": "" }, { "docid": "12aba946684ce7a45759b3de900e843d", "score": "0.803447", "text": "func (d *Date) DeepCopyInto(out *Date) {\n\t*out = *d\n}", "title": "" }, { "docid": "8e8acfb208833240003e7bd04991a6fd", "score": "0.80235606", "text": "func (in *Res) DeepCopyInto(out *Res) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "5b24c3ee0cabe62c71b4995b5197f3e8", "score": "0.8021609", "text": "func (in *ObjectSelector) DeepCopyInto(out *ObjectSelector) {\n\t*out = *in\n}", "title": "" }, { "docid": "47e926643765e9a4a156b16f17541bb3", "score": "0.80211926", "text": "func (in *Type) DeepCopyInto(out *Type) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "44a6cbccbb6bb25682871c474d6f5707", "score": "0.8016718", "text": "func (in *MatchExpression) DeepCopyInto(out *MatchExpression) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "30324ad038726659a523150f3368d0f5", "score": "0.8011081", "text": "func (in *Container) DeepCopyInto(out *Container) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "e15ee59c73e0b956f52cc07e2dc67c42", "score": "0.80057174", "text": "func (in *NodeCleanUpDetail) DeepCopyInto(out *NodeCleanUpDetail) {\n\t*out = *in\n}", "title": "" }, { "docid": "da67199fd73512557ec605b34bb7786a", "score": "0.80035967", "text": "func (in *GitFileGeneratorItem) DeepCopyInto(out *GitFileGeneratorItem) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "b9940b476867bb05d134db61f68d9644", "score": "0.8001236", "text": "func (in *Sequence) DeepCopyInto(out *Sequence) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "0e6b303fbadbc23c61dcee39495476b2", "score": "0.7999441", "text": "func (in *Interface) DeepCopyInto(out *Interface) {\n\t*out = *in\n}", "title": "" }, { "docid": "64f7c5b12b50180e8fc16b78724a33b3", "score": "0.79961914", "text": "func (in *DebugInfo) DeepCopyInto(out *DebugInfo) {\n\t*out = *in\n}", "title": "" }, { "docid": "b484ecb198d3d15da23105d7d1e0fce9", "score": "0.7982816", "text": "func (in *HostMemory) DeepCopyInto(out *HostMemory) {\n\t*out = *in\n}", "title": "" }, { "docid": "a61d45a01b735be0637692d867f2886b", "score": "0.79821885", "text": "func (in *GitDirectoryGeneratorItem) DeepCopyInto(out *GitDirectoryGeneratorItem) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "083852392c5e9f16679610351c913068", "score": "0.7978422", "text": "func (in *Entry) DeepCopyInto(out *Entry) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "73f3c4b574f47b584d574904e9535278", "score": "0.79766333", "text": "func (in *Mba) DeepCopyInto(out *Mba) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "de7749f45d05b10ffc6cb8d5f6fb7e08", "score": "0.7971164", "text": "func (in *KeepAlive) DeepCopyInto(out *KeepAlive) {\n\t*out = *in\n}", "title": "" }, { "docid": "dc25f670b9ab6635efd1a7f707841646", "score": "0.7970074", "text": "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n}", "title": "" }, { "docid": "6fbe56e0c85e188a8a0560cb5e8afedb", "score": "0.7968312", "text": "func (in *JsonnetVar) DeepCopyInto(out *JsonnetVar) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "df39ebb54f270c6d9f8b9577e7363c97", "score": "0.79638344", "text": "func (in *VMInfo) DeepCopyInto(out *VMInfo) {\n\t*out = *in\n}", "title": "" }, { "docid": "be82863d9978b104237d2472cfdf3614", "score": "0.7960795", "text": "func (in *CrossVersionObjectReference) DeepCopyInto(out *CrossVersionObjectReference) {\n\t*out = *in\n}", "title": "" }, { "docid": "724c532b18202d3ed4a017bc96ed7ac0", "score": "0.7953224", "text": "func (in *ObjRef) DeepCopyInto(out *ObjRef) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "3c51337658fc0e9d2966273bd3459022", "score": "0.79461676", "text": "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "3c51337658fc0e9d2966273bd3459022", "score": "0.79461676", "text": "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "fa8ae88431960117f58fb44b09159283", "score": "0.79443544", "text": "func (in *ProgressStep) DeepCopyInto(out *ProgressStep) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "e5f7998496abc109db19d751b6e4c690", "score": "0.79437053", "text": "func (in *OperandVersion) DeepCopyInto(out *OperandVersion) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "92bd0f9f52c488e2823218fc03f28117", "score": "0.794318", "text": "func (in *CrossVersionObjectReference) DeepCopyInto(out *CrossVersionObjectReference) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "03b47d22a5efb39d6ec384531900b624", "score": "0.79427123", "text": "func (in *Ovs) DeepCopyInto(out *Ovs) {\n\t*out = *in\n}", "title": "" }, { "docid": "e147f3c4cabb40a6a4a8327bd70c51d6", "score": "0.7940481", "text": "func (in *GPULimit) DeepCopyInto(out *GPULimit) {\n\t*out = *in\n}", "title": "" }, { "docid": "15ea69cebeda46850cc727790e5bd7bd", "score": "0.7937892", "text": "func (in *Target) DeepCopyInto(out *Target) {\n\t*out = *in\n\tout.Cfg = in.Cfg\n}", "title": "" }, { "docid": "d9295895700ce483b375539279ecb7a0", "score": "0.79350686", "text": "func (in *Multus) DeepCopyInto(out *Multus) {\n\t*out = *in\n}", "title": "" }, { "docid": "4e012cd4b271b374007162be15072ad7", "score": "0.7925471", "text": "func (in *IsoContainer) DeepCopyInto(out *IsoContainer) {\n\t*out = *in\n}", "title": "" }, { "docid": "e7824965b786de83e5edd7c40c1905bd", "score": "0.79140574", "text": "func (in *Cache) DeepCopyInto(out *Cache) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "6a74df2be2dbe701a0ee65d8e03053f6", "score": "0.79130125", "text": "func (in *IPXE) DeepCopyInto(out *IPXE) {\n\t*out = *in\n}", "title": "" }, { "docid": "9b532d431b3f33589b5f4ac91d132785", "score": "0.79105514", "text": "func (in *PhaseStep) DeepCopyInto(out *PhaseStep) {\n\t*out = *in\n}", "title": "" }, { "docid": "d76c01b6f2f6b38d5d88fdf56bc5b770", "score": "0.79068846", "text": "func (in *NSFSSpec) DeepCopyInto(out *NSFSSpec) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "6e0024c4cb6b6d1586b3b7e5f14e9680", "score": "0.79035264", "text": "func (in *CephBackupSource) DeepCopyInto(out *CephBackupSource) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "effa6307fdf6b6d8aef93425794295c1", "score": "0.79013073", "text": "func (in *OCIReferenceParts) DeepCopyInto(out *OCIReferenceParts) {\n\t*out = *in\n}", "title": "" }, { "docid": "9fc1385dfaa3a89b6a701b34d99f68ae", "score": "0.7900888", "text": "func (in *ContinueOn) DeepCopyInto(out *ContinueOn) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "943d7f6174a25b06a160290aa387b688", "score": "0.7900393", "text": "func (in *DatasetRoutine) DeepCopyInto(out *DatasetRoutine) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "c4c4ace47e2088630b69076a754ee18a", "score": "0.7894223", "text": "func (in *PlumbingValue) DeepCopyInto(out *PlumbingValue) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "a1e837b1e5c0750250ec053337d4ea95", "score": "0.78911597", "text": "func (in *Rdt) DeepCopyInto(out *Rdt) {\n\t*out = *in\n\tout.Cache = in.Cache\n\tout.Mba = in.Mba\n\treturn\n}", "title": "" }, { "docid": "dddf435977ebcd6bfaf0b4c062ea8042", "score": "0.78905755", "text": "func (in *Image) DeepCopyInto(out *Image) {\n\t*out = *in\n}", "title": "" }, { "docid": "44aa843319d42aac540ebbb780c5f0d0", "score": "0.78901464", "text": "func (in *Record) DeepCopyInto(out *Record) {\n\t*out = *in\n\tif in.StepInfo != nil {\n\t\tin, out := &in.StepInfo, &out.StepInfo\n\t\t*out = make([]byte, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" }, { "docid": "32b00888211ff9ca3596125ceec6d7e7", "score": "0.7889031", "text": "func (in *ObjectInfo) DeepCopyInto(out *ObjectInfo) {\n\t*out = *in\n\tout.GroupVersionKind = in.GroupVersionKind\n\treturn\n}", "title": "" }, { "docid": "153a99a016a77679a9b35b2afac0ce73", "score": "0.7886498", "text": "func (in *CloneFrom) DeepCopyInto(out *CloneFrom) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "153a99a016a77679a9b35b2afac0ce73", "score": "0.7886498", "text": "func (in *CloneFrom) DeepCopyInto(out *CloneFrom) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "23db226639df1ec5bfce6ed220d55ed3", "score": "0.78859967", "text": "func (in *Port) DeepCopyInto(out *Port) {\n\t*out = *in\n}", "title": "" }, { "docid": "fea7ec9e7b416ca412ea4012d2bc4379", "score": "0.7882666", "text": "func (in *CallValue) DeepCopyInto(out *CallValue) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "0a324763431036abed5658a8c6a258d6", "score": "0.788138", "text": "func (in *NodeSelector) DeepCopyInto(out *NodeSelector) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "468d028d016a29b90f8fb0728461fcc7", "score": "0.7879159", "text": "func (in *Command) DeepCopyInto(out *Command) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "d256c820515fab73a5f773948f60b6b7", "score": "0.787675", "text": "func (in *KeyValue) DeepCopyInto(out *KeyValue) {\n\t*out = *in\n}", "title": "" }, { "docid": "e0a6b516fdf9d0ade0ca8bf100e9c9c0", "score": "0.787639", "text": "func (in *NFS) DeepCopyInto(out *NFS) {\n\t*out = *in\n}", "title": "" }, { "docid": "dfd9b82d38c6fee08dd3cf0209bd1133", "score": "0.7875957", "text": "func (in *Disk) DeepCopyInto(out *Disk) {\n\t*out = *in\n}", "title": "" }, { "docid": "bb04cd638c939bd7a75e8da7e2cc1460", "score": "0.78753304", "text": "func (in *AWSDNSSpec) DeepCopyInto(out *AWSDNSSpec) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "23691787fc6f5c7052485344cca224ef", "score": "0.7873126", "text": "func (in *Run) DeepCopyInto(out *Run) {\n\t*out = *in\n\tif in.Params != nil {\n\t\tin, out := &in.Params, &out.Params\n\t\t*out = make(map[string]string, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t}\n}", "title": "" }, { "docid": "d02c4e245665db42aa7f449aedbc0217", "score": "0.7872079", "text": "func (in *DNSSelection) DeepCopyInto(out *DNSSelection) {\n\t*out = *in\n\tif in.Include != nil {\n\t\tin, out := &in.Include, &out.Include\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Exclude != nil {\n\t\tin, out := &in.Exclude, &out.Exclude\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" }, { "docid": "d04effc735adc59932f839adb9a5fcca", "score": "0.78715914", "text": "func (in *Target) DeepCopyInto(out *Target) {\n\t*out = *in\n}", "title": "" }, { "docid": "7469ccae1d21960cfa51970df24db597", "score": "0.78689843", "text": "func (in *HookRunArgument) DeepCopyInto(out *HookRunArgument) {\n\t*out = *in\n}", "title": "" }, { "docid": "23a65f1f8246d0a6155b7ec686aafb86", "score": "0.78654516", "text": "func (in *Revision) DeepCopyInto(out *Revision) {\n\t*out = *in\n}", "title": "" }, { "docid": "1e1088954cae99b323e1b34730ad0490", "score": "0.7865111", "text": "func (in *Proxy) DeepCopyInto(out *Proxy) {\n\t*out = *in\n}", "title": "" }, { "docid": "5186b8d1bfd3abf2fb983694f27e4aed", "score": "0.7863912", "text": "func (in *Image) DeepCopyInto(out *Image) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "4b45b7057d0a50a99f3ef94afc614586", "score": "0.7862088", "text": "func (in *Update) DeepCopyInto(out *Update) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "1c6240a586997b039407221e81129759", "score": "0.7861322", "text": "func (in *Rest) DeepCopyInto(out *Rest) {\n\t*out = *in\n\tout.Rest = in.Rest\n\treturn\n}", "title": "" }, { "docid": "9986d28e50d7f5a5e40d87f7a686278a", "score": "0.7859102", "text": "func (in *NodeCleanUpResult) DeepCopyInto(out *NodeCleanUpResult) {\n\t*out = *in\n\tif in.Results != nil {\n\t\tin, out := &in.Results, &out.Results\n\t\t*out = make([]NodeCleanUpDetail, len(*in))\n\t\tcopy(*out, *in)\n\t}\n}", "title": "" }, { "docid": "29e02c97b127087f995d6b0457b82abc", "score": "0.7858547", "text": "func (in *Checksum) DeepCopyInto(out *Checksum) {\n\t*out = *in\n}", "title": "" }, { "docid": "395e42f980980caf06129125de0d1056", "score": "0.78582096", "text": "func (in *PlasterDockerfileBuild) DeepCopyInto(out *PlasterDockerfileBuild) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "be10e95aa69cc037d34c99b04c51d566", "score": "0.78570116", "text": "func (in *PodNodeSelector) DeepCopyInto(out *PodNodeSelector) {\n\t*out = *in\n\tout.Config = in.Config\n\treturn\n}", "title": "" }, { "docid": "619ced57a08dd863072d39bcb0947148", "score": "0.7856391", "text": "func (in *Core) DeepCopyInto(out *Core) {\n\t*out = *in\n\tout.Core = in.Core\n\treturn\n}", "title": "" }, { "docid": "4600993eda54ac756514102911f18857", "score": "0.7854608", "text": "func (in *Result) DeepCopyInto(out *Result) {\n\t*out = *in\n\tif in.Items != nil {\n\t\tin, out := &in.Items, &out.Items\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" }, { "docid": "b73a0bca7e66531ec43189e30dbb950c", "score": "0.7854286", "text": "func (in *MigrationVolumeInfo) DeepCopyInto(out *MigrationVolumeInfo) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "8595c8a7e4fc300ac82d808dfdd3b97d", "score": "0.7854255", "text": "func (in *Step) DeepCopyInto(out *Step) {\n\t*out = *in\n\tif in.Environment != nil {\n\t\tin, out := &in.Environment, &out.Environment\n\t\t*out = make(map[string]string, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t}\n\tif in.Labels != nil {\n\t\tin, out := &in.Labels, &out.Labels\n\t\t*out = make(map[string]string, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t}\n\tif in.Entrypoint != nil {\n\t\tin, out := &in.Entrypoint, &out.Entrypoint\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Command != nil {\n\t\tin, out := &in.Command, &out.Command\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.ExtraHosts != nil {\n\t\tin, out := &in.ExtraHosts, &out.ExtraHosts\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Volumes != nil {\n\t\tin, out := &in.Volumes, &out.Volumes\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Tmpfs != nil {\n\t\tin, out := &in.Tmpfs, &out.Tmpfs\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Devices != nil {\n\t\tin, out := &in.Devices, &out.Devices\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Networks != nil {\n\t\tin, out := &in.Networks, &out.Networks\n\t\t*out = make([]Conn, len(*in))\n\t\tfor i := range *in {\n\t\t\t(*in)[i].DeepCopyInto(&(*out)[i])\n\t\t}\n\t}\n\tif in.DNS != nil {\n\t\tin, out := &in.DNS, &out.DNS\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.DNSSearch != nil {\n\t\tin, out := &in.DNSSearch, &out.DNSSearch\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tout.AuthConfig = in.AuthConfig\n\tif in.Sysctls != nil {\n\t\tin, out := &in.Sysctls, &out.Sysctls\n\t\t*out = make(map[string]string, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "60ab2f0f445d10b5a62d93d1d95c53b2", "score": "0.7851628", "text": "func (in *NodeResult) DeepCopyInto(out *NodeResult) {\n\t*out = *in\n\tif in.Images != nil {\n\t\tin, out := &in.Images, &out.Images\n\t\t*out = make([]NodeCleanUpDetail, len(*in))\n\t\tcopy(*out, *in)\n\t}\n}", "title": "" }, { "docid": "b4edcf0a724e1fe7f417820e620e8dd9", "score": "0.7851545", "text": "func (in *KeyToPath) DeepCopyInto(out *KeyToPath) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "8f77db9449d807b50cf35ec73f5fcbce", "score": "0.78464186", "text": "func (in *Pool) DeepCopyInto(out *Pool) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "3e013886e6bc1d59a365df69c5ee97c5", "score": "0.7844852", "text": "func (in *ReferenceObject) DeepCopyInto(out *ReferenceObject) {\n\t*out = *in\n}", "title": "" }, { "docid": "c507de4966f2e549916d775c5aa6a00c", "score": "0.7842351", "text": "func (in *TlsData) DeepCopyInto(out *TlsData) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "cb9ae0cf9d42bca2cbea4af3bc24b150", "score": "0.7841662", "text": "func (in *Anonymous) DeepCopyInto(out *Anonymous) {\n\t*out = *in\n}", "title": "" }, { "docid": "ca7ac29d4707cb3199f6c0f7f01870c8", "score": "0.78399724", "text": "func (in *PullRequestGeneratorAzureDevOps) DeepCopyInto(out *PullRequestGeneratorAzureDevOps) {\n\t*out = *in\n\tif in.TokenRef != nil {\n\t\tin, out := &in.TokenRef, &out.TokenRef\n\t\t*out = new(SecretRef)\n\t\t**out = **in\n\t}\n\tif in.Labels != nil {\n\t\tin, out := &in.Labels, &out.Labels\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" }, { "docid": "2300229ea8d7d76543a7dc0370ad8527", "score": "0.78388846", "text": "func (in *CephRestoreSource) DeepCopyInto(out *CephRestoreSource) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "6517829e5f084e9fc164337dca5ad675", "score": "0.7837769", "text": "func (in *PodGC) DeepCopyInto(out *PodGC) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "1462f8c11ac9fb85a2db41dbf2f02527", "score": "0.7837718", "text": "func (in *NodeSpec) DeepCopyInto(out *NodeSpec) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "81964a32bfd6f7c4c30aba87ff257c5c", "score": "0.78369665", "text": "func (in *DatabaseConnectionInfo) DeepCopyInto(out *DatabaseConnectionInfo) {\n\t*out = *in\n}", "title": "" }, { "docid": "44dc6b8ab066d5f4294fa5b4e52ab31e", "score": "0.7834809", "text": "func (in *BucketVersioning) DeepCopyInto(out *BucketVersioning) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "78e490f295133f130a3ed946e288149f", "score": "0.7832983", "text": "func (in *HierarchicalReference) DeepCopyInto(out *HierarchicalReference) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "66d2580ffb856b04e5d00a44ee008ce0", "score": "0.78312105", "text": "func (in *Target) DeepCopyInto(out *Target) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "cb473a50a2c7608cb863df348afabf6c", "score": "0.78271323", "text": "func (in *State) DeepCopyInto(out *State) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "783f47424c191839399d4e44b906dd71", "score": "0.78259516", "text": "func (in *Port) DeepCopyInto(out *Port) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "783f47424c191839399d4e44b906dd71", "score": "0.78259516", "text": "func (in *Port) DeepCopyInto(out *Port) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "45b81ab5647ffc92a79777654a796ae7", "score": "0.782401", "text": "func (in *ManagedDisk) DeepCopyInto(out *ManagedDisk) {\n\t*out = *in\n}", "title": "" }, { "docid": "de8b3130a4b02c2fe7327dbd014d80d9", "score": "0.7821276", "text": "func (in *ContainerImage) DeepCopyInto(out *ContainerImage) {\n\t*out = *in\n}", "title": "" }, { "docid": "f0098cc888d3f9bd31c28603507c9ac2", "score": "0.78200805", "text": "func (in *InfoItem) DeepCopyInto(out *InfoItem) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "1841f8389d1b1da1c8510773fe898aa0", "score": "0.7816404", "text": "func (in *AVLivenessprobe) DeepCopyInto(out *AVLivenessprobe) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "3221f8cc95cfbc91e17579c0e35dfcde", "score": "0.78154856", "text": "func (in *ComposableGetValueFrom) DeepCopyInto(out *ComposableGetValueFrom) {\n\t*out = *in\n\tif in.Labels != nil {\n\t\tin, out := &in.Labels, &out.Labels\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.FormatTransformers != nil {\n\t\tin, out := &in.FormatTransformers, &out.FormatTransformers\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n}", "title": "" } ]
abe3d3098ef54a0076fd75b632c17f52
IsYANGGoStruct ensures that NetworkInstance_Protocol_Ospfv2_Global_Timers_LsaGeneration implements the yang.GoStruct interface. This allows functions that need to handle this struct to identify it as being generated by ygen.
[ { "docid": "0f60364a1e1bf2cd450e3e808c65925e", "score": "0.89642775", "text": "func (*NetworkInstance_Protocol_Ospfv2_Global_Timers_LsaGeneration) IsYANGGoStruct() {}", "title": "" } ]
[ { "docid": "248318196170529b6f71c15dfe8d7e22", "score": "0.8351233", "text": "func (*NetworkInstance_Protocol_Isis_Global_Timers_LspGeneration) IsYANGGoStruct() {}", "title": "" }, { "docid": "248318196170529b6f71c15dfe8d7e22", "score": "0.8350632", "text": "func (*NetworkInstance_Protocol_Isis_Global_Timers_LspGeneration) IsYANGGoStruct() {}", "title": "" }, { "docid": "2dee46c5311bcb550219c22afd74d907", "score": "0.7946444", "text": "func (*NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_GraceLsa_Tlv) IsYANGGoStruct() {\n}", "title": "" }, { "docid": "2dee46c5311bcb550219c22afd74d907", "score": "0.7946444", "text": "func (*NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_GraceLsa_Tlv) IsYANGGoStruct() {\n}", "title": "" }, { "docid": "fae6de5455bb9f6b10b6085b0836ca2c", "score": "0.79174125", "text": "func (*NetworkInstance_Protocol_Ospfv2_Global_Timers_Spf) IsYANGGoStruct() {}", "title": "" }, { "docid": "fae6de5455bb9f6b10b6085b0836ca2c", "score": "0.79174125", "text": "func (*NetworkInstance_Protocol_Ospfv2_Global_Timers_Spf) IsYANGGoStruct() {}", "title": "" }, { "docid": "fcc0afa8eb5f22c8248a14555888c36b", "score": "0.77884144", "text": "func (*NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_GraceLsa) IsYANGGoStruct() {}", "title": "" }, { "docid": "fcc0afa8eb5f22c8248a14555888c36b", "score": "0.77884144", "text": "func (*NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_GraceLsa) IsYANGGoStruct() {}", "title": "" }, { "docid": "61e4b27578149d4f370fbb063e34dba5", "score": "0.77776444", "text": "func (*NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_TrafficEngineering_Tlv) IsYANGGoStruct() {\n}", "title": "" }, { "docid": "61e4b27578149d4f370fbb063e34dba5", "score": "0.77776444", "text": "func (*NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_TrafficEngineering_Tlv) IsYANGGoStruct() {\n}", "title": "" }, { "docid": "aa8635953458334e9fcaf11dcfd67644", "score": "0.77261984", "text": "func (*NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_ExtendedLink_Tlv) IsYANGGoStruct() {\n}", "title": "" }, { "docid": "aa8635953458334e9fcaf11dcfd67644", "score": "0.77261984", "text": "func (*NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_ExtendedLink_Tlv) IsYANGGoStruct() {\n}", "title": "" }, { "docid": "2265dab459d817acef64f66523424642", "score": "0.7725348", "text": "func (*NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_TrafficEngineering_Tlv_Link_SubTlv) IsYANGGoStruct() {\n}", "title": "" }, { "docid": "2265dab459d817acef64f66523424642", "score": "0.7725348", "text": "func (*NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_TrafficEngineering_Tlv_Link_SubTlv) IsYANGGoStruct() {\n}", "title": "" }, { "docid": "28c5aada748a133a510217bcc484c9ff", "score": "0.7724592", "text": "func (*NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_TrafficEngineering) IsYANGGoStruct() {\n}", "title": "" }, { "docid": "28c5aada748a133a510217bcc484c9ff", "score": "0.7724592", "text": "func (*NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_TrafficEngineering) IsYANGGoStruct() {\n}", "title": "" }, { "docid": "a9bae11e7bbbfe1972481157b917f916", "score": "0.768785", "text": "func (*NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_TrafficEngineering_Tlv_Link) IsYANGGoStruct() {\n}", "title": "" }, { "docid": "a9bae11e7bbbfe1972481157b917f916", "score": "0.768785", "text": "func (*NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_TrafficEngineering_Tlv_Link) IsYANGGoStruct() {\n}", "title": "" }, { "docid": "374a2ec198292f836d59a85f7dcfd4a6", "score": "0.76851034", "text": "func (*NetworkInstance_Protocol_Ospfv2_Global_Mpls) IsYANGGoStruct() {}", "title": "" }, { "docid": "374a2ec198292f836d59a85f7dcfd4a6", "score": "0.76851034", "text": "func (*NetworkInstance_Protocol_Ospfv2_Global_Mpls) IsYANGGoStruct() {}", "title": "" }, { "docid": "6e24df7cd7c9eac4d5358e8ff3d8dd31", "score": "0.76796484", "text": "func (*NetworkInstance_Protocol_Isis_Global_Timers_Spf) IsYANGGoStruct() {}", "title": "" }, { "docid": "6e24df7cd7c9eac4d5358e8ff3d8dd31", "score": "0.76796484", "text": "func (*NetworkInstance_Protocol_Isis_Global_Timers_Spf) IsYANGGoStruct() {}", "title": "" }, { "docid": "e4abcb08694849d0512f3871f64f805d", "score": "0.7657658", "text": "func (*Bgp_PeerGroup_Timers) IsYANGGoStruct() {}", "title": "" }, { "docid": "e4abcb08694849d0512f3871f64f805d", "score": "0.7657651", "text": "func (*Bgp_PeerGroup_Timers) IsYANGGoStruct() {}", "title": "" }, { "docid": "a97a7d9281ec8abdb798a95f83a807e1", "score": "0.7645955", "text": "func (*NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_ExtendedPrefix_Tlv_SidLabelBinding_Tlv_EroMetric) IsYANGGoStruct() {\n}", "title": "" }, { "docid": "a97a7d9281ec8abdb798a95f83a807e1", "score": "0.7645955", "text": "func (*NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_ExtendedPrefix_Tlv_SidLabelBinding_Tlv_EroMetric) IsYANGGoStruct() {\n}", "title": "" }, { "docid": "6178e39d9a7f24903c3dd10ea5e37fdc", "score": "0.7632526", "text": "func (*Mpls_SignalingProtocols_Ldp) IsYANGGoStruct() {}", "title": "" }, { "docid": "6178e39d9a7f24903c3dd10ea5e37fdc", "score": "0.7632526", "text": "func (*Mpls_SignalingProtocols_Ldp) IsYANGGoStruct() {}", "title": "" }, { "docid": "d9b992a6cd51751c200e80e4b78dca13", "score": "0.7623937", "text": "func (*NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_NetworkLsa) IsYANGGoStruct() {}", "title": "" }, { "docid": "d9b992a6cd51751c200e80e4b78dca13", "score": "0.7623937", "text": "func (*NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_NetworkLsa) IsYANGGoStruct() {}", "title": "" }, { "docid": "e3aaf9e8f45444949743cc34d558d6e2", "score": "0.7614648", "text": "func (*NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_TrafficEngineering_Tlv_Link_SubTlv_AdminGroup) IsYANGGoStruct() {\n}", "title": "" }, { "docid": "e3aaf9e8f45444949743cc34d558d6e2", "score": "0.7614648", "text": "func (*NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_TrafficEngineering_Tlv_Link_SubTlv_AdminGroup) IsYANGGoStruct() {\n}", "title": "" }, { "docid": "71f33bd6f5a743c236d5b0c4ea41009f", "score": "0.75964135", "text": "func (*OpenconfigSystem_System_Openflow_Agent_Config) IsYANGGoStruct() {}", "title": "" }, { "docid": "71f33bd6f5a743c236d5b0c4ea41009f", "score": "0.75964135", "text": "func (*OpenconfigSystem_System_Openflow_Agent_Config) IsYANGGoStruct() {}", "title": "" }, { "docid": "32ba8c7da61eb62f9d601def168bad79", "score": "0.7591058", "text": "func (*Mpls_SignalingProtocols_RsvpTe_Interface_Hellos) IsYANGGoStruct() {}", "title": "" }, { "docid": "32ba8c7da61eb62f9d601def168bad79", "score": "0.7590282", "text": "func (*Mpls_SignalingProtocols_RsvpTe_Interface_Hellos) IsYANGGoStruct() {}", "title": "" }, { "docid": "8264623853c3b9339c49a0b2b8c3828b", "score": "0.75842506", "text": "func (*OpenconfigSystem_System_Openflow_Agent_State) IsYANGGoStruct() {}", "title": "" }, { "docid": "8264623853c3b9339c49a0b2b8c3828b", "score": "0.75842506", "text": "func (*OpenconfigSystem_System_Openflow_Agent_State) IsYANGGoStruct() {}", "title": "" }, { "docid": "3641defff63c1b777d6c3bac68c6dc03", "score": "0.7565136", "text": "func (*NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_ExtendedLink) IsYANGGoStruct() {\n}", "title": "" }, { "docid": "3641defff63c1b777d6c3bac68c6dc03", "score": "0.7565136", "text": "func (*NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_ExtendedLink) IsYANGGoStruct() {\n}", "title": "" }, { "docid": "b655dde4a056e7043dbcfc2d7d5022fd", "score": "0.75625956", "text": "func (*NetworkInstance_Mpls_Lsps) IsYANGGoStruct() {}", "title": "" }, { "docid": "debc6f2e10f2ec3fe0e8ed2884221331", "score": "0.7562308", "text": "func (*NetworkInstance_Protocol_Ospfv2_Global_Timers) IsYANGGoStruct() {}", "title": "" }, { "docid": "debc6f2e10f2ec3fe0e8ed2884221331", "score": "0.7562308", "text": "func (*NetworkInstance_Protocol_Ospfv2_Global_Timers) IsYANGGoStruct() {}", "title": "" }, { "docid": "b655dde4a056e7043dbcfc2d7d5022fd", "score": "0.75613296", "text": "func (*NetworkInstance_Mpls_Lsps) IsYANGGoStruct() {}", "title": "" }, { "docid": "c9ae94961f69654944f62483a1e11079", "score": "0.75567496", "text": "func (*NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_ExtendedPrefix_Tlv_SidLabelBinding_Tlv) IsYANGGoStruct() {\n}", "title": "" }, { "docid": "c9ae94961f69654944f62483a1e11079", "score": "0.75567496", "text": "func (*NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_ExtendedPrefix_Tlv_SidLabelBinding_Tlv) IsYANGGoStruct() {\n}", "title": "" }, { "docid": "04b5c94f2505528bfeba686574789a20", "score": "0.7556627", "text": "func (*OpenconfigInterfaces_Interfaces_Interface_HoldTime_Config) IsYANGGoStruct() {}", "title": "" }, { "docid": "04b5c94f2505528bfeba686574789a20", "score": "0.7556627", "text": "func (*OpenconfigInterfaces_Interfaces_Interface_HoldTime_Config) IsYANGGoStruct() {}", "title": "" }, { "docid": "04b5c94f2505528bfeba686574789a20", "score": "0.7556627", "text": "func (*OpenconfigInterfaces_Interfaces_Interface_HoldTime_Config) IsYANGGoStruct() {}", "title": "" }, { "docid": "ccd7d269523f39a226a670577d1c27ab", "score": "0.75559753", "text": "func (*NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_ExtendedPrefix_Tlv) IsYANGGoStruct() {\n}", "title": "" }, { "docid": "ccd7d269523f39a226a670577d1c27ab", "score": "0.75559753", "text": "func (*NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_ExtendedPrefix_Tlv) IsYANGGoStruct() {\n}", "title": "" }, { "docid": "554868141d63f57e2cc0e682329bb9a6", "score": "0.7554964", "text": "func (*Bgp_Global_AfiSafi_L2VpnEvpn) IsYANGGoStruct() {}", "title": "" }, { "docid": "554868141d63f57e2cc0e682329bb9a6", "score": "0.7553896", "text": "func (*Bgp_Global_AfiSafi_L2VpnEvpn) IsYANGGoStruct() {}", "title": "" }, { "docid": "d9294361135da192924705e3103d224a", "score": "0.7549268", "text": "func (*Mpls_SignalingProtocols_RsvpTe_Interface) IsYANGGoStruct() {}", "title": "" }, { "docid": "d9294361135da192924705e3103d224a", "score": "0.75477827", "text": "func (*Mpls_SignalingProtocols_RsvpTe_Interface) IsYANGGoStruct() {}", "title": "" }, { "docid": "2d3618485ddb1d487058454325262da8", "score": "0.75401473", "text": "func (*OpenconfigSystem_System_Openflow_Agent) IsYANGGoStruct() {}", "title": "" }, { "docid": "2d3618485ddb1d487058454325262da8", "score": "0.75401473", "text": "func (*OpenconfigSystem_System_Openflow_Agent) IsYANGGoStruct() {}", "title": "" }, { "docid": "f5ab5905c9825ece5c167f24a750339c", "score": "0.75399315", "text": "func (*NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa) IsYANGGoStruct() {}", "title": "" }, { "docid": "f5ab5905c9825ece5c167f24a750339c", "score": "0.75399315", "text": "func (*NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa) IsYANGGoStruct() {}", "title": "" }, { "docid": "741cf372e630e5e05f73042e28583f12", "score": "0.75357604", "text": "func (*NetworkInstance_Protocol_Ospfv2_Global) IsYANGGoStruct() {}", "title": "" }, { "docid": "741cf372e630e5e05f73042e28583f12", "score": "0.75357604", "text": "func (*NetworkInstance_Protocol_Ospfv2_Global) IsYANGGoStruct() {}", "title": "" }, { "docid": "5a692a98ab5961576e649eeec9160531", "score": "0.7531308", "text": "func (*NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_UnknownTlv) IsYANGGoStruct() {}", "title": "" }, { "docid": "5a692a98ab5961576e649eeec9160531", "score": "0.7531308", "text": "func (*NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_UnknownTlv) IsYANGGoStruct() {}", "title": "" }, { "docid": "45bb8e9f58eab9f1e93c68d8eadff1fa", "score": "0.7526832", "text": "func (*Bgp_Neighbor_Timers) IsYANGGoStruct() {}", "title": "" }, { "docid": "45bb8e9f58eab9f1e93c68d8eadff1fa", "score": "0.75267833", "text": "func (*Bgp_Neighbor_Timers) IsYANGGoStruct() {}", "title": "" }, { "docid": "5b384861167140a5e6bf3d0f7831ecab", "score": "0.75242084", "text": "func (*OpenconfigLldp_Lldp_Interfaces) IsYANGGoStruct() {}", "title": "" }, { "docid": "da7ffe5e26d5bef6da57fb8d64defc2f", "score": "0.7522921", "text": "func (*NetworkInstance_Mpls_TeGlobalAttributes_TeLspTimers) IsYANGGoStruct() {}", "title": "" }, { "docid": "da7ffe5e26d5bef6da57fb8d64defc2f", "score": "0.75219566", "text": "func (*NetworkInstance_Mpls_TeGlobalAttributes_TeLspTimers) IsYANGGoStruct() {}", "title": "" }, { "docid": "1d5437447ce3d4276c174a03fe38b607", "score": "0.75216204", "text": "func (*Bgp_Global_AfiSafi_L2VpnVpls) IsYANGGoStruct() {}", "title": "" }, { "docid": "1d5437447ce3d4276c174a03fe38b607", "score": "0.75215346", "text": "func (*Bgp_Global_AfiSafi_L2VpnVpls) IsYANGGoStruct() {}", "title": "" }, { "docid": "34af6311d5e8e87affebc3b4aa5b61b7", "score": "0.7515669", "text": "func (*Mpls_TeGlobalAttributes_TeLspTimers) IsYANGGoStruct() {}", "title": "" }, { "docid": "34af6311d5e8e87affebc3b4aa5b61b7", "score": "0.7515669", "text": "func (*Mpls_TeGlobalAttributes_TeLspTimers) IsYANGGoStruct() {}", "title": "" }, { "docid": "f8eb2cccf4c4dda437505c79c2318dc2", "score": "0.75145143", "text": "func (*OpenconfigSystem_System_GrpcServer_State) IsYANGGoStruct() {}", "title": "" }, { "docid": "f8eb2cccf4c4dda437505c79c2318dc2", "score": "0.75145143", "text": "func (*OpenconfigSystem_System_GrpcServer_State) IsYANGGoStruct() {}", "title": "" }, { "docid": "af280c2451c611282a56971250e1b82f", "score": "0.7514021", "text": "func (*Mpls_SignalingProtocols_RsvpTe_Global_Hellos) IsYANGGoStruct() {}", "title": "" }, { "docid": "776e4c8079779cccb9577bd07f8c4695", "score": "0.7513834", "text": "func (*NetworkInstance_Protocol_Ospfv2) IsYANGGoStruct() {}", "title": "" }, { "docid": "776e4c8079779cccb9577bd07f8c4695", "score": "0.7513834", "text": "func (*NetworkInstance_Protocol_Ospfv2) IsYANGGoStruct() {}", "title": "" }, { "docid": "af280c2451c611282a56971250e1b82f", "score": "0.7513339", "text": "func (*Mpls_SignalingProtocols_RsvpTe_Global_Hellos) IsYANGGoStruct() {}", "title": "" }, { "docid": "5d38d27b03d7d5e80b2efc19090d4fd9", "score": "0.7512164", "text": "func (*OpenconfigLldp_Lldp_Interfaces_Interface) IsYANGGoStruct() {}", "title": "" }, { "docid": "813049c86ca1aa8bea05271720a14de9", "score": "0.75074846", "text": "func (*NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_AsExternalLsa) IsYANGGoStruct() {}", "title": "" }, { "docid": "813049c86ca1aa8bea05271720a14de9", "score": "0.75074846", "text": "func (*NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_AsExternalLsa) IsYANGGoStruct() {}", "title": "" }, { "docid": "e098cd1cc5434861d5d02568e69b2fdb", "score": "0.75051576", "text": "func (*NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa) IsYANGGoStruct() {}", "title": "" }, { "docid": "e098cd1cc5434861d5d02568e69b2fdb", "score": "0.75051576", "text": "func (*NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa) IsYANGGoStruct() {}", "title": "" }, { "docid": "cc3ee236b39903904d75d3f1a697a134", "score": "0.7499594", "text": "func (*Mpls_SignalingProtocols_RsvpTe_Session) IsYANGGoStruct() {}", "title": "" }, { "docid": "cc3ee236b39903904d75d3f1a697a134", "score": "0.7499434", "text": "func (*Mpls_SignalingProtocols_RsvpTe_Session) IsYANGGoStruct() {}", "title": "" }, { "docid": "8218cc5b10d933a4511456a35598c356", "score": "0.7495011", "text": "func (*OpenconfigLldp_Lldp_Config) IsYANGGoStruct() {}", "title": "" }, { "docid": "49917da442ae31741eada2cd2635b001", "score": "0.7493497", "text": "func (*OpenconfigLldp_Lldp_Interfaces_Interface_Config) IsYANGGoStruct() {}", "title": "" }, { "docid": "06ea6e7efbe1529875ea27c8a3aaf8ef", "score": "0.74916786", "text": "func (*Mpls_SignalingProtocols_RsvpTe_Global) IsYANGGoStruct() {}", "title": "" }, { "docid": "9f9a81bcdb27530e96a904cb2b3f3e39", "score": "0.74910474", "text": "func (*NetworkInstance_Mpls_SignalingProtocols_Ldp) IsYANGGoStruct() {}", "title": "" }, { "docid": "06ea6e7efbe1529875ea27c8a3aaf8ef", "score": "0.7490532", "text": "func (*Mpls_SignalingProtocols_RsvpTe_Global) IsYANGGoStruct() {}", "title": "" }, { "docid": "9f9a81bcdb27530e96a904cb2b3f3e39", "score": "0.74897563", "text": "func (*NetworkInstance_Mpls_SignalingProtocols_Ldp) IsYANGGoStruct() {}", "title": "" }, { "docid": "444e7d3bcc533902c94de580db117966", "score": "0.7486479", "text": "func (*NetworkInstance_Mpls_Global_Interface) IsYANGGoStruct() {}", "title": "" }, { "docid": "444e7d3bcc533902c94de580db117966", "score": "0.7486414", "text": "func (*NetworkInstance_Mpls_Global_Interface) IsYANGGoStruct() {}", "title": "" }, { "docid": "323ac88f6a2a5a723b4ca9c66345dd2d", "score": "0.74819684", "text": "func (*NetworkInstance_Protocol_Bgp_PeerGroup_Timers) IsYANGGoStruct() {}", "title": "" }, { "docid": "323ac88f6a2a5a723b4ca9c66345dd2d", "score": "0.74819684", "text": "func (*NetworkInstance_Protocol_Bgp_PeerGroup_Timers) IsYANGGoStruct() {}", "title": "" }, { "docid": "75c6d966b2c6e45a04c222ac8f000900", "score": "0.74808896", "text": "func (*NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_GraceLsa_Tlv_UnknownTlv) IsYANGGoStruct() {\n}", "title": "" }, { "docid": "75c6d966b2c6e45a04c222ac8f000900", "score": "0.74808896", "text": "func (*NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_GraceLsa_Tlv_UnknownTlv) IsYANGGoStruct() {\n}", "title": "" }, { "docid": "89027321e5800f3299a6b1c7f469013a", "score": "0.74799937", "text": "func (*NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Interface) IsYANGGoStruct() {}", "title": "" }, { "docid": "89027321e5800f3299a6b1c7f469013a", "score": "0.74799937", "text": "func (*NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Interface) IsYANGGoStruct() {}", "title": "" } ]
9caec8bc956bd4cbc2b9ece08e1874f9
GetResolutionStep returns a single step resolution, with its full content (output included)
[ { "docid": "a47783fab4a38031241d669e4c774b40", "score": "0.7742116", "text": "func GetResolutionStep(c *gin.Context, in *getResolutionStepIn) (*step.Step, error) {\n\tmetadata.AddActionMetadata(c, metadata.ResolutionID, in.PublicID)\n\n\tdbp, err := zesty.NewDBProvider(utask.DBName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tr, err := resolution.LoadFromPublicID(dbp, in.PublicID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tstep, ok := r.Steps[in.StepName]\n\tif !ok {\n\t\treturn nil, errors.NotFoundf(\"given stepName %q for this resolution\", in.StepName)\n\t}\n\n\tmetadata.AddActionMetadata(c, metadata.StepName, in.StepName)\n\n\tt, err := task.LoadFromID(dbp, r.TaskID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tmetadata.AddActionMetadata(c, metadata.TaskID, t.PublicID)\n\n\ttt, err := tasktemplate.LoadFromID(dbp, t.TemplateID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tmetadata.AddActionMetadata(c, metadata.TemplateName, tt.Name)\n\n\tadmin := auth.IsAdmin(c) == nil\n\trequester := auth.IsRequester(c, t) == nil\n\twatcher := auth.IsWatcher(c, t) == nil\n\tresolutionManager := auth.IsResolutionManager(c, tt, t, r) == nil\n\n\tif !admin && !requester && !watcher && !resolutionManager {\n\t\treturn nil, errors.Forbiddenf(\"Can't display resolution details\")\n\t}\n\n\tif !resolutionManager && !admin {\n\t\tr.ClearOutputs()\n\t}\n\n\tif !resolutionManager && !requester && !watcher {\n\t\tmetadata.SetSUDO(c)\n\t}\n\n\treturn step, nil\n}", "title": "" } ]
[ { "docid": "8dd63944e2393dcd8120f65a8a8bd053", "score": "0.6527012", "text": "func (o *HyperflexHealthCheckDefinition) GetResolution() string {\n\tif o == nil || o.Resolution == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Resolution\n}", "title": "" }, { "docid": "690c133c4c3020c36d6d34baecf734c5", "score": "0.6359591", "text": "func ResolutionFromSteps(steps int) Resolution {\n\tswitch steps {\n\tcase 32:\n\t\treturn 0\n\tcase 64:\n\t\treturn 1\n\tcase 128:\n\t\treturn 2\n\tcase 256:\n\t\treturn 3\n\tcase 512:\n\t\treturn 4\n\tcase 1024:\n\t\treturn 5\n\tcase 2048:\n\t\treturn 6\n\tdefault:\n\t\treturn 7\n\t}\n}", "title": "" }, { "docid": "e5c888e344af43da9b1e87bfc67125cd", "score": "0.6087338", "text": "func GetStep() int64 {\n\treturn step\n}", "title": "" }, { "docid": "e5c888e344af43da9b1e87bfc67125cd", "score": "0.6087338", "text": "func GetStep() int64 {\n\treturn step\n}", "title": "" }, { "docid": "e5c888e344af43da9b1e87bfc67125cd", "score": "0.6087338", "text": "func GetStep() int64 {\n\treturn step\n}", "title": "" }, { "docid": "1ca47de2d9081237b51e7ed5bcf9df39", "score": "0.60390884", "text": "func GetResolution(c *gin.Context, in *getResolutionIn) (*resolution.Resolution, error) {\n\tmetadata.AddActionMetadata(c, metadata.ResolutionID, in.PublicID)\n\n\tdbp, err := zesty.NewDBProvider(utask.DBName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tr, err := resolution.LoadFromPublicID(dbp, in.PublicID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tt, err := task.LoadFromID(dbp, r.TaskID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tmetadata.AddActionMetadata(c, metadata.TaskID, t.PublicID)\n\n\ttt, err := tasktemplate.LoadFromID(dbp, t.TemplateID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tmetadata.AddActionMetadata(c, metadata.TemplateName, tt.Name)\n\n\tadmin := auth.IsAdmin(c) == nil\n\trequester := auth.IsRequester(c, t) == nil\n\twatcher := auth.IsWatcher(c, t) == nil\n\tresolutionManager := auth.IsResolutionManager(c, tt, t, r) == nil\n\n\tif !admin && !requester && !watcher && !resolutionManager {\n\t\treturn nil, errors.Forbiddenf(\"Can't display resolution details\")\n\t}\n\n\tif !resolutionManager && !admin {\n\t\tr.ClearOutputs()\n\t}\n\n\tif !resolutionManager && !requester && !watcher {\n\t\tmetadata.SetSUDO(c)\n\t}\n\n\treturn r, nil\n}", "title": "" }, { "docid": "4031e9cbbe6c43edac456b4ee12c6c16", "score": "0.5987877", "text": "func (m *RuntimeManifest) ResolveStep(step *manifest.Step) error {\n\tmustache.AllowMissingVariables = false\n\tsourceData, err := m.buildSourceData()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"unable to build step template data\")\n\t}\n\n\tif m.Debug {\n\t\tfmt.Fprintf(m.Err, \"=== Step Data ===\\n%v\\n\", sourceData)\n\t}\n\n\tpayload, err := yaml.Marshal(step)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"invalid step data %v\", step)\n\t}\n\n\tif m.Debug {\n\t\tfmt.Fprintf(m.Err, \"=== Step Template ===\\n%v\\n\", string(payload))\n\t}\n\n\trendered, err := mustache.RenderRaw(string(payload), true, sourceData)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"unable to render step template %s\", string(payload))\n\t}\n\n\tif m.Debug {\n\t\tfmt.Fprintf(m.Err, \"=== Rendered Step ===\\n%s\\n\", rendered)\n\t}\n\n\terr = yaml.Unmarshal([]byte(rendered), step)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"invalid step yaml\\n%s\", rendered)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "89a948a4e61a35f5fcefedc00213386c", "score": "0.5870129", "text": "func UpdateResolutionStep(c *gin.Context, in *updateResolutionStepIn) error {\n\tmetadata.AddActionMetadata(c, metadata.ResolutionID, in.PublicID)\n\n\tdbp, err := zesty.NewDBProvider(utask.DBName)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := dbp.Tx(); err != nil {\n\t\treturn err\n\t}\n\n\tr, err := resolution.LoadLockedNoWaitFromPublicID(dbp, in.PublicID)\n\tif err != nil {\n\t\tdbp.Rollback()\n\t\treturn err\n\t}\n\n\tif _, ok := r.Steps[in.StepName]; !ok {\n\t\tdbp.Rollback()\n\t\treturn errors.NotFoundf(\"given stepName %q for this resolution\", in.StepName)\n\t}\n\n\tmetadata.AddActionMetadata(c, metadata.StepName, in.StepName)\n\n\tt, err := task.LoadFromID(dbp, r.TaskID)\n\tif err != nil {\n\t\tdbp.Rollback()\n\t\treturn err\n\t}\n\n\tmetadata.AddActionMetadata(c, metadata.TaskID, t.PublicID)\n\n\tif r.State != resolution.StatePaused {\n\t\tdbp.Rollback()\n\t\treturn errors.BadRequestf(\"Cannot update a resolution which is not in state '%s'\", resolution.StatePaused)\n\t}\n\n\tif err := auth.IsAdmin(c); err != nil {\n\t\tdbp.Rollback()\n\t\treturn err\n\t}\n\n\tmetadata.SetSUDO(c)\n\n\ttt, err := tasktemplate.LoadFromID(dbp, t.TemplateID)\n\tif err != nil {\n\t\tdbp.Rollback()\n\t\treturn err\n\t}\n\n\tmetadata.AddActionMetadata(c, metadata.TemplateName, tt.Name)\n\n\tr.Steps[in.StepName] = &in.Step\n\n\tif err := r.Steps[in.StepName].ValidAndNormalize(in.StepName, tt.BaseConfigurations, r.Steps); err != nil {\n\t\tdbp.Rollback()\n\t\treturn err\n\t}\n\n\tvalid, err := r.Steps[in.StepName].CheckIfValidState()\n\tif err != nil {\n\t\t_ = dbp.Rollback()\n\t\treturn err\n\t}\n\n\tif !valid {\n\t\t_ = dbp.Rollback()\n\t\treturn errors.NewBadRequest(nil, fmt.Sprintf(\"invalid state provided: %q is not allowed\", in.State))\n\t}\n\n\tlogrus.WithFields(logrus.Fields{\"resolution_id\": r.PublicID}).Debugf(\"Handler UpdateResolutionStep: manual update of resolution %s step %s\", r.PublicID, in.StepName)\n\n\tif err := r.Update(dbp); err != nil {\n\t\tdbp.Rollback()\n\t\treturn err\n\t}\n\n\treqUsername := auth.GetIdentity(c)\n\t_, err = task.CreateComment(dbp, t, reqUsername, \"manually updated resolution step \"+in.StepName)\n\tif err != nil {\n\t\tdbp.Rollback()\n\t\treturn err\n\t}\n\n\tif err := dbp.Commit(); err != nil {\n\t\tdbp.Rollback()\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f10d599f66d9f7f240ccdd6520f28b92", "score": "0.5681321", "text": "func GetResolution(file string) (int, int, error) {\n\tcmd := fmt.Sprintln(config.FFPROBE + \" -v error -show_entries stream=width,height -of default=noprint_wrappers=1:nokey=1 \" + file)\n\n\tout, err := exec.Command(\"bash\", \"-c\", cmd).CombinedOutput()\n\n\tsize := len(out)\n\t//log.Println(\"Get Width And Height\")\n\n\n\tif err != nil && size == 10 {\n\t\treturn 0, 0, err\n\t} else {\n\n\t\twidthStr := string(out[:4])\n\t\t//log.Printf(\"Width Raw: %s \\n\", widthStr)\n\t\twidth, _ := strconv.Atoi(widthStr)\n\t\t//log.Println(\"Width String\")\n\n\n\t\theightStr := string(out[5:9])\n\t\t//log.Printf(\"Height Raw : %s \\n\", heightStr)\n\t\theight, _ := strconv.Atoi(heightStr)\n\t\t//log.Printf(\"Height : %d \\n\", height)\n\n\n\t\tif height == 0 || width == 0 {\n\t\t\theight = 1080\n\t\t\twidth = 1960\n\t\t}\n\n\t\treturn width, height, nil\n\t}\n}", "title": "" }, { "docid": "e7b26453e24e69aad55e31337381b628", "score": "0.54789454", "text": "func (re *ApiLoop) minResolution(start int64, end int64, cur_step uint32) uint32 {\n\n\tuse_min := cur_step\n\tif DEFAULT_MIN_RESOLUTION > use_min {\n\t\tuse_min = DEFAULT_MIN_RESOLUTION\n\t}\n\tcur_pts := uint32(end-start) / use_min\n\n\tif re.Metrics == nil {\n\t\tif cur_pts > MAX_METRIC_POINTS {\n\t\t\treturn uint32(end-start) / MAX_METRIC_POINTS\n\t\t}\n\t\treturn use_min\n\t}\n\treturn use_min\n}", "title": "" }, { "docid": "9ca47c980f783564e4f60cada7bca7ce", "score": "0.5447312", "text": "func h3GetResolution(h H3Index) int { return H3_GET_RESOLUTION(h) }", "title": "" }, { "docid": "3786171547d319acedaf94e5618f9643", "score": "0.53627354", "text": "func (o *HyperflexHealthCheckDefinition) GetResolutionOk() (*string, bool) {\n\tif o == nil || o.Resolution == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Resolution, true\n}", "title": "" }, { "docid": "19105c475c6afe9fcf78c1896d59ac28", "score": "0.53416526", "text": "func (o *Animation) GetStep() float64 {\n\tlog.Println(\"Calling Animation.GetStep()\")\n\n\t// Build out the method's arguments\n\tgoArguments := make([]reflect.Value, 0, 0)\n\n\t// Call the parent method.\n\n\tgoRet := o.callParentMethod(o.baseClass(), \"get_step\", goArguments, \"float64\")\n\n\treturnValue := goRet.Interface().(float64)\n\n\tlog.Println(\" Got return value: \", returnValue)\n\treturn returnValue\n\n}", "title": "" }, { "docid": "1517a1ce6644024130e3537180064a05", "score": "0.53307784", "text": "func (ms *mountContext) ResolveStep(ctx *context.T, call rpc.ServerCall) (entry naming.MountEntry, err error) {\n\tif ms.logLevel >= 2 {\n\t\tctx.Infof(\"ResolveStep %q\", ms.name)\n\t} else {\n\t\tctx.VI(2).Infof(\"ResolveStep %q\", ms.name)\n\t}\n\tmt, cc := ms.newCallContext(ctx, call.Security(), !createMissingNodes)\n\t// Find the next mount point for the name.\n\tn, elems, werr := mt.findMountPoint(cc, ms.elems)\n\tif werr != nil {\n\t\terr = werr\n\t\treturn\n\t}\n\tif n == nil {\n\t\tentry.Name = ms.name\n\t\tif len(ms.elems) == 0 {\n\t\t\terr = naming.ErrNoSuchNameRoot.Errorf(ctx, \"namespace root name %s doesn't exist\", ms.name)\n\t\t} else {\n\t\t\terr = naming.ErrNoSuchName.Errorf(ctx, \"name %s doesn't exist\", ms.name)\n\t\t}\n\t\treturn\n\t}\n\tn.parent.Unlock()\n\tdefer n.Unlock()\n\tentry.Servers = n.mount.servers.copyToSlice()\n\tentry.Name = strings.Join(elems, \"/\")\n\tentry.ServesMountTable = n.mount.mt\n\tentry.IsLeaf = n.mount.leaf\n\treturn\n}", "title": "" }, { "docid": "adf2f0c0265ad382bcd657c5dc63f81a", "score": "0.53205764", "text": "func (o *Physics2DDirectBodyState) GetStep() float64 {\n\tlog.Println(\"Calling Physics2DDirectBodyState.GetStep()\")\n\n\t// Build out the method's arguments\n\tgoArguments := make([]reflect.Value, 0, 0)\n\n\t// Call the parent method.\n\n\tgoRet := o.callParentMethod(o.baseClass(), \"get_step\", goArguments, \"float64\")\n\n\treturnValue := goRet.Interface().(float64)\n\n\tlog.Println(\" Got return value: \", returnValue)\n\treturn returnValue\n\n}", "title": "" }, { "docid": "f2ff3ddc85383bcc0f615c9ced8b2146", "score": "0.5276777", "text": "func (w *World) Step() int64 {\n\treturn w.step\n}", "title": "" }, { "docid": "1f795896dd9241d77d9a865c8acf523b", "score": "0.52088976", "text": "func (u *UI) Resolution() image.Point {\n\treturn u.screenResolution\n}", "title": "" }, { "docid": "2c40ce9a4e0ced044834e292b5282acd", "score": "0.52006704", "text": "func (o *HyperflexHealthCheckDefinition) SetResolution(v string) {\n\to.Resolution = &v\n}", "title": "" }, { "docid": "937773487fafb4026981e526664445da", "score": "0.51938564", "text": "func (s *solution) Steps() string {\n\treturn s.text\n}", "title": "" }, { "docid": "42b2efbcee56fa6355418162193fdb7c", "score": "0.51681805", "text": "func (r *Itinerary) GetStepForPhase(phaseName string) string {\n\tfor _, phase := range r.Phases {\n\t\tif phaseName == phase.Name {\n\t\t\treturn phase.Step\n\t\t}\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "52760bdeb47849b108af40ef61f71b9c", "score": "0.5143636", "text": "func (m *AuthenticationDetail) GetAuthenticationStepRequirement()(*string) {\n val, err := m.GetBackingStore().Get(\"authenticationStepRequirement\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "title": "" }, { "docid": "1e954fbb84a1637514c44acd777b8da2", "score": "0.512589", "text": "func (o *SyntheticsStepDetail) GetStepId() int64 {\n\tif o == nil || o.StepId == nil {\n\t\tvar ret int64\n\t\treturn ret\n\t}\n\treturn *o.StepId\n}", "title": "" }, { "docid": "25bddcd0d00e94e237907497dce19e07", "score": "0.5051607", "text": "func (p *provisioner) GetStep(name string) (ProvisioningStep, bool) {\n\tstep, ok := p.steps[name]\n\treturn step, ok\n}", "title": "" }, { "docid": "c492391e07fd8b12ad496ddc5f2a8bde", "score": "0.50467503", "text": "func (m *GCMessage) GetStep() int {\n\treturn int(m.SignedCredential.Message.Credential.Step)\n}", "title": "" }, { "docid": "00fa69435ebbbc5e83be6be15900839f", "score": "0.5014084", "text": "func (o ApplicationScalingRuleScalingRuleMetricScaleDownRulesPtrOutput) Step() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *ApplicationScalingRuleScalingRuleMetricScaleDownRules) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Step\n\t}).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "562daa275f321e328580df3f9b417033", "score": "0.49549302", "text": "func (m *Matrix) Resolution() int {\n\treturn m.res\n}", "title": "" }, { "docid": "324f1b13aec6c9f5e93875af95281d6f", "score": "0.4950778", "text": "func (o GetApplicationScalingRulesRuleScalingRuleMetricScaleDownRuleOutput) Step() pulumi.IntOutput {\n\treturn o.ApplyT(func(v GetApplicationScalingRulesRuleScalingRuleMetricScaleDownRule) int { return v.Step }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "a7e957d1c5e25b90b20e37532d625e8e", "score": "0.49325702", "text": "func (o GoogleCloudDialogflowCxV3RolloutStatePtrOutput) Step() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *GoogleCloudDialogflowCxV3RolloutState) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Step\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "a251356feaafb4c72704b718a0db1aec", "score": "0.49065852", "text": "func H3_GET_RESOLUTION(h3 H3Index) int { return int((h3 & H3_RES_MASK) >> H3_RES_OFFSET) }", "title": "" }, { "docid": "acd9a92b49fc07c45f0782b6ffc4935b", "score": "0.4902328", "text": "func (o ApplicationScalingRuleScalingRuleMetricScaleUpRulesPtrOutput) Step() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *ApplicationScalingRuleScalingRuleMetricScaleUpRules) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Step\n\t}).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "5aaa37186ed8622eac0fc978afbf5d16", "score": "0.48935023", "text": "func NewResolution(res string) (*Resolution, error) {\n\tss := strings.Split(res, \"x\")\n\tif len(ss) != 2 {\n\t\treturn nil, ErrInvalidResolution\n\t}\n\n\tx, err := strconv.Atoi(ss[0])\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ty, err := strconv.Atoi(ss[1])\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Resolution{\n\t\tX: x,\n\t\tY: y,\n\t}, nil\n}", "title": "" }, { "docid": "653098f129ce6a9186b3a660d3a02099", "score": "0.48908427", "text": "func Resolution(zoomlevel, extent int) float64 {\n\treturn 360 / (math.Pow(2, float64(zoomlevel)) * float64(extent))\n}", "title": "" }, { "docid": "a571d977a12c5c44e221aee79eef6082", "score": "0.48825878", "text": "func (o GoogleCloudDialogflowCxV3RolloutStateOutput) Step() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v GoogleCloudDialogflowCxV3RolloutState) *string { return v.Step }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "bd113c35043434ce645ced707abe5d3e", "score": "0.48771486", "text": "func (o GetApplicationScalingRulesRuleScalingRuleMetricScaleUpRuleOutput) Step() pulumi.IntOutput {\n\treturn o.ApplyT(func(v GetApplicationScalingRulesRuleScalingRuleMetricScaleUpRule) int { return v.Step }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "ecd99bb2e344b8c88075ba222365307b", "score": "0.48674557", "text": "func UpdateResolution(c *gin.Context, in *updateResolutionIn) error {\n\tmetadata.AddActionMetadata(c, metadata.ResolutionID, in.PublicID)\n\n\tdbp, err := zesty.NewDBProvider(utask.DBName)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := dbp.Tx(); err != nil {\n\t\treturn err\n\t}\n\n\tr, err := resolution.LoadLockedNoWaitFromPublicID(dbp, in.PublicID)\n\tif err != nil {\n\t\tdbp.Rollback()\n\t\treturn err\n\t}\n\n\tt, err := task.LoadFromID(dbp, r.TaskID)\n\tif err != nil {\n\t\tdbp.Rollback()\n\t\treturn err\n\t}\n\n\tmetadata.AddActionMetadata(c, metadata.TaskID, t.PublicID)\n\n\ttt, err := tasktemplate.LoadFromID(dbp, t.TemplateID)\n\tif err != nil {\n\t\t_ = dbp.Rollback()\n\t\treturn err\n\t}\n\n\tmetadata.AddActionMetadata(c, metadata.TemplateName, tt.Name)\n\n\tif r.State != resolution.StatePaused {\n\t\tdbp.Rollback()\n\t\treturn errors.BadRequestf(\"Cannot update a resolution which is not in state '%s'\", resolution.StatePaused)\n\t}\n\n\tif err := auth.IsAdmin(c); err != nil {\n\t\tdbp.Rollback()\n\t\treturn err\n\t}\n\n\tmetadata.SetSUDO(c)\n\n\tif in.Steps != nil {\n\t\tr.Steps = in.Steps\n\n\t\ttt, err := tasktemplate.LoadFromID(dbp, t.TemplateID)\n\t\tif err != nil {\n\t\t\t_ = dbp.Rollback()\n\t\t\treturn err\n\t\t}\n\n\t\t// valid and normalize steps\n\t\tfor name, st := range r.Steps {\n\t\t\tif err := st.ValidAndNormalize(name, tt.BaseConfigurations, r.Steps); err != nil {\n\t\t\t\t_ = dbp.Rollback()\n\t\t\t\treturn errors.NewNotValid(err, fmt.Sprintf(\"invalid step %s\", name))\n\t\t\t}\n\n\t\t\tvalid, err := st.CheckIfValidState()\n\t\t\tif err != nil {\n\t\t\t\t_ = dbp.Rollback()\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tif !valid {\n\t\t\t\t_ = dbp.Rollback()\n\t\t\t\treturn errors.NewBadRequest(nil, fmt.Sprintf(\"step %q: invalid state provided: %q is not allowed\", name, st.State))\n\t\t\t}\n\t\t}\n\t}\n\n\tif in.ResolverInputs != nil {\n\t\tr.SetInput(in.ResolverInputs)\n\t}\n\n\tlogrus.WithFields(logrus.Fields{\"resolution_id\": r.PublicID}).Debugf(\"Handler UpdateResolution: manual update of resolution %s\", r.PublicID)\n\n\tif err := r.Update(dbp); err != nil {\n\t\tdbp.Rollback()\n\t\treturn err\n\t}\n\n\treqUsername := auth.GetIdentity(c)\n\t_, err = task.CreateComment(dbp, t, reqUsername, \"manually updated resolution\")\n\tif err != nil {\n\t\tdbp.Rollback()\n\t\treturn err\n\t}\n\n\tif err := dbp.Commit(); err != nil {\n\t\tdbp.Rollback()\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "81099fe23e75282384d2eb63a0780de3", "score": "0.4862117", "text": "func (o ApplicationScalingRuleScalingRuleMetricScaleDownRulesOutput) Step() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v ApplicationScalingRuleScalingRuleMetricScaleDownRules) *int { return v.Step }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "4373e61ce924febbf79bd8b8318c5fe7", "score": "0.4837314", "text": "func (m *AuthenticationDetail) GetAuthenticationStepResultDetail()(*string) {\n val, err := m.GetBackingStore().Get(\"authenticationStepResultDetail\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "title": "" }, { "docid": "4fd08b3ced824ffd85b58f42e211a7ce", "score": "0.48075658", "text": "func (o GoogleCloudDialogflowCxV3RolloutStateResponseOutput) Step() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GoogleCloudDialogflowCxV3RolloutStateResponse) string { return v.Step }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "3dbcee2ea2fb33e766f3011bc712a288", "score": "0.48071826", "text": "func UpdateResolutionStepState(c *gin.Context, in *updateResolutionStepStateIn) error {\n\tmetadata.AddActionMetadata(c, metadata.ResolutionID, in.PublicID)\n\tmetadata.AddActionMetadata(c, metadata.StepName, in.StepName)\n\n\tdbp, err := zesty.NewDBProvider(utask.DBName)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := dbp.Tx(); err != nil {\n\t\treturn err\n\t}\n\n\tr, err := resolution.LoadLockedNoWaitFromPublicID(dbp, in.PublicID)\n\tif err != nil {\n\t\tdbp.Rollback()\n\t\treturn err\n\t}\n\n\tif _, ok := r.Steps[in.StepName]; !ok {\n\t\tdbp.Rollback()\n\t\treturn errors.NotFoundf(\"given stepName %q for this resolution\", in.StepName)\n\t}\n\n\tt, err := task.LoadFromID(dbp, r.TaskID)\n\tif err != nil {\n\t\tdbp.Rollback()\n\t\treturn err\n\t}\n\n\tmetadata.AddActionMetadata(c, metadata.TaskID, t.PublicID)\n\n\tif r.State != resolution.StatePaused {\n\t\tdbp.Rollback()\n\t\treturn errors.BadRequestf(\"Cannot update a resolution which is not in state '%s'\", resolution.StatePaused)\n\t}\n\n\ttt, err := tasktemplate.LoadFromID(dbp, t.TemplateID)\n\tif err != nil {\n\t\tdbp.Rollback()\n\t\treturn err\n\t}\n\n\tmetadata.AddActionMetadata(c, metadata.TemplateName, tt.Name)\n\n\tadmin := auth.IsAdmin(c) == nil\n\tresolutionManager := auth.IsTemplateOwner(c, tt) == nil\n\n\tif !admin && !resolutionManager {\n\t\tdbp.Rollback()\n\t\treturn errors.Forbiddenf(\"Can't update resolution step state\")\n\t} else if !resolutionManager {\n\t\tmetadata.SetSUDO(c)\n\t}\n\n\ts := r.Steps[in.StepName]\n\toldState := s.State\n\ts.State = in.State\n\n\tvalid, err := s.CheckIfValidState()\n\tif err != nil {\n\t\tdbp.Rollback()\n\t\treturn err\n\t}\n\n\tif !valid {\n\t\tdbp.Rollback()\n\t\treturn errors.NewBadRequest(nil, fmt.Sprintf(\"invalid state provided: %q is not allowed\", in.State))\n\t}\n\n\tlogrus.WithFields(logrus.Fields{\"resolution_id\": r.PublicID}).Debugf(\"Handler UpdateResolutionStepState: manual update of resolution %s step %s state switched from %s to %s\", r.PublicID, in.StepName, oldState, in.State)\n\tmetadata.AddActionMetadata(c, metadata.OldState, oldState)\n\tmetadata.AddActionMetadata(c, metadata.NewState, s.State)\n\n\tif err := r.Update(dbp); err != nil {\n\t\tdbp.Rollback()\n\t\treturn err\n\t}\n\n\treqUsername := auth.GetIdentity(c)\n\t_, err = task.CreateComment(dbp, t, reqUsername, \"manually updated resolution step \"+in.StepName+\" state from \"+oldState+\" to \"+in.State)\n\tif err != nil {\n\t\tdbp.Rollback()\n\t\treturn err\n\t}\n\n\tif err := dbp.Commit(); err != nil {\n\t\tdbp.Rollback()\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "43f4230c806c4c00ed3fa45fc0c8827f", "score": "0.47568136", "text": "func (v *SpecValidator) Step(s *gauge.Step) {\n\tif s.IsConcept {\n\t\tfor _, c := range s.ConceptSteps {\n\t\t\tv.Step(c)\n\t\t}\n\t\treturn\n\t}\n\tval, ok := v.stepValidationCache[s.Value]\n\tif !ok {\n\t\terr := v.validateStep(s)\n\t\tif err != nil {\n\t\t\tv.validationErrors = append(v.validationErrors, err)\n\t\t}\n\t\tv.stepValidationCache[s.Value] = err\n\t\treturn\n\t}\n\tif val != nil {\n\t\tvalErr := val.(StepValidationError)\n\t\tif s.Parent == nil {\n\t\t\tv.validationErrors = append(v.validationErrors,\n\t\t\t\tNewStepValidationError(s, valErr.message, v.specification.FileName, valErr.errorType, valErr.suggestion))\n\t\t} else {\n\t\t\tcpt := v.conceptsDictionary.Search(s.Parent.Value)\n\t\t\tv.validationErrors = append(v.validationErrors,\n\t\t\t\tNewStepValidationError(s, valErr.message, cpt.FileName, valErr.errorType, valErr.suggestion))\n\t\t}\n\t}\n}", "title": "" }, { "docid": "960cd78117a68c7b0eb44d0359481cb0", "score": "0.47554588", "text": "func (p *Pattern) StepSize() uint64 {\n\tswitch p.Grid {\n\tcase One4:\n\t\treturn uint64(p.PPQN)\n\tcase One8:\n\t\treturn uint64(p.PPQN / 2)\n\tcase One16:\n\t\treturn uint64(p.PPQN / 4)\n\tcase One32:\n\t\treturn uint64(p.PPQN / 8)\n\tcase One64:\n\t\treturn uint64(p.PPQN / 16)\n\t}\n\treturn 0\n}", "title": "" }, { "docid": "2bbe6ba664e4a4343e60b527dd0bfe49", "score": "0.47445384", "text": "func (u *Udemy) getVideoResolution() {\n\tvar resolution string\n\tfmt.Print(\"[?] : Enter the video Resolution(360/480/720/1080): \")\n\tfmt.Scanln(&resolution)\n\tu.Resolution = resolution\n}", "title": "" }, { "docid": "201135e80c1fc13ff4b5c36385c1abfe", "score": "0.47380763", "text": "func (o ApplicationScalingRuleScalingRuleMetricScaleUpRulesOutput) Step() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v ApplicationScalingRuleScalingRuleMetricScaleUpRules) *int { return v.Step }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "b12e1bb0d5f27fecc6333c3f7c162e1c", "score": "0.46953475", "text": "func GetH264Resolution(sps []byte) (width uint32, height uint32) {\n start, sc := FindStartCode(sps, 0)\n bs := NewBitStream(sps[start+int(sc)+1:])\n var s SPS\n s.Decode(bs)\n\n widthInSample := (uint32(s.Pic_width_in_mbs_minus1) + 1) * 16\n widthCrop := uint32(s.Frame_crop_left_offset)*2 - uint32(s.Frame_crop_right_offset)*2\n width = widthInSample - widthCrop\n\n heightInSample := ((2 - uint32(s.Frame_mbs_only_flag)) * (uint32(s.Pic_height_in_map_units_minus1) + 1) * 16)\n heightCrop := uint32(s.Frame_crop_bottom_offset)*2 - uint32(s.Frame_crop_top_offset)*2\n height = heightInSample - heightCrop\n\n return\n}", "title": "" }, { "docid": "60b8599ce33eed8f13bfd70257f73027", "score": "0.46739268", "text": "func getFinalStep(steps []*Step) *Step {\n\tfinalStep := steps[len(steps)-1]\n\tif finalStep.T == StepTypeAgent || finalStep.T == StepTypeJobSet {\n\t\treturn finalStep\n\t} else if finalStep.T == StepTypeConcurrent {\n\t\treturn getFinalStep(finalStep.ConcurrentSteps)\n\t} else {\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "cf45a6e593abfe0536d0dd1416dbffa1", "score": "0.46687955", "text": "func (o *SyntheticsStepDetail) GetDuration() float64 {\n\tif o == nil || o.Duration == nil {\n\t\tvar ret float64\n\t\treturn ret\n\t}\n\treturn *o.Duration\n}", "title": "" }, { "docid": "6272d3d48dbe16e2b1daadc4c7daecdc", "score": "0.46579573", "text": "func (k *KhoriumManager) GetKhoriumStep(ctx context.Context, name string) (*common.KhoriumStep, error) {\n\tvar (\n\t\tkhoriumName string\n\t\tkhoriumVersion string\n\t)\n\n\tps := strings.SplitN(name, \"@\", 2)\n\tif len(ps) == 2 {\n\t\tkhoriumName = ps[0]\n\t\tkhoriumVersion = ps[1]\n\t} else {\n\t\tkhoriumName = name\n\t\tkhoriumVersion = \"master\"\n\t}\n\n\tdir, err := ioutil.TempDir(\"\", \"phistage-khoriumstep-*\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer os.RemoveAll(dir)\n\n\tif err := k.cloneRepository(ctx, khoriumName, khoriumVersion, dir); err != nil {\n\t\treturn nil, err\n\t}\n\treturn k.loadKhoriumStepFromFilesystem(dir)\n}", "title": "" }, { "docid": "3a7805f28c16aa350f9021e12054385f", "score": "0.46379387", "text": "func nvmlVgpuTypeGetResolution(VgpuTypeId VgpuTypeId, DisplayIndex uint32, Xdim *uint32, Ydim *uint32) Return {\n\tcVgpuTypeId, _ := (C.nvmlVgpuTypeId_t)(VgpuTypeId), cgoAllocsUnknown\n\tcDisplayIndex, _ := (C.uint)(DisplayIndex), cgoAllocsUnknown\n\tcXdim, _ := (*C.uint)(unsafe.Pointer(Xdim)), cgoAllocsUnknown\n\tcYdim, _ := (*C.uint)(unsafe.Pointer(Ydim)), cgoAllocsUnknown\n\t__ret := C.nvmlVgpuTypeGetResolution(cVgpuTypeId, cDisplayIndex, cXdim, cYdim)\n\t__v := (Return)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "be897fdb665b5346543d8c8ff02b1e75", "score": "0.46337208", "text": "func (r *Rectification) Wait() DiffResolution {\n\t<-r.done\n\treturn r.Resolution\n}", "title": "" }, { "docid": "7b426d35aea829ae2c32e7b72eb8e43f", "score": "0.46095297", "text": "func (se *SeriesEnvelope) Step() time.Duration {\n\treturn se.StepDuration\n}", "title": "" }, { "docid": "d3a241f6a517d09aa94c4d749c97f767", "score": "0.46070048", "text": "func (g Game) Step() int {\n\treturn g.step\n}", "title": "" }, { "docid": "6cfcf9b4b8d6137bc26a33c948de231d", "score": "0.45970204", "text": "func (o ScaledObjectSpecJobTargetRefTemplateSpecContainersLifecyclePostStartHttpGetOutput) Port() ScaledObjectSpecJobTargetRefTemplateSpecContainersLifecyclePostStartHttpGetPortOutput {\n\treturn o.ApplyT(func(v ScaledObjectSpecJobTargetRefTemplateSpecContainersLifecyclePostStartHttpGet) ScaledObjectSpecJobTargetRefTemplateSpecContainersLifecyclePostStartHttpGetPort {\n\t\treturn v.Port\n\t}).(ScaledObjectSpecJobTargetRefTemplateSpecContainersLifecyclePostStartHttpGetPortOutput)\n}", "title": "" }, { "docid": "ebc0c99ffbf6e66300b157076eec8cc0", "score": "0.45859274", "text": "func (m *mockEMRAPISteps) DescribeStep(input *emr.DescribeStepInput) (*emr.DescribeStepOutput, error) {\n\tif !strings.HasPrefix(*input.ClusterId, \"j-\") {\n\t\treturn nil, errors.New(\"DescribeStep failed\")\n\t}\n\tvar state string\n\tvar states = []string{\"PENDING\", \"CANCEL_PENDING\", \"RUNNING\", \"COMPLETED\", \"CANCELLED\",\n\t\t\"FAILED\", \"INTERRUPTED\"}\n\tfor _, e := range states {\n\t\tif strings.Contains(*input.ClusterId, e) {\n\t\t\tstate = e\n\t\t\tbreak\n\t\t}\n\t}\n\tif state == \"\" {\n\t\treturn nil, errors.New(\"DescribeStep failed\")\n\t}\n\ttestTime := time.Date(2019, time.October, 10, 23, 0, 0, 0, time.UTC)\n\treturn &emr.DescribeStepOutput{\n\t\tStep: &emr.Step{\n\t\t\tName: aws.String(\"step\"),\n\t\t\tId: aws.String(\"step-id\"),\n\t\t\tStatus: &emr.StepStatus{\n\t\t\t\tState: aws.String(state),\n\t\t\t\tTimeline: &emr.StepTimeline{\n\t\t\t\t\tStartDateTime: &testTime,\n\t\t\t\t\tEndDateTime: &testTime,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}, nil\n}", "title": "" }, { "docid": "071d65fe828d13227ea94e6ec6271ba3", "score": "0.45648462", "text": "func (dt *DefaultTimer) Step() <-chan uint64 {\n\treturn dt.absolute\n}", "title": "" }, { "docid": "92db1ca02977e6d3c7004f9dc84dbd10", "score": "0.45603725", "text": "func (t *TaskStepProperties) GetTaskStepProperties() *TaskStepProperties { return t }", "title": "" }, { "docid": "169e3eb9c46174a08f75166d1c047ec4", "score": "0.45593342", "text": "func (o *SyntheticsStepDetail) GetType() SyntheticsStepType {\n\tif o == nil || o.Type == nil {\n\t\tvar ret SyntheticsStepType\n\t\treturn ret\n\t}\n\treturn *o.Type\n}", "title": "" }, { "docid": "eda450cf542e52b84904fe753abdc66b", "score": "0.45448264", "text": "func (pv *Playlist_Video) QueryResolution() *ResolutionQuery {\n\treturn (&Playlist_VideoClient{config: pv.config}).QueryResolution(pv)\n}", "title": "" }, { "docid": "7ccee84601952e32f64620e29745d09b", "score": "0.45210513", "text": "func (v NullableSyntheticsAPIStepSubtype) Get() *SyntheticsAPIStepSubtype {\n\treturn v.value\n}", "title": "" }, { "docid": "5fcbea3fb41dd773e1bed7a455f34af2", "score": "0.4519589", "text": "func (o DatascanExecutionSpecOutput) Field() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v DatascanExecutionSpec) *string { return v.Field }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "fa6b6e8ee5e627139e3eb5113810395c", "score": "0.4507011", "text": "func (o ScaledObjectSpecJobTargetRefTemplateSpecContainersLifecyclePostStartHttpGetPtrOutput) Port() ScaledObjectSpecJobTargetRefTemplateSpecContainersLifecyclePostStartHttpGetPortPtrOutput {\n\treturn o.ApplyT(func(v *ScaledObjectSpecJobTargetRefTemplateSpecContainersLifecyclePostStartHttpGet) *ScaledObjectSpecJobTargetRefTemplateSpecContainersLifecyclePostStartHttpGetPort {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Port\n\t}).(ScaledObjectSpecJobTargetRefTemplateSpecContainersLifecyclePostStartHttpGetPortPtrOutput)\n}", "title": "" }, { "docid": "23951a87fe282f0e583e153027155532", "score": "0.44996306", "text": "func ParseResolution(s string) (image.Rectangle, error) {\n\tparts := strings.Split(s, _resolutionSeparator)\n\tif len(parts) != 2 {\n\t\treturn image.Rectangle{}, fmt.Errorf(\"failed to parse resolution: %s. Expected format <width>x<height>\", s)\n\t}\n\twidth, err := strconv.Atoi(parts[0])\n\tif err != nil {\n\t\treturn image.Rectangle{}, fmt.Errorf(\"width: %s has an invalid value. Expected an integer\", parts[0])\n\t}\n\theight, err := strconv.Atoi(parts[1])\n\tif err != nil {\n\t\treturn image.Rectangle{}, fmt.Errorf(\"height: %s has an invalid value. Expected an integer\", parts[1])\n\t}\n\treturn image.Rect(0, 0, width, height), nil\n}", "title": "" }, { "docid": "928193c585a33a0d4f730c561e59a71f", "score": "0.44988975", "text": "func (x *UserProfileMsg) GetUserWalkingStepLengthScaled() float64 {\n\tif x.UserWalkingStepLength == 0xFFFF {\n\t\treturn math.NaN()\n\t}\n\treturn float64(x.UserWalkingStepLength) / 1000\n}", "title": "" }, { "docid": "1da63114c827aad2b34f981025ac43f0", "score": "0.44942483", "text": "func (graph *dependencyGraph) getNextStep() (string, bool) {\n\tif len(graph.stepsReadyToBuild) == 0 {\n\t\treturn \"\", false\n\t}\n\telement := heap.Pop(&graph.stepsReadyToBuild).(util.HeapElement)\n\treturn element.Value, true\n}", "title": "" }, { "docid": "ab0e6d8209142170d65cebb8af3b2ed5", "score": "0.44826055", "text": "func (r *Resolution) String() string {\n\treturn fmt.Sprintf(\"%dx%d\", r.X, r.Y)\n}", "title": "" }, { "docid": "72da8c23d853213028ccc6a7194e2f19", "score": "0.44812572", "text": "func (o *SyntheticsStepDetail) GetDescription() string {\n\tif o == nil || o.Description == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Description\n}", "title": "" }, { "docid": "ffbcd87b2c2f8bbc40a58d892b492e1f", "score": "0.446462", "text": "func (m *ProvisioningObjectSummary) GetProvisioningSteps()([]ProvisioningStepable) {\n return m.provisioningSteps\n}", "title": "" }, { "docid": "e2cf79af99e596143ff5acb3c94b0358", "score": "0.4455727", "text": "func (m *PrintTask) GetDefinition()(PrintTaskDefinitionable) {\n return m.definition\n}", "title": "" }, { "docid": "c5ef0acd770c8bca99044568c38d8b32", "score": "0.44233057", "text": "func (o DatascanExecutionSpecPtrOutput) Field() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *DatascanExecutionSpec) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Field\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "e6ba40c0b11aa5ed3907132b96bea12e", "score": "0.44228387", "text": "func (t *TestingTool) GetSteps() time.Duration {\n\treturn t.Steps\n}", "title": "" }, { "docid": "b7b13584bb0b6c989f13e789b02a5628", "score": "0.44141176", "text": "func (o ScaledObjectSpecJobTargetRefTemplateSpecInitContainersLifecyclePostStartHttpGetOutput) Port() ScaledObjectSpecJobTargetRefTemplateSpecInitContainersLifecyclePostStartHttpGetPortOutput {\n\treturn o.ApplyT(func(v ScaledObjectSpecJobTargetRefTemplateSpecInitContainersLifecyclePostStartHttpGet) ScaledObjectSpecJobTargetRefTemplateSpecInitContainersLifecyclePostStartHttpGetPort {\n\t\treturn v.Port\n\t}).(ScaledObjectSpecJobTargetRefTemplateSpecInitContainersLifecyclePostStartHttpGetPortOutput)\n}", "title": "" }, { "docid": "fc9d5cfbe5c11afb21efaa3e53bf7bf4", "score": "0.44088712", "text": "func take_step(steps int, dir string, x int, y int) (int, int) {\n\tif dir == \"N\" {\n\t\ty = y + steps\n\t} else if dir == \"S\" {\n\t\ty = y - steps\n\t} else if dir == \"E\" {\n\t\tx = x + steps\n\t} else {\n\t\tx = x - steps\n\t}\n\n\treturn x, y\n}", "title": "" }, { "docid": "00adecfc9c8a45e4264a073cf7728e0d", "score": "0.4395746", "text": "func (c *client) GetStepLog(id int64) (*library.Log, error) {\n\tlogrus.Tracef(\"Getting log for step %d from the database\", id)\n\n\t// variable to store query results\n\tl := new(database.Log)\n\n\t// send query to the database and store result in variable\n\terr := c.Database.\n\t\tTable(constants.TableLog).\n\t\tRaw(c.DML.LogService.Select[\"step\"], id).\n\t\tScan(l).Error\n\n\treturn l.ToLibrary(), err\n}", "title": "" }, { "docid": "4c0a83fbe3705afb77f95cd5e4314e63", "score": "0.4391333", "text": "func RunResolution(c *gin.Context, in *runResolutionIn) error {\n\tmetadata.AddActionMetadata(c, metadata.ResolutionID, in.PublicID)\n\n\tdbp, err := zesty.NewDBProvider(utask.DBName)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// not using a LoadLocked here, because GetEngine().Resolve will lock row\n\tr, err := resolution.LoadFromPublicID(dbp, in.PublicID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tt, err := task.LoadFromID(dbp, r.TaskID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tmetadata.AddActionMetadata(c, metadata.TaskID, t.PublicID)\n\n\ttt, err := tasktemplate.LoadFromID(dbp, t.TemplateID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tmetadata.AddActionMetadata(c, metadata.TemplateName, tt.Name)\n\n\tadmin := auth.IsAdmin(c) == nil\n\tresolutionManager := auth.IsResolutionManager(c, tt, t, r) == nil\n\n\tif !admin && !resolutionManager {\n\t\treturn errors.Forbiddenf(\"You are not allowed to resolve this task\")\n\t} else if !resolutionManager {\n\t\tmetadata.SetSUDO(c)\n\t}\n\n\treqUsername := auth.GetIdentity(c)\n\t_, err = task.CreateComment(dbp, t, reqUsername, \"manually ran resolution\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlogrus.WithFields(logrus.Fields{\"resolution_id\": r.PublicID}).Debugf(\"Handler RunResolution: manual resolve %s\", r.PublicID)\n\n\tch := make(chan struct{})\n\tgo func() {\n\t\terr = engine.GetEngine().Resolve(in.PublicID, nil)\n\t\tclose(ch)\n\t}()\n\n\ttimeout := time.NewTicker(5 * time.Second)\n\tdefer timeout.Stop()\n\n\t// manual resolution can be blocked by a lock acquisition on the Execution pool\n\t// waiting for 5 seconds to get a response, otherwise let's consider the task will\n\t// start correctly when the Execution pool gets available, and prevent API thread to be blocked\n\tselect {\n\tcase <-ch:\n\t\treturn err\n\tcase <-timeout.C:\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "983a3a2a2c89acf0cdda0d5ba3038c94", "score": "0.43785077", "text": "func GetSummaryLink(layout Layout, stepsMetadataReduced map[string]Metablock,\n\tstepName string) (Metablock, error) {\n\tvar summaryLink Link\n\tvar result Metablock\n\tif len(layout.Steps) > 0 {\n\t\tfirstStepLink := stepsMetadataReduced[layout.Steps[0].Name]\n\t\tlastStepLink := stepsMetadataReduced[layout.Steps[len(layout.Steps)-1].Name]\n\n\t\tsummaryLink.Materials = firstStepLink.Signed.(Link).Materials\n\t\tsummaryLink.Name = stepName\n\t\tsummaryLink.Type = firstStepLink.Signed.(Link).Type\n\n\t\tsummaryLink.Products = lastStepLink.Signed.(Link).Products\n\t\tsummaryLink.ByProducts = lastStepLink.Signed.(Link).ByProducts\n\t\t// Using the last command of the sublayout as the command\n\t\t// of the summary link can be misleading. Is it necessary to\n\t\t// include all the commands executed as part of sublayout?\n\t\tsummaryLink.Command = lastStepLink.Signed.(Link).Command\n\t}\n\n\tresult.Signed = summaryLink\n\n\treturn result, nil\n}", "title": "" }, { "docid": "7c228e75759fc75fc5a3e59f3da00405", "score": "0.4376381", "text": "func (pi *Instance) StepID() int {\n\treturn pi.stepID\n}", "title": "" }, { "docid": "ea838af84c2278d685a50dd3a738a59a", "score": "0.4375413", "text": "func (t *PatternTrack) StepsAsString() string {\n\tvar buf bytes.Buffer\n\tfor i := range t.Steps {\n\t\tif i%4 == 0 {\n\t\t\tbuf.WriteString(\"|\")\n\t\t}\n\t\tif t.Steps[i] {\n\t\t\tbuf.WriteString(\"x\")\n\t\t} else {\n\t\t\tbuf.WriteString(\"-\")\n\t\t}\n\t}\n\tbuf.WriteString(\"|\")\n\treturn buf.String()\n}", "title": "" }, { "docid": "b2fd328463d8979140ad3d4e8c33521d", "score": "0.43688694", "text": "func (l *LockFile) Resolution(resolution time.Duration) {\n\tl.resolution = resolution\n}", "title": "" }, { "docid": "c4299544ed8517ea6e905fc9cec8346c", "score": "0.43544054", "text": "func (o ScaledObjectSpecJobTargetRefTemplateSpecInitContainersLifecyclePostStartHttpGetPtrOutput) Port() ScaledObjectSpecJobTargetRefTemplateSpecInitContainersLifecyclePostStartHttpGetPortPtrOutput {\n\treturn o.ApplyT(func(v *ScaledObjectSpecJobTargetRefTemplateSpecInitContainersLifecyclePostStartHttpGet) *ScaledObjectSpecJobTargetRefTemplateSpecInitContainersLifecyclePostStartHttpGetPort {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Port\n\t}).(ScaledObjectSpecJobTargetRefTemplateSpecInitContainersLifecyclePostStartHttpGetPortPtrOutput)\n}", "title": "" }, { "docid": "929204720a4bb38f2be9f4e74e83d95e", "score": "0.43457642", "text": "func (m *Machine) Step() ExecReturnCode {\n\tip := address(m.registers[RegisterInstructionPointer])\n\top := m.model.decodeAddress(ip)\n\tif op == nil {\n\t\tpanic(fmt.Sprintf(\"Unable to decode op att address %v\", ip))\n\t}\n\tm.operations[ip] = op\n\n\treturn op.Exec()\n}", "title": "" }, { "docid": "15f0abd400d1b63b2d4eef37456eeaff", "score": "0.4345504", "text": "func (me *MatrixEnvelope) Step() time.Duration {\n\treturn me.StepDuration\n}", "title": "" }, { "docid": "f5d9ce93007fdf90264764cb9d565d57", "score": "0.43249175", "text": "func (e *Ellipsizer) step(currentNode *BidirectionalParseTreeNode, path mentalese.CategoryPath) *mentalese.ParseTreeNode {\n\tif len(path) == 0 {\n\t\treturn currentNode.source\n\t}\n\n\tpathNode := path[0]\n\trestPath := path[1:]\n\tnextNodes := e.navigate(currentNode, pathNode)\n\n\tfor _, nextNode := range nextNodes {\n\t\tresult := e.step(nextNode, restPath)\n\t\t// a single result is enough\n\t\tif result != nil {\n\t\t\treturn result\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "565d43c2aaaff4057e3316d03f883d35", "score": "0.43222287", "text": "func (r *Residence) OutSteps() map[uint]*Step {\n\treturn r.out\n}", "title": "" }, { "docid": "ec3d24d3f5cc6f62e244d0b1c7009fd6", "score": "0.43204543", "text": "func RvGetPart() int64 {\n\treturn GlobalGenerator.RvGetPart()\n}", "title": "" }, { "docid": "ccc17c0ddc1e70bcb2697baae94d033c", "score": "0.43197808", "text": "func (r *SQLDB) LoadStep(org, reponame string, build int, stepname string) (*model.Step, error) {\n\tresult := &model.Step{}\n\trows, err := r.db.Query(\"SELECT org, reponame, buildnumber,name,log,status,exitcode FROM steps WHERE ORG=$1 AND REPONAME=$2 AND buildnumber=$3 AND NAME=$4\", org, reponame, build, stepname)\n\tif err != nil {\n\t\treturn result, err\n\t}\n\n\tdefer rows.Close()\n\n\tfor rows.Next() {\n\t\terr = rows.Scan(&result.Org, &result.Reponame, &result.BuildNumber, &result.Name, &result.Log, &result.Status, &result.ExitCode)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn result, nil\n\n}", "title": "" }, { "docid": "aa1d2aa76f422b6dc96650f5ab62696b", "score": "0.43126935", "text": "func (m *LeaderVoteMessage) GetStep() int {\n\treturn int(m.SignedCredential.Message.Credential.Step)\n}", "title": "" }, { "docid": "56cd51d009414f8765f66ca7f6523370", "score": "0.43119138", "text": "func (o StepOutput) Kind() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v Step) *string { return v.Kind }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "5154740002a2d9047096deb45ca3a6a9", "score": "0.43028826", "text": "func (e Playlist_VideoEdges) ResolutionOrErr() (*Resolution, error) {\n\tif e.loadedTypes[2] {\n\t\tif e.Resolution == nil {\n\t\t\t// The edge resolution was loaded in eager-loading,\n\t\t\t// but was not found.\n\t\t\treturn nil, &NotFoundError{label: resolution.Label}\n\t\t}\n\t\treturn e.Resolution, nil\n\t}\n\treturn nil, &NotLoadedError{edge: \"resolution\"}\n}", "title": "" }, { "docid": "20c561e12e2185085e2f509e5298837c", "score": "0.4300345", "text": "func (g *Gauge) SetResolution(n int) {\n\tg.resolution = n\n}", "title": "" }, { "docid": "98e105e7107aa29450627b3f68f7c44d", "score": "0.42907834", "text": "func (step ShellStep) GetActivityDetails() string {\n\tif step.Description != \"\" {\n\t\treturn step.Description\n\t}\n\treturn step.Command\n}", "title": "" }, { "docid": "ae587bdcb463be49a4ee5a1779d8a66a", "score": "0.4282322", "text": "func NextStep(curStep int64, consumeDur time.Duration) int64 {\n\tfailpoint.Inject(\"mockAutoIDCustomize\", func(val failpoint.Value) {\n\t\tif val.(bool) {\n\t\t\tfailpoint.Return(3)\n\t\t}\n\t})\n\tfailpoint.Inject(\"mockAutoIDChange\", func(val failpoint.Value) {\n\t\tif val.(bool) {\n\t\t\tfailpoint.Return(step)\n\t\t}\n\t})\n\n\tconsumeRate := defaultConsumeTime.Seconds() / consumeDur.Seconds()\n\tres := int64(float64(curStep) * consumeRate)\n\tif res < minStep {\n\t\treturn minStep\n\t} else if res > maxStep {\n\t\treturn maxStep\n\t}\n\treturn res\n}", "title": "" }, { "docid": "42b3e5ad1177ce16c8395811a2036920", "score": "0.42777625", "text": "func (f Feature) Step(name string, a ...interface{}) {\n\tvar fn StepFunc\n\tvar args []interface{}\n\n\tfor _, s := range f.Steps {\n\t\tfor _, v := range s {\n\t\t\tm := v.reg.FindStringSubmatch(name)\n\t\t\tif n := len(m); n > 0 {\n\t\t\t\tfn = v.fn\n\n\t\t\t\t// start at 1, we only want the submatches\n\t\t\t\tfor i := 1; i < n; i++ {\n\t\t\t\t\targs = append(args, &param{m[i]})\n\t\t\t\t}\n\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\tif fn == nil {\n\t\tf.T.Fatalf(\"`%s`: step not found\", name)\n\n\t\treturn // actual testing package will exit, just for testing\n\t}\n\n\tf.call(name, fn, append(args, a...)...)\n}", "title": "" }, { "docid": "7f78475bb390aa904d54cf570ac483e9", "score": "0.42774367", "text": "func (o *SyntheticsStepDetail) GetValue() interface{} {\n\tif o == nil || o.Value == nil {\n\t\tvar ret interface{}\n\t\treturn ret\n\t}\n\treturn o.Value\n}", "title": "" }, { "docid": "945ccb4b8182796c979486e44d89d103", "score": "0.42554116", "text": "func (o DatascanDataQualityResultRuleRuleOutput) Dimension() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v DatascanDataQualityResultRuleRule) *string { return v.Dimension }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "f541b26a27814b64c42f45775b07becb", "score": "0.4251908", "text": "func ResolutionFromString(res string) Resolution {\n\tswitch res {\n\tcase \"mi\":\n\t\treturn Resolution_MIN\n\tcase \"mi5\":\n\t\treturn Resolution_MIN5\n\tcase \"mi10\":\n\t\treturn Resolution_MIN10\n\tcase \"mi15\":\n\t\treturn Resolution_MIN15\n\tcase \"mi20\":\n\t\treturn Resolution_MIN20\n\tcase \"mi30\":\n\t\treturn Resolution_MIN30\n\tcase \"h\":\n\t\treturn Resolution_HOUR\n\tcase \"h2\":\n\t\treturn Resolution_HOUR2\n\tcase \"h3\":\n\t\treturn Resolution_HOUR3\n\tcase \"h6\":\n\t\treturn Resolution_HOUR6\n\tcase \"h12\":\n\t\treturn Resolution_HOUR12\n\tcase \"d\":\n\t\treturn Resolution_DAY\n\tcase \"w\":\n\t\treturn Resolution_WEEK\n\tcase \"m\":\n\t\treturn Resolution_MONTH\n\tcase \"m2\":\n\t\treturn Resolution_MONTH2\n\tcase \"m3\":\n\t\treturn Resolution_MONTH3\n\tcase \"m6\":\n\t\treturn Resolution_MONTH6\n\tcase \"y\":\n\t\treturn Resolution_YEAR\n\tcase \"a\":\n\t\treturn Resolution_ALL\n\t}\n\treturn Resolution_HOUR\n}", "title": "" }, { "docid": "2e294ab3047e6fa9af97e407aaebf74c", "score": "0.42480913", "text": "func (o *GetTenantsTenantIDMetricsAPIV1QueryRangeParams) SetStep(step *string) {\n\to.Step = step\n}", "title": "" }, { "docid": "1587d3f6f6074593933c7e593dc4ee73", "score": "0.42440626", "text": "func NextStep(curStep int64, consumeDur time.Duration) int64 {\n\tfailpoint.Inject(\"mockAutoIDChange\", func(val failpoint.Value) {\n\t\tif val.(bool) {\n\t\t\tfailpoint.Return(step)\n\t\t}\n\t})\n\n\tconsumeRate := defaultConsumeTime.Seconds() / consumeDur.Seconds()\n\tres := int64(float64(curStep) * consumeRate)\n\tif res < minStep {\n\t\treturn minStep\n\t} else if res > maxStep {\n\t\treturn maxStep\n\t}\n\treturn res\n}", "title": "" }, { "docid": "ca620699187d12e8c7ab394d89b37a51", "score": "0.42428887", "text": "func (o ScaledObjectSpecJobTargetRefTemplateSpecContainersLivenessProbeHttpGetPtrOutput) Port() ScaledObjectSpecJobTargetRefTemplateSpecContainersLivenessProbeHttpGetPortPtrOutput {\n\treturn o.ApplyT(func(v *ScaledObjectSpecJobTargetRefTemplateSpecContainersLivenessProbeHttpGet) *ScaledObjectSpecJobTargetRefTemplateSpecContainersLivenessProbeHttpGetPort {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Port\n\t}).(ScaledObjectSpecJobTargetRefTemplateSpecContainersLivenessProbeHttpGetPortPtrOutput)\n}", "title": "" }, { "docid": "738f9ce0360d05e671d7f084601ca29c", "score": "0.42389184", "text": "func (v NullableSyntheticsStepType) Get() *SyntheticsStepType {\n\treturn v.value\n}", "title": "" }, { "docid": "e33e3547a9d01175b22594d40f599248", "score": "0.4225424", "text": "func (o CSIPowerMaxSpecDriverNodeEnvsValueFromResourceFieldRefPtrOutput) Resource() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *CSIPowerMaxSpecDriverNodeEnvsValueFromResourceFieldRef) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Resource\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "81757e697e3190d98c545680167491e9", "score": "0.42241234", "text": "func (r *SQLDB) LoadStepInfo(org string, name string, stepname string, build int) (*model.StepInfo, error) {\n\trows, err := r.db.Query(\"SELECT org, reponame, buildnumber,name,status,exitcode FROM steps WHERE ORG=$1 AND REPONAME=$2 AND NAME=$3 AND buildnumber=$4\", org, name, stepname, build)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\n\tfor rows.Next() {\n\t\tvar stepinfo model.StepInfo\n\t\terr = rows.Scan(&stepinfo.Org, &stepinfo.Reponame, &stepinfo.BuildNumber, &stepinfo.Name, &stepinfo.Status, &stepinfo.ExitCode)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn &stepinfo, nil\n\t}\n\treturn nil, fmt.Errorf(\"couldn't find step %v in %v/%v with build number %v \", stepname, org, name, build)\n\n}", "title": "" } ]
b7eba7850f16f2a277f8884e3a4db8f1
HttpGet specifies the http request to perform. Structure is documented below.
[ { "docid": "b1e9124705e32ea1cb6531c7164c8981", "score": "0.0", "text": "func (o ServiceTemplateSpecContainerStartupProbePtrOutput) HttpGet() ServiceTemplateSpecContainerStartupProbeHttpGetPtrOutput {\n\treturn o.ApplyT(func(v *ServiceTemplateSpecContainerStartupProbe) *ServiceTemplateSpecContainerStartupProbeHttpGet {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.HttpGet\n\t}).(ServiceTemplateSpecContainerStartupProbeHttpGetPtrOutput)\n}", "title": "" } ]
[ { "docid": "afaea54c5caed3592e327a6e60b39746", "score": "0.7567316", "text": "func (s StdIo) HttpGet(url string, extraHeaders ...string) (string, error) {\n\treturn s.doRequest(url, \"GET\", nil, extraHeaders)\n}", "title": "" }, { "docid": "2f0485b95710c381a78d8f4320c87471", "score": "0.7376166", "text": "func HttpGet(t testing.TestingT, url string, tlsConfig *tls.Config) (int, string) {\n\treturn HttpGetWithOptions(t, HttpGetOptions{Url: url, TlsConfig: tlsConfig, Timeout: 10})\n}", "title": "" }, { "docid": "7c35ed21702b3a093bf02326b6163299", "score": "0.73255086", "text": "func (cli *Client) httpGet(URL string) (body io.ReadCloser, err error) {\n\tbody, err = cli.httpClient(\"GET\", URL, nil)\n\treturn body, err\n}", "title": "" }, { "docid": "444d0c11466bd182d8746a493b8a4ac8", "score": "0.72846514", "text": "func (c *Client) HttpGet(url string) (*Response, error) {\n\treturn c.DoRequest(\"GET\", url, nil)\n}", "title": "" }, { "docid": "dfbd3aa1dc64e400e4a8abcbd0f3adc2", "score": "0.7234795", "text": "func httpGet(url string) (resp *http.Response, err error) {\n\treturn httpClient.Get(url)\n}", "title": "" }, { "docid": "cb01b201bb4947b7f8804427927c8cf9", "score": "0.71909016", "text": "func (hc *HTTPClient) Get(req *http.Request) ([]byte, int, error) {\n\treq.Method = \"GET\"\n\treturn hc.Do(req)\n}", "title": "" }, { "docid": "5d1cb60dc4713bd827c242b6c5363070", "score": "0.71865207", "text": "func HTTPGet(URL string, encoding string, header http.Header) (HTTPResponse, error) {\n\treturn httpcall(URL, \"GET\", encoding, \"\", header)\n}", "title": "" }, { "docid": "219da3c29bce140bd0c64ef1a2d01170", "score": "0.71645397", "text": "func (c *Client) httpGet(ctx context.Context, url string) (*http.Response, error) {\n\treq, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp, err := c.httpDo(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif resp.StatusCode != http.StatusOK {\n\t\tresp.Body.Close()\n\t\treturn nil, ErrUnexpectedStatusCode(resp.StatusCode)\n\t}\n\treturn resp, nil\n}", "title": "" }, { "docid": "d18d354f59c56288097dc7cfa92c4d2f", "score": "0.7128228", "text": "func httpGet(t *testing.T, url string) ([]byte, error) {\n\tt.Helper()\n\n\tclient := &http.Client{}\n\n\thttpReq, err := http.NewRequest(http.MethodGet, url, nil)\n\trequire.NoError(t, err)\n\n\tresp, err := invokeWithRetry(\n\t\tfunc() (response *http.Response, e error) {\n\t\t\treturn client.Do(httpReq)\n\t\t},\n\t)\n\trequire.NoError(t, err)\n\n\treturn handleHTTPResp(resp)\n}", "title": "" }, { "docid": "999d0af5cee87dca7cc19388ae91ed98", "score": "0.708417", "text": "func HTTPGet(path string) (string, error) {\n\trequest := gorequest.New().Get(buildURL(path))\n\trequestHeaders(request)\n\tresponse, body, errs := request.End()\n\n\treturn handleResponse(response, body, errs)\n}", "title": "" }, { "docid": "2409ed3b923b93885d7bb515b809be5f", "score": "0.70773447", "text": "func (c *Client) httpGet(ctx context.Context, url string) (resp *http.Response, err error) {\n\tclient := c.HTTPClient\n\tif client == nil {\n\t\tclient = http.DefaultClient\n\t}\n\n\tif c.Debug {\n\t\tlog.Println(\"GET\", url)\n\t}\n\n\treq, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp, err = client.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif resp.StatusCode != http.StatusOK {\n\t\tresp.Body.Close()\n\t\treturn nil, ErrUnexpectedStatusCode(resp.StatusCode)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "90c62b300c3b90972d9860c8f999042f", "score": "0.70527196", "text": "func HttpGet(url string) (error, string) {\n\treturn util.HttpGet(url)\n}", "title": "" }, { "docid": "8ffab3c1cf91450947048bc08948c54a", "score": "0.6989709", "text": "func (DefaultImpl) HTTPGet() string {\n\treturn svc.Message()\n}", "title": "" }, { "docid": "6820146756b088f190289d336bb84ba1", "score": "0.6954653", "text": "func (c *Client) httpGet(url string, basicAuth []string) ([]byte, *http.Response, error) {\n\treq, err := http.NewRequest(\"GET\", url, nil)\n\tif len(basicAuth) > 0 {\n\t\treq.SetBasicAuth(basicAuth[0], basicAuth[1])\n\t}\n\tresp, err := c.httpClient.Do(req)\n\tif err != nil {\n\t\treturn []byte{}, resp, err\n\t}\n\tdefer resp.Body.Close()\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn []byte{}, resp, err\n\t}\n\treturn body, resp, nil\n}", "title": "" }, { "docid": "b451b7fbd1368c6373415b6c66403f5c", "score": "0.6913159", "text": "func HTTPGet(httpUrl string) ([]byte, error) {\n\n\tr, err := http.Get(httpUrl)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer r.Body.Close()\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// read the response and check\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn body, nil\n}", "title": "" }, { "docid": "dcd23afbfa12f428bb36b6630f47587b", "score": "0.6874976", "text": "func (c *Client) GET(url string, params map[string]string, headers map[string]string) *Response {\n\treturn c.send(url, params, \"GET\", headers)\n}", "title": "" }, { "docid": "35dc09a466e29e833eb2f94aec6b0194", "score": "0.68570656", "text": "func HttpGet(url string) (response []byte, err error) {\n\tclient := &http.Client{}\n\n\tvar req *http.Request\n\treq, err = http.NewRequest(\"GET\", url, nil)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tvar resp *http.Response\n\tresp, err = client.Do(req)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\n\tresponse, err = ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tif resp.StatusCode != 200 {\n\t\treturn response, errors.New(\"HTTP status code: \" + strconv.Itoa(resp.StatusCode))\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "b6e973abf9b7077808b035ceb474d7f5", "score": "0.6827354", "text": "func httpGet(t *testing.T, url string) ([]byte, error) {\n\tclient := &http.Client{}\n\tresp, err := invokeWithRetry(\n\t\tfunc() (response *http.Response, e error) {\n\t\t\treturn client.Get(url)\n\t\t},\n\t)\n\trequire.NoError(t, err)\n\n\treturn handleHTTPResp(t, resp)\n}", "title": "" }, { "docid": "28fa59d8a544c57de237e1eb442cf1b2", "score": "0.6810445", "text": "func HTTPGet(httpClient *http.Client, url string, result interface{}, ctx ...url.Values) (ret []byte, err error) {\n\trequest, requestErr := http.NewRequest(\"GET\", url, nil)\n\tif requestErr != nil {\n\t\terr = requestErr\n\t\tlog.Printf(\"construct request failed, url:%s, err:%s\", url, err.Error())\n\t\treturn\n\t}\n\n\tfor _, val := range ctx {\n\t\tfor k, v := range val {\n\t\t\trequest.Header.Set(k, v[0])\n\t\t}\n\t}\n\n\tresponse, responseErr := httpClient.Do(request)\n\tif responseErr != nil {\n\t\terr = responseErr\n\t\tlog.Printf(\"get request failed, err:%s\", err.Error())\n\t\treturn\n\t}\n\tdefer response.Body.Close()\n\n\tif response.StatusCode != http.StatusOK {\n\t\terr = fmt.Errorf(\"unexpect statusCode, statusCode:%d\", response.StatusCode)\n\t\treturn\n\t}\n\n\tcontent, contentErr := ioutil.ReadAll(response.Body)\n\tif contentErr != nil {\n\t\terr = contentErr\n\t\tlog.Printf(\"read respose data failed, err:%s\", err.Error())\n\t\treturn\n\t}\n\n\tif result != nil {\n\t\terr = json.Unmarshal(content, result)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"unmarshal data failed, err:%s\", err.Error())\n\t\t\treturn\n\t\t}\n\t}\n\n\tret = content\n\treturn\n}", "title": "" }, { "docid": "4ff4cdb2dc25592caf224dbb78e66826", "score": "0.678108", "text": "func httpGet(uri string) string {\n\tclient := &http.Client{}\n\treq, err := http.NewRequest(\"GET\", uri, nil)\n\treq.Header.Add(\"Content-Type\", \"application/json;charset=utf-8\")\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\t// handle error\n\t}\n\n\tdefer resp.Body.Close()\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t}\n\t//fmt.Println(string(body))\n\treturn string(body)\n}", "title": "" }, { "docid": "c16ff86f0970c2fe983a85a2c1c3157d", "score": "0.6760988", "text": "func (c *HTTPClient) HTTPGet(path string, successStatus int) ([]byte, error) {\n\n\tendpoint := fmt.Sprintf(\"%s%s\", c.apiOrigin, path)\n\n\treq, err := http.NewRequest(\"GET\", endpoint, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Set(\"Authorization\", c.apiKey)\n\tresp, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\tif resp.StatusCode == http.StatusNotFound {\n\t\treturn nil, ErrNotFound\n\t}\n\tif resp.StatusCode != successStatus {\n\t\tbody, _ := ioutil.ReadAll(resp.Body)\n\t\treturn nil, fmt.Errorf(\"GET %s %d: %s\", endpoint, resp.StatusCode, body)\n\t}\n\n\treturn ioutil.ReadAll(resp.Body)\n}", "title": "" }, { "docid": "58349ef5fabc67aa134872a92312de6e", "score": "0.67606705", "text": "func (client *Client) Get(headers http.Header, path string, params url.Values) (\n\thttpRes *http.Response, resBody []byte, err error,\n) {\n\tif params != nil {\n\t\tpath += \"?\" + params.Encode()\n\t}\n\n\treturn client.doRequest(http.MethodGet, headers, path, \"\", nil)\n}", "title": "" }, { "docid": "74dc614ee75a8295f8b41f7e328b5ee6", "score": "0.6754048", "text": "func HttpGet(url string) (string, error) {\n\t// open connection to a given url\n\tresponse, errConn := http.Get(url)\n\tif errConn != nil {\n\t\tfmt.Println(errConn)\n\t\treturn \"\", errConn\n\t}\n\n\t// read the response body\n\tbody, errorBody := ioutil.ReadAll(response.Body)\n\n\treturnValue := \"\"\n\tif errorBody == nil {\n\t\t// collect the response into a string object\n\t\treturnValue = string(body)\n\t\t// close the response\n\t\tresponse.Body.Close()\n\t}\n\n\t// return the response\n\treturn returnValue, errorBody\n}", "title": "" }, { "docid": "ac58f296ad2f0ef4a7d4f79cfd514617", "score": "0.67529476", "text": "func (s *GoServer) HTTPGet(ctx context.Context, url string, useragent string) (string, error) {\n\n\tvar tracer *rpcStats\n\tif s.RPCTracing {\n\t\ttracer = s.getTrace(\"http_get\", \"client\")\n\t}\n\n\tt := time.Now()\n\n\tclient := &http.Client{}\n\treq, err := http.NewRequest(\"GET\", url, nil)\n\treq.Header.Set(\"User-Agent\", useragent)\n\tvar response http.Response\n\tbody := []byte{}\n\tif err == nil {\n\t\tresponse, err := client.Do(req)\n\t\tif err == nil {\n\t\t\tdefer response.Body.Close()\n\t\t\tbody, _ = ioutil.ReadAll(response.Body)\n\t\t}\n\t}\n\n\tif response.StatusCode != 200 && response.StatusCode != 201 && response.StatusCode != 204 && response.StatusCode != 0 {\n\t\terr = fmt.Errorf(\"Error reading url: %v and %v\", response.StatusCode, string(body))\n\t}\n\n\tif s.RPCTracing {\n\t\ts.recordTrace(ctx, tracer, \"http_get\", time.Now().Sub(t), err, url, false)\n\t}\n\n\treturn string(body), err\n}", "title": "" }, { "docid": "98552bae6495f18b8d02659dd068b299", "score": "0.66894597", "text": "func httpGet(parsedLink *url.URL) (body []byte, err error) {\n\tresp, err := http.Get(parsedLink.String())\n\tif err != nil {\n\t\tcolorlog.Errorln(\"[http.Get error]\", err)\n\t\treturn\n\t}\n\n\tbody, err = ioutil.ReadAll(resp.Body)\n\tdefer resp.Body.Close()\n\tif err != nil {\n\t\tcolorlog.Errorln(\"[ioutil.ReadAll error]\", err)\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "3b7f6bafb59e5d4259aeac65bcc18c35", "score": "0.6650895", "text": "func httpGet(ctx context.Context, url string) ([]byte, error) {\n\tclient := &http.Client{\n\t\t// We MUST NOT follow redirects, see\n\t\t// https://tools.ietf.org/html/rfc8461#section-3.3\n\t\tCheckRedirect: rejectRedirect,\n\t}\n\n\tresp, err := ctxhttp.Get(ctx, client, url)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn nil, fmt.Errorf(\"HTTP response status code: %v\", resp.StatusCode)\n\t}\n\n\t// Media type must be \"text/plain\" to guard against cases where webservers\n\t// allow untrusted users to host non-text content (like HTML or images) at\n\t// a user-defined path.\n\t// https://tools.ietf.org/html/rfc8461#section-3.2\n\tmt, _, err := mime.ParseMediaType(resp.Header.Get(\"Content-type\"))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"HTTP media type error: %v\", err)\n\t}\n\tif mt != \"text/plain\" {\n\t\treturn nil, ErrInvalidMediaType\n\t}\n\n\t// Read but up to 10k; policies should be way smaller than that, and\n\t// having a limit prevents abuse/accidents with very large replies.\n\treturn io.ReadAll(&io.LimitedReader{R: resp.Body, N: 10 * 1024})\n}", "title": "" }, { "docid": "04d4914f10e009593195b0f5cd40ef19", "score": "0.6620279", "text": "func (c *Client) get(urlStr string) (*http.Request, error) {\n\treturn c.newRequest(http.MethodGet, urlStr, nil)\n}", "title": "" }, { "docid": "a39cc4849b7e398a811c0f213c20c4f3", "score": "0.6596844", "text": "func (c HTTPClient) Get(path string, resBody interface{}) (*http.Response, error) {\n\treturn c.request(\"GET\", path, nil, resBody)\n}", "title": "" }, { "docid": "64f79f2978a6014bb5b288c69e7e4e09", "score": "0.6565493", "text": "func (c *Client) Get(p string, ro *RequestOptions) (*http.Response, error) {\n\treturn c.Request(\"GET\", p, ro)\n}", "title": "" }, { "docid": "3424a4e31646e634b7c6cce14d45cf34", "score": "0.65623504", "text": "func GET(url string, queries map[string]string, headers map[string]string) *http.Response {\n\treturn callerWithData(\"GET\", url, queries, headers, nil)\n}", "title": "" }, { "docid": "b4a3f59d39a88e0d79f8b1e4505d0fff", "score": "0.6560018", "text": "func (c *HttpClient) Get(url string, result interface{}) (err error) {\n\treturn c.do(http.MethodGet, url, nil, result)\n}", "title": "" }, { "docid": "885d6272a499c3f29508cd49663014e7", "score": "0.65578127", "text": "func (o ProbeResponseOutput) HttpGet() HTTPGetActionResponseOutput {\n\treturn o.ApplyT(func(v ProbeResponse) HTTPGetActionResponse { return v.HttpGet }).(HTTPGetActionResponseOutput)\n}", "title": "" }, { "docid": "3f927b9373484205bfb442d6273ab6b6", "score": "0.65484756", "text": "func (o ProbeOutput) HttpGet() HTTPGetActionPtrOutput {\n\treturn o.ApplyT(func(v Probe) *HTTPGetAction { return v.HttpGet }).(HTTPGetActionPtrOutput)\n}", "title": "" }, { "docid": "62d1b7b344fbd426d30ff69002748135", "score": "0.6542273", "text": "func (c Client) Get(ctx context.Context, url string, result interface{}, opt ...RequestOption) error {\n\treturn c.request(ctx, url, \"GET\", nil, result, opt)\n}", "title": "" }, { "docid": "de06802ca69e31dfd3623c6a78d0c5ef", "score": "0.65171915", "text": "func (dhtNode *DHTNode) HttpGet(key string) (bool, string, *NetworkNode){\n\tnodeResponsible := dhtNode.Lookup(key, dhtNode.ToNetworkNode(), \"\")\n\t\n\tchannel:= dhtNode.SendGetData(\"all\",nodeResponsible)\n\t\t\n\t/* Waiting the answer in the channel*/\n\tselect {\n\t\tcase dataSet := <- channel:\n\t\t\tdata, success :=dataSet.getData(key)\n\t\t\treturn success, data.Value, nodeResponsible\n\t\tcase <-time.After(LOOKUPEXPIRATION):\n\t\t\tfmt.Println(\"Waiting time for SendGetData answer expirated\")\n\t\t\treturn false, \"\", nodeResponsible\n\t}\n}", "title": "" }, { "docid": "5919bcc36b134316bea85afa78360f5f", "score": "0.6516537", "text": "func Get(url string, optFns ...OptionFn) (*http.Response, error) {\n\treturn std.Get(url, optFns...)\n}", "title": "" }, { "docid": "ca6d016e51b932ec05778e835205d7b3", "score": "0.65061444", "text": "func (c *Client) Get(req *Request) (*Response, error) {\n\treturn c.Send(req, MethodGet)\n}", "title": "" }, { "docid": "d923f1ab2d0ad8dc5e3444686e8ca693", "score": "0.6499532", "text": "func (c *Client) GET(ctx context.Context, target string, output interface{}, ums ...URLModifier) (*http.Response, error) {\n\treturn c.Call(ctx, \"GET\", target, nil, output, ums...)\n}", "title": "" }, { "docid": "469bb7dc6bf99eebfbfbe576d33d5944", "score": "0.64784825", "text": "func (a *API) get(tpl string, p *params) ([]byte, error) {\n\treturn a.httpRequest(tpl, p, \"GET\")\n}", "title": "" }, { "docid": "7e1304527318a40136ea9e6590815fa5", "score": "0.6474815", "text": "func (c *Client) Get(url string, querystring interface{}) ([]byte, error) {\n\tqs, err := query.Values(querystring)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq := c.cli.Get(url).Query(qs.Encode())\n\tlog.Info(\"http client\", &log.LogContext{\n\t\t\"method\": req.Method,\n\t\t\"url\": req.Url,\n\t\t\"queryData\": req.QueryData,\n\t})\n\n\tc.mu.Lock()\n\treq.Header = c.Headers\n\tc.mu.Unlock()\n\n\tvar body []byte\n\n\t// circuitbreaker is on\n\tif c.cb != nil {\n\t\tb, err := c.cb.Execute(func() (interface{}, error) {\n\t\t\treturn c.send()\n\t\t})\n\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tbody, _ = b.([]byte)\n\t\treturn body, nil\n\t}\n\n\treturn c.send()\n}", "title": "" }, { "docid": "fbec218f17446eb8d412a24a8056ebc1", "score": "0.646552", "text": "func Get(url string) *Request {\n\treturn newRequest(url, \"GET\")\n}", "title": "" }, { "docid": "1bc2d0fb164bdae9881204f46b7c85e8", "score": "0.64610016", "text": "func (c *Client) Get(log *logrus.Entry, path string, body interface{}, output interface{}) error {\n\tif log == nil {\n\t\tlog = logrus.WithField(\"method\", \"httputils#Get\")\n\t}\n\treturn c.genericRequest(http.MethodGet, log, path, body, output)\n}", "title": "" }, { "docid": "fc87fd3dce2627d0986e4555745d225b", "score": "0.64358366", "text": "func Get(httpClient *http.Client, url string, args map[string]string) (result []byte, err error) {\n\tif args != nil {\n\t\turl += \"?\" + argsEncode(args)\n\t}\n\tresp, err := httpClient.Get(url)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\tbody, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = NewError(body)\n\tif err != nil {\n\t\treturn\n\t}\n\tresult = body\n\treturn\n}", "title": "" }, { "docid": "822b0bab5edb6c22c7599ac05a66a640", "score": "0.64305425", "text": "func (c *Client) Get(url string, options ...RequestOption) (*Response, error) {\n\treturn c.newRequest(url, http.MethodGet, nil, options...).execute()\n}", "title": "" }, { "docid": "770792433dd210e5c02c8638cf3e94cf", "score": "0.6420416", "text": "func Get(url string, header http.Header, timeout *Timeout) (*http.Response, error) {\n\treturn Request(http.MethodGet, url, header, nil, timeout)\n}", "title": "" }, { "docid": "23849cf68e9781f23e1a1349d44d7235", "score": "0.6417624", "text": "func Get(uri string, opts ...ReqOption) (*http.Response, []byte, error) {\n\topts = append(opts, Method(http.MethodGet))\n\treturn MakeRequest(uri, opts...)\n}", "title": "" }, { "docid": "1b0dfeae8225534ace191c99eec109f2", "score": "0.64086086", "text": "func Get(path string) *Request { return New(http.MethodGet, path) }", "title": "" }, { "docid": "f7766016ad9b5f1dd783e1588257711e", "score": "0.6402661", "text": "func HttpGetWithValidation(t testing.TestingT, url string, tlsConfig *tls.Config, expectedStatusCode int, expectedBody string) {\n\toptions := HttpGetOptions{Url: url, TlsConfig: tlsConfig, Timeout: 10}\n\tHttpGetWithValidationWithOptions(t, options, expectedStatusCode, expectedBody)\n}", "title": "" }, { "docid": "7eabb4b93b90e00866bba0f8fdf95ce8", "score": "0.6399719", "text": "func Get(params GetParams) (int, string, error) {\n\n\tif params.URL == \"\" {\n\t\treturn 0, \"\", errors.New(\"Request URL missing\")\n\t}\n\n\t// Making logger\n\tlog := xray.ROOT.Fork().WithLogger(\"http-client\").With(args.URL(params.URL))\n\n\t// Building HTTP client\n\tclient := http.Client{}\n\n\t// Building request\n\tlog.Trace(\"Making GET request to :url\")\n\tbefore := time.Now()\n\treq, err := http.NewRequest(\"GET\", params.URL, nil)\n\tif err != nil {\n\t\tlog.Warning(\"Unable to build request. Maybe URL (:url) is incorrect - :err\", args.Error{Err: err})\n\t\treturn -1, \"\", err\n\t}\n\treq.Header.Add(\"User-Agent\", \"Charlie Changelog Agent (v0.1-alpha)\")\n\n\tfor k, v := range params.Headers {\n\t\treq.Header.Add(k, v)\n\t}\n\n\t// Making request\n\tres, err := client.Do(req)\n\tif err != nil {\n\t\tlog.Warning(\"HTTP request to :url failed - :err\", args.Error{Err: err})\n\t\treturn -1, \"\", err\n\t}\n\tdefer res.Body.Close()\n\n\t// Reading response bytes\n\tbts, err := ioutil.ReadAll(res.Body)\n\tif err != nil {\n\t\tlog.Warning(\"Unable to read response body - :err\", args.Error{Err: err})\n\t\treturn res.StatusCode, \"\", err\n\t}\n\tif len(bts) == 0 {\n\t\tlog.Warning(\"Response is empty\")\n\t\treturn res.StatusCode, \"\", errors.New(\"empty response\")\n\t}\n\tlog.InBytes(bts)\n\tlog.Info(\"HTTP GET :url done in :delta\", args.Delta(time.Now().Sub(before)))\n\n\treturn res.StatusCode, string(bts), nil\n}", "title": "" }, { "docid": "38b2c07a51d380b9054c2c06b542909b", "score": "0.6393255", "text": "func (s *Client) Get() error {\r\n\r\n\turl := s.hostname + \"/get\"\r\n\trequest, _ := http.NewRequest(\"GET\", url, nil)\r\n\tclient := &http.Client{}\r\n\r\n\tresponse, err := client.Do(request)\r\n\tif err != nil {\r\n\t\tfmt.Printf(\"The HTTP request failed with error %s\\n\", err)\r\n\t\treturn err\r\n\t} else {\r\n\t\tdata, _ := ioutil.ReadAll(response.Body)\r\n\t\tfmt.Println(\"HTTP Response Status:\", response.StatusCode)\r\n\t\tfmt.Println(\"HTTP Body:\")\r\n\t\tfmt.Println(string(data))\r\n\t}\r\n\treturn nil\r\n}", "title": "" }, { "docid": "a39ffdc0bd8bd33e57458e039b416aa5", "score": "0.63833576", "text": "func (request *Request) Get(ctx context.Context) (*Response, error) {\n\trequest.Method = \"GET\"\n\treturn request.httpWithMiddleware(ctx)\n}", "title": "" }, { "docid": "032c02c9ba84538ad00e00137ab07866", "score": "0.63772416", "text": "func HTTPGet(client *http.Client, url string, headers map[string]string, trace bool) (*http.Response, error) {\r\n\treq, _ := http.NewRequest(\"GET\", url, nil)\r\n\t/*\r\n\t\treq.Header.Add(\"Content-Type\", \"application/json\")\r\n\t\treq.Header.Add(\"Prefer\", \"respond-async\")\r\n\t\tif token != nil {\r\n\t\t\treq.Header.Add(\"Authorization\", \"Token \"+*token)\r\n\r\n\t*/\r\n\tfor key, value := range headers {\r\n\t\t//fmt.Printf(\"%s: %s\\n\", key, value)\r\n\t\treq.Header.Add(key, value)\r\n\t}\r\n\r\n\tif trace == true {\r\n\t\tdump, _ := httputil.DumpRequestOut(req, true)\r\n\t\tlog.Println(string(dump))\r\n\t}\r\n\r\n\tresp, err := client.Do(req)\r\n\r\n\tif trace == true && err == nil {\r\n\t\tdumpBody := true\r\n\t\tcontentLength, _ := strconv.Atoi(resp.Header.Get(\"Content-Length\"))\r\n\t\tif contentLength > 5000 {\r\n\t\t\tdumpBody = false\r\n\t\t}\r\n\r\n\t\tdump, _ := httputil.DumpResponse(resp, dumpBody)\r\n\t\tlog.Println(string(dump))\r\n\t}\r\n\r\n\treturn resp, err\r\n\r\n}", "title": "" }, { "docid": "69bd60f84bdba1dd9940d68f0d8de15d", "score": "0.63697094", "text": "func HttpGetRequestBuilder(uri string, body []byte) {\n\n\turi = httpEndPointBuider(uri)\n\tfmt.Println(\"Request URL :\\t\" + uri)\n\trequest, err := http.NewRequest(http.MethodGet, uri, bytes.NewBuffer(body))\n\trequest.Header.Set(common.ContentType, common.ApplicationJson)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\tclient := GetHttpClient()\n\tresponse, err := client.Do(request)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\tdefer response.Body.Close()\n\n\toutput, err := ioutil.ReadAll(response.Body)\n\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\tfmt.Println(\"Response Data: \\n\" + string(output))\n}", "title": "" }, { "docid": "6ed0b85e71844f8ef332e1cb85bb3d18", "score": "0.6361485", "text": "func HttpGetWithOptions(t testing.TestingT, options HttpGetOptions) (int, string) {\n\tstatusCode, body, err := HttpGetWithOptionsE(t, options)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\treturn statusCode, body\n}", "title": "" }, { "docid": "3a88e94a40ac82a9b68aa9b1dc7a8d52", "score": "0.63475025", "text": "func httpExample() {\n\tres, err := http.Get(\"http://www.google.com/robots.txt\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer res.Body.Close()\n\trobots, err := ioutil.ReadAll(res.Body)\n\t// res.Body.Close()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfmt.Printf(\"%s\", robots)\n}", "title": "" }, { "docid": "01deba24346e4cf0a23fe1cb88ad4b72", "score": "0.6347179", "text": "func (e *Expect) GET(path string, pathargs ...interface{}) *Request {\n\treturn e.Request(\"GET\", path, pathargs...)\n}", "title": "" }, { "docid": "488144b4c608b875e6286e1d8fe3db03", "score": "0.63400435", "text": "func HTTPGet(url string) string {\n\ttr := &http.Transport{\n\t\tDial: fakeDial,\n\t}\n\tclient := &http.Client{Transport: tr}\n\tlog.Debug(\"Doing POST request to \" + url)\n\tresp, err := client.Get(\"http://d\" + url)\n\tif err != nil {\n\t\tlog.Warn(\"HTTP call failed\")\n\t}\n\tvar body []byte\n\tif resp != nil {\n\t\tdefer resp.Body.Close()\n\t\tbody, _ = ioutil.ReadAll(resp.Body)\n\t}\n\treturn string(body)\n}", "title": "" }, { "docid": "7f561f0ea4e671b672e7a8a1b2f0f019", "score": "0.6295004", "text": "func ViewGet(w http.ResponseWriter, r *http.Request) {\r\n\t// swagger:operation GET /get getRequest\r\n\t//\r\n\t// ---\r\n\t// produces:\r\n\t// - application/json\r\n\t//\r\n\t// summary: The request's query args.\r\n\t//\r\n\t// schemes:\r\n\t// - http\r\n\t// - https\r\n\t//\r\n\t// tags:\r\n\t// - HTTP Methods\r\n\t//\r\n\t// responses:\r\n\t// '200':\r\n\t// description: The request's query args.\r\n\r\n\te := json.NewEncoder(w)\r\n\te.Encode(helpers.MakeResponse(r, \"url\", \"headers\", \"args\", \"origin\"))\r\n}", "title": "" }, { "docid": "984d52c23e559ec95a429f5b50160671", "score": "0.6290641", "text": "func (transport *HTTPTransport) Get(url string, result interface{}) error {\n\treturn transport.jsonRequest(url, http.MethodGet, result, nil)\n}", "title": "" }, { "docid": "f552e8e90dff29a16ed8a5467147b775", "score": "0.6270007", "text": "func (ht *HTTPIntegrationTest) Get(url string) *Response {\n\treturn ht.callAPI(\"GET\", url, nil)\n}", "title": "" }, { "docid": "4df1dae1a0955b44d6c7a94173006d99", "score": "0.62592286", "text": "func (c *Context) HTTPGet(uri string) (*http.Response, error) {\n\tscheme := \"http\"\n\tif c.Request.TLS != nil {\n\t\tscheme = \"https\"\n\t}\n\tsanitizedURI, _ := url.ParseRequestURI(uri)\n\ttargetUrl := fmt.Sprintf(\"%s://%s%s\", scheme, c.Request.Host, sanitizedURI.RequestURI())\n\n\treq, _ := http.NewRequest(http.MethodGet, targetUrl, nil)\n\tsessionCookie, _ := c.Cookie(\"hexya-session\")\n\treq.AddCookie(&http.Cookie{\n\t\tName: \"hexya-session\",\n\t\tValue: sessionCookie,\n\t})\n\tclient := http.Client{}\n\treturn client.Do(req)\n}", "title": "" }, { "docid": "8d29fb46bdd826de030ae0ac5eecbb97", "score": "0.623036", "text": "func HttpGet(rawurl string, header http.Header, proxyURL string) (*http.Response, error) {\n\treq, err := http.NewRequest(\"GET\", rawurl, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Set(\"Proxy-Switch-Ip\", \"yes\")\n\treq.Header.Set(\"User-Agent\", UserAgent)\n\tfor k, vs := range header {\n\t\treq.Header[k] = vs\n\t}\n\n\t// 设置请求超时时间\n\tclient := &http.Client{\n\t\tTimeout: 3 * 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// 设置代理\n\tif proxyURL != \"\" {\n\t\tparsedProxyUrl, err := url.Parse(proxyURL)\n\t\tif err == nil {\n\t\t\tclient.Transport = &http.Transport{\n\t\t\t\tProxy: http.ProxyURL(parsedProxyUrl),\n\t\t\t}\n\t\t}\n\t}\n\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif resp.StatusCode == 200 {\n\t\treturn resp, nil\n\t}\n\n\tif resp.StatusCode == 404 { //\n\t\terr = ErrHttpNotFound\n\t} else {\n\t\terr = ErrHttpError\n\t}\n\n\treturn resp, err\n}", "title": "" }, { "docid": "876ffeaa8dd431f096c80b7508a2cd0b", "score": "0.6226583", "text": "func (hc *Client) Get(url string) (resp *http.Response, err error) {\n\treq, err := http.NewRequest(\"GET\", url, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn hc.Do(req)\n}", "title": "" }, { "docid": "7b605262440e7d8bc43ba98f47168358", "score": "0.6225387", "text": "func (c *Client) Get(url string) (*http.Response, error) {\n\treq, err := http.NewRequest(\"GET\", url, http.NoBody)\n\tif err != nil {\n\t\tfmt.Println(\"error making request \" + err.Error())\n\t\treturn nil, err\n\t}\n\tc.addHeader(req)\n\tresp, err := c.httpclient.Do(req)\n\tif err != nil {\n\t\tfmt.Println(\"error making request \" + err.Error())\n\t\treturn nil, err\n\t}\n\treturn resp, nil\n}", "title": "" }, { "docid": "83fa60950eecbcc540b868fbbd600ad0", "score": "0.6221929", "text": "func (c *restClient) Get(ctx context.Context, uriPath, uriQuery string) (*http.Response, error) {\n\tu, err := url.Parse(c.url)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tu.Path = path.Join(u.Path, uriPath)\n\tu.RawQuery = uriQuery\n\tvar req *http.Request\n\treq, err = http.NewRequestWithContext(ctx, http.MethodGet, u.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\tfor key, value := range c.headers {\n\t\treq.Header.Set(key, value)\n\t}\n\n\treturn c.client.Do(req)\n}", "title": "" }, { "docid": "70bae21fc723df446f908316c5ce20ce", "score": "0.6218864", "text": "func (req *Request) GET() (*http.Request, error) {\n\treturn http.NewRequest(\"GET\", req.sourceURL, nil)\n}", "title": "" }, { "docid": "2540b315a8b17893b9d092925fb1eefa", "score": "0.62157524", "text": "func (c *Client) Get(url string, params url.Values) ([]byte, error) {\n\treturn c.do(\"GET\", url, \"\", params, nil)\n}", "title": "" }, { "docid": "245190ce56cd744c829610e1a0d6de9d", "score": "0.6210002", "text": "func (r *Request) Get(pathURL string) *Request {\n\tr.method = http.MethodGet\n\treturn r.Path(pathURL)\n}", "title": "" }, { "docid": "f4b5544ef4c4dd26b1ea563b67e8e927", "score": "0.62090313", "text": "func (c *RESTClient) Get() *Request {\n\treturn c.Verb(\"GET\")\n}", "title": "" }, { "docid": "80fe7ac373cb8ba4c018ec6774a649b0", "score": "0.62064654", "text": "func (rqt *Requester) Get(path string, params map[string]string) (string, error) {\n\t_, body, err := rqt.GetR(path, params)\n\treturn body, err\n}", "title": "" }, { "docid": "d3d9e85f4d37d8c973f64253189a54e4", "score": "0.62053543", "text": "func (c *Client) Get(\n\turl string,\n\tqueryParams interface{},\n\trespBody interface{},\n) (*http.Response, error) {\n\treturn c.GetWithContext(context.Background(), url, queryParams, respBody)\n}", "title": "" }, { "docid": "bff2f8efaac1f260ea8e3dd5d977097f", "score": "0.6200311", "text": "func (a *API) Get(path string, params finnhub.URLParams, response interface{}) error {\n\treturn a.Call(http.MethodGet, path, params, response)\n}", "title": "" }, { "docid": "4cbbfec24e60a4c6b2ed4a54f1631d29", "score": "0.61816704", "text": "func (c *HTTPClient) Get(href string) (*bytes.Buffer, error) {\n\treturn c.get(href)\n}", "title": "" }, { "docid": "4c28d9b60ea66c40ce1f6f9508405d13", "score": "0.61765605", "text": "func HTTPGet(url string, timeout time.Duration, insecure bool) (int, error) {\n\ttr := &http.Transport{\n\t\tTLSClientConfig: &tls.Config{InsecureSkipVerify: insecure},\n\t}\n\tclient := http.Client{\n\t\tTimeout: timeout,\n\t\tTransport: tr,\n\t}\n\n\tresp, err := client.Get(url)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn resp.StatusCode, nil\n}", "title": "" }, { "docid": "aee022105fcb6964d20c61bc88b71fed", "score": "0.6176023", "text": "func (c Client) Get(path string, options ...Option) (*Response, error) {\n\treturn c.Do(http.MethodGet, path, nil, options...)\n}", "title": "" }, { "docid": "f5a02988a89aba8ddd4792b0963ee4fa", "score": "0.6175824", "text": "func Get(url string, options ...func(*Request)) (*Response, error) {\n\treturn New(\"GET\", url, options...)\n}", "title": "" }, { "docid": "8dd3d74ff8f8a8c06c520ceefe175e32", "score": "0.61615866", "text": "func (o ProbePtrOutput) HttpGet() HTTPGetActionPtrOutput {\n\treturn o.ApplyT(func(v *Probe) *HTTPGetAction {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.HttpGet\n\t}).(HTTPGetActionPtrOutput)\n}", "title": "" }, { "docid": "d6d70a60ca9340472d7627caaad03e26", "score": "0.6159584", "text": "func (c *Client) Get(u string, params url.Values, t int) ([]byte, error) {\n\treturn c.Do(http.MethodGet, u, params, t)\n}", "title": "" }, { "docid": "deebbc29d0426e23b5bbf2b1f484e955", "score": "0.6146324", "text": "func Get(url, user, pwd string) (*http.Response, error) {\n\t// create request\n\treq, err := http.NewRequest(\"GET\", url, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// add http request headers\n\tif len(user) > 0 && len(pwd) > 0 {\n\t\treq.Header.Add(\"Authorization\", httpserver.BasicToken(user, pwd))\n\t}\n\t// issue http request\n\tresp, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// do we have a nil response?\n\tif resp == nil {\n\t\treturn resp, errors.New(fmt.Sprintf(\"error: response was empty for resource: %s\", url))\n\t}\n\t// check error status codes\n\tif resp.StatusCode != 200 {\n\t\terr = errors.New(fmt.Sprintf(\"error: response returned status: %s. resource: %s\", resp.Status, url))\n\t}\n\treturn resp, err\n}", "title": "" }, { "docid": "b60fa2dee37dce8e12c85a25a7f2f5eb", "score": "0.6145372", "text": "func (r *Requester) Get(endpoint string, responseStruct interface{}, querystring map[string]string) (*http.Response, error) {\n\tar := NewAPIRequest(\"GET\", endpoint, nil)\n\tar.Suffix = \"\"\n\treturn r.Do(ar, responseStruct, querystring)\n}", "title": "" }, { "docid": "0e282dae51ea939ac7b11745ce5e3cf2", "score": "0.6145178", "text": "func Get(ctx context.Context, url string) (resp *http.Response, err error) {\n\treturn ClientGet(ctx, http.DefaultClient, url)\n}", "title": "" }, { "docid": "5b75137de2b25a2b6b849706ffb20f81", "score": "0.6140537", "text": "func (c *CircleCIClient) Get(url string) (*http.Response, error) {\n\treturn c.do(http.MethodGet, url, nil)\n}", "title": "" }, { "docid": "6586dce3c416231a12dd55bbd92585b1", "score": "0.61399335", "text": "func (g *xGroup) GET(path string, h HttpHandle) RouterNode {\n\treturn g.add(RouteMethod_GET, path, h)\n}", "title": "" }, { "docid": "c1708326a973ee3c661488db129b9345", "score": "0.61361563", "text": "func (c *Client) Get(URL string) (resp *Response, err error) {\n\turlObj, err := url.ParseRequestURI(URL)\n\tif err != nil {\n\t\treturn\n\t}\n\theader := make(map[string]string)\n\theader[HeaderContentLength] = \"0\"\n\theader[HeaderHost] = urlObj.Host\n\treq := &Request{\n\t\tMethod: MethodGet,\n\t\tURL: urlObj,\n\t\tProto: HTTPVersion,\n\t\tHeader: header,\n\t\tContentLength: 0,\n\t\tBody: strings.NewReader(\"\"),\n\t}\n\tresp, err = c.Send(req)\n\treturn\n}", "title": "" }, { "docid": "dce5ab9f0be40cfdeb564791f5f54b6e", "score": "0.61348283", "text": "func (c *client) Get(\n\tctx context.Context,\n\tonResponse ResponseHandler,\n\turl string,\n\topts ...RequestOption,\n) error {\n\treturn c.Do(ctx, onResponse, \"GET\", url, nil, opts...)\n}", "title": "" }, { "docid": "f25c9eb6c8b4c95b51ea51119d1b404f", "score": "0.6126502", "text": "func (c *restClient) Get(\n\tbrokerSpec framework.ServiceBrokerSpec,\n\tquery url.Values,\n\tpathElts ...string,\n) (*http.Request, error) {\n\treq, err := http.NewRequest(\"GET\", c.urlStr(brokerSpec, pathElts...), nil)\n\tif err != nil {\n\t\tlogger.Debugf(\"CF Client GET error (%s)\", err)\n\t\treturn nil, err\n\t}\n\treq.URL.RawQuery = query.Encode()\n\tlogger.Debugf(\"CF client making GET request to %s\", req.URL.String())\n\treq.Header.Set(versionHeader, apiVersion)\n\treturn req, nil\n}", "title": "" }, { "docid": "1e6825dffcc3ec99e4c5fed8b2608077", "score": "0.6123532", "text": "func Get(url string) *Request {\n\treturn New().AsGet().WithURL(url)\n}", "title": "" }, { "docid": "17613958062f335eceb97ce6175a3d67", "score": "0.61214405", "text": "func (c *Client) doHTTPGet(url string, data url.Values) (*http.Response, error) {\n\tif data != nil {\n\t\turl = url + \"?\" + data.Encode()\n\t}\n\treq, err := http.NewRequest(\"GET\", url, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn c.doHTTP(req)\n}", "title": "" }, { "docid": "1eea5877d4eddee27341c953063f22b5", "score": "0.612094", "text": "func (c *Ctx) GET(url string) error {\n\treturn c.httpRequest(\"GET\", url, \"\")\n}", "title": "" }, { "docid": "3833eea277e26a5f90a49357e601eb08", "score": "0.61047214", "text": "func (c *httpClient) GetHTTP(initURL string) (*http.Response, error) {\n //c.mutex.Lock()\n //defer c.mutex.Unlock()\n\n // Using custom net client to add required timeouts since the go http clients default timeout is 0 which waits forever\n var netTransport = &http.Transport{\n DialContext: (&net.Dialer{\n Timeout: 5 * time.Second,\n }).DialContext,\n TLSHandshakeTimeout: 5 * time.Second,\n IdleConnTimeout: 5 * time.Second,\n ExpectContinueTimeout: 5 * time.Second,\n MaxIdleConns: 100,\n MaxConnsPerHost: 100,\n MaxIdleConnsPerHost: 100,\n }\n var netClient = &http.Client{\n Timeout: time.Second * 10,\n Transport: netTransport,\n }\n\n return netClient.Get(initURL)\n}", "title": "" }, { "docid": "2748be98ea5b49a9aefc89fca0e85f58", "score": "0.60919803", "text": "func (c *Client) get(ctx context.Context, url string, v interface{}) error {\n\treq, err := c.newRequest(ctx, \"GET\", url, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = c.send(req, v)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "df6156aad5f1473194cac8dff0ef5594", "score": "0.6091979", "text": "func HttpGetE(t testing.TestingT, url string, tlsConfig *tls.Config) (int, string, error) {\n\treturn HttpGetWithOptionsE(t, HttpGetOptions{Url: url, TlsConfig: tlsConfig, Timeout: 10})\n}", "title": "" }, { "docid": "1acb61e56dc844d78998046723d6c5d6", "score": "0.6088986", "text": "func (c *Client) Get(url string) (*http.Response, error) {\n\treq, err := NewRequest(\"GET\", url, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn c.Do(req)\n}", "title": "" }, { "docid": "09f4ced34febc4bb286ad510493fa5c1", "score": "0.60827875", "text": "func (c *Client) Get(ctx context.Context, url string, v interface{}) (*Response, error) {\n\tr := &Request{Ctx: ctx, Method: http.MethodGet, URL: url}\n\trsp, err := c.Send(r).Response()\n\tif err != nil {\n\t\treturn rsp, err\n\t}\n\tif v != nil {\n\t\treturn rsp, rsp.Decode(v)\n\t}\n\treturn rsp, nil\n}", "title": "" }, { "docid": "5297e9910a7d21b3bd94c654fa908f68", "score": "0.6078611", "text": "func (c *Client) Get(url string) (resp *http.Response, err error) {\n\treq, err := http.NewRequest(\"GET\", url, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn c.Do(req)\n}", "title": "" }, { "docid": "ef97b7a97a06783696e25a648f562226", "score": "0.60736775", "text": "func Get(t test.T, url string, respBody interface{}, apiToken string) int {\n\treturn doRequestWithoutBody(t, url, http.MethodGet, respBody, apiToken)\n}", "title": "" }, { "docid": "0e08925fe06f0ebc013f6ecac2f217c1", "score": "0.60658306", "text": "func (c *Client) Get(path string) (*http.Response, error) {\n\tendpoint := strings.TrimSuffix(c.BaseURL+path, \"\\n\")\n\treq, err := http.NewRequest(\"GET\", endpoint, nil)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\taddHeader(req, c.APIKey)\n\treturn c.httpClient.Do(req)\n}", "title": "" }, { "docid": "fab73fe89fee11cfd6922c0697bc7e84", "score": "0.6063607", "text": "func Get(path string, headers map[string]string) ([]byte, error) {\n\tclient := &http.Client{}\n\treturn getResponse(client, path, headers)\n}", "title": "" }, { "docid": "42ebb73cf0759196d23fadb05e7d1358", "score": "0.60576344", "text": "func get(url string) (*http.Response, error) {\n\tresp, err := http.Get(url)\n\treturn resp, err\n}", "title": "" }, { "docid": "5125b5646b048a7ecccd3f802a5b13fc", "score": "0.6055931", "text": "func GET(url string) Agent {\n\treturn newAgentWithClient(_httpClient).GET(url)\n}", "title": "" }, { "docid": "1ac04433a8b709ce56e5ef572f098fd4", "score": "0.60540056", "text": "func (c *RestHTTPClient) Get(APIUrl, queryString string) (string, error) {\n\turl := c.BaseURL + \"/\" + APIUrl\n\n\tif queryString != \"\" {\n\t\turl = url + \"?\" + queryString\n\t}\n\n\treq, err := http.NewRequest(\"GET\", url, nil)\n\tif err != nil {\n\t\tlog.Fatal(\"NewRequest: \", err)\n\t\treturn \"\", err\n\t}\n\n\t// Set authorization token\n\tc.setAuthenticationHeader(req)\n\n\t// Set User-Agent header\n\tc.setUserAgentHeader(req)\n\n\tresp, err := c.Client.Do(req)\n\tif err != nil {\n\t\tlog.Fatal(\"Do: \", err)\n\t\treturn \"\", err\n\t}\n\n\tdefer resp.Body.Close()\n\n\tbs, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\tlog.Fatal(\"ReadAll: \", err)\n\t\treturn \"\", err\n\t}\n\n\treturn string(bs), nil\n}", "title": "" } ]
89eb4f78548e5beb600be601815f067e
Create response model instance with FAILURE or ERROR result.
[ { "docid": "c30e937f3880eab0b9104942d340623a", "score": "0.58047765", "text": "func NewFailedResponseModelWithData( errorCode enum.ErrorCode, errorMsg string, returnData interface{}) *ResponseModel {\n\tresponse :=&ResponseModel{\n\t\tReturnCode: errorCode.GetRespCode(),\n\t\tReturnMsg: errorMsg,\n\t}\n\n\tif returnData != nil {\n\t\tresponse.ReturnData = returnData\n\t}\n\n\treturn response\n}", "title": "" } ]
[ { "docid": "6575819149fa929e85981814a2f45658", "score": "0.6352041", "text": "func CreateFailureResponseMessage(message string, code string, errs []ErrorResponse) ResponseMessage {\n\n\tresponseMessage := ResponseMessage{\n\t\tStatus: StatusResponse{\n\t\t\tMessage: message,\n\t\t\tCode: code,\n\t\t},\n\t\tErrors: errs,\n\t}\n\n\treturn responseMessage\n\n}", "title": "" }, { "docid": "a171119de68eac4155eb4c163b823012", "score": "0.62788236", "text": "func Fail(message string, statusCode int) *response {\n\treturn newResponse(false, message, nil, statusCode)\n}", "title": "" }, { "docid": "d05ec2309ce9000a58225b51acd667be", "score": "0.62067217", "text": "func failure(err error) (Response, error) {\n\tfmt.Printf(\"ERROR: %v\\n\", err)\n\treturn Response{StatusCode: 500}, err\n}", "title": "" }, { "docid": "b7fdb0e56912e6c05c6ba34cad29aa08", "score": "0.6127292", "text": "func newResult(response *http.Response) (*Result, error) {\n\tresult := new(Result)\n\t// attempt to de-serialise the response\n\terr := json.NewDecoder(response.Body).Decode(result)\n\t// close the response\n\tdefer func() {\n\t\tif ferr := response.Body.Close(); ferr != nil {\n\t\t\terr = ferr\n\t\t}\n\t}()\n\t// if the de-serialisation fails, it could be that the server is returning an error code\n\tif err != nil {\n\t\t// if there is an error code\n\t\tif response.StatusCode > 299 {\n\t\t\t// added to the result\n\t\t\tresult.Error = true\n\t\t\tresult.Message = response.Status\n\t\t\terr = nil\n\t\t}\n\t\treturn result, err\n\t}\n\t// else returns the result sent by the server\n\treturn result, nil\n}", "title": "" }, { "docid": "52d53b7fff081bcb8d39fe90e7901137", "score": "0.60211647", "text": "func Fail(message string, err error) Response {\n\treturn Response{\n\t\tCode: http.StatusInternalServerError,\n\t\tStatus: StatusFail,\n\t\tMessage: message,\n\t\tData: err,\n\t}\n}", "title": "" }, { "docid": "a5ed5f51dfe4a38950578fa15dc9a809", "score": "0.5834826", "text": "func NewFailedResponseModel( errorCode enum.ErrorCode, errorMsg string) *ResponseModel {\n\treturn &ResponseModel{\n\t\tReturnCode: errorCode.GetRespCode(),\n\t\tReturnMsg: errorMsg,\n\t}\n}", "title": "" }, { "docid": "2e307d41e2b81b9d6972cfa7eeb59263", "score": "0.582887", "text": "func createCopyReponseFailure(errorCode int, errorMsg string) *crb_web.CreateCopyDefault {\n\tfailedResponse := crb_web.NewCreateCopyDefault(errorCode)\n\tmodelErrorInt := int32(errorCode)\n\tmodelsError := models.Error{Code: &modelErrorInt, Message: &errorMsg}\n\tfailedResponse.SetPayload(&modelsError)\n\treturn failedResponse\n}", "title": "" }, { "docid": "d86a54d4c273abc78e26203f87d87799", "score": "0.5793336", "text": "func FailureResponse(ctx types.Context, response contract.Response, httpCode int, err *error.Error) contract.Response {\n\tresponse.SetRequestID(ctx.GetReqID())\n\tresponse.SetMethod(ctx.GetMethod())\n\tresponse.SetHTTPCode(httpCode)\n\tresponse.SetStatus(\"Failure\")\n\tresponse.SetError(err)\n\treturn response\n}", "title": "" }, { "docid": "2fba3e537f097d9e0e19d875e3c4459b", "score": "0.57881016", "text": "func FailResponse(msg string) JsendMessage {\n\tresponse := JsendMessage{}\n\tresponse.Status = \"failed\"\n\tresponse.Message = msg\n\n\treturn response\n}", "title": "" }, { "docid": "594b5d453da9bb28083e8a32db842be6", "score": "0.57185084", "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": "48f78b71c0fc64a66502e90b6fc6985c", "score": "0.5670324", "text": "func CreateErr(err error) *ResponseError {\n\tres := &ResponseError{Error: err.Error()}\n\treturn res\n}", "title": "" }, { "docid": "a97d132cc291e06b317dd98e00a98314", "score": "0.5654658", "text": "func ToResponse(result interface{}) (Response, error) {\n\terrorWithCode, ok := result.(httperror.Error)\n\t// Http Error with statusCode\n\tif ok {\n\t\tjsonBody, toJsonErr := toJsonError(errorWithCode.Error())\n\t\tif toJsonErr != nil {\n\t\t\treturn InternalServerErrorResp(), toJsonErr\n\t\t}\n\t\tresp := Response{\n\t\t\tStatusCode: errorWithCode.Code(),\n\t\t\tBody: jsonBody,\n\t\t\tHeaders: commonHeaders,\n\t\t}\n\t\treturn resp, nil\n\t}\n\n\tregularError, ok := result.(error)\n\t// regular error\n\tif ok {\n\t\tjsonBody, marshalError := toJsonError(regularError.Error())\n\t\tif marshalError != nil {\n\t\t\treturn InternalServerErrorResp(), marshalError\n\t\t}\n\t\tresp := Response{\n\t\t\tStatusCode: http.StatusInternalServerError,\n\t\t\tBody: jsonBody,\n\t\t\tHeaders: commonHeaders,\n\t\t}\n\t\treturn resp, nil\n\t}\n\n\tjsonBody, marshalError := toJson(result)\n\tif marshalError != nil {\n\t\treturn InternalServerErrorResp(), marshalError\n\t}\n\tresp := Response{\n\t\tStatusCode: http.StatusOK,\n\t\tBody: jsonBody,\n\t\tHeaders: commonHeaders,\n\t}\n\treturn resp, nil\n}", "title": "" }, { "docid": "ab264a76679646c31b752d4a2f213956", "score": "0.56164473", "text": "func New(status int, description string) HttpErr {\n\treturn &error{status, description}\n}", "title": "" }, { "docid": "da1b97eed04a11f1540c72dfb2061d0d", "score": "0.55998653", "text": "func GenerateFailureResponse(ErrCat string, ErrCode string, ErrMsg string) []byte {\n\tresponse, err := (json.MarshalIndent(jsonError{Result: \"fail\", ErrorCategory: ErrCat, ErrorCode: ErrCode, ErrorMessage: ErrMsg}, \"\", \" \"))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn response\n}", "title": "" }, { "docid": "229b44ae7cf76d8952e2ec206a32f1c3", "score": "0.5589359", "text": "func New(status bool, code int, message string, err, data interface{}) _response {\n\treturn _response{\n\t\tStatus: status,\n\t\tCode: code,\n\t\tMessage: message,\n\t\tError: err,\n\t\tData: data,\n\t}\n}", "title": "" }, { "docid": "98bbff466033416951402141ceb24cd2", "score": "0.55850327", "text": "func (ctx *Context) Failure(err error) error {\n\treturn echo.NewHTTPError(http.StatusInternalServerError, err)\n}", "title": "" }, { "docid": "a2a5f777b276637e5e70483945248d95", "score": "0.55816346", "text": "func Failure(w http.ResponseWriter, err error) {\n\tswitch err.(type) {\n\tcase *Error:\n\t\treportError(w, err)\n\tcase *ValidationError:\n\t\treportValidationError(w, err)\n\tdefault:\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t}\n}", "title": "" }, { "docid": "cdfcbcb6fd6cdb4ebc79c2ee3fc7003a", "score": "0.55604076", "text": "func newResult(response *http.Response) (*Result, error) {\n result := new(Result)\n // de-serialise the response\n err := json.NewDecoder(response.Body).Decode(result)\n // if the de-serialisation fails then return the error\n if err != nil {\n return result, err\n }\n // close the response\n defer func() {\n if ferr := response.Body.Close(); ferr != nil {\n err = ferr\n }\n }()\n // returns the result\n return result, nil\n}", "title": "" }, { "docid": "d9c7b417bf048a7d48937fee2c1ec0ec", "score": "0.55570185", "text": "func NewFailure(cond *Condition, errs error) *Failure {\n\treturn &Failure{\n\t\tCondition: cond,\n\t\tError: errs,\n\t}\n}", "title": "" }, { "docid": "0001a4ac80f182e84407dd937a87d08c", "score": "0.55479383", "text": "func CreateResponseStatus(result core.MethodResult,\n\topRestMetaData protocol.OperationRestMetadata) (statusCode int, status string, respError []error) {\n\n\tif result.IsSuccess() {\n\t\tstatusOKTextFunc := func(statusCode int) string {\n\t\t\tstatusText := http.StatusText(statusCode)\n\t\t\tif statusText == \"\" {\n\t\t\t\treturn http.StatusText(http.StatusOK)\n\t\t\t}\n\t\t\treturn statusText\n\t\t}\n\n\t\tfor _, code := range rest.SUCCESSFUL_STATUS_CODES {\n\t\t\tif opRestMetaData.SuccessCode() == code {\n\t\t\t\treturn code, statusOKTextFunc(code), nil\n\t\t\t}\n\t\t}\n\t\treturn http.StatusOK, statusOKTextFunc(http.StatusOK), nil\n\t}\n\n\terrorNameToStatusMap := opRestMetaData.ErrorCodeMap()\n\tif len(errorNameToStatusMap) > 0 {\n\t\terrorName := result.Error().Name()\n\t\tif httpErrorCode, ok := errorNameToStatusMap[errorName]; ok {\n\t\t\tstatusCode = httpErrorCode\n\t\t\tif httpErrorCode < 500 {\n\t\t\t\tstatus = errorName\n\t\t\t} else {\n\t\t\t\tstatus = \"Internal Server Error\"\n\t\t\t}\n\t\t} else {\n\t\t\tstatusCode = rest.HTTP_500_INTERNAL_SERVER_ERROR\n\t\t\tstatus = \"Internal Server Error\"\n\t\t\treturn statusCode, status, []error{l10n.NewRuntimeError(\"vapi.protocol.server.rest.error.not_supported\",\n\t\t\t\tmap[string]string{\"errorName\": errorName})}\n\t\t}\n\t} else {\n\t\terrorName := result.Error().Name()\n\t\tif httpErrorCode, ok := rest.VAPI_TO_HTTP_ERROR_MAP[errorName]; ok {\n\t\t\tstatusCode = httpErrorCode\n\t\t\tstatus = http.StatusText(statusCode)\n\t\t} else {\n\t\t\tstatusCode = rest.HTTP_500_INTERNAL_SERVER_ERROR\n\t\t\tstatus = \"Internal Server Error\"\n\t\t\treturn statusCode, status, []error{l10n.NewRuntimeError(\"vapi.protocol.server.rest.error.not_supported\",\n\t\t\t\tmap[string]string{\"errorName\": errorName})}\n\t\t}\n\n\t\tif status == \"\" {\n\t\t\tstatus = http.StatusText(http.StatusInternalServerError)\n\t\t}\n\t}\n\n\treturn statusCode, status, nil\n}", "title": "" }, { "docid": "7d92b5d0ae17ab52b8c0330e90affcda", "score": "0.5546028", "text": "func NewResponse(id uint64, result interface{}, rpcErr *Error) (*Message, error) {\n\tif id == 0 {\n\t\treturn nil, fmt.Errorf(\"id = 0 not allowed for response-type message\")\n\t}\n\tencResult, err := json.Marshal(result)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresp := &ResponsePayload{\n\t\tResult: encResult,\n\t\tError: rpcErr,\n\t}\n\tencResp, err := json.Marshal(resp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Message{\n\t\tType: Response,\n\t\tPayload: json.RawMessage(encResp),\n\t\tID: id,\n\t}, nil\n}", "title": "" }, { "docid": "c3565d7b1c11fd52e4982ddb51fd4efd", "score": "0.5529052", "text": "func MapToCreateResponse(entityCreated bool, entityName string, entityValue string) *common.BaseHTTPResponse {\n\trs := &common.BaseHTTPResponse{}\n\tif entityCreated {\n\t\trs.Data = entityName + \" \" + entityValue + \" Created sucessfully\"\n\t}\n\treturn rs\n}", "title": "" }, { "docid": "92ad196cc19b1f616f3adf08dc5a9d14", "score": "0.5523204", "text": "func newErrResponse(code int, err error) *ErrResponse {\n\treturn &ErrResponse{Code: code, Err: err}\n}", "title": "" }, { "docid": "80143f950965326ec73ae36b6bf5b92e", "score": "0.55193645", "text": "func CreateResponse(status int, message string, payload interface{}) Response {\n\tr := Response{HTTPStatus: status, Message: message, Payload: payload}\n\treturn r\n}", "title": "" }, { "docid": "d7940071ee9c8fed59b7826ea8178db6", "score": "0.55027", "text": "func NewResponse() Response { return Response{} }", "title": "" }, { "docid": "9fbadb9d3276e78b25df7ffb09c210f2", "score": "0.55010235", "text": "func (c *baseController) failure(w http.ResponseWriter, code int, message string) error {\n\t// tODO: map against custom error-codes\n\n\tw.Header().Set(\"Content-type\", \"application/json\")\n\tw.WriteHeader(http.StatusInternalServerError)\n\t_, err := w.Write([]byte(message))\n\treturn err\n}", "title": "" }, { "docid": "a706b6eb11ed718b64ab2596dd34fab6", "score": "0.5490922", "text": "func NewResult(matched bool, got interface{}, msg string) Result {\n\tr := Result{\n\t\tstatus: Match,\n\t\tmsg: msg,\n\t\tvalue: got,\n\t}\n\tif !matched {\n\t\tr.status = Mismatch\n\t\tr.backtrace = backtrace()\n\t}\n\treturn r\n}", "title": "" }, { "docid": "cda750d9b4dc2125bf53f95cdd694c10", "score": "0.54711133", "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": "81c7e684d9f65c663c72e7922a5b31e9", "score": "0.54635257", "text": "func conversionResponseFailureWithMessagef(msg string, params ...interface{}) *apix.ConversionResponse {\n\treturn &apix.ConversionResponse{\n\t\tResult: metav1.Status{\n\t\t\tMessage: fmt.Sprintf(msg, params...),\n\t\t\tStatus: metav1.StatusFailure,\n\t\t},\n\t}\n\n}", "title": "" }, { "docid": "be7d42b5ed8f3800b2a04828439fe650", "score": "0.5456216", "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": "757b911f67d5e8ca7b3badc42195942c", "score": "0.5447735", "text": "func createResponse(op string, res interface{}, resErr *msgjson.Error) *msgjson.ResponsePayload {\n\tencodedRes, err := json.Marshal(res)\n\tif err != nil {\n\t\terr := fmt.Errorf(\"unable to marshal data for %s: %v\", op, err)\n\t\tpanic(err)\n\t}\n\treturn &msgjson.ResponsePayload{Result: encodedRes, Error: resErr}\n}", "title": "" }, { "docid": "665ccd42702275a060c2c7b252b9ea10", "score": "0.5446055", "text": "func Fail() *Status {\n\tstatus, _ := Respond(500, \"UNEXPECTED APPLICATION ERROR\")\n\treturn status\n}", "title": "" }, { "docid": "5991f4d41a9ce0eae383ca7bfdf7242a", "score": "0.54432327", "text": "func v2ResponseFailure(casError *cas.CasError, format string) string {\n\tif format == \"XML\" {\n\t\treturn fmt.Sprintf(v2ValidationFailureXML, casError.Code, casError.InnerError)\n\t}\n\n\treturn fmt.Sprintf(v2ValidationFailureJSON,\n\t\tcasError.Code, casError.InnerError)\n}", "title": "" }, { "docid": "175152f9fddf6065c95f36d579daef93", "score": "0.5434295", "text": "func New(statuses ...int) (result Response) {\n\tresult = &response{\n\t\tdata: map[string]interface{}{},\n\t\theaders: map[string]string{},\n\t}\n\tresult.ContentType(\"application/json\")\n\tif len(statuses) > 0 {\n\t\tresult.Status(statuses[0])\n\t} else {\n\t\tresult.Status(http.StatusOK)\n\t}\n\treturn\n}", "title": "" }, { "docid": "5c531987041f00d074e820f4cd5b3ab3", "score": "0.543253", "text": "func (a *assessor) Failure(errorMessage string) metadata.Contract {\n\treturn pkiAssessorMetadata.NewFailure(errorMessage)\n}", "title": "" }, { "docid": "fd15eb7f18041716064e7ea5d24f795d", "score": "0.5431127", "text": "func errorResult(ctx *fasthttp.RequestCtx, tid []byte, err error) {\n\tvar result = model.Result{}\n\tresult.Code = 500\n\tresult.Msg = error.Error(err)\n\tresult.TimeStamp = time.Now().UnixNano()\n\tctx.Response.Header.SetBytesV(\"tid\", tid)\n\tctx.Response.SetStatusCode(fasthttp.StatusInternalServerError)\n\tout, _ := json.Marshal(result)\n\tctx.SetBody(out)\n\n}", "title": "" }, { "docid": "f0328e7e26844069a44fb1f7077583dc", "score": "0.53962076", "text": "func ToHTTPErr(st *status.Status) *Error {\n\tswitch st.Code() {\n\tcase StatusSuccess.status.Code():\n\t\treturn Success\n\tcase StatusInternalServerError.status.Code():\n\t\treturn InternalServerError\n\tcase StatusInvalidParams.status.Code():\n\t\treturn InvalidParams\n\tcase StatusUnauthorized.status.Code():\n\t\treturn Unauthorized\n\tcase StatusNotFound.status.Code():\n\t\treturn NotFound\n\tcase StatusDeadlineExceeded.status.Code():\n\t\treturn DeadlineExceeded\n\tcase StatusAccessDenied.status.Code():\n\t\treturn AccessDenied\n\tcase StatusLimitExceed.status.Code():\n\t\treturn LimitExceed\n\tcase StatusMethodNotAllowed.status.Code():\n\t\treturn MethodNotAllowed\n\tcase StatusServiceUnavailable.status.Code():\n\t\treturn ServiceUnavailable\n\t}\n\n\treturn &Error{\n\t\tcode: getCodeInt(st),\n\t\tmsg: st.Message(),\n\t}\n}", "title": "" }, { "docid": "3c56c5d43901103fed7d48315c8e950f", "score": "0.536168", "text": "func NewFail(message string, data ...interface{}) error {\n\treturn &Fail{\n\t\tMessage: message,\n\t\tData: data,\n\t\tHTTPStatus: 0,\n\t}\n}", "title": "" }, { "docid": "7bac7f268e042659deabaafbde7f43c0", "score": "0.53609383", "text": "func NewResponse(status int, data interface{}, errorStr string) Response {\n\tval := json.RawMessage{}\n\tif data != nil {\n\t\tvar err error\n\t\tval, err = json.Marshal(data)\n\t\tif err != nil {\n\t\t\tstatus = StatusInternalErr\n\t\t\terrorStr = err.Error()\n\t\t}\n\n\t}\n\treturn Response{Status: status, Data: val, Error: errorStr}\n}", "title": "" }, { "docid": "ab70382aa751170577aebf8424918232", "score": "0.5353231", "text": "func NewResponse(status int, message string, data interface{}) (Response, error) {\n\tif reflect.TypeOf(data).Kind() == reflect.Int64 {\n\t\tdt, ok := data.(int64)\n\t\tif !ok {\n\t\t\terr := errors.New(\"invalid data in creating response, expecting int64\")\n\n\t\t\treturn Response{Status: &status, Message: &message}, err\n\t\t}\n\n\t\tartcl := article.Article{\n\t\t\tID: &dt,\n\t\t}\n\n\t\treturn Response{\n\t\t\tStatus: &status,\n\t\t\tMessage: &message,\n\t\t\tData: artcl,\n\t\t}, nil\n\t}\n\n\tdt, ok := data.([]article.Article)\n\tif !ok {\n\t\terr := errors.New(\"invalid data in creating response, expecting a slice of structs\")\n\n\t\treturn Response{Status: &status, Message: &message}, err\n\t}\n\n\treturn Response{\n\t\tStatus: &status,\n\t\tMessage: &message,\n\t\tData: &dt,\n\t}, nil\n}", "title": "" }, { "docid": "80b5d1fb1b0f5c267877a785b286443c", "score": "0.5343346", "text": "func (future LROsPut201CreatingFailed200Future) Result(client LROsClient) (p Product, err error) {\n\tvar done bool\n\tdone, err = future.Done(client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"lrogroup.LROsPut201CreatingFailed200Future\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\treturn p, azure.NewAsyncOpIncompleteError(\"lrogroup.LROsPut201CreatingFailed200Future\")\n\t}\n\tif future.PollingMethod() == azure.PollingLocation {\n\t\tp, err = client.Put201CreatingFailed200Responder(future.Response())\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"lrogroup.LROsPut201CreatingFailed200Future\", \"Result\", future.Response(), \"Failure responding to request\")\n\t\t}\n\t\treturn\n\t}\n\tvar req *http.Request\n\tvar resp *http.Response\n\tif future.PollingURL() != \"\" {\n\t\treq, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t} else {\n\t\treq = autorest.ChangeToGet(future.req)\n\t}\n\tresp, err = autorest.SendWithSender(client, req,\n\t\tautorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"lrogroup.LROsPut201CreatingFailed200Future\", \"Result\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\tp, err = client.Put201CreatingFailed200Responder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"lrogroup.LROsPut201CreatingFailed200Future\", \"Result\", resp, \"Failure responding to request\")\n\t}\n\treturn\n}", "title": "" }, { "docid": "a732fe20c98719ff53d94dfd4f335ef2", "score": "0.5335099", "text": "func CreateErrResp(code string, errorMessage string) interface{} {\n\treturn CommonError{\n\t\tError: ErrorClass{\n\t\t\tCode: code,\n\t\t\tMessage: errorMessage,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "9163916c2358d3e5b3a2b07ed3ef3f88", "score": "0.5334953", "text": "func NewResponse(w http.ResponseWriter, r *http.Request) Response {\n\tresp := Response{}\n\tresp.wtr = w\n\tresp.req = r\n\tresp.ErrorCode = ErrorNoError\n\treturn resp\n}", "title": "" }, { "docid": "5c060c15e7e1a947c9cfd4d995f9ccbe", "score": "0.53305346", "text": "func SuccessResponse(data interface{}, message string, code int, s Serializer) SerializerModel {\n\tvar model SerializerModel\n\n\tmodel.Code = code\n\tmodel.Success = true\n\tmodel.Message = message\n\tmodel.HTTPStatus = http.StatusOK\n\n\tif s == nil {\n\t\tmodel.Data = data\n\t\treturn model\n\t}\n\n\tmodel.Data = Serialize(data, s)\n\n\treturn model\n}", "title": "" }, { "docid": "e73f42ffe5b67dc228a568345c32d7fa", "score": "0.531269", "text": "func newErrResp(e error) *response {\n\treturn &response{\n\t\terr: e,\n\t}\n}", "title": "" }, { "docid": "2bfadfa9e1cb276d2b0067d3b35480df", "score": "0.530759", "text": "func NewBusinessErrorResponse(err error) (int, ControllerResponse) {\r\n\treturn errorMapping(err)\r\n}", "title": "" }, { "docid": "497f827f065126379b2720513899bf75", "score": "0.5303032", "text": "func ToResponse(payload interface{}, code string, error error) *Response {\n\tif error == nil {\n\t\treturn &Response{payload, &APIError{code, Empty, error}}\n\t}\n\treturn &Response{payload, &APIError{code, error.Error(), error}}\n}", "title": "" }, { "docid": "a7c4fd70363333ccec885924e3208e50", "score": "0.53021705", "text": "func NewErr(r *http.Response) error {\n\tif r.StatusCode >= http.StatusOK && r.StatusCode < http.StatusMultipleChoices {\n\t\treturn nil\n\t}\n\n\tswitch r.StatusCode {\n\tcase http.StatusUnauthorized:\n\t\treturn transport.ErrAuthenticationRequired\n\tcase http.StatusForbidden:\n\t\treturn transport.ErrAuthorizationFailed\n\tcase http.StatusNotFound:\n\t\treturn transport.ErrRepositoryNotFound\n\t}\n\n\treturn plumbing.NewUnexpectedError(&Err{r})\n}", "title": "" }, { "docid": "c19ec44af26aa4141d884e760ddffcfd", "score": "0.5297706", "text": "func NewSuccess(code int, v interface{}, format string, a ...interface{}) Success {\n\tvar txt string\n\tif code != 0 {\n\t\ttxt = http.StatusText(code)\n\t}\n\treturn Success{\n\t\tStatusCode: code,\n\t\tStatusText: txt,\n\t\tMessage: fmt.Sprintf(format, a...),\n\t\tObject: v,\n\t}\n}", "title": "" }, { "docid": "30d0fc0c10aa903acb684e67980e3d84", "score": "0.5280305", "text": "func (o LookupCapacityCommitmentResultOutput) FailureStatus() StatusResponseOutput {\n\treturn o.ApplyT(func(v LookupCapacityCommitmentResult) StatusResponse { return v.FailureStatus }).(StatusResponseOutput)\n}", "title": "" }, { "docid": "20d5adda068c10a43d9f236baea7a90f", "score": "0.52793807", "text": "func (m *MockSageMakerClientBuilder) AddCreateModelErrorResponse(code string, message string, statusCode int, reqId string) *MockSageMakerClientBuilder {\n\tm.responses.PushBack(createModelResponse{\n\t\terr: awserr.NewRequestFailure(awserr.New(code, message, fmt.Errorf(code)), statusCode, reqId),\n\t\tdata: nil,\n\t})\n\treturn m\n}", "title": "" }, { "docid": "252492460aec676b95cc47002558f7af", "score": "0.5270915", "text": "func create(s *sling.Sling, r interface{}, suc interface{}) (success interface{}, failure error) {\n\tresult := reflect.New(reflect.TypeOf(success))\n\tapierr := new(errors.APIError)\n\t_, err := s.New().Post(\"\").BodyJSON(r).Receive(result, apierr)\n\treturn success, errors.BuildError(err, apierr).(error)\n}", "title": "" }, { "docid": "1cb9fab11f35b05b547cad67f08f4b03", "score": "0.5259187", "text": "func Result(result interface{}) Response {\n\treturn New().Result(result)\n}", "title": "" }, { "docid": "cbd53a94ea256c654d8336b4a9ff3d29", "score": "0.5257126", "text": "func newResponse(seq int, requestSeq int, command string, success bool) *Response {\n\treturn &Response{\n\t\tProtocolMessage: ProtocolMessage{\n\t\t\tSeq: seq,\n\t\t\tType: \"response\",\n\t\t},\n\t\tCommand: command,\n\t\tRequestSeq: requestSeq,\n\t\tSuccess: success,\n\t}\n}", "title": "" }, { "docid": "00e0e762dc92e7a7cc76d541d62fe02f", "score": "0.5250446", "text": "func failed(code int, message string, args ...interface{}) CommonResp {\n\treturn CommonResp{\n\t\tCode: code,\n\t\tMessage: fmt.Sprintf(message, args...),\n\t\tTimestamp: time.Now().Unix(),\n\t}\n}", "title": "" }, { "docid": "a895d5c8848feeddc91d6be9eb4e29f2", "score": "0.52475196", "text": "func New(status int, code string, title string, message string, retriable bool) HttpError {\n\treturn HttpError{\n\t\tStatus: status,\n\t\tCode: code,\n\t\tMessage: message,\n\t\tTitle: title,\n\t\tRetriable: retriable,\n\t}\n}", "title": "" }, { "docid": "81f898ac14563c114f83599d4184e84e", "score": "0.5235699", "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": "616a136e5c6bbc9675e9bb523fe98074", "score": "0.5230782", "text": "func (r Response) NewResponse(st int, msg, dt string, i iserial.Serializable) context.IResponseWriter {\n\td := i.GetMapped()\n\treturn Response{\n\t\tStatus: st,\n\t\tData: d,\n\t\tMessage: msg,\n\t\tDetail: dt,\n\t}\n}", "title": "" }, { "docid": "577ac341b9ddd2be132dd9aa2b77f743", "score": "0.5228046", "text": "func (r *Response) Failed(w http.ResponseWriter) {\n\tr.Status = false\n\n\tif r.StatusCode == 0 {\n\t\tr.StatusCode = http.StatusBadRequest\n\t}\n\n\tjsonResponse, err := json.Marshal(r)\n\tif err != nil {\n\t\tlog.Printf(\"Error while json encode: %q\", err.Error())\n\n\t\tr.StatusCode = http.StatusInternalServerError\n\t\tr.Message = notConvertedToJSONErrorMessage\n\t\tr.Data = nil\n\t\tr.Failed(w)\n\n\t\treturn\n\t}\n\n\tw.WriteHeader(r.StatusCode)\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t_, _ = w.Write(jsonResponse)\n}", "title": "" }, { "docid": "48f4ab80600e2e522e3cb83c7e8c81a4", "score": "0.52227634", "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": "63e7dfd0087bbb561f681dc4c1e0d71d", "score": "0.5219066", "text": "func Get300Response(jsonString interface{}) Response {\n\tvar r Response\n\tr.Code = 300\n\tr.Message = \"Failure : Data is not satisfied\"\n\tr.ResponseData = jsonString\n\treturn r\n}", "title": "" }, { "docid": "6a440721415fa05de53701771cb2008b", "score": "0.5203239", "text": "func createTestModelInvalidInstance() *testModelInvalid {\n\treturn &testModelInvalid{\n\t\tId: 0,\n\t\tField: -1,\n\t}\n}", "title": "" }, { "docid": "955f67908b556675f9d7b3da5b9abbf7", "score": "0.51996315", "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": "ac2d2080c29d44e4f5f7c078d39620ff", "score": "0.5197153", "text": "func generateErrorMessage(data []byte, statusCode int) *ErrorMessage {\n\terrorMessage := &ErrorMessage{}\n\tjson.Unmarshal(data, &errorMessage)\n\terrorMessage.StatusCode = statusCode\n\terrorMessage.Error = errors.New(errorMessage.Message)\n\treturn errorMessage\n}", "title": "" }, { "docid": "2e64e70322dd16feb741e1005cb8c0af", "score": "0.5194001", "text": "func createResponse(r *http.Request, message string) (*slashResponse, bool) {\n\n\t//If the message is -help, return the helptext gicen in the team info\n\tif strings.EqualFold(strings.ToLower(message), \"-help\") {\n\t\treturn &slashResponse{\n\t\t\tResponseType: \"ephemeral\",\n\t\t\tText: team.HelpText,\n\t\t}, false\n\t}\n\n\t//If the message starts with -report, return a list of reports for given\n\t//target or all targets if target is \"all\"\n\tif strings.HasPrefix(strings.ToLower(message), \"-report\") {\n\t\treturn &slashResponse{\n\t\t\tResponseType: \"ephemeral\",\n\t\t\tText: getTargetReports(r, message),\n\t\t\tAttachments: []*attachments{&attachments{\n\t\t\t\tText: \"Report query: \" + message,\n\t\t\t}},\n\t\t}, false\n\t}\n\n\t//Find the target in message\n\ttarget := findTarget(r, message)\n\n\t//If target is not found, respond with team specific message\n\tif target == \"noTarget\" {\n\t\treturn &slashResponse{\n\t\t\tResponseType: \"ephemeral\",\n\t\t\tText: team.NoTargetMessage,\n\t\t\tAttachments: []*attachments{&attachments{\n\t\t\t\tText: message,\n\t\t\t}},\n\t\t}, false\n\t}\n\n\t//Target found in message, the request is a valid report\n\tif len(target) > 0 {\n\n\t\treturn &slashResponse{\n\t\t\tResponseType: \"ephemeral\",\n\t\t\tText: team.AnswerPrefix + r.PostFormValue(\"user_name\") + \"! \" + team.Answer,\n\t\t\tAttachments: []*attachments{&attachments{\n\t\t\t\tText: message,\n\t\t\t}},\n\t\t}, true\n\n\t}\n\n\treturn &slashResponse{\n\t\tResponseType: \"ephemeral\",\n\t\tText: team.ErrorMessage,\n\t\tAttachments: []*attachments{&attachments{\n\t\t\tText: message,\n\t\t}},\n\t}, false\n}", "title": "" }, { "docid": "a1415ad70075f4da8bb095318a0895e0", "score": "0.5183927", "text": "func (c *JobClient) Failure() *JobFailureRequest {\n\treturn &JobFailureRequest{\n\t\ttransport: c.transport,\n\t\tpath: path.Join(c.path, \"failure\"),\n\t}\n}", "title": "" }, { "docid": "597054ec680ff7d3ddbd9ed09a372deb", "score": "0.51646835", "text": "func CreateCreateModelResponse() (response *CreateModelResponse) {\n\tresponse = &CreateModelResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "title": "" }, { "docid": "2824a35f8cc5967fd72bb7c1e2c957d2", "score": "0.5164447", "text": "func (r *Result) Fail(err string) {\n\tr.Errors = append(r.Errors, err)\n\tr.Status = StatusFailed\n}", "title": "" }, { "docid": "f8d3cd530381d11cc4a9962b154e7a54", "score": "0.5151571", "text": "func NewErr(r *http.Response) error {\n\tif r.StatusCode >= http.StatusOK && r.StatusCode < http.StatusMultipleChoices {\n\t\treturn nil\n\t}\n\n\tswitch r.StatusCode {\n\tcase http.StatusUnauthorized:\n\t\treturn common.ErrAuthorizationRequired\n\tcase http.StatusNotFound:\n\t\treturn common.ErrRepositoryNotFound\n\t}\n\n\treturn plumbing.NewUnexpectedError(&Err{r})\n}", "title": "" }, { "docid": "8f8bf07ff72776b192115ef2f83ec90d", "score": "0.51513124", "text": "func newResponse(r *api.Result, err *auroraError, extraDetails ...string) *api.Response {\n\tif err != nil {\n\t\treturn &api.Response{\n\t\t\tResponseCode: err.responseCode.Ptr(),\n\t\t\tDetails: newResponseDetails(append(extraDetails, err.msg)...),\n\t\t}\n\t}\n\treturn &api.Response{\n\t\tResponseCode: api.ResponseCodeOk.Ptr(),\n\t\tResult: r,\n\t\tDetails: newResponseDetails(extraDetails...),\n\t}\n}", "title": "" }, { "docid": "5f2e1baee2745358b947e870d673c833", "score": "0.5151111", "text": "func createStandardResponse(status int, devMsg, userMsg string) standardResponse {\n\treturn standardResponse{\n\t\tStatus: status,\n\t\tDeveloperMessage: devMsg,\n\t\tUserMessage: userMsg,\n\t}\n}", "title": "" }, { "docid": "72a52361cc05dc46d566ef85fc23aa43", "score": "0.51391625", "text": "func (a *Response) new(t *testing.T, r *httptest.ResponseRecorder) {\n\tvar err error\n\n\ta.t = t\n\ta.StatusCode = r.Code\n\ta.StatusText = http.StatusText(r.Code)\n\n\t// Read response body\n\tif a.Body, err = ioutil.ReadAll(r.Body); err != nil {\n\t\tt.Errorf(\"could not read response body: %s\", err.Error())\n\t}\n\n\t// Clean up body\n\ta.Body = []byte(strings.Trim(string(a.Body), \"\\n \"))\n}", "title": "" }, { "docid": "29944aa86ad46be64594e1a897580200", "score": "0.512558", "text": "func CreateHuichengTestRoaDataApiResponse() (response *HuichengTestRoaDataApiResponse) {\n\tresponse = &HuichengTestRoaDataApiResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "title": "" }, { "docid": "c37d15687a2e7adacb4aab1bac47c645", "score": "0.51100117", "text": "func responseToError(response *http.Response) error {\n\tif response.StatusCode < 300 {\n\t\treturn nil\n\t}\n\treturn newCongressError(response)\n}", "title": "" }, { "docid": "1025b361969899e22d7b5d4a6d2605ea", "score": "0.5101905", "text": "func UnmarshalCreateRuleResponse(m map[string]json.RawMessage, result interface{}) (err error) {\n\tobj := new(CreateRuleResponse)\n\terr = core.UnmarshalPrimitive(m, \"request_id\", &obj.RequestID)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"status_code\", &obj.StatusCode)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"rule\", &obj.Rule, UnmarshalRule)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"errors\", &obj.Errors, UnmarshalRuleResponseError)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"trace\", &obj.Trace)\n\tif err != nil {\n\t\treturn\n\t}\n\treflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))\n\treturn\n}", "title": "" }, { "docid": "228388d9596135660d983a477b90c34a", "score": "0.5099602", "text": "func Build(statusCode int, messages ...string) HTTPError {\n\tswitch statusCode {\n\tdefault:\n\t\treturn NewInternalServer(messages...)\n\tcase http.StatusBadRequest:\n\t\treturn NewBadRequest(messages...)\n\tcase http.StatusUnauthorized:\n\t\treturn NewUnauthorized(messages...)\n\tcase http.StatusForbidden:\n\t\treturn NewForbidden(messages...)\n\tcase http.StatusNotFound:\n\t\treturn NewNotFound(messages...)\n\tcase http.StatusUnprocessableEntity:\n\t\treturn NewUnprocessableEntity(messages...)\n\tcase http.StatusServiceUnavailable:\n\t\treturn NewUnavailable(messages...)\n\t}\n}", "title": "" }, { "docid": "75ccea2bf9c5f3d997f9f18ecae055a1", "score": "0.50995547", "text": "func (r *JobFailureResponse) Status() int {\n\tif r == nil {\n\t\treturn 0\n\t}\n\treturn r.status\n}", "title": "" }, { "docid": "fbb89e8eef23a576a41c9ddefe707ca5", "score": "0.50936604", "text": "func newErrSystemFailure(msg string, err error) error {\n\treturn &ErrSystemFailure{\n\t\tmyError: myError{\n\t\t\tmsg: msg,\n\t\t\twerr: err,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "3f5e5f9b274303feb90752dfaab7aa50", "score": "0.50918424", "text": "func makeResponse(id, result interface{}, err error) btcjson.Reply {\n\tidPtr := idPointer(id)\n\tif err != nil {\n\t\treturn btcjson.Reply{\n\t\t\tId: idPtr,\n\t\t\tError: jsonError(err),\n\t\t}\n\t}\n\treturn btcjson.Reply{\n\t\tId: idPtr,\n\t\tResult: result,\n\t}\n}", "title": "" }, { "docid": "d0b2351b1934d5b191a56710506ddf00", "score": "0.5088475", "text": "func (o LookupCloneJobResultOutput) Error() StatusResponseOutput {\n\treturn o.ApplyT(func(v LookupCloneJobResult) StatusResponse { return v.Error }).(StatusResponseOutput)\n}", "title": "" }, { "docid": "d61fd4d50f7c47560a88810d3e21205a", "score": "0.50787425", "text": "func NewResponse(code int, body ...string) *Response {\n\tmsg, ok := status[code]\n\tif !ok {\n\t\treturn NewResponse(500)\n\t}\n\tb := fmt.Sprintf(\"%d %v\\r\\n\", code, msg)\n\tif len(body) > 0 {\n\t\tb = strings.Join(body, \"\\r\\n\") + \"\\r\\n\"\n\t}\n\treturn &Response{\n\t\tStatus: msg,\n\t\tStatusCode: code,\n\t\tHeaders: &Headers{},\n\t\tBody: strings.NewReader(b),\n\t}\n}", "title": "" }, { "docid": "abbcb5c79e37bb063a32791281a287e1", "score": "0.50777584", "text": "func TestResponseOnPrimitiveModelRetrieval(t *testing.T) {\n\tmodel := resourceData(\"test.model\")\n\tbrokenModel := json.RawMessage(`{\"foo\":\"bar\"}`)\n\tbrokenAccess := json.RawMessage(`{\"get\":\"foo\"}`)\n\tmodelGetResponse := json.RawMessage(`{\"model\":` + model + `}`)\n\tfullAccess := json.RawMessage(`{\"get\":true}`)\n\tnoAccess := json.RawMessage(`{\"get\":false}`)\n\tmodelClientResponse := json.RawMessage(`{\"models\":{\"test.resource\":` + model + `}}`)\n\n\t// *reserr.Error implies an error response. requestTimeout implies a timeout. Otherwise success.\n\ttbl := []struct {\n\t\tGetResponse interface{}\n\t\tAccessResponse interface{}\n\t\tExpected interface{}\n\t}{\n\t\t{modelGetResponse, fullAccess, modelClientResponse},\n\t\t{modelGetResponse, noAccess, reserr.ErrAccessDenied},\n\t\t{modelGetResponse, reserr.ErrAccessDenied, reserr.ErrAccessDenied},\n\t\t{modelGetResponse, reserr.ErrInternalError, reserr.ErrInternalError},\n\t\t{modelGetResponse, requestTimeout, mq.ErrRequestTimeout},\n\t\t{modelGetResponse, brokenAccess, reserr.CodeInternalError},\n\t\t{reserr.ErrNotFound, fullAccess, reserr.ErrNotFound},\n\t\t{reserr.ErrNotFound, noAccess, reserr.ErrAccessDenied},\n\t\t{reserr.ErrNotFound, reserr.ErrAccessDenied, reserr.ErrAccessDenied},\n\t\t{reserr.ErrNotFound, reserr.ErrInternalError, reserr.ErrInternalError},\n\t\t{reserr.ErrNotFound, requestTimeout, mq.ErrRequestTimeout},\n\t\t{reserr.ErrNotFound, brokenAccess, reserr.CodeInternalError},\n\t\t{reserr.ErrInternalError, fullAccess, reserr.ErrInternalError},\n\t\t{reserr.ErrInternalError, noAccess, reserr.ErrAccessDenied},\n\t\t{reserr.ErrInternalError, reserr.ErrAccessDenied, reserr.ErrAccessDenied},\n\t\t{reserr.ErrInternalError, reserr.ErrDisposing, reserr.ErrDisposing},\n\t\t{reserr.ErrInternalError, requestTimeout, mq.ErrRequestTimeout},\n\t\t{reserr.ErrInternalError, brokenAccess, reserr.CodeInternalError},\n\t\t{requestTimeout, fullAccess, mq.ErrRequestTimeout},\n\t\t{requestTimeout, noAccess, reserr.ErrAccessDenied},\n\t\t{requestTimeout, reserr.ErrAccessDenied, reserr.ErrAccessDenied},\n\t\t{requestTimeout, reserr.ErrInternalError, reserr.ErrInternalError},\n\t\t{requestTimeout, requestTimeout, mq.ErrRequestTimeout},\n\t\t{requestTimeout, brokenAccess, reserr.CodeInternalError},\n\t\t{brokenModel, fullAccess, reserr.CodeInternalError},\n\t\t{brokenModel, noAccess, reserr.ErrAccessDenied},\n\t\t{brokenModel, reserr.ErrAccessDenied, reserr.ErrAccessDenied},\n\t\t{brokenModel, reserr.ErrInternalError, reserr.ErrInternalError},\n\t\t{brokenModel, requestTimeout, mq.ErrRequestTimeout},\n\t\t{brokenModel, brokenAccess, reserr.CodeInternalError},\n\t\t// Untrimmed whitespaces\n\t\t{json.RawMessage(\"\\r\\n \\t{ \\\"model\\\":\\t \\r\\n\" + model + \"\\t} \\t\\n\"), fullAccess, modelClientResponse},\n\t\t{modelGetResponse, json.RawMessage(\"\\r\\n \\t{\\\"get\\\":\\ttrue}\\n\"), modelClientResponse},\n\t\t// Invalid get response\n\t\t{[]byte(`{\"invalid\":JSON}`), fullAccess, reserr.CodeInternalError},\n\t\t{[]byte(``), fullAccess, reserr.CodeInternalError},\n\t\t{[]byte(`{\"invalid\":\"response\"}`), fullAccess, reserr.CodeInternalError},\n\t\t// Invalid access response\n\t\t{modelGetResponse, []byte(`{\"invalid\":JSON}`), reserr.CodeInternalError},\n\t\t{modelGetResponse, []byte(``), reserr.CodeInternalError},\n\t\t{modelGetResponse, []byte(`{\"invalid\":\"response\"}`), reserr.CodeInternalError},\n\t\t// Invalid get model or collection response\n\t\t{json.RawMessage(`{\"model\":[\"with\",\"array\",\"data\"]}`), fullAccess, reserr.CodeInternalError},\n\t\t{json.RawMessage(`{\"collection\":{\"with\":\"model data\"}}`), fullAccess, reserr.CodeInternalError},\n\t\t{json.RawMessage(`{\"model\":{\"array\":[1,2]}}`), fullAccess, reserr.CodeInternalError},\n\t\t{json.RawMessage(`{\"model\":{\"prop\":{\"action\":\"delete\"}}}`), fullAccess, reserr.CodeInternalError},\n\t\t{json.RawMessage(`{\"model\":{\"prop\":{\"action\":\"unknown\"}}}`), fullAccess, reserr.CodeInternalError},\n\t\t{json.RawMessage(`{\"model\":{\"prop\":{\"unknown\":\"property\"}}}`), fullAccess, reserr.CodeInternalError},\n\t\t{json.RawMessage(`{\"model\":{\"child\":{\"rid\":false}}}`), fullAccess, reserr.CodeInternalError},\n\t\t{json.RawMessage(`{\"model\":{\"child\":{\"rid\":false}}}`), fullAccess, reserr.CodeInternalError},\n\t\t{json.RawMessage(`{\"collection\":[\"array\",[1,2]]}`), fullAccess, reserr.CodeInternalError},\n\t\t{json.RawMessage(`{\"collection\":[\"prop\",{\"action\":\"delete\"}]}`), fullAccess, reserr.CodeInternalError},\n\t\t{json.RawMessage(`{\"collection\":[\"prop\",{\"action\":\"unknown\"}]}`), fullAccess, reserr.CodeInternalError},\n\t\t{json.RawMessage(`{\"collection\":[\"prop\",{\"unknown\":\"property\"}]}`), fullAccess, reserr.CodeInternalError},\n\t\t// Multiple resource types\n\t\t{json.RawMessage(`{\"model\":{\"foo\":\"bar\"},\"collection\":[1,2,3]}`), fullAccess, reserr.CodeInternalError},\n\t\t// Invalid get error response\n\t\t{[]byte(`{\"error\":[]}`), fullAccess, reserr.CodeInternalError},\n\t\t{[]byte(`{\"error\":{\"message\":\"missing code\"}}`), fullAccess, \"\"},\n\t\t{[]byte(`{\"error\":{\"code\":12,\"message\":\"integer code\"}}`), fullAccess, reserr.CodeInternalError},\n\t}\n\n\tfor i, l := range tbl {\n\t\t// Run both \"get\" and \"subscribe\" tests\n\t\tfor _, method := range []string{\"get\", \"subscribe\"} {\n\t\t\t// Run both orders for \"get\" and \"access\" response\n\t\t\tfor getFirst := true; getFirst; getFirst = false {\n\t\t\t\ts := fmt.Sprintf(\"#%d when using %#v\", i+1, method)\n\t\t\t\tif getFirst {\n\t\t\t\t\ts += \" with get response sent first\"\n\t\t\t\t} else {\n\t\t\t\t\ts += \" with access response sent first\"\n\t\t\t\t}\n\t\t\t\trunNamedTest(t, s, func(s *Session) {\n\t\t\t\t\tc := s.Connect()\n\t\t\t\t\tvar creq *ClientRequest\n\t\t\t\t\tswitch method {\n\t\t\t\t\tcase \"get\":\n\t\t\t\t\t\tcreq = c.Request(\"get.test.resource\", nil)\n\t\t\t\t\tcase \"subscribe\":\n\t\t\t\t\t\tcreq = c.Request(\"subscribe.test.resource\", nil)\n\t\t\t\t\t}\n\t\t\t\t\tmreqs := s.GetParallelRequests(t, 2)\n\n\t\t\t\t\tvar req *Request\n\t\t\t\t\tif getFirst {\n\t\t\t\t\t\t// Send get response\n\t\t\t\t\t\treq = mreqs.GetRequest(t, \"get.test.resource\")\n\t\t\t\t\t\tif l.GetResponse == requestTimeout {\n\t\t\t\t\t\t\treq.Timeout()\n\t\t\t\t\t\t} else if err, ok := l.GetResponse.(*reserr.Error); ok {\n\t\t\t\t\t\t\treq.RespondError(err)\n\t\t\t\t\t\t} else if raw, ok := l.GetResponse.([]byte); ok {\n\t\t\t\t\t\t\treq.RespondRaw(raw)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treq.RespondSuccess(l.GetResponse)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Send access response\n\t\t\t\t\treq = mreqs.GetRequest(t, \"access.test.resource\")\n\t\t\t\t\tif l.AccessResponse == requestTimeout {\n\t\t\t\t\t\treq.Timeout()\n\t\t\t\t\t} else if err, ok := l.AccessResponse.(*reserr.Error); ok {\n\t\t\t\t\t\treq.RespondError(err)\n\t\t\t\t\t} else if raw, ok := l.AccessResponse.([]byte); ok {\n\t\t\t\t\t\treq.RespondRaw(raw)\n\t\t\t\t\t} else {\n\t\t\t\t\t\treq.RespondSuccess(l.AccessResponse)\n\t\t\t\t\t}\n\n\t\t\t\t\tif !getFirst {\n\t\t\t\t\t\t// Send get response\n\t\t\t\t\t\treq := mreqs.GetRequest(t, \"get.test.resource\")\n\t\t\t\t\t\tif l.GetResponse == nil {\n\t\t\t\t\t\t\treq.Timeout()\n\t\t\t\t\t\t} else if err, ok := l.GetResponse.(*reserr.Error); ok {\n\t\t\t\t\t\t\treq.RespondError(err)\n\t\t\t\t\t\t} else if raw, ok := l.GetResponse.([]byte); ok {\n\t\t\t\t\t\t\treq.RespondRaw(raw)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treq.RespondSuccess(l.GetResponse)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Validate client response\n\t\t\t\t\tcresp := creq.GetResponse(t)\n\t\t\t\t\tif err, ok := l.Expected.(*reserr.Error); ok {\n\t\t\t\t\t\tcresp.AssertError(t, err)\n\t\t\t\t\t} else if code, ok := l.Expected.(string); ok {\n\t\t\t\t\t\tcresp.AssertErrorCode(t, code)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcresp.AssertResult(t, l.Expected)\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "45662590e58645320fd464b046a3497e", "score": "0.5072164", "text": "func Response(responseWriter http.ResponseWriter, statusCode int, message string, errors interface{}, data interface{}) {\n\tresponse := models.ResponseModel{\n\t\tMessage: message,\n\t\tErrors: errors,\n\t\tData: data,\n\t}\n\n\tresponseWriter.Header().Set(\"Content-type\", \"application/json; charset=utf-8\")\n\tresponseWriter.WriteHeader(statusCode)\n\tjson.NewEncoder(responseWriter).Encode(response)\n}", "title": "" }, { "docid": "8fb84bf84bf4ed32c68384c582e5feb0", "score": "0.5071016", "text": "func newResponse(r *http.Response) *atlas.Response {\n\tresponse := atlas.Response{Response: r}\n\n\treturn &response\n}", "title": "" }, { "docid": "f3e15117bc3ec7df7f7570fe9e35b5bb", "score": "0.5063985", "text": "func (g *Gin) FailResponse(httpCode int, msg error, detail error) {\n\tg.C.JSON(httpCode, gin.H{\n\t\t\"msg\": msg.Error(),\n\t\t\"detail\": detail.Error(),\n\t})\n}", "title": "" }, { "docid": "5fb79156b6a8f92614420ba3d774023d", "score": "0.50544673", "text": "func NewResponse(w http.ResponseWriter, statusCode int, err error, data interface{}) {\n\tw.WriteHeader(statusCode)\n\tres := Response{}\n\tif err != nil {\n\t\terrors := Error{\n\t\t\tMessage: err.Error(),\n\t\t}\n\t\tres.Error = &errors\n\t}\n\tif data != nil {\n\t\tres.Body = &data\n\t}\n\tjson.NewEncoder(w).Encode(&res)\n}", "title": "" }, { "docid": "c7777eadef4440b9de9a8423816b4660", "score": "0.5053599", "text": "func createResponse(dbVals map[string][]byte, errorMsg string) (*responsePayload, error) {\r\n\treturn &responsePayload{errorMsg: errorMsg, dbVals: dbVals}, nil\r\n}", "title": "" }, { "docid": "38859cb97e6ffe528366277f786fd553", "score": "0.50456333", "text": "func NewClassificationJobResponse()(*ClassificationJobResponse) {\n m := &ClassificationJobResponse{\n JobResponseBase: *NewJobResponseBase(),\n }\n return m\n}", "title": "" }, { "docid": "c06b958741cc16e44a33fa115a41fb4f", "score": "0.50429565", "text": "func (a Response) Status(code int) Response {\n\tif a.StatusCode != code {\n\t\ta.t.Errorf(\"HTTP: expected %d %s, got %d %s\", code,\n\t\t\thttp.StatusText(code), a.StatusCode, a.StatusText)\n\t}\n\treturn a\n}", "title": "" }, { "docid": "a2116cd480c6dffcef1a7606a055f397", "score": "0.5041874", "text": "func newResponseState(inErr error, badStatus ctlpb.ResponseStatus, infoMsg string) *ctlpb.ResponseState {\n\trs := new(ctlpb.ResponseState)\n\trs.Info = infoMsg\n\n\tif inErr != nil {\n\t\trs.Status = badStatus\n\t\trs.Error = inErr.Error()\n\t}\n\n\treturn rs\n}", "title": "" }, { "docid": "4ae7eb4de0b030b037c3a3b2ec8e80e1", "score": "0.5038352", "text": "func Fail(err *Error, reason string) Result {\n\treturn Result{\n\t\tError: err,\n\t\tReason: reason,\n\t}\n}", "title": "" }, { "docid": "2e7136b929b5ffac4366b7a09e04a146", "score": "0.50368273", "text": "func NewResponseStatus()(*ResponseStatus) {\n m := &ResponseStatus{\n }\n m.backingStore = ie8677ce2c7e1b4c22e9c3827ecd078d41185424dd9eeb92b7d971ed2d49a392e.BackingStoreFactoryInstance();\n m.SetAdditionalData(make(map[string]any))\n return m\n}", "title": "" }, { "docid": "28505959e94c9ae744174ef1f0216a7c", "score": "0.5032917", "text": "func builResponseError(err error) events.APIGatewayProxyResponse {\n\tlog.Printf(\"[ONBOARDING] Response Error: %v\", err)\n\tres := events.APIGatewayProxyResponse{\n\t\tStatusCode: 400,\n\t\tHeaders: map[string]string{\n\t\t\t\"Content-Type\": \"application/json\",\n\t\t},\n\t}\n\tjson, _ := json.Marshal(model.Response{Error: core.BuildResError(err)})\n\tres.Body = string(json)\n\treturn res\n}", "title": "" }, { "docid": "d769ee7bf0a73eb4ae2fd98b21f7b179", "score": "0.5028609", "text": "func makeStatusResponse(status string, message string) *response {\n\treturn &response{\n\t\t\"type\": \"status\",\n\t\t\"status\": status,\n\t\t\"message\": message,\n\t}\n}", "title": "" }, { "docid": "13522cf0cafba1d62f6c882a07d6179d", "score": "0.50279516", "text": "func (CreateResponse) StatusCode() int {\n\treturn http.StatusCreated\n}", "title": "" }, { "docid": "bfb79813c8b21748c30022844bfab44a", "score": "0.50275314", "text": "func (r *Resource) Response(data interface{}, fieldSet *FieldSet) Response {\n\treturn r.ResponseWithStatusCode(data, fieldSet, http.StatusOK)\n}", "title": "" }, { "docid": "5234cc480cb00fdc920b72116812f90d", "score": "0.5027248", "text": "func NewOK(res interface{}) (int, http.Header, interface{}, error) {\n\treturn http.StatusOK, nil, res, nil\n}", "title": "" }, { "docid": "304b29af7c15c62466fff59e488462e6", "score": "0.50265825", "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": "1706e71b9c044f8093bb17d64d5db648", "score": "0.50258887", "text": "func CreateOutputResponse(id uint64, output json.RawMessage, final bool) ResponseMessage {\n\t// create message\n\treturn ResponseMessage{\n\t\tID: id,\n\t\tOutput: output,\n\t\tError: nil,\n\t\tFinal: final,\n\t}\n}", "title": "" }, { "docid": "d89b934d9ff61a5ad0d9b02459106a41", "score": "0.50250626", "text": "func NewResponse(body interface{}) Response {\n\treturn Response{\n\t\theader: make(http.Header),\n\t\tstatusCode: 200,\n\t\tbody: body,\n\t}\n}", "title": "" } ]
21d1cf2d5784866907680ed6660e4ed1
AllocateSubnetFromIPBlock mocks base method
[ { "docid": "b116b2ac2db9563e4e24de9b0851057e", "score": "0.7216818", "text": "func (m *MockClient) AllocateSubnetFromIPBlock(arg0 *models.IPBlockSubnet) (*models.IPBlockSubnet, error) {\n\tret := m.ctrl.Call(m, \"AllocateSubnetFromIPBlock\", arg0)\n\tret0, _ := ret[0].(*models.IPBlockSubnet)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" } ]
[ { "docid": "e0607543be0d3b96b6e56dcb0cdbf9e9", "score": "0.7315599", "text": "func (m *MockClient) AllocateIPFromSubnetBlock(arg0 string) (*models.AllocationIPAddress, error) {\n\tret := m.ctrl.Call(m, \"AllocateIPFromSubnetBlock\", arg0)\n\tret0, _ := ret[0].(*models.AllocationIPAddress)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "33e76f726dd2888de5511b9e2a07198c", "score": "0.7311201", "text": "func TestCreateSubnet(t *testing.T) {\n\trequire := require.New(t)\n\tvm, _, _ := defaultVM(t)\n\tvm.ctx.Lock.Lock()\n\tdefer func() {\n\t\trequire.NoError(vm.Shutdown(context.Background()))\n\t\tvm.ctx.Lock.Unlock()\n\t}()\n\n\tnodeID := ids.NodeID(keys[0].PublicKey().Address())\n\n\tcreateSubnetTx, err := vm.txBuilder.NewCreateSubnetTx(\n\t\t1, // threshold\n\t\t[]ids.ShortID{ // control keys\n\t\t\tkeys[0].PublicKey().Address(),\n\t\t\tkeys[1].PublicKey().Address(),\n\t\t},\n\t\t[]*secp256k1.PrivateKey{keys[0]}, // payer\n\t\tkeys[0].PublicKey().Address(), // change addr\n\t)\n\trequire.NoError(err)\n\n\trequire.NoError(vm.Builder.AddUnverifiedTx(createSubnetTx))\n\n\t// should contain proposal to create subnet\n\tblk, err := vm.Builder.BuildBlock(context.Background())\n\trequire.NoError(err)\n\n\trequire.NoError(blk.Verify(context.Background()))\n\trequire.NoError(blk.Accept(context.Background()))\n\trequire.NoError(vm.SetPreference(context.Background(), vm.manager.LastAccepted()))\n\n\t_, txStatus, err := vm.state.GetTx(createSubnetTx.ID())\n\trequire.NoError(err)\n\trequire.Equal(status.Committed, txStatus)\n\n\tsubnets, err := vm.state.GetSubnets()\n\trequire.NoError(err)\n\n\tfound := false\n\tfor _, subnet := range subnets {\n\t\tif subnet.ID() == createSubnetTx.ID() {\n\t\t\tfound = true\n\t\t\tbreak\n\t\t}\n\t}\n\trequire.True(found)\n\n\t// Now that we've created a new subnet, add a validator to that subnet\n\tstartTime := vm.clock.Time().Add(txexecutor.SyncBound).Add(1 * time.Second)\n\tendTime := startTime.Add(defaultMinStakingDuration)\n\t// [startTime, endTime] is subset of time keys[0] validates default subnet so tx is valid\n\taddValidatorTx, err := vm.txBuilder.NewAddSubnetValidatorTx(\n\t\tdefaultWeight,\n\t\tuint64(startTime.Unix()),\n\t\tuint64(endTime.Unix()),\n\t\tnodeID,\n\t\tcreateSubnetTx.ID(),\n\t\t[]*secp256k1.PrivateKey{keys[0]},\n\t\tids.ShortEmpty, // change addr\n\t)\n\trequire.NoError(err)\n\n\trequire.NoError(vm.Builder.AddUnverifiedTx(addValidatorTx))\n\n\tblk, err = vm.Builder.BuildBlock(context.Background()) // should add validator to the new subnet\n\trequire.NoError(err)\n\n\trequire.NoError(blk.Verify(context.Background()))\n\trequire.NoError(blk.Accept(context.Background())) // add the validator to pending validator set\n\trequire.NoError(vm.SetPreference(context.Background(), vm.manager.LastAccepted()))\n\n\ttxID := blk.(blocks.Block).Txs()[0].ID()\n\t_, txStatus, err = vm.state.GetTx(txID)\n\trequire.NoError(err)\n\trequire.Equal(status.Committed, txStatus)\n\n\t_, err = vm.state.GetPendingValidator(createSubnetTx.ID(), nodeID)\n\trequire.NoError(err)\n\n\t// Advance time to when new validator should start validating\n\t// Create a block with an advance time tx that moves validator\n\t// from pending to current validator set\n\tvm.clock.Set(startTime)\n\tblk, err = vm.Builder.BuildBlock(context.Background()) // should be advance time tx\n\trequire.NoError(err)\n\trequire.NoError(blk.Verify(context.Background()))\n\trequire.NoError(blk.Accept(context.Background())) // move validator addValidatorTx from pending to current\n\trequire.NoError(vm.SetPreference(context.Background(), vm.manager.LastAccepted()))\n\n\t_, err = vm.state.GetPendingValidator(createSubnetTx.ID(), nodeID)\n\trequire.ErrorIs(err, database.ErrNotFound)\n\n\t_, err = vm.state.GetCurrentValidator(createSubnetTx.ID(), nodeID)\n\trequire.NoError(err)\n\n\t// fast forward clock to time validator should stop validating\n\tvm.clock.Set(endTime)\n\tblk, err = vm.Builder.BuildBlock(context.Background())\n\trequire.NoError(err)\n\trequire.NoError(blk.Verify(context.Background()))\n\trequire.NoError(blk.Accept(context.Background())) // remove validator from current validator set\n\n\t_, err = vm.state.GetPendingValidator(createSubnetTx.ID(), nodeID)\n\trequire.ErrorIs(err, database.ErrNotFound)\n\n\t_, err = vm.state.GetCurrentValidator(createSubnetTx.ID(), nodeID)\n\trequire.ErrorIs(err, database.ErrNotFound)\n}", "title": "" }, { "docid": "1c5ac8e6687b466d27b8f5cc3b927ff9", "score": "0.71500033", "text": "func (m *MockNsxNetworkProvisioner) AllocateSubnetBlock(arg0, arg1 string, arg2 []*models.Tag) (string, string, error) {\n\tret := m.ctrl.Call(m, \"AllocateSubnetBlock\", arg0, arg1, arg2)\n\tret0, _ := ret[0].(string)\n\tret1, _ := ret[1].(string)\n\tret2, _ := ret[2].(error)\n\treturn ret0, ret1, ret2\n}", "title": "" }, { "docid": "9c7f45f4f341547bfb89e754595cada9", "score": "0.7037002", "text": "func (m *MockNsxNetworkProvisioner) AllocateSubnetFromIPBlocks(arg0 string, arg1 []string, arg2 []*models.Tag) (string, string, string, error) {\n\tret := m.ctrl.Call(m, \"AllocateSubnetFromIPBlocks\", arg0, arg1, arg2)\n\tret0, _ := ret[0].(string)\n\tret1, _ := ret[1].(string)\n\tret2, _ := ret[2].(string)\n\tret3, _ := ret[3].(error)\n\treturn ret0, ret1, ret2, ret3\n}", "title": "" }, { "docid": "77fd922a514e95f6c9b61b5bc4fdd2aa", "score": "0.62717694", "text": "func TestAddSubnetValidatorReject(t *testing.T) {\n\trequire := require.New(t)\n\tvm, _, _ := defaultVM(t)\n\tvm.ctx.Lock.Lock()\n\tdefer func() {\n\t\trequire.NoError(vm.Shutdown(context.Background()))\n\t\tvm.ctx.Lock.Unlock()\n\t}()\n\n\tstartTime := vm.clock.Time().Add(txexecutor.SyncBound).Add(1 * time.Second)\n\tendTime := startTime.Add(defaultMinStakingDuration)\n\tnodeID := ids.NodeID(keys[0].PublicKey().Address())\n\n\t// create valid tx\n\t// note that [startTime, endTime] is a subset of time that keys[0]\n\t// validates primary network ([defaultValidateStartTime, defaultValidateEndTime])\n\ttx, err := vm.txBuilder.NewAddSubnetValidatorTx(\n\t\tdefaultWeight,\n\t\tuint64(startTime.Unix()),\n\t\tuint64(endTime.Unix()),\n\t\tnodeID,\n\t\ttestSubnet1.ID(),\n\t\t[]*secp256k1.PrivateKey{testSubnet1ControlKeys[1], testSubnet1ControlKeys[2]},\n\t\tids.ShortEmpty, // change addr\n\t)\n\trequire.NoError(err)\n\n\t// trigger block creation\n\trequire.NoError(vm.Builder.AddUnverifiedTx(tx))\n\n\tblk, err := vm.Builder.BuildBlock(context.Background())\n\trequire.NoError(err)\n\n\trequire.NoError(blk.Verify(context.Background()))\n\trequire.NoError(blk.Reject(context.Background()))\n\n\t_, _, err = vm.state.GetTx(tx.ID())\n\trequire.ErrorIs(err, database.ErrNotFound)\n\n\t// Verify that new validator NOT in pending validator set\n\t_, err = vm.state.GetPendingValidator(testSubnet1.ID(), nodeID)\n\trequire.ErrorIs(err, database.ErrNotFound)\n}", "title": "" }, { "docid": "14cca98f877341cac7f7ae149fd07042", "score": "0.6184264", "text": "func TestAllocateSubnetNoSubnetBitsIPv4(t *testing.T) {\n\tsna, err := newSubnetAllocator(\"10.1.0.0/16\", 16)\n\tif err != nil {\n\t\tt.Fatal(\"Failed to initialize subnet allocator: \", err)\n\t}\n\n\tif err := allocateExpected(sna, 0, \"10.1.0.0/16\"); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif err := allocateNotExpected(sna, 1, 0); err != nil {\n\t\tt.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "d1e6d28bd403dcd654cdf4af6063c419", "score": "0.61460406", "text": "func TestAddSubnetValidatorAccept(t *testing.T) {\n\trequire := require.New(t)\n\tvm, _, _ := defaultVM(t)\n\tvm.ctx.Lock.Lock()\n\tdefer func() {\n\t\trequire.NoError(vm.Shutdown(context.Background()))\n\t\tvm.ctx.Lock.Unlock()\n\t}()\n\n\tstartTime := vm.clock.Time().Add(txexecutor.SyncBound).Add(1 * time.Second)\n\tendTime := startTime.Add(defaultMinStakingDuration)\n\tnodeID := ids.NodeID(keys[0].PublicKey().Address())\n\n\t// create valid tx\n\t// note that [startTime, endTime] is a subset of time that keys[0]\n\t// validates primary network ([defaultValidateStartTime, defaultValidateEndTime])\n\ttx, err := vm.txBuilder.NewAddSubnetValidatorTx(\n\t\tdefaultWeight,\n\t\tuint64(startTime.Unix()),\n\t\tuint64(endTime.Unix()),\n\t\tnodeID,\n\t\ttestSubnet1.ID(),\n\t\t[]*secp256k1.PrivateKey{testSubnet1ControlKeys[0], testSubnet1ControlKeys[1]},\n\t\tids.ShortEmpty, // change addr\n\t)\n\trequire.NoError(err)\n\n\t// trigger block creation\n\trequire.NoError(vm.Builder.AddUnverifiedTx(tx))\n\n\tblk, err := vm.Builder.BuildBlock(context.Background())\n\trequire.NoError(err)\n\n\trequire.NoError(blk.Verify(context.Background()))\n\trequire.NoError(blk.Accept(context.Background()))\n\n\t_, txStatus, err := vm.state.GetTx(tx.ID())\n\trequire.NoError(err)\n\trequire.Equal(status.Committed, txStatus)\n\n\t// Verify that new validator is in pending validator set\n\t_, err = vm.state.GetPendingValidator(testSubnet1.ID(), nodeID)\n\trequire.NoError(err)\n}", "title": "" }, { "docid": "a71df2c9e37d22dc5270f83018b2e7bc", "score": "0.61121476", "text": "func (m *MockNetworking) CreateSubnet(arg0 subnets.CreateOpts) (*subnets.Subnet, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"CreateSubnet\", arg0)\n\tret0, _ := ret[0].(*subnets.Subnet)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "3a4c32452b07db67b2cbaca762eaedeb", "score": "0.6030998", "text": "func TestFree(t *testing.T) {\n\ttests := []struct {\n\t\tnetwork string\n\t\tmask int\n\t\tsubnets []string\n\t\texpectedNetwork string\n\t\texpectedErrorHandler func(error) bool\n\t}{\n\t\t// Test that a network with no existing subnets returns the correct subnet.\n\t\t{\n\t\t\tnetwork: \"10.4.0.0/16\",\n\t\t\tmask: 24,\n\t\t\tsubnets: []string{},\n\t\t\texpectedNetwork: \"10.4.0.0/24\",\n\t\t},\n\n\t\t// Test that a network with one existing subnet returns the correct subnet.\n\t\t{\n\t\t\tnetwork: \"10.4.0.0/16\",\n\t\t\tmask: 24,\n\t\t\tsubnets: []string{\"10.4.0.0/24\"},\n\t\t\texpectedNetwork: \"10.4.1.0/24\",\n\t\t},\n\n\t\t// Test that a network with two existing (non-fragmented) subnets returns the correct subnet.\n\t\t{\n\t\t\tnetwork: \"10.4.0.0/16\",\n\t\t\tmask: 24,\n\t\t\tsubnets: []string{\"10.4.0.0/24\", \"10.4.1.0/24\"},\n\t\t\texpectedNetwork: \"10.4.2.0/24\",\n\t\t},\n\n\t\t// Test that a network with an existing subnet, that is fragmented,\n\t\t// and can fit one network before, returns the correct subnet.\n\t\t{\n\t\t\tnetwork: \"10.4.0.0/16\",\n\t\t\tmask: 24,\n\t\t\tsubnets: []string{\"10.4.1.0/24\"},\n\t\t\texpectedNetwork: \"10.4.0.0/24\",\n\t\t},\n\n\t\t// Test that a network with an existing subnet, that is fragmented,\n\t\t// and can fit one network before, returns the correct subnet,\n\t\t// given a smaller mask.\n\t\t{\n\t\t\tnetwork: \"10.4.0.0/16\",\n\t\t\tmask: 25,\n\t\t\tsubnets: []string{\"10.4.1.0/24\"},\n\t\t\texpectedNetwork: \"10.4.0.0/25\",\n\t\t},\n\n\t\t// Test that a network with an existing subnet, that is fragmented,\n\t\t// but can't fit the requested network size before, returns the correct subnet.\n\t\t{\n\t\t\tnetwork: \"10.4.0.0/16\",\n\t\t\tmask: 23,\n\t\t\tsubnets: []string{\"10.4.1.0/24\"}, // 10.4.1.0 - 10.4.1.255\n\t\t\texpectedNetwork: \"10.4.2.0/23\", // 10.4.2.0 - 10.4.3.255\n\t\t},\n\n\t\t// Test that a network with no existing subnets returns the correct subnet,\n\t\t// for a mask that does not fall on an octet boundary.\n\t\t{\n\t\t\tnetwork: \"10.4.0.0/24\",\n\t\t\tmask: 26,\n\t\t\tsubnets: []string{},\n\t\t\texpectedNetwork: \"10.4.0.0/26\",\n\t\t},\n\n\t\t// Test that a network with one existing subnet returns the correct subnet,\n\t\t// for a mask that does not fall on an octet boundary.\n\t\t{\n\t\t\tnetwork: \"10.4.0.0/24\",\n\t\t\tmask: 26,\n\t\t\tsubnets: []string{\"10.4.0.0/26\"},\n\t\t\texpectedNetwork: \"10.4.0.64/26\",\n\t\t},\n\n\t\t// Test that a network with two existing fragmented subnets,\n\t\t// with a mask that does not fall on an octet boundary, returns the correct subnet.\n\t\t{\n\t\t\tnetwork: \"10.4.0.0/24\",\n\t\t\tmask: 26,\n\t\t\tsubnets: []string{\"10.4.0.0/26\", \"10.4.0.128/26\"},\n\t\t\texpectedNetwork: \"10.4.0.64/26\",\n\t\t},\n\n\t\t// Test a setup with multiple, fragmented networks, of different sizes.\n\t\t{\n\t\t\tnetwork: \"10.4.0.0/24\",\n\t\t\tmask: 29,\n\t\t\tsubnets: []string{\n\t\t\t\t\"10.4.0.0/26\",\n\t\t\t\t\"10.4.0.64/28\",\n\t\t\t\t\"10.4.0.80/28\",\n\t\t\t\t\"10.4.0.112/28\",\n\t\t\t\t\"10.4.0.128/26\",\n\t\t\t},\n\t\t\texpectedNetwork: \"10.4.0.96/29\",\n\t\t},\n\n\t\t// Test where a network the same size as the main network is requested.\n\t\t{\n\t\t\tnetwork: \"10.4.0.0/16\",\n\t\t\tmask: 16,\n\t\t\tsubnets: []string{},\n\t\t\texpectedNetwork: \"10.4.0.0/16\",\n\t\t},\n\n\t\t// Test a setup where a network larger than the main network is requested.\n\t\t{\n\t\t\tnetwork: \"10.4.0.0/16\",\n\t\t\tmask: 15,\n\t\t\tsubnets: []string{},\n\t\t\texpectedErrorHandler: IsMaskTooBig,\n\t\t},\n\n\t\t// Test where the existing networks are not ordered.\n\t\t{\n\t\t\tnetwork: \"10.4.0.0/16\",\n\t\t\tmask: 24,\n\t\t\tsubnets: []string{\"10.4.1.0/24\", \"10.4.0.0/24\"},\n\t\t\texpectedNetwork: \"10.4.2.0/24\",\n\t\t},\n\n\t\t// Test where the existing networks are fragmented, and not ordered.\n\t\t{\n\t\t\tnetwork: \"10.4.0.0/16\",\n\t\t\tmask: 24,\n\t\t\tsubnets: []string{\"10.4.2.0/24\", \"10.4.0.0/24\"},\n\t\t\texpectedNetwork: \"10.4.1.0/24\",\n\t\t},\n\n\t\t// Test where the range is full.\n\t\t{\n\t\t\tnetwork: \"10.4.0.0/16\",\n\t\t\tmask: 17,\n\t\t\tsubnets: []string{\"10.4.0.0/17\", \"10.4.128.0/17\"},\n\t\t\texpectedErrorHandler: IsSpaceExhausted,\n\t\t},\n\n\t\t// Test where the subnet is not within the network.\n\t\t{\n\t\t\tnetwork: \"10.4.0.0/16\",\n\t\t\tmask: 24,\n\t\t\tsubnets: []string{\"10.5.0.0/24\"},\n\t\t\texpectedErrorHandler: IsIPNotContained,\n\t\t},\n\n\t\t{\n\t\t\tnetwork: \"10.1.0.0/16\",\n\t\t\tmask: 24,\n\t\t\tsubnets: []string{\n\t\t\t\t\"10.1.1.0/26\",\n\t\t\t\t\"10.1.1.64/26\",\n\t\t\t\t\"10.1.1.128/26\",\n\t\t\t\t\"10.1.1.192/26\",\n\t\t\t\t\"10.1.0.0/25\",\n\t\t\t\t\"10.1.0.128/25\",\n\t\t\t\t\"10.1.0.0/24\",\n\t\t\t\t\"10.1.2.0/27\",\n\t\t\t\t\"10.1.2.32/27\",\n\t\t\t\t\"10.1.2.64/27\",\n\t\t\t\t\"10.1.2.96/27\",\n\t\t\t\t\"10.1.2.128/27\",\n\t\t\t\t\"10.1.2.160/27\",\n\t\t\t\t\"10.1.2.0/24\",\n\t\t\t},\n\t\t\texpectedErrorHandler: nil,\n\t\t\texpectedNetwork: \"10.1.3.0/24\",\n\t\t},\n\t\t{\n\t\t\tnetwork: \"10.163.0.0/16\",\n\t\t\tmask: 23,\n\t\t\tsubnets: []string{\n\t\t\t\t\"10.163.0.0/23\",\n\t\t\t\t\"10.163.0.0/25\",\n\t\t\t\t\"10.163.0.128/25\",\n\t\t\t\t\"10.163.1.0/25\",\n\t\t\t\t\"10.163.2.0/25\",\n\t\t\t\t\"10.163.2.0/23\",\n\t\t\t\t\"10.163.2.128/25\",\n\t\t\t\t\"10.163.3.0/25\",\n\t\t\t\t\"10.163.4.0/22\",\n\t\t\t\t\"10.163.4.0/25\",\n\t\t\t\t\"10.163.4.128/25\",\n\t\t\t\t\"10.163.5.0/25\",\n\t\t\t\t\"10.163.5.128/25\",\n\t\t\t\t\"10.163.6.0/25\",\n\t\t\t\t\"10.163.6.128/25\",\n\t\t\t\t\"10.163.8.0/25\",\n\t\t\t\t\"10.163.8.0/22\",\n\t\t\t\t\"10.163.8.128/25\",\n\t\t\t\t\"10.163.9.0/25\",\n\t\t\t\t\"10.163.9.128/25\",\n\t\t\t\t\"10.163.10.0/25\",\n\t\t\t\t\"10.163.10.128/25\",\n\t\t\t\t\"10.163.12.0/23\",\n\t\t\t\t\"10.163.12.0/25\",\n\t\t\t\t\"10.163.12.128/25\",\n\t\t\t\t\"10.163.13.0/25\",\n\t\t\t\t\"10.163.14.0/23\",\n\t\t\t\t\"10.163.14.0/25\",\n\t\t\t\t\"10.163.14.128/25\",\n\t\t\t\t\"10.163.15.0/25\",\n\t\t\t\t\"10.163.16.0/25\",\n\t\t\t\t\"10.163.16.0/22\",\n\t\t\t\t\"10.163.16.128/25\",\n\t\t\t\t\"10.163.17.0/25\",\n\t\t\t\t\"10.163.17.128/25\",\n\t\t\t\t\"10.163.18.0/25\",\n\t\t\t\t\"10.163.18.128/25\",\n\t\t\t\t\"10.163.20.0/22\",\n\t\t\t\t\"10.163.20.0/24\",\n\t\t\t\t\"10.163.21.0/24\",\n\t\t\t\t\"10.163.22.0/24\",\n\t\t\t\t\"10.163.24.0/21\",\n\t\t\t\t\"10.163.24.0/24\",\n\t\t\t\t\"10.163.25.0/24\",\n\t\t\t\t\"10.163.26.0/24\",\n\t\t\t\t\"10.163.27.0/24\",\n\t\t\t\t\"10.163.28.0/24\",\n\t\t\t\t\"10.163.29.0/24\",\n\t\t\t\t\"10.163.30.0/25\",\n\t\t\t\t\"10.163.30.0/23\",\n\t\t\t\t\"10.163.30.128/25\",\n\t\t\t\t\"10.163.31.0/25\",\n\t\t\t\t\"10.163.32.0/21\",\n\t\t\t\t\"10.163.32.0/24\",\n\t\t\t\t\"10.163.33.0/24\",\n\t\t\t\t\"10.163.34.0/24\",\n\t\t\t\t\"10.163.35.0/24\",\n\t\t\t\t\"10.163.36.0/24\",\n\t\t\t\t\"10.163.37.0/24\",\n\t\t\t\t\"10.163.40.0/24\",\n\t\t\t\t\"10.163.40.0/22\",\n\t\t\t\t\"10.163.41.0/24\",\n\t\t\t\t\"10.163.42.0/24\",\n\t\t\t\t\"10.163.44.0/24\",\n\t\t\t\t\"10.163.44.0/22\",\n\t\t\t\t\"10.163.45.0/24\",\n\t\t\t\t\"10.163.46.0/24\",\n\t\t\t\t\"10.163.48.0/24\",\n\t\t\t\t\"10.163.48.0/21\",\n\t\t\t\t\"10.163.49.0/24\",\n\t\t\t\t\"10.163.50.0/24\",\n\t\t\t\t\"10.163.51.0/24\",\n\t\t\t\t\"10.163.52.0/24\",\n\t\t\t\t\"10.163.53.0/24\",\n\t\t\t\t\"10.163.56.0/25\",\n\t\t\t\t\"10.163.56.0/22\",\n\t\t\t\t\"10.163.56.128/25\",\n\t\t\t\t\"10.163.57.0/25\",\n\t\t\t\t\"10.163.57.128/25\",\n\t\t\t\t\"10.163.58.0/25\",\n\t\t\t\t\"10.163.58.128/25\",\n\t\t\t},\n\t\t\texpectedErrorHandler: nil,\n\t\t\texpectedNetwork: \"10.163.60.0/23\",\n\t\t},\n\t\t{\n\t\t\tnetwork: \"10.163.0.0/16\",\n\t\t\tmask: 24,\n\t\t\tsubnets: []string{\n\t\t\t\t\"10.163.0.0/23\",\n\t\t\t\t\"10.163.0.0/25\",\n\t\t\t\t\"10.163.0.128/25\",\n\t\t\t\t\"10.163.1.0/25\",\n\t\t\t\t\"10.163.2.0/25\",\n\t\t\t\t\"10.163.2.0/23\",\n\t\t\t\t\"10.163.2.128/25\",\n\t\t\t\t\"10.163.3.0/25\",\n\t\t\t\t\"10.163.4.0/22\",\n\t\t\t\t\"10.163.4.0/25\",\n\t\t\t\t\"10.163.4.128/25\",\n\t\t\t\t\"10.163.5.0/25\",\n\t\t\t\t\"10.163.5.128/25\",\n\t\t\t\t\"10.163.6.0/25\",\n\t\t\t\t\"10.163.6.128/25\",\n\t\t\t\t\"10.163.8.0/25\",\n\t\t\t\t\"10.163.8.0/22\",\n\t\t\t\t\"10.163.8.128/25\",\n\t\t\t\t\"10.163.9.0/25\",\n\t\t\t\t\"10.163.9.128/25\",\n\t\t\t\t\"10.163.10.0/25\",\n\t\t\t\t\"10.163.10.128/25\",\n\t\t\t\t\"10.163.12.0/23\",\n\t\t\t\t\"10.163.12.0/25\",\n\t\t\t\t\"10.163.12.128/25\",\n\t\t\t\t\"10.163.13.0/25\",\n\t\t\t\t\"10.163.14.0/23\",\n\t\t\t\t\"10.163.14.0/25\",\n\t\t\t\t\"10.163.14.128/25\",\n\t\t\t\t\"10.163.15.0/25\",\n\t\t\t\t\"10.163.16.0/25\",\n\t\t\t\t\"10.163.16.0/22\",\n\t\t\t\t\"10.163.16.128/25\",\n\t\t\t\t\"10.163.17.0/25\",\n\t\t\t\t\"10.163.17.128/25\",\n\t\t\t\t\"10.163.18.0/25\",\n\t\t\t\t\"10.163.18.128/25\",\n\t\t\t\t\"10.163.20.0/22\",\n\t\t\t\t\"10.163.20.0/24\",\n\t\t\t\t\"10.163.21.0/24\",\n\t\t\t\t\"10.163.22.0/24\",\n\t\t\t\t\"10.163.24.0/21\",\n\t\t\t\t\"10.163.24.0/24\",\n\t\t\t\t\"10.163.25.0/24\",\n\t\t\t\t\"10.163.26.0/24\",\n\t\t\t\t\"10.163.27.0/24\",\n\t\t\t\t\"10.163.28.0/24\",\n\t\t\t\t\"10.163.29.0/24\",\n\t\t\t\t\"10.163.30.0/25\",\n\t\t\t\t\"10.163.30.0/23\",\n\t\t\t\t\"10.163.30.128/25\",\n\t\t\t\t\"10.163.31.0/25\",\n\t\t\t\t\"10.163.32.0/21\",\n\t\t\t\t\"10.163.32.0/24\",\n\t\t\t\t\"10.163.33.0/24\",\n\t\t\t\t\"10.163.34.0/24\",\n\t\t\t\t\"10.163.35.0/24\",\n\t\t\t\t\"10.163.36.0/24\",\n\t\t\t\t\"10.163.37.0/24\",\n\t\t\t\t\"10.163.40.0/24\",\n\t\t\t\t\"10.163.40.0/22\",\n\t\t\t\t\"10.163.41.0/24\",\n\t\t\t\t\"10.163.42.0/24\",\n\t\t\t\t\"10.163.44.0/24\",\n\t\t\t\t\"10.163.44.0/22\",\n\t\t\t\t\"10.163.45.0/24\",\n\t\t\t\t\"10.163.46.0/24\",\n\t\t\t\t\"10.163.48.0/24\",\n\t\t\t\t\"10.163.48.0/21\",\n\t\t\t\t\"10.163.49.0/24\",\n\t\t\t\t\"10.163.50.0/24\",\n\t\t\t\t\"10.163.51.0/24\",\n\t\t\t\t\"10.163.52.0/24\",\n\t\t\t\t\"10.163.53.0/24\",\n\t\t\t\t\"10.163.56.0/25\",\n\t\t\t\t\"10.163.56.0/22\",\n\t\t\t\t\"10.163.56.128/25\",\n\t\t\t\t\"10.163.57.0/25\",\n\t\t\t\t\"10.163.57.128/25\",\n\t\t\t\t\"10.163.58.0/25\",\n\t\t\t\t\"10.163.58.128/25\",\n\t\t\t},\n\t\t\texpectedErrorHandler: nil,\n\t\t\texpectedNetwork: \"10.163.60.0/24\",\n\t\t},\n\t}\n\n\tfor index, test := range tests {\n\t\t_, network, err := net.ParseCIDR(test.network)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"%v: could not parse cidr: %v\", index, test.network)\n\t\t}\n\n\t\tmask := net.CIDRMask(test.mask, 32)\n\n\t\tsubnets := []net.IPNet{}\n\t\tfor _, e := range test.subnets {\n\t\t\t_, n, err := net.ParseCIDR(e)\n\t\t\tif err != nil {\n\t\t\t\tt.Fatalf(\"%v: could not parse cidr: %v\", index, test.network)\n\t\t\t}\n\t\t\tsubnets = append(subnets, *n)\n\t\t}\n\n\t\t_, expectedNetwork, _ := net.ParseCIDR(test.expectedNetwork)\n\n\t\treturnedNetwork, err := Free(*network, mask, subnets)\n\n\t\tif err != nil {\n\t\t\tif test.expectedErrorHandler == nil {\n\t\t\t\tt.Fatalf(\"%v: unexpected error returned.\\nreturned: %v\", index, err)\n\t\t\t}\n\t\t\tif !test.expectedErrorHandler(err) {\n\t\t\t\tt.Fatalf(\"%v: incorrect error returned.\\nreturned: %v\", index, err)\n\t\t\t}\n\t\t} else {\n\t\t\tif test.expectedErrorHandler != nil {\n\t\t\t\tt.Fatalf(\"%v: expected error not returned.\", index)\n\t\t\t}\n\n\t\t\tif !ipNetEqual(returnedNetwork, *expectedNetwork) {\n\t\t\t\tt.Fatalf(\n\t\t\t\t\t\"%v: unexpected network returned. \\nexpected: %s (%#v, %#v) \\nreturned: %s (%#v, %#v)\",\n\t\t\t\t\tindex,\n\n\t\t\t\t\texpectedNetwork.String(),\n\t\t\t\t\texpectedNetwork.IP,\n\t\t\t\t\texpectedNetwork.Mask,\n\n\t\t\t\t\treturnedNetwork.String(),\n\t\t\t\t\treturnedNetwork.IP,\n\t\t\t\t\treturnedNetwork.Mask,\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "569af8a513620ee5eb9279497d131348", "score": "0.59351987", "text": "func testSubnetCidrs(t *testing.T, terraformOptions *terraform.Options) {\n\n\tawsRegion := terraformOptions.Vars[\"aws_region\"].(string)\n\tvpcID := terraform.Output(t, terraformOptions, \"vpc_id\")\n\tvpcSubnets := aws.GetSubnetsForVpc(t, vpcID, awsRegion)\n\n\tvar subnetList []string\n\tfor _, subnet := range vpcSubnets {\n\t\tsubnetList = append(subnetList, subnet.Id)\n\t}\n\n\tcfg, _ := external.LoadDefaultAWSConfig()\n\tcfg.Region = awsRegion\n\tclient := ec2.New(cfg)\n\n\tsubnetParams := &ec2.DescribeSubnetsInput{\n\t\tFilters: []ec2.Filter{\n\t\t\t{\n\t\t\t\tName: aws2.String(\"subnet-id\"),\n\t\t\t\tValues: subnetList,\n\t\t\t},\n\t\t},\n\t}\n\n\tsubnetReq := client.DescribeSubnetsRequest(subnetParams)\n\n\tsubnetResp, _ := subnetReq.Send()\n\n\tvar subnetCidrList []string\n\tfor _, subnet := range subnetResp.Subnets {\n\t\tsubnetCidrList = append(subnetCidrList, *subnet.CidrBlock)\n\t}\n\n\tacceptableCidrList := [2]string{\"10.0.0.0/28\", \"10.0.1.0/28\"}\n\n\tassert.ElementsMatch(t, subnetCidrList, acceptableCidrList)\n}", "title": "" }, { "docid": "663632995a092b468559fa350946033a", "score": "0.585993", "text": "func TestSubnetOverlapInside(t *testing.T) {\n\tdt, _ := simpleSetup()\n\t_, err, code := addNewSubnet(dt, \"fred2\", \"192.168.128.128/25\")\n\n\tassert.Equal(t, code, http.StatusBadRequest, \"Return code should be bad status, but is %d\", code)\n\tassert.NotNil(t, err, \"Error should not be nil\")\n\tassert.Equal(t, err.Error(), \"Subnet overlaps with existing subnet\", \"Error message should be 'Subnet overlaps with existing subnet', but was %s\", err.Error())\n}", "title": "" }, { "docid": "94be59a9d14afd03635cbeddda35397c", "score": "0.5853378", "text": "func (m *MockNsxNetworkProvisioner) GetIPBlockSubnet(arg0, arg1 string) (string, string, error) {\n\tret := m.ctrl.Call(m, \"GetIPBlockSubnet\", arg0, arg1)\n\tret0, _ := ret[0].(string)\n\tret1, _ := ret[1].(string)\n\tret2, _ := ret[2].(error)\n\treturn ret0, ret1, ret2\n}", "title": "" }, { "docid": "cd7461616302ccf9ccb0f8883aaf9f7a", "score": "0.58378965", "text": "func AddSubnet(connectionName string, rsType string, vpcName string, reqInfo cres.SubnetInfo) (*cres.VPCInfo, error) {\n\tcblog.Info(\"call AddSubnet()\")\n\n\t// check empty and trim user inputs\n connectionName, err := EmptyCheckAndTrim(\"connectionName\", connectionName)\n if err != nil {\n\t\tcblog.Error(err)\n return nil, err\n }\n\n vpcName, err = EmptyCheckAndTrim(\"vpcName\", vpcName)\n if err != nil {\n\t\tcblog.Error(err)\n return nil, err\n }\n\n\tcldConn, err := ccm.GetCloudConnection(connectionName)\n\tif err != nil {\n\t\tcblog.Error(err)\n\t\treturn nil, err\n\t}\n\n\thandler, err := cldConn.CreateVPCHandler()\n\tif err != nil {\n\t\tcblog.Error(err)\n\t\treturn nil, err\n\t}\n\n\tvpcSPLock.Lock(connectionName, vpcName)\n\tdefer vpcSPLock.Unlock(connectionName, vpcName)\n\t// (1) check exist(NameID)\n\tbool_ret, err := iidRWLock.IsExistIID(iidm.SUBNETGROUP, connectionName, vpcName, reqInfo.IId)\n\tif err != nil {\n\t\tcblog.Error(err)\n\t\treturn nil, err\n\t}\n\n\tif bool_ret == true {\n\t\terr := fmt.Errorf(rsType + \"-\" + reqInfo.IId.NameId + \" already exists!\")\n\t\tcblog.Error(err)\n\t\treturn nil, err\n\t}\n\t// (2) create Resource\n\tiidVPCInfo, err := iidRWLock.GetIID(iidm.IIDSGROUP, connectionName, rsVPC, cres.IID{vpcName, \"\"})\n\tif err != nil {\n\t\tcblog.Error(err)\n\t\treturn nil, err\n\t}\n\n\tsubnetUUID, err := iidm.New(connectionName, rsType, reqInfo.IId.NameId)\n\tif err != nil {\n cblog.Error(err)\n return nil, err\n }\n\n\t// driverIID for driver\n\tsubnetReqNameId := reqInfo.IId.NameId\n\treqInfo.IId = cres.IID{subnetUUID, \"\"}\n\tinfo, err := handler.AddSubnet(getDriverIID(iidVPCInfo.IId), reqInfo)\n\tif err != nil {\n\t\tcblog.Error(err)\n\t\treturn nil, err\n\t}\n\n\t// (3) insert IID\n\t// for Subnet list\n\tfor _, subnetInfo := range info.SubnetInfoList {\t\t\n\t\tif subnetInfo.IId.NameId == reqInfo.IId.NameId { // NameId => SS-UUID\n\t\t\t// key-value structure: ~/{SUBNETGROUP}/{ConnectionName}/{VPC-NameId}/{Subnet-reqNameId} [subnet-driverNameId:subnet-driverSystemId] # VPC NameId => rsType\n\t\t\tsubnetSpiderIId := cres.IID{subnetReqNameId, subnetInfo.IId.NameId + \":\" + subnetInfo.IId.SystemId}\n\t\t\t_, err := iidRWLock.CreateIID(iidm.SUBNETGROUP, connectionName, vpcName, subnetSpiderIId)\n\t\t\tif err != nil {\n\t\t\t\tcblog.Error(err)\n\t\t\t\t// rollback\n\t\t\t\t// (1) for resource\n\t\t\t\tcblog.Info(\"<<ROLLBACK:TRY:VPC-SUBNET-CSP>> \" + subnetInfo.IId.SystemId)\n\t\t\t\t_, err2 := handler.RemoveSubnet(getDriverIID(iidVPCInfo.IId), subnetInfo.IId)\n\t\t\t\tif err2 != nil {\n\t\t\t\t\tcblog.Error(err2)\n\t\t\t\t\treturn nil, fmt.Errorf(err.Error() + \", \" + err2.Error())\n\t\t\t\t}\n\t\t\t\t// (2) for Subnet IID\n\t\t\t\tcblog.Info(\"<<ROLLBACK:TRY:VPC-SUBNET-IID>> \" + subnetInfo.IId.NameId)\n\t\t\t\t_, err3 := iidRWLock.DeleteIID(iidm.SUBNETGROUP, connectionName, vpcName, subnetSpiderIId) // vpcName => rsType\n\t\t\t\tif err3 != nil {\n\t\t\t\t\tcblog.Error(err3)\n\t\t\t\t\treturn nil, fmt.Errorf(err.Error() + \", \" + err3.Error())\n\t\t\t\t}\n\t\t\t\tcblog.Error(err)\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t}\n\n\t// (3) set ResourceInfo(userIID)\n\tinfo.IId = getUserIID(iidVPCInfo.IId)\n\n\t// set NameId for SubnetInfo List\n\t// create new SubnetInfo List\n\tsubnetInfoList := []cres.SubnetInfo{}\n\tfor _, subnetInfo := range info.SubnetInfoList {\t\t\n\t\tsubnetIIDInfo, err := iidRWLock.GetIIDbySystemID(iidm.SUBNETGROUP, connectionName, vpcName, subnetInfo.IId) // vpcName => rsType\n\t\tif err != nil {\n\t\t\tcblog.Error(err)\n\t\t\treturn nil, err\n\t\t}\n\t\tif subnetIIDInfo.IId.NameId != \"\" { // insert only this user created.\n\t\t\tsubnetInfo.IId = getUserIID(subnetIIDInfo.IId)\n\t\t\tsubnetInfoList = append(subnetInfoList, subnetInfo)\n\t\t}\n\t}\n\tinfo.SubnetInfoList = subnetInfoList\n\n\treturn &info, nil\n}", "title": "" }, { "docid": "d843bfd8c8f65adff717ae6b2fe13cee", "score": "0.5790917", "text": "func (vpc *Vpcclient) CreatSubnet(project_id string, name string, cidr string, gataway_ip string, vpc_id string, token string) (*SubnetDetails, error) {\n\trouter := fmt.Sprintf(\"%s/v1/%s/subnets\", vpc.endpoint, project_id)\n\trequstbody := &SubnetDetails{\n\t\tSubnet: Subnet{\n\t\t\tName: name,\n\t\t\tCIDR: cidr,\n\t\t\tGatewayIp: gataway_ip,\n\t\t\tVpcID: vpc_id,\n\t\t\tDHCPEnable: true,\n\t\t},\n\t}\n\tstr, _ := json.Marshal(requstbody)\n\tbody := bytes.NewBuffer([]byte(str))\n\trsp, status_code, _, err := common.DoHttpRequest(\"POST\", router, \"application/json\", body, token, \"\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif status_code != 200 {\n\t\treturn nil, errors.New(\"return code is not 200 :\" + strconv.Itoa(status_code) + string(rsp))\n\t}\n\tvar result SubnetDetails\n\terr = json.Unmarshal(rsp, &result)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &result, nil\n}", "title": "" }, { "docid": "afb29874e325bcb13d84d85004cf57fb", "score": "0.5751335", "text": "func Example() {\n\tctx := context.Background()\n\n\t// Construct a new IPAM service.\n\tlogger := microloggertest.New()\n\tstorage, _ := memory.New(memory.Config{})\n\t_, network, _ := net.ParseCIDR(\"10.4.0.0/16\")\n\n\tconfig := Config{\n\t\tLogger: logger,\n\t\tStorage: storage,\n\t\tNetwork: network,\n\t}\n\n\tservice, _ := New(config)\n\n\t// Request a subnet. There are no subnets in the network currently,\n\t// so this subnet will be at the start of the IP range.\n\tfirstNetwork, _ := service.CreateSubnet(ctx, net.CIDRMask(24, 32), \"arbitrary value\", nil)\n\tfmt.Println(firstNetwork.String())\n\n\t// Request a second, smaller subnet.\n\t// There is one subnet currently, so this subnet will begin after\n\t// the previous subnet.\n\tsecondNetwork, _ := service.CreateSubnet(ctx, net.CIDRMask(32, 32), \"\", nil)\n\tfmt.Println(secondNetwork.String())\n\n\t// Release the first subnet from the service.\n\t// This makes the IP range available for future operations.\n\t_ = service.DeleteSubnet(ctx, firstNetwork)\n\n\t// Request a third subnet.\n\t// As the range at the start of the network is free,\n\t// and this subnet fits in the space,\n\t// it will be placed there.\n\tthirdNetwork, _ := service.CreateSubnet(ctx, net.CIDRMask(25, 32), \"\", nil)\n\tfmt.Println(thirdNetwork.String())\n\n\t// Request a fourth subnet.\n\t// As 2 /25s fit within a /24, both this subnet and the previous\n\t// subnet fit in the space of the older /24.\n\tfourthNetwork, _ := service.CreateSubnet(ctx, net.CIDRMask(25, 32), \"\", nil)\n\tfmt.Println(fourthNetwork.String())\n\n\t// Output:\n\t// 10.4.0.0/24\n\t// 10.4.1.0/32\n\t// 10.4.0.0/25\n\t// 10.4.0.128/25\n}", "title": "" }, { "docid": "88befb351d611c748d32bd3765ea4c70", "score": "0.5746097", "text": "func TestReserveIP(t *testing.T) {\n\tsubnet := \"10.0.0.0/16\"\n\n\tasID, err := ic.GetAddressSpace()\n\tif err != nil {\n\t\tt.Errorf(\"GetAddressSpace failed with %v\\n\", err)\n\t\treturn\n\t}\n\n\tpoolID, err := ic.GetPoolID(asID, subnet)\n\tif err != nil {\n\t\tt.Errorf(\"GetPoolID failed with %v\\n\", err)\n\t\treturn\n\t}\n\n\taddr1, err := ic.ReserveIPAddress(poolID, \"id1\")\n\tif err != nil {\n\t\tt.Errorf(\"GetReserveIP failed with %v\\n\", err)\n\t\treturn\n\t}\n\tif addr1 != \"10.0.0.2/16\" {\n\t\tt.Errorf(\"GetReserveIP returned ivnvalid IP %s\\n\", addr1)\n\t\treturn\n\t}\n\taddr2, err := ic.ReserveIPAddress(poolID, \"id1\")\n\tif err != nil {\n\t\tt.Errorf(\"GetReserveIP failed with %v\\n\", err)\n\t\treturn\n\t}\n\tif addr1 != addr2 {\n\t\tt.Errorf(\"GetReserveIP with id returned ivnvalid IP1 %s IP2 %s\\n\", addr1, addr2)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "fe6b9c71d721b14fd86dcf10cfa5e3c3", "score": "0.57319075", "text": "func (m *MockClient) ReadIPBlockSubnet(arg0 string) (*models.IPBlockSubnet, error) {\n\tret := m.ctrl.Call(m, \"ReadIPBlockSubnet\", arg0)\n\tret0, _ := ret[0].(*models.IPBlockSubnet)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "f4fa8460999f35522f20417a8a0ca6dc", "score": "0.5678545", "text": "func TestIPUsedUPInSubnet(t *testing.T) {\n\tconf, allocator := setup(\"10.0.0.0/29\", \"\", \"\", t)\n\n\tgomock.InOrder(\n\t\tallocator.EXPECT().Exists(config.LastKnownIPKey).Return(true, nil),\n\t\tallocator.EXPECT().Get(config.LastKnownIPKey).Return(\"10.0.0.3\", nil),\n\t\tallocator.EXPECT().SetLastKnownIP(net.ParseIP(\"10.0.0.3\")),\n\t\tallocator.EXPECT().GetAvailableIP(gomock.Any()).Return(\"\", errors.New(\"no available ip in the subnet\")),\n\t)\n\n\tassignedAddress, err := getIPV4Address(allocator, conf)\n\tassert.Error(t, err, \"no available ip in the subnet should cause error\")\n\tassert.Nil(t, assignedAddress, \"error will cause ip not be assigned\")\n}", "title": "" }, { "docid": "575db001e3ab7425a780b0c09f4ccf4c", "score": "0.56597424", "text": "func (client *Client) createSubnet(name string, networkID string, cidr string, ipVersion IPVersion.Enum) (*Subnet, error) {\n\t// You must associate a new subnet with an existing network - to do this you\n\t// need its UUID. You must also provide a well-formed CIDR value.\n\t//addr, _, err := net.ParseCIDR(mask)\n\tdhcp := true\n\topts := subnets.CreateOpts{\n\t\tNetworkID: networkID,\n\t\tCIDR: cidr,\n\t\tIPVersion: toGopherIPversion(ipVersion),\n\t\tName: name,\n\t\tEnableDHCP: &dhcp,\n\t}\n\n\t// Execute the operation and get back a subnets.Subnet struct\n\tsubnet, err := subnets.Create(client.Network, opts).Extract()\n\tif client.Cfg.UseLayer3Networking {\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"Error creating subnet: %s\", errorString(err))\n\t\t}\n\n\t\trouter, err := client.createRouter(RouterRequest{\n\t\t\tName: subnet.ID,\n\t\t\tNetworkID: client.ProviderNetworkID,\n\t\t})\n\t\tif err != nil {\n\t\t\tclient.deleteSubnet(subnet.ID)\n\t\t\treturn nil, fmt.Errorf(\"Error creating subnet: %s\", errorString(err))\n\t\t}\n\t\terr = client.addSubnetToRouter(router.ID, subnet.ID)\n\t\tif err != nil {\n\t\t\tclient.deleteSubnet(subnet.ID)\n\t\t\tclient.deleteRouter(router.ID)\n\t\t\treturn nil, fmt.Errorf(\"Error creating subnet: %s\", errorString(err))\n\t\t}\n\t}\n\n\treturn &Subnet{\n\t\tID: subnet.ID,\n\t\tName: subnet.Name,\n\t\tIPVersion: fromIntIPversion(subnet.IPVersion),\n\t\tMask: subnet.CIDR,\n\t\tNetworkID: subnet.NetworkID,\n\t}, nil\n}", "title": "" }, { "docid": "b52f6b344041c3ed6118890cf38d1cdd", "score": "0.56560457", "text": "func TestNewIPRange(t *testing.T) {\n\ttests := []struct {\n\t\tnetwork string\n\t\texpectedIPRange ipRange\n\t}{\n\t\t{\n\t\t\tnetwork: \"0.0.0.0/0\",\n\t\t\texpectedIPRange: ipRange{\n\t\t\t\tstart: net.ParseIP(\"0.0.0.0\").To4(),\n\t\t\t\tend: net.ParseIP(\"255.255.255.255\").To4(),\n\t\t\t},\n\t\t},\n\n\t\t{\n\t\t\tnetwork: \"10.4.0.0/8\",\n\t\t\texpectedIPRange: ipRange{\n\t\t\t\tstart: net.ParseIP(\"10.0.0.0\").To4(),\n\t\t\t\tend: net.ParseIP(\"10.255.255.255\").To4(),\n\t\t\t},\n\t\t},\n\n\t\t{\n\t\t\tnetwork: \"10.4.0.0/16\",\n\t\t\texpectedIPRange: ipRange{\n\t\t\t\tstart: net.ParseIP(\"10.4.0.0\").To4(),\n\t\t\t\tend: net.ParseIP(\"10.4.255.255\").To4(),\n\t\t\t},\n\t\t},\n\n\t\t{\n\t\t\tnetwork: \"10.4.0.0/24\",\n\t\t\texpectedIPRange: ipRange{\n\t\t\t\tstart: net.ParseIP(\"10.4.0.0\").To4(),\n\t\t\t\tend: net.ParseIP(\"10.4.0.255\").To4(),\n\t\t\t},\n\t\t},\n\n\t\t{\n\t\t\tnetwork: \"172.168.0.0/25\",\n\t\t\texpectedIPRange: ipRange{\n\t\t\t\tstart: net.ParseIP(\"172.168.0.0\").To4(),\n\t\t\t\tend: net.ParseIP(\"172.168.0.127\").To4(),\n\t\t\t},\n\t\t},\n\t}\n\n\tfor index, test := range tests {\n\t\t_, network, _ := net.ParseCIDR(test.network)\n\t\tipRange := newIPRange(*network)\n\n\t\tif !reflect.DeepEqual(ipRange, test.expectedIPRange) {\n\t\t\tt.Fatalf(\n\t\t\t\t\"%v: unexpected ipRange returned.\\nexpected: %#v\\nreturned: %#v\\n\",\n\t\t\t\tindex,\n\t\t\t\ttest.expectedIPRange,\n\t\t\t\tipRange,\n\t\t\t)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "409f6c4123ee3b8b23d52b6fb772be3a", "score": "0.5638847", "text": "func (nuageetcd *NuageEtcdClient) AllocateSubnetForPod(data *api.EtcdPodMetadata) (*api.EtcdPodSubnet, error) {\n\tpod := data.PodName\n\tns := data.NamespaceName\n\tpodSubnet := &api.EtcdPodSubnet{}\n\tvar err error\n\tvar subnetStr string\n\tvar txnResp *clientv3.TxnResponse\n\n\tf := func() (bool, error) {\n\t\tpodSubnet.ToCreate = \"\"\n\t\tpodSubnet.ToUse = \"\"\n\t\tcount := nuageetcd.maxIPCount\n\t\tACTIVEIPCount := 0\n\t\tsuffix := -1\n\t\tsnet := &etcdSubnetValue{}\n\t\tallocatedSubnet := &etcdSubnetValue{}\n\n\t\tnuageEtcdRetry(\n\t\t\tfunc() error {\n\t\t\t\ttxnResp, err = nuageetcd.client.KV.Txn(context.Background()).Then(\n\t\t\t\t\tclientv3.OpGet(POD_METADATA_TREE+ns+\"/\"+pod),\n\t\t\t\t\tclientv3.OpGet(SUBNET_METADATA_TREE+ns+\"/\"+ns, clientv3.WithPrefix())).Commit()\n\t\t\t\treturn err\n\t\t\t})\n\t\tif err != nil {\n\t\t\tglog.Errorf(\"fetching pod and subnet metadata during allocating subnet failed: %v\", err)\n\t\t\treturn false, err\n\t\t}\n\t\tpodResp := (*clientv3.GetResponse)(txnResp.Responses[0].GetResponseRange())\n\t\tsubnetResp := (*clientv3.GetResponse)(txnResp.Responses[1].GetResponseRange())\n\t\tif len(podResp.Kvs) != 0 {\n\t\t\tpodSubnet.ToUse = string(podResp.Kvs[0].Value)\n\t\t\tglog.Warningf(\"pod %s is already allocated to subnet %s\", pod, podSubnet.ToUse)\n\t\t\treturn true, nil\n\t\t}\n\n\t\tfor _, kv := range subnetResp.Kvs {\n\t\t\tif err := json.Unmarshal(kv.Value, snet); err != nil {\n\t\t\t\tglog.Errorf(\"unmarshal kv pair(%s, %s) conversion failed: %v\", kv.Key, kv.Value, err)\n\t\t\t\tcontinue\n\t\t\t} else {\n\t\t\t\tACTIVEIPCount += snet.ACTIVEIP\n\t\t\t\tsuffix = max(suffix, getSuffix(string(kv.Key)))\n\t\t\t\tif count == nuageetcd.maxIPCount && snet.ACTIVEIP < count {\n\t\t\t\t\tcount = snet.ACTIVEIP\n\t\t\t\t\tsubnetStr = string(kv.Key)\n\t\t\t\t\tallocatedSubnet = &etcdSubnetValue{\n\t\t\t\t\t\tCIDR: snet.CIDR,\n\t\t\t\t\t\tVSDID: snet.VSDID,\n\t\t\t\t\t\tACTIVEIP: snet.ACTIVEIP,\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tputs := []clientv3.Op{}\n\t\tcompares := []clientv3.Cmp{}\n\t\tnoOfSubnets := len(subnetResp.Kvs)\n\t\tif (ACTIVEIPCount+1)*100 > noOfSubnets*nuageetcd.maxIPCount*SCALE_UP_THRESHOLD {\n\t\t\tnewSubnet := fmt.Sprintf(\"%s-%d\", ns, suffix+1)\n\t\t\tsnet := &etcdSubnetValue{ACTIVEIP: 0, VSDID: \"\", CIDR: \"0\"}\n\t\t\tb, err := json.Marshal(snet)\n\t\t\tif err != nil {\n\t\t\t\tglog.Errorf(\"marshal struct %v to json string failed: %v\", snet, err)\n\t\t\t}\n\t\t\tputs = append(puts, clientv3.OpPut(SUBNET_METADATA_TREE+ns+\"/\"+newSubnet, string(b)))\n\t\t\tpodSubnet.ToCreate = newSubnet\n\t\t}\n\t\tpodSubnet.ToUse = path.Base(subnetStr)\n\t\tallocatedSubnet.ACTIVEIP += 1\n\t\tb, err := json.Marshal(allocatedSubnet)\n\t\tif err != nil {\n\t\t\tglog.Errorf(\"marshal struct %v to json string failed: %v\", allocatedSubnet, err)\n\t\t}\n\n\t\tputs = append(puts, clientv3.OpPut(subnetStr, string(b)))\n\t\tputs = append(puts, clientv3.OpPut(POD_METADATA_TREE+ns+\"/\"+pod, path.Base(subnetStr)))\n\t\tfor _, kv := range subnetResp.Kvs {\n\t\t\tcompares = append(compares, clientv3.Compare(clientv3.ModRevision(string(kv.Key)), \"=\", kv.ModRevision))\n\t\t}\n\t\tnuageEtcdRetry(\n\t\t\tfunc() error {\n\t\t\t\ttxnResp, err = nuageetcd.client.KV.Txn(context.Background()).If(\n\t\t\t\t\tcompares...).Then(\n\t\t\t\t\tputs...).Commit()\n\t\t\t\treturn err\n\t\t\t})\n\t\tif err != nil {\n\t\t\tglog.Errorf(\"writing transaction to etcd failed:\", err)\n\t\t\treturn false, err\n\t\t}\n\t\treturn txnResp.Succeeded, nil\n\t}\n\tnuageetcd.nuageSTM(f)\n\treturn podSubnet, nil\n}", "title": "" }, { "docid": "1c96a9583e6e80831702708bfcf7782d", "score": "0.5599372", "text": "func TestParseCIDR(t *testing.T) {\n\tfor _, tt := range []struct {\n\t\tin string\n\t\taddress string\n\t\tnetmask string\n\t}{\n\t\t{\"135.104.0.0/32\", \"135.104.0.0\", \"255.255.255.255\"},\n\t\t{\"0.0.0.0/24\", \"0.0.0.0\", \"255.255.255.0\"},\n\t\t{\"135.104.0.0/24\", \"135.104.0.0\", \"255.255.255.0\"},\n\t\t{\"135.104.0.1/32\", \"135.104.0.1\", \"255.255.255.255\"},\n\t\t{\"135.104.0.1/24\", \"135.104.0.1\", \"255.255.255.0\"},\n\t} {\n\t\taddress, subnet, err := util.ParseCIDR(tt.in)\n\t\tif err != nil {\n\t\t\tt.Error(err)\n\t\t} else if want := util.Parse(tt.address); address != want {\n\t\t\tt.Errorf(\"ParseCIDR('%s') = ('%s', _); want ('%s', _)\", tt.in, address, want)\n\t\t} else {\n\t\t\tnetmask := tcpip.AddressMask(util.Parse(tt.netmask))\n\t\t\tif want, err := tcpip.NewSubnet(util.ApplyMask(want, netmask), netmask); err != nil {\n\t\t\t\tt.Errorf(\"tcpip.NewSubnet('%v', '%v') failed: %v\", want, tt.netmask, err)\n\t\t\t} else if want != subnet {\n\t\t\t\tt.Errorf(\"ParseCIDR('%s') = (_, %+v); want (_, %+v)\", tt.in, subnet, want)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "10c2256abd2d9e28d3d336d7577c9785", "score": "0.55876034", "text": "func (m *MockNsxNetworkProvisioner) DeleteIPBlockSubnet(arg0 string) error {\n\tret := m.ctrl.Call(m, \"DeleteIPBlockSubnet\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "901b56cf4bb0b64d018a63b089361eaa", "score": "0.55826366", "text": "func (aSpace *addrSpace) allocateSubnet(nw, sub netip.Prefix) error {\n\taSpace.Lock()\n\tdefer aSpace.Unlock()\n\n\t// Check if already allocated\n\tif pool, ok := aSpace.subnets[nw]; ok {\n\t\tvar childExists bool\n\t\tif sub != (netip.Prefix{}) {\n\t\t\t_, childExists = pool.children[sub]\n\t\t}\n\t\tif sub == (netip.Prefix{}) || childExists {\n\t\t\t// This means the same pool is already allocated. allocateSubnet is called when there\n\t\t\t// is request for a pool/subpool. It should ensure there is no overlap with existing pools\n\t\t\treturn ipamapi.ErrPoolOverlap\n\t\t}\n\t}\n\n\treturn aSpace.allocateSubnetL(nw, sub)\n}", "title": "" }, { "docid": "acddd5b03979ad6553d979e292afbe50", "score": "0.5574612", "text": "func (m *MockBastionScope) Subnet(arg0 string) v1beta1.SubnetSpec {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Subnet\", arg0)\n\tret0, _ := ret[0].(v1beta1.SubnetSpec)\n\treturn ret0\n}", "title": "" }, { "docid": "6d2f2c6822b383375a45fc7e9d435472", "score": "0.5573546", "text": "func (m *MockBastionScope) NodeSubnets() []v1beta1.SubnetSpec {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"NodeSubnets\")\n\tret0, _ := ret[0].([]v1beta1.SubnetSpec)\n\treturn ret0\n}", "title": "" }, { "docid": "735e4d76548758068166453adba9446b", "score": "0.55657846", "text": "func (m *MockIPAMDelegator) GetIPAMSubnetAddress(arg0 []byte, arg1 *invoke.Args) (*types100.Result, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetIPAMSubnetAddress\", arg0, arg1)\n\tret0, _ := ret[0].(*types100.Result)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "b8757185bfc9a6900353a04220a8b1be", "score": "0.55613405", "text": "func (m *MockAPIs) AllocIPAddress(arg0 string) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"AllocIPAddress\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "d2eee5a29cf580af0c311a5cc7539b9d", "score": "0.55478257", "text": "func TestCreateChain(t *testing.T) {\n\trequire := require.New(t)\n\tvm, _, _ := defaultVM(t)\n\tvm.ctx.Lock.Lock()\n\tdefer func() {\n\t\trequire.NoError(vm.Shutdown(context.Background()))\n\t\tvm.ctx.Lock.Unlock()\n\t}()\n\n\ttx, err := vm.txBuilder.NewCreateChainTx(\n\t\ttestSubnet1.ID(),\n\t\tnil,\n\t\tids.ID{'t', 'e', 's', 't', 'v', 'm'},\n\t\tnil,\n\t\t\"name\",\n\t\t[]*secp256k1.PrivateKey{testSubnet1ControlKeys[0], testSubnet1ControlKeys[1]},\n\t\tids.ShortEmpty, // change addr\n\t)\n\trequire.NoError(err)\n\n\trequire.NoError(vm.Builder.AddUnverifiedTx(tx))\n\n\tblk, err := vm.Builder.BuildBlock(context.Background())\n\trequire.NoError(err) // should contain proposal to create chain\n\n\trequire.NoError(blk.Verify(context.Background()))\n\n\trequire.NoError(blk.Accept(context.Background()))\n\n\t_, txStatus, err := vm.state.GetTx(tx.ID())\n\trequire.NoError(err)\n\trequire.Equal(status.Committed, txStatus)\n\n\t// Verify chain was created\n\tchains, err := vm.state.GetChains(testSubnet1.ID())\n\trequire.NoError(err)\n\n\tfoundNewChain := false\n\tfor _, chain := range chains {\n\t\tif bytes.Equal(chain.Bytes(), tx.Bytes()) {\n\t\t\tfoundNewChain = true\n\t\t}\n\t}\n\trequire.True(foundNewChain)\n}", "title": "" }, { "docid": "fb704351c240e318031184047ef01981", "score": "0.55440694", "text": "func (m *MockClient) DeleteIPBlockSubnet(arg0 string) error {\n\tret := m.ctrl.Call(m, \"DeleteIPBlockSubnet\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "254832cf585bb38b847351fe6ce0a63c", "score": "0.5542503", "text": "func (m *MockBastionScope) SetSubnet(arg0 v1beta1.SubnetSpec) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"SetSubnet\", arg0)\n}", "title": "" }, { "docid": "60d1b302a125d9dff93d3dfd3aaedf84", "score": "0.5503016", "text": "func TestReleaseIP(t *testing.T) {\n\tsubnet := \"10.0.0.0/16\"\n\n\tasID, err := ic.GetAddressSpace()\n\tif err != nil {\n\t\tt.Errorf(\"GetAddressSpace failed with %v\\n\", err)\n\t\treturn\n\t}\n\n\tpoolID, err := ic.GetPoolID(asID, subnet)\n\tif err != nil {\n\t\tt.Errorf(\"GetPoolID failed with %v\\n\", err)\n\t\treturn\n\t}\n\n\taddr1, err := ic.ReserveIPAddress(poolID, \"id1\")\n\tif err != nil {\n\t\tt.Errorf(\"GetReserveIP failed with %v\\n\", err)\n\t\treturn\n\t}\n\tif addr1 != \"10.0.0.2/16\" {\n\t\tt.Errorf(\"GetReserveIP returned ivnvalid IP %s\\n\", addr1)\n\t\treturn\n\t}\n\n\terr = ic.ReleaseIPAddress(poolID, \"id1\")\n\tif err != nil {\n\t\tt.Errorf(\"Release reservation failed with %v\\n\", err)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "118524d74d09ff3855ce90b2cb285933", "score": "0.5494654", "text": "func TestReconcileLoadBalancerAddServiceOnInternalSubnet(t *testing.T) {\n\tctrl := gomock.NewController(t)\n\tdefer ctrl.Finish()\n\n\taz := GetTestCloud(ctrl)\n\tclusterResources, expectedInterfaces, expectedVirtualMachines := getClusterResources(az, 1, 1)\n\tsetMockEnv(az, ctrl, expectedInterfaces, expectedVirtualMachines, 1)\n\n\tsvc := getInternalTestService(\"service1\", 80)\n\tvalidateTestSubnet(t, az, &svc)\n\n\texpectedLBs := make([]network.LoadBalancer, 0)\n\tsetMockLBs(az, ctrl, &expectedLBs, \"service\", 1, 1, true)\n\n\tlb, err := az.reconcileLoadBalancer(testClusterName, &svc, clusterResources.nodes, true /* wantLb */)\n\tif err != nil {\n\t\tt.Errorf(\"Unexpected error: %q\", err)\n\t}\n\n\t// ensure we got a frontend ip configuration\n\tif len(*lb.FrontendIPConfigurations) != 1 {\n\t\tt.Error(\"Expected the loadbalancer to have a frontend ip configuration\")\n\t}\n\n\tvalidateLoadBalancer(t, lb, svc)\n}", "title": "" }, { "docid": "6395d16886db16a1070c5aebcb54fc07", "score": "0.54857874", "text": "func TestReconcileLoadBalancerEditServiceSubnet(t *testing.T) {\n\tctrl := gomock.NewController(t)\n\tdefer ctrl.Finish()\n\n\taz := GetTestCloud(ctrl)\n\tclusterResources, expectedInterfaces, expectedVirtualMachines := getClusterResources(az, 1, 1)\n\tsetMockEnv(az, ctrl, expectedInterfaces, expectedVirtualMachines, 1)\n\n\tsvc := getInternalTestService(\"service1\", 8081)\n\tvalidateTestSubnet(t, az, &svc)\n\n\texpectedLBs := make([]network.LoadBalancer, 0)\n\tsetMockLBs(az, ctrl, &expectedLBs, \"service\", 1, 1, true)\n\n\tlb, err := az.reconcileLoadBalancer(testClusterName, &svc, clusterResources.nodes, true /* wantLb */)\n\tif err != nil {\n\t\tt.Errorf(\"Unexpected error reconciling initial svc: %q\", err)\n\t}\n\n\tvalidateLoadBalancer(t, lb, svc)\n\n\tsvc.Annotations[ServiceAnnotationLoadBalancerInternalSubnet] = \"subnet\"\n\tvalidateTestSubnet(t, az, &svc)\n\n\texpectedLBs = make([]network.LoadBalancer, 0)\n\tsetMockLBs(az, ctrl, &expectedLBs, \"service\", 1, 1, true)\n\n\tlb, err = az.reconcileLoadBalancer(testClusterName, &svc, clusterResources.nodes, true /* wantLb */)\n\tif err != nil {\n\t\tt.Errorf(\"Unexpected error reconciling edits to svc: %q\", err)\n\t}\n\n\t// ensure we got a frontend ip configuration for the service\n\tif len(*lb.FrontendIPConfigurations) != 1 {\n\t\tt.Error(\"Expected the loadbalancer to have 1 frontend ip configuration\")\n\t}\n\n\tvalidateLoadBalancer(t, lb, svc)\n}", "title": "" }, { "docid": "9e37340f6556df84c281b3b2c73d9ba8", "score": "0.5483821", "text": "func (m *MockNatGatewayScope) SetSubnet(arg0 v1beta1.SubnetSpec) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"SetSubnet\", arg0)\n}", "title": "" }, { "docid": "8f24fc967e098a8bdfdfde8e8c9d0a21", "score": "0.54830545", "text": "func (m *MockNetworking) DeleteSubnet(arg0 string) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"DeleteSubnet\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "4e442a478e64db95ccd0257582672d9a", "score": "0.54732746", "text": "func (sub SubnetIn) CreateVirtualNetworkSubnet() (subnet network.Subnet, err error) {\n\n subnetParams := network.Subnet {\n Name: to.StringPtr(sub.SubnetName),\n SubnetPropertiesFormat: &network.SubnetPropertiesFormat{\n AddressPrefix: to.StringPtr(sub.SubnetCidr),\n },\n }\n\n if sub.NsgID != \"\" {\n r := subnetParams.SubnetPropertiesFormat\n r.NetworkSecurityGroup = &network.SecurityGroup{\n ID: to.StringPtr(sub.NsgID),\n }\n }\n\tsubnetsClient := getSubnetsClient()\n\n\tfuture, err := subnetsClient.CreateOrUpdate(\n\t\tctx,\n\t\tsub.ResourceGroup,\n\t\tsub.VnetName,\n\t\tsub.SubnetName,\n subnetParams,\n\t\t)\n\tif err != nil {\n\t\treturn subnet, fmt.Errorf(\"cannot create subnet: %v\", err)\n\t}\n\n\terr = future.WaitForCompletion(ctx, subnetsClient.Client)\n\tif err != nil {\n\t\treturn subnet, fmt.Errorf(\"cannot get the subnet create or update future response: %v\", err)\n\t}\n\n\treturn future.Result(subnetsClient)\n}", "title": "" }, { "docid": "07264ee018b35435b35b9b1e208bf36e", "score": "0.54513156", "text": "func TestNewNodeIpamControllerWithCIDRMasks2(t *testing.T) {\n\temptyServiceCIDR := \"\"\n\tfor _, tc := range []struct {\n\t\tdesc string\n\t\tclusterCIDR string\n\t\tserviceCIDR string\n\t\tsecondaryServiceCIDR string\n\t\tmaskSize []int\n\t\tallocatorType ipam.CIDRAllocatorType\n\t}{\n\t\t{\"valid_multi_cidr_range_allocator\", \"10.0.0.0/21\", \"10.1.0.0/21\", emptyServiceCIDR, []int{24}, ipam.MultiCIDRRangeAllocatorType},\n\t\t{\"valid_multi_cidr_range_allocator_dualstack\", \"10.0.0.0/21,2000::/48\", \"10.1.0.0/21\", emptyServiceCIDR, []int{24, 64}, ipam.MultiCIDRRangeAllocatorType},\n\t} {\n\t\ttest := tc\n\t\t_, ctx := ktesting.NewTestContext(t)\n\t\tt.Run(test.desc, func(t *testing.T) {\n\t\t\tdefer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.MultiCIDRRangeAllocator, true)()\n\n\t\t\tclusterCidrs, err := netutils.ParseCIDRs(strings.Split(test.clusterCIDR, \",\"))\n\t\t\tif err != nil {\n\t\t\t\tclusterCidrs = nil\n\t\t\t}\n\t\t\t_, serviceCIDRIpNet, err := netutils.ParseCIDRSloppy(test.serviceCIDR)\n\t\t\tif err != nil {\n\t\t\t\tserviceCIDRIpNet = nil\n\t\t\t}\n\t\t\t_, secondaryServiceCIDRIpNet, err := netutils.ParseCIDRSloppy(test.secondaryServiceCIDR)\n\t\t\tif err != nil {\n\t\t\t\tsecondaryServiceCIDRIpNet = nil\n\t\t\t}\n\t\t\t_, err = newTestNodeIpamController(ctx, clusterCidrs, serviceCIDRIpNet, secondaryServiceCIDRIpNet, test.maskSize, test.allocatorType)\n\t\t\tif err != nil {\n\t\t\t\tt.Errorf(\"Test %s, got error %v\", test.desc, err)\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "cc8c599dcb9118407b51d15456ab3c27", "score": "0.5441691", "text": "func testDescribeSubnets(input *ec2.DescribeSubnetsInput) (*ec2.DescribeSubnetsOutput, error) {\n\tif *input.SubnetIds[0] == \"bad\" {\n\t\treturn nil, fmt.Errorf(\"error\")\n\t}\n\treturn testDescribeSubnetsOutput(), nil\n}", "title": "" }, { "docid": "73ab782bfebdae26dafd7f5616f43c34", "score": "0.5441325", "text": "func TestNewNodeIpamControllerWithCIDRMasks(t *testing.T) {\n\temptyServiceCIDR := \"\"\n\tfor _, tc := range []struct {\n\t\tdesc string\n\t\tclusterCIDR string\n\t\tserviceCIDR string\n\t\tsecondaryServiceCIDR string\n\t\tmaskSize []int\n\t\tallocatorType ipam.CIDRAllocatorType\n\t\texpectedError error\n\t}{\n\t\t{\"valid_range_allocator\", \"10.0.0.0/21\", \"10.1.0.0/21\", emptyServiceCIDR, []int{24}, ipam.RangeAllocatorType, nil},\n\t\t{\"valid_range_allocator_dualstack\", \"10.0.0.0/21,2000::/48\", \"10.1.0.0/21\", emptyServiceCIDR, []int{24, 64}, ipam.RangeAllocatorType, nil},\n\t\t{\"valid_range_allocator_dualstack_dualstackservice\", \"10.0.0.0/21,2000::/48\", \"10.1.0.0/21\", \"3000::/112\", []int{24, 64}, ipam.RangeAllocatorType, nil},\n\t\t{\"valid_cloud_allocator\", \"10.0.0.0/21\", \"10.1.0.0/21\", emptyServiceCIDR, []int{24}, ipam.CloudAllocatorType, nil},\n\t\t{\"valid_ipam_from_cluster\", \"10.0.0.0/21\", \"10.1.0.0/21\", emptyServiceCIDR, []int{24}, ipam.IPAMFromClusterAllocatorType, nil},\n\t\t{\"valid_ipam_from_cloud\", \"10.0.0.0/21\", \"10.1.0.0/21\", emptyServiceCIDR, []int{24}, ipam.IPAMFromCloudAllocatorType, nil},\n\t\t{\"valid_skip_cluster_CIDR_validation_for_cloud_allocator\", \"invalid\", \"10.1.0.0/21\", emptyServiceCIDR, []int{24}, ipam.CloudAllocatorType, nil},\n\t\t{\"valid_CIDR_larger_than_mask_cloud_allocator\", \"10.0.0.0/16\", \"10.1.0.0/21\", emptyServiceCIDR, []int{24}, ipam.CloudAllocatorType, nil},\n\t\t{\"invalid_cluster_CIDR\", \"\", \"10.1.0.0/21\", emptyServiceCIDR, []int{24}, ipam.IPAMFromClusterAllocatorType, errors.New(\"Controller: Must specify --cluster-cidr if --allocate-node-cidrs is set\")},\n\t\t{\"invalid_CIDR_smaller_than_mask_other_allocators\", \"10.0.0.0/26\", \"10.1.0.0/21\", emptyServiceCIDR, []int{24}, ipam.IPAMFromCloudAllocatorType, errors.New(\"Controller: Invalid --cluster-cidr, mask size of cluster CIDR must be less than or equal to --node-cidr-mask-size configured for CIDR family\")},\n\t\t{\"invalid_serviceCIDR_contains_clusterCIDR\", \"10.0.0.0/16\", \"10.0.0.0/8\", emptyServiceCIDR, []int{24}, ipam.IPAMFromClusterAllocatorType, errors.New(\"error creating ipam controller: failed after occupy serviceCIDR: CIDR allocation failed; there are no remaining CIDRs left to allocate in the accepted range\")},\n\t\t{\"invalid_CIDR_mask_size\", \"10.0.0.0/24,2000::/64\", \"10.1.0.0/21\", emptyServiceCIDR, []int{24, 48}, ipam.IPAMFromClusterAllocatorType, errors.New(\"Controller: Invalid --cluster-cidr, mask size of cluster CIDR must be less than or equal to --node-cidr-mask-size configured for CIDR family\")},\n\t} {\n\t\ttest := tc\n\t\t_, ctx := ktesting.NewTestContext(t)\n\t\tt.Run(test.desc, func(t *testing.T) {\n\t\t\tt.Parallel()\n\t\t\tclusterCidrs, err := netutils.ParseCIDRs(strings.Split(test.clusterCIDR, \",\"))\n\t\t\tif err != nil {\n\t\t\t\tclusterCidrs = nil\n\t\t\t}\n\t\t\t_, serviceCIDRIpNet, err := netutils.ParseCIDRSloppy(test.serviceCIDR)\n\t\t\tif err != nil {\n\t\t\t\tserviceCIDRIpNet = nil\n\t\t\t}\n\t\t\t_, secondaryServiceCIDRIpNet, err := netutils.ParseCIDRSloppy(test.secondaryServiceCIDR)\n\t\t\tif err != nil {\n\t\t\t\tsecondaryServiceCIDRIpNet = nil\n\t\t\t}\n\t\t\t_, err = newTestNodeIpamController(ctx, clusterCidrs, serviceCIDRIpNet, secondaryServiceCIDRIpNet, test.maskSize, test.allocatorType)\n\t\t\tif test.expectedError == nil {\n\t\t\t\tif err != nil {\n\t\t\t\t\tt.Errorf(\"Test %s, unexpected error: %v\", test.desc, err)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif err.Error() != test.expectedError.Error() {\n\t\t\t\t\tt.Errorf(\"Test %s, got error: %v, expected error: %v\", test.desc, err, test.expectedError)\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "6c5c0bf5c77ec5f78d58df7cfe002f7b", "score": "0.5440485", "text": "func (m *MockNetworking) UpdateSubnet(arg0 string, arg1 subnets.UpdateOpts) (*subnets.Subnet, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"UpdateSubnet\", arg0, arg1)\n\tret0, _ := ret[0].(*subnets.Subnet)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "ece065eab54f26b6a1a89ae90503f61a", "score": "0.5434779", "text": "func ensureOpenStackSubnet(client *gophercloud.ServiceClient, name, tag, netId, cidr string, gatewayIp *string) (string, error) {\n\tdhcp := false\n\tpage, err := subnets.List(client, subnets.ListOpts{\n\t\tName: name,\n\t\tTags: tag,\n\t\tNetworkID: netId,\n\t\tCIDR: cidr,\n\t\tGatewayIP: *gatewayIp,\n\t\tIPVersion: 4,\n\t\tEnableDHCP: &dhcp,\n\t}).AllPages()\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"failed to get subnet list\")\n\t}\n\tsubnetList, err := subnets.ExtractSubnets(page)\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"failed to extract subnets list\")\n\t}\n\tif len(subnetList) > 1 {\n\t\treturn \"\", errors.Errorf(\"found multiple subnets matching name %s and tag %s, cannot proceed\", name, tag)\n\t} else if len(subnetList) == 1 {\n\t\treturn subnetList[0].ID, nil\n\t} else {\n\t\topts := subnets.CreateOpts{\n\t\t\tName: name,\n\t\t\tNetworkID: netId,\n\t\t\tCIDR: cidr,\n\t\t\tGatewayIP: gatewayIp,\n\t\t\tIPVersion: gophercloud.IPv4,\n\t\t\tEnableDHCP: &dhcp,\n\t\t}\n\t\tsubnetObj, err := subnets.Create(client, opts).Extract()\n\t\tif err != nil {\n\t\t\treturn \"\", errors.Wrap(err, \"failed to create subnet\")\n\t\t}\n\n\t\t_, err = tagResource(client, \"subnets\", subnetObj.ID, tag)\n\t\tif err != nil {\n\t\t\treturn \"\", errors.Wrap(err, \"failed to tag created subnet\")\n\t\t}\n\n\t\treturn subnetObj.ID, nil\n\t}\n}", "title": "" }, { "docid": "7327e059f2615d7908778d26453180af", "score": "0.5427937", "text": "func createNewTestAllocation(t *testing.T, ssc *StorageSmartContract,\n\ttxHash, clientID, pubKey string, balances chainState.StateContextI) {\n\n\tvar (\n\t\ttx transaction.Transaction\n\t\tnar newAllocationRequest\n\t\tallBlobbers *StorageNodes\n\t\tconf scConfig\n\t\terr error\n\t)\n\n\ttx.Hash = txHash\n\ttx.Value = 400\n\ttx.ClientID = clientID\n\ttx.CreationDate = toSeconds(2 * time.Hour)\n\n\tbalances.(*testBalances).setTransaction(t, &tx)\n\n\tconf.MaxChallengeCompletionTime = 20 * time.Second\n\tconf.MinAllocDuration = 20 * time.Second\n\tconf.MinAllocSize = 20 * GB\n\n\t_, err = balances.InsertTrieNode(scConfigKey(ssc.ID), &conf)\n\trequire.NoError(t, err)\n\n\tallBlobbers = newTestAllBlobbers()\n\tallBlobbers.Nodes[0].LastHealthCheck = tx.CreationDate\n\tallBlobbers.Nodes[1].LastHealthCheck = tx.CreationDate\n\t_, err = balances.InsertTrieNode(ALL_BLOBBERS_KEY, allBlobbers)\n\trequire.NoError(t, err)\n\n\tnar.ReadPriceRange = PriceRange{Min: 10, Max: 40}\n\tnar.WritePriceRange = PriceRange{Min: 100, Max: 400}\n\tnar.Size = 20 * GB\n\tnar.DataShards = 1\n\tnar.ParityShards = 1\n\tnar.Expiration = tx.CreationDate + toSeconds(48*time.Hour)\n\tnar.Owner = clientID\n\tnar.OwnerPublicKey = pubKey\n\tnar.PreferredBlobbers = nil // not set\n\tnar.MaxChallengeCompletionTime = 200 * time.Hour //\n\n\tnar.Expiration = tx.CreationDate + toSeconds(100*time.Second)\n\n\tvar (\n\t\tsp1, sp2 = newStakePool(), newStakePool()\n\t\tdp1, dp2 = new(delegatePool), new(delegatePool)\n\t)\n\tdp1.Balance, dp2.Balance = 20e10, 20e10\n\tsp1.Pools[\"hash1\"], sp2.Pools[\"hash2\"] = dp1, dp2\n\trequire.NoError(t, sp1.save(ssc.ID, \"b1\", balances))\n\trequire.NoError(t, sp2.save(ssc.ID, \"b2\", balances))\n\n\ttx.Value = 400\n\n\tallBlobbers.Nodes[0].Used = 5 * GB\n\tallBlobbers.Nodes[1].Used = 10 * GB\n\t_, err = balances.InsertTrieNode(ALL_BLOBBERS_KEY, allBlobbers)\n\trequire.NoError(t, err)\n\n\tbalances.(*testBalances).balances[clientID] = 1100\n\n\ttx.Value = 400\n\t_, err = ssc.newAllocationRequest(&tx, mustEncode(t, &nar), balances)\n\trequire.NoError(t, err)\n\treturn\n}", "title": "" }, { "docid": "ec013be4773ffb382ee447000590e4ff", "score": "0.5416733", "text": "func (rm *resourceManager) sdkCreate(\n\tctx context.Context,\n\tr *resource,\n) (*resource, error) {\n\tinput, err := rm.newCreateRequestPayload(ctx, r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp, respErr := rm.sdkapi.CreateSubnetWithContext(ctx, input)\n\trm.metrics.RecordAPICall(\"CREATE\", \"CreateSubnet\", respErr)\n\tif respErr != nil {\n\t\treturn nil, respErr\n\t}\n\t// Merge in the information we read from the API call above to the copy of\n\t// the original Kubernetes object we passed to the function\n\tko := r.ko.DeepCopy()\n\n\tif resp.Subnet.AssignIpv6AddressOnCreation != nil {\n\t\tko.Status.AssignIPv6AddressOnCreation = resp.Subnet.AssignIpv6AddressOnCreation\n\t}\n\tif resp.Subnet.AvailableIpAddressCount != nil {\n\t\tko.Status.AvailableIPAddressCount = resp.Subnet.AvailableIpAddressCount\n\t}\n\tif resp.Subnet.CustomerOwnedIpv4Pool != nil {\n\t\tko.Status.CustomerOwnedIPv4Pool = resp.Subnet.CustomerOwnedIpv4Pool\n\t}\n\tif resp.Subnet.DefaultForAz != nil {\n\t\tko.Status.DefaultForAZ = resp.Subnet.DefaultForAz\n\t}\n\tif resp.Subnet.Ipv6CidrBlockAssociationSet != nil {\n\t\tf7 := []*svcapitypes.SubnetIPv6CIDRBlockAssociation{}\n\t\tfor _, f7iter := range resp.Subnet.Ipv6CidrBlockAssociationSet {\n\t\t\tf7elem := &svcapitypes.SubnetIPv6CIDRBlockAssociation{}\n\t\t\tif f7iter.AssociationId != nil {\n\t\t\t\tf7elem.AssociationID = f7iter.AssociationId\n\t\t\t}\n\t\t\tif f7iter.Ipv6CidrBlock != nil {\n\t\t\t\tf7elem.IPv6CIDRBlock = f7iter.Ipv6CidrBlock\n\t\t\t}\n\t\t\tif f7iter.Ipv6CidrBlockState != nil {\n\t\t\t\tf7elemf2 := &svcapitypes.SubnetCIDRBlockState{}\n\t\t\t\tif f7iter.Ipv6CidrBlockState.State != nil {\n\t\t\t\t\tf7elemf2.State = f7iter.Ipv6CidrBlockState.State\n\t\t\t\t}\n\t\t\t\tif f7iter.Ipv6CidrBlockState.StatusMessage != nil {\n\t\t\t\t\tf7elemf2.StatusMessage = f7iter.Ipv6CidrBlockState.StatusMessage\n\t\t\t\t}\n\t\t\t\tf7elem.IPv6CIDRBlockState = f7elemf2\n\t\t\t}\n\t\t\tf7 = append(f7, f7elem)\n\t\t}\n\t\tko.Status.IPv6CIDRBlockAssociationSet = f7\n\t}\n\tif resp.Subnet.MapCustomerOwnedIpOnLaunch != nil {\n\t\tko.Status.MapCustomerOwnedIPOnLaunch = resp.Subnet.MapCustomerOwnedIpOnLaunch\n\t}\n\tif resp.Subnet.MapPublicIpOnLaunch != nil {\n\t\tko.Status.MapPublicIPOnLaunch = resp.Subnet.MapPublicIpOnLaunch\n\t}\n\tif resp.Subnet.OwnerId != nil {\n\t\tko.Status.OwnerID = resp.Subnet.OwnerId\n\t}\n\tif resp.Subnet.State != nil {\n\t\tko.Status.State = resp.Subnet.State\n\t}\n\tif ko.Status.ACKResourceMetadata == nil {\n\t\tko.Status.ACKResourceMetadata = &ackv1alpha1.ResourceMetadata{}\n\t}\n\tif resp.Subnet.SubnetArn != nil {\n\t\tarn := ackv1alpha1.AWSResourceName(*resp.Subnet.SubnetArn)\n\t\tko.Status.ACKResourceMetadata.ARN = &arn\n\t}\n\tif resp.Subnet.SubnetId != nil {\n\t\tko.Status.SubnetID = resp.Subnet.SubnetId\n\t}\n\tif resp.Subnet.Tags != nil {\n\t\tf15 := []*svcapitypes.Tag{}\n\t\tfor _, f15iter := range resp.Subnet.Tags {\n\t\t\tf15elem := &svcapitypes.Tag{}\n\t\t\tif f15iter.Key != nil {\n\t\t\t\tf15elem.Key = f15iter.Key\n\t\t\t}\n\t\t\tif f15iter.Value != nil {\n\t\t\t\tf15elem.Value = f15iter.Value\n\t\t\t}\n\t\t\tf15 = append(f15, f15elem)\n\t\t}\n\t\tko.Status.Tags = f15\n\t}\n\n\trm.setStatusDefaults(ko)\n\n\treturn &resource{ko}, nil\n}", "title": "" }, { "docid": "5fe34b94a4910c1f47387011d61a5c82", "score": "0.5414147", "text": "func (m *MockNatGatewayScope) Subnet(arg0 string) v1beta1.SubnetSpec {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Subnet\", arg0)\n\tret0, _ := ret[0].(v1beta1.SubnetSpec)\n\treturn ret0\n}", "title": "" }, { "docid": "c302fe57d52ffaf4e6354a4b3bb12b98", "score": "0.54088396", "text": "func test2_IPNet(T *testing.T) bool {\n\tT.Log(\"--- IPNet Test ---\")\n\n\ttestcases := []uint{16, 4}\n\n\tfor _, addrSize := range testcases {\n\t\tip := net.IP(genRandomBytes(addrSize))\n\t\tprefixLen := uint(rand.Int31n(int32(addrSize) * 8))\n\t\tcidr := fmt.Sprintf(\"%s/%d\", ip.String(), prefixLen)\n\t\tnetmask := genNetmask(addrSize, prefixLen)\n\t\tT.Logf(\"Detect(\\\"%s\\\")\\n\", cidr)\n\t\tt, o, err := Detect(cidr)\n\t\tif !(assertTrue(T, t == IPNet, \"type!=IPNet\") &&\n\t\t\tassertTrue(T, err == nil, \"err!=nil\") &&\n\t\t\tassertTrue(T, byteArrayEqual(o.(*net.IPNet).Mask, netmask), \"Incorrect netmask\")) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "c16ca9700493372f2432aeb2c8862cf9", "score": "0.5393678", "text": "func (m *MockNsxNetworkProvisioner) CheckIPBlockSubnetPrefix(arg0 string, arg1 int) error {\n\tret := m.ctrl.Call(m, \"CheckIPBlockSubnetPrefix\", arg0, arg1)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "54aed18925606a9fe5ed538eaf45d459", "score": "0.5384589", "text": "func (s *Service) findSubnet(scope *scope.MachineScope) (string, error) {\n\t// Check Machine.Spec.FailureDomain first as it's used by KubeadmControlPlane to spread machines across failure domains.\n\tfailureDomain := scope.Machine.Spec.FailureDomain\n\n\t// We basically have 2 sources for subnets:\n\t// 1. If subnet.id or subnet.filters are specified, we directly query AWS\n\t// 2. All other cases use the subnets provided in the cluster network spec without ever calling AWS\n\n\tswitch {\n\tcase scope.AWSMachine.Spec.Subnet != nil && (scope.AWSMachine.Spec.Subnet.ID != nil || scope.AWSMachine.Spec.Subnet.Filters != nil):\n\t\tcriteria := []*ec2.Filter{\n\t\t\tfilter.EC2.SubnetStates(ec2.SubnetStatePending, ec2.SubnetStateAvailable),\n\t\t}\n\t\tif !scope.IsExternallyManaged() {\n\t\t\tcriteria = append(criteria, filter.EC2.VPC(s.scope.VPC().ID))\n\t\t}\n\t\tif scope.AWSMachine.Spec.Subnet.ID != nil {\n\t\t\tcriteria = append(criteria, &ec2.Filter{Name: aws.String(\"subnet-id\"), Values: aws.StringSlice([]string{*scope.AWSMachine.Spec.Subnet.ID})})\n\t\t}\n\t\tfor _, f := range scope.AWSMachine.Spec.Subnet.Filters {\n\t\t\tcriteria = append(criteria, &ec2.Filter{Name: aws.String(f.Name), Values: aws.StringSlice(f.Values)})\n\t\t}\n\n\t\tsubnets, err := s.getFilteredSubnets(criteria...)\n\t\tif err != nil {\n\t\t\treturn \"\", errors.Wrapf(err, \"failed to filter subnets for criteria %q\", criteria)\n\t\t}\n\t\tif len(subnets) == 0 {\n\t\t\terrMessage := fmt.Sprintf(\"failed to run machine %q, no subnets available matching criteria %q\",\n\t\t\t\tscope.Name(), criteria)\n\t\t\trecord.Warnf(scope.AWSMachine, \"FailedCreate\", errMessage)\n\t\t\treturn \"\", awserrors.NewFailedDependency(errMessage)\n\t\t}\n\n\t\tvar filtered []*ec2.Subnet\n\t\tvar errMessage string\n\t\tfor _, subnet := range subnets {\n\t\t\tif failureDomain != nil && *subnet.AvailabilityZone != *failureDomain {\n\t\t\t\t// we could have included the failure domain in the query criteria, but then we end up with EC2 error\n\t\t\t\t// messages that don't give a good hint about what is really wrong\n\t\t\t\terrMessage += fmt.Sprintf(\" subnet %q availability zone %q does not match failure domain %q.\",\n\t\t\t\t\t*subnet.SubnetId, *subnet.AvailabilityZone, *failureDomain)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif scope.AWSMachine.Spec.PublicIP != nil && *scope.AWSMachine.Spec.PublicIP && !*subnet.MapPublicIpOnLaunch {\n\t\t\t\terrMessage += fmt.Sprintf(\" subnet %q is a private subnet.\", *subnet.SubnetId)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfiltered = append(filtered, subnet)\n\t\t}\n\t\tif len(filtered) == 0 {\n\t\t\terrMessage = fmt.Sprintf(\"failed to run machine %q, found %d subnets matching criteria but post-filtering failed.\",\n\t\t\t\tscope.Name(), len(subnets)) + errMessage\n\t\t\trecord.Warnf(scope.AWSMachine, \"FailedCreate\", errMessage)\n\t\t\treturn \"\", awserrors.NewFailedDependency(errMessage)\n\t\t}\n\t\treturn *filtered[0].SubnetId, nil\n\tcase failureDomain != nil:\n\t\tif scope.AWSMachine.Spec.PublicIP != nil && *scope.AWSMachine.Spec.PublicIP {\n\t\t\tsubnets := s.scope.Subnets().FilterPublic().FilterByZone(*failureDomain)\n\t\t\tif len(subnets) == 0 {\n\t\t\t\terrMessage := fmt.Sprintf(\"failed to run machine %q with public IP, no public subnets available in availability zone %q\",\n\t\t\t\t\tscope.Name(), *failureDomain)\n\t\t\t\trecord.Warnf(scope.AWSMachine, \"FailedCreate\", errMessage)\n\t\t\t\treturn \"\", awserrors.NewFailedDependency(errMessage)\n\t\t\t}\n\t\t\treturn subnets[0].ID, nil\n\t\t}\n\n\t\tsubnets := s.scope.Subnets().FilterPrivate().FilterByZone(*failureDomain)\n\t\tif len(subnets) == 0 {\n\t\t\terrMessage := fmt.Sprintf(\"failed to run machine %q, no subnets available in availability zone %q\",\n\t\t\t\tscope.Name(), *failureDomain)\n\t\t\trecord.Warnf(scope.AWSMachine, \"FailedCreate\", errMessage)\n\t\t\treturn \"\", awserrors.NewFailedDependency(errMessage)\n\t\t}\n\t\treturn subnets[0].ID, nil\n\tcase scope.AWSMachine.Spec.PublicIP != nil && *scope.AWSMachine.Spec.PublicIP:\n\t\tsubnets := s.scope.Subnets().FilterPublic()\n\t\tif len(subnets) == 0 {\n\t\t\terrMessage := fmt.Sprintf(\"failed to run machine %q with public IP, no public subnets available\", scope.Name())\n\t\t\trecord.Eventf(scope.AWSMachine, \"FailedCreate\", errMessage)\n\t\t\treturn \"\", awserrors.NewFailedDependency(errMessage)\n\t\t}\n\t\treturn subnets[0].ID, nil\n\n\t\t// TODO(vincepri): Define a tag that would allow to pick a preferred subnet in an AZ when working\n\t\t// with control plane machines.\n\n\tdefault:\n\t\tsns := s.scope.Subnets().FilterPrivate()\n\t\tif len(sns) == 0 {\n\t\t\terrMessage := fmt.Sprintf(\"failed to run machine %q, no subnets available\", scope.Name())\n\t\t\trecord.Eventf(s.scope.InfraCluster(), \"FailedCreateInstance\", errMessage)\n\t\t\treturn \"\", awserrors.NewFailedDependency(errMessage)\n\t\t}\n\t\treturn sns[0].ID, nil\n\t}\n}", "title": "" }, { "docid": "1589872dbf807ff46601eb714dcdf540", "score": "0.53817874", "text": "func (sv *ContrailTypeLogicService) allocateVnSubnetsInAddrMgmt(\n\tctx context.Context, ipamRef *models.VirtualNetworkNetworkIpamRef,\n) error {\n\tif ipamRef.GetAttr() != nil {\n\t\tif len(ipamRef.GetAttr().GetIpamSubnets()) > 0 {\n\t\t\tlinkedIpamSubnets := ipamRef.GetAttr().GetIpamSubnets()\n\t\t\tfor _, vnSubnet := range linkedIpamSubnets {\n\t\t\t\tsubnetUUID, err := sv.allocateVnSubnet(ctx, vnSubnet)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tvnSubnet.SubnetUUID = subnetUUID\n\t\t\t}\n\t\t} else {\n\t\t\tipamResponse, err := sv.ReadService.GetNetworkIpam(ctx, &services.GetNetworkIpamRequest{\n\t\t\t\tID: ipamRef.GetUUID(),\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\treturn errutil.ErrorBadRequestf(\"getting referenced network IPAM with UUID %s failed: %v\",\n\t\t\t\t\tipamRef.GetUUID(), err)\n\t\t\t}\n\n\t\t\tlinkedIpamSubnets := ipamResponse.GetNetworkIpam().GetIpamSubnets().GetSubnets()\n\t\t\tfor _, vnSubnet := range linkedIpamSubnets {\n\t\t\t\tsubnetUUID, err := sv.allocateVnSubnet(ctx, vnSubnet)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tipamRef.Attr.IpamSubnets = append(ipamRef.Attr.IpamSubnets, &models.IpamSubnetType{\n\t\t\t\t\tSubnetUUID: subnetUUID})\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b0c0a5fb80c2ebce343324530056e805", "score": "0.5333946", "text": "func TestSpace(t *testing.T) {\n\ttests := []struct {\n\t\tfreeIPRanges []ipRange\n\t\tmask int\n\t\texpectedIP net.IP\n\t\texpectedErrorHandler func(error) bool\n\t}{\n\t\t// Test a case of fitting a network into an unused network.\n\t\t{\n\t\t\tfreeIPRanges: []ipRange{\n\t\t\t\t{\n\t\t\t\t\tstart: net.ParseIP(\"10.4.0.0\"),\n\t\t\t\t\tend: net.ParseIP(\"10.4.255.255\"),\n\t\t\t\t},\n\t\t\t},\n\t\t\tmask: 24,\n\t\t\texpectedIP: net.ParseIP(\"10.4.0.0\"),\n\t\t},\n\n\t\t// Test fitting a network into a network, with one subnet,\n\t\t// at the start of the range.\n\t\t{\n\t\t\tfreeIPRanges: []ipRange{\n\t\t\t\t{\n\t\t\t\t\tstart: net.ParseIP(\"10.4.1.0\"),\n\t\t\t\t\tend: net.ParseIP(\"10.4.255.255\"),\n\t\t\t\t},\n\t\t\t},\n\t\t\tmask: 24,\n\t\t\texpectedIP: net.ParseIP(\"10.4.1.0\"),\n\t\t},\n\n\t\t// Test adding a network that fills the range\n\t\t{\n\t\t\tfreeIPRanges: []ipRange{\n\t\t\t\t{\n\t\t\t\t\tstart: net.ParseIP(\"10.4.0.0\"),\n\t\t\t\t\tend: net.ParseIP(\"10.4.255.255\"),\n\t\t\t\t},\n\t\t\t},\n\t\t\tmask: 16,\n\t\t\texpectedIP: net.ParseIP(\"10.4.0.0\"),\n\t\t},\n\n\t\t// Test adding a network that is too large.\n\t\t{\n\t\t\tfreeIPRanges: []ipRange{\n\t\t\t\t{\n\t\t\t\t\tstart: net.ParseIP(\"10.4.0.0\"),\n\t\t\t\t\tend: net.ParseIP(\"10.4.255.255\"),\n\t\t\t\t},\n\t\t\t},\n\t\t\tmask: 15,\n\t\t\texpectedErrorHandler: IsSpaceExhausted,\n\t\t},\n\n\t\t// Test adding a slightly larger network,\n\t\t// given a smaller, non-contiguous subnet.\n\t\t{\n\t\t\tfreeIPRanges: []ipRange{\n\t\t\t\t{\n\t\t\t\t\tstart: net.ParseIP(\"10.4.0.0\"),\n\t\t\t\t\tend: net.ParseIP(\"10.4.0.255\"),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tstart: net.ParseIP(\"10.4.2.0\"),\n\t\t\t\t\tend: net.ParseIP(\"10.4.255.255\"),\n\t\t\t\t},\n\t\t\t},\n\t\t\tmask: 23,\n\t\t\texpectedIP: net.ParseIP(\"10.4.2.0\"),\n\t\t},\n\n\t\t// Test allocating /24 network when the first free range starts from /26.\n\t\t{\n\t\t\tfreeIPRanges: []ipRange{\n\t\t\t\t{\n\t\t\t\t\tstart: net.ParseIP(\"10.1.2.192\"),\n\t\t\t\t\tend: net.ParseIP(\"10.1.255.255\"),\n\t\t\t\t},\n\t\t\t},\n\t\t\tmask: 24,\n\t\t\texpectedIP: net.ParseIP(\"10.1.3.0\"),\n\t\t},\n\t}\n\n\tfor index, test := range tests {\n\t\tmask := net.CIDRMask(test.mask, 32)\n\n\t\tip, err := space(test.freeIPRanges, mask)\n\n\t\tif err != nil {\n\t\t\tif test.expectedErrorHandler == nil {\n\t\t\t\tt.Fatalf(\"%v: unexpected error returned.\\nreturned: %v\", index, err)\n\t\t\t}\n\t\t\tif !test.expectedErrorHandler(err) {\n\t\t\t\tt.Fatalf(\"%v: incorrect error returned.\\nreturned: %v\", index, err)\n\t\t\t}\n\t\t} else {\n\t\t\tif test.expectedErrorHandler != nil {\n\t\t\t\tt.Fatalf(\"%v: expected error not returned.\", index)\n\t\t\t}\n\n\t\t\tif !ip.Equal(test.expectedIP) {\n\t\t\t\tt.Fatalf(\n\t\t\t\t\t\"%v: unexpected ip returned. \\nexpected: %v\\nreturned: %v\",\n\t\t\t\t\tindex,\n\t\t\t\t\ttest.expectedIP,\n\t\t\t\t\tip,\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "67dd85056d866e2d33938c7a96c2badf", "score": "0.5329264", "text": "func (m *MockBastionScope) ControlPlaneSubnet() v1beta1.SubnetSpec {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ControlPlaneSubnet\")\n\tret0, _ := ret[0].(v1beta1.SubnetSpec)\n\treturn ret0\n}", "title": "" }, { "docid": "f99872ffbb5b2678e72fd01e75c03362", "score": "0.532204", "text": "func (m *MockNsxNetworkProvisioner) BuildIPAddress(arg0, arg1 string) string {\n\tret := m.ctrl.Call(m, \"BuildIPAddress\", arg0, arg1)\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}", "title": "" }, { "docid": "5243be306e0c00ee90149b2736b451ba", "score": "0.53218216", "text": "func testSubnetsArePublic(t *testing.T, terraformOptions *terraform.Options) {\n\n\tawsRegion := terraformOptions.Vars[\"aws_region\"].(string)\n\tvpcID := terraform.Output(t, terraformOptions, \"vpc_id\")\n\tvpcSubnets := aws.GetSubnetsForVpc(t, vpcID, awsRegion)\n\n\tvar subnetList []string\n\tfor _, subnet := range vpcSubnets {\n\t\tsubnetList = append(subnetList, subnet.Id)\n\t}\n\n\tcfg, _ := external.LoadDefaultAWSConfig()\n\tcfg.Region = awsRegion\n\tclient := ec2.New(cfg)\n\n\tsubnetParams := &ec2.DescribeSubnetsInput{\n\t\tFilters: []ec2.Filter{\n\t\t\t{\n\t\t\t\tName: aws2.String(\"subnet-id\"),\n\t\t\t\tValues: subnetList,\n\t\t\t},\n\t\t},\n\t}\n\n\tsubnetReq := client.DescribeSubnetsRequest(subnetParams)\n\n\tsubnetResp, _ := subnetReq.Send()\n\n\tfor _, subnet := range subnetResp.Subnets {\n\t\tassert.True(t, *subnet.MapPublicIpOnLaunch)\n\t}\n\n}", "title": "" }, { "docid": "5c53fd9d0c6984e2567b8a4292790c41", "score": "0.53128314", "text": "func (m *MockBastionScope) Subnets() v1beta1.Subnets {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Subnets\")\n\tret0, _ := ret[0].(v1beta1.Subnets)\n\treturn ret0\n}", "title": "" }, { "docid": "5bfb0f80a412df699b01bb7de918647b", "score": "0.5310121", "text": "func CreateSubnet(class, name, vpcSearch, ip, az string, dryRun bool) error {\n\n\t// --dry-run flag\n\tif dryRun {\n\t\tterminal.Information(\"--dry-run flag is set, not making any actual changes!\")\n\t}\n\n\t// Class Config\n\tcfg, err := config.LoadSubnetClass(class)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tterminal.Information(\"Found Subnet Class Configuration for [\" + class + \"]!\")\n\n\t// Verify the VPC input\n\tvpcs, _ := GetVpcs(vpcSearch)\n\tvpcCount := len(*vpcs)\n\tif vpcCount == 0 {\n\t\treturn errors.New(\"No VPCs found for your search terms.\")\n\t}\n\tif vpcCount > 1 {\n\t\tvpcs.PrintTable()\n\t\treturn errors.New(\"Please limit your search to return only one VPC.\")\n\t}\n\tvpc := (*vpcs)[0]\n\tregion := vpc.Region\n\n\tterminal.Information(\"Found VPC [\" + vpc.VpcID + \"] named [\" + vpc.Name + \"] with a class of [\" + vpc.Class + \"] in [\" + region + \"]!\")\n\n\t// Verify the az input\n\tif az != \"\" {\n\t\tazs, errs := regions.GetAZs()\n\t\tif errs != nil {\n\t\t\treturn errors.New(\"Error Verifying Availability Zone input\")\n\t\t}\n\t\tif !azs.ValidAZ(az) {\n\t\t\treturn cli.NewExitError(\"Availability Zone [\"+az+\"] is Invalid!\", 1)\n\t\t}\n\t\tterminal.Information(\"Found Availability Zone [\" + az + \"]!\")\n\n\t\tazRegion := azs.GetRegion(az)\n\n\t\tif azRegion != vpc.Region {\n\t\t\treturn cli.NewExitError(\"Availability Zone [\"+az+\"] is not in the same region as the VPC [\"+vpc.Region+\"]!\", 1)\n\t\t}\n\t}\n\n\t// Create the Subnet\n\tsess := session.Must(session.NewSession(&aws.Config{Region: aws.String(vpc.Region)}))\n\tsvc := ec2.New(sess)\n\n\tparams := &ec2.CreateSubnetInput{\n\t\tCidrBlock: aws.String(ip + cfg.CIDR),\n\t\tVpcId: aws.String(vpc.VpcID),\n\t\tDryRun: aws.Bool(dryRun),\n\t}\n\n\tif az != \"\" {\n\t\tparams.SetAvailabilityZone(az)\n\t}\n\n\tcreateSubnetResp, err := svc.CreateSubnet(params)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsubnetId := *createSubnetResp.Subnet.SubnetId\n\tsubnetAz := *createSubnetResp.Subnet.AvailabilityZone\n\n\tterminal.Delta(\"Created Subnet [\" + subnetId + \"] named [\" + name + \"] in [\" + subnetAz + \"]!\")\n\n\tterminal.Notice(\"Waiting to tag Subnet...\")\n\n\terr = svc.WaitUntilSubnetAvailable(&ec2.DescribeSubnetsInput{\n\t\tSubnetIds: []*string{\n\t\t\taws.String(subnetId),\n\t\t},\n\t})\n\tif err != nil {\n\t\tif awsErr, ok := err.(awserr.Error); ok {\n\t\t\treturn errors.New(awsErr.Message())\n\t\t}\n\t}\n\n\tterminal.Delta(\"Adding Subnet Tags...\")\n\n\t// Add Tags\n\terr = SetEc2NameAndClassTags(createSubnetResp.Subnet.SubnetId, name, class, vpc.Region)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tnamePrefix := vpc.Name\n\tif namePrefix == \"\" {\n\t\tnamePrefix = vpc.VpcID\n\t}\n\n\tif cfg.CreateInternetGateway {\n\t\tterminal.Notice(\"Creating a new Internet Gateway...\")\n\n\t\t// Create a new Internet Gateway\n\t\tinternetGatewayId, err := CreateInternetGateway(namePrefix+\"-internet-gateway\", region, dryRun)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tterminal.Notice(\"Attaching Internet Gateway to VPC...\")\n\t\t// Attach the Internet Gateway to the VPC\n\t\terr = attachInternetGateway(vpc.VpcID, internetGatewayId, region, dryRun)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Add to main route table, if specified\n\t\tif cfg.AddInternetGatewayToMainRouteTable {\n\t\t\tterminal.Notice(\"Adding Internet Gateway to Main Route Table...\")\n\n\t\t\trouteTable, err := GetVpcMainRouteTable(vpc.VpcID, region)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\terr = createRoute(routeTable.RouteTableID, region, \"0.0.0.0/0\", internetGatewayId, \"\", dryRun)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\t// Create a new route table and add to that, if specified\n\t\tif cfg.AddInternetGatewayToNewRouteTable {\n\t\t\tterminal.Notice(\"Creating a new Route Table...\")\n\n\t\t\trouteTableId, err := createRouteTable(namePrefix+\"-\"+name+\"-route-table\", vpc.VpcID, region, dryRun)\n\n\t\t\tterminal.Notice(\"Associating Route Table to Subnet...\")\n\n\t\t\terr = associateRouteTable(routeTableId, subnetId, region, dryRun)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tterminal.Notice(\"Adding Internet Gateway to New Route Table...\")\n\n\t\t\terr = createRoute(routeTableId, region, \"0.0.0.0/0\", internetGatewayId, \"\", dryRun)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif cfg.CreateNatGateway {\n\n\t\tterminal.Notice(\"Creating a new NAT Gateway...\")\n\n\t\t// Create a new NAT Gateway\n\t\tnatGatewayId, err := CreateNatGateway(namePrefix+\"-nat-gateway\", \"\", subnetId, region, dryRun)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Add to main route table, if specified\n\t\tif cfg.AddNatGatewayToMainRouteTable {\n\t\t\tterminal.Notice(\"Adding NAT Gateway to Main Route Table...\")\n\n\t\t\trouteTable, err := GetVpcMainRouteTable(vpc.VpcID, region)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\terr = createRoute(routeTable.RouteTableID, region, \"0.0.0.0/0\", \"\", natGatewayId, dryRun)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\t// Create a new route table and add to that, if specified\n\t\tif cfg.AddNatGatewayToNewRouteTable {\n\t\t\tterminal.Notice(\"Creating a new Route Table...\")\n\n\t\t\trouteTableId, err := createRouteTable(namePrefix+\"-\"+name+\"-route-table\", vpc.VpcID, region, dryRun)\n\n\t\t\tterminal.Notice(\"Associating Route Table to Subnet...\")\n\n\t\t\terr = associateRouteTable(routeTableId, subnetId, region, dryRun)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tterminal.Notice(\"Adding NAT Gateway to New Route Table...\")\n\n\t\t\terr = createRoute(routeTableId, region, \"0.0.0.0/0\", \"\", natGatewayId, dryRun)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tterminal.Information(\"Done!\")\n\n\treturn nil\n}", "title": "" }, { "docid": "738f934c0e0f2e9537a57ebd7e9381bf", "score": "0.53011066", "text": "func (m *MockClient) ListIPBlockSubnets(arg0 string) (*models.IPBlockSubnetListResult, error) {\n\tret := m.ctrl.Call(m, \"ListIPBlockSubnets\", arg0)\n\tret0, _ := ret[0].(*models.IPBlockSubnetListResult)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "5ccf540aef7f830208173d0995b787e8", "score": "0.5296515", "text": "func TestAccGetAddressesInSubnet(t *testing.T) {\n\ttestacc.VetAccConditions(t)\n\n\tsess := session.NewSession()\n\tclient := NewController(sess)\n\n\texpected := testGetAddressesInSubnetExpected\n\tif os.Getenv(\"TESTACC_CUSTOM_NESTED\") != \"\" {\n\t\tfor n := range expected {\n\t\t\texpected[n].CustomFields = map[string]interface{}{\n\t\t\t\t\"CustomTestAddresses\": nil,\n\t\t\t\t\"CustomTestAddresses2\": nil,\n\t\t\t}\n\t\t}\n\t} else {\n\t\tlog.Println(\"Note: Not testing nested custom fields as TESTACC_CUSTOM_NESTED is not set\")\n\t}\n\tactual, err := client.GetAddressesInSubnet(3)\n\tif err != nil {\n\t\tt.Fatalf(\"Bad: %s\", err)\n\t}\n\n\tif !reflect.DeepEqual(expected, actual) {\n\t\tt.Fatalf(\"Expected %#v, got %#v\", expected, actual)\n\t}\n}", "title": "" }, { "docid": "6c5a6d457eb57e56d81ba936a63abf42", "score": "0.52959406", "text": "func (m *MockNatGatewayScope) NodeSubnets() []v1beta1.SubnetSpec {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"NodeSubnets\")\n\tret0, _ := ret[0].([]v1beta1.SubnetSpec)\n\treturn ret0\n}", "title": "" }, { "docid": "d3cbbf03ca639d9f732d1656dc981368", "score": "0.52836716", "text": "func testDescribeSubnetsOutput() *ec2.DescribeSubnetsOutput {\n\treturn &ec2.DescribeSubnetsOutput{\n\t\tSubnets: []*ec2.Subnet{\n\t\t\t&ec2.Subnet{\n\t\t\t\tAvailabilityZone: aws.String(\"us-west-2\"),\n\t\t\t\tAvailableIpAddressCount: aws.Int64(7),\n\t\t\t\tCidrBlock: aws.String(\"10.0.0.0/24\"),\n\t\t\t\tDefaultForAz: aws.Bool(true),\n\t\t\t\tMapPublicIpOnLaunch: aws.Bool(false),\n\t\t\t\tState: aws.String(\"available\"),\n\t\t\t\tSubnetId: aws.String(\"subnet-123456\"),\n\t\t\t\tVpcId: aws.String(\"vpc-123456\"),\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "7a4530108c91837953baa5404143fe9a", "score": "0.5279265", "text": "func (m *manager) CreateOrUpdate(ctx context.Context, subnetID string, subnet *network.Subnet) error {\n\tvnetID, subnetName, err := Split(subnetID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tr, err := azure.ParseResourceID(vnetID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfuture, err := m.subnets.CreateOrUpdate(ctx, r.ResourceGroup, r.ResourceName, subnetName, *subnet)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn future.WaitForCompletionRef(ctx, m.subnets.Client)\n}", "title": "" }, { "docid": "760d08ac4451428bcf31233317592311", "score": "0.5277574", "text": "func (mr *MockClientMockRecorder) AllocateSubnetFromIPBlock(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"AllocateSubnetFromIPBlock\", reflect.TypeOf((*MockClient)(nil).AllocateSubnetFromIPBlock), arg0)\n}", "title": "" }, { "docid": "c2fc567afa3b02b05a1288a838a985ed", "score": "0.5276625", "text": "func TestEnsureEIPWithSpecificIP(t *testing.T) {\n\tcloud, _, lbResp, err := beforeTestBlb()\n\tif err != nil {\n\t\tt.Errorf(\"beforeTestBlb err , %v\", err)\n\t}\n\tctx := context.Background()\n\t// cases is nil\n\n\t// clusterName nodes are not important\n\tsvc := buildService()\n\tsvc.Spec.LoadBalancerIP = \"test\"\n\n\tlb := &blb.LoadBalancer{\n\t\tBlbId: lbResp.LoadBalancerId,\n\t}\n\t_, err = cloud.ensureEIPWithSpecificIP(ctx, svc, lb)\n\tif err == nil {\n\t\tt.Errorf(\"ensureEIPWithSpecificIP err, should be an error\")\n\t}\n\t// right case1 blb already bound the eip\n\t// create eip bind blb\n\tsa := &ServiceAnnotation{\n\t\tElasticIPName: \"da\",\n\t\tElasticIPBillingMethod: \"\",\n\t\tElasticIPBandwidthInMbps: 100,\n\t\tElasticIPReservationLength: 100,\n\t}\n\targs, err := cloud.getEipArgsFromAnnotation(sa)\n\tif err != nil {\n\t\tt.Errorf(\"getEipArgsFromAnnotation err, err: %s\", err)\n\t}\n\tip1, err := cloud.createEIP(ctx, args)\n\tif err != nil {\n\t\tt.Errorf(\"createEIP err, err: %s\", err)\n\t}\n\tif len(ip1) == 0 {\n\t\tt.Errorf(\"createEIP err, ip is nil\")\n\t}\n\tsvc.Spec.LoadBalancerIP = ip1\n\tlb.PublicIp = ip1\n\t_, err = cloud.ensureEIPWithSpecificIP(ctx, svc, lb)\n\tif err != nil {\n\t\tt.Errorf(\"ensureEIPWithSpecificIP err, err: %s\", err)\n\t}\n\t// right case2 blb does not bind the eip\n\tcloud, _, lbResp, err = beforeTestBlb()\n\tif err != nil {\n\t\tt.Errorf(\"beforeTestBlb err , %v\", err)\n\t}\n\tlb = &blb.LoadBalancer{\n\t\tBlbId: lbResp.LoadBalancerId,\n\t}\n\teipArgs := &eip.CreateEIPArgs{\n\t\tName: \"test\",\n\t\tBandwidthInMbps: 100,\n\t\tBilling: &eip.Billing{\n\t\t\tPaymentTiming: \"\",\n\t\t\tBillingMethod: \"\",\n\t\t},\n\t}\n\tip2, err := cloud.clientSet.EIPClient.CreateEIP(ctx, eipArgs, nil)\n\tif err != nil {\n\t\tt.Errorf(\"CreateEIP err, err; %s\", err)\n\t}\n\tsvc.Spec.LoadBalancerIP = ip2\n\tlb.PublicIp = \"\"\n\t_, err = cloud.ensureEIPWithSpecificIP(ctx, svc, lb)\n\tif err != nil {\n\t\tt.Errorf(\"ensureEIPWithSpecificIP err, err: %s\", err)\n\t}\n\t// right case3 blb already bound eip what is not expected\n\tcloud, _, lbResp, err = beforeTestBlb()\n\tif err != nil {\n\t\tt.Errorf(\"beforeTestBlb err , %v\", err)\n\t}\n\tlb = &blb.LoadBalancer{\n\t\tBlbId: lbResp.LoadBalancerId,\n\t}\n\tsa = &ServiceAnnotation{\n\t\tElasticIPName: \"test1\",\n\t\tElasticIPBillingMethod: \"\",\n\t\tElasticIPBandwidthInMbps: 100,\n\t\tElasticIPReservationLength: 100,\n\t}\n\targs, err = cloud.getEipArgsFromAnnotation(sa)\n\tif err != nil {\n\t\tt.Errorf(\"getEipArgsFromAnnotation err, err: %s\", err)\n\t}\n\tip3, err := cloud.createEIP(ctx, args)\n\tif err != nil {\n\t\tt.Errorf(\"createEIP err, err: %s\", err)\n\t}\n\tif len(ip3) == 0 {\n\t\tt.Errorf(\"createEIP err, ip is nil\")\n\t}\n\teipArgs = &eip.CreateEIPArgs{\n\t\tName: \"test2\",\n\t\tBandwidthInMbps: 100,\n\t\tBilling: &eip.Billing{\n\t\t\tPaymentTiming: \"\",\n\t\t\tBillingMethod: \"\",\n\t\t},\n\t}\n\tip4, err := cloud.clientSet.EIPClient.CreateEIP(ctx, eipArgs, nil)\n\tif err != nil {\n\t\tt.Errorf(\"CreateEIP err, err; %s\", err)\n\t}\n\tsvc.Spec.LoadBalancerIP = ip4\n\tlb.PublicIp = ip3\n\t_, err = cloud.ensureEIPWithSpecificIP(ctx, svc, lb)\n\tif err != nil {\n\t\tt.Errorf(\"ensureEIPWithSpecificIP err, err: %s\", err)\n\t}\n}", "title": "" }, { "docid": "bc2aa909132226c95852ddc0f41028c5", "score": "0.5276102", "text": "func ipsubnetfindbysize(siteID string, blockID string, requestedIP string, prefixSize int, meta interface{}) ([]string, error) {\n\ts := meta.(*SOLIDserver)\n\n\t// Building parameters\n\tparameters := url.Values{}\n\tparameters.Add(\"site_id\", siteID)\n\tparameters.Add(\"prefix\", strconv.Itoa(prefixSize))\n\tparameters.Add(\"max_find\", \"4\")\n\n\t// Trying to create a block\n\tif len(blockID) == 0 {\n\t\tsubnetAddresses := []string{}\n\n\t\tif len(requestedIP) > 0 {\n\t\t\tsubnetAddresses = append(subnetAddresses, iptohexip(requestedIP))\n\t\t\treturn subnetAddresses, nil\n\t\t}\n\n\t\treturn subnetAddresses, nil\n\t}\n\n\t// Trying to create a subnet under an existing block\n\tparameters.Add(\"block_id\", blockID)\n\n\t// Specifying a suggested subnet IP address\n\tif len(requestedIP) > 0 {\n\t\tparameters.Add(\"begin_addr\", requestedIP)\n\t}\n\n\t// Sending the creation request\n\tresp, body, err := s.Request(\"get\", \"rpc/ip_find_free_subnet\", &parameters)\n\n\tif err == nil {\n\t\tvar buf [](map[string]interface{})\n\t\tjson.Unmarshal([]byte(body), &buf)\n\n\t\t// Checking the answer\n\t\tif resp.StatusCode == 200 && len(buf) > 0 {\n\t\t\tsubnetAddresses := []string{}\n\n\t\t\tfor i := 0; i < len(buf); i++ {\n\t\t\t\tif hexaddr, hexaddr_exist := buf[i][\"start_ip_addr\"].(string); hexaddr_exist {\n\t\t\t\t\tlog.Printf(\"[DEBUG] SOLIDServer - Suggested IP subnet address: %s\\n\", hexiptoip(hexaddr))\n\t\t\t\t\tsubnetAddresses = append(subnetAddresses, hexaddr)\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn subnetAddresses, nil\n\t\t}\n\t}\n\n\tlog.Printf(\"[DEBUG] SOLIDServer - Unable to find a free IP subnet in space (oid): %s, block (oid): %s, size: %s\\n\", siteID, blockID, strconv.Itoa(prefixSize))\n\n\treturn []string{}, err\n}", "title": "" }, { "docid": "909a1ed50151e326b01212b30edb2914", "score": "0.5259168", "text": "func MakeAllocation(db *sql.DB, node Node,\n\tprojectName, ipblock, cidr string) (int64, error) {\n\n\tif db == nil {\n\t\treturn 0, fmt.Errorf(\"database connector is nil\")\n\t}\n\tif len(projectName) == 0 {\n\t\treturn 0, fmt.Errorf(\"deployment name is empty\")\n\t}\n\tif node == nil || len(node.GetUuidName()) == 0 {\n\t\treturn 0, fmt.Errorf(\"node or node name is empty\")\n\t}\n\tif len(cidr) == 0 || len(ipblock) == 0 {\n\t\treturn 0, fmt.Errorf(\"cifr and ip block can't be empty\")\n\t}\n\tif _, _, err := net.ParseCIDR(cidr); err != nil {\n\t\terr := fmt.Errorf(\"invalid cidr format\")\n\t\tlogging.ErrorLogging(err)\n\t\treturn 0, err\n\t}\n\t// ip block stored with / mask\n\tif _, _, err := net.ParseCIDR(ipblock); err != nil {\n\t\terr := fmt.Errorf(\"invalid IP address format\")\n\t\tlogging.ErrorLogging(err)\n\t\treturn 0, err\n\t}\n\n\terr := CreateTablesIfNeed(db)\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(\"failed create tables\")\n\t}\n\n\ttx, err := db.Begin()\n\tif err != nil {\n\t\treturn 0, errors.Trace(err)\n\t}\n\n\tquery := ` INSERT INTO main.podipblock(id, nodeid, ipblock, cidrblock, type)\n SELECT deployment.id, nodes.nodeid, ?, ?, 1\n FROM deployment, nodes \n \t WHERE deployment.DeploymentName = ? AND nodes.JettisonUuid == ?`\n\n\tstmt, err := tx.Prepare(query)\n\tif err != nil {\n\t\tlogging.ErrorLogging(err)\n\t\treturn 0, errors.Trace(err)\n\t}\n\n\tdefer func() {\n\t\tif err := stmt.Close(); err != nil {\n\t\t\tlog.Println(\"failed to close db smtm\", err)\n\t\t}\n\t}()\n\n\tr, err := stmt.Exec(ipblock, cidr, projectName, node.GetUuidName())\n\tif err != nil {\n\t\ttx.Rollback()\n\t\tlogging.ErrorLogging(err)\n\t\treturn 0, errors.Trace(err)\n\t}\n\tdepId, err := r.LastInsertId()\n\tif err != nil {\n\t\ttx.Rollback()\n\t\tlogging.ErrorLogging(err)\n\t\treturn 0, errors.Trace(err)\n\t}\n\n\terr = tx.Commit()\n\tif err != nil {\n\t\tlogging.ErrorLogging(err)\n\t\treturn 0, errors.Trace(err)\n\t}\n\n\treturn depId, nil\n}", "title": "" }, { "docid": "1f7f2fb69c6c1ee550f2a569b20c639b", "score": "0.525389", "text": "func (objMgr *ObjectManager) CreateSubnet(subnet Subnet) (string,error){\n\tglog.Infof(\"Creating subnet : %s\", subnet.Name)\n\tpayload := &Payload{Method:\"POST\", Path:\"subnet/add\", Body: subnet}\n\tres,err := objMgr.Client.MakeRequest(*payload)\n\tif err!=nil{\n\t\tglog.Errorf(\"Error creating subnet :: Msg :'%s', Status : %s\", err.ErrorMsg, err.Status)\n\t\treturn \"\", errors.New(err.ErrorMsg)\n\t}\n\tresStr := string(res)\n\treturn resStr,nil\n}", "title": "" }, { "docid": "c4dbddb9117595c10347e67c2fde9c18", "score": "0.5243625", "text": "func testVpcSubnetCount(t *testing.T, terraformOptions *terraform.Options) { // {{{\n\tawsRegion := terraformOptions.Vars[\"aws_region\"].(string)\n\tvpcID := terraform.Output(t, terraformOptions, \"vpc_id\")\n\tvpcSubnets := aws.GetSubnetsForVpc(t, vpcID, awsRegion)\n\n\tassert.Equal(t, len(vpcSubnets), 2)\n}", "title": "" }, { "docid": "4473965c366560627759e9f7aad04dcb", "score": "0.5227491", "text": "func (lsr *Leaser) getBlockFromMainPool(v uint8) (*Subnet, error) {\n\tswitch v {\n\tcase 6:\n\t\tif lsr.V6Pool == nil {\n\t\t\treturn nil, errors.New(\"Can't get new IPv6 address block from main pool, because IPv6 block is ignore\")\n\t\t}\n\n\t\tnbv6 := lsr.V6Pool.NthSubnet(lsr.V6AllocateBlock, uint64(lsr.V6Idx))\n\t\tif nbv6 == nil {\n\t\t\treturn nil, errors.New(\"Can't get new IPv6 address block from main pool \" + lsr.V6Pool.String())\n\t\t}\n\n\t\tlsr.V6Idx++\n\n\t\tb, err := NewSubnet(nbv6)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treturn b, nil\n\n\tcase 4:\n\t\tif lsr.V6Pool == nil {\n\t\t\treturn nil, errors.New(\"Can't get new IPv4 address block from main pool, because IPv4 block is ignore\")\n\t\t}\n\n\t\tnbv4 := lsr.V4Pool.NthSubnet(lsr.V4AllocateBlock, uint32(lsr.V4Idx))\n\t\tif nbv4 == nil {\n\t\t\treturn nil, errors.New(\"Can't get new IPv4 address block from main pool \" + lsr.V4Pool.String())\n\t\t}\n\n\t\tlsr.V4Idx++\n\n\t\tb, err := NewSubnet(nbv4)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treturn b, nil\n\n\tdefault:\n\t\treturn nil, errors.New(\"Wrong requested IP protocol version\")\n\t}\n}", "title": "" }, { "docid": "b4e3bd142988fe34a073e7b0245d9b45", "score": "0.5226679", "text": "func TestIPv6NetSubnetting(t *testing.T) {\n\t// Mask: 33 -> 18279849774960082944::0-18279849777107566591::18446744073709551615 -> fdaf:1285::-fdaf:1285:7fff:ffff:ffff:ffff:ffff:ffff\n\tmBits := 33\n\tipWant := net.ParseIP(\"fdaf:1285:6f0e:1262:6f0e:8a2e:0370:7334\")\n\tuSNetWant, uSHostWant := uint64(18279849774960082944), uint64(0)\n\tuENetWant, uEHostWant := uint64(18279849777107566591), uint64(18446744073709551615)\n\tbSWant, _ := new(big.Int).SetString(\"337203710504545790806880554100409237504\", 10)\n\tbEWant, _ := new(big.Int).SetString(\"337203710544159872064012722897181212671\", 10)\n\n\teq := func(sn, sh, en, eh uint64) bool {\n\t\treturn sn == uSNetWant &&\n\t\t\tsh == uSHostWant &&\n\t\t\ten == uENetWant &&\n\t\t\teh == uEHostWant &&\n\t\t\tbSWant.Cmp(uint64sToBig(sn, sh)) == 0 &&\n\t\t\tbEWant.Cmp(uint64sToBig(en, eh)) == 0\n\t}\n\n\tif sn, sh, en, eh := IPv6NetStartEnd(ipWant, mBits); !eq(sn, sh, en, eh) {\n\t\tt.Errorf(\"Failed to convert IPv6 CIDR %s/%d into correct start and end uint64s - got %d::%d-%d::%d, want %d::%d-%d::%d\", ipWant, mBits, uSNetWant, uSHostWant, uENetWant, uEHostWant, sn, sh, en, eh)\n\t}\n}", "title": "" }, { "docid": "f055b0382b37442e33105b9b76626e37", "score": "0.5217005", "text": "func (instance *SecurityGroup) unsafeBindToSubnet(inctx context.Context, abstractSubnet *abstract.Subnet, subnetHosts *propertiesv1.SubnetHosts, enable resources.SecurityGroupActivation, mark resources.SecurityGroupMark) (ferr fail.Error) {\n\tif valid.IsNil(instance) {\n\t\treturn fail.InvalidInstanceError()\n\t}\n\tif inctx == nil {\n\t\treturn fail.InvalidParameterCannotBeNilError(\"inctx\")\n\t}\n\tif abstractSubnet == nil {\n\t\treturn fail.InvalidParameterCannotBeNilError(\"abstractSubnet\")\n\t}\n\tif subnetHosts == nil {\n\t\treturn fail.InvalidParameterCannotBeNilError(\"subnetProps\")\n\t}\n\n\tctx, cancel := context.WithCancel(inctx)\n\tdefer cancel()\n\n\ttype result struct {\n\t\trErr fail.Error\n\t}\n\tchRes := make(chan result)\n\tgo func() {\n\t\tdefer close(chRes)\n\n\t\tvar xerr fail.Error\n\t\tswitch enable {\n\t\tcase resources.SecurityGroupEnable:\n\t\t\txerr = instance.enableOnHostsAttachedToSubnet(ctx, subnetHosts)\n\t\tcase resources.SecurityGroupDisable:\n\t\t\txerr = instance.disableOnHostsAttachedToSubnet(ctx, subnetHosts)\n\t\t}\n\t\txerr = debug.InjectPlannedFail(xerr)\n\t\tif xerr != nil {\n\t\t\tchRes <- result{xerr}\n\t\t\treturn\n\t\t}\n\n\t\txerr = instance.Alter(ctx, func(clonable data.Clonable, props *serialize.JSONProperties) fail.Error {\n\t\t\tif mark == resources.MarkSecurityGroupAsDefault {\n\t\t\t\tasg, ok := clonable.(*abstract.SecurityGroup)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn fail.InconsistentError(\"'*abstract.SecurityGroup' expected, '%s' provided\", reflect.TypeOf(clonable).String())\n\t\t\t\t}\n\n\t\t\t\tif asg.DefaultForHost != \"\" {\n\t\t\t\t\treturn fail.InvalidRequestError(\"security group is already marked as default for subnet %s\", asg.DefaultForSubnet)\n\t\t\t\t}\n\n\t\t\t\tasg.DefaultForSubnet = abstractSubnet.ID\n\t\t\t}\n\n\t\t\treturn props.Alter(securitygroupproperty.SubnetsV1, func(clonable data.Clonable) fail.Error {\n\t\t\t\tsgsV1, ok := clonable.(*propertiesv1.SecurityGroupSubnets)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn fail.InconsistentError(\"'*propertiesv1.SecurityGroupSubnets' expected, '%s' provided\", reflect.TypeOf(clonable).String())\n\t\t\t\t}\n\n\t\t\t\t// First check if subnet is present with the state requested; if present with same state, consider situation as a success\n\t\t\t\tdisable := !bool(enable)\n\t\t\t\tif item, ok := sgsV1.ByID[abstractSubnet.ID]; !ok || item.Disabled == disable {\n\t\t\t\t\titem = &propertiesv1.SecurityGroupBond{\n\t\t\t\t\t\tID: abstractSubnet.ID,\n\t\t\t\t\t\tName: abstractSubnet.Name,\n\t\t\t\t\t}\n\t\t\t\t\tsgsV1.ByID[abstractSubnet.ID] = item\n\t\t\t\t\tsgsV1.ByName[abstractSubnet.Name] = abstractSubnet.ID\n\t\t\t\t}\n\n\t\t\t\t// updates security group properties\n\t\t\t\tsgsV1.ByID[abstractSubnet.ID].Disabled = disable\n\t\t\t\treturn nil\n\t\t\t})\n\t\t})\n\t\tchRes <- result{xerr}\n\n\t}()\n\tselect {\n\tcase res := <-chRes:\n\t\treturn res.rErr\n\tcase <-ctx.Done():\n\t\treturn fail.ConvertError(ctx.Err())\n\tcase <-inctx.Done():\n\t\treturn fail.ConvertError(inctx.Err())\n\t}\n}", "title": "" }, { "docid": "c39fca8f53e0741b1c344446f448664e", "score": "0.5214767", "text": "func initSubnet(apiRouter *mux.Router, context *Context) {\n\taddContext := func(handler contextHandlerFunc) *contextHandler {\n\t\treturn newContextHandler(context, handler)\n\t}\n\n\tsubnetsRouter := apiRouter.PathPrefix(\"/subnets\").Subrouter()\n\tsubnetsRouter.Handle(\"\", addContext(handleGetSubnets)).Methods(\"GET\")\n\n\tsubnetRouter := apiRouter.PathPrefix(\"/subnet/{subnet:[A-Za-z0-9]{26}}\").Subrouter()\n\tsubnetRouter.Handle(\"\", addContext(handleGetSubnet)).Methods(\"GET\")\n}", "title": "" }, { "docid": "5789368568cc0ecb57eedb4ac19f2210", "score": "0.520276", "text": "func (m *MockELBV2) SetSubnetsRequest(arg0 *elbv2.SetSubnetsInput) (*request.Request, *elbv2.SetSubnetsOutput) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"SetSubnetsRequest\", arg0)\n\tret0, _ := ret[0].(*request.Request)\n\tret1, _ := ret[1].(*elbv2.SetSubnetsOutput)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "beee8e6068bd1d7aeb86add14a460bf5", "score": "0.5192316", "text": "func TestEnsureEIPWithNoSpecificIP(t *testing.T) {\n\tcloud, _, blbResp, err := beforeTestBlb()\n\tif err != nil {\n\t\tt.Errorf(\"beforeTestBlb err , %v\", err)\n\t}\n\tctx := context.Background()\n\t// cases is nil\n\tsvc := buildService()\n\t// clusterName svc nodes are not important\n\tserviceAnnotation := &ServiceAnnotation{}\n\tlb := &blb.LoadBalancer{}\n\t_, err = cloud.ensureEIPWithNoSpecificIP(ctx, svc, lb)\n\tif err == nil {\n\t\tt.Errorf(\"ensureEIPWithNoSpecificIP err, should be an error\")\n\t}\n\t// right case1\n\tserviceAnnotation = &ServiceAnnotation{\n\t\tElasticIPName: \"da\",\n\t\tElasticIPBillingMethod: \"\",\n\t\tElasticIPBandwidthInMbps: 100,\n\t\tElasticIPReservationLength: 100,\n\t}\n\tlb = &blb.LoadBalancer{\n\t\tBlbId: blbResp.LoadBalancerId,\n\t}\n\tip, err := cloud.ensureEIPWithNoSpecificIP(ctx, svc, lb)\n\tif err != nil {\n\t\tt.Errorf(\"ensureEIPWithNoSpecificIP err, err: %s\", err)\n\t}\n\tif len(ip) == 0 {\n\t\tt.Errorf(\"ensureEIPWithNoSpecificIP err, ip is nil\")\n\t}\n\t// right case2\n\t// create eip and bind blb\n\tlb2 := &blb.LoadBalancer{\n\t\tBlbId: blbResp.LoadBalancerId,\n\t\tStatus: \"available\",\n\t}\n\targs, err := cloud.getEipArgsFromAnnotation(serviceAnnotation)\n\tif err != nil {\n\t\tt.Errorf(\"getEipArgsFromAnnotation err, err: %s\", err)\n\t}\n\teip, err := cloud.createEIP(ctx, args)\n\tif err != nil {\n\t\tt.Errorf(\"createEIP err, err: %s\", err)\n\t}\n\tif len(eip) == 0 {\n\t\tt.Errorf(\"createEIP err, ip is nil\")\n\t}\n\tip2, err := cloud.ensureEIPWithNoSpecificIP(ctx, svc, lb2)\n\tif err != nil {\n\t\tt.Errorf(\"ensureEIPWithNoSpecificIP err, err: %s\", err)\n\t}\n\tif len(ip2) == 0 {\n\t\tt.Errorf(\"ensureEIPWithNoSpecificIP err, ip is nil\")\n\t}\n}", "title": "" }, { "docid": "c8a7938ed8e3ddbf47eac5df7570a777", "score": "0.51847833", "text": "func newSubnetsClient(subscriptionID string, baseURI string, authorizer autorest.Authorizer) network.SubnetsClient {\n\tsubnetsClient := network.NewSubnetsClientWithBaseURI(baseURI, subscriptionID)\n\tsubnetsClient.Authorizer = authorizer\n\tsubnetsClient.AddToUserAgent(azure.UserAgent())\n\treturn subnetsClient\n}", "title": "" }, { "docid": "d35e4ad501a92ef20469cec83f902bd2", "score": "0.5159139", "text": "func (m *MockNsxNetworkProvisioner) AllocateIPAddress(arg0 string) (string, error) {\n\tret := m.ctrl.Call(m, \"AllocateIPAddress\", arg0)\n\tret0, _ := ret[0].(string)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "4d03d2c827e76ad4a793d786e5de21ac", "score": "0.51588005", "text": "func (m *MockNatGatewayScope) Subnets() v1beta1.Subnets {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Subnets\")\n\tret0, _ := ret[0].(v1beta1.Subnets)\n\treturn ret0\n}", "title": "" }, { "docid": "4939c2cadd953a6be4ec967377dc2106", "score": "0.5152371", "text": "func regionTest(t *testing.T) {\n\tnodes := &v1.NodeList{}\n\tnodes.Items = append(nodes.Items, *newNode(\"node11\", \"node1\", \"192.168.0.1\", \"rack1\", \"a\", \"us-east-1\"))\n\tnodes.Items = append(nodes.Items, *newNode(\"node21\", \"node2\", \"192.168.0.2\", \"rack2\", \"a\", \"us-east-1\"))\n\tnodes.Items = append(nodes.Items, *newNode(\"node31\", \"node3\", \"192.168.0.3\", \"rack1\", \"b\", \"us-east-1\"))\n\tnodes.Items = append(nodes.Items, *newNode(\"node41\", \"node4\", \"192.168.0.4\", \"rack2\", \"b\", \"us-east-2\"))\n\tnodes.Items = append(nodes.Items, *newNode(\"node51\", \"node5\", \"192.168.0.5\", \"rack1\", \"c\", \"us-east-2\"))\n\n\tif err := driver.CreateCluster(5, nodes); err != nil {\n\t\tt.Fatalf(\"Error creating cluster: %v\", err)\n\t}\n\n\tpod := newPod(\"regionTest\", map[string]bool{\"regionVolume1\": false, \"regionVolume2\": false})\n\tprovNodes := []int{0, 1}\n\tif err := driver.ProvisionVolume(\"regionVolume1\", provNodes, 1, nil, false, false); err != nil {\n\t\tt.Fatalf(\"Error provisioning volume: %v\", err)\n\t}\n\tprovNodes = []int{1, 2}\n\tif err := driver.ProvisionVolume(\"regionVolume2\", provNodes, 1, nil, false, false); err != nil {\n\t\tt.Fatalf(\"Error provisioning volume: %v\", err)\n\t}\n\n\tfilterResponse, err := sendFilterRequest(pod, nodes)\n\tif err != nil {\n\t\tt.Fatalf(\"Error sending filter request: %v\", err)\n\t}\n\tverifyFilterResponse(t, nodes, []int{0, 1, 2, 3, 4}, filterResponse)\n\n\tprioritizeResponse, err := sendPrioritizeRequest(pod, nodes)\n\tif err != nil {\n\t\tt.Fatalf(\"Error sending prioritize request: %v\", err)\n\t}\n\tverifyPrioritizeResponse(\n\t\tt,\n\t\tnodes,\n\t\t[]float64{nodePriorityScore + zonePriorityScore,\n\t\t\t2 * nodePriorityScore,\n\t\t\tnodePriorityScore + regionPriorityScore,\n\t\t\tdefaultScore,\n\t\t\tdefaultScore},\n\t\tprioritizeResponse)\n}", "title": "" }, { "docid": "5f99e9570b1cac3b6a8449b45e5db87b", "score": "0.5144696", "text": "func (m *MockAPI) IsPublicSubnet(arg0 context.Context, arg1 string) (bool, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"IsPublicSubnet\", arg0, arg1)\n\tret0, _ := ret[0].(bool)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "5fe31ce9a9419c99725f34721e1d4c7f", "score": "0.5144172", "text": "func (subnet *VirtualNetworks_Subnet_Spec) AssignProperties_From_VirtualNetworks_Subnet_Spec(source *v20201101s.VirtualNetworks_Subnet_Spec) error {\n\t// Clone the existing property bag\n\tpropertyBag := genruntime.NewPropertyBag(source.PropertyBag)\n\n\t// AddressPrefix\n\tsubnet.AddressPrefix = genruntime.ClonePointerToString(source.AddressPrefix)\n\n\t// AddressPrefixes\n\tsubnet.AddressPrefixes = genruntime.CloneSliceOfString(source.AddressPrefixes)\n\n\t// ApplicationGatewayIpConfigurations\n\tif source.ApplicationGatewayIpConfigurations != nil {\n\t\tapplicationGatewayIpConfigurationList := make([]ApplicationGatewayIPConfiguration_VirtualNetworks_Subnet_SubResourceEmbedded, len(source.ApplicationGatewayIpConfigurations))\n\t\tfor applicationGatewayIpConfigurationIndex, applicationGatewayIpConfigurationItem := range source.ApplicationGatewayIpConfigurations {\n\t\t\t// Shadow the loop variable to avoid aliasing\n\t\t\tapplicationGatewayIpConfigurationItem := applicationGatewayIpConfigurationItem\n\t\t\tvar applicationGatewayIpConfiguration ApplicationGatewayIPConfiguration_VirtualNetworks_Subnet_SubResourceEmbedded\n\t\t\terr := applicationGatewayIpConfiguration.AssignProperties_From_ApplicationGatewayIPConfiguration_VirtualNetworks_Subnet_SubResourceEmbedded(&applicationGatewayIpConfigurationItem)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_ApplicationGatewayIPConfiguration_VirtualNetworks_Subnet_SubResourceEmbedded() to populate field ApplicationGatewayIpConfigurations\")\n\t\t\t}\n\t\t\tapplicationGatewayIpConfigurationList[applicationGatewayIpConfigurationIndex] = applicationGatewayIpConfiguration\n\t\t}\n\t\tsubnet.ApplicationGatewayIpConfigurations = applicationGatewayIpConfigurationList\n\t} else {\n\t\tsubnet.ApplicationGatewayIpConfigurations = nil\n\t}\n\n\t// AzureName\n\tsubnet.AzureName = source.AzureName\n\n\t// Delegations\n\tif source.Delegations != nil {\n\t\tdelegationList := make([]Delegation, len(source.Delegations))\n\t\tfor delegationIndex, delegationItem := range source.Delegations {\n\t\t\t// Shadow the loop variable to avoid aliasing\n\t\t\tdelegationItem := delegationItem\n\t\t\tvar delegation Delegation\n\t\t\terr := delegation.AssignProperties_From_Delegation(&delegationItem)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_Delegation() to populate field Delegations\")\n\t\t\t}\n\t\t\tdelegationList[delegationIndex] = delegation\n\t\t}\n\t\tsubnet.Delegations = delegationList\n\t} else {\n\t\tsubnet.Delegations = nil\n\t}\n\n\t// IpAllocations\n\tif source.IpAllocations != nil {\n\t\tipAllocationList := make([]SubResource, len(source.IpAllocations))\n\t\tfor ipAllocationIndex, ipAllocationItem := range source.IpAllocations {\n\t\t\t// Shadow the loop variable to avoid aliasing\n\t\t\tipAllocationItem := ipAllocationItem\n\t\t\tvar subResourceStash v20200601s.SubResource\n\t\t\terr := subResourceStash.AssignProperties_From_SubResource(&ipAllocationItem)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_SubResource() to populate field SubResourceStash from IpAllocations\")\n\t\t\t}\n\t\t\tvar subResourceStashLocal v20180501s.SubResource\n\t\t\terr = subResourceStashLocal.AssignProperties_From_SubResource(&subResourceStash)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_SubResource() to populate field SubResourceStash\")\n\t\t\t}\n\t\t\tvar ipAllocation SubResource\n\t\t\terr = ipAllocation.AssignProperties_From_SubResource(&subResourceStashLocal)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_SubResource() to populate field IpAllocations from SubResourceStash\")\n\t\t\t}\n\t\t\tipAllocationList[ipAllocationIndex] = ipAllocation\n\t\t}\n\t\tsubnet.IpAllocations = ipAllocationList\n\t} else {\n\t\tsubnet.IpAllocations = nil\n\t}\n\n\t// NatGateway\n\tif source.NatGateway != nil {\n\t\tvar subResourceStash v20200601s.SubResource\n\t\terr := subResourceStash.AssignProperties_From_SubResource(source.NatGateway)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_SubResource() to populate field SubResourceStash from NatGateway\")\n\t\t}\n\t\tvar subResourceStashLocal v20180501s.SubResource\n\t\terr = subResourceStashLocal.AssignProperties_From_SubResource(&subResourceStash)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_SubResource() to populate field SubResourceStash\")\n\t\t}\n\t\tvar natGateway SubResource\n\t\terr = natGateway.AssignProperties_From_SubResource(&subResourceStashLocal)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_SubResource() to populate field NatGateway from SubResourceStash\")\n\t\t}\n\t\tsubnet.NatGateway = &natGateway\n\t} else {\n\t\tsubnet.NatGateway = nil\n\t}\n\n\t// NetworkSecurityGroup\n\tif source.NetworkSecurityGroup != nil {\n\t\tvar networkSecurityGroup NetworkSecurityGroupSpec_VirtualNetworks_Subnet_SubResourceEmbedded\n\t\terr := networkSecurityGroup.AssignProperties_From_NetworkSecurityGroupSpec_VirtualNetworks_Subnet_SubResourceEmbedded(source.NetworkSecurityGroup)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_NetworkSecurityGroupSpec_VirtualNetworks_Subnet_SubResourceEmbedded() to populate field NetworkSecurityGroup\")\n\t\t}\n\t\tsubnet.NetworkSecurityGroup = &networkSecurityGroup\n\t} else {\n\t\tsubnet.NetworkSecurityGroup = nil\n\t}\n\n\t// OriginalVersion\n\tsubnet.OriginalVersion = source.OriginalVersion\n\n\t// Owner\n\tif source.Owner != nil {\n\t\towner := source.Owner.Copy()\n\t\tsubnet.Owner = &owner\n\t} else {\n\t\tsubnet.Owner = nil\n\t}\n\n\t// PrivateEndpointNetworkPolicies\n\tsubnet.PrivateEndpointNetworkPolicies = genruntime.ClonePointerToString(source.PrivateEndpointNetworkPolicies)\n\n\t// PrivateLinkServiceNetworkPolicies\n\tsubnet.PrivateLinkServiceNetworkPolicies = genruntime.ClonePointerToString(source.PrivateLinkServiceNetworkPolicies)\n\n\t// RouteTable\n\tif source.RouteTable != nil {\n\t\tvar routeTable RouteTableSpec_VirtualNetworks_Subnet_SubResourceEmbedded\n\t\terr := routeTable.AssignProperties_From_RouteTableSpec_VirtualNetworks_Subnet_SubResourceEmbedded(source.RouteTable)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_RouteTableSpec_VirtualNetworks_Subnet_SubResourceEmbedded() to populate field RouteTable\")\n\t\t}\n\t\tsubnet.RouteTable = &routeTable\n\t} else {\n\t\tsubnet.RouteTable = nil\n\t}\n\n\t// ServiceEndpointPolicies\n\tif source.ServiceEndpointPolicies != nil {\n\t\tserviceEndpointPolicyList := make([]ServiceEndpointPolicySpec_VirtualNetworks_Subnet_SubResourceEmbedded, len(source.ServiceEndpointPolicies))\n\t\tfor serviceEndpointPolicyIndex, serviceEndpointPolicyItem := range source.ServiceEndpointPolicies {\n\t\t\t// Shadow the loop variable to avoid aliasing\n\t\t\tserviceEndpointPolicyItem := serviceEndpointPolicyItem\n\t\t\tvar serviceEndpointPolicy ServiceEndpointPolicySpec_VirtualNetworks_Subnet_SubResourceEmbedded\n\t\t\terr := serviceEndpointPolicy.AssignProperties_From_ServiceEndpointPolicySpec_VirtualNetworks_Subnet_SubResourceEmbedded(&serviceEndpointPolicyItem)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_ServiceEndpointPolicySpec_VirtualNetworks_Subnet_SubResourceEmbedded() to populate field ServiceEndpointPolicies\")\n\t\t\t}\n\t\t\tserviceEndpointPolicyList[serviceEndpointPolicyIndex] = serviceEndpointPolicy\n\t\t}\n\t\tsubnet.ServiceEndpointPolicies = serviceEndpointPolicyList\n\t} else {\n\t\tsubnet.ServiceEndpointPolicies = nil\n\t}\n\n\t// ServiceEndpoints\n\tif source.ServiceEndpoints != nil {\n\t\tserviceEndpointList := make([]ServiceEndpointPropertiesFormat, len(source.ServiceEndpoints))\n\t\tfor serviceEndpointIndex, serviceEndpointItem := range source.ServiceEndpoints {\n\t\t\t// Shadow the loop variable to avoid aliasing\n\t\t\tserviceEndpointItem := serviceEndpointItem\n\t\t\tvar serviceEndpoint ServiceEndpointPropertiesFormat\n\t\t\terr := serviceEndpoint.AssignProperties_From_ServiceEndpointPropertiesFormat(&serviceEndpointItem)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_ServiceEndpointPropertiesFormat() to populate field ServiceEndpoints\")\n\t\t\t}\n\t\t\tserviceEndpointList[serviceEndpointIndex] = serviceEndpoint\n\t\t}\n\t\tsubnet.ServiceEndpoints = serviceEndpointList\n\t} else {\n\t\tsubnet.ServiceEndpoints = nil\n\t}\n\n\t// Update the property bag\n\tif len(propertyBag) > 0 {\n\t\tsubnet.PropertyBag = propertyBag\n\t} else {\n\t\tsubnet.PropertyBag = nil\n\t}\n\n\t// Invoke the augmentConversionForVirtualNetworks_Subnet_Spec interface (if implemented) to customize the conversion\n\tvar subnetAsAny any = subnet\n\tif augmentedSubnet, ok := subnetAsAny.(augmentConversionForVirtualNetworks_Subnet_Spec); ok {\n\t\terr := augmentedSubnet.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": "ca6308a0717476a05f8c4e2fb13f1a47", "score": "0.51265705", "text": "func TestAccSubnetCRUD(t *testing.T) {\n\ttestacc.VetAccConditions(t)\n\n\tsess := session.NewSession()\n\tsubnet := testCreateSubnetInput\n\t// Permissions get added even though they are optional\n\tsubnet.Permissions = \"{\\\"3\\\":\\\"1\\\",\\\"2\\\":\\\"2\\\"}\"\n\tif os.Getenv(\"TESTACC_CUSTOM_NESTED\") != \"\" {\n\t\tsubnet.CustomFields = map[string]interface{}{\n\t\t\t\"CustomTestSubnets\": \"foobar\",\n\t\t\t\"CustomTestSubnets2\": nil,\n\t\t}\n\t} else {\n\t\tlog.Println(\"Note: Not testing nested custom fields as TESTACC_CUSTOM_NESTED is not set\")\n\t}\n\ttestAccSubnetCRUDCreate(t, sess, subnet)\n\tsubnet.ID = testAccSubnetCRUDReadByCIDR(t, sess, subnet)\n\ttestAccSubnetCRUDReadByID(t, sess, subnet)\n\tsubnet.Description = \"Updating subnet!\"\n\tif os.Getenv(\"TESTACC_CUSTOM_NESTED\") != \"\" {\n\t\tsubnet.CustomFields[\"CustomTestSubnets\"] = \"bazboop\"\n\t}\n\ttestAccSubnetCRUDUpdate(t, sess, subnet)\n\ttestAccSubnetCRUDDelete(t, sess, subnet)\n}", "title": "" }, { "docid": "a5e87198ce205bbc51c325bb7c211a28", "score": "0.51263", "text": "func (mr *MockClientMockRecorder) AllocateIPFromSubnetBlock(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"AllocateIPFromSubnetBlock\", reflect.TypeOf((*MockClient)(nil).AllocateIPFromSubnetBlock), arg0)\n}", "title": "" }, { "docid": "1839dd27fec0be3fcf201e3d279a8e68", "score": "0.51149493", "text": "func (m *MockNatGatewayScope) ControlPlaneSubnet() v1beta1.SubnetSpec {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ControlPlaneSubnet\")\n\tret0, _ := ret[0].(v1beta1.SubnetSpec)\n\treturn ret0\n}", "title": "" }, { "docid": "ed06fdf87eb7d9883ea0ff3c327d7deb", "score": "0.5106935", "text": "func TestFreeIPRanges(t *testing.T) {\n\ttests := []struct {\n\t\tnetwork string\n\t\tsubnets []string\n\t\texpectedFreeIPRanges []ipRange\n\t\texpectedErrorHandler func(error) bool\n\t}{\n\t\t// Test that given a network with no subnets,\n\t\t// the entire network is returned as a free range.\n\t\t{\n\t\t\tnetwork: \"10.4.0.0/16\",\n\t\t\tsubnets: []string{},\n\t\t\texpectedFreeIPRanges: []ipRange{\n\t\t\t\t{\n\t\t\t\t\tstart: net.ParseIP(\"10.4.0.0\"),\n\t\t\t\t\tend: net.ParseIP(\"10.4.255.255\"),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\n\t\t// Test that given a network, and one subnet at the start of the network,\n\t\t// the entire remaining network - that is, the network minus the subnet,\n\t\t// is returned as a free range.\n\t\t{\n\t\t\tnetwork: \"10.4.0.0/16\",\n\t\t\tsubnets: []string{\"10.4.0.0/24\"},\n\t\t\texpectedFreeIPRanges: []ipRange{\n\t\t\t\t{\n\t\t\t\t\tstart: net.ParseIP(\"10.4.1.0\"),\n\t\t\t\t\tend: net.ParseIP(\"10.4.255.255\"),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\n\t\t// Test that given a network, and two contiguous subnets,\n\t\t// the entire remaining network (afterwards) is returned as a free range.\n\t\t{\n\t\t\tnetwork: \"10.4.0.0/16\",\n\t\t\tsubnets: []string{\"10.4.0.0/24\", \"10.4.1.0/24\"},\n\t\t\texpectedFreeIPRanges: []ipRange{\n\t\t\t\t{\n\t\t\t\t\tstart: net.ParseIP(\"10.4.2.0\"),\n\t\t\t\t\tend: net.ParseIP(\"10.4.255.255\"),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\n\t\t// Test that given a network, and one fragmented subnet,\n\t\t// the two remaining free ranges are returned as free.\n\t\t{\n\t\t\tnetwork: \"10.4.0.0/16\",\n\t\t\tsubnets: []string{\"10.4.1.0/24\"},\n\t\t\texpectedFreeIPRanges: []ipRange{\n\t\t\t\t{\n\t\t\t\t\tstart: net.ParseIP(\"10.4.0.0\"),\n\t\t\t\t\tend: net.ParseIP(\"10.4.0.255\"),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tstart: net.ParseIP(\"10.4.2.0\"),\n\t\t\t\t\tend: net.ParseIP(\"10.4.255.255\"),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\n\t\t// Test that given a network, and three fragmented subnets,\n\t\t// the 4 remaining free ranges are returned as free.\n\t\t{\n\t\t\tnetwork: \"10.4.0.0/16\",\n\t\t\tsubnets: []string{\n\t\t\t\t\"10.4.10.0/24\",\n\t\t\t\t\"10.4.12.0/24\",\n\t\t\t\t\"10.4.14.0/24\",\n\t\t\t},\n\t\t\texpectedFreeIPRanges: []ipRange{\n\t\t\t\t{\n\t\t\t\t\tstart: net.ParseIP(\"10.4.0.0\"),\n\t\t\t\t\tend: net.ParseIP(\"10.4.9.255\"),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tstart: net.ParseIP(\"10.4.11.0\"),\n\t\t\t\t\tend: net.ParseIP(\"10.4.11.255\"),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tstart: net.ParseIP(\"10.4.13.0\"),\n\t\t\t\t\tend: net.ParseIP(\"10.4.13.255\"),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tstart: net.ParseIP(\"10.4.15.0\"),\n\t\t\t\t\tend: net.ParseIP(\"10.4.255.255\"),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t// Test that given multiple network ranges\n\t\t{\n\t\t\tnetwork: \"10.163.0.0/16\",\n\t\t\tsubnets: []string{\n\t\t\t\t\"10.163.32.0/21\",\n\t\t\t\t\"10.163.32.0/24\",\n\t\t\t\t\"10.163.33.0/24\",\n\t\t\t\t\"10.163.34.0/24\",\n\t\t\t\t\"10.163.35.0/24\",\n\t\t\t\t\"10.163.36.0/24\",\n\t\t\t\t\"10.163.37.0/24\",\n\t\t\t\t\"10.163.40.0/24\",\n\t\t\t\t\"10.163.40.0/22\",\n\t\t\t},\n\t\t\texpectedFreeIPRanges: []ipRange{\n\t\t\t\t{\n\t\t\t\t\tstart: net.ParseIP(\"10.163.0.0\"),\n\t\t\t\t\tend: net.ParseIP(\"10.163.31.255\"),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tstart: net.ParseIP(\"10.163.44.0\"),\n\t\t\t\t\tend: net.ParseIP(\"10.163.255.255\"),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\tfor index, test := range tests {\n\t\t_, network, err := net.ParseCIDR(test.network)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"%v: could not parse cidr: %v\", index, test.network)\n\t\t}\n\n\t\tsubnets := []net.IPNet{}\n\t\tfor _, subnetString := range test.subnets {\n\t\t\t_, subnet, err := net.ParseCIDR(subnetString)\n\t\t\tif err != nil {\n\t\t\t\tt.Fatalf(\"%v: could not parse cidr: %v\", index, subnetString)\n\t\t\t}\n\n\t\t\tsubnets = append(subnets, *subnet)\n\t\t}\n\n\t\tfreeSubnets, err := freeIPRanges(*network, subnets)\n\n\t\tif err != nil {\n\t\t\tif test.expectedErrorHandler == nil {\n\t\t\t\tt.Fatalf(\"%v: unexpected error returned.\\nreturned: %v\", index, err)\n\t\t\t}\n\t\t\tif !test.expectedErrorHandler(err) {\n\t\t\t\tt.Fatalf(\"%v: incorrect error returned.\\nreturned: %v\", index, err)\n\t\t\t}\n\t\t} else {\n\t\t\tif test.expectedErrorHandler != nil {\n\t\t\t\tt.Fatalf(\"%v: expected error not returned.\", index)\n\t\t\t}\n\n\t\t\tif !ipRangesEqual(freeSubnets, test.expectedFreeIPRanges) {\n\t\t\t\tt.Fatalf(\n\t\t\t\t\t\"%v: unexpected free subnets returned.\\nexpected: %v\\nreturned: %v\",\n\t\t\t\t\tindex,\n\t\t\t\t\ttest.expectedFreeIPRanges,\n\t\t\t\t\tfreeSubnets,\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "4b54fe23544fff34d12cc93d7c43de6d", "score": "0.50926536", "text": "func TestUnverifiedParentPanicRegression(t *testing.T) {\n\trequire := require.New(t)\n\t_, genesisBytes := defaultGenesis(t)\n\n\tbaseDBManager := manager.NewMemDB(version.Semantic1_0_0)\n\tatomicDB := prefixdb.New([]byte{1}, baseDBManager.Current().Database)\n\n\tvdrs := validators.NewManager()\n\tprimaryVdrs := validators.NewSet()\n\t_ = vdrs.Add(constants.PrimaryNetworkID, primaryVdrs)\n\tvm := &VM{Config: config.Config{\n\t\tChains: chains.TestManager,\n\t\tValidators: vdrs,\n\t\tUptimeLockedCalculator: uptime.NewLockedCalculator(),\n\t\tMinStakeDuration: defaultMinStakingDuration,\n\t\tMaxStakeDuration: defaultMaxStakingDuration,\n\t\tRewardConfig: defaultRewardConfig,\n\t\tBanffTime: banffForkTime,\n\t}}\n\n\tctx := defaultContext(t)\n\tctx.Lock.Lock()\n\tdefer func() {\n\t\trequire.NoError(vm.Shutdown(context.Background()))\n\t\tctx.Lock.Unlock()\n\t}()\n\n\tmsgChan := make(chan common.Message, 1)\n\trequire.NoError(vm.Initialize(\n\t\tcontext.Background(),\n\t\tctx,\n\t\tbaseDBManager,\n\t\tgenesisBytes,\n\t\tnil,\n\t\tnil,\n\t\tmsgChan,\n\t\tnil,\n\t\tnil,\n\t))\n\n\tm := atomic.NewMemory(atomicDB)\n\tvm.ctx.SharedMemory = m.NewSharedMemory(ctx.ChainID)\n\n\t// set time to post Banff fork\n\tvm.clock.Set(banffForkTime.Add(time.Second))\n\tvm.state.SetTimestamp(banffForkTime.Add(time.Second))\n\n\tkey0 := keys[0]\n\tkey1 := keys[1]\n\taddr0 := key0.PublicKey().Address()\n\taddr1 := key1.PublicKey().Address()\n\n\taddSubnetTx0, err := vm.txBuilder.NewCreateSubnetTx(\n\t\t1,\n\t\t[]ids.ShortID{addr0},\n\t\t[]*secp256k1.PrivateKey{key0},\n\t\taddr0,\n\t)\n\trequire.NoError(err)\n\n\taddSubnetTx1, err := vm.txBuilder.NewCreateSubnetTx(\n\t\t1,\n\t\t[]ids.ShortID{addr1},\n\t\t[]*secp256k1.PrivateKey{key1},\n\t\taddr1,\n\t)\n\trequire.NoError(err)\n\n\taddSubnetTx2, err := vm.txBuilder.NewCreateSubnetTx(\n\t\t1,\n\t\t[]ids.ShortID{addr1},\n\t\t[]*secp256k1.PrivateKey{key1},\n\t\taddr0,\n\t)\n\trequire.NoError(err)\n\n\tpreferred, err := vm.Builder.Preferred()\n\trequire.NoError(err)\n\n\tpreferredChainTime := preferred.Timestamp()\n\tpreferredID := preferred.ID()\n\tpreferredHeight := preferred.Height()\n\n\tstatelessStandardBlk, err := blocks.NewBanffStandardBlock(\n\t\tpreferredChainTime,\n\t\tpreferredID,\n\t\tpreferredHeight+1,\n\t\t[]*txs.Tx{addSubnetTx0},\n\t)\n\trequire.NoError(err)\n\taddSubnetBlk0 := vm.manager.NewBlock(statelessStandardBlk)\n\n\tstatelessStandardBlk, err = blocks.NewBanffStandardBlock(\n\t\tpreferredChainTime,\n\t\tpreferredID,\n\t\tpreferredHeight+1,\n\t\t[]*txs.Tx{addSubnetTx1},\n\t)\n\trequire.NoError(err)\n\taddSubnetBlk1 := vm.manager.NewBlock(statelessStandardBlk)\n\n\tstatelessStandardBlk, err = blocks.NewBanffStandardBlock(\n\t\tpreferredChainTime,\n\t\taddSubnetBlk1.ID(),\n\t\tpreferredHeight+2,\n\t\t[]*txs.Tx{addSubnetTx2},\n\t)\n\trequire.NoError(err)\n\taddSubnetBlk2 := vm.manager.NewBlock(statelessStandardBlk)\n\n\t_, err = vm.ParseBlock(context.Background(), addSubnetBlk0.Bytes())\n\trequire.NoError(err)\n\n\t_, err = vm.ParseBlock(context.Background(), addSubnetBlk1.Bytes())\n\trequire.NoError(err)\n\n\t_, err = vm.ParseBlock(context.Background(), addSubnetBlk2.Bytes())\n\trequire.NoError(err)\n\n\trequire.NoError(addSubnetBlk0.Verify(context.Background()))\n\trequire.NoError(addSubnetBlk0.Accept(context.Background()))\n\n\t// Doesn't matter what verify returns as long as it's not panicking.\n\t_ = addSubnetBlk2.Verify(context.Background())\n}", "title": "" }, { "docid": "d4cd67ec897e44050f1bbf32a03f425e", "score": "0.5089667", "text": "func (ss *SubnetService) Create(reqdata *SubnetCreateRequest) (*SubnetCreateResponse, *http.Response, error) {\n\n\tu := \"subnets\"\n\n\tu, err := addOptions(u, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treq, err := ss.client.NewRequest(\"POST\", u, reqdata)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tvar result *SubnetCreateResponse\n\tresp, err := ss.client.Do(req, &result)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn result, resp, nil\n}", "title": "" }, { "docid": "240e94073cf4bb39b670f8adbf77c4c4", "score": "0.5081864", "text": "func (nuageetcd *NuageEtcdClient) AllocateSubnetCIDR(subnet *api.EtcdSubnetMetadata) (string, error) {\n\tvar err error\n\tvar txnResp *clientv3.TxnResponse\n\tnetworkCIDR := strings.Replace(subnet.CIDR, \"/\", \"-\", -1)\n\tkey := POOL_CIDR_TREE + networkCIDR\n\tnuageEtcdRetry(\n\t\tfunc() error {\n\t\t\ttxnResp, err = nuageetcd.client.KV.Txn(context.Background()).If(\n\t\t\t\tclientv3.Compare(clientv3.ModRevision(key), \"=\", 0),\n\t\t\t).Then(\n\t\t\t\tclientv3.OpPut(key, subnet.Name),\n\t\t\t).Else(\n\t\t\t\tclientv3.OpGet(key),\n\t\t\t).Commit()\n\t\t\treturn err\n\t\t})\n\tif err != nil {\n\t\tglog.Errorf(\"create subnet cidr key(%s) txn failed:%v\", networkCIDR, err)\n\t\treturn \"\", err\n\t}\n\n\tif !txnResp.Succeeded {\n\t\tgetResp := (*clientv3.GetResponse)(txnResp.Responses[0].GetResponseRange())\n\t\tallocatedSubnet := string(getResp.Kvs[0].Value)\n\t\tglog.Warningf(\"subnet cidr %s is already allocated to subnet %s:\", networkCIDR, allocatedSubnet)\n\t\treturn allocatedSubnet, nil\n\t}\n\treturn \"\", err\n}", "title": "" }, { "docid": "060f4e6661980a2bffed425128cdd291", "score": "0.5081438", "text": "func TestReconcileLoadBalancerAddServicesOnMultipleSubnets(t *testing.T) {\n\tctrl := gomock.NewController(t)\n\tdefer ctrl.Finish()\n\n\taz := GetTestCloud(ctrl)\n\tclusterResources, expectedInterfaces, expectedVirtualMachines := getClusterResources(az, 1, 1)\n\tsetMockEnv(az, ctrl, expectedInterfaces, expectedVirtualMachines, 1)\n\n\tsvc1 := getTestService(\"service1\", v1.ProtocolTCP, nil, false, 8081)\n\tsvc2 := getInternalTestService(\"service2\", 8081)\n\n\texpectedLBs := make([]network.LoadBalancer, 0)\n\tsetMockLBs(az, ctrl, &expectedLBs, \"service\", 1, 1, false)\n\n\t// svc1 is using LB without \"-internal\" suffix\n\tlb, err := az.reconcileLoadBalancer(testClusterName, &svc1, clusterResources.nodes, true /* wantLb */)\n\tif err != nil {\n\t\tt.Errorf(\"Unexpected error reconciling svc1: %q\", err)\n\t}\n\n\t// ensure we got a frontend ip configuration for each service\n\tif len(*lb.FrontendIPConfigurations) != 1 {\n\t\tt.Error(\"Expected the loadbalancer to have 1 frontend ip configurations\")\n\t}\n\n\tvalidateLoadBalancer(t, lb, svc1)\n\n\t// Internal and External service cannot reside on the same LB resource\n\tvalidateTestSubnet(t, az, &svc2)\n\n\texpectedLBs = make([]network.LoadBalancer, 0)\n\tsetMockLBs(az, ctrl, &expectedLBs, \"service\", 1, 2, true)\n\n\t// svc2 is using LB with \"-internal\" suffix\n\tlb, err = az.reconcileLoadBalancer(testClusterName, &svc2, nil, true /* wantLb */)\n\tif err != nil {\n\t\tt.Errorf(\"Unexpected error reconciling svc2: %q\", err)\n\t}\n\n\t// ensure we got a frontend ip configuration for each service\n\tif len(*lb.FrontendIPConfigurations) != 1 {\n\t\tt.Error(\"Expected the loadbalancer to have 1 frontend ip configurations\")\n\t}\n\n\tvalidateLoadBalancer(t, lb, svc2)\n}", "title": "" }, { "docid": "a540e318485e3f9d56e37e22ef5813ae", "score": "0.50810784", "text": "func TestNetworkDeployment(t *testing.T) {\n\tt.Parallel()\n\n\tterraformOptions := &terraform.Options{\n\t\t// The path to where our Terraform code is located\n\t\tTerraformDir: \"../tf/\",\n\t}\n\n\t// At the end of the test, run `terraform destroy` to clean up any resources that were created\n\tdefer terraform.Destroy(t, terraformOptions)\n\n\t// This will run `terraform init` and `terraform apply` and fail the test if there are any errors\n\tterraform.InitAndApply(t, terraformOptions)\n\n\t// Run `terraform output` to get the value of an output variable\n\tvnetName := terraform.Output(t, terraformOptions, \"vnet_name\")\n\tresourceGroupName := terraform.Output(t, terraformOptions, \"resource_group_name\")\n\n\tazureSubscriptionID := os.Getenv(\"ARM_SUBSCRIPTION_ID\")\n\tfmt.Printf(\"Subscription ID = %s\", azureSubscriptionID)\n\t\n\tauthorizer, err := auth.NewAuthorizerFromEnvironment()\n\tif err != nil {\n\t\tt.Fatal(\"Cannot get an Azure Authorizer\")\n\t}\n\n\tvnetClient := network.NewVirtualNetworksClient(azureSubscriptionID)\n\tvnetClient.Authorizer = authorizer\n\n\tvirtualNetwork, err := vnetClient.Get(context.Background(), resourceGroupName, vnetName, \"\")\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tassert.Fail(t, \"The virtual network does not exists\")\n\t\treturn\n\t}\n\n\texpectedSubnetsCount := 1\n\tactualSubnetsCount := len(*virtualNetwork.Subnets)\n\n\tif !assert.Equal(t, expectedSubnetsCount, actualSubnetsCount, \"The expected number of subnet is 1\") {\n\t\treturn\n\t}\n\n\tsubnet := (*virtualNetwork.Subnets)[0]\n\t\n\texpectedSubnetName := \"default\"\n\tactualSubnetName := subnet.Name\n\n\tassert.Equal(t, expectedSubnetName, *actualSubnetName, \"The expected subnet name is 'default'\")\n}", "title": "" }, { "docid": "09cf5dbe7b9351efd5ebff46d751c88a", "score": "0.50805235", "text": "func (tc *AzureTestClient) createSubnetsClient() *aznetwork.SubnetsClient {\n\treturn &aznetwork.SubnetsClient{BaseClient: tc.networkClient}\n}", "title": "" }, { "docid": "4e32d54710db31193c3a5c8301ba8904", "score": "0.50656337", "text": "func GetSubnetAllocation(db *sql.DB) ([]SubnetAllocation, bool, error) {\n\n\tmodels := make([]SubnetAllocation, 0)\n\n\tif db == nil {\n\t\treturn nil, false, fmt.Errorf(\"database connector is nil\")\n\t}\n\n\tquery := `SELECT nodes.JettisonUuid, podipblock.cidrblock, podipblock.ipblock, podipblock.type\n\t\t\t\tFROM deployment, nodes, podipblock\n\t\t\tWHERE deployment.id = nodes.id AND podipblock.nodeid = nodes.nodeid;`\n\n\trows, err := db.Query(query)\n\tif err != nil {\n\t\treturn nil, false, err\n\t}\n\n\tdefer func() {\n\t\tif err := rows.Close(); err != nil {\n\t\t\tlog.Println(\"failed to close db smtm\", err)\n\t\t}\n\t}()\n\n\tfor rows.Next() {\n\t\tvar (\n\t\t\thostid = \"\"\n\t\t\tcidr = \"\"\n\t\t\tipblock = \"\"\n\t\t\tpodtype = \"\"\n\t\t\tnodetype = 0\n\t\t)\n\t\terr = rows.Scan(&hostid, &cidr, &ipblock, &podtype)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\tlog.Println(hostid)\n\t\tlog.Println(cidr)\n\t\tlog.Println(ipblock)\n\t\tlog.Println(nodetype)\n\n\t\tr := &PodSubnet{}\n\t\tr.hostuuid = hostid\n\t\tr.cidrblock = cidr\n\t\tr.ipblock = ipblock\n\t\tr.podtype = jettypes.NodeType(nodetype)\n\n\t\tmodels = append(models, r)\n\t}\n\n\terr = rows.Err()\n\tif err != nil {\n\t\treturn nil, false, err\n\t}\n\n\treturn models, true, nil\n}", "title": "" }, { "docid": "88e24cb39c20b16901509c486dc8d3d0", "score": "0.5062968", "text": "func Test_CreateNetwork(t *testing.T) {\n\t// TODO: Implement Test\n\n}", "title": "" }, { "docid": "1093b9c41c8af78b4ec75f6bab8250f5", "score": "0.50535876", "text": "func (m *MockIPAMDelegator) DelIPAMSubnetAddress(arg0 []byte, arg1 *invoke.Args) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"DelIPAMSubnetAddress\", arg0, arg1)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "f2bcad0107f75eed42ce36b16e4322a5", "score": "0.505191", "text": "func testAccSubnetCRUDCreate(t *testing.T, sess *session.Session, s Subnet) {\n\tc := NewController(sess)\n\n\tif _, err := c.CreateSubnet(s); err != nil {\n\t\tt.Fatalf(\"Create: Error creating subnet: %s\", err)\n\t}\n}", "title": "" }, { "docid": "61ed0a118493b62d979dfdd0a48c44cf", "score": "0.5046751", "text": "func ipTest(t *testing.T) {\n\tnodes := &v1.NodeList{}\n\tnodes.Items = append(nodes.Items, *newNode(\"n1\", \"n1\", \"192.168.0.1\", \"rack1\", \"\", \"\"))\n\tnodes.Items = append(nodes.Items, *newNode(\"n2\", \"n2\", \"192.168.0.2\", \"rack2\", \"\", \"\"))\n\tnodes.Items = append(nodes.Items, *newNode(\"n3\", \"n3\", \"192.168.0.3\", \"rack1\", \"\", \"\"))\n\tnodes.Items = append(nodes.Items, *newNode(\"n4\", \"n4\", \"192.168.0.4\", \"rack2\", \"\", \"\"))\n\tnodes.Items = append(nodes.Items, *newNode(\"n5\", \"n5\", \"192.168.0.5\", \"rack3\", \"\", \"\"))\n\n\tprovNodes := []int{0, 1}\n\tif err := driver.CreateCluster(5, nodes); err != nil {\n\t\tt.Fatalf(\"Error creating cluster: %v\", err)\n\t}\n\n\tpod := newPod(\"ipTest\", map[string]bool{\"ipTest\": false})\n\n\tif err := driver.ProvisionVolume(\"ipTest\", provNodes, 1, nil, false, false); err != nil {\n\t\tt.Fatalf(\"Error provisioning volume: %v\", err)\n\t}\n\tfilterResponse, err := sendFilterRequest(pod, nodes)\n\tif err != nil {\n\t\tt.Fatalf(\"Error sending filter request: %v\", err)\n\t}\n\tverifyFilterResponse(t, nodes, []int{0, 1, 2, 3, 4}, filterResponse)\n\n\tprioritizeResponse, err := sendPrioritizeRequest(pod, nodes)\n\tif err != nil {\n\t\tt.Fatalf(\"Error sending prioritize request: %v\", err)\n\t}\n\tverifyPrioritizeResponse(\n\t\tt,\n\t\tnodes,\n\t\t[]float64{nodePriorityScore,\n\t\t\tnodePriorityScore,\n\t\t\trackPriorityScore,\n\t\t\trackPriorityScore,\n\t\t\tdefaultScore},\n\t\tprioritizeResponse)\n}", "title": "" }, { "docid": "fbea324ea7770496a8d5ababdd2ad4f2", "score": "0.5045129", "text": "func TestConstructNetworkConfig(t *testing.T) {\n\tadditionalRoutesJson := `[\"169.254.172.1/32\", \"10.11.12.13/32\"]`\n\tvar additionalRoutes []cniTypes.IPNet\n\terr := json.Unmarshal([]byte(additionalRoutesJson), &additionalRoutes)\n\tassert.NoError(t, err)\n\n\tconfig := &Config{\n\t\tContainerID: \"containerid12\",\n\t\tContainerPID: \"pid\",\n\t\tBridgeName: \"bridge-test1\",\n\t\tAdditionalLocalRoutes: additionalRoutes,\n\t}\n\n\tvethName, bridgeNetworkConfig, err := NewBridgeNetworkConfig(config, true)\n\trequire.NoError(t, err, \"construct bridge plugins configuration failed\")\n\tassert.Equal(t, \"ecs-eth0\", vethName)\n\tbridgeConfig := &BridgeConfig{}\n\terr = json.Unmarshal(bridgeNetworkConfig.Bytes, bridgeConfig)\n\trequire.NoError(t, err, \"unmarshal bridge config from bytes failed: %s\",\n\t\tstring(bridgeNetworkConfig.Bytes))\n\tassert.Equal(t, config.BridgeName, bridgeConfig.BridgeName)\n\tassert.Equal(t, ecsSubnet, bridgeConfig.IPAM.IPV4Subnet)\n\tassert.Equal(t, TaskIAMRoleEndpoint, bridgeConfig.IPAM.IPV4Routes[0].Dst.String())\n}", "title": "" }, { "docid": "c8a71fc52e3b0fca7b44bf8a8b64aef6", "score": "0.5018437", "text": "func createNetwork(upstream, networkName string) error {\n\t// TODO: this loop logic is ugly...fixme, maybe with golang client\n\tvar err error\n\tvar output []byte\n\ttries := 10\n\tn := 0\n\tdone := false\n\n\t// create a network, and retry if it failed because of overlap\n\tfor output, err = exec.Command(\"docker\", \"-H\", \"unix://\"+upstream, \"network\", \"create\", networkName, \"--subnet\", newSubnet()).CombinedOutput(); !done && err != nil && n < tries; output, err = exec.Command(\"docker\", \"-H\", \"unix://\"+upstream, \"network\", \"create\", networkName, \"--subnet\", newSubnet()).CombinedOutput() {\n\t\tn++\n\t\tif err != nil {\n\t\t\t// ignore if network already exists\n\t\t\tif strings.Contains(string(output), networkName+\" already exists\") {\n\t\t\t\tlog.Printf(\"Docker network '%s' already exists\\n\", networkName)\n\t\t\t\tdone = true\n\t\t\t} else if strings.Contains(string(output), \"networks have overlapping IPv4\") {\n\t\t\t\tlog.Println(\"Overlapping subnets. Trying a different one.\")\n\t\t\t} else {\n\t\t\t\t// try setting to a different subnet (calculate subnet from block, hashed by hostname, maybe?)\n\t\t\t\tlog.Println(\"Failed, not due to overlapping subnets.\")\n\t\t\t\tlog.Println(err.Error())\n\t\t\t}\n\t\t}\n\t}\n\n\t// if done, we have a network created, return nil\n\tif done {\n\t\treturn nil\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "ba623666a37ab6bee0daf7448ccd9a2a", "score": "0.50127053", "text": "func (rm *resourceManager) newCreateRequestPayload(\n\tctx context.Context,\n\tr *resource,\n) (*svcsdk.CreateSubnetInput, error) {\n\tres := &svcsdk.CreateSubnetInput{}\n\n\tif r.ko.Spec.AvailabilityZone != nil {\n\t\tres.SetAvailabilityZone(*r.ko.Spec.AvailabilityZone)\n\t}\n\tif r.ko.Spec.AvailabilityZoneID != nil {\n\t\tres.SetAvailabilityZoneId(*r.ko.Spec.AvailabilityZoneID)\n\t}\n\tif r.ko.Spec.CIDRBlock != nil {\n\t\tres.SetCidrBlock(*r.ko.Spec.CIDRBlock)\n\t}\n\tif r.ko.Spec.DryRun != nil {\n\t\tres.SetDryRun(*r.ko.Spec.DryRun)\n\t}\n\tif r.ko.Spec.IPv6CIDRBlock != nil {\n\t\tres.SetIpv6CidrBlock(*r.ko.Spec.IPv6CIDRBlock)\n\t}\n\tif r.ko.Spec.OutpostARN != nil {\n\t\tres.SetOutpostArn(*r.ko.Spec.OutpostARN)\n\t}\n\tif r.ko.Spec.TagSpecifications != nil {\n\t\tf6 := []*svcsdk.TagSpecification{}\n\t\tfor _, f6iter := range r.ko.Spec.TagSpecifications {\n\t\t\tf6elem := &svcsdk.TagSpecification{}\n\t\t\tif f6iter.ResourceType != nil {\n\t\t\t\tf6elem.SetResourceType(*f6iter.ResourceType)\n\t\t\t}\n\t\t\tif f6iter.Tags != nil {\n\t\t\t\tf6elemf1 := []*svcsdk.Tag{}\n\t\t\t\tfor _, f6elemf1iter := range f6iter.Tags {\n\t\t\t\t\tf6elemf1elem := &svcsdk.Tag{}\n\t\t\t\t\tif f6elemf1iter.Key != nil {\n\t\t\t\t\t\tf6elemf1elem.SetKey(*f6elemf1iter.Key)\n\t\t\t\t\t}\n\t\t\t\t\tif f6elemf1iter.Value != nil {\n\t\t\t\t\t\tf6elemf1elem.SetValue(*f6elemf1iter.Value)\n\t\t\t\t\t}\n\t\t\t\t\tf6elemf1 = append(f6elemf1, f6elemf1elem)\n\t\t\t\t}\n\t\t\t\tf6elem.SetTags(f6elemf1)\n\t\t\t}\n\t\t\tf6 = append(f6, f6elem)\n\t\t}\n\t\tres.SetTagSpecifications(f6)\n\t}\n\tif r.ko.Spec.VPCID != nil {\n\t\tres.SetVpcId(*r.ko.Spec.VPCID)\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "7f2a2b37893dfe89b27fdefad1d19500", "score": "0.49871367", "text": "func validateSubnets(t *testing.T, tfOpts *terraform.Options) {\n\tpublicSubnetIds := terraform.OutputList(t, tfOpts, \"public_subnet_ids\")\n\tprivateSubnetAIds := terraform.OutputList(t, tfOpts, \"private_subnet_a_ids\")\n\tprivateSubnetBIds := terraform.OutputList(t, tfOpts, \"private_subnet_b_ids\")\n\n\tassert.Equal(t, 3, len(publicSubnetIds), \"minimal example should produce 3 public subnets\")\n\tassert.Equal(t, 3, len(privateSubnetAIds), \"minimal example should produce 3 private_a subnets\")\n\tassert.Equal(t, 0, len(privateSubnetBIds), \"minimal example should produce 0 private_b subnets\")\n\tfor _, subnet := range publicSubnetIds {\n\t\tassert.NotContains(t, privateSubnetAIds, subnet, \"subnets in public should not also be in private\")\n\t}\n\tfor _, subnet := range privateSubnetAIds {\n\t\tassert.NotContains(t, publicSubnetIds, subnet, \"subnets in public should not also be in private\")\n\t}\n}", "title": "" }, { "docid": "100c7e4699ae7504b5e3ccd81b190838", "score": "0.49804646", "text": "func ConstructTestBlock(t *testing.T, numTx int, txSize int, startingTxID int) *pb.Block2 {\n\ttxEnvs := []*common.Envelope{}\n\tfor i := startingTxID; i < numTx+startingTxID; i++ {\n\t\ttxEnv, _ := ConstructTestTransaction(t, ConstructRandomBytes(t, txSize), false)\n\t\ttxEnvs = append(txEnvs, txEnv)\n\t}\n\treturn newBlockEnv(txEnvs)\n}", "title": "" }, { "docid": "6c64ca54cf542baf710220d92e32045c", "score": "0.4957366", "text": "func TestCalculateCidrRange(t *testing.T) {\n\tip := \"10.10.10.12\"\n\tcidr := \"24\"\n\texpected := \"10.10.10.0/24\"\n\tresult := calculateCidrRange(ip, cidr)\n\tif result != expected {\n\t\tt.Logf(\"expected %s, got %s\", expected, result)\n\t\tt.Fail()\n\t}\n}", "title": "" }, { "docid": "fbb69fbfdeb4fc86961feeaebb59e7ef", "score": "0.49309582", "text": "func TestSetDesiredSizeScaledownWhenNotEnoughCandidatesExist(t *testing.T) {\n\tmockCloudPool := new(mocks.CloudPoolClient)\n\tmockNodeScaler := new(mocks.NodeScaler)\n\n\t//\n\t// set up expectations\n\t//\n\n\tdesiredSize := 1\n\n\tmachine1 := NewTestMachine(\"i-1\").SetMachineState(cloudpool.MachineStateRunning).\n\t\tSetMembershipStatus(true, true).ToMachine()\n\tmachine2 := NewTestMachine(\"i-2\").SetMachineState(cloudpool.MachineStateRunning).\n\t\tSetMembershipStatus(true, true).ToMachine()\n\tmachine3 := NewTestMachine(\"i-3\").SetMachineState(cloudpool.MachineStateRunning).\n\t\tSetMembershipStatus(true, true).ToMachine()\n\tmachine4 := NewTestMachine(\"i-4\").SetMachineState(cloudpool.MachineStateRunning).\n\t\tSetMembershipStatus(true, true).ToMachine()\n\n\tpool := &cloudpool.MachinePoolMessage{\n\t\tMachines: []cloudpool.Machine{*machine1, *machine2, *machine3, *machine4},\n\t\tTimestamp: time.Now().UTC(),\n\t}\n\tnode1 := buildTestNode(\"i-1\")\n\tnode2 := buildTestNode(\"i-2\")\n\tnode3 := buildTestNode(\"i-3\")\n\tnode4 := buildTestNode(\"i-4\")\n\n\tkubeWorkers := []*kube.NodeInfo{node1, node2, node3, node4}\n\tmockNodeScaler.On(\"ListWorkerNodes\").Return(kubeWorkers, nil)\n\tmockCloudPool.On(\"GetMachinePool\").Return(pool, nil)\n\t// note: node1 is not a scale-down candidate\n\tmockNodeScaler.On(\"IsScaleDownCandidate\", node1).Return(false, fmt.Errorf(\"node not ready\"))\n\t// note: node2 is not a scale-down candidate\n\tmockNodeScaler.On(\"IsScaleDownCandidate\", node2).Return(false, fmt.Errorf(\"node not ready\"))\n\t// note: node3 is not a scale-down candidate\n\tmockNodeScaler.On(\"IsScaleDownCandidate\", node3).Return(false, fmt.Errorf(\"node not ready\"))\n\tmockNodeScaler.On(\"IsScaleDownCandidate\", node4).Return(true, nil)\n\tmockNodeScaler.On(\"NodeLoad\", node4).Return(0.3, nil)\n\t// note: should only pick node4 for deletion\n\tmockNodeScaler.On(\"DrainNode\", node4).Return(nil)\n\tmockNodeScaler.On(\"DeleteNode\", node4).Return(nil)\n\tmockCloudPool.On(\"TerminateMachine\", \"i-4\", true).Return(nil)\n\n\tproxy := New(mockCloudPool, mockNodeScaler)\n\terr := proxy.SetDesiredSize(desiredSize)\n\tassert.Nil(t, err, \"SetDesiredSize failed unexpectedly\")\n\n\t// verify that expected calls were made on the clients\n\tmockCloudPool.AssertExpectations(t)\n\tmockNodeScaler.AssertExpectations(t)\n}", "title": "" } ]
fb8d037af87796b9e24f34506d2e1c02
GenerateSecretToken generates secret token for application
[ { "docid": "e0fabbeb243ceca0c3f0ccb144179142", "score": "0.7726188", "text": "func GenerateSecretToken(str string) (string, string) {\n\thash, err := bcrypt.GenerateFromPassword([]byte(str), bcrypt.DefaultCost)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\thasher := md5.New()\n\t_, _ = hasher.Write(hash)\n\treturn string(hash), hex.EncodeToString(hasher.Sum(nil))\n}", "title": "" } ]
[ { "docid": "5b3848a73cc5ebb448579f046c7d6155", "score": "0.75356597", "text": "func GenerateGameTokenSecret() string {\n\th := sha1.New()\n\tio.WriteString(h, makeRandomString()+\"game_token_secret_salt\")\n\treturn hex.EncodeToString(h.Sum(nil))\n}", "title": "" }, { "docid": "cb21e0ddd8bad902e92f2482c84abcf4", "score": "0.7299704", "text": "func GenerateToken(userID int) string {\n\tcfg := config.GetJwtConfig()\n\ttoken := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{\n\t\t\"exp\": time.Now().Unix() + cfg.Lifetime,\n\t\t\"id\": userID,\n\t})\n\n\t// Sign and get the complete encoded token as a string using the secret\n\ttokenString, _ := token.SignedString([]byte(cfg.Secret))\n\n\treturn tokenString\n}", "title": "" }, { "docid": "28e968e4ee7fb25c0dad5d46e437a8fb", "score": "0.7279342", "text": "func generateToken(key []byte) string {\n\tsecretKey := []byte(key)\n\tclaims := &jwt.StandardClaims{\n\t\tExpiresAt: time.Now().Add(time.Hour * time.Duration(1)).Unix(),\n\t\tIssuer: \"APId2js898ilsje6272g726g072gso\",\n\t\tIssuedAt: time.Now().Unix(),\n\t}\n\ttoken := jwt.NewWithClaims(jwt.SigningMethodHS256, claims) //Incorporar informações do usuário ao token\n\ttokenstring, err := token.SignedString(secretKey) // token -> string. Only server knows this secret (wsitesb).\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\treturn tokenstring\n}", "title": "" }, { "docid": "770d4b5ecc30897cc96070f98f4888b1", "score": "0.71379954", "text": "func GenerateToken(fileId, secret string, expireTimestamp string) string {\n\treturn gox.Md5Sum(expireTimestamp, fileId, secret)\n}", "title": "" }, { "docid": "9b263379c8ee0b43de76b3f7709f1d79", "score": "0.7122097", "text": "func GenerateToken(sessionId string, expireAt time.Time, secret string) string {\n\tts := strconv.FormatInt(expireAt.Unix(), 10)\n\tcontents := tokenContents(sessionId, ts)\n\n\tvar tsb strings.Builder\n\ttsb.WriteString(hmacToken(contents, secret))\n\ttsb.WriteString(TokenTimestampSeparator)\n\ttsb.WriteString(ts)\n\n\treturn tsb.String()\n}", "title": "" }, { "docid": "7768c9ce73140dcc1ee1e794fdf82fef", "score": "0.7093559", "text": "func (s Signer) generateToken(message string) string {\n\thash := sha1.New()\n\thash.Write([]byte(s.Secret))\n\tkey := hash.Sum(nil)\n\tmac := hmac.New(sha1.New, key)\n\tmac.Write([]byte(message))\n\tdigest := base64.StdEncoding.EncodeToString(mac.Sum(nil))\n\treturn s.urlSafe(digest)\n}", "title": "" }, { "docid": "ac276c1f7773c49088fe091341c05f6c", "score": "0.7065748", "text": "func genToken(claims jwt.Claims, secret string) (string, error) {\n\tconst errorWhere = \"RetrieveToken\"\n\tvar err error\n\tvar token *jwt.Token\n\tvar tokenString string\n\n\t// create the token\n\ttoken = jwt.NewWithClaims(jwt.SigningMethodHS256, claims)\n\n\t/* Sign the token with our secret */\n\ttokenString, err = token.SignedString([]byte(secret))\n\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"internal server error: fail to generate token\")\n\t}\n\treturn tokenString, nil\n}", "title": "" }, { "docid": "b40db6156d9a2143f346fb059d37621e", "score": "0.6973028", "text": "func GenerateToken(uid string) (string, error) {\n\tclaims := Claims{\n\t\tuid,\n\t\tjwt.StandardClaims{\n\t\t\tExpiresAt: time.Now().Add(TokenTimeout).Unix(),\n\t\t\tIssuer: \"server\",\n\t\t},\n\t}\n\ttoken := jwt.NewWithClaims(jwt.SigningMethodHS256, claims)\n\treturn token.SignedString([]byte(SigningKey))\n}", "title": "" }, { "docid": "d23899e9f303349554103d6a16e92f0b", "score": "0.69475454", "text": "func GenerateToken(user models.User) (string, error) {\n\tsecret := os.Getenv(\"APP_SECRET\")\n\n\ttoken := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{\n\t\t\"email\": user.Email,\n\t\t\"iss\": \"jwtCourse\",\n\t})\n\n\ttokenString, err := token.SignedString([]byte(secret))\n\tif err != nil {\n\t\tLogFatal(err)\n\t}\n\treturn tokenString, nil\n\n}", "title": "" }, { "docid": "8105d06f4b69a94cd15bae6288affbf6", "score": "0.6935987", "text": "func GenerateToken(user model.User) (string, error) {\n\n\ttoken := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{\n\t\t\"email\": user.Email,\n\t\t\"iss\": \"course\",\n\t})\n\n\ttokenString, err := token.SignedString([]byte(os.Getenv(\"SECRET\")))\n\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\treturn tokenString, nil\n}", "title": "" }, { "docid": "09f2e76b9d16b7db3e99b54bd526cf62", "score": "0.6926994", "text": "func GenerateToken(secretKey string, expiryDuration time.Duration, tokenClaims map[string]interface{}) (string, error) {\n\ttoken := jwt.New(jwt.SigningMethodHS256)\n\n\t// Set claims\n\tclaims := token.Claims.(jwt.MapClaims)\n\n\tfor key, val := range tokenClaims {\n\t\tclaims[key] = val\n\t}\n\n\tif _, ok := claims[\"exp\"]; ok {\n\t\treturn \"\", errors.New(\"cannot set exp from outside jwt.GenerateToken\")\n\t}\n\n\tclaims[\"exp\"] = time.Now().Add(expiryDuration).Unix()\n\n\t// Generate encoded token and send it as response.\n\tt, err := token.SignedString([]byte(secretKey))\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"unable to sign token\")\n\t}\n\n\treturn t, nil\n}", "title": "" }, { "docid": "4301a91bc95eb87801534ddb5dffce6a", "score": "0.6926496", "text": "func GenerateToken(payload map[string]string) (string, error) {\n\tmySigningKey := []byte(os.Getenv(\"JWT_KEY\"))\n\ttoken := jwt.New(jwt.SigningMethodHS256)\n\tclaims := token.Claims.(jwt.MapClaims)\n\tclaims[\"authorized\"] = true\n\tclaims[\"public\"] = payload\n\tclaims[\"exp\"] = time.Now().Add(time.Minute * 30).Unix()\n\ttokenString, err := token.SignedString(mySigningKey)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn tokenString, nil\n}", "title": "" }, { "docid": "cee76d547929368aef686e1e0b0b3ad4", "score": "0.6925276", "text": "func GenerateToken(qs string) (token string) {\n\tapiSecret := os.Getenv(\"URLBOX_SECRET\")\n\tkey := []byte(apiSecret)\n\th := hmac.New(sha1.New, key)\n\th.Write([]byte(qs))\n\ttoken = hex.EncodeToString(h.Sum(nil))\n\treturn\n}", "title": "" }, { "docid": "8ee0c253b2ace238738afd84ccac5371", "score": "0.68640906", "text": "func GenerateToken(user *models.User) (string, error) {\n\n\t// Create token\n\ttokenSeed := jwt.New(jwt.SigningMethodHS256)\n\n\t// Set claims\n\tclaims := tokenSeed.Claims.(jwt.MapClaims)\n\tclaims[\"data\"] = user\n\n\t// Generate encoded token and send it as response.\n\ttoken, err := tokenSeed.SignedString([]byte(config.GetConfig()[\"JWT_SECRET\"]))\n\tif err != nil {\n\t\treturn \"\", ErrorHandler(500, \"An error occured, pls try again.\")\n\t}\n\treturn token, nil\n}", "title": "" }, { "docid": "3358d43781e889cb8063ff3c6e72ac7d", "score": "0.6862715", "text": "func (ga *GoogleAuthenticator) GenerateSecret() (string, error) {\n\tvar buf bytes.Buffer\n\t_ = binary.Write(&buf, binary.BigEndian, time.Now().UnixNano()/1000/30)\n\tsecret := strings.ToUpper(base32.StdEncoding.EncodeToString(ga.hmacSha1(buf.Bytes(), nil)))\n\treturn secret, nil\n}", "title": "" }, { "docid": "d786d436afeb8dba2f666667ecccd3fe", "score": "0.6758011", "text": "func GenerateToken(user *entities.User) (string, error) {\n\texpiresAt := time.Now().Add(time.Minute * 100000).Unix()\n\ttokenClaims := &payloadmodels.Token{\n\t\tID: user.ID.String(),\n\t\tName: user.NAME,\n\t\tEmail: user.EMAIL,\n\t\tStandardClaims: &jwt.StandardClaims{\n\t\t\tExpiresAt: expiresAt,\n\t\t},\n\t}\n\tencodedToken := jwt.NewWithClaims(jwt.GetSigningMethod(\"HS256\"), tokenClaims)\n\ttoken, err := encodedToken.SignedString([]byte(\"secret\"))\n\tif err != nil {\n\t\tfmt.Println(\"Error occurred while hashing password\", err)\n\t\treturn \"\", err\n\t}\n\treturn token, nil\n}", "title": "" }, { "docid": "66adf9fcaa8b52c98ac8de7577beab1d", "score": "0.6743428", "text": "func GenerateToken(ctx context.Context, fbApiKey string, fbAuth *auth.Client, uid string) (string, error) {\n\tcustomToken, err := fbAuth.CustomToken(ctx, uid)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treqByte, _ := json.Marshal(struct {\n\t\tToken string `json:\"token\"`\n\t\tReturnSecureToken bool `json:\"returnSecureToken\"`\n\t}{\n\t\tcustomToken,\n\t\ttrue,\n\t})\n\treqBody := bytes.NewReader(reqByte)\n\turi := fmt.Sprintf(\"https://www.googleapis.com/identitytoolkit/v3/relyingparty/verifyCustomToken?key=%s\", fbApiKey)\n\tresp, err := http.DefaultClient.Post(uri, \"application/json\", reqBody)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tvar respJSON map[string]interface{}\n\terr = json.Unmarshal(body, &respJSON)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tjwt, ok := respJSON[\"idToken\"]\n\tif !ok {\n\t\treturn \"\", fmt.Errorf(\"idToken %w\", project.NotFound)\n\t}\n\n\treturn fmt.Sprintf(\"%s\", jwt), nil\n}", "title": "" }, { "docid": "55272aac6b87837696e321182f064269", "score": "0.67432594", "text": "func Generate(payload *TokenPayload) string {\n\tv, err := time.ParseDuration(os.Getenv(\"TOKEN_EXPIRATION\"))\n\tif err != nil {\n\t\tpanic(\"Invalid time duration. Should be time.ParseDuration string\")\n\t}\n\tt := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{\n\t\t\"exp\": time.Now().Add(v).Unix(),\n\t\t\"ID\": payload.ID,\n\t})\n\ttoken, err := t.SignedString([]byte(os.Getenv(\"TOKEN_SECRET\")))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn token\n}", "title": "" }, { "docid": "cf80b0d2fabaeb1471560e9f5492f96c", "score": "0.6742957", "text": "func GenerateToken(userID string) (string, error) {\n\texpirationTime := time.Now().Add(1440 * time.Minute)\n\n\tclaims := &Claims{\n\t\t\tUserID: userID,\n\t\t\tStandardClaims: jwt.StandardClaims{\n\t\t\t\tExpiresAt: expirationTime.Unix(),\n\t\t\t},\n\t}\n\n\ttoken := jwt.NewWithClaims(jwt.SigningMethodHS256, claims)\n\n\ttokenString, err := token.SignedString(jwtKey)\n\n\treturn tokenString, err\n}", "title": "" }, { "docid": "1632c31f3235cb1e1243389ed7e82b80", "score": "0.67174107", "text": "func (u *User) GenerateToken(ID uint) (string, error) {\n\tclaims := jwt.MapClaims{}\n\tclaims[\"authorized\"] = true\n\tclaims[\"user_id\"] = ID\n\tclaims[\"exp\"] = time.Now().Add(time.Hour * 72).Unix()\n\tgodotenv.Load()\n\ttoken, err := jwt.NewWithClaims(jwt.SigningMethodHS256, claims).SignedString([]byte(os.Getenv(\"JWT_SECRET\")))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn token, nil\n}", "title": "" }, { "docid": "f653e8821dd105a75645affd7c9aa55f", "score": "0.6689166", "text": "func createToken(user *models.WriterInfo) (string, error) {\n\n\tsecret := os.Getenv(\"SECRET\")\n\n\tclaims := newClaimsMap(user)\n\n\tnewToken := jwt.NewWithClaims(jwt.SigningMethodHS256, claims)\n\n\tsignedToken, err := newToken.SignedString([]byte(secret))\n\tif err != nil {\n\t\treturn \"\", err\n\t} else {\n\t\treturn signedToken, nil\n\t}\n}", "title": "" }, { "docid": "d0268c9c40213cfcb8fc5fbe032a13c8", "score": "0.66812307", "text": "func GenToken(log *log.Logger) error {\n\tprivatePEM, err := ioutil.ReadFile(\"./private.pem\")\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"reading PEM private key file\")\n\t}\n\n\tprivateKey, err := jwt.ParseRSAPrivateKeyFromPEM(privatePEM)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"parsing PEM into private key\")\n\t}\n\n\tclaims := struct {\n\t\tjwt.StandardClaims\n\t\tRoles []string\n\t}{\n\t\tStandardClaims: jwt.StandardClaims{\n\t\t\tIssuer: \"class project\",\n\t\t\tSubject: \"5cf37266-3473-4006-984f-9325122678b7\",\n\t\t\tExpiresAt: time.Now().Add(8760 * time.Hour).Unix(),\n\t\t\tIssuedAt: time.Now().Unix(),\n\t\t},\n\t\tRoles: []string{\"ADMIN\"},\n\t}\n\n\talgorithm := \"RS256\"\n\tmethod := jwt.GetSigningMethod(algorithm)\n\ttoken := jwt.NewWithClaims(method, claims)\n\ttoken.Header[\"kid\"] = \"54bb2165-71e1-41a6-af3e-7da4a0e1e2c1\"\n\n\tstr, err := token.SignedString(privateKey)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"signing token\")\n\t}\n\n\tfmt.Printf(\"-----BEGIN TOKEN-----\\n%s\\n-----END TOKEN-----\\n\", str)\n\treturn nil\n}", "title": "" }, { "docid": "4519c2a14e91f81c9a0194018df78a3a", "score": "0.6676694", "text": "func GenerateToken(user models.User) (string, error) {\n\tsecret := os.Getenv(\"APP_DB_SECRET\") //secret of the token\n\t//first param is the algorithm, second: struct of the claims we want to use\n\ttoken := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{\n\t\t\"email\": user.Email, //Email\n\t\t\"iss\": \"course\", //Issuer\n\t})\n\t//To generate toekn string for the clients\n\ttokenString, err := token.SignedString([]byte(secret))\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\treturn tokenString, err\n}", "title": "" }, { "docid": "555c6b14b7608110248a7ef8673f942a", "score": "0.6673522", "text": "func GenerateToken(username string) (string, error) {\n\ttoken := jwt.New(jwt.SigningMethodHS256)\n\tclaims := token.Claims.(jwt.MapClaims)\n\n\tclaims[\"username\"] = username\n\tclaims[\"exp\"] = time.Now().Add(time.Hour * 24).Unix()\n\ttokenString, err := token.SignedString(SECRET_KEY)\n\tif err != nil {\n\t\tlog.Fatal(\"Error in generating key\")\n\t\treturn \"\", err\n\t}\n\n\treturn tokenString, nil\n}", "title": "" }, { "docid": "ff3ca59537a3c98bcdb47f04c901c02e", "score": "0.6664299", "text": "func CreateToken(c *gin.Context) {\n\ttoken := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{\n\t\t\"foo\": \"bar\",\n\t\t\"nbf\": time.Date(2015, 10, 10, 12, 0, 0, 0, time.UTC).Unix(),\n\t})\n\n\t// Sign and get the complete encoded token as a string using the secret\n\ttokenString, err := token.SignedString(hmacSampleSecret)\n\n\tfmt.Println(tokenString, err)\n}", "title": "" }, { "docid": "d2dda94ea1b387b48ce553b2632cf399", "score": "0.6642486", "text": "func GenerateToken() AuthenticationTokenPair {\n\treturn AuthenticationTokenPair{\n\t\tAccessToken: uuid.NewV4().String(),\n\t\tRefreshToken: uuid.NewV4().String(),\n\t}\n}", "title": "" }, { "docid": "e88735c063417acb3c925a2ad99bba2e", "score": "0.6612658", "text": "func GenerateToken(id uint, username string, w http.ResponseWriter) string {\n\tclaims := userClaim{\n\t\tid,\n\t\tusername,\n\t\tjwt.StandardClaims{\n\t\t\tIssuedAt: time.Now().Unix(),\n\t\t},\n\t}\n\ttokenInstance := jwt.NewWithClaims(jwt.SigningMethodHS256, claims)\n\ttoken, err := tokenInstance.SignedString([]byte(config.Conf.KeyJWT))\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn \"null\"\n\t}\n\treturn token\n}", "title": "" }, { "docid": "ee80b69e3e562b53d188a5d11ce6d963", "score": "0.660742", "text": "func GenerateToken(user *models.Examinees) (string, error) {\n\tnowTime := time.Now()\n\texpireTime := nowTime.Add(24 * time.Hour)\n\n\tstdClaims := jwt.StandardClaims{\n\t\tExpiresAt: expireTime.Unix(),\n\t\tIssuedAt: time.Now().Unix(),\n\t\tIssuer: \"exam\",\n\t\tId: fmt.Sprintf(\"%d\", user.ID),\n\t}\n\n\tclaims := Claims{\n\t\tStandardClaims: stdClaims,\n\t\tExaminees: user,\n\t}\n\n\ttokenClaims := jwt.NewWithClaims(jwt.SigningMethodHS256, claims)\n\ttoken, err := tokenClaims.SignedString(jwtSecret)\n\n\treturn token, err\n}", "title": "" }, { "docid": "937df7c6dcc4bffa59652588e44f741d", "score": "0.66047907", "text": "func GenerateToken(email string, accessTokenDuration int64, refreshTokenDuration int64) (*pb.Token, error) {\n\t// generate access token\n\taccessClaims := &JwtAccessClaims{\n\t\tEmail: email,\n\t\t// Since the UUID is unique each time it is created, a use can create more than one token.\n\t\t// This happens when a user is logged in on different devices.\n\t\t// The user can also logout from any of the devices without being logged out from all devices.\n\t\tAccessUUID: uuid.NewV4().String(),\n\t\tStandardClaims: jwt.StandardClaims{\n\t\t\tExpiresAt: time.Now().Local().Add(time.Duration(accessTokenDuration) * time.Minute).Unix(),\n\t\t\tIssuer: Issuer,\n\t\t},\n\t}\n\n\ttoken := jwt.NewWithClaims(jwt.SigningMethodHS256, accessClaims)\n\taccessToken, err := token.SignedString([]byte(AccessSecretKey))\n\n\tif err != nil {\n\t\treturn nil, status.Errorf(codes.Internal, \"could not sign access token\")\n\t}\n\n\t// generate refresh token\n\trefreshClaims := &JwtRefreshClaims{\n\t\tEmail: email,\n\t\tRefreshUUID: uuid.NewV4().String(),\n\t\tStandardClaims: jwt.StandardClaims{\n\t\t\tExpiresAt: time.Now().Local().Add(time.Duration(refreshTokenDuration) * time.Minute).Unix(),\n\t\t\tIssuer: Issuer,\n\t\t},\n\t}\n\n\ttoken = jwt.NewWithClaims(jwt.SigningMethodHS256, refreshClaims)\n\trefreshToken, err := token.SignedString([]byte(RefreshSecretKey))\n\n\tif err != nil {\n\t\treturn nil, status.Errorf(codes.Internal, \"could not sign refresh token\")\n\t}\n\n\treturn &pb.Token{\n\t\tAccessToken: accessToken,\n\t\tAccessTokenExpires: accessClaims.ExpiresAt,\n\t\tAccessUuid: accessClaims.AccessUUID,\n\t\tRefreshToken: refreshToken,\n\t\tRefreshTokenExpires: refreshClaims.ExpiresAt,\n\t\tRefreshUuid: refreshClaims.RefreshUUID,\n\t}, status.New(codes.OK, \"\").Err()\n}", "title": "" }, { "docid": "75a633e6128c1a2ae972f4a81c2551df", "score": "0.6598238", "text": "func GenerateApplicationSecretKey(application *entity.Application) string {\n\t// Generate a random salt for the token\n\tkeySalt := GenerateRandomSecureString(20)\n\n\t// Generate the token itself\n\thasher := md5.New()\n\thasher.Write([]byte(fmt.Sprintf(\n\t\t\"%d%s%s\",\n\t\tapplication.OrgID,\n\t\tkeySalt,\n\t\tapplication.CreatedAt.Format(time.RFC3339),\n\t)))\n\treturn fmt.Sprintf(\"%x\", hasher.Sum(nil))\n}", "title": "" }, { "docid": "a14106bcada527d3873dc9615e67a6b1", "score": "0.6581161", "text": "func CreateToken(userid uint) (string, error) {\n\tvar err error\n\tos.Setenv(\"ACCESS_SECRET\", \"jdnfksdmfksd\")\n\tatClaims := jwt.MapClaims{}\n\tatClaims[\"authorized\"] = true\n\tatClaims[\"user_id\"] = userid\n\tatClaims[\"exp\"] = time.Now().Add(time.Minute * 15).Unix()\n\tat := jwt.NewWithClaims(jwt.SigningMethodHS256, atClaims)\n\ttoken, err := at.SignedString([]byte(os.Getenv(\"ACCESS_SECRET\")))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn token, nil\n}", "title": "" }, { "docid": "ea464daebbb6d9631f5f6678c796d040", "score": "0.65751135", "text": "func GenerateToken(usuario models.Usuario) (string, error) {\n\tvar err error\n\tsecret := \"secret\"\n\n\ttoken := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{\n\t\t\"email\": usuario.Email,\n\t\t\"iss\": \"crmplus\",\n\t})\n\n\ttokenString, err := token.SignedString([]byte(secret))\n\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\treturn tokenString, nil\n}", "title": "" }, { "docid": "56c12bea15beabcd051842dbfc14d432", "score": "0.6568322", "text": "func GenerateToken(claims UkuOfferBackendClaims) (string, error) {\n\tnowTime := time.Now()\n\t//expireTime := nowTime.Add(time.Duration(setting.AppSetting.TokenExpireTime) * time.Hour) // 1一个小时的过期时间\n\t//设置token过期时间\n\tclaims.ExpiresAt = nowTime.Add(time.Duration(setting.AppSetting.TokenExpireTime)).Unix()\n\tclaims.Issuer = \"uku_backend\"\n\ttokenClaims := jwt.NewWithClaims(jwt.SigningMethodHS256, claims)\n\ttoken, err := tokenClaims.SignedString(jwtSecret)\n\n\terr = SetCacheToken(claims.ID, token)\n\tif err != nil {\n\t\tlogf.Error(\"token_cache.SetCacheToken:\", err)\n\t}\n\treturn token, err\n}", "title": "" }, { "docid": "c308e08ee156312bf1424031b59d5cd5", "score": "0.6557378", "text": "func (c *Client) GenerateToken(ctx context.Context) (*GenerateTokenResponse, error) {\n\tc.init()\n\n\tgoLiveDate, _ := time.Parse(\"2006-01-02\", \"2020-12-06\")\n\tif !time.Now().After(goLiveDate) {\n\t\tresponse, err := c.GenerateTokenLegacy(ctx)\n\t\tif err == nil {\n\t\t\treturn response, nil\n\t\t}\n\t\tif c.AccountID == \"\" || c.UserID == \"\" {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tresponse, err := c.GenerateToken2020(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar returnValue GenerateTokenResponse\n\treturnValue.AccessToken = response.AccessToken\n\treturnValue.TokenType = response.TokenType\n\texpiresIn, _ := strconv.ParseInt(response.ExpiresIn, 10, 64)\n\treturnValue.ExpiresIn = int(expiresIn)\n\n\treturn &returnValue, nil\n}", "title": "" }, { "docid": "b8a76abe40b10ee4b3293e18b64cbebe", "score": "0.65558535", "text": "func GenerateJWTToken(data string, timestamp int64, secret string) (string, error) {\n\n\ttoken := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{\n\t\t\"data\": data,\n\t\t\"timestamp\": timestamp,\n\t})\n\n\ttokenString, err := token.SignedString([]byte(secret))\n\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn tokenString, nil\n}", "title": "" }, { "docid": "b387fdcabfda01c1ca1b3f9d079e0dc3", "score": "0.65549463", "text": "func generateToken() (string, error) {\n\tb := make([]byte, 64) // 512 bit token should be enough for anyone :)\n\t_, err := rand.Read(b)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// The \"=\" at the end can get lost when emailing links for some reason\n\t// so ensure that there are no \"=\" at the end for linking or storing.\n\treturn strings.TrimRight(base64.URLEncoding.EncodeToString(b), \"=\"), nil\n}", "title": "" }, { "docid": "9e78aa9e3cf701999603fce56ea0b844", "score": "0.652927", "text": "func GenerateToken() (string, error) {\n\ttokenID, err := randBytes(TokenIDBytes)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\ttokenSecret, err := randBytes(TokenSecretBytes)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn fmt.Sprintf(\"%s.%s\", tokenID, tokenSecret), nil\n}", "title": "" }, { "docid": "caaac553879561d7800349c610f8ac30", "score": "0.6524745", "text": "func GenerateToken(uid string, username string) (token string, err error) {\n\tvar (\n\t\tnow time.Time\n\t\texpireTime time.Time\n\t\tclaims Claims\n\t\ttokenClaims *jwt.Token\n\t)\n\tnow = time.Now()\n\texpireTime = now.Add(7 * 24 * time.Hour)\n\n\tclaims = Claims{\n\t\tUID: uid,\n\t\tUserName: username,\n\t\tStandardClaims: jwt.StandardClaims{\n\t\t\tExpiresAt: expireTime.Unix(),\n\t\t\tIssuer: \"crocodile\",\n\t\t},\n\t}\n\ttokenClaims = jwt.NewWithClaims(jwt.SigningMethodHS256, claims)\n\ttoken, err = tokenClaims.SignedString([]byte(secret))\n\n\treturn\n}", "title": "" }, { "docid": "8ef5025c026b12e22b9a98be2d93dca1", "score": "0.6515866", "text": "func CreateToken(userid uint64) (string, error) {\n var err error\n //Creating Access Token\n atClaims := jwt.MapClaims{}\n atClaims[\"authorized\"] = true\n atClaims[\"user_id\"] = userid\n // atClaims[\"exp\"] = time.Now().Add(time.Minute * 60 * 24 * 2).Unix()\n at := jwt.NewWithClaims(jwt.SigningMethodHS256, atClaims)\n token, err := at.SignedString([]byte(os.Getenv(\"ACCESS_SECRET\")))\n if err != nil {\n // ErrCreateToken.Error()\n return \"\", ErrCreateToken\n }\n return token, nil\n}", "title": "" }, { "docid": "6d7a2250c9e05b69da428bb81cf0ed9e", "score": "0.6515786", "text": "func (a *Authenticator) GenerateToken(claims Claims) (string, error) {\n\tmethod := jwt.GetSigningMethod(a.algorithm)\n\n\ttkn := jwt.NewWithClaims(method, claims)\n\ttkn.Header[\"kid\"] = a.keyID\n\n\tstr, err := tkn.SignedString(a.privateKey.PrivateKey)\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"signing token\")\n\t}\n\n\treturn str, nil\n}", "title": "" }, { "docid": "164559c6f05e3ca2ddddb469cf3ba725", "score": "0.65017956", "text": "func GenerateApplicationToken() string {\n\treturn generateRandomToken(applicationPrefix)\n}", "title": "" }, { "docid": "e2e217f2fd33fc7c8fb3816ce4f6b331", "score": "0.64946926", "text": "func GenerateJWT(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) {\n\texpireToken := time.Now().AddDate(0, 3, 0).Unix()\n\n\tclaims := Claims{\n\t\tLogin(r.Context()),\n\t\tjwt.StandardClaims{\n\t\t\tExpiresAt: expireToken,\n\t\t},\n\t}\n\n\ttoken := jwt.NewWithClaims(jwt.SigningMethodHS256, claims)\n\t// TODO: read secret from cofig file\n\tsignedToken, err := token.SignedString(secret)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusAccepted)\n\tw.Write([]byte(signedToken))\n\n\tnext(w, r)\n}", "title": "" }, { "docid": "adef671a1ea7a9e450758cb41dca16a2", "score": "0.6490645", "text": "func (c *FusionAuthClient) GenerateTwoFactorSecretUsingJWT(encodedJWT string) (interface{}, error) {\n\tvar body interface{}\n\turi := \"/api/two-factor/secret\"\n\tmethod := http.MethodGet\n\treq, err := c.NewRequest(method, uri, body)\n\treq.Header.Set(\"Authorization\", \"JWT \"+encodedJWT)\n\tvar resp interface{}\n\t_, err = c.Do(req, &resp)\n\treturn resp, err\n}", "title": "" }, { "docid": "fd83e951a7f4eb544ca63cd0192d8294", "score": "0.6477983", "text": "func GenToken(organizationID, departmentID int64, departmentName string) (string, error) {\n\t// Create our own statement\n\tc := WebClaims{\n\t\tdepartmentID,\n\t\t// Customization\n\t\torganizationID,\n\t\tdepartmentName,\n\t\tjwt.StandardClaims{\n\t\t\tExpiresAt: time.Now().Add(TokenExpireDuration).Unix(), // 过期时间\n\t\t\tIssuer: \"uapply_go\", // 签发人\n\t\t},\n\t}\n\t// Create a signature object using the SigningMethodHS256 signature method\n\ttoken := jwt.NewWithClaims(jwt.SigningMethodHS256, c)\n\t// Use the specified seek signature and get the fully encoded token\n\treturn token.SignedString(mySercet)\n}", "title": "" }, { "docid": "57bbae7b41696e896d3e2e0a7d0305da", "score": "0.6464303", "text": "func (s *Proxy) generateToken() string {\n\tmrand.Seed(time.Now().UnixNano())\n\tb := make([]byte, 32)\n\tmrand.Read(b)\n\treturn fmt.Sprintf(\"%x\", b)\n}", "title": "" }, { "docid": "97e151d14f7c0b62ce182b97cb7ab9a5", "score": "0.64606", "text": "func GenerateOauth2JWTToken(sd *TokenSigningData, remoteSourceName string) (string, error) {\n\treturn GenerateGenericJWTToken(sd, jwt.MapClaims{\n\t\t\"exp\": time.Now().Add(time.Duration(sd.Duration) * time.Second).Unix(),\n\t\t\"git_source_name\": remoteSourceName,\n\t})\n}", "title": "" }, { "docid": "eff0e320953c19a7f70ac44205067aba", "score": "0.641948", "text": "func GenerateToken(id string, action string) (token string, err error) {\n\t// Tiempo de expiracion del Token, 1 semana\n\t// expireToken := time.Now().Add(time.Hour * 24 * 7).Unix()\n\n\t// Se crea la estructura del Payload.\n\tclaims := Claims{\n\t\tID: id,\n\t\tAction: action,\n\t}\n\n\t// Se genera el token y se firma.\n\ttokenKey := jwt.NewWithClaims(jwt.SigningMethodHS256, claims)\n\ttoken, err = tokenKey.SignedString([]byte(SigningKey))\n\tif err!=nil{\n\t\tfmt.Printf(\"Error generating token: %s \\n\",err.Error())\n\t\treturn\n\t}\n\tfmt.Printf(\"Token generated: %s \\n\",token)\n\treturn\n}", "title": "" }, { "docid": "96107059b061ffeacd2a321c66816006", "score": "0.6418273", "text": "func GenToken(str string) string {\n\treturn GeneredHashSha256(StrRand(len(str), false) + string(rune(time.Now().Second())))\n}", "title": "" }, { "docid": "5473198b7814c1c307089f3bbbc69da2", "score": "0.6409507", "text": "func (gen *JwtTokenGenerator) GenerateToken(sub string, expires int) (string, error) {\n\n\tvar claims = &jwt.StandardClaims{\n\t\tSubject: sub,\n\t\tExpiresAt: time.Now().Unix() + int64(expires),\n\t\tIssuer: \"Civil\",\n\t}\n\n\ttoken := jwt.NewWithClaims(jwt.SigningMethodHS256, claims)\n\n\t// Sign and get the complete encoded token as a string using the secret\n\ttokenString, err := token.SignedString(gen.Secret)\n\n\treturn tokenString, err\n}", "title": "" }, { "docid": "1e4e53b14773f57aebb1fe37f1be2e69", "score": "0.64076215", "text": "func GenerateSecret(secretName string) *domain.Secret {\n\tvar checksum string\n\tfor _, v := range config.StringData {\n\t\tchecksum += v\n\t}\n\tsecret := &domain.Secret{\n\t\tName: secretName,\n\t\tNamespace: config.SecretNamespace,\n\t\tChecksum: createCheckSum(checksum),\n\t\tData: config.StringData,\n\t\tLabels: config.Labels,\n\t\tAnnotations: config.Annotations,\n\t}\n\treturn secret\n}", "title": "" }, { "docid": "57d3fc6097406c8cb2137ec0c720e545", "score": "0.63991475", "text": "func GenerateJWTToken(secretKey []byte, mapClaims jwt.MapClaims) (signedToken string, signingErr error) {\n\ttoken := jwt.NewWithClaims(jwt.SigningMethodHS256, mapClaims)\n\tsignedToken, signingErr = token.SignedString(secretKey)\n\treturn\n}", "title": "" }, { "docid": "f0d7aefffcb16fa0e307fe94ef56a661", "score": "0.63888896", "text": "func (p *AccountClient) GenerateJWTToken(ctx context.Context, traceId string, input *inputs.JWTInput, secretKey string, expired int32) (r string, err error) {\n var _args14 AccountGenerateJWTTokenArgs\n _args14.TraceId = traceId\n _args14.Input = input\n _args14.SecretKey = secretKey\n _args14.Expired = expired\n var _result15 AccountGenerateJWTTokenResult\n if err = p.c.Call(ctx, \"GenerateJWTToken\", &_args14, &_result15); err != nil {\n return\n }\n switch {\n case _result15.Status!= nil:\n return r, _result15.Status\n }\n\n return _result15.GetSuccess(), nil\n}", "title": "" }, { "docid": "faa482d83868cf269382550ea7d54136", "score": "0.63881", "text": "func (e *DockercfgController) createTokenSecret(serviceAccount *v1.ServiceAccount) (*v1.Secret, bool, error) {\n\tpendingTokenName := serviceAccount.Annotations[PendingTokenAnnotation]\n\n\t// If this service account has no record of a pending token name, record one\n\tif len(pendingTokenName) == 0 {\n\t\tpendingTokenName = secret.Strategy.GenerateName(getTokenSecretNamePrefix(serviceAccount.Name))\n\t\tif serviceAccount.Annotations == nil {\n\t\t\tserviceAccount.Annotations = map[string]string{}\n\t\t}\n\t\tserviceAccount.Annotations[PendingTokenAnnotation] = pendingTokenName\n\t\tupdatedServiceAccount, err := e.client.Core().ServiceAccounts(serviceAccount.Namespace).Update(serviceAccount)\n\t\t// Conflicts mean we'll get called to sync this service account again\n\t\tif kapierrors.IsConflict(err) {\n\t\t\treturn nil, false, nil\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, false, err\n\t\t}\n\t\tserviceAccount = updatedServiceAccount\n\t}\n\n\t// Return the token from cache\n\texistingTokenSecretObj, exists, err := e.secretCache.GetByKey(serviceAccount.Namespace + \"/\" + pendingTokenName)\n\tif err != nil {\n\t\treturn nil, false, err\n\t}\n\tif exists {\n\t\texistingTokenSecret := existingTokenSecretObj.(*v1.Secret)\n\t\treturn existingTokenSecret, len(existingTokenSecret.Data[v1.ServiceAccountTokenKey]) > 0, nil\n\t}\n\n\t// Try to create the named pending token\n\ttokenSecret := &v1.Secret{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: pendingTokenName,\n\t\t\tNamespace: serviceAccount.Namespace,\n\t\t\tAnnotations: map[string]string{\n\t\t\t\tv1.ServiceAccountNameKey: serviceAccount.Name,\n\t\t\t\tv1.ServiceAccountUIDKey: string(serviceAccount.UID),\n\t\t\t\tDeprecatedKubeCreatedByAnnotation: CreateDockercfgSecretsController,\n\t\t\t},\n\t\t},\n\t\tType: v1.SecretTypeServiceAccountToken,\n\t\tData: map[string][]byte{},\n\t}\n\n\tglog.V(4).Infof(\"Creating token secret %q for service account %s/%s\", tokenSecret.Name, serviceAccount.Namespace, serviceAccount.Name)\n\ttoken, err := e.client.Core().Secrets(tokenSecret.Namespace).Create(tokenSecret)\n\t// Already exists but not in cache means we'll get an add watch event and resync\n\tif kapierrors.IsAlreadyExists(err) {\n\t\treturn nil, false, nil\n\t}\n\tif err != nil {\n\t\treturn nil, false, err\n\t}\n\treturn token, len(token.Data[v1.ServiceAccountTokenKey]) > 0, nil\n}", "title": "" }, { "docid": "087973cc1ff8e80e05a07ec706c95c6d", "score": "0.63853157", "text": "func GenerateToken(clientID string) (map[string]interface{}, error) {\n\tvar result map[string]interface{}\n\n\ttoken, err := createToken(clientID, time.Now().Add(time.Hour*1).Unix())\n\n\tvar refreshToken string\n\tif err == nil {\n\t\trefreshToken, err = createToken(clientID, time.Now().Add(time.Hour*168).Unix())\n\t}\n\n\tif err == nil {\n\t\tresult = map[string]interface{}{\n\t\t\t\"access_token\": token,\n\t\t\t\"token_type\": \"Bearer\",\n\t\t\t\"refresh_token\": refreshToken,\n\t\t}\n\t}\n\n\treturn result, err\n}", "title": "" }, { "docid": "805dc35ba4d5eee11379832b718e6ce8", "score": "0.6380572", "text": "func GenerateToken(length int) (string, error) {\n\tb := make([]byte, length)\n\t_, err := rand.Read(b)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn base64.URLEncoding.EncodeToString(b), err\n}", "title": "" }, { "docid": "a15e53e695b6c14ca3db1302dc8d1054", "score": "0.63782144", "text": "func createToken(sessionID string) (string, error) {\n\tclaim := &UserClaims{\n\t\tStandardClaims: jwt.StandardClaims{\n\t\t\tExpiresAt: time.Now().UTC().Add(sessionExpiry).Unix(),\n\t\t},\n\t\tSessionID: sessionID,\n\t}\n\ttoken := jwt.NewWithClaims(jwt.SigningMethodHS256, claim)\n\t// The key to sign this token needs to be of 32 chars based on the algo chosen here\n\treturn token.SignedString(jwtSigningSecretKey)\n}", "title": "" }, { "docid": "f96d2cfdd02e717c55d6cb436c07245d", "score": "0.63635045", "text": "func (c *Client) GenerateToken() (Token, error) {\n\turl := c.BaseUrl + c.TokenSuffix\n\trep, err := c.Post(url)\n\n\tvar token Token\n\tif err != nil {\n\t\treturn token, err\n\t}\n\n\terr = json.Unmarshal(rep, &token)\n\ttoken.CreatedAt = time.Now().Unix()\n\treturn token, err\n}", "title": "" }, { "docid": "219a6cce0df7900b55a0c8653d69624a", "score": "0.6354034", "text": "func generateSecret(signingKey, teamID, clientID, keyID string, ttlDays int) (string, error) {\n\tblock, _ := pem.Decode([]byte(signingKey))\n\tif block == nil {\n\t\treturn \"\", errors.New(\"empty block after decoding\")\n\t}\n\n\tprivKey, err := x509.ParsePKCS8PrivateKey(block.Bytes)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\t// Create the Claims\n\tnow := time.Now()\n\tclaims := &jwt.StandardClaims{\n\t\tIssuer: teamID,\n\t\tIssuedAt: now.Unix(),\n\t\tExpiresAt: time.Now().AddDate(0,0,ttlDays).Unix(), // ttlDays days\n\t\tAudience: \"https://appleid.apple.com\",\n\t\tSubject: clientID,\n\t}\n\n\ttoken := jwt.NewWithClaims(jwt.SigningMethodES256, claims)\n\ttoken.Header[\"alg\"] = \"ES256\"\n\ttoken.Header[\"kid\"] = keyID\n\n\treturn token.SignedString(privKey)\n}", "title": "" }, { "docid": "c1ba0b10e535016e26733dd88a81e7b7", "score": "0.6351204", "text": "func (c *TwilioClient) GenerateToken(client string, scopeType string, expirationDate time.Time) (string, error) {\n\ttoken := jwt.New(jwt.SigningMethodHS256)\n\n\tscope, err := c.buildScope(scopeType, client)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tclaims := token.Claims.(jwt.MapClaims)\n\tclaims[\"client\"] = client\n\tclaims[\"scope\"] = scope\n\tclaims[\"iss\"] = c.accountSid\n\tclaims[\"exp\"] = expirationDate.Unix()\n\n\treturn token.SignedString([]byte(c.accountSecret))\n}", "title": "" }, { "docid": "d9ddfc57b227d78b03d4596265ffe44e", "score": "0.6347517", "text": "func GenerateSecret(n int) string {\n\tb := make([]byte, base64.URLEncoding.DecodedLen(n))\n\tif _, err := rand.Read(b); err != nil {\n\t\tpanic(err) // rand should never fail\n\t}\n\treturn base64.URLEncoding.EncodeToString(b)\n}", "title": "" }, { "docid": "b2112fcedbd6b73007fcce9cf681cb4e", "score": "0.6344392", "text": "func GenerateJWT(username, roleId string) (string, error) {\n\t// load .env file\n\terr := godotenv.Load()\nif err != nil{\n\tlog.Fatal(\"Error loading .env file\")\n}\n\tvar mySigningKey = []byte(os.Getenv(\"JWT_SECRET\"))\n\tToken := jwt.New(jwt.SigningMethodHS256)\n\tclaims := Token.Claims.(jwt.MapClaims)\n\n\tclaims[\"authorized\"] = true\n\tclaims[\"email\"] = username\n\tclaims[\"roleId\"] = roleId\n\tclaims[\"exp\"] = time.Now().Add(time.Minute * 30).Unix()\n\n\ttokenString, err := Token.SignedString(mySigningKey)\n\tif err != nil {\n\tlog.Fatal(\"Unauthorized!\")\n\t}\n\treturn tokenString, nil\n}", "title": "" }, { "docid": "4a1b529dd45865d517e807915831a878", "score": "0.6342354", "text": "func GenToken(cfg database.Config, id string, privateKeyFile string, algorithm string) error {\n\tif id == \"\" || privateKeyFile == \"\" || algorithm == \"\" {\n\t\tfmt.Println(\"help: gentoken <id> <private_key_file> <algorithm>\")\n\t\tfmt.Println(\"algorithm: RS256, HS256\")\n\t\treturn ErrHelp\n\t}\n\n\tdb, err := database.Open(cfg)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"connect database\")\n\t}\n\tdefer db.Close()\n\n\tctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)\n\tdefer cancel()\n\n\t// The call to retrieve a user requires an Admin role by the caller.\n\tclaims := auth.Claims{\n\t\tStandardClaims: jwt.StandardClaims{\n\t\t\tSubject: \"admin\",\n\t\t},\n\t\tRoles: []string{auth.RoleAdmin},\n\t}\n\tuser, err := user.QueryByID(ctx, claims, db, id)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"retrieve user\")\n\t}\n\n\tprivatePEM, err := ioutil.ReadFile(privateKeyFile)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"reading PEM private key file\")\n\t}\n\n\tprivateKey, err := jwt.ParseRSAPrivateKeyFromPEM(privatePEM)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"parsing PEM into private key\")\n\t}\n\n\t// In a production system, a key id (KID) is used to retrieve the correct\n\t// public key to parse a JWT for auth and claims. A key lookup function is\n\t// provided to perform the task of retrieving a KID for a given public key.\n\t// In this code, I am writing a lookup function that will return the public\n\t// key for the private key provided with an arbitary KID.\n\tkeyID := \"54bb2165-71e1-41a6-af3e-7da4a0e1e2c1\"\n\tkeyLookupFunc := func(publicKID string) (*rsa.PublicKey, error) {\n\t\tswitch publicKID {\n\t\tcase keyID:\n\t\t\treturn &privateKey.PublicKey, nil\n\t\t}\n\t\treturn nil, fmt.Errorf(\"no public key found for the specified kid: %s\", publicKID)\n\t}\n\n\t// An authenticator maintains the state required to handle JWT processing.\n\t// It requires the private key for generating tokens. The KID for access\n\t// to the corresponding public key, the algorithms to use (RS256), and the\n\t// key lookup function to perform the actual retrieve of the KID to public\n\t// key lookup.\n\ta, err := auth.New(privateKey, keyID, algorithm, keyLookupFunc)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"constructing auth\")\n\t}\n\n\t// Generating a token requires defining a set of claims. In this applications\n\t// case, we only care about defining the subject and the user in question and\n\t// the roles they have on the database. This token will expire in a year.\n\t//\n\t// iss (issuer): Issuer of the JWT\n\t// sub (subject): Subject of the JWT (the user)\n\t// aud (audience): Recipient for which the JWT is intended\n\t// exp (expiration time): Time after which the JWT expires\n\t// nbf (not before time): Time before which the JWT must not be accepted for processing\n\t// iat (issued at time): Time at which the JWT was issued; can be used to determine age of the JWT\n\t// jti (JWT ID): Unique identifier; can be used to prevent the JWT from being replayed (allows a token to be used only once)\n\tclaims = auth.Claims{\n\t\tStandardClaims: jwt.StandardClaims{\n\t\t\tIssuer: \"service project\",\n\t\t\tSubject: user.ID,\n\t\t\tExpiresAt: time.Now().Add(8760 * time.Hour).Unix(),\n\t\t\tIssuedAt: time.Now().Unix(),\n\t\t},\n\t\tRoles: user.Roles,\n\t}\n\n\t// This will generate a JWT with the claims embedded in them. The database\n\t// with need to be configured with the information found in the public key\n\t// file to validate these claims. Dgraph does not support key rotate at\n\t// this time.\n\ttoken, err := a.GenerateToken(claims)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"generating token\")\n\t}\n\n\tfmt.Printf(\"-----BEGIN TOKEN-----\\n%s\\n-----END TOKEN-----\\n\", token)\n\treturn nil\n}", "title": "" }, { "docid": "24f6af3078c7e7ef34c686a9fb4dfb9f", "score": "0.63326925", "text": "func (c *FusionAuthClient) GenerateTwoFactorSecret() (interface{}, error) {\n\tvar body interface{}\n\turi := \"/api/two-factor/secret\"\n\tmethod := http.MethodGet\n\treq, err := c.NewRequest(method, uri, body)\n\tvar resp interface{}\n\t_, err = c.Do(req, &resp)\n\treturn resp, err\n}", "title": "" }, { "docid": "afb740929c96025ac04d04ba0b5b29f8", "score": "0.6332527", "text": "func GenerateToken(user sql.User) (string, error) {\n\tnowTime := time.Now()\n\texpireTime := nowTime.Add(24 * time.Hour * 365)\n\n\tclaims := Claims{\n\t\tuser.ID,\n\t\tuser.Email,\n\t\tuser.FirstName,\n\t\tuser.LastName,\n\t\tjwt.StandardClaims{\n\t\t\tExpiresAt: expireTime.Unix(),\n\t\t\tIssuer: \"gin\",\n\t\t},\n\t}\n\n\ttokenClaims := jwt.NewWithClaims(jwt.SigningMethodHS256, claims)\n\ttoken, err := tokenClaims.SignedString(jwtSecret)\n\n\treturn token, err\n}", "title": "" }, { "docid": "b0f5e347d0756bdcc29e9c57bf70967a", "score": "0.63301414", "text": "func (c *Client) GenerateSecret(opts ...Option) (GeneratedSecret, error) {\n\ts := GeneratedSecret{}\n\tdata := url.Values{}\n\tapply(data, opts...)\n\terr := c.Do(\"POST\", \"/generate\", data, &s)\n\tif err != nil {\n\t\treturn GeneratedSecret{}, err\n\t}\n\treturn s, nil\n}", "title": "" }, { "docid": "252daec26c642f7dd57acea2097c7543", "score": "0.632102", "text": "func GenerateToken(claims jwt.Claims) *jwt.Token {\n\treturn jwt.NewWithClaims(jwt.SigningMethodHS256, claims)\n}", "title": "" }, { "docid": "5e79f6cfc712fa1be6cd58f21545cd19", "score": "0.63204193", "text": "func GenerateJWT(user model.User) model.AuthToken {\n\tsecret := envvar.AuthSecret()\n\texpiresAt := time.Now().Add(time.Minute * 15).Unix()\n\n\ttoken := jwt.New(jwt.SigningMethodHS256)\n\n\ttoken.Claims = &model.AuthTokenClaim{\n\t\tStandardClaims: jwt.StandardClaims{\n\t\t\tExpiresAt: expiresAt,\n\t\t},\n\t\tUser: user,\n\t}\n\n\ttokenString, error := token.SignedString([]byte(secret))\n\tif error != nil {\n\t\tfmt.Println(error)\n\t}\n\treturn model.AuthToken{\n\t\tToken: tokenString,\n\t\tTokenType: \"Bearer\",\n\t\tExpiresIn: expiresAt,\n\t}\n}", "title": "" }, { "docid": "bf955290d5c6448b8ddd2b541db72b23", "score": "0.63068885", "text": "func generateToken(c *http.Client) *auth {\n\tauth := &auth{}\n\turl := \"https://sms.opestechnologies.co.tz/api/get-api-key\"\n\treq := &config{\n\t\tUsername: os.Getenv(\"OPES_USERNAME\"),\n\t\tPassword: os.Getenv(\"OPES_PASSWORD\"),\n\t}\n\n\tcontent, _ := json.Marshal(req)\n\tresp, err := c.Post(url, \"application/json\", bytes.NewBuffer(content))\n\tif err != nil {\n\t\treturn nil\n\t}\n\tdefer resp.Body.Close()\n\n\ttokenResp := &response{}\n\tif err := json.NewDecoder(resp.Body).Decode(tokenResp); err != nil {\n\t\treturn nil\n\t}\n\n\tif tokenResp.Error != \"\" {\n\t\treturn nil\n\t}\n\n\tauth.token = tokenResp.Success.Token\n\t// expires after 15 days starting from day token was generated.\n\tauth.expire = time.Now().Add(time.Hour * 24 * 15)\n\n\t// store the token in config file\n\tviper.Set(\"auth.token\", auth.token)\n\tviper.Set(\"auth.expires\", auth.expire)\n\tviper.WriteConfigAs(configPath)\n\n\treturn auth\n}", "title": "" }, { "docid": "e488c25e50a22bfe26684017dc95b3ae", "score": "0.62942123", "text": "func generateToken(size int) (string, error) {\r\n\tb := make([]byte, size)\r\n\tif _, err := rand.Read(b); err != nil {\r\n\t\treturn \"\", err\r\n\t}\r\n\treturn base64.URLEncoding.EncodeToString(b), nil\r\n}", "title": "" }, { "docid": "1acaec4125dfac0a40327211e0f9c78d", "score": "0.62923276", "text": "func GenerateJWTToken(subject string, extraTime time.Duration) (tokenString string, err error) {\n\tJWTToken := jwt.New(jwt.SigningMethodHS256)\n\n\tJWTToken.Claims[\"iat\"] = time.Now()\n\tJWTToken.Claims[\"exp\"] = time.Now().Add(extraTime)\n\tJWTToken.Claims[\"sub\"] = subject\n\n\treturn JWTToken.SignedString([]byte(JWTSecret))\n}", "title": "" }, { "docid": "800ef93d3cd62c1f7f31247b24bf6e24", "score": "0.6283488", "text": "func (backend *JWTAuthenticationBackend) GenerateToken(\n\tuserUUID string) (string, error) {\n\n\tnow := time.Now()\n\texp := now.Add(\n\t\ttime.Hour * time.Duration(\n\t\t\tsettings.Get().JWTExpirationDelta))\n\n\ttoken := jwt.NewWithClaims(\n\t\tjwt.SigningMethodRS512,\n\t\t&jwt.StandardClaims{\n\t\t\tExpiresAt: exp.Unix(),\n\t\t\tIssuedAt: now.Unix(),\n\t\t\tSubject: userUUID,\n\t\t})\n\n\ttokenString, err := token.SignedString(backend.privateKey)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn tokenString, nil\n}", "title": "" }, { "docid": "9ae85862cc47bd88bb2e2d7d4ca9fd4d", "score": "0.62819827", "text": "func GenerateJWT(openId string) (string, error) {\r\n\t// expire in two weeks\r\n\tvar exp = time.Hour * 24 * 14\r\n\tvar hmacSampleSecret = []byte(secret)\r\n\ttoken := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{\r\n\t\t\"sub\": openId,\r\n\t\t\"iat\": time.Now().Unix(),\r\n\t\t\"exp\": time.Now().Add(exp).Unix(),\r\n\t})\r\n\r\n\t// Sign and get the complete encoded token as a string using the secret\r\n\ttokenString, err := token.SignedString(hmacSampleSecret)\r\n\treturn tokenString, err\r\n}", "title": "" }, { "docid": "a0ed5af59f2e981e4c6af86bbaec022f", "score": "0.62474304", "text": "func (g TokenManager) GenerateToken(ctx context.Context, payload string) (Token, error) {\n\tgeneratedAtTimestamp := g.now().Unix()\n\t// Generate a hash for those metadata\n\thash := crypto.HMAC256(g.tokenSecretKey, []byte(generatePlainText(generatedAtTimestamp, payload)))\n\n\treturn Token{\n\t\tGeneratedAt: generatedAtTimestamp,\n\t\tHash: hex.EncodeToString(hash),\n\t}, nil\n}", "title": "" }, { "docid": "4458c57b106fab9efeea613ecb3c71bc", "score": "0.62465024", "text": "func (j *JWTAuth) GenerateJWT(serviceID string) (string, error) {\n\t// Create a new token object, specifying signing method and the claims\n\t// you would like it to contain.\n\texpiresAt := time.Now().Add(10 * time.Hour).UTC().Unix()\n\tclaims := TokenClaims{\n\t\tserviceID,\n\t\tjwt.StandardClaims{\n\t\t\tExpiresAt: expiresAt,\n\t\t\tIssuer: \"noebs\",\n\t\t},\n\t}\n\ttoken := jwt.NewWithClaims(jwt.SigningMethodHS256, claims)\n\tlog.Println(\"generating token\")\n\t// Sign and get the complete encoded token as a string using the secret\n\tif j.Key == nil {\n\t\treturn \"\", errors.New(\"empty jwt key\")\n\t}\n\tlog.Printf(\"jwt_key: %s\", j.Key)\n\tif tokenString, err := token.SignedString(j.Key); err == nil {\n\t\treturn tokenString, nil\n\t} else {\n\t\treturn \"\", err\n\t}\n}", "title": "" }, { "docid": "36ae859a51210f329e267dabd68292ad", "score": "0.6244705", "text": "func (g *GRPCServer) GenerateAppToken(ctx context.Context, req *authpb.GenerateAppTokenRequest) (*authpb.GenerateAppTokenResponse, error) {\n\tauth, err := g.authenticate(ctx)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\ttraits := wrappers.Traits{}\n\tfor traitName, traitValues := range req.Traits {\n\t\ttraits[traitName] = traitValues.Values\n\t}\n\ttoken, err := auth.GenerateAppToken(ctx, types.GenerateAppTokenRequest{\n\t\tUsername: req.Username,\n\t\tRoles: req.Roles,\n\t\tTraits: traits,\n\t\tURI: req.URI,\n\t\tExpires: req.Expires,\n\t})\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\treturn &authpb.GenerateAppTokenResponse{\n\t\tToken: token,\n\t}, nil\n}", "title": "" }, { "docid": "486df6012a3feb999ac5a6762338be70", "score": "0.62403667", "text": "func GenerateToken(fingerprint string) (t Token) {\n\tts := time.Now().UTC()\n\treturn Token{\n\t\tID: uuid.Must(uuid.NewV4()).Bytes(),\n\t\tFingerprint: fingerprint,\n\t\tIssued: ts.Unix(),\n\t\tExpires: ts.Add(10 * time.Second).Unix(),\n\t}\n}", "title": "" }, { "docid": "f1211113d98632cc90c720d40c233b8e", "score": "0.62334645", "text": "func GenerateOAuthTokenPair() (privToken, pubToken string) {\n\tconst sha256Prefix = \"sha256~\"\n\trandomToken := base64.RawURLEncoding.EncodeToString(uuid.NewRandom())\n\thashed := sha256.Sum256([]byte(randomToken))\n\treturn sha256Prefix + string(randomToken), sha256Prefix + base64.RawURLEncoding.EncodeToString(hashed[:])\n}", "title": "" }, { "docid": "e7e26b5d4cf195d38187974bdda6140b", "score": "0.6221448", "text": "func genKeySecret(apiKey *APIKey) error {\n\trand.Seed(time.Now().UnixNano())\n\tconst letters = \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\"\n\n\tkey := make([]byte, 16)\n\tfor i := range key {\n\t\tkey[i] = letters[rand.Intn(len(letters))]\n\t}\n\tsecret := make([]byte, 32)\n\tfor i := range secret {\n\t\tsecret[i] = letters[rand.Intn(len(letters))]\n\t}\n\n\tapiKey.Key = string(key)\n\tapiKey.Secret = string(secret)\n\n\tpassword := []byte(secret)\n\n\th, err := bcrypt.GenerateFromPassword(password, bcrypt.DefaultCost)\n\tif err != nil {\n\t\treturn err\n\t}\n\tapiKey.SecretHash = h\n\n\treturn nil\n}", "title": "" }, { "docid": "883fe5d262fe07e3ed7c304fde43f1fd", "score": "0.62206984", "text": "func (s MonitoringSpec) GetTokenSecretName() string {\n\treturn util.TypeOrDefault[string](s.TokenSecretName)\n}", "title": "" }, { "docid": "3f0981d51c6f652b635dcfbdcda1a054", "score": "0.62163734", "text": "func (c *HMACStrategy) Generate(ctx context.Context) (string, string, error) {\n\tc.Lock()\n\tdefer c.Unlock()\n\n\tsecrets, err := c.Config.GetGlobalSecret(ctx)\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\n\tif len(secrets) < minimumSecretLength {\n\t\treturn \"\", \"\", errors.Errorf(\"secret for signing HMAC-SHA512/256 is expected to be 32 byte long, got %d byte\", len(secrets))\n\t}\n\n\tvar signingKey [32]byte\n\tcopy(signingKey[:], secrets)\n\n\tentropy := c.Config.GetTokenEntropy(ctx)\n\tif entropy < minimumEntropy {\n\t\tentropy = minimumEntropy\n\t}\n\n\t// When creating secrets not intended for usage by human users (e.g.,\n\t// client secrets or token handles), the authorization server should\n\t// include a reasonable level of entropy in order to mitigate the risk\n\t// of guessing attacks. The token value should be >=128 bits long and\n\t// constructed from a cryptographically strong random or pseudo-random\n\t// number sequence (see [RFC4086] for best current practice) generated\n\t// by the authorization server.\n\ttokenKey, err := RandomBytes(entropy)\n\tif err != nil {\n\t\treturn \"\", \"\", errorsx.WithStack(err)\n\t}\n\n\tsignature := c.generateHMAC(ctx, tokenKey, &signingKey)\n\n\tencodedSignature := b64.EncodeToString(signature)\n\tencodedToken := fmt.Sprintf(\"%s.%s\", b64.EncodeToString(tokenKey), encodedSignature)\n\treturn encodedToken, encodedSignature, nil\n}", "title": "" }, { "docid": "7a59ded001b67a310d8b77e21122c90d", "score": "0.62126607", "text": "func generateWebHookSecret(opts Options) *v1.Secret {\n\tsecret := &v1.Secret{\n\t\tData: make(map[string][]byte),\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: \"kudo-webhook-server-secret\",\n\t\t\tNamespace: opts.Namespace,\n\t\t},\n\t}\n\n\treturn secret\n}", "title": "" }, { "docid": "f165b0cfbfe799213efdbc587b7d1075", "score": "0.62125266", "text": "func (s *SigningKey) GenerateToken(u models.User) (string, error) {\n\tclaims := JWTClaims{\n\t\tu.Username,\n\t\tjwt.StandardClaims{\n\t\t\tExpiresAt: time.Now().Add(time.Minute * 15).Unix(),\n\t\t},\n\t}\n\ttoken := jwt.NewWithClaims(jwt.SigningMethodHS256, claims)\n\tt, err := token.SignedString(s.secret)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn t, nil\n}", "title": "" }, { "docid": "a2c0ed299e16cf870d71150a08f6f2be", "score": "0.62066835", "text": "func GenerateToken(n int) (string, error) {\n\tb, err := generateRandomBytes(n)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn base64.StdEncoding.EncodeToString(b), nil\n}", "title": "" }, { "docid": "0bb2a6868a4fb2b5e8c653524a3f2935", "score": "0.6206131", "text": "func GetToken(endpoint, id, secret string) string {\n app := MakeApplication(endpoint, id, secret)\n return GetOAuthResponse(app).Access_token\n}", "title": "" }, { "docid": "b38be67d086b2d897b68d1b325abc05c", "score": "0.6205707", "text": "func GenerateSecureToken(length int) (string, error) {\n\tb := make([]byte, length)\n\t_, err := rand.Read(b)\n\tif err != nil {\n\t\treturn \"\", errors.WithStack(err)\n\t}\n\n\tenc := base32.StdEncoding.WithPadding(base32.NoPadding)\n\tt := enc.EncodeToString(b)\n\treturn strings.ToLower(t), nil\n}", "title": "" }, { "docid": "50f7cd6eaf18417bf3f841958cd4a7ac", "score": "0.61878693", "text": "func NewJwtTokenGenerator(secret []byte) *JwtTokenGenerator {\n\treturn &JwtTokenGenerator{\n\t\tSecret: secret,\n\t}\n}", "title": "" }, { "docid": "be6c1d4c6bcf016de2f236b20802a04d", "score": "0.6182183", "text": "func generateToken(creds Credentials, validTime time.Duration) (*Token, error) {\n\t// Declare the expiration time of the token\n\t// here, we have kept it as 5 minutes\n\texpirationTime := time.Now().Add(validTime)\n\n\t// Create the JWT claims, which includes the username and expiry time\n\tclaims := &Claims{\n\t\tUsername: creds.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\t// Declare the token with the algorithm used for signing, and the claims\n\ttoken := jwt.NewWithClaims(jwt.SigningMethodHS256, claims)\n\n\t// Create the JWT string\n\ttokenString, err := token.SignedString(jwtKey)\n\tif err != nil {\n\t\tlog.Errorf(\"Token could not be generated, because: %s\", err.Error())\n\t\treturn nil, err\n\t}\n\treturn &Token{token: tokenString, expirationTime: expirationTime}, nil\n}", "title": "" }, { "docid": "459399db5a31b2c31b085d8b299c55e8", "score": "0.6165754", "text": "func (s *Service) Generate(input map[string]interface{}) (string, error) {\n\tif len(input) == 0 {\n\t\treturn \"\", errors.New(\"can't generate a token with required claims\")\n\t}\n\tclaims := IdentityClaims{}\n\tif val, ok := input[\"email\"]; ok {\n\t\tclaims.Email = val.(string)\n\t}\n\tclaims.ExpiresAt = time.Now().Add(12 * time.Hour).UTC().Unix()\n\ttoken := jwtGo.NewWithClaims(jwtGo.SigningMethodHS256, claims)\n\tif token != nil {\n\t\ttokenString, err := token.SignedString([]byte(os.Getenv(\"STAGE_JWT_SECRET\")))\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\treturn tokenString, nil\n\t}\n\treturn \"\", nil\n}", "title": "" }, { "docid": "d4701abddbebb19d1a1469039a609cc4", "score": "0.6164317", "text": "func GenerateToken() (string, error) {\n\trandomBytes := make([]byte, 16)\n\trand.Reader.Read(randomBytes)\n\trandomNumberString := fmt.Sprintf(\"%x\", randomBytes)\n\t// TODO sign token\n\t//hashAlgorithm := crypto.SHA1.New()\n\t//hashAlgorithm.Write([]byte(randomNumberString))\n\t//hash := hashAlgorithm.Sum(nil)\n\t//signed, err := rsa.SignPKCS1v15(rand.Reader, privateKey, crypto.SHA256, hash)\n\t//if err != nil {\n\t//\treturn \"\", nil\n\t//}\n\n\t//randomNumberString += randomNumberString + \"_\" + string(signed)\n\n\treturn randomNumberString, nil\n}", "title": "" }, { "docid": "622ce5620a16c1ab02f2bb8d4d6a9370", "score": "0.6161483", "text": "func (sStub *SessionsService) GenerateToken(tokenType TokenType, id string, mask int64) (models.TokenData, error) {\n\tvar err error\n\n\tclaims, exp, err := CreatePayload(tokenType, id, constants.TokenIssuer, mask)\n\tif err != nil {\n\t\treturn models.TokenData{}, err\n\t}\n\ttoken := jwt.NewWithClaims(jwt.SigningMethodHS256, claims)\n\ttokenString, err := token.SignedString([]byte(sStub.secret))\n\n\tif err != nil {\n\t\treturn models.TokenData{}, err\n\t}\n\n\treturn models.TokenData{\n\t\tToken: tokenString,\n\t\tType: \"Bearer\",\n\t\tExpirationDate: exp,\n\t}, err\n}", "title": "" }, { "docid": "6792bd854c4e81639691660553b75212", "score": "0.6147601", "text": "func (creds *Credentials) GenerateSecret() {\n\tcreds.HashAlg = crypto.SHA1\n\tcreds.Secret = creds.GenerateHash(creds.PasswordHash() + creds.TimeSalt() + creds.CharSalt(64))\n}", "title": "" }, { "docid": "d35f5206b9cff906479dad42b3a06c66", "score": "0.6132935", "text": "func BootstrapTokenFromSecret(secret *v1.Secret) (*BootstrapToken, error) {\n\t// Get the Token ID field from the Secret data\n\ttokenID := bootstrapsecretutil.GetData(secret, bootstrapapi.BootstrapTokenIDKey)\n\tif len(tokenID) == 0 {\n\t\treturn nil, errors.Errorf(\"bootstrap Token Secret has no token-id data: %s\", secret.Name)\n\t}\n\n\t// Enforce the right naming convention\n\tif secret.Name != bootstraputil.BootstrapTokenSecretName(tokenID) {\n\t\treturn nil, errors.Errorf(\"bootstrap token name is not of the form '%s(token-id)'. Actual: %q. Expected: %q\",\n\t\t\tbootstrapapi.BootstrapTokenSecretPrefix, secret.Name, bootstraputil.BootstrapTokenSecretName(tokenID))\n\t}\n\n\ttokenSecret := bootstrapsecretutil.GetData(secret, bootstrapapi.BootstrapTokenSecretKey)\n\tif len(tokenSecret) == 0 {\n\t\treturn nil, errors.Errorf(\"bootstrap Token Secret has no token-secret data: %s\", secret.Name)\n\t}\n\n\t// Create the BootstrapTokenString object based on the ID and Secret\n\tbts, err := NewBootstrapTokenStringFromIDAndSecret(tokenID, tokenSecret)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"bootstrap Token Secret is invalid and couldn't be parsed\")\n\t}\n\n\t// Get the description (if any) from the Secret\n\tdescription := bootstrapsecretutil.GetData(secret, bootstrapapi.BootstrapTokenDescriptionKey)\n\n\t// Expiration time is optional, if not specified this implies the token\n\t// never expires.\n\tsecretExpiration := bootstrapsecretutil.GetData(secret, bootstrapapi.BootstrapTokenExpirationKey)\n\tvar expires *metav1.Time\n\tif len(secretExpiration) > 0 {\n\t\texpTime, err := time.Parse(time.RFC3339, secretExpiration)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"can't parse expiration time of bootstrap token %q\", secret.Name)\n\t\t}\n\t\texpires = &metav1.Time{Time: expTime}\n\t}\n\n\t// Build an usages string slice from the Secret data\n\tvar usages []string\n\tfor k, v := range secret.Data {\n\t\t// Skip all fields that don't include this prefix\n\t\tif !strings.HasPrefix(k, bootstrapapi.BootstrapTokenUsagePrefix) {\n\t\t\tcontinue\n\t\t}\n\t\t// Skip those that don't have this usage set to true\n\t\tif string(v) != \"true\" {\n\t\t\tcontinue\n\t\t}\n\t\tusages = append(usages, strings.TrimPrefix(k, bootstrapapi.BootstrapTokenUsagePrefix))\n\t}\n\t// Only sort the slice if defined\n\tif usages != nil {\n\t\tsort.Strings(usages)\n\t}\n\n\t// Get the extra groups information from the Secret\n\t// It's done this way to make .Groups be nil in case there is no items, rather than an\n\t// empty slice or an empty slice with a \"\" string only\n\tvar groups []string\n\tgroupsString := bootstrapsecretutil.GetData(secret, bootstrapapi.BootstrapTokenExtraGroupsKey)\n\tg := strings.Split(groupsString, \",\")\n\tif len(g) > 0 && len(g[0]) > 0 {\n\t\tgroups = g\n\t}\n\n\treturn &BootstrapToken{\n\t\tToken: bts,\n\t\tDescription: description,\n\t\tExpires: expires,\n\t\tUsages: usages,\n\t\tGroups: groups,\n\t}, nil\n}", "title": "" }, { "docid": "68638d320692bd5db1ce5de0a8dc7909", "score": "0.611474", "text": "func (c *Client) GenerateToken2020(ctx context.Context) (*GenerateTokenResponseV2, error) {\n\tc.init()\n\n\ttenantHost := \"login.emergencyreporting.com\"\n\ttenantSegment := \"login.emergencyreporting.com\"\n\n\tif c.TenantHost != \"\" {\n\t\ttenantHost = c.TenantHost\n\t}\n\tif c.TenantSegment != \"\" {\n\t\ttenantSegment = c.TenantSegment\n\t}\n\n\ttargetURL := \"https://\" + tenantHost + \"/\" + tenantSegment + \"/B2C_1A_PasswordGrant/oauth2/v2.0/token\"\n\n\tvalues := url.Values{\n\t\t\"grant_type\": {\"password\"},\n\t\t\"username\": {c.Username},\n\t\t\"password\": {c.Password},\n\t\t\"client_id\": {c.ClientID},\n\t\t\"client_secret\": {c.ClientSecret},\n\t\t\"scope\": {\"https://\" + tenantSegment + \"/secure/full_access\"},\n\t\t\"response_type\": {\"token\"},\n\t\t\"er_aid\": {c.AccountID},\n\t\t\"er_uid\": {c.UserID},\n\t}\n\n\tc.Logger.Printf(\"POST %s\\n\", targetURL)\n\n\trequest, err := http.NewRequest(http.MethodPost, targetURL, strings.NewReader(values.Encode()))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could create request: %w\", err)\n\t}\n\trequest.Header.Set(\"Content-Type\", \"application/x-www-form-urlencoded\")\n\n\trequest = request.WithContext(ctx)\n\n\tresponse, err := c.client.Do(request)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not post form: %w\", err)\n\t}\n\tdefer response.Body.Close()\n\n\tcontents, err := ioutil.ReadAll(response.Body)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not read body: %w\", err)\n\t}\n\n\tif response.StatusCode < 200 || response.StatusCode > 299 {\n\t\tc.Logger.Printf(\"Body: %v\\n\", string(contents))\n\t\treturn nil, fmt.Errorf(\"bad status code: %d\", response.StatusCode)\n\t}\n\n\t// DEBUG:\n\t//c.Logger.Printf(\"%s\\n\", contents)\n\t// :GUBED\n\n\tvar parsedResponse GenerateTokenResponseV2\n\terr = json.Unmarshal(contents, &parsedResponse)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not parse JSON: %w\", err)\n\t}\n\n\treturn &parsedResponse, nil\n}", "title": "" }, { "docid": "b0476ad2a7afc0f618d6325b85288289", "score": "0.61082166", "text": "func GenerateToken() string{\n\tsession := connect()\n\tdefer session.Close()\n\tc := session.DB(\"rest\").C(\"tokens\")\n\trandom := tokenNumber\n\ttokenNumber = tokenNumber+1\n\terr := c.Insert(&model.Token{ID: bson.NewObjectId(), Token: fmt.Sprintf(\"token-%d\",random)})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Printf(\"token-%d\",random)\n\treturn fmt.Sprintf(\"token-%d\", random)\n}", "title": "" }, { "docid": "18a6a88ec94b1369c1f58736169ff4d1", "score": "0.610167", "text": "func (jwt *JWT) GenerateToken(accessKey string) (string, error) {\n\t// Trim spaces.\n\taccessKey = strings.TrimSpace(accessKey)\n\n\tif !isValidAccessKey(accessKey) {\n\t\treturn \"\", errInvalidAccessKeyLength\n\t}\n\n\ttUTCNow := time.Now().UTC()\n\ttoken := jwtgo.NewWithClaims(jwtgo.SigningMethodHS512, jwtgo.MapClaims{\n\t\t// Token expires in 10hrs.\n\t\t\"exp\": tUTCNow.Add(jwt.expiry).Unix(),\n\t\t\"iat\": tUTCNow.Unix(),\n\t\t\"sub\": accessKey,\n\t})\n\treturn token.SignedString([]byte(jwt.SecretAccessKey))\n}", "title": "" }, { "docid": "2f7fedce01df8acba3a384b93099b50e", "score": "0.61008155", "text": "func (a *OAuthConsumerCredential) OAuthTokenSecret() string {\n\treturn a.oauthTokenSecret\n}", "title": "" }, { "docid": "c6d588234b6b03c8c0134c9a288d2257", "score": "0.61005557", "text": "func GetToken(tokenSecretContext *api.TokenSecretContext) (string, error) {\n\tvar inputSecretKey string\n\tvar outputSecretKey string\n\tsecretName := tokenSecretContext.SecretName\n\tsecretsInst := lsecrets.Instance()\n\n\tif secretsInst == nil {\n\t\treturn \"\", fmt.Errorf(\"Unable to get token from secret since it is not initialized\")\n\t}\n\n\t// Handle edge cases for different providers.\n\tswitch secretsInst.String() {\n\tcase lsecrets.TypeDCOS:\n\t\tinputSecretKey = tokenSecretContext.SecretName\n\t\tnamespace := tokenSecretContext.SecretNamespace\n\t\tif namespace != \"\" {\n\t\t\tinputSecretKey = namespace + \"/\" + secretName\n\t\t}\n\t\toutputSecretKey = inputSecretKey\n\n\tcase lsecrets.TypeK8s:\n\t\tinputSecretKey = tokenSecretContext.SecretName\n\t\toutputSecretKey = SecretTokenKey\n\n\tdefault:\n\t\tinputSecretKey = tokenSecretContext.SecretName\n\t\toutputSecretKey = SecretNameKey\n\t}\n\n\t// Get secret value with standardized interface\n\tsecretValue, err := secretsInst.GetSecret(inputSecretKey, requestToContext(tokenSecretContext))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// Retrieve auth token\n\tauthToken, exists := secretValue[outputSecretKey]\n\tif !exists {\n\t\treturn \"\", ErrAuthTokenNotFound\n\t}\n\treturn authToken.(string), nil\n\n}", "title": "" }, { "docid": "6e0d57cb54582798c23b9a433a26cdb2", "score": "0.6068564", "text": "func CreateToken(userID uint, secretKey string) (string, error) {\n\n\tclaims := jwt.MapClaims{}\n\tclaims[\"id\"] = userID\n\tclaims[\"exp\"] = time.Now().Add(time.Hour * 24).Unix()\n\n\tpreToken := jwt.NewWithClaims(jwt.SigningMethodHS256, claims)\n\n\ttoken, err := preToken.SignedString([]byte(secretKey))\n\tif err != nil {\n\t\treturn \"\", errors.New(\"Could not sign the new token\")\n\t}\n\n\treturn token, nil\n}", "title": "" }, { "docid": "b3bb4ad40623d636871ba05e821f8d60", "score": "0.6067564", "text": "func GenerateGitHubAppsToken(ctx context.Context, clientApps *github.Client, installationID int64) (string, *time.Time, error) {\n\ttoken, _, err := clientApps.Apps.CreateInstallationToken(ctx, installationID, nil)\n\tif err != nil {\n\t\treturn \"\", nil, fmt.Errorf(\"failed to generate token from API: %w\", err)\n\t}\n\treturn *token.Token, token.ExpiresAt, nil\n}", "title": "" }, { "docid": "e54544653322483d0a2c590924e5fc5b", "score": "0.606594", "text": "func Generate(payload *TokenPayload) string {\n\tv, err := time.ParseDuration(config.TOKENEXP)\n\n\tif err != nil {\n\t\tpanic(\"Invalid time duration. Should be time.ParseDuration string\")\n\t}\n\n\tt := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{\n\t\t\"exp\": time.Now().Add(v).Unix(),\n\t\t\"ID\": payload.ID,\n\t})\n\n\ttoken, err := t.SignedString([]byte(config.TOKENKEY))\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn token\n}", "title": "" } ]
fb8c12eb98ffb63ebfc67ef27337eef1
NewResult return a new result object which starts with passed == true since has no errors
[ { "docid": "3c2f51650aaab28394663bce4abb9271", "score": "0.67457724", "text": "func NewResult() *Result {\n\treturn &Result{Passed: true}\n}", "title": "" } ]
[ { "docid": "be07c25e955e6d44f2acb9f930eb2b3b", "score": "0.7074712", "text": "func newResult() *result {\n\treturn &result{}\n}", "title": "" }, { "docid": "9cdc1e5708669185fbe7ac3866e079ea", "score": "0.6405195", "text": "func newResult(lap model.Lap) model.Result {\n\treturn model.Result{\n\t\tRunnerID: lap.RunnerID,\n\t\tRunnerName: lap.RunnerName,\n\t\tLaps: lap.LapID,\n\t\tRunnerTime: lap.LapTime,\n\t}\n}", "title": "" }, { "docid": "4717c27f1498ee3e7306b4f88c77a189", "score": "0.62621164", "text": "func newBatchOperationResult(name string, success bool, err error) batchOperationResult {\n\treturn batchOperationResult{\n\t\tname: name,\n\t\tsuccess: success,\n\t\terr: err,\n\t}\n}", "title": "" }, { "docid": "138887e5a65863df881fb2d42407860a", "score": "0.6244385", "text": "func New(v interface{}) Result {\n\treturn Result{v}\n}", "title": "" }, { "docid": "761cb3b9e5f32c23c887ba1f82ba879e", "score": "0.60317916", "text": "func NewResult(e string) []byte {\n\tvar r Result\n\n\tif e != \"\" {\n\t\tr = Result{Ok: false, Error: e}\n\t} else {\n\t\tr = Result{Ok: true}\n\t}\n\n\tres, _ := json.Marshal(r)\n\treturn res\n}", "title": "" }, { "docid": "8c68c2727bbd382db72332afc88da09b", "score": "0.59880507", "text": "func New() *Result {\n\tr := &Result{}\n\tr.Code = 0\n\tr.Msg = common.Success.String()\n\treturn r\n}", "title": "" }, { "docid": "479fe98a345beaa2cba40acbf3a02cf1", "score": "0.5773319", "text": "func NewResult(cfg *Config, factory Factory, obj runtime.Object) (Result, error) {\n\tvalidationScheme, err := factory.Validator(cfg.Validation)\n\tif err != nil {\n\t\tglog.V(4).Infof(\"Error getting validator for %s: %s\", kubekit.TypeName(obj), err)\n\t\treturn nil, err\n\t}\n\n\tjsonData, err := json.Marshal(obj)\n\tif err != nil {\n\t\tglog.V(4).Infof(\"Error encoding the given object for %s: %s\", kubekit.TypeName(obj), err)\n\t\treturn nil, err\n\t}\n\n\treturn defaultStreamBuilderFunc(\n\t\tfactory.NewBuilder(),\n\t\tvalidationScheme,\n\t\tdefaultNamespace,\n\t\tbytes.NewBuffer(jsonData),\n\t)\n}", "title": "" }, { "docid": "ae7a3c5de81ffc77fcd286098a3c288d", "score": "0.57014704", "text": "func NewResult() Result {\n\tvar res Result\n\tres.Balls = make([]int, BALLS)\n\treturn res\n}", "title": "" }, { "docid": "936b1df2c8d14eefca3987bf520ad3ff", "score": "0.5698533", "text": "func MakeOK(err error) error { return ok{base{err: err, code: OK}} }", "title": "" }, { "docid": "cea93bac0acffeedae5075ec285e8fe5", "score": "0.56882507", "text": "func newResults(hc *HealthCheck) *results {\n\tr := &results{\n\t\thc: hc,\n\t}\n\n\tgo r.run()\n\n\treturn r\n}", "title": "" }, { "docid": "0274622389566840e3c4b078508d5494", "score": "0.5666419", "text": "func NewResult(name, v string, location string, published time.Time) *Result {\n\tr := &Result{name, version.NewVersion(v), location, published}\n\tif r.Published.IsZero() {\n\t\tr.Published = r.Version.FindDate()\n\t}\n\treturn r\n}", "title": "" }, { "docid": "89591a8baf54761bcb36bb57bb3d39d5", "score": "0.5659543", "text": "func newResult(t reflect.Type, opts resultOptions) (result, error) {\n\tswitch {\n\tcase IsIn(t) || (t.Kind() == reflect.Ptr && IsIn(t.Elem())) || embedsType(t, _inPtrType):\n\t\treturn nil, newErrInvalidInput(fmt.Sprintf(\n\t\t\t\"cannot provide parameter objects: %v embeds a dig.In\", t), nil)\n\tcase isError(t):\n\t\treturn nil, newErrInvalidInput(\"cannot return an error here, return it from the constructor instead\", nil)\n\tcase IsOut(t):\n\t\treturn newResultObject(t, opts)\n\tcase embedsType(t, _outPtrType):\n\t\treturn nil, newErrInvalidInput(fmt.Sprintf(\n\t\t\t\"cannot build a result object by embedding *dig.Out, embed dig.Out instead: %v embeds *dig.Out\", t), nil)\n\tcase t.Kind() == reflect.Ptr && IsOut(t.Elem()):\n\t\treturn nil, newErrInvalidInput(fmt.Sprintf(\n\t\t\t\"cannot return a pointer to a result object, use a value instead: %v is a pointer to a struct that embeds dig.Out\", t), nil)\n\tcase len(opts.Group) > 0:\n\t\tg, err := parseGroupString(opts.Group)\n\t\tif err != nil {\n\t\t\treturn nil, newErrInvalidInput(\n\t\t\t\tfmt.Sprintf(\"cannot parse group %q\", opts.Group), err)\n\t\t}\n\t\trg := resultGrouped{Type: t, Group: g.Name, Flatten: g.Flatten}\n\t\tif len(opts.As) > 0 {\n\t\t\tvar asTypes []reflect.Type\n\t\t\tfor _, as := range opts.As {\n\t\t\t\tifaceType := reflect.TypeOf(as).Elem()\n\t\t\t\tif ifaceType == t {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif !t.Implements(ifaceType) {\n\t\t\t\t\treturn nil, newErrInvalidInput(\n\t\t\t\t\t\tfmt.Sprintf(\"invalid dig.As: %v does not implement %v\", t, ifaceType), nil)\n\t\t\t\t}\n\t\t\t\tasTypes = append(asTypes, ifaceType)\n\t\t\t}\n\t\t\tif len(asTypes) > 0 {\n\t\t\t\trg.Type = asTypes[0]\n\t\t\t\trg.As = asTypes[1:]\n\t\t\t}\n\t\t}\n\t\tif g.Soft {\n\t\t\treturn nil, newErrInvalidInput(fmt.Sprintf(\n\t\t\t\t\"cannot use soft with result value groups: soft was used with group:%q\", g.Name), nil)\n\t\t}\n\t\tif g.Flatten {\n\t\t\tif t.Kind() != reflect.Slice {\n\t\t\t\treturn nil, newErrInvalidInput(fmt.Sprintf(\n\t\t\t\t\t\"flatten can be applied to slices only: %v is not a slice\", t), nil)\n\t\t\t}\n\t\t\trg.Type = rg.Type.Elem()\n\t\t}\n\t\treturn rg, nil\n\tdefault:\n\t\treturn newResultSingle(t, opts)\n\t}\n}", "title": "" }, { "docid": "399de6fd34cbb9cf1ec418b576b593f9", "score": "0.5606907", "text": "func CreateInconclusiveResult(name, reason string) CheckResult {\n\treturn CheckResult{\n\t\tName: name,\n\t\t// Old structure.\n\t\tConfidence: 0,\n\t\tPass: false,\n\t\t// New structure.\n\t\tVersion: 2,\n\t\tScore: InconclusiveResultScore,\n\t\tReason: reason,\n\t}\n}", "title": "" }, { "docid": "175644b7cc593be7d7b070d1154cea95", "score": "0.55761844", "text": "func (r *EmptyResult) Ok() {}", "title": "" }, { "docid": "48f1d96ec5fc5cd79f91e72e29d1008e", "score": "0.55586433", "text": "func (ddruo *DatabaseDetectorResultUpdateOne) AddResult(sr schema.DetectorResult) *DatabaseDetectorResultUpdateOne {\n\tddruo.mutation.AddResult(sr)\n\treturn ddruo\n}", "title": "" }, { "docid": "1d17110e642995f6d730d7bdf06197b9", "score": "0.55186796", "text": "func (ddruo *DNSDetectorResultUpdateOne) AddResult(sr schema.DetectorResult) *DNSDetectorResultUpdateOne {\n\tddruo.mutation.AddResult(sr)\n\treturn ddruo\n}", "title": "" }, { "docid": "b22c7f29b52841e0d612688924832775", "score": "0.55081505", "text": "func toResult(pID string, status model.StatusResponse) (res common.KYCResult, err error) {\n\tswitch status.CurrentStatus {\n\tcase model.New, model.InProgress:\n\t\tres.Status = common.Unclear\n\t\tres.StatusCheck = &common.KYCStatusCheck{\n\t\t\tProvider: common.Coinfirm,\n\t\t\tReferenceID: pID,\n\t\t\tLastCheck: time.Now(),\n\t\t}\n\tcase model.Incomplete:\n\t\terr = errors.New(\"data provided by participant is incomplete or does not meet the requirements set in KYC form\")\n\tcase model.Low, model.Medium:\n\t\tres.Status = common.Approved\n\tcase model.High, model.Fail:\n\t\ts := string(status.CurrentStatus)\n\t\tif status.CurrentStatus == model.Fail {\n\t\t\ts = \"unacceptable\"\n\t\t}\n\t\tres.Status = common.Denied\n\t\tres.Details = &common.KYCDetails{\n\t\t\tReasons: []string{\n\t\t\t\t\"Coinfirm analysts evaluated the risk associated to participant as \" + s,\n\t\t\t},\n\t\t}\n\tdefault:\n\t\terr = errors.New(\"unexpected status value: \" + string(status.CurrentStatus))\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "9f9a03eaea06abe3421ccba5addc47fb", "score": "0.54230165", "text": "func NewResult(statusCode int, payload interface{}, error string) Result {\n\treturn Result{\n\t\tStatusCode: statusCode,\n\t\tError: error,\n\t\tPayload: payload,\n\t}\n}", "title": "" }, { "docid": "20dc9d528f25febb384a4a2f446c4db1", "score": "0.5406951", "text": "func MakeAndResult(checks ...CheckResult) CheckResult {\n\tminResult := CheckResult{\n\t\tPass: true,\n\t\tConfidence: MaxResultConfidence,\n\t}\n\n\tfor _, result := range checks {\n\t\tif minResult.Name == \"\" {\n\t\t\tminResult.Name = result.Name\n\t\t}\n\t\tif isMinResult(result, minResult) {\n\t\t\tminResult = result\n\t\t}\n\t}\n\treturn minResult\n}", "title": "" }, { "docid": "3ecf47dddbeced66b26d0e4db199aa91", "score": "0.54060894", "text": "func NewResult(field, content string) *Result {\n\treturn &Result{Field: field, Content: content}\n}", "title": "" }, { "docid": "828ac997daa4ccfb60bcdb3500eb7e60", "score": "0.54023105", "text": "func NewSuccess(data interface{}, status int) Success {\n\treturn &s{\n\t\tdata: data,\n\t\tstatus: status,\n\t}\n}", "title": "" }, { "docid": "7212cd7f7779e46f57ef09b575bdb01d", "score": "0.53870374", "text": "func newResult(engine, text string) *result {\n\tvar e string\n\tswitch engine {\n\tcase Google:\n\t\te = \"Google Translate\"\n\n\tcase Baidu:\n\t\te = \"百度翻译\"\n\t}\n\treturn &result{e, text}\n}", "title": "" }, { "docid": "c9753f8334ce763faa5ad6e49801a7da", "score": "0.5372401", "text": "func NewWorkbookFunctionResult()(*WorkbookFunctionResult) {\n m := &WorkbookFunctionResult{\n Entity: *NewEntity(),\n }\n return m\n}", "title": "" }, { "docid": "dbfb55207ab07fc7b36e8474ab022390", "score": "0.53588974", "text": "func NewResult(resource string, cfnType string, result State, description string) Result {\n\tvar res Result\n\tres.setResult(result)\n\tres.setDescription(description)\n\tres.setAwsType(cfnType)\n\treturn res\n}", "title": "" }, { "docid": "55022c61b31aa73a13ab718e72f39f40", "score": "0.535324", "text": "func NewSubmissionResult()(*SubmissionResult) {\n m := &SubmissionResult{\n }\n m.backingStore = ie8677ce2c7e1b4c22e9c3827ecd078d41185424dd9eeb92b7d971ed2d49a392e.BackingStoreFactoryInstance();\n m.SetAdditionalData(make(map[string]any))\n return m\n}", "title": "" }, { "docid": "0e973edd2e189132df9313739446fa46", "score": "0.52774435", "text": "func newSuccessResp(key, msg string) *ResponseType {\n\treturn &ResponseType{Ok: true, Message: msg, Key: key}\n}", "title": "" }, { "docid": "a88ec77c17c06d870c03abf9c4b46755", "score": "0.52756494", "text": "func newTestResults(data generator.TestResult) testResults {\n\treturn testResults{Failed: data.Failed,\n\t\tTestOutput: data.TestOutput,\n\t\tID: data.TestID,\n\t\tSkipped: data.Skipped,\n\t}\n}", "title": "" }, { "docid": "7c7843ae9d898a3df993425bcccea1e3", "score": "0.52600324", "text": "func createSuccessResult(rt *route.Route,\n\tpreimage lntypes.Preimage) *PaymentResult {\n\n\treturn &PaymentResult{\n\t\tSuccess: true,\n\t\tPreimage: preimage,\n\t\tRoute: rt,\n\t}\n}", "title": "" }, { "docid": "e762961bf577a6d7575c5f0ee9d1bc58", "score": "0.5230507", "text": "func CreateResultWithScore(name, reason string, score int) CheckResult {\n\tpass := true\n\tif score < migrationThresholdPassValue {\n\t\tpass = false\n\t}\n\treturn CheckResult{\n\t\tName: name,\n\t\t// Old structure.\n\t\tError: nil,\n\t\tConfidence: MaxResultScore,\n\t\tPass: pass,\n\t\t// New structure.\n\t\tVersion: 2,\n\t\tError2: nil,\n\t\tScore: score,\n\t\tReason: reason,\n\t}\n}", "title": "" }, { "docid": "5f611b9fc561168f39cdbc8f387b375f", "score": "0.5223429", "text": "func (o *CreateRepository40Created) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "53de7a779d60415190a4964d06fa5594", "score": "0.5195495", "text": "func (ddru *DatabaseDetectorResultUpdate) AddResult(sr schema.DetectorResult) *DatabaseDetectorResultUpdate {\n\tddru.mutation.AddResult(sr)\n\treturn ddru\n}", "title": "" }, { "docid": "a0e1c4575dcf562f2a538f656076748f", "score": "0.5188005", "text": "func CreateInconclusiveResult(name, reason string) CheckResult {\n\treturn CheckResult{\n\t\tName: name,\n\t\tVersion: 2,\n\t\tScore: InconclusiveResultScore,\n\t\tReason: reason,\n\t}\n}", "title": "" }, { "docid": "e5438f8d36420b5f38b40a90973d7065", "score": "0.51688945", "text": "func NewResult(sql string) *Result {\n\tr := Result{Sql: sql}\n\treturn &r\n}", "title": "" }, { "docid": "7b8f4783a9804808d6a220868d38dbdc", "score": "0.5165541", "text": "func (o *CreateRepository35Created) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "1989917acd81b86093d978849c48b0ff", "score": "0.51565367", "text": "func NewResultOK(data []byte, log string) Result {\n\treturn Result{\n\t\tCode: CodeType_OK,\n\t\tData: data,\n\t\tLog: log,\n\t}\n}", "title": "" }, { "docid": "1f1d99a3e22a976dc930f39b01d36c5b", "score": "0.515321", "text": "func Success() Result {\n\treturn Result{}\n}", "title": "" }, { "docid": "829260f8ea5a0aa292fda30159a9c374", "score": "0.51511985", "text": "func (ddru *DNSDetectorResultUpdate) AddResult(sr schema.DetectorResult) *DNSDetectorResultUpdate {\n\tddru.mutation.AddResult(sr)\n\treturn ddru\n}", "title": "" }, { "docid": "196e43d81f81d97ac4483d4284e6376b", "score": "0.5144316", "text": "func (wr *SuccessfulResult) Success() bool {\n\treturn true\n}", "title": "" }, { "docid": "ab2b99f6099c063101ee6015460cc26f", "score": "0.51438373", "text": "func (o *IpamVlansCreateCreated) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "a607a1b4842d1323459cd8b17e43a547", "score": "0.5128685", "text": "func NewResult() *Result {\n\treturn &Result{\n\t\tCode: 0,\n\t\tMsg: \"success\",\n\t\tData: nil,\n\t}\n}", "title": "" }, { "docid": "c0d3f68d058f2b1d4244f2db0529817d", "score": "0.512694", "text": "func (j JSONValueBoolean) construct() JSONValueClass { return &j }", "title": "" }, { "docid": "8dd54cbc09d64ed84568972596c119de", "score": "0.5126748", "text": "func (o *CreateOK) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "fe53e90e316f157a2884115345bfef55", "score": "0.5112674", "text": "func NewResult(duration time.Duration, traversed, created int) *Result {\n\treturn &Result{\n\t\tduration: duration,\n\t\ttraversed: traversed,\n\t\tcreated: created,\n\t}\n}", "title": "" }, { "docid": "cb4eb8f375cfacb6664fca43cff9ed51", "score": "0.51054156", "text": "func (check *Check) NewResult(description string, r parser.Range, severity Severity) Result {\n\treturn Result{\n\t\tRuleID: check.Code,\n\t\tRuleDescription: check.Documentation.Summary,\n\t\tImpact: check.Documentation.Impact,\n\t\tResolution: check.Documentation.Resolution,\n\t\tRuleProvider: check.Provider,\n\t\tDescription: description,\n\t\tRange: r,\n\t\tSeverity: severity,\n\t}\n}", "title": "" }, { "docid": "80297c02ab4a982f01226b99199899eb", "score": "0.5104561", "text": "func (o *TemplateSummaryDiffDashboard) GetNewOk() (*TemplateSummaryDiffDashboardFields, bool) {\n\tif o == nil || o.New == nil {\n\t\treturn nil, false\n\t}\n\treturn o.New, true\n}", "title": "" }, { "docid": "dfd783d52ebbd07fbfddec9f3632b48c", "score": "0.5101975", "text": "func (o *CreateSearchOK) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "72aeaadde095a97d80849d294e1a9595", "score": "0.50841165", "text": "func (o *TemplateSummaryDiffVariable) GetNewOk() (*TemplateSummaryDiffVariableFields, bool) {\n\tif o == nil || o.New == nil {\n\t\treturn nil, false\n\t}\n\treturn o.New, true\n}", "title": "" }, { "docid": "38ba89e9199334b05543d4a8d5fc0f68", "score": "0.50796825", "text": "func (ddruo *DNSDetectorResultUpdateOne) SetResult(sr schema.DetectorResult) *DNSDetectorResultUpdateOne {\n\tddruo.mutation.ResetResult()\n\tddruo.mutation.SetResult(sr)\n\treturn ddruo\n}", "title": "" }, { "docid": "516a7512dc1e3f55e5f35907cd163bc0", "score": "0.50765175", "text": "func newTestResult(r *http.Response) (*testResult, error) {\n\tresult := &testResult{}\n\tif err := json.NewDecoder(r.Body).Decode(result); err != nil {\n\t\treturn nil, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "a83982a1e5c0a56e7c12cafc2b6a6948", "score": "0.50415504", "text": "func TestResultOk(t *testing.T) {\n\n\tresultData, _ := data.CoerceToObject(\"{\\\"data\\\":\\\"mock data\\\"}\")\n\tresultData[\"code\"] = 1\n\trh := &SyncResultHandler{data: resultData, err: errors.New(\"New Error\")}\n\tdata, err := rh.Result()\n\tassert.Equal(t, 1, data[\"code\"])\n\tassert.Equal(t, \"mock data\", data[\"data\"])\n\tassert.NotNil(t, err)\n}", "title": "" }, { "docid": "4250e1977322d3267b8d75aef79dbac8", "score": "0.5037853", "text": "func (e *Executor) Ok(f *flow.Flow, res interface{}) {\n\tswitch arg := res.(type) {\n\tcase reflow.Fileset:\n\t\te.Exec(f).Ok(reflow.Result{Fileset: arg})\n\tcase error:\n\t\te.Exec(f).Ok(reflow.Result{Err: errors.Recover(arg)})\n\tdefault:\n\t\tpanic(\"invalid result\")\n\t}\n}", "title": "" }, { "docid": "379acef4d9349e92380969b974d10681", "score": "0.5034929", "text": "func (o *IpamVlansCreateDefault) IsSuccess() bool {\n\treturn o._statusCode/100 == 2\n}", "title": "" }, { "docid": "c4a32f167ca6304ad39b01860c64698d", "score": "0.502666", "text": "func (o *CreateSearchDefault) IsSuccess() bool {\n\treturn o._statusCode/100 == 2\n}", "title": "" }, { "docid": "50b48c856fe5f3d411af4e8b38d90f13", "score": "0.5021142", "text": "func StatusOk(status string) *OutputResponse {\n return &OutputResponse{\n Status: status,\n }\n}", "title": "" }, { "docid": "7ea3bfc629c58ff7495bfcc77e6d217b", "score": "0.5017301", "text": "func (jrp JSONResultProvider) OK() Result {\n\treturn &JSONResult{\n\t\tStatusCode: http.StatusOK,\n\t\tResponse: \"OK!\",\n\t}\n}", "title": "" }, { "docid": "cb741b54055affb49d3f123ddf0a88f8", "score": "0.5014087", "text": "func newResultListener(api *API, filters ...ListenResultFilter) *ResultListener {\n\tln := &ResultListener{\n\t\tExecutions: make(chan *execution.Execution),\n\t\tErr: make(chan error, 1),\n\t\tcancel: make(chan struct{}),\n\t\tlistening: make(chan struct{}),\n\t\tapi: api,\n\t}\n\tfor _, filter := range filters {\n\t\tfilter(ln)\n\t}\n\treturn ln\n}", "title": "" }, { "docid": "4488bc48d110b68ae7c64556b718a61e", "score": "0.5013779", "text": "func (e *Exec) Ok(res reflow.Result) {\n\tselect {\n\tcase <-e.err:\n\t\tpanic(\"error defined\")\n\tdefault:\n\t}\n\n\tselect {\n\tcase e.resultc <- ExecResult{Result: res}:\n\tdefault:\n\t\tpanic(\"result already set\")\n\t}\n}", "title": "" }, { "docid": "3cdd3fbd245e1edf82ff71e9a285a64b", "score": "0.5006584", "text": "func (o *CreateRepository40Unauthorized) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "d8e758229ffa289700e53a4dc4be87af", "score": "0.50047725", "text": "func (o *CreateRepository35Unauthorized) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "729ee14addb2bc547343aa7d512b962b", "score": "0.4995286", "text": "func CheckResult(r *Result,topic int64,iteration string,docid string,rank int64,score float64,runname string, line string,t *testing.T) {\n if r.Topic != topic {\n t.Error(\"Expected topic\",topic,\"got\",r.Topic)\n }\n if r.Iteration != iteration {\n t.Error(\"Expected iteration\",iteration,\"got\",r.Iteration)\n }\n if r.DocId != docid {\n t.Error(\"Expected DocId\",docid,\"got\",r.DocId)\n }\n if r.Rank != rank {\n t.Error(\"Expected rank\",rank,\"got\",r.Rank)\n }\n if r.Score != score {\n t.Error(\"Expected score\",score,\"got\", r.Score)\n }\n if r.RunName != runname {\n t.Error(\"Expected runname\",runname,\"got\",r.RunName)\n }\n if r.String() != line {\n t.Error(\"Expected string representation\",line,\"but got\",r)\n }\n}", "title": "" }, { "docid": "b7705ac17be22beb944d8b672c28951e", "score": "0.49912682", "text": "func newResponseSimple(c echo.Context, msg string, resBool string, httpStatus int) error {\n\tresponseJson := mysql.DataPacketSimple{\n\t\tmsg,\n\t\tresBool,\n\t}\n\treturn c.JSON(httpStatus, responseJson) // encode to json and send\n}", "title": "" }, { "docid": "5869397d1cf7e968d4f2f7c2447f0728", "score": "0.49903095", "text": "func (bc *BController) Result(code int, data interface{}, message string) Struct {\n\treturn Struct{Code: code, Data: data, Message: message}\n}", "title": "" }, { "docid": "0f2760730c73abfec606ea6a321b913e", "score": "0.4981525", "text": "func (o *CreateSearchNotFound) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "4d64e09ef8d031a901b3ec6f1dc0f679", "score": "0.4980698", "text": "func parseResult(res testResult) *testSuite {\n\tret := &testSuite{}\n\n\tswitch {\n\tcase res.skipped:\n\t\tret.Tests = 1\n\t\tret.Skipped = 1\n\tcase res.workflowSuccess:\n\t\t// Workflow completed without error. Only in this case do we try to parse the result.\n\t\tret = convertToTestSuite(res.results)\n\tdefault:\n\t\tret.Tests = 1\n\t\tret.Errors = 1\n\t\tif res.err != nil {\n\t\t\tret.SystemErr = res.err.Error()\n\t\t} else {\n\t\t\tret.SystemErr = \"Unknown status\"\n\t\t}\n\t}\n\n\tret.Name = fmt.Sprintf(\"%s-%s\", res.testWorkflow.Name, res.testWorkflow.ShortImage)\n\treturn ret\n}", "title": "" }, { "docid": "eb4bcecd5adaba265266c54b05a9b22d", "score": "0.49737644", "text": "func createFailedResult(rt *route.Route,\n\treason channeldb.FailureReason) *PaymentResult {\n\n\tresult := &PaymentResult{\n\t\tSuccess: false,\n\t\tFailureReason: reason,\n\t}\n\n\t// In case of incorrect payment details, set the route. This can be used\n\t// for probing and to extract a fee estimate from the route.\n\tif reason == channeldb.FailureReasonIncorrectPaymentDetails {\n\t\tresult.Route = rt\n\t}\n\n\treturn result\n}", "title": "" }, { "docid": "a614ad3bd1185d82418ab78fcc7f710d", "score": "0.49686623", "text": "func TestValidateValid(t *testing.T) {\n\tunittest.SmallTest(t)\n\n\ttype validInput struct {\n\t\tresults GoldResults\n\t\tignoreResults bool\n\t}\n\n\ttests := map[string]validInput{\n\t\t\"emptyResultsButResultsIgnored\": {\n\t\t\tresults: GoldResults{\n\t\t\t\tGitHash: \"aaa27ef254ad66609606c7af0730ee062b25edf9\",\n\t\t\t\tKey: map[string]string{\"param1\": \"value1\"},\n\t\t\t\tResults: []*Result{},\n\t\t\t},\n\t\t\tignoreResults: true,\n\t\t},\n\t\t\"masterBranch\": {\n\t\t\tresults: GoldResults{\n\t\t\t\tGitHash: \"aaa27ef254ad66609606c7af0730ee062b25edf9\",\n\t\t\t\tKey: map[string]string{\"param1\": \"value1\"},\n\t\t\t\tResults: []*Result{\n\t\t\t\t\t{\n\t\t\t\t\t\tKey: map[string]string{\n\t\t\t\t\t\t\ttypes.PrimaryKeyField: \"bar\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\tDigest: \"12345abc\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tignoreResults: false,\n\t\t},\n\t\t\"onChangeList\": {\n\t\t\tresults: GoldResults{\n\t\t\t\tGitHash: \"aaa27ef254ad66609606c7af0730ee062b25edf9\",\n\t\t\t\tKey: map[string]string{\"param1\": \"value1\"},\n\t\t\t\tResults: []*Result{\n\t\t\t\t\t{\n\t\t\t\t\t\tKey: map[string]string{\n\t\t\t\t\t\t\ttypes.PrimaryKeyField: \"bar\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\tDigest: \"12345abc\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tChangeListID: \"123456\",\n\t\t\t\tCodeReviewSystem: \"some_system\",\n\t\t\t\tPatchSetOrder: 1,\n\t\t\t\tTryJobID: \"12345\",\n\t\t\t\tContinuousIntegrationSystem: \"sandbucket\",\n\t\t\t},\n\t\t\tignoreResults: false,\n\t\t},\n\t\t\"withPatchsetID\": {\n\t\t\tresults: GoldResults{\n\t\t\t\tGitHash: \"aaa27ef254ad66609606c7af0730ee062b25edf9\",\n\t\t\t\tKey: map[string]string{\"param1\": \"value1\"},\n\t\t\t\tResults: []*Result{\n\t\t\t\t\t{\n\t\t\t\t\t\tKey: map[string]string{\n\t\t\t\t\t\t\ttypes.PrimaryKeyField: \"bar\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\tDigest: \"12345abc\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tChangeListID: \"123456\",\n\t\t\t\tCodeReviewSystem: \"some_system\",\n\t\t\t\tPatchSetID: \"another id\",\n\t\t\t\tTryJobID: \"12345\",\n\t\t\t\tContinuousIntegrationSystem: \"sandbucket\",\n\t\t\t},\n\t\t\tignoreResults: false,\n\t\t},\n\t}\n\n\tfor name, testCase := range tests {\n\t\terr := testCase.results.Validate(testCase.ignoreResults)\n\t\trequire.NoError(t, err, \"when processing %s: %v\", name, testCase)\n\t}\n\n}", "title": "" }, { "docid": "2ab4619b3e8258b60b1c2eafbd986c29", "score": "0.49578077", "text": "func (o *CreateRegistryEntitiesCreated) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "24e2b74da771a1063b9bfb85dd8c896d", "score": "0.49518844", "text": "func NewDeviceActionResult()(*DeviceActionResult) {\n m := &DeviceActionResult{\n }\n m.backingStore = ie8677ce2c7e1b4c22e9c3827ecd078d41185424dd9eeb92b7d971ed2d49a392e.BackingStoreFactoryInstance();\n m.SetAdditionalData(make(map[string]any))\n return m\n}", "title": "" }, { "docid": "30b7e8d0b8e5404e505999e844b9ac55", "score": "0.49473047", "text": "func Pass(s *Result) {\n\ts.Final = false\n}", "title": "" }, { "docid": "8372c774558b804a04422706963a3c6c", "score": "0.49470538", "text": "func (req *Request) Result(v interface{}) {\n\treq.result = v\n}", "title": "" }, { "docid": "77eb01fad3e92103f884cc5f80721aad", "score": "0.49361536", "text": "func (ddruo *DatabaseDetectorResultUpdateOne) SetResult(sr schema.DetectorResult) *DatabaseDetectorResultUpdateOne {\n\tddruo.mutation.ResetResult()\n\tddruo.mutation.SetResult(sr)\n\treturn ddruo\n}", "title": "" }, { "docid": "15de641a82c8648f4770c7c541e7f19a", "score": "0.49318776", "text": "func generateResult(j *work.Job, jobKind string, isUnique bool) models.JobStats {\n\tif j == nil {\n\t\treturn models.JobStats{}\n\t}\n\n\treturn models.JobStats{\n\t\tStats: &models.JobStatData{\n\t\t\tJobID: j.ID,\n\t\t\tJobName: j.Name,\n\t\t\tJobKind: jobKind,\n\t\t\tIsUnique: isUnique,\n\t\t\tStatus: job.JobStatusPending,\n\t\t\tEnqueueTime: j.EnqueuedAt,\n\t\t\tUpdateTime: time.Now().Unix(),\n\t\t\tRefLink: fmt.Sprintf(\"/api/v1/jobs/%s\", j.ID),\n\t\t},\n\t}\n}", "title": "" }, { "docid": "b12861da4c0e5d979b50576d27f075df", "score": "0.4918015", "text": "func (o *CardinalityActionResultAllOf) HasResult() bool {\n\tif o != nil && o.Result != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "1c16d99ec461d8d4cd22d86d6a9ee69d", "score": "0.4914564", "text": "func (c SettingsStoreCreateIfUpToDateFuncCall) Results() []interface{} {\n\treturn []interface{}{c.Result0, c.Result1}\n}", "title": "" }, { "docid": "91661457b205bcf17f4f35e77a1f4182", "score": "0.49131814", "text": "func (p *Param) Ok() bool {\n\tif p.final {\n\t\treturn true\n\t}\n\telapsed := time.Now().Sub(p.updated)\n\treturn elapsed.Seconds() < 3\n}", "title": "" }, { "docid": "408477621747204a2952f94f23b9b9e8", "score": "0.49037796", "text": "func (pdrc *PingDetectorResultCreate) check() error {\n\tif _, ok := pdrc.mutation.CreatedAt(); !ok {\n\t\treturn &ValidationError{Name: \"created_at\", err: errors.New(`ent: missing required field \"PingDetectorResult.created_at\"`)}\n\t}\n\tif _, ok := pdrc.mutation.UpdatedAt(); !ok {\n\t\treturn &ValidationError{Name: \"updated_at\", err: errors.New(`ent: missing required field \"PingDetectorResult.updated_at\"`)}\n\t}\n\tif _, ok := pdrc.mutation.Task(); !ok {\n\t\treturn &ValidationError{Name: \"task\", err: errors.New(`ent: missing required field \"PingDetectorResult.task\"`)}\n\t}\n\tif _, ok := pdrc.mutation.Result(); !ok {\n\t\treturn &ValidationError{Name: \"result\", err: errors.New(`ent: missing required field \"PingDetectorResult.result\"`)}\n\t}\n\tif v, ok := pdrc.mutation.Result(); ok {\n\t\tif err := pingdetectorresult.ResultValidator(int8(v)); err != nil {\n\t\t\treturn &ValidationError{Name: \"result\", err: fmt.Errorf(`ent: validator failed for field \"PingDetectorResult.result\": %w`, err)}\n\t\t}\n\t}\n\tif _, ok := pdrc.mutation.MaxDuration(); !ok {\n\t\treturn &ValidationError{Name: \"maxDuration\", err: errors.New(`ent: missing required field \"PingDetectorResult.maxDuration\"`)}\n\t}\n\tif _, ok := pdrc.mutation.Messages(); !ok {\n\t\treturn &ValidationError{Name: \"messages\", err: errors.New(`ent: missing required field \"PingDetectorResult.messages\"`)}\n\t}\n\tif _, ok := pdrc.mutation.Ips(); !ok {\n\t\treturn &ValidationError{Name: \"ips\", err: errors.New(`ent: missing required field \"PingDetectorResult.ips\"`)}\n\t}\n\tif _, ok := pdrc.mutation.Results(); !ok {\n\t\treturn &ValidationError{Name: \"results\", err: errors.New(`ent: missing required field \"PingDetectorResult.results\"`)}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4610de4b42abaef08c45ace758394c36", "score": "0.4898538", "text": "func (c *BaseController) OK(v json.Marshaler) *Result {\n\treturn &Result{Data: v}\n}", "title": "" }, { "docid": "f394d616d4a64e246cf147a0c9a8d227", "score": "0.48953053", "text": "func extractCreateFromTxnResult(data map[string]interface{}, modelIndex string) (client.Object, error) {\n\tif data[\"create\"] == nil {\n\t\treturn nil, fmt.Errorf(\"no created objects in result %s\", data)\n\t}\n\n\tcreateList := data[\"create\"].([]interface{})\n\tfor _, c := range createList {\n\t\tcm := c.(map[string]interface{})\n\t\tmi := cm[\"modelIndex\"].(string)\n\t\tif !strings.EqualFold(mi, modelIndex) {\n\t\t\tcontinue\n\t\t}\n\n\t\tcreatedObj, err := client.NewObject(cm)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to parse cluster type %v: %v\", c, err)\n\t\t}\n\n\t\treturn createdObj, nil\n\t}\n\n\treturn nil, fmt.Errorf(\"modelIndex %s not found in create result\", modelIndex)\n}", "title": "" }, { "docid": "feb0cb5df6e4cee15acb9558084de2f6", "score": "0.4893487", "text": "func (gs GameService) compute_result() (result Result) {\n //@todo\n return\n}", "title": "" }, { "docid": "f9ca3f662e887ba5cdf2b77b6058ecb4", "score": "0.4887061", "text": "func (x *fastReflection_TallyResult) New() protoreflect.Message {\n\treturn new(fastReflection_TallyResult)\n}", "title": "" }, { "docid": "3372c255eae54b96486313e59f450d0a", "score": "0.48845255", "text": "func (o *VscanOnAccessCreateCreated) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "32f1b8e9625f28852b5634da01c43ccc", "score": "0.4882937", "text": "func (o *BatchReferencesCreateUnauthorized) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "e5732defe7246d3e6d3feb4855477853", "score": "0.48826286", "text": "func successImportHash(id int, result *model.Proverb) bool {\n\tvar hash struct {\n\t\tID string `json:\"id\"`\n\t\tRiddle string `json:\"riddle\"`\n\t\tAnswer string `json:\"answer\"`\n\t}\n\tresult.ID = strconv.Itoa(id)\n\tif ok, _ := redis.Bool(db.DB.Do(\"HEXISTS\", proverbParams.ProverbHash, id)); ok {\n\t\treturn true\n\t}\n\tfmt.Println(result)\n\thash.ID = result.ID\n\thash.Riddle = result.Riddle\n\thash.Answer = result.Answer\n\tif _, err := db.DB.Do(\"HMSET\", redis.Args{}.Add(fmt.Sprintf(proverbParams.ProverbHash+\":%d\", id)).AddFlat(&hash)...); err != nil {\n\t\tfmt.Println(err)\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "8afcf7705aacd81701114becf29624a7", "score": "0.48817343", "text": "func (ss *ServiceStatus) AddResult(result *Result) {\n\tif len(ss.Results) > 0 {\n\t\t// Check if there's any change since the last result\n\t\t// OR there's only 1 event, which only happens when there's a start event\n\t\tif ss.Results[len(ss.Results)-1].Success != result.Success || len(ss.Events) == 1 {\n\t\t\tevent := &Event{Timestamp: result.Timestamp}\n\t\t\tif result.Success {\n\t\t\t\tevent.Type = EventHealthy\n\t\t\t} else {\n\t\t\t\tevent.Type = EventUnhealthy\n\t\t\t}\n\t\t\tss.Events = append(ss.Events, event)\n\t\t\tif len(ss.Events) > MaximumNumberOfEvents {\n\t\t\t\t// Doing ss.Events[1:] would usually be sufficient, but in the case where for some reason, the slice has\n\t\t\t\t// more than one extra element, we can get rid of all of them at once and thus returning the slice to a\n\t\t\t\t// length of MaximumNumberOfEvents by using ss.Events[len(ss.Events)-MaximumNumberOfEvents:] instead\n\t\t\t\tss.Events = ss.Events[len(ss.Events)-MaximumNumberOfEvents:]\n\t\t\t}\n\t\t}\n\t}\n\tss.Results = append(ss.Results, result)\n\tif len(ss.Results) > MaximumNumberOfResults {\n\t\t// Doing ss.Results[1:] would usually be sufficient, but in the case where for some reason, the slice has more\n\t\t// than one extra element, we can get rid of all of them at once and thus returning the slice to a length of\n\t\t// MaximumNumberOfResults by using ss.Results[len(ss.Results)-MaximumNumberOfResults:] instead\n\t\tss.Results = ss.Results[len(ss.Results)-MaximumNumberOfResults:]\n\t}\n\tss.Uptime.ProcessResult(result)\n}", "title": "" }, { "docid": "7ae1777418e59cfd01ccc4a1d81ef954", "score": "0.48773086", "text": "func updateResult(lap model.Lap, r model.Result) model.Result {\n\tmoreTime := (time.Duration(lap.LapTime.Minute()) * time.Minute) +\n\t\t(time.Duration(lap.LapTime.Second()) * time.Second) +\n\t\t(time.Duration(lap.LapTime.Nanosecond()) * time.Nanosecond)\n\n\tif lap.LapID > r.Laps {\n\t\tr.Laps = lap.LapID\n\t}\n\tr.RunnerTime = r.RunnerTime.Add(moreTime)\n\treturn r\n}", "title": "" }, { "docid": "38010a851af58100a119e4a500ae230c", "score": "0.48741627", "text": "func (r *Runner) addResult(s result) result {\n\tm, ok := r.Metrics[s.doResult.RequestLabel]\n\tif !ok {\n\t\tm = new(Metrics)\n\t\tr.Metrics[s.doResult.RequestLabel] = m\n\t}\n\tm.add(s)\n\treturn s\n}", "title": "" }, { "docid": "b29502c27340d7afebe89cff162db457", "score": "0.48724797", "text": "func (p *rpcContext) OK(value interface{}) *rpcReturn {\n\tif thread := p.getThread(); thread != nil {\n\t\tstream := thread.outStream\n\t\tstream.SetWritePos(17)\n\t\tstream.WriteBool(true)\n\n\t\tif stream.Write(value) != rpcStreamWriteOK {\n\t\t\treturn p.writeError(\"return type is error\", getStackString(1))\n\t\t}\n\n\t\tthread.execSuccessful = true\n\t}\n\treturn nilReturn\n}", "title": "" }, { "docid": "7a039f8cc0040bcf5fd6af506b4690f5", "score": "0.48712766", "text": "func determineSuccess(idx int, originalValue, newValue bool) bool {\n\tif idx == 0 {\n\t\treturn true\n\t}\n\n\treturn originalValue && newValue\n}", "title": "" }, { "docid": "23bdbcfa7d571c72212638595a5b0b2f", "score": "0.48631853", "text": "func TestReferee_result(t *testing.T) {\n\tref := getReferee()\n\n\tgRes := ref.result(0, 1, \"test\", true)\n\n\tif gRes.BrokenRule != true {\n\t\tt.Fail()\n\t}\n\n\tif gRes.Loser != PLAYER_2 || gRes.Winner != PLAYER_1 {\n\t\tt.Fail()\n\t}\n\n\tif gRes.Reason != \"test\" {\n\t\tt.Fail()\n\t}\n}", "title": "" }, { "docid": "8452203bbfbb7aa967782b56e7458d4a", "score": "0.48613846", "text": "func SetOk(c *gin.Context, extra ...interface{}) {\n\tvar (\n\t\texlen = len(extra)\n\t\tdata interface{} = true\n\t\tcode = http.StatusOK\n\t\tremain int64 = 0\n\t)\n\tif exlen >= 1 {\n\t\tcode = extra[0].(int)\n\t}\n\tif exlen >= 2 {\n\t\tdata = extra[1]\n\t}\n\n\tswitch code {\n\tcase http.StatusCreated:\n\t\tlogger.Info(fmt.Sprintf(\"Create (%s) Success. detail:%v\", reflect.TypeOf(data), data))\n\tcase http.StatusPartialContent:\n\t\tremain = extra[2].(int64)\n\t}\n\n\tif reflect.TypeOf(data).Kind() == reflect.Slice {\n\t\tc.JSON(code, core.ArrayResponse{Data: data, Remain: remain})\n\t} else {\n\t\tc.JSON(code, core.ObjectResponse{Data: data})\n\t}\n}", "title": "" }, { "docid": "5168d91090e12d545f1843ac3cabfc4b", "score": "0.4850801", "text": "func (o *CreateDataCollectorCreated) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "e18b8c567ebc7a054f89fdccd91c55fc", "score": "0.48458663", "text": "func (o *MetroclusterDiagnosticsCreateAccepted) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "78e72360d8765de8c66ecb0ac13fbd0f", "score": "0.4842913", "text": "func (r *SubscriptionRepository) Success() {}", "title": "" }, { "docid": "fe92c7903921ba965c77af567970619e", "score": "0.48299146", "text": "func (o *BatchReferencesCreateOK) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "72297d4f9c931d5c57e3814e67dfdf79", "score": "0.48268396", "text": "func newMntRet(log logging.Logger, op string, mntPoint string, status pb.ResponseStatus, errMsg string,\n\tinfoMsg string) *pb.ScmMountResult {\n\n\treturn &pb.ScmMountResult{\n\t\tMntpoint: mntPoint,\n\t\tState: newState(log, status, errMsg, infoMsg, \"scm mount \"+op),\n\t}\n}", "title": "" }, { "docid": "6cff2e521cf47e5c58a2ac7a403f6ffe", "score": "0.48221076", "text": "func (o *LazyStartsWithOperation) getResult(results interface{}) error {\n\tvar tp reflect.Type\n\tvar ok bool\n\tif tp, ok = isMapStringToPtrStruct(reflect.TypeOf(results)); !ok {\n\t\treturn fmt.Errorf(\"expected o.results to be of type map[string]*struct, got %T\", results)\n\t}\n\n\tfinalResult := reflect.ValueOf(results)\n\n\tfor _, document := range o.rawResult.Results {\n\t\tnewDocumentInfo := getNewDocumentInfo(document)\n\t\to.sessionOperations.documentsByID.add(newDocumentInfo)\n\n\t\tif newDocumentInfo.id == \"\" {\n\t\t\tcontinue // is this possible?\n\t\t}\n\n\t\tid := strings.ToLower(newDocumentInfo.id)\n\n\t\tkey := reflect.ValueOf(id)\n\t\tif o.sessionOperations.IsDeleted(newDocumentInfo.id) {\n\t\t\tnilPtr := reflect.New(tp)\n\t\t\tfinalResult.SetMapIndex(key, reflect.ValueOf(nilPtr))\n\t\t\tcontinue\n\t\t}\n\t\tdoc := o.sessionOperations.documentsByID.getValue(newDocumentInfo.id)\n\t\tif doc != nil {\n\t\t\tv := reflect.New(tp).Interface()\n\t\t\tif err := o.sessionOperations.TrackEntityInDocumentInfo(v, doc); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tfinalResult.SetMapIndex(key, reflect.ValueOf(v).Elem())\n\t\t\tcontinue\n\t\t}\n\t\tnilPtr := reflect.New(tp)\n\t\tfinalResult.SetMapIndex(key, reflect.ValueOf(nilPtr))\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "84353749c747709b1aaf162f1d988a1f", "score": "0.48120376", "text": "func (o *VscanOnAccessCreateDefault) IsSuccess() bool {\n\treturn o._statusCode/100 == 2\n}", "title": "" }, { "docid": "9fcdd688b8f1958ed3cd241c3999b47e", "score": "0.48055145", "text": "func (o *CreateSearchNoContent) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "890ca78fb5780067714b6ee99e07c96e", "score": "0.4793076", "text": "func returnOne(c <-chan Result) (any bool, firstOffset uint32, e error) {\n\tif result, ok := <-c; ok {\n\t\tif result.Error == nil {\n\t\t\tif _, ok = <-c; ok {\n\t\t\t\tpanic(\"got more than one result\")\n\t\t\t}\n\t\t\treturn true, result.Offset, nil\n\t\t} else {\n\t\t\tif _, ok = <-c; ok {\n\t\t\t\tpanic(\"got more than one result\")\n\t\t\t}\n\t\t\treturn false, result.Offset, result.Error\n\t\t}\n\t}\n\treturn false, 0, nil\n}", "title": "" }, { "docid": "4651c1f647d2001f6910535cdb6a5907", "score": "0.478768", "text": "func (s *Service) Result(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tkey := r.FormValue(\"key\")\n\tres := &Response{\n\t\tSuccess: false,\n\t}\n\n\tfmt.Println(\"result: key\", key)\n\tif s.GetResult == nil {\n\t\tjson.NewEncoder(w).Encode(res)\n\t\treturn\n\t}\n\tplayers, balances := s.GetResult(key)\n\tbalancesString := []string{}\n\tfor _, balance := range balances {\n\t\tbalancesString = append(balancesString, balance.String())\n\t}\n\tres.Players = players\n\tres.Balances = balancesString\n\tres.Success = true\n\tjson.NewEncoder(w).Encode(res)\n}", "title": "" } ]
84d5ca2a8f00a7859a63978ccd6d8750
SetXCorrelationID : Allow user to set XCorrelationID
[ { "docid": "8ddb7a376d8d6a942ae863d5c85cbcba", "score": "0.6421047", "text": "func (_options *DeleteMonitorOptions) SetXCorrelationID(xCorrelationID string) *DeleteMonitorOptions {\n\t_options.XCorrelationID = core.StringPtr(xCorrelationID)\n\treturn _options\n}", "title": "" } ]
[ { "docid": "7ac5b365c02efe76ee8a16905a8aefd4", "score": "0.7183931", "text": "func (m *CloudPcOnPremisesConnectionHealthCheck) SetCorrelationId(value *string)() {\n err := m.GetBackingStore().Set(\"correlationId\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "2b0c062d0719f51a5e9a28f14de2f42f", "score": "0.71563655", "text": "func (_options *GetCustomResolverOptions) SetXCorrelationID(xCorrelationID string) *GetCustomResolverOptions {\n\t_options.XCorrelationID = core.StringPtr(xCorrelationID)\n\treturn _options\n}", "title": "" }, { "docid": "503a84faea00e05e04c752bf9e368a0a", "score": "0.7103295", "text": "func (_options *CreatePoolOptions) SetXCorrelationID(xCorrelationID string) *CreatePoolOptions {\n\t_options.XCorrelationID = core.StringPtr(xCorrelationID)\n\treturn _options\n}", "title": "" }, { "docid": "2100dee854533297c39f91cfa9f93c6a", "score": "0.7101961", "text": "func (_options *CreateCustomResolverOptions) SetXCorrelationID(xCorrelationID string) *CreateCustomResolverOptions {\n\t_options.XCorrelationID = core.StringPtr(xCorrelationID)\n\treturn _options\n}", "title": "" }, { "docid": "4e1fa87c195535e89b27fc0a940ff8e8", "score": "0.70532984", "text": "func (_options *CreateMonitorOptions) SetXCorrelationID(xCorrelationID string) *CreateMonitorOptions {\n\t_options.XCorrelationID = core.StringPtr(xCorrelationID)\n\treturn _options\n}", "title": "" }, { "docid": "f17469a7e1a2138d9d662bfb068deb17", "score": "0.70230645", "text": "func (_options *GetPoolOptions) SetXCorrelationID(xCorrelationID string) *GetPoolOptions {\n\t_options.XCorrelationID = core.StringPtr(xCorrelationID)\n\treturn _options\n}", "title": "" }, { "docid": "63faafbc7135d45ae8f1ffbecdd3739f", "score": "0.7011722", "text": "func (_options *GetPermittedNetworkOptions) SetXCorrelationID(xCorrelationID string) *GetPermittedNetworkOptions {\n\t_options.XCorrelationID = core.StringPtr(xCorrelationID)\n\treturn _options\n}", "title": "" }, { "docid": "ae6a9693a222408afb8b4df688af2f1c", "score": "0.700215", "text": "func (_options *GetDnszoneAccessRequestOptions) SetXCorrelationID(xCorrelationID string) *GetDnszoneAccessRequestOptions {\n\t_options.XCorrelationID = core.StringPtr(xCorrelationID)\n\treturn _options\n}", "title": "" }, { "docid": "c89016434b8f96834bca0aa7de4339c4", "score": "0.6997757", "text": "func (_options *GetLinkedPermittedNetworkOptions) SetXCorrelationID(xCorrelationID string) *GetLinkedPermittedNetworkOptions {\n\t_options.XCorrelationID = core.StringPtr(xCorrelationID)\n\treturn _options\n}", "title": "" }, { "docid": "455a704ae095039280681453529aa66f", "score": "0.6994029", "text": "func (_options *GetMonitorOptions) SetXCorrelationID(xCorrelationID string) *GetMonitorOptions {\n\t_options.XCorrelationID = core.StringPtr(xCorrelationID)\n\treturn _options\n}", "title": "" }, { "docid": "85c4f915ebefb6527458a6b0bd23ac57", "score": "0.6984234", "text": "func (_options *CreatePermittedNetworkOptions) SetXCorrelationID(xCorrelationID string) *CreatePermittedNetworkOptions {\n\t_options.XCorrelationID = core.StringPtr(xCorrelationID)\n\treturn _options\n}", "title": "" }, { "docid": "44e696204328588546ef1ba3f8e8baf4", "score": "0.6950899", "text": "func (_options *GetLinkedZoneOptions) SetXCorrelationID(xCorrelationID string) *GetLinkedZoneOptions {\n\t_options.XCorrelationID = core.StringPtr(xCorrelationID)\n\treturn _options\n}", "title": "" }, { "docid": "cf61274c2f1f1ed26b4cb3e2e03b9dcf", "score": "0.6948503", "text": "func (_options *UpdateCustomResolverOptions) SetXCorrelationID(xCorrelationID string) *UpdateCustomResolverOptions {\n\t_options.XCorrelationID = core.StringPtr(xCorrelationID)\n\treturn _options\n}", "title": "" }, { "docid": "dea27beeb66f360706ed1ae8e2af65f1", "score": "0.6925743", "text": "func (m *DirectoryAudit) SetCorrelationId(value *string)() {\n err := m.GetBackingStore().Set(\"correlationId\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "d7f09de29524abf6ee20f55493f40e05", "score": "0.68709016", "text": "func (_options *UpdateDnszoneAccessRequestOptions) SetXCorrelationID(xCorrelationID string) *UpdateDnszoneAccessRequestOptions {\n\t_options.XCorrelationID = core.StringPtr(xCorrelationID)\n\treturn _options\n}", "title": "" }, { "docid": "0fa8d27dd31bdc6d4a2aab88d520ecda", "score": "0.68651646", "text": "func (_options *CreateLzPermittedNetworkOptions) SetXCorrelationID(xCorrelationID string) *CreateLzPermittedNetworkOptions {\n\t_options.XCorrelationID = core.StringPtr(xCorrelationID)\n\treturn _options\n}", "title": "" }, { "docid": "660156a98feeadc2f1a9e197427ebb3e", "score": "0.68445337", "text": "func (_options *UpdateCustomResolverLocationOptions) SetXCorrelationID(xCorrelationID string) *UpdateCustomResolverLocationOptions {\n\t_options.XCorrelationID = core.StringPtr(xCorrelationID)\n\treturn _options\n}", "title": "" }, { "docid": "c5c21fd424db77e1d6a8d62ce7e3456f", "score": "0.6788744", "text": "func (_options *CreateLinkedZoneOptions) SetXCorrelationID(xCorrelationID string) *CreateLinkedZoneOptions {\n\t_options.XCorrelationID = core.StringPtr(xCorrelationID)\n\treturn _options\n}", "title": "" }, { "docid": "f2086ea9577a1302363c26acabec3e87", "score": "0.67817724", "text": "func (_options *UpdatePoolOptions) SetXCorrelationID(xCorrelationID string) *UpdatePoolOptions {\n\t_options.XCorrelationID = core.StringPtr(xCorrelationID)\n\treturn _options\n}", "title": "" }, { "docid": "e1366140c17e3ce9ea096159e6594086", "score": "0.67432487", "text": "func (_options *CreateForwardingRuleOptions) SetXCorrelationID(xCorrelationID string) *CreateForwardingRuleOptions {\n\t_options.XCorrelationID = core.StringPtr(xCorrelationID)\n\treturn _options\n}", "title": "" }, { "docid": "cb27352166c5af272d11c4842e4d3f5a", "score": "0.6741924", "text": "func (_options *AddCustomResolverLocationOptions) SetXCorrelationID(xCorrelationID string) *AddCustomResolverLocationOptions {\n\t_options.XCorrelationID = core.StringPtr(xCorrelationID)\n\treturn _options\n}", "title": "" }, { "docid": "02058a19b97b8f066cdfaa86993e2be8", "score": "0.67410135", "text": "func (_options *GetForwardingRuleOptions) SetXCorrelationID(xCorrelationID string) *GetForwardingRuleOptions {\n\t_options.XCorrelationID = core.StringPtr(xCorrelationID)\n\treturn _options\n}", "title": "" }, { "docid": "6fb277ff4a434be969a94caa672dc198", "score": "0.6736495", "text": "func (_options *UpdateMonitorOptions) SetXCorrelationID(xCorrelationID string) *UpdateMonitorOptions {\n\t_options.XCorrelationID = core.StringPtr(xCorrelationID)\n\treturn _options\n}", "title": "" }, { "docid": "9ecadc364413c556ed0ecc58e950e5ea", "score": "0.6682696", "text": "func (_options *UpdateLinkedZoneOptions) SetXCorrelationID(xCorrelationID string) *UpdateLinkedZoneOptions {\n\t_options.XCorrelationID = core.StringPtr(xCorrelationID)\n\treturn _options\n}", "title": "" }, { "docid": "cedef38847edf8cefa07273c46d239d6", "score": "0.66577625", "text": "func (_options *GetDnszoneOptions) SetXCorrelationID(xCorrelationID string) *GetDnszoneOptions {\n\t_options.XCorrelationID = core.StringPtr(xCorrelationID)\n\treturn _options\n}", "title": "" }, { "docid": "ec4c80f3d7806a7f5426d4e0b33556e5", "score": "0.66522026", "text": "func (m *DeviceManagementTroubleshootingEvent) SetCorrelationId(value *string)() {\n m.correlationId = value\n}", "title": "" }, { "docid": "68f8889c030bb35874b3978ae38b6733", "score": "0.6645208", "text": "func (_options *GetSecondaryZoneOptions) SetXCorrelationID(xCorrelationID string) *GetSecondaryZoneOptions {\n\t_options.XCorrelationID = core.StringPtr(xCorrelationID)\n\treturn _options\n}", "title": "" }, { "docid": "d7871080ee77b6811b716f62e9df10c2", "score": "0.6634969", "text": "func SetCorrelationID(cid string) RequestFunc {\n\treturn func(ctx context.Context, pub *amqp.Publishing, _ *amqp.Delivery) context.Context {\n\t\tpub.CorrelationId = cid\n\t\treturn ctx\n\t}\n}", "title": "" }, { "docid": "b858cddabfcd0c9c8b04887d06becfd4", "score": "0.66236514", "text": "func (_options *GetLoadBalancerOptions) SetXCorrelationID(xCorrelationID string) *GetLoadBalancerOptions {\n\t_options.XCorrelationID = core.StringPtr(xCorrelationID)\n\treturn _options\n}", "title": "" }, { "docid": "6d0cfdd7b271962baa44ba898a0b03c1", "score": "0.66153616", "text": "func (_options *CreateResourceRecordOptions) SetXCorrelationID(xCorrelationID string) *CreateResourceRecordOptions {\n\t_options.XCorrelationID = core.StringPtr(xCorrelationID)\n\treturn _options\n}", "title": "" }, { "docid": "745896a9542c331d32bd705db0946eae", "score": "0.66105175", "text": "func (m *CustomExtensionHandlerInstance) SetExternalCorrelationId(value *string)() {\n err := m.GetBackingStore().Set(\"externalCorrelationId\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "173b212214be8245ba64759e139ece34", "score": "0.6578819", "text": "func (_options *CreateSecondaryZoneOptions) SetXCorrelationID(xCorrelationID string) *CreateSecondaryZoneOptions {\n\t_options.XCorrelationID = core.StringPtr(xCorrelationID)\n\treturn _options\n}", "title": "" }, { "docid": "e3248eef692a07697e164db28f0160e6", "score": "0.657631", "text": "func (_options *DeleteCustomResolverOptions) SetXCorrelationID(xCorrelationID string) *DeleteCustomResolverOptions {\n\t_options.XCorrelationID = core.StringPtr(xCorrelationID)\n\treturn _options\n}", "title": "" }, { "docid": "08a006242073a44c530df1e11d76193d", "score": "0.65584147", "text": "func (_options *CreateLoadBalancerOptions) SetXCorrelationID(xCorrelationID string) *CreateLoadBalancerOptions {\n\t_options.XCorrelationID = core.StringPtr(xCorrelationID)\n\treturn _options\n}", "title": "" }, { "docid": "0f0edb343382568301034ed2e0a33fac", "score": "0.65328646", "text": "func (_options *CreateDnszoneOptions) SetXCorrelationID(xCorrelationID string) *CreateDnszoneOptions {\n\t_options.XCorrelationID = core.StringPtr(xCorrelationID)\n\treturn _options\n}", "title": "" }, { "docid": "2383efac714e6d0680189ef767b3fa39", "score": "0.6527343", "text": "func (_options *DeleteLzPermittedNetworkOptions) SetXCorrelationID(xCorrelationID string) *DeleteLzPermittedNetworkOptions {\n\t_options.XCorrelationID = core.StringPtr(xCorrelationID)\n\treturn _options\n}", "title": "" }, { "docid": "9e5e3fb4cb8cf2e916a8078ba77614d1", "score": "0.65266085", "text": "func (_options *DeleteCustomResolverLocationOptions) SetXCorrelationID(xCorrelationID string) *DeleteCustomResolverLocationOptions {\n\t_options.XCorrelationID = core.StringPtr(xCorrelationID)\n\treturn _options\n}", "title": "" }, { "docid": "abb2b99f0c4fa128184770a9af1a97fb", "score": "0.6519151", "text": "func (_options *UpdateForwardingRuleOptions) SetXCorrelationID(xCorrelationID string) *UpdateForwardingRuleOptions {\n\t_options.XCorrelationID = core.StringPtr(xCorrelationID)\n\treturn _options\n}", "title": "" }, { "docid": "74bac736ac7ea53062048709056c5208", "score": "0.6503949", "text": "func (_options *UpdateDnszoneOptions) SetXCorrelationID(xCorrelationID string) *UpdateDnszoneOptions {\n\t_options.XCorrelationID = core.StringPtr(xCorrelationID)\n\treturn _options\n}", "title": "" }, { "docid": "142c925279210074d7e44b036540c592", "score": "0.6465396", "text": "func (_options *UpdateResourceRecordOptions) SetXCorrelationID(xCorrelationID string) *UpdateResourceRecordOptions {\n\t_options.XCorrelationID = core.StringPtr(xCorrelationID)\n\treturn _options\n}", "title": "" }, { "docid": "5e7b92a24aae58e3e14f023872da98d5", "score": "0.6459923", "text": "func (_options *DeletePermittedNetworkOptions) SetXCorrelationID(xCorrelationID string) *DeletePermittedNetworkOptions {\n\t_options.XCorrelationID = core.StringPtr(xCorrelationID)\n\treturn _options\n}", "title": "" }, { "docid": "7dcd0b59e5b93f8d1cfef05344900c81", "score": "0.6440375", "text": "func (_options *ListCustomResolversOptions) SetXCorrelationID(xCorrelationID string) *ListCustomResolversOptions {\n\t_options.XCorrelationID = core.StringPtr(xCorrelationID)\n\treturn _options\n}", "title": "" }, { "docid": "5f759df23ffb25806791fc462318d2b0", "score": "0.6435649", "text": "func (_options *UpdateLoadBalancerOptions) SetXCorrelationID(xCorrelationID string) *UpdateLoadBalancerOptions {\n\t_options.XCorrelationID = core.StringPtr(xCorrelationID)\n\treturn _options\n}", "title": "" }, { "docid": "1522125da1251023218ad6cb90b155ff", "score": "0.6428818", "text": "func (_options *DeletePoolOptions) SetXCorrelationID(xCorrelationID string) *DeletePoolOptions {\n\t_options.XCorrelationID = core.StringPtr(xCorrelationID)\n\treturn _options\n}", "title": "" }, { "docid": "28e7deaedc670e86026e9b7bd90d2aaa", "score": "0.64179283", "text": "func (_options *ListDnszoneAccessRequestsOptions) SetXCorrelationID(xCorrelationID string) *ListDnszoneAccessRequestsOptions {\n\t_options.XCorrelationID = core.StringPtr(xCorrelationID)\n\treturn _options\n}", "title": "" }, { "docid": "8bd3a081a5d2f97463ad2180a87203f0", "score": "0.641428", "text": "func (_options *UpdateSecondaryZoneOptions) SetXCorrelationID(xCorrelationID string) *UpdateSecondaryZoneOptions {\n\t_options.XCorrelationID = core.StringPtr(xCorrelationID)\n\treturn _options\n}", "title": "" }, { "docid": "7aadeb0cb23ed5be27731aac1958e202", "score": "0.6407863", "text": "func (_options *ListPoolsOptions) SetXCorrelationID(xCorrelationID string) *ListPoolsOptions {\n\t_options.XCorrelationID = core.StringPtr(xCorrelationID)\n\treturn _options\n}", "title": "" }, { "docid": "b4faa354c97aa550e68bd43bb5ea167c", "score": "0.6403513", "text": "func (_options *ListForwardingRulesOptions) SetXCorrelationID(xCorrelationID string) *ListForwardingRulesOptions {\n\t_options.XCorrelationID = core.StringPtr(xCorrelationID)\n\treturn _options\n}", "title": "" }, { "docid": "c800c16c1b2a33b576803af8d78d6418", "score": "0.6400347", "text": "func (_options *ListMonitorsOptions) SetXCorrelationID(xCorrelationID string) *ListMonitorsOptions {\n\t_options.XCorrelationID = core.StringPtr(xCorrelationID)\n\treturn _options\n}", "title": "" }, { "docid": "96e97d7a4793def600954af0d73d1827", "score": "0.63515484", "text": "func (_options *DeleteLinkedZoneOptions) SetXCorrelationID(xCorrelationID string) *DeleteLinkedZoneOptions {\n\t_options.XCorrelationID = core.StringPtr(xCorrelationID)\n\treturn _options\n}", "title": "" }, { "docid": "f5841c411ddca466207a8c978b94d7e2", "score": "0.6345686", "text": "func (_options *ListLinkedPermittedNetworksOptions) SetXCorrelationID(xCorrelationID string) *ListLinkedPermittedNetworksOptions {\n\t_options.XCorrelationID = core.StringPtr(xCorrelationID)\n\treturn _options\n}", "title": "" }, { "docid": "2a4e84ea17cdf4a1fa470153ee600c4d", "score": "0.6345178", "text": "func (_options *UpdateCrLocationsOrderOptions) SetXCorrelationID(xCorrelationID string) *UpdateCrLocationsOrderOptions {\n\t_options.XCorrelationID = core.StringPtr(xCorrelationID)\n\treturn _options\n}", "title": "" }, { "docid": "04e68507c2eff7f7395ebd3ddf77b837", "score": "0.632495", "text": "func (_options *GetResourceRecordOptions) SetXCorrelationID(xCorrelationID string) *GetResourceRecordOptions {\n\t_options.XCorrelationID = core.StringPtr(xCorrelationID)\n\treturn _options\n}", "title": "" }, { "docid": "eb3ce02db298ed1553cd7e5a099778b4", "score": "0.63041216", "text": "func (res *ResponseMessage) SetCorrelationID(id CorrelationID) {\n\tif len(res.rawMsg) >= 8 {\n\t\tbinary.BigEndian.PutUint32(res.rawMsg[4:8], uint32(id))\n\t}\n}", "title": "" }, { "docid": "e78074a96452cceed8783aa49ec461df", "score": "0.63012767", "text": "func (_options *ListPermittedNetworksOptions) SetXCorrelationID(xCorrelationID string) *ListPermittedNetworksOptions {\n\t_options.XCorrelationID = core.StringPtr(xCorrelationID)\n\treturn _options\n}", "title": "" }, { "docid": "2bf9c7f90095bc579a665aef3112f78b", "score": "0.62929356", "text": "func (_options *ListLinkedZonesOptions) SetXCorrelationID(xCorrelationID string) *ListLinkedZonesOptions {\n\t_options.XCorrelationID = core.StringPtr(xCorrelationID)\n\treturn _options\n}", "title": "" }, { "docid": "a37d71ea2e446048bccbfa94950f3ed7", "score": "0.6231141", "text": "func (_options *DeleteForwardingRuleOptions) SetXCorrelationID(xCorrelationID string) *DeleteForwardingRuleOptions {\n\t_options.XCorrelationID = core.StringPtr(xCorrelationID)\n\treturn _options\n}", "title": "" }, { "docid": "3fabacfa577f57f79b09ff9ba3a478b7", "score": "0.6201866", "text": "func (_options *ListDnszonesOptions) SetXCorrelationID(xCorrelationID string) *ListDnszonesOptions {\n\t_options.XCorrelationID = core.StringPtr(xCorrelationID)\n\treturn _options\n}", "title": "" }, { "docid": "97337dd2a5463cde0c7b4345ec2425d2", "score": "0.61898816", "text": "func (_options *DeleteResourceRecordOptions) SetXCorrelationID(xCorrelationID string) *DeleteResourceRecordOptions {\n\t_options.XCorrelationID = core.StringPtr(xCorrelationID)\n\treturn _options\n}", "title": "" }, { "docid": "d2e2367a521875124791eedf7856d03f", "score": "0.6189352", "text": "func (_options *ExportResourceRecordsOptions) SetXCorrelationID(xCorrelationID string) *ExportResourceRecordsOptions {\n\t_options.XCorrelationID = core.StringPtr(xCorrelationID)\n\treturn _options\n}", "title": "" }, { "docid": "9566de62673fa8318e9fdffab4826cb3", "score": "0.6187038", "text": "func (_options *ImportResourceRecordsOptions) SetXCorrelationID(xCorrelationID string) *ImportResourceRecordsOptions {\n\t_options.XCorrelationID = core.StringPtr(xCorrelationID)\n\treturn _options\n}", "title": "" }, { "docid": "fdae12740b64aec2d69e9340bedf73fb", "score": "0.6173102", "text": "func (_options *DeleteDnszoneOptions) SetXCorrelationID(xCorrelationID string) *DeleteDnszoneOptions {\n\t_options.XCorrelationID = core.StringPtr(xCorrelationID)\n\treturn _options\n}", "title": "" }, { "docid": "13c65f7046d17bb6d67ce62efe903bed", "score": "0.6135397", "text": "func (_options *ListSecondaryZonesOptions) SetXCorrelationID(xCorrelationID string) *ListSecondaryZonesOptions {\n\t_options.XCorrelationID = core.StringPtr(xCorrelationID)\n\treturn _options\n}", "title": "" }, { "docid": "580f6a4d26779fda66a34ad0dbc0b83f", "score": "0.613435", "text": "func (o *GetPetsParams) SetXCorrelationID(xCorrelationID *string) {\n\to.XCorrelationID = xCorrelationID\n}", "title": "" }, { "docid": "53cc1a4505848d26fc4082640a380037", "score": "0.6128733", "text": "func (_options *DeleteSecondaryZoneOptions) SetXCorrelationID(xCorrelationID string) *DeleteSecondaryZoneOptions {\n\t_options.XCorrelationID = core.StringPtr(xCorrelationID)\n\treturn _options\n}", "title": "" }, { "docid": "f76d568e43d995b16b88018958dbf951", "score": "0.61043525", "text": "func (_options *ListLoadBalancersOptions) SetXCorrelationID(xCorrelationID string) *ListLoadBalancersOptions {\n\t_options.XCorrelationID = core.StringPtr(xCorrelationID)\n\treturn _options\n}", "title": "" }, { "docid": "89b8b2b1c3c5dd4a1798d9c85e455aa8", "score": "0.6050194", "text": "func (_options *DeleteLoadBalancerOptions) SetXCorrelationID(xCorrelationID string) *DeleteLoadBalancerOptions {\n\t_options.XCorrelationID = core.StringPtr(xCorrelationID)\n\treturn _options\n}", "title": "" }, { "docid": "4f603ac936d8ec8d71355c2d5fb68d2c", "score": "0.6045399", "text": "func (_options *ListResourceRecordsOptions) SetXCorrelationID(xCorrelationID string) *ListResourceRecordsOptions {\n\t_options.XCorrelationID = core.StringPtr(xCorrelationID)\n\treturn _options\n}", "title": "" }, { "docid": "3a6465a0b79e450c9fc63ba0f745d217", "score": "0.5999352", "text": "func (b *AddonStatusBuilder) CorrelationID(value string) *AddonStatusBuilder {\n\tb.correlationID = value\n\tb.bitmap_ |= 16\n\treturn b\n}", "title": "" }, { "docid": "718cfb27bca7f9b14cd9ab95c661dd64", "score": "0.59786737", "text": "func (c *CoreRequest) CorrelationID() string {\n\treturn xid.New().String()\n}", "title": "" }, { "docid": "30f7bcd80c004c79a72440d5d8de958b", "score": "0.58283657", "text": "func TestCorrelationID(t *testing.T) {\n\tcorid := \"fooid\"\n\tctx := NewFContext(corid)\n\tassert.Equal(t, corid, ctx.CorrelationID())\n}", "title": "" }, { "docid": "5afc8b87d7ee9748c41ad4c6ba304663", "score": "0.5529902", "text": "func TestNewCorrelationID(t *testing.T) {\n\tcid := \"abc\"\n\toldCID := generateCorrelationID\n\tdefer func() { generateCorrelationID = oldCID }()\n\tgenerateCorrelationID = func() string { return cid }\n\n\tctx := NewFContext(\"\")\n\n\tassert.Equal(t, cid, ctx.CorrelationID())\n}", "title": "" }, { "docid": "98bcfe6986efd2e3c48df6ca42e98a50", "score": "0.5371576", "text": "func (_m *correlationIdStore) StoreCorrelationID(ctx context.Context, cid string) {\n\t_m.Called(ctx, cid)\n}", "title": "" }, { "docid": "e5309afc772efdfb8866ac7185f7551e", "score": "0.53608686", "text": "func (o *Event) SetCorrelationId(v string) {\n\to.CorrelationId = &v\n}", "title": "" }, { "docid": "2edbcc6d5d31f92884f4c7f52fb1fd8c", "score": "0.5294451", "text": "func (m *AccessPackageResourceRole) SetOriginId(value *string)() {\n err := m.GetBackingStore().Set(\"originId\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "c6b5ff34c69a5d71bc25fb02f4b8e5d6", "score": "0.52229834", "text": "func (soc *Socket) SetReqCorrelate(value int) error {\n\treturn soc.setInt(C.ZMQ_REQ_CORRELATE, value)\n}", "title": "" }, { "docid": "d1988dcd1dcf9b76e3689fb352150789", "score": "0.5133028", "text": "func (o *WorkflowTaskNotification) SetCorrelationId(v string) {\n\to.CorrelationId = &v\n}", "title": "" }, { "docid": "fde8c662ef0b60fcb3b40f96461a42db", "score": "0.5111529", "text": "func (c client) CorrelationIDKey() string {\n\treturn c.correlationIDKey\n}", "title": "" }, { "docid": "8db710cf99e0a07b55335a4023c6d1ea", "score": "0.5062467", "text": "func (s *Storage) SetIDPublicKey(correlationID, secretKey string, publicKey string) error {\n\t// If we already have this correlation ID, return.\n\tif s.cache.Get(correlationID) != nil {\n\t\treturn errors.New(\"correlation-id provided is invalid\")\n\t}\n\tpublicKeyData, err := parseB64RSAPublicKeyFromPEM(publicKey)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"could not read public Key\")\n\t}\n\taesKey := uuid.New().String()[:32]\n\n\tciphertext, err := rsa.EncryptOAEP(sha256.New(), rand.Reader, publicKeyData, []byte(aesKey), []byte(\"\"))\n\tif err != nil {\n\t\treturn errors.New(\"could not encrypt event data\")\n\t}\n\n\tdata := &CorrelationData{\n\t\tData: make([]string, 0),\n\t\tsecretKey: secretKey,\n\t\tdataMutex: &sync.Mutex{},\n\t\taesKey: []byte(aesKey),\n\t\tAESKey: base64.StdEncoding.EncodeToString(ciphertext),\n\t}\n\ts.cache.Set(correlationID, data, s.evictionTTL)\n\treturn nil\n}", "title": "" }, { "docid": "51ea7e656e98c01d31176a293684a80e", "score": "0.50457436", "text": "func genXid() {\n\tid := xid.New()\n\tfmt.Printf(\"github.com/rs/xid: %s\\n\", id.String())\n}", "title": "" }, { "docid": "cd63becfd1b4a1ab1580ba0d34756e27", "score": "0.50348264", "text": "func (o *MicrosoftGraphSignIn) SetCorrelationId(v string) {\n\to.CorrelationId = &v\n}", "title": "" }, { "docid": "88fc4b1c2eb501f4de9abddf3fb682f1", "score": "0.50329375", "text": "func (k Keeper) setAgreementID(ctx sdk.Context, agreementID uint64) {\r\n\tstore := k.store(ctx)\r\n\tbz := k.codec.MustMarshalBinaryLengthPrefixed(agreementID)\r\n\tstore.Set(AgreementIDKey, bz)\r\n}", "title": "" }, { "docid": "f1e64ef9942d52fe6aa6a186f3823399", "score": "0.5028723", "text": "func (dsr *DeliveryServiceRequestV5) SetXMLID() {\n\tif dsr == nil {\n\t\treturn\n\t}\n\n\tif dsr.ChangeType == DSRChangeTypeDelete && dsr.Original != nil {\n\t\tdsr.XMLID = dsr.Original.XMLID\n\t\treturn\n\t}\n\n\tif dsr.Requested != nil {\n\t\tdsr.XMLID = dsr.Requested.XMLID\n\t}\n}", "title": "" }, { "docid": "f38190acbde1a31e1f4375d4b5a1e17f", "score": "0.5025968", "text": "func genXid() string {\r\n\tid := xid.New()\r\n\treturn id.String()\r\n}", "title": "" }, { "docid": "0c0671439c53a3cba8cd1f6501f46635", "score": "0.50000787", "text": "func (c *Client) getCorrelationID(ctx context.Context) string {\n\tcorrID := GetCorrelationID(ctx)\n\tif corrID == nil {\n\t\treturn uuid.New().String()\n\t}\n\n\treturn corrID.String()\n}", "title": "" }, { "docid": "6791a6348266085c0567d60104446353", "score": "0.49985912", "text": "func UseXRequestIDHeaderOption(f bool) middleware.RequestIDOption {\n\treturn middleware.UseRequestIDOption(f)\n}", "title": "" }, { "docid": "2f93933ef60c0e0a5202a2c26b52c2f4", "score": "0.49609342", "text": "func xorr(c *CPU, reg uint8) {\n\tc.A ^= reg\n}", "title": "" }, { "docid": "a6b2a85354b9edcff7cda992764c8576", "score": "0.49387956", "text": "func SetRequestID() echo.MiddlewareFunc {\n\treturn func(next echo.HandlerFunc) echo.HandlerFunc {\n\t\treturn func(c echo.Context) error {\n\t\t\treq := c.Request()\n\t\t\trid := req.Header.Get(echo.HeaderXRequestID)\n\t\t\tif rid == \"\" {\n\t\t\t\trid = pawgen.UUIDV4()\n\t\t\t}\n\t\t\tc.Response().Header().Set(echo.HeaderXRequestID, rid)\n\n\t\t\t// set requestID to the context\n\t\t\tctx := pawctx.SetRequestID(c.Request().Context(), rid)\n\t\t\tc.SetRequest(c.Request().WithContext(ctx))\n\n\t\t\treturn next(c)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1a4656832a4de48e0a8aba336fbb8783", "score": "0.4915034", "text": "func (s *Storage) SetIDPublicKey(correlationID, secretKey string, publicKey string) error {\n\tpublicKeyData, err := parseB64RSAPublicKeyFromPEM(publicKey)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"could not read public Key\")\n\t}\n\taesKey := uuid.New().String()[:32]\n\n\tciphertext, err := rsa.EncryptOAEP(sha256.New(), rand.Reader, publicKeyData, []byte(aesKey), []byte(\"\"))\n\tif err != nil {\n\t\treturn errors.New(\"could not encrypt event data\")\n\t}\n\n\tdata := &CorrelationData{\n\t\tData: make([]string, 0),\n\t\tsecretKey: secretKey,\n\t\tdataMutex: &sync.Mutex{},\n\t\taesKey: []byte(aesKey),\n\t\tAESKey: base64.StdEncoding.EncodeToString(ciphertext),\n\t}\n\ts.cache.Set(correlationID, data, s.evictionTTL)\n\treturn nil\n}", "title": "" }, { "docid": "c4e4916f5d18aeb54964ad3d7bd30bce", "score": "0.49110478", "text": "func (_m *AppFunctionContext) CorrelationID() string {\n\tret := _m.Called()\n\n\tvar r0 string\n\tif rf, ok := ret.Get(0).(func() string); ok {\n\t\tr0 = rf()\n\t} else {\n\t\tr0 = ret.Get(0).(string)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "af38089013d2f8abc15f141187a2bfd2", "score": "0.48431066", "text": "func GenXid() string {\n\tid := xid.New()\n\treturn id.String()\n}", "title": "" }, { "docid": "1910cf34dd178c3cd4201a2a0e5da67f", "score": "0.4835657", "text": "func SetTxID(channelHeader *cb.ChannelHeader, signatureHeader *cb.SignatureHeader) {\n\tchannelHeader.TxId = ComputeTxID(\n\t\tsignatureHeader.Nonce,\n\t\tsignatureHeader.Creator,\n\t)\n}", "title": "" }, { "docid": "6560da4c4e34def8c86ffabb8d9e861b", "score": "0.48212343", "text": "func GetCorrelationID(request *http.Request) string {\n\n\tcorrelationID := request.Header.Get(\"CORRELATION-ID\")\n\tif correlationID == \"\" {\n\t\tcorrelationID = getUniqID()\n\t}\n\treturn correlationID\n}", "title": "" }, { "docid": "b89a4f05d393467597950020d787874e", "score": "0.4819776", "text": "func (crq *ClinicalResultsQuery) IDsX(ctx context.Context) []uuid.UUID {\n\tids, err := crq.IDs(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn ids\n}", "title": "" }, { "docid": "4bd9952556141de375e87ceb0a42e6b1", "score": "0.48115903", "text": "func xcorr(x *Matrix, y *Matrix) (*Matrix, string) {\n if (x.N != 1 || y.N != 1) {\n return nil, \"ERROR: Parameters must be vectors\";\n }\n\n if (x.M != y.M) {\n return nil, \"ERROR: Vectors must have the same dimensions\";\n }\n\n vals := make([][]float64, y.M);\n for i := 0; i < y.M; i++ {\n v, _ := roll(y, i);\n vals[i] = v.cols[0];\n }\n circulant, _ := NewMatrix(vals);\n return mulMatrices(circulant, x), \"\";\n}", "title": "" }, { "docid": "14140d3e5d7e96ffaea481efa6f7b94e", "score": "0.48070994", "text": "func (dsr *DeliveryServiceRequestV40) SetXMLID() {\n\tif dsr == nil {\n\t\treturn\n\t}\n\n\tif dsr.ChangeType == DSRChangeTypeDelete && dsr.Original != nil && dsr.Original.XMLID != nil {\n\t\tdsr.XMLID = *dsr.Original.XMLID\n\t\treturn\n\t}\n\n\tif dsr.Requested != nil && dsr.Requested.XMLID != nil {\n\t\tdsr.XMLID = *dsr.Requested.XMLID\n\t}\n}", "title": "" }, { "docid": "c26ec13f8fe79d1cda8e6bfd7cd709cb", "score": "0.47749987", "text": "func setRequestIDHandler(next http.Handler) http.Handler {\n\tf := logrus.Fields{\n\t\t\"functionName\": \"cmd.setRequestIDHandler\",\n\t}\n\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t// Set the x-request-id header value if it doesn't exist...\n\t\tif r.Header.Get(utils.XREQUESTID) == \"\" {\n\t\t\trequestID, err := uuid.NewV4()\n\t\t\tif err != nil {\n\t\t\t\tlog.WithFields(f).WithError(err).Warn(\"unable to generate a UUID for x-request-id header\")\n\t\t\t} else {\n\t\t\t\tr.Header.Set(utils.XREQUESTID, requestID.String())\n\t\t\t}\n\t\t}\n\t\tnext.ServeHTTP(w, r)\n\t})\n}", "title": "" }, { "docid": "7bc42cd5a48d9e8c1c719fce27c5acdd", "score": "0.47541258", "text": "func (m *CloudPcOnPremisesConnectionHealthCheck) GetCorrelationId()(*string) {\n val, err := m.GetBackingStore().Get(\"correlationId\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "title": "" }, { "docid": "fe5e0e6e0822be03a2521f121a7b62f4", "score": "0.47510788", "text": "func (self *Pointer) SetClientXA(member int) {\n self.Object.Set(\"clientX\", member)\n}", "title": "" }, { "docid": "43c8b7466175098b6b2420256d111876", "score": "0.46904436", "text": "func XRequestIdClientInterceptor(next RoundTripHandler, keys ...interface{}) RoundTripHandler {\n\treturn RoundTripFunc(func(req *http.Request) (resp *http.Response, err error) {\n\t\treq = req.WithContext(newContextForHandleClientRequestID(req, keys...))\n\t\treturn next.RoundTrip(req)\n\t})\n}", "title": "" } ]
19c91cd74c4ce5f17b7ace7034b032c7
Delete takes name of the clusterInstallation and deletes it. Returns an error if one occurs.
[ { "docid": "11f116f53e31af1255d7f4e393084445", "score": "0.73632216", "text": "func (c *FakeClusterInstallations) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {\n\t_, err := c.Fake.\n\t\tInvokes(testing.NewDeleteActionWithOptions(clusterinstallationsResource, c.ns, name, opts), &v1alpha1.ClusterInstallation{})\n\n\treturn err\n}", "title": "" } ]
[ { "docid": "2199f3329f0c7fd13e62b4cc753d0f87", "score": "0.68683", "text": "func (provisioner *kopsCIAlpha) DeleteClusterInstallation(cluster *model.Cluster, installation *model.Installation, clusterInstallation *model.ClusterInstallation) error {\n\tlogger := provisioner.logger.WithFields(log.Fields{\n\t\t\"cluster\": clusterInstallation.ClusterID,\n\t\t\"installation\": clusterInstallation.InstallationID,\n\t})\n\n\tconfigLocation, err := provisioner.getCachedKopsClusterKubecfg(cluster.ProvisionerMetadataKops.Name, logger)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to get kops config from cache\")\n\t}\n\tdefer provisioner.invalidateCachedKopsClientOnError(err, cluster.ProvisionerMetadataKops.Name, logger)\n\n\tk8sClient, err := k8s.NewFromFile(configLocation, logger)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to create k8s client from file\")\n\t}\n\n\tname := makeClusterInstallationName(clusterInstallation)\n\n\tctx := context.TODO()\n\n\terr = k8sClient.MattermostClientsetV1Alpha.MattermostV1alpha1().ClusterInstallations(clusterInstallation.Namespace).Delete(ctx, name, metav1.DeleteOptions{})\n\tif k8sErrors.IsNotFound(err) {\n\t\tlogger.Warnf(\"Cluster installation %s not found, assuming already deleted\", name)\n\t} else if err != nil {\n\t\treturn errors.Wrapf(err, \"failed to delete cluster installation %s\", clusterInstallation.ID)\n\t}\n\n\tif installation.License != \"\" {\n\t\terr = provisioner.deleteLicenseSecret(clusterInstallation, k8sClient, logger)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"failed to delete license secret\")\n\t\t}\n\t}\n\n\terr = k8sClient.Clientset.CoreV1().Namespaces().Delete(ctx, clusterInstallation.Namespace, metav1.DeleteOptions{})\n\tif k8sErrors.IsNotFound(err) {\n\t\tlogger.Warnf(\"Namespace %s not found, assuming already deleted\", clusterInstallation.Namespace)\n\t} else if err != nil {\n\t\treturn errors.Wrapf(err, \"failed to delete namespace %s\", clusterInstallation.Namespace)\n\t}\n\n\tlogger.Info(\"Successfully deleted cluster installation\")\n\n\treturn nil\n}", "title": "" }, { "docid": "55fed178591fa89f516065a46993dc12", "score": "0.6141707", "text": "func (c *Civo) DeleteCluster(name string) error {\n\n\turi := fmt.Sprintf(\"%s/%s\", baseUri, name)\n\n\t// Create a new request using http\n\treq, err := http.NewRequest(http.MethodDelete, uri, nil)\n\n\t// Send req using http Client\n\tresp, err := c.client.Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = handleResponse(resp)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlog.Infof(\"status: %s\", resp.Status)\n\n\treturn nil\n}", "title": "" }, { "docid": "30eedeff25d5ca74dc372f5c5bb85453", "score": "0.5800967", "text": "func (storage Storage) DeleteClusterByName(name string) error {\n\tstatement, err := storage.connections.Prepare(\"DELETE FROM cluster WHERE name = $1\")\n\tif err != nil {\n\t\tlog.Print(err)\n\t\treturn err\n\t}\n\n\t// statement has to be closed at function exit\n\tdefer func() {\n\t\t// try to close the statement\n\t\terr := statement.Close()\n\t\t// in case of error all we can do is to just log the error\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\t}()\n\n\trowsAffected, err := execStatementAndGetRowsAffected(statement, name)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif rowsAffected == 0 {\n\t\treturn &ItemNotFoundError{\n\t\t\tItemID: name,\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "dd2a688cff92de51d354dec85deb75ee", "score": "0.57436556", "text": "func (c *Client) DeleteInstallation(installationID string) error {\n\tresp, err := c.doDelete(c.buildURL(\"/api/installation/%s\", installationID))\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer closeBody(resp)\n\n\tswitch resp.StatusCode {\n\tcase http.StatusAccepted:\n\t\treturn nil\n\n\tdefault:\n\t\treturn errors.Errorf(\"failed with status code %d\", resp.StatusCode)\n\t}\n}", "title": "" }, { "docid": "efcefcb401f835be047060785924b0e4", "score": "0.57417625", "text": "func DeleteCluster() {\n\terr := deleteCluster()\n\tmageutil.PanicOnError(err)\n}", "title": "" }, { "docid": "25d28ff810eda74badc1d7c11b4eb002", "score": "0.56982666", "text": "func (c *Config) Delete(ctx context.Context, clusterName string, destroyAll bool) (string, error) {\n\tc.Logger.Debugf(\"Sending parameters to server to delete the cluster %q\", clusterName)\n\n\treturn c.RunGRPCnRESTFunc(\"delete\", true,\n\t\tfunc() (string, error) {\n\t\t\treturn c.deleteGRPC(ctx, clusterName, destroyAll)\n\t\t},\n\t\tfunc() (string, error) {\n\t\t\treturn c.deleteHTTP(clusterName, destroyAll)\n\t\t})\n}", "title": "" }, { "docid": "dad91245f3fecb6fd2ac31c67a8b49ac", "score": "0.56738317", "text": "func (c *ClusterService) DeleteByName(clusterName string) error {\n\treturn c.db.DeleteCluster(clusterName)\n}", "title": "" }, { "docid": "5fc7c7ab37a359a37a5a799fe5a11897", "score": "0.56283414", "text": "func (c *Client) DeleteInstallation(installation Installation) error {\n\turi := fmt.Sprintf(\"/1/installations/%s\", installation.ObjectID())\n\tresp, err := c.doSimple(\"DELETE\", uri)\n\tdefer resp.Body.Close()\n\tc.trace(\"DeleteInstallation\", uri)\n\treturn err\n}", "title": "" }, { "docid": "7b05213b9ef211dcbe7c0b4f38ffbec2", "score": "0.55677605", "text": "func (r clusterInformation) Delete(ctx context.Context, name string, opts options.DeleteOptions) (*apiv3.ClusterInformation, error) {\n\tout, err := r.client.resources.Delete(ctx, opts, apiv3.KindClusterInformation, noNamespace, name)\n\tif out != nil {\n\t\treturn out.(*apiv3.ClusterInformation), err\n\t}\n\treturn nil, err\n}", "title": "" }, { "docid": "84c7f00282800055210c0c005d60403c", "score": "0.5549091", "text": "func (e *EtcdStore) DeleteCluster(name string) error {\n\tc, err := e.GetCluster(name)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif c.HasBind() {\n\t\treturn ErrHasBind\n\t}\n\n\tkey := fmt.Sprintf(\"%s/%s\", e.clustersDir, name)\n\treturn e.delete(key)\n}", "title": "" }, { "docid": "b868b8c76eda9acbde325060d5bdb581", "score": "0.55351645", "text": "func deleteCluster(service *dataproc.Service, cluster clusterDetails) (response string, err error) {\n res, err := service.Projects.Regions.Clusters.Delete(cluster.project, cluster.region, cluster.name).Do()\n\n return fmt.Sprintf(\"%s\", res), err\n}", "title": "" }, { "docid": "2b0fa6ebd1002cf2875f50234a7b08e0", "score": "0.55335075", "text": "func (c *executionClusters) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {\n\treturn c.client.Delete().\n\t\tResource(\"executionclusters\").\n\t\tName(name).\n\t\tBody(&opts).\n\t\tDo(ctx).\n\t\tError()\n}", "title": "" }, { "docid": "03000df0a8491b26a43b4fc968493e4c", "score": "0.5485851", "text": "func (c *Client) DeleteInActiveClusterInstallationByID(clusterInstallationID string) (*ClusterInstallation, error) {\n\tresp, err := c.doDelete(c.buildURL(\"/api/cluster_installations/migrate/delete_inactive/cluster_installation/%s\", clusterInstallationID))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer closeBody(resp)\n\n\tswitch resp.StatusCode {\n\tcase http.StatusOK:\n\t\treturn ClusterInstallationFromReader(resp.Body)\n\n\tdefault:\n\t\treturn nil, errors.Errorf(\"failed with status code %d\", resp.StatusCode)\n\t}\n}", "title": "" }, { "docid": "bb6e36d0c3cd90e1d3e226f247ed4633", "score": "0.5467145", "text": "func (c *clusterManagers) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {\r\n\treturn c.client.Delete().\r\n\t\tNamespace(c.ns).\r\n\t\tResource(\"clusterManagers\").\r\n\t\tName(name).\r\n\t\tBody(&opts).\r\n\t\tDo(ctx).\r\n\t\tError()\r\n}", "title": "" }, { "docid": "3cc660e9a5a872de45c72bbe4388d08b", "score": "0.54501116", "text": "func UninstallStorageCluster(cluster *corev1.StorageCluster, kubeconfig ...string) error {\n\tvar err error\n\tif len(kubeconfig) != 0 && kubeconfig[0] != \"\" {\n\t\tos.Setenv(\"KUBECONFIG\", kubeconfig[0])\n\t}\n\n\tt := func() (interface{}, bool, error) {\n\t\tcluster, err = operatorops.Instance().GetStorageCluster(cluster.Name, cluster.Namespace)\n\t\tif err != nil && !errors.IsNotFound(err) {\n\t\t\treturn nil, true, err\n\t\t}\n\n\t\tif cluster.Spec.DeleteStrategy == nil ||\n\t\t\t(cluster.Spec.DeleteStrategy.Type != corev1.UninstallAndWipeStorageClusterStrategyType &&\n\t\t\t\tcluster.Spec.DeleteStrategy.Type != corev1.UninstallStorageClusterStrategyType) {\n\t\t\tcluster.Spec.DeleteStrategy = &corev1.StorageClusterDeleteStrategy{\n\t\t\t\tType: corev1.UninstallAndWipeStorageClusterStrategyType,\n\t\t\t}\n\n\t\t\tif _, err := operatorops.Instance().UpdateStorageCluster(cluster); err != nil {\n\t\t\t\treturn nil, true, err\n\t\t\t}\n\n\t\t\tif err := validateTelemetrySecret(cluster, defaultTelemetrySecretValidationTimeout, defaultTelemetrySecretValidationInterval, false); err != nil {\n\t\t\t\treturn nil, true, err\n\t\t\t}\n\t\t}\n\n\t\tif err := operatorops.Instance().DeleteStorageCluster(cluster.Name, cluster.Namespace); err != nil {\n\t\t\treturn nil, true, err\n\t\t}\n\n\t\treturn nil, false, nil\n\t}\n\n\tif _, err := task.DoRetryWithTimeout(t, defaultDeleteStorageClusterTimeout, defaultDeleteStorageClusterInterval); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6ade0922515f0ead88e25dc8801548f7", "score": "0.54214334", "text": "func (c *FakeClusterInstallations) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ClusterInstallation, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewGetAction(clusterinstallationsResource, c.ns, name), &v1alpha1.ClusterInstallation{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*v1alpha1.ClusterInstallation), err\n}", "title": "" }, { "docid": "76a9b6a48392adb8c304178f9c4968b8", "score": "0.53979754", "text": "func (c *FakeChubaoClusters) Delete(name string, options *v1.DeleteOptions) error {\n\t_, err := c.Fake.\n\t\tInvokes(testing.NewDeleteAction(chubaoclustersResource, c.ns, name), &v1alpha1.ChubaoCluster{})\n\n\treturn err\n}", "title": "" }, { "docid": "993fd10c42823a3c86f6a6137e5bedc8", "score": "0.53891087", "text": "func (c *Cluster) Delete(ctx context.Context, objMeta *api.ObjectMeta) (*cmd.Cluster, error) {\n\treturn nil, errors.New(\"not implemented\")\n}", "title": "" }, { "docid": "6a7544791b1e205335b9bf0289f8e02b", "score": "0.5380412", "text": "func (a *MemberNodesAPI) Delete(ctx context.Context, req *http.Request) api.Response {\n\tdefer req.Body.Close()\n\n\td, err := api.GetDaemon(ctx)\n\tif err != nil {\n\t\treturn api.InternalError(err)\n\t}\n\n\tname, ok := mux.Vars(req)[\"name\"]\n\tif !ok {\n\t\treturn api.BadRequest(errors.Errorf(\"expected name\"))\n\t}\n\tif err := d.Cluster().Transaction(func(tx *db.ClusterTx) error {\n\t\tinfo, err := tx.ServiceByName(name)\n\t\tif err != nil {\n\t\t\treturn errors.WithStack(err)\n\t\t}\n\t\treturn tx.ServiceRemove(info.ID)\n\t}); err != nil {\n\t\treturn api.SmartError(err)\n\t}\n\n\treturn api.EmptySyncResponse()\n}", "title": "" }, { "docid": "f256c2514c9f6ec577122ddb085e777b", "score": "0.5379185", "text": "func (a *Client) Delete(params *DeleteParams) (*DeleteNoContent, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewDeleteParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"delete\",\n\t\tMethod: \"DELETE\",\n\t\tPathPattern: \"/clusters/{name}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &DeleteReader{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.(*DeleteNoContent)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\tunexpectedSuccess := result.(*DeleteDefault)\n\treturn nil, runtime.NewAPIError(\"unexpected success response: content available as default response in error\", unexpectedSuccess, unexpectedSuccess.Code())\n}", "title": "" }, { "docid": "b163354d235d9d21bea24c9c4ade07b3", "score": "0.53702974", "text": "func DeleteCluster(c *gin.Context) {\n\n\tbanzaiUtils.LogInfo(banzaiConstants.TagDeleteCluster, \"Delete cluster start\")\n\n\tcl, err := cloud.GetClusterFromDB(c)\n\tif err != nil {\n\t\treturn\n\t}\n\tif cl.Cloud == banzaiConstants.Amazon {\n\t\tbanzaiUtils.LogInfo(banzaiConstants.TagDeleteCluster, \"Start delete created helm charts\")\n\n\t\tcloudCluster, err := cloud.GetClusterWithDbCluster(cl, c)\n\t\tif err != nil {\n\t\t\tcloud.SetResponseBodyJson(c, http.StatusInternalServerError, gin.H{\n\t\t\t\tcloud.JsonKeyStatus: http.StatusInternalServerError,\n\t\t\t\tcloud.JsonKeyMessage: err,\n\t\t\t})\n\t\t\treturn\n\t\t}\n\t\tbanzaiUtils.LogInfo(banzaiConstants.TagDeleteCluster, \"Get aws cluster succeeded\")\n\n\t\tconfig, err := cloud.GetAmazonKubernetesConfig(cloudCluster)\n\t\tif err != nil {\n\t\t\tcloud.SetResponseBodyJson(c, http.StatusInternalServerError, gin.H{\n\t\t\t\tcloud.JsonKeyStatus: http.StatusInternalServerError,\n\t\t\t\tcloud.JsonKeyMessage: err,\n\t\t\t})\n\t\t\treturn\n\t\t}\n\t\terr = deleteAllDeployment(config)\n\t\tif err != nil {\n\t\t\tbanzaiUtils.LogError(banzaiConstants.TagDeleteCluster, \"Error during deleting all deployments #\", err.Error())\n\t\t} else {\n\t\t\tbanzaiUtils.LogInfo(banzaiConstants.TagDeleteCluster, \"Deployments successfully deleted\")\n\t\t}\n\t}\n\tif cloud.DeleteCluster(cl, c) {\n\t\t// cluster delete success\n\t\tbanzaiUtils.LogInfof(banzaiConstants.TagDeleteCluster, \"Cluster %s delete succeeded!\", cl.Name)\n\n\t\t// delete state store\n\t\tcloud.DestroyStateStore(cl)\n\n\t\t// delete from db\n\t\tif cloud.DeleteFromDb(cl, c) {\n\t\t\t// update Prometheus config\n\t\t\tupdatePrometheus()\n\t\t}\n\t}\n\n}", "title": "" }, { "docid": "b70c9b51f5f679fbcee668b02ce87e8a", "score": "0.5370085", "text": "func (a ClustersAPI) Delete(req httpmodels.DeleteReq) error {\n\t_, err := a.Client.performQuery(http.MethodPost, \"/clusters/delete\", req, nil)\n\treturn err\n}", "title": "" }, { "docid": "761cb3741494d34d6389bdb383145dfd", "score": "0.5355577", "text": "func (k K3D) DeleteCluster() error {\n\tcmd := k3dCommand(\"k3d cluster delete\")\n\treturn cmd.Run()\n}", "title": "" }, { "docid": "df0a7e543f507c1e280ee3a2e3eb6363", "score": "0.5349135", "text": "func (ca *ClusterActuator) Delete(cluster *clusterv1.Cluster) error {\n\tca.eventRecorder.Eventf(cluster, corev1.EventTypeNormal, \"Deleted\", \"Deleting cluster %s\", cluster.Name)\n\tglog.Infof(\"Attempting to cleaning up resources of cluster %s\", cluster.ObjectMeta.Name)\n\treturn nil\n}", "title": "" }, { "docid": "72a72ae99252edc8526bd61af2b8fe0a", "score": "0.5348028", "text": "func (storage Storage) DeleteCluster(id int64) error {\n\tstatement, err := storage.connections.Prepare(\"DELETE FROM cluster WHERE id = $1\")\n\tif err != nil {\n\t\tlog.Print(err)\n\t\treturn err\n\t}\n\n\t// statement has to be closed at function exit\n\tdefer func() {\n\t\t// try to close the statement\n\t\terr := statement.Close()\n\t\t// in case of error all we can do is to just log the error\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\t}()\n\n\trowsAffected, err := execStatementAndGetRowsAffected(statement, id)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif rowsAffected == 0 {\n\t\treturn &ItemNotFoundError{\n\t\t\tItemID: id,\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5c4999bee8d0dcbb196c4016b1639cbb", "score": "0.53082484", "text": "func DeleteCluster(c *gin.Context) {\n\tcommonCluster, ok := GetCommonClusterFromRequest(c)\n\tif ok != true {\n\t\treturn\n\t}\n\tlog.Info(\"Delete cluster start\")\n\n\tforceParam := c.DefaultQuery(\"force\", \"false\")\n\tforce, err := strconv.ParseBool(forceParam)\n\tif err != nil {\n\t\tforce = false\n\t}\n\n\tgo postDeleteCluster(commonCluster, force)\n\n\tdeleteName := commonCluster.GetName()\n\tdeleteId := commonCluster.GetID()\n\n\tc.JSON(http.StatusAccepted, pkgCluster.DeleteClusterResponse{\n\t\tStatus: http.StatusAccepted,\n\t\tName: deleteName,\n\t\tResourceID: deleteId,\n\t})\n}", "title": "" }, { "docid": "4639c2e69fb762d577bded0dcb2a2acb", "score": "0.53010994", "text": "func (r *ProjectsLocationsWorkstationClustersService) Delete(name string) *ProjectsLocationsWorkstationClustersDeleteCall {\n\tc := &ProjectsLocationsWorkstationClustersDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.name = name\n\treturn c\n}", "title": "" }, { "docid": "5b532ba001ec7474f52ec02d3753e300", "score": "0.52960366", "text": "func DeleteCluster(clustername string, force bool) error {\n\tcluster, ok := GetCluster(clustername)\n\tif !ok {\n\t\treturn errClusterDoesNotExist\n\t}\n\n\t// TODO: Temporary condition. Will fix later.\n\tif len(cluster.Nodes) > 0 {\n\t\treturn errClusterNotEmpty\n\t}\n\n\tklog.Println(2, \"Deleting network...\")\n\terr := cluster.deletenetwork()\n\tif err != nil {\n\t\tif !force {\n\t\t\treturn err\n\t\t}\n\n\t\tklog.Printf(\n\t\t\t0,\n\t\t\t\"Warning: Errors returned while deleting network: %v. Some artifacts may need manual cleanup.\",\n\t\t\terr,\n\t\t)\n\t}\n\n\tklog.Println(2, \"Network deleted.\")\n\n\tdelete(config.Clusters, clustername)\n\n\treturn clusterconfigmanager.Save()\n}", "title": "" }, { "docid": "eca40ddc09a483936339dc491f5f698b", "score": "0.52829814", "text": "func (c *FakeZookeeperClusters) Delete(name string, options *v1.DeleteOptions) error {\n\t_, err := c.Fake.\n\t\tInvokes(testing.NewDeleteAction(zookeeperclustersResource, c.ns, name), &v1alpha1.ZookeeperCluster{})\n\n\treturn err\n}", "title": "" }, { "docid": "a1a8f70cc8364f662a1ba76008d7b04d", "score": "0.5274181", "text": "func (k Registry) Delete(ctx context.Context, c *kubernetes.Cluster, ui *termui.UI) error {\n\tui.Note().KeeplineUnder(1).Msg(\"Removing Registry...\")\n\n\texistsAndOwned, err := c.NamespaceExistsAndOwned(ctx, RegistryDeploymentID)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"failed to check if namespace '%s' is owned or not\", RegistryDeploymentID)\n\t}\n\tif !existsAndOwned {\n\t\tui.Exclamation().Msg(\"Skipping Registry because namespace either doesn't exist or not owned by Epinio\")\n\t\treturn nil\n\t}\n\n\tcurrentdir, err := os.Getwd()\n\tif err != nil {\n\t\treturn errors.New(\"Failed uninstalling Registry: \" + err.Error())\n\t}\n\n\tmessage := \"Removing helm release \" + RegistryDeploymentID\n\tout, err := helpers.WaitForCommandCompletion(ui, message,\n\t\tfunc() (string, error) {\n\t\t\thelmCmd := fmt.Sprintf(\"helm uninstall '%s' --namespace '%s'\", RegistryDeploymentID, RegistryDeploymentID)\n\t\t\treturn helpers.RunProc(helmCmd, currentdir, k.Debug)\n\t\t},\n\t)\n\tif err != nil {\n\t\tif strings.Contains(out, \"release: not found\") {\n\t\t\tui.Exclamation().Msgf(\"%s helm release not found, skipping.\\n\", RegistryDeploymentID)\n\t\t} else {\n\t\t\treturn errors.Wrapf(err, \"Failed uninstalling helm release %s: %s\", RegistryDeploymentID, out)\n\t\t}\n\t}\n\n\tmessage = \"Deleting Registry namespace \" + RegistryDeploymentID\n\t_, err = helpers.WaitForCommandCompletion(ui, message,\n\t\tfunc() (string, error) {\n\t\t\treturn \"\", c.DeleteNamespace(ctx, RegistryDeploymentID)\n\t\t},\n\t)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"Failed deleting namespace %s\", RegistryDeploymentID)\n\t}\n\n\tui.Success().Msg(\"Registry removed\")\n\n\treturn nil\n}", "title": "" }, { "docid": "8cd50934ddff077e54fbd058cfebd379", "score": "0.5228064", "text": "func (bc *client) DeleteDeployment(name string, force bool) (int, error) {\n\tfound, _, err := bc.GetDeployment(name)\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(\"error getting deployment `%s`: %v\", name, err)\n\t}\n\tif !found {\n\t\treturn 0, nil\n\t}\n\n\tasyncTaskReporter := NewAsyncTaskReporter()\n\tboshDirector, err := bc.Director(asyncTaskReporter)\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(\"failed to build director: %v\", err)\n\t}\n\n\tdeployment, err := boshDirector.FindDeployment(name)\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(\"error when finding deployment `%s`: %v\", name, err)\n\t}\n\n\tgo func() {\n\t\terr = deployment.Delete(force)\n\t\tif err != nil {\n\t\t\tasyncTaskReporter.Err <- fmt.Errorf(\"error deleting deployment `%s`: %v\", name, err)\n\t\t}\n\t}()\n\n\tselect {\n\tcase err := <-asyncTaskReporter.Err:\n\t\treturn 0, err\n\tcase id := <-asyncTaskReporter.Task:\n\t\treturn id, nil\n\t}\n}", "title": "" }, { "docid": "fedd9cc65c51194e7603938dfb6ca6c9", "score": "0.521555", "text": "func Uninstall(chartName, home, namespace string, force bool, client kubectl.Runner) {\n\t// This is a stop-gap until kubectl respects namespaces in manifests.\n\tif namespace == \"\" {\n\t\tlog.Die(\"This command requires a namespace. Did you mean '-n default'?\")\n\t}\n\tif !chartFetched(chartName, home) {\n\t\tlog.Info(\"No chart named %q in your workspace. Nothing to delete.\", chartName)\n\t\treturn\n\t}\n\n\tcd := helm.WorkspaceChartDirectory(home, chartName)\n\tc, err := chart.Load(cd)\n\tif err != nil {\n\t\tlog.Die(\"Failed to load chart: %s\", err)\n\t}\n\tif err := deleteChart(c, namespace, true, client); err != nil {\n\t\tlog.Die(\"Failed to list charts: %s\", err)\n\t}\n\tif !force && !promptConfirm(\"Uninstall the listed objects?\") {\n\t\tlog.Info(\"Aborted uninstall\")\n\t\treturn\n\t}\n\n\tCheckKubePrereqs()\n\n\tlog.Info(\"Running `kubectl delete` ...\")\n\tif err := deleteChart(c, namespace, false, client); err != nil {\n\t\tlog.Die(\"Failed to completely delete chart: %s\", err)\n\t}\n\tlog.Info(\"Done\")\n}", "title": "" }, { "docid": "95dac31d9c8a2e5fe2b4532e30adb1b9", "score": "0.52152723", "text": "func (w *TestWicker) DeleteInstallation() func(w *TestWicker, ctx context.Context) error {\n\treturn func(w *TestWicker, ctx context.Context) error {\n\t\tw.logger.WithField(\"ID\", w.installation.ID).Info(\"Deleting installation\")\n\t\terr := w.provisionerClient.DeleteInstallation(w.installation.ID)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"client.DeleteInstallation\")\n\t\t}\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "c12cf1964fe6b8c14b780d9bc46791be", "score": "0.52079296", "text": "func (c *installationTargets) Delete(name string, options *meta_v1.DeleteOptions) error {\n\treturn c.client.Delete().\n\t\tNamespace(c.ns).\n\t\tResource(\"installationtargets\").\n\t\tName(name).\n\t\tBody(options).\n\t\tDo().\n\t\tError()\n}", "title": "" }, { "docid": "a292c03d41463a52f5f4de649f1ae1d8", "score": "0.51792175", "text": "func deleteCluster(metaKey string) core.AfterFunc {\n\treturn core.ExecAfterCmd(\"scw k8s cluster delete {{ .\" + metaKey + \".ID }} --wait\")\n}", "title": "" }, { "docid": "209d477966c0c5d65e1a3a038776d69e", "score": "0.51780677", "text": "func DeleteCluster() error {\n\tlog.Infof(\"Removing cluster config file\")\n\treturn os.Remove(path.Join(env.Options.ConfigDir, env.Options.ClusterConfigFile))\n}", "title": "" }, { "docid": "8a5e8e0818ebab94114fe1233d287e0b", "score": "0.5162892", "text": "func (c *Client) Delete(releaseName internal.ReleaseName, namespace internal.Namespace) error {\n\tc.log.Infof(\"Deleting chart with release name [%s], namespace: [%s]\", releaseName, namespace)\n\tcfg, err := c.getConfig(string(namespace))\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"while getting config\")\n\t}\n\n\tuninstallAction := action.NewUninstall(cfg)\n\t_, err = uninstallAction.Run(string(releaseName))\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"while executing uninstall action\")\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "6ed0c9e6fe8765c825e45bb0b3d549bc", "score": "0.51418495", "text": "func (cli *CLI) Delete() error {\n\thost, err := cli.cmd.Flags().GetString(\"host\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(cli.args) != 1 {\n\t\treturn errors.New(\"name is required\")\n\t}\n\tname := cli.args[0]\n\n\terr = client.NewClient(host).Delete(name)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcolor.Green(\"Deleted %v\", name)\n\treturn nil\n}", "title": "" }, { "docid": "0db406dc639e02981d92db4aa7cf3130", "score": "0.5140444", "text": "func (l *L7s) Delete(name string) error {\n\tlb := &L7{\n\t\truntimeInfo: &L7RuntimeInfo{Name: name},\n\t\tName: l.namer.LoadBalancer(name),\n\t\tcloud: l.cloud,\n\t\tnamer: l.namer,\n\t}\n\n\tklog.V(3).Infof(\"Deleting lb %v\", lb.Name)\n\tif err := lb.Cleanup(); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c2b89b4edea79a94a460455edfd24409", "score": "0.51320684", "text": "func (a *Client) DeleteCluster(params *DeleteClusterParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteClusterNoContent, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewDeleteClusterParams()\n\t}\n\top := &runtime.ClientOperation{\n\t\tID: \"deleteCluster\",\n\t\tMethod: \"DELETE\",\n\t\tPathPattern: \"/kubernetes-clusters/{cluster_id}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &DeleteClusterReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t}\n\tfor _, opt := range opts {\n\t\topt(op)\n\t}\n\n\tresult, err := a.transport.Submit(op)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*DeleteClusterNoContent)\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 deleteCluster: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "995cf676f8a284142f20361d9548cfb5", "score": "0.5101954", "text": "func (k *kindUtil) DestroyCluster(name string) error {\n\tcmd := exec.Command(k.kindPath, \"delete\", \"cluster\", \"--name\", name, \"--kubeconfig\", kindKubeConfigPath)\n\t_, err := k.runCmd(cmd)\n\treturn err\n}", "title": "" }, { "docid": "87dadff2f958272811f7bf3cc0cafe6d", "score": "0.5099109", "text": "func Uninstall(chartName, home, namespace string, force bool) {\n\tif !chartFetched(chartName, home) {\n\t\tlog.Info(\"No chart named %q in your workspace. Nothing to delete.\", chartName)\n\t\treturn\n\t}\n\n\tcd := filepath.Join(home, WorkspaceChartPath, chartName)\n\tc, err := chart.Load(cd)\n\tif err != nil {\n\t\tlog.Die(\"Failed to load chart: %s\", err)\n\t}\n\tif err := deleteChart(c, namespace, true); err != nil {\n\t\tlog.Die(\"Failed to list charts: %s\", err)\n\t}\n\tif !force && !promptConfirm(\"Uninstall the listed objects?\") {\n\t\tlog.Info(\"Aborted uninstall\")\n\t\treturn\n\t}\n\n\tlog.Info(\"Running `kubectl delete` ...\")\n\tif err := deleteChart(c, namespace, false); err != nil {\n\t\tlog.Die(\"Failed to completely delete chart: %s\", err)\n\t}\n\tlog.Info(\"Done\")\n}", "title": "" }, { "docid": "de0624744de7a8a1c3690a7a5e6f3f62", "score": "0.50707227", "text": "func (c *cellClusters) Delete(name string, options *v1.DeleteOptions) error {\n\treturn c.client.Delete().\n\t\tNamespace(c.ns).\n\t\tResource(\"cellclusters\").\n\t\tName(name).\n\t\tBody(options).\n\t\tDo().\n\t\tError()\n}", "title": "" }, { "docid": "a7184d026060b72133731fb042313209", "score": "0.50668085", "text": "func (c *Client) DeleteInstallationAnnotation(installationID string, annotationName string) error {\n\tresp, err := c.doDelete(c.buildURL(\"/api/installation/%s/annotation/%s\", installationID, annotationName))\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer closeBody(resp)\n\n\tswitch resp.StatusCode {\n\tcase http.StatusNoContent:\n\t\treturn nil\n\n\tdefault:\n\t\treturn errors.Errorf(\"failed with status code %d\", resp.StatusCode)\n\t}\n}", "title": "" }, { "docid": "27baba3ddf03fe9659f16a8241bc1482", "score": "0.50663364", "text": "func (w *ServerInterfaceWrapper) DeleteCluster(ctx echo.Context) error {\n\tvar err error\n\n\t// Invoke the callback with all the unmarshalled arguments\n\terr = w.Handler.DeleteCluster(ctx)\n\treturn err\n}", "title": "" }, { "docid": "35597decf524f78eef72d78cdb89d2d6", "score": "0.5065915", "text": "func Delete(rw *RequestWrapper) error {\n\trw.Request.SkipCreation = true\n\n\tgkeOps, err := rw.acquire()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error identifying cluster for deletion: %w\", err)\n\t}\n\tlog.Printf(\"Identified project %q and cluster %q for removal\", gkeOps.Project, gkeOps.Cluster.Name)\n\tif err = gkeOps.Delete(); err != nil {\n\t\treturn fmt.Errorf(\"failed deleting cluster: %w\", err)\n\t}\n\t// Unset context with best effort.\n\t// The commands will try to unset the current context and delete it from kubeconfig.\n\tcc, _ := cmd.RunCommand(\"kubectl config current-context\")\n\tif _, err := cmd.RunCommand(\"kubectl config unset current-context\"); err != nil {\n\t\tcmd.RunCommand(\"kubectl config unset contexts.\" + cc)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "5bb072ab539214d109e8444a253c4b95", "score": "0.5064895", "text": "func (b *KubeCluster) DeleteCluster() error {\n\treturn nil\n}", "title": "" }, { "docid": "7bb9b15285876724aa189dafcea15b31", "score": "0.5049044", "text": "func (s *SpecManager) Remove(clusterName string) error {\n\treturn os.RemoveAll(s.Path(clusterName))\n}", "title": "" }, { "docid": "d06062d58a21be4ad6960ac4f37594f2", "score": "0.50288266", "text": "func (o *migration) Delete(name string, options *k8smetav1.DeleteOptions) error {\n\terr := o.restClient.Delete().\n\t\tResource(o.resource).\n\t\tNamespace(o.namespace).\n\t\tName(name).\n\t\tBody(options).\n\t\tDo(context.Background()).\n\t\tError()\n\n\treturn err\n}", "title": "" }, { "docid": "d625b116db87bb63fe62c174240127f1", "score": "0.501233", "text": "func (mcs *MiddlewareClusterService) Delete(id int) error {\n\treturn mcs.MiddlewareClusterRepo.Delete(id)\n}", "title": "" }, { "docid": "77b3cda7dc4f9d644b6bc5061c71b321", "score": "0.5006134", "text": "func (g *GRPCServer) DeleteInstaller(ctx context.Context, req *types.ResourceRequest) (*emptypb.Empty, error) {\n\tauth, err := g.authenticate(ctx)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\tif err := auth.DeleteInstaller(ctx, req.Name); err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\treturn &emptypb.Empty{}, nil\n}", "title": "" }, { "docid": "04fade1a0f5d522f6709659efd9e99ae", "score": "0.5001591", "text": "func DeleteCluster(t *testing.T, crClient versioned.Interface, vs *api.VaultService) error {\n\tt.Logf(\"deleting vault cluster: %v\", vs.Name)\n\terr := crClient.VaultV1alpha1().VaultServices(vs.Namespace).Delete(vs.Name, nil)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to delete CR: %v\", err)\n\t}\n\t// TODO: Wait for cluster resources to be deleted\n\treturn nil\n}", "title": "" }, { "docid": "9ec7eede59f8314d380ac6e15ce1f2f2", "score": "0.5000648", "text": "func (s *PresenceService) DeleteTrustedCluster(ctx context.Context, name string) error {\n\tif name == \"\" {\n\t\treturn trace.BadParameter(\"missing trusted cluster name\")\n\t}\n\terr := s.Delete(ctx, backend.Key(trustedClustersPrefix, name))\n\tif err != nil {\n\t\tif trace.IsNotFound(err) {\n\t\t\treturn trace.NotFound(\"trusted cluster %q is not found\", name)\n\t\t}\n\t}\n\treturn trace.Wrap(err)\n}", "title": "" }, { "docid": "39e0d93155d0d91f3b06256ec96259a1", "score": "0.4998679", "text": "func (c *Client) DeleteInActiveClusterInstallationsByCluster(clusterID string) (*MigrateClusterInstallationResponse, error) {\n\tresp, err := c.doDelete(c.buildURL(\"/api/cluster_installations/migrate/delete_inactive/%s\", clusterID))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer closeBody(resp)\n\n\tswitch resp.StatusCode {\n\tcase http.StatusOK:\n\t\treturn MigrateClusterInstallationResponseFromReader(resp.Body)\n\n\tdefault:\n\t\treturn nil, errors.Errorf(\"failed with status code %d\", resp.StatusCode)\n\t}\n}", "title": "" }, { "docid": "298f01a737404f77be95a75426546128", "score": "0.49629876", "text": "func (cluster *CouchdbCluster) DeleteDeployment() (error) {\n\t// options for delete\n\torphan := true\n\tdeleteOptions := api.DeleteOptions{OrphanDependents: &orphan}\n\t// get kube extensions client\n\tc, err := KubeClientExtensions(KUBE_API)\n\tif err != nil {\n\t\tErrorLog(\"kube control : delete coucdb cluster: kube extensions client error\")\n\t\treturn err\n\t}\n\t// delete deployment\n\terr = c.Deployments(cluster.Namespace).Delete(CLUSTER_PREFIX+cluster.Tag, &deleteOptions)\n\tif err != nil {\n\t\tErrorLog(\"kube control : delete coucdb cluster: delete deployment error\")\n\t\treturn err\n\t}\n\t// DELETE orphaned kube components\n\t// cascade deleting is not working, we have to manually delete replica sets and pods\n\t// get kube client\n\tc2, err := KubeClient(KUBE_API)\n\tif err != nil {\n\t\tErrorLog(\"kube control : delete coucdb cluster: kube client error\")\n\t\treturn err\n\t}\n\t// delete orphaned replica sets\n\t// get replica sets list\n\t// list options, with label selector\n\tlistOptions := api.ListOptions{LabelSelector: labels.SelectorFromSet(labels.Set(cluster.Labels))}\n\treplicaSetLists, err := c2.ReplicaSets(cluster.Namespace).List(listOptions)\n\tif err != nil {\n\t\tErrorLog(\"kube control : delete coucdb cluster: list replica sets error\")\n\t\treturn err\n\t}\n\t// iterate thorough all replica sets and find matching\n\tfor _, replicaSet := range replicaSetLists.Items {\n\t\t// check matching name\n\t\tif strings.HasPrefix(replicaSet.Name, CLUSTER_PREFIX + cluster.Tag) {\n\t\t\t// we got our replica set, so delete it\n\t\t\terr = c2.ReplicaSets(cluster.Namespace).Delete(replicaSet.Name, &deleteOptions)\n\t\t\tif err != nil {\n\t\t\t\tErrorLog(\"kube control : delete coucdb cluster: delete replica set error\")\n\t\t\t\treturn err\n\t\t\t}\n\t\t\t// there is only 1 replica set for each cluster db, so break loop\n\t\t\tbreak\n\t\t}\n\t}\n\t// no errors\n\treturn nil\n}", "title": "" }, { "docid": "e68dc10183fb1c1fc5b177c7cf383640", "score": "0.49569145", "text": "func (c *Cluster) Delete(r es.DeleteRequest) (_ es.IndexResponse, err error) {\n\tdefer func(began time.Time) {\n\t\tlabels := c.labels(\"delete\", err == nil)\n\t\tupdateRequestMetrics(labels, time.Since(began))\n\t}(time.Now())\n\n\treturn c.cluster.Delete(r)\n}", "title": "" }, { "docid": "41b9b9ff9f7827b6bc55144b2dc4bb76", "score": "0.4950542", "text": "func StopCluster(name string) Step {\n\tfmt.Println(\"Deleting k3d cluster...\")\n\treturn StepFn(func(fn ExecFn) error {\n\t\treturn fn(\n\t\t\t\"k3d\",\n\t\t\t[]string{\"cluster\", \"delete\", name},\n\t\t\tos.Environ(),\n\t\t)\n\t})\n}", "title": "" }, { "docid": "d0400d1efc9046fa079102bd24a5bd33", "score": "0.49497044", "text": "func (c *FakeClusterInstallations) Update(ctx context.Context, clusterInstallation *v1alpha1.ClusterInstallation, opts v1.UpdateOptions) (result *v1alpha1.ClusterInstallation, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewUpdateAction(clusterinstallationsResource, c.ns, clusterInstallation), &v1alpha1.ClusterInstallation{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*v1alpha1.ClusterInstallation), err\n}", "title": "" }, { "docid": "f2f4a04cc82139c3894f0057c144442e", "score": "0.49436", "text": "func (c *CLI) Delete(ctx context.Context, out io.Writer, manifests manifest.ManifestList) error {\n\targs := c.args(c.Flags.Delete, \"--ignore-not-found=true\", \"--wait=false\", \"-f\", \"-\")\n\tif err := c.Run(ctx, manifests.Reader(), out, \"delete\", args...); err != nil {\n\t\treturn deployerr.CleanupErr(fmt.Errorf(\"kubectl delete: %w\", err))\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "1a94fad6f4765185ff63992845c846bf", "score": "0.49370983", "text": "func Delete(c *client.Client, deployment string, namespace string) error {\n\t_, err := c.Clientset.AppsV1().Deployments(namespace).\n\t\tGet(context.TODO(), deployment, metav1.GetOptions{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfmt.Printf(\"Deleting deployment: %s namespace: %s...\\n\",\n\t\tdeployment,\n\t\tnamespace)\n\n\t// Double check service is removed\n\t// TODO: We can improve this logic with some pool schema\n\tfor i := 0; i < c.NumberMaxOfAttemptsPerTask; i++ {\n\t\t_, err := Exists(c, deployment, namespace)\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"Deleted deployment: %s namespace: %s\\n\",\n\t\t\t\tdeployment,\n\t\t\t\tnamespace)\n\t\t\tbreak\n\t\t}\n\t\tc.Clientset.AppsV1().Deployments(namespace).Delete(\n\t\t\tcontext.TODO(),\n\t\t\tdeployment,\n\t\t\tmetav1.DeleteOptions{})\n\n\t\ttime.Sleep(time.Duration(c.TimeoutTaskInSec) * time.Second)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "12abfd3f041d4ae5f982b6c57db19723", "score": "0.49349508", "text": "func (api RestAPIMock) DeleteCluster(clusterID string) error {\n\t// return mocked response\n\treturn nil\n}", "title": "" }, { "docid": "538ffd3cf48325c11a7c5b328e97e2fe", "score": "0.49236265", "text": "func (c *eKSs) Delete(name string, options *v1.DeleteOptions) error {\n\treturn c.client.Delete().\n\t\tNamespace(c.ns).\n\t\tResource(\"ekss\").\n\t\tName(name).\n\t\tBody(options).\n\t\tDo().\n\t\tError()\n}", "title": "" }, { "docid": "023b4d66d427342a2eae38a02c7c4d06", "score": "0.49220622", "text": "func (c *InstallClient) Uninstall(cmd *cobra.Command) error {\n\tlog := c.Log.WithName(\"Uninstall\")\n\tlog.Info(\"start\")\n\tdefer log.Info(\"return\")\n\tdetails := log.V(1) // NOTE: Increment of level, not absolute.\n\n\tc.ui.Note().Msg(\"FuseML uninstalling...\")\n\n\tfor _, deployment := range []kubernetes.Deployment{\n\t\t&deployments.Workloads{Timeout: DefaultTimeoutSec},\n\t\t&deployments.Tekton{Timeout: DefaultTimeoutSec},\n\t\t&deployments.Registry{Timeout: DefaultTimeoutSec},\n\t\t&deployments.Gitea{Timeout: DefaultTimeoutSec},\n\t\t&deployments.Core{Timeout: DefaultTimeoutSec},\n\t\t&deployments.Quarks{Timeout: DefaultTimeoutSec},\n\t\t&deployments.Istio{Timeout: DefaultTimeoutSec},\n\t} {\n\t\tdetails.Info(\"remove\", \"Deployment\", deployment.ID())\n\t\terr := deployment.Delete(c.kubeClient, c.ui)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tc.ui.Success().Msg(\"FuseML uninstalled.\")\n\n\treturn nil\n}", "title": "" }, { "docid": "6069f04acc91688f12b05024e9b5e610", "score": "0.49168321", "text": "func (a *Actuator) Delete(ctx context.Context, cluster *clusterv1.Cluster, machine *clusterv1.Machine) error {\n\tlog.Printf(\"Deleting machine %v for cluster %v.\", machine.Name, cluster.Name)\n\t_, err := a.clientset.CoreV1().Pods(cluster.Namespace).Get(machine.Name, metav1.GetOptions{})\n\tif err != nil {\n\t\tif strings.Contains(err.Error(), \"not found\") {\n\t\t\treturn nil\n\t\t}\n\t\treturn fmt.Errorf(\"Could not get machine pod: %v\", err)\n\t}\n\terr = a.clientset.CoreV1().Pods(cluster.Namespace).Delete(machine.Name, &metav1.DeleteOptions{})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Could not delete machine pod: %v\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1a3feab030c0f2b7be8519789faefc78", "score": "0.4912606", "text": "func (client *GslbHealthMonitorClient) DeleteByName(name string) error {\n\tres, err := client.GetByName(name)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn client.Delete(res.UUID)\n}", "title": "" }, { "docid": "f171b545106667bc94fefd7b675ccb40", "score": "0.49116775", "text": "func (c *ClusterController) Delete(ctx *app.DeleteClusterContext) error {\n\t// ClusterController_Delete: start_implement\n\tproj, ok := c.ds.Project(ctx.Projectid)\n\tif !ok {\n\t\treturn ctx.NotFound()\n\t}\n\tres, ok := c.ds.Resource(ctx.ResourceID)\n\tif !ok {\n\t\treturn ctx.NotFound()\n\t}\n\tns, ok := c.ds.Namespace(res.NamespaceID)\n\tif !ok {\n\t\treturn ctx.NotFound()\n\t}\n\tif ns.Resources.OID != ctx.ResourceID {\n\t\treturn ctx.BadRequest(errors.New(\"Inavlid Cluster Resource Object ID specified in request\"))\n\t}\n\n\tres.State = ResourceDeleteRequested\n\tc.backend.ProjectRequest(RemoveProject, c.ds, proj, ns, res)\n\n\tc.ds.DeleteResource(res)\n\tns.Resources = nil\n\n\treturn ctx.NoContent()\n\t// ClusterController_Delete: end_implement\n}", "title": "" }, { "docid": "63377864e4fc63a47de39040b1933ec7", "score": "0.49007958", "text": "func DeleteCluster(cluster *Cluster, session *Session) (bool, error) {\n\tdeleteClusterRequest := DeleteClusterRequest{\n\t\tCluster: cluster,\n\t}\n\tdeleteClusterBytes, _ := json.Marshal(deleteClusterRequest)\n\tpayload := bytes.NewBuffer(deleteClusterBytes)\n\turi := clustersURI + \"/\" + cluster.ID\n\tstatusCode, _, err := httpRequest(session, \"DELETE\", uri, \"application/json\", payload)\n\tif err != nil || statusCode == 404 {\n\t\treturn false, err\n\t}\n\treturn true, nil\n}", "title": "" }, { "docid": "23499b8f28a6f4b4b535b9c709d7bca6", "score": "0.48970827", "text": "func runDelete(cmd *cobra.Command, args []string) {\n\tif len(args) > 0 {\n\t\texit.Usage(\"usage: minikube delete\")\n\t}\n\tprofile := viper.GetString(pkg_config.MachineProfile)\n\tapi, err := machine.NewAPIClient()\n\tif err != nil {\n\t\texit.WithError(\"Error getting client\", err)\n\t}\n\tdefer api.Close()\n\n\tcc, err := pkg_config.Load()\n\tif err != nil && !os.IsNotExist(err) {\n\t\tconsole.ErrLn(\"Error loading profile config: %v\", err)\n\t}\n\n\t// In the case of \"none\", we want to uninstall Kubernetes as there is no VM to delete\n\tif err == nil && cc.MachineConfig.VMDriver == constants.DriverNone {\n\t\tuninstallKubernetes(api, cc.KubernetesConfig, viper.GetString(cmdcfg.Bootstrapper))\n\t}\n\n\tif err = cluster.DeleteHost(api); err != nil {\n\t\tswitch err := errors.Cause(err).(type) {\n\t\tcase mcnerror.ErrHostDoesNotExist:\n\t\t\tconsole.OutStyle(console.Meh, \"%q cluster does not exist\", profile)\n\t\tdefault:\n\t\t\texit.WithError(\"Failed to delete cluster\", err)\n\t\t}\n\t}\n\n\tif err := cmdUtil.KillMountProcess(); err != nil {\n\t\tconsole.Fatal(\"Failed to kill mount process: %v\", err)\n\t}\n\n\tif err := os.RemoveAll(constants.GetProfilePath(viper.GetString(pkg_config.MachineProfile))); err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\tconsole.OutStyle(console.Meh, \"%q profile does not exist\", profile)\n\t\t\tos.Exit(0)\n\t\t}\n\t\texit.WithError(\"Failed to remove profile\", err)\n\t}\n\tconsole.OutStyle(console.Crushed, \"The %q cluster has been deleted.\", profile)\n\n\tmachineName := pkg_config.GetMachineName()\n\tif err := pkgutil.DeleteKubeConfigContext(constants.KubeconfigPath, machineName); err != nil {\n\t\texit.WithError(\"update config\", err)\n\t}\n}", "title": "" }, { "docid": "d1802efcc071ce9de84b562661c6541f", "score": "0.4895632", "text": "func DeleteRelease(name, namespace string) error {\n\tbinary, err := exec.LookPath(helmCmd[0])\n\tif err != nil {\n\t\treturn err\n\t}\n\n\targs := []string{\"uninstall\", name, \"-n\", namespace}\n\tcmd := exec.Command(binary, args...)\n\tlog.Info(\"Exec\", \"command\", cmd.String())\n\t// env := os.Environ()\n\t// if types.KubeConfig != \"\" {\n\t// \tenv = append(env, fmt.Sprintf(\"KUBECONFIG=%s\", types.KubeConfig))\n\t// }\n\t// return syscall.Exec(cmd, args, env)\n\tout, err := cmd.Output()\n\tlog.Info(\"delete release\", \"result\", string(out))\n\tif err != nil {\n\t\tlog.Error(err, \"failed to execute DeleteRelease() command\", \"command\", cmd.String())\n\t\treturn fmt.Errorf(\"failed to delete engine-related kubernetes resources\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a19fac25c1323504bc5581ede8cf6ad1", "score": "0.48954362", "text": "func (c *Client) Delete(name string) error {\n\tctx, cancel := context.WithTimeout(context.Background(), time.Duration(timeOutInSeconds)*time.Second)\n\tdefer cancel()\n\n\tu, err := url.Parse(c.Address)\n\tif err != nil {\n\t\tc.Logger.Debug().Err(err).Msg(\"Failed to parse address\")\n\t\treturn err\n\t}\n\n\tu.Path = path.Join(u.Path, vaultURI, name)\n\tcode, err := c.Handler.MakeRequest(ctx, http.MethodDelete, u.String())\n\tif err != nil {\n\t\tc.Logger.Debug().Err(err).Int(\"code\", code).Msg(\"Failed to delete result.\")\n\t\treturn err\n\t}\n\tif code > 299 || code < 200 {\n\t\tc.Logger.Error().Str(\"url\", u.String()).Int(\"code\", code).Msg(\"Return code was not OK\")\n\t\treturn fmt.Errorf(\"return code was not OK %d\", code)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "975bf0ef26fd37b04fc2819a1220e5f3", "score": "0.48906928", "text": "func (cl *ClusterService) DeleteCluster(ID string) (err error) {\n\tlog.Debug(\"DeleteCluster\")\n\n\tdata, status, err := cl.concertoService.Delete(fmt.Sprintf(\"/v1/kaas/fleets/%s\", ID))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err = utils.CheckStandardStatus(status, data); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "104f850fb671f50888e61ebfffb2c98e", "score": "0.48760822", "text": "func (hr *Repository) Delete(name string) (err error) {\n\n\tif hub, ok := hr.Load(name); ok {\n\t\tif err = hub.deleteNodeDB(); err != nil {\n\t\t\treturn\n\t\t}\n\t\tif hr.db != nil {\n\t\t\tif err = hr.db.Delete(name); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\thr.hubs.Delete(name)\n\t}\n\treturn\n\n}", "title": "" }, { "docid": "cfc5b4aa452d091c4a3b33811d37a284", "score": "0.48732772", "text": "func Delete(api client.Client) error {\n\tlog.Info(\"Deleting Quickstarts\")\n\tmanifest, err := mfc.NewManifest(manifestPath(), api, mf.UseLogger(log.WithName(\"mf\")))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to load quickstart manifest: %w\", err)\n\t}\n\n\tif err := manifest.Delete(); err != nil {\n\t\tif apierrs.IsNoMatchError(err) {\n\t\t\tlog.Info(\"ConsoleQuickStart CRD not installed, skipping quickstart installation\")\n\t\t\treturn nil\n\t\t}\n\t\treturn fmt.Errorf(\"failed to delete quickstart manifest: %w\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "811f38ac2616571f7f655f75e041da12", "score": "0.48718935", "text": "func (cas *CassandraInstance) Uninstall(ctx context.Context) error {\n\tlog.Print(\"Uninstalling application.\", field.M{\"app\": cas.name})\n\tcli, err := helm.NewCliClient()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to create helm client\")\n\t}\n\terr = cli.Uninstall(ctx, cas.chart.Release, cas.namespace)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"Error uninstalling cassandra app.\")\n\t}\n\tlog.Print(\"Application was uninstalled successfully.\", field.M{\"app\": cas.name})\n\treturn nil\n}", "title": "" }, { "docid": "c91907c2c92146e2977694b263b9a0c5", "score": "0.48706117", "text": "func (sqlStore *SQLStore) DeleteInstallationDNS(installationID, dnsName string) error {\n\tquery := sq.Update(installationDNSTable).Set(\"DeleteAt\", model.GetMillis()).\n\t\tWhere(\"InstallationID = ?\", installationID).\n\t\tWhere(\"DomainName = ?\", dnsName).\n\t\tWhere(\"DeleteAt = 0\")\n\n\t_, err := sqlStore.execBuilder(sqlStore.db, query)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to delete DNS record for installation\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f50af56ca89cb5067f0e8438cee31b1b", "score": "0.48627102", "text": "func (g *GKECluster) DeleteCluster() error {\n\n\tlog := logger.WithFields(logrus.Fields{\"action\": constants.TagDeleteCluster})\n\n\tlog.Info(\"Start delete google cluster\")\n\n\tif g == nil {\n\t\treturn constants.ErrorNilCluster\n\t}\n\n\tgkec := googleCluster{\n\t\tProjectID: g.modelCluster.Google.Project,\n\t\tName: g.modelCluster.Name,\n\t\tZone: g.modelCluster.Location,\n\t}\n\n\tif err := g.callDeleteCluster(&gkec); err != nil {\n\t\tbe := getBanzaiErrorFromError(err)\n\t\t// TODO status code !?\n\t\treturn errors.New(be.Message)\n\t}\n\tlog.Info(\"Delete succeeded\")\n\treturn nil\n\n}", "title": "" }, { "docid": "3076fe249e3b1edd6e5f853a61b5645d", "score": "0.48609737", "text": "func (dm *DeployerManagement) CleanupInstallation(ctx context.Context, inst *lsv1alpha1.Installation) error {\n\tenvName, ok := inst.Labels[lsv1alpha1.DeployerEnvironmentLabelName]\n\tif !ok {\n\t\treturn errors.New(\"no environment label provided\")\n\t}\n\tregName, ok := inst.Labels[lsv1alpha1.DeployerRegistrationLabelName]\n\tif !ok {\n\t\treturn errors.New(\"no deployer registration label provided\")\n\t}\n\n\tcrb := &rbacv1.ClusterRoleBinding{}\n\tcrb.Name = FQNameFromName(regName, envName)\n\tif err := dm.client.Delete(ctx, crb); err != nil && !apierrors.IsNotFound(err) {\n\t\treturn fmt.Errorf(\"unable to delete clusterrolebinding %q: %w\", crb.Name, err)\n\t}\n\n\terr := wait.PollImmediate(10*time.Second, 2*time.Minute, func() (done bool, err error) {\n\t\tobj := crb.DeepCopy()\n\t\tif err := dm.client.Get(ctx, kutil.ObjectKeyFromObject(obj), obj); err != nil {\n\t\t\tif apierrors.IsNotFound(err) {\n\t\t\t\treturn true, nil\n\t\t\t}\n\t\t}\n\t\treturn false, nil\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\tcontrollerutil.RemoveFinalizer(inst, lsv1alpha1.LandscaperDMFinalizer)\n\tif err := dm.client.Update(ctx, inst); err != nil {\n\t\treturn fmt.Errorf(\"unable to remove finalizer: %w\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f4d108c42fdf3490c5086e622406956e", "score": "0.48599726", "text": "func ExampleEKS_DeleteCluster_shared00() {\n\tsvc := eks.New(session.New())\n\tinput := &eks.DeleteClusterInput{\n\t\tName: aws.String(\"devel\"),\n\t}\n\n\tresult, err := svc.DeleteCluster(input)\n\tif err != nil {\n\t\tif aerr, ok := err.(awserr.Error); ok {\n\t\t\tswitch aerr.Code() {\n\t\t\tcase eks.ErrCodeResourceInUseException:\n\t\t\t\tfmt.Println(eks.ErrCodeResourceInUseException, aerr.Error())\n\t\t\tcase eks.ErrCodeResourceNotFoundException:\n\t\t\t\tfmt.Println(eks.ErrCodeResourceNotFoundException, aerr.Error())\n\t\t\tcase eks.ErrCodeClientException:\n\t\t\t\tfmt.Println(eks.ErrCodeClientException, aerr.Error())\n\t\t\tcase eks.ErrCodeServerException:\n\t\t\t\tfmt.Println(eks.ErrCodeServerException, aerr.Error())\n\t\t\tcase eks.ErrCodeServiceUnavailableException:\n\t\t\t\tfmt.Println(eks.ErrCodeServiceUnavailableException, 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": "5540c5824bbcb60a8da784a2e7a14af1", "score": "0.48581946", "text": "func (c *TkgClient) DeleteWorkloadCluster(options DeleteWorkloadClusterOptions) error {\n\tcurrentRegion, err := c.GetCurrentRegionContext()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"cannot get current management cluster context\")\n\t}\n\tclusterclientOptions := clusterclient.Options{\n\t\tGetClientInterval: 1 * time.Second,\n\t\tGetClientTimeout: 3 * time.Second,\n\t}\n\tclusterClient, err := clusterclient.NewClient(currentRegion.SourceFilePath, currentRegion.ContextName, clusterclientOptions)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"unable to get cluster client while deleting cluster\")\n\t}\n\n\tif options.Namespace == \"\" {\n\t\toptions.Namespace = constants.DefaultNamespace\n\t}\n\n\tisPacific, err := clusterClient.IsPacificRegionalCluster()\n\tif err == nil && !isPacific {\n\t\terr = deleteAutoscalerDeploymentIfPresent(clusterClient, options.ClusterName, options.Namespace)\n\t\tif err != nil {\n\t\t\tlog.Warningf(\"failed to delete autoscaler resources from management cluster, reason: %v\", err)\n\t\t}\n\n\t\terr = deleteCRSObjectsIfPresent(clusterClient, options.ClusterName, options.Namespace)\n\t\tif err != nil {\n\t\t\tlog.Warningf(\"failed to delete ClusterResourceSet objects from management cluster, reason: %v\", err)\n\t\t}\n\t}\n\n\treturn clusterClient.DeleteCluster(options.ClusterName, options.Namespace)\n}", "title": "" }, { "docid": "8d3dca90c8b1ff1da71ca44bab4520db", "score": "0.48525724", "text": "func (c *nfsshares) Delete(name string, options *v1.DeleteOptions) error {\n\treturn c.client.Delete().\n\t\tNamespace(c.ns).\n\t\tResource(\"nfsshares\").\n\t\tName(name).\n\t\tBody(options).\n\t\tDo().\n\t\tError()\n}", "title": "" }, { "docid": "6f84aead5a333d21778cf74cb05d4777", "score": "0.48488286", "text": "func (a *Actuator) Delete(cluster *clusterv1.Cluster) error {\n\tklog.Infof(\"Reconciling cluster %v\", cluster.Name)\n\n\tscope, err := actuators.NewScope(actuators.ScopeParams{Cluster: cluster, Client: a.client})\n\tif err != nil {\n\t\treturn errors.Errorf(\"failed to create scope: %+v\", err)\n\t}\n\n\tdefer scope.Close()\n\n\tif err := NewReconciler(scope).Delete(); err != nil {\n\t\tklog.Errorf(\"Error deleting resource group: %v.\", err)\n\t\treturn &controllerError.RequeueAfterError{\n\t\t\tRequeueAfter: 5 * 1000 * 1000 * 1000,\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2033df04cd2634e612c62f05fadc7cc9", "score": "0.48488003", "text": "func handleDeleteInActiveClusterInstallationByID(c *Context, w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r)\n\tclusterInstallationID := vars[\"ClusterInstallationID\"]\n\tc.Logger = c.Logger.WithField(\"ClusterInstallationID\", clusterInstallationID)\n\tif len(clusterInstallationID) == 0 {\n\t\tc.Logger.Error(\"Missing mandatory cluster installation id in a migration request\")\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\n\t// Delete single inactive cluster installation\n\tclusterInstallation, err := c.Store.GetClusterInstallation(clusterInstallationID)\n\tif err != nil {\n\t\tc.Logger.WithError(err).Errorf(\"Unable to retrieve inactive cluster installation for deletion %s\", clusterInstallationID)\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\tclusterInstallation.State = model.ClusterInstallationStateDeletionRequested\n\terr = c.Store.UpdateClusterInstallation(clusterInstallation)\n\tif err != nil {\n\t\tc.Logger.WithError(err).Errorf(\"Failed to delete inactive cluster installation %s\", clusterInstallationID)\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\tc.Logger.Infof(\"Successfully deleted inactive cluster installations ID %s\", clusterInstallationID)\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\toutputJSON(c, w, clusterInstallation)\n}", "title": "" }, { "docid": "e495fd42e5c41fbc86bc7a21fde7af2f", "score": "0.48471484", "text": "func (api RestAPIMock) DeleteClusterConfiguration(configurationID string) error {\n\t// return mocked response\n\treturn nil\n}", "title": "" }, { "docid": "1d0121580fa9ace6061b9a602fc0737a", "score": "0.48471314", "text": "func (client CassandraDataCentersClient) Delete(ctx context.Context, resourceGroupName string, clusterName string, dataCenterName string) (result CassandraDataCentersDeleteFuture, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/CassandraDataCentersClient.Delete\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif result.FutureAPI != nil && result.FutureAPI.Response() != nil {\n\t\t\t\tsc = result.FutureAPI.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: clusterName,\n\t\t\tConstraints: []validation.Constraint{{Target: \"clusterName\", Name: validation.MaxLength, Rule: 100, Chain: nil},\n\t\t\t\t{Target: \"clusterName\", Name: validation.MinLength, Rule: 1, Chain: nil},\n\t\t\t\t{Target: \"clusterName\", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$`, Chain: nil}}},\n\t\t{TargetValue: dataCenterName,\n\t\t\tConstraints: []validation.Constraint{{Target: \"dataCenterName\", Name: validation.MaxLength, Rule: 100, Chain: nil},\n\t\t\t\t{Target: \"dataCenterName\", Name: validation.MinLength, Rule: 1, Chain: nil},\n\t\t\t\t{Target: \"dataCenterName\", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$`, Chain: nil}}}}); err != nil {\n\t\treturn result, validation.NewError(\"documentdb.CassandraDataCentersClient\", \"Delete\", err.Error())\n\t}\n\n\treq, err := client.DeletePreparer(ctx, resourceGroupName, clusterName, dataCenterName)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"documentdb.CassandraDataCentersClient\", \"Delete\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresult, err = client.DeleteSender(req)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"documentdb.CassandraDataCentersClient\", \"Delete\", result.Response(), \"Failure sending request\")\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "55f598a03ba16abdba7db0d63baa4805", "score": "0.4845255", "text": "func (g *GRPCServer) DeleteTrustedCluster(ctx context.Context, req *types.ResourceRequest) (*emptypb.Empty, error) {\n\tauth, err := g.authenticate(ctx)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\tif err := auth.ServerWithRoles.DeleteTrustedCluster(ctx, req.Name); err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\treturn &emptypb.Empty{}, nil\n}", "title": "" }, { "docid": "7f378bfee0d021407aa2d910c918e96f", "score": "0.48403054", "text": "func DeleteDeployment(c *gin.Context) {\n\n\tbanzaiUtils.LogInfo(banzaiConstants.TagDeleteDeployment, \"Start delete deployment\")\n\n\tname := c.Param(\"name\")\n\n\t// --- [ Get cluster ] --- //\n\tbanzaiUtils.LogInfo(banzaiConstants.TagDeleteDeployment, \"Get cluster\")\n\tcloudCluster, err := cloud.GetClusterFromDB(c)\n\tif err != nil {\n\t\treturn\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.TagDeleteDeployment, \"Getting K8S Config Succeeded\")\n\n\t// --- [Delete deployment] --- //\n\tbanzaiUtils.LogInfo(banzaiConstants.TagDeleteDeployment, \"Delete deployment\")\n\terr = helm.DeleteDeployment(name, kubeConfig)\n\tif err != nil {\n\t\t// error during delete deployment\n\t\tbanzaiUtils.LogWarn(banzaiConstants.TagDeleteDeployment, 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\t// delete succeeded\n\t\tbanzaiUtils.LogInfo(banzaiConstants.TagDeleteDeployment, \"Delete deployment succeeded\")\n\t}\n\tcloud.SetResponseBodyJson(c, http.StatusOK, gin.H{\n\t\tcloud.JsonKeyStatus: http.StatusOK,\n\t\tcloud.JsonKeyMessage: \"success\",\n\t})\n\treturn\n}", "title": "" }, { "docid": "0db2d9630623443b3880344cacf461da", "score": "0.48264873", "text": "func (s *Store) Delete(name string) (err error) {\n\tok, err := s.Has(name)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !ok {\n\t\treturn store.ErrTransactionNotFound\n\t}\n\n\treturn s.data.Delete([]byte(name), nil)\n}", "title": "" }, { "docid": "4c846256d5a6b5cf61d4075f8a1add46", "score": "0.48235932", "text": "func (self Installation) Uninstall(kind RefKind, name string, arch string, branch string, progress ProgressCallback, cancellable gio.Cancellable) (bool, error) {\n\tname0 := C.CString(name)\n\tarch0 := C.CString(arch)\n\tbranch0 := C.CString(branch)\n\tprogress0 := (*C.GClosure)(gobject.ClosureNew(progress).Ptr) /*gir:GObject*/\n\tvar err glib.Error\n\tret0 := C._flatpak_installation_uninstall(self.native(), C.FlatpakRefKind(kind), name0, arch0, branch0, progress0, (*C.GCancellable)(cancellable.Ptr), (**C.GError)(unsafe.Pointer(&err)))\n\tC.free(unsafe.Pointer(name0)) /*ch:<stdlib.h>*/\n\tC.free(unsafe.Pointer(arch0)) /*ch:<stdlib.h>*/\n\tC.free(unsafe.Pointer(branch0)) /*ch:<stdlib.h>*/\n\tC.g_closure_unref(progress0)\n\tif err.Ptr != nil {\n\t\tdefer err.Free()\n\t\treturn false, err.GoValue()\n\t}\n\treturn util.Int2Bool(int(ret0)) /*go:.util*/, nil\n}", "title": "" }, { "docid": "fce471dfb08df41bc3ea234303cc65db", "score": "0.48199344", "text": "func Delete(deployment string) error {\n\ttype DeleteDeploymentJobArgs struct {\n\t\tDeployment string\n\t}\n\n\tgo enqueue(job.Job{\n\t\tID: uuid.Generate().String(),\n\t\tDeployment: deployment,\n\t\tType: string(DeleteDeploymentJobType),\n\t\tRetryPolicy: utils.UIntEnv(constants.EnvDeploymentRetryPolicy),\n\t\tArgs: DeleteDeploymentJobArgs{\n\t\t\tDeployment: deployment,\n\t\t},\n\t\tRun: func(args interface{}) error {\n\t\t\tjobArgs := args.(DeleteDeploymentJobArgs)\n\t\t\tdeploymentName := jobArgs.Deployment\n\n\t\t\t// get current containers\n\t\t\tcontainers, err := GetContainersByDeployment(deploymentName)\n\t\t\tif err != nil {\n\t\t\t\tlogger.Errorf(\"unable get containers %v\", err)\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t// remove containers\n\t\t\tfor _, c := range containers {\n\t\t\t\tif err := c.Remove(); err != nil {\n\t\t\t\t\tlogger.Errorf(\"unable to remove container %v\", err)\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t\tlogger.Debugf(\"%d container(s) for deployment %s removed\", len(containers), deploymentName)\n\n\t\t\treturn nil\n\t\t},\n\t\tFinally: func(args interface{}) error {\n\t\t\tjobArgs := args.(DeleteDeploymentJobArgs)\n\t\t\tdeploymentName := jobArgs.Deployment\n\n\t\t\t// delete secrets collection\n\t\t\tlogger.Debugf(\"removing secrets collection for deployment %s\", deploymentName)\n\t\t\tif err := DeleteSecretsCollection(deploymentName); err != nil {\n\t\t\t\tlogger.Errorf(\"unable to remove secrets collection %v\", err)\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t// delete jobs collection\n\t\t\tlogger.Debugf(\"removing jobs collection for deployment %s\", deploymentName)\n\t\t\tif err := DeleteJobsCollection(deploymentName); err != nil {\n\t\t\t\tlogger.Errorf(\"unable to remove jobs collection %v\", err)\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t// delete deployment configuration\n\t\t\tlogger.Debugf(\"removing config for deployment %s\", deploymentName)\n\t\t\tif err := DeleteConfig(deploymentName); err != nil {\n\t\t\t\tlogger.Errorf(\"unable to remove deployment configuration %v\", err)\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\treturn nil\n\t\t},\n\t})\n\n\treturn nil\n}", "title": "" }, { "docid": "51137c4de9e79f43d078da71efcf027f", "score": "0.48164544", "text": "func (provisioner *kopsCIAlpha) UpdateClusterInstallation(cluster *model.Cluster, installation *model.Installation, clusterInstallation *model.ClusterInstallation) error {\n\tlogger := provisioner.logger.WithFields(log.Fields{\n\t\t\"cluster\": clusterInstallation.ClusterID,\n\t\t\"installation\": clusterInstallation.InstallationID,\n\t})\n\n\tconfigLocation, err := provisioner.getCachedKopsClusterKubecfg(cluster.ProvisionerMetadataKops.Name, logger)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to get kops config from cache\")\n\t}\n\tdefer provisioner.invalidateCachedKopsClientOnError(err, cluster.ProvisionerMetadataKops.Name, logger)\n\n\tk8sClient, err := k8s.NewFromFile(configLocation, logger)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to create k8s client from file\")\n\t}\n\n\tname, err := provisioner.prepareClusterInstallationEnv(clusterInstallation, k8sClient)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to prepare cluster installation env\")\n\t}\n\n\tctx := context.TODO()\n\n\tcr, err := k8sClient.MattermostClientsetV1Alpha.MattermostV1alpha1().ClusterInstallations(clusterInstallation.Namespace).Get(ctx, name, metav1.GetOptions{})\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"failed to get cluster installation %s\", clusterInstallation.ID)\n\t}\n\n\tlogger.WithField(\"status\", fmt.Sprintf(\"%+v\", cr.Status)).Debug(\"Got cluster installation\")\n\n\tcr.ObjectMeta.Labels = generateClusterInstallationResourceLabels(installation, clusterInstallation)\n\n\tversion := translateMattermostVersion(installation.Version)\n\tif cr.Spec.Version == version {\n\t\tlogger.Debugf(\"Cluster installation already on version %s\", version)\n\t} else {\n\t\tlogger.Debugf(\"Cluster installation version updated from %s to %s\", cr.Spec.Version, installation.Version)\n\t\tcr.Spec.Version = version\n\t}\n\n\tif cr.Spec.Image == installation.Image {\n\t\tlogger.Debugf(\"Cluster installation already on image %s\", installation.Image)\n\t} else {\n\t\tlogger.Debugf(\"Cluster installation image updated from %s to %s\", cr.Spec.Image, installation.Image)\n\t\tcr.Spec.Image = installation.Image\n\t}\n\n\t// A few notes on installation sizing changes:\n\t// - Resizing currently ignores the installation scheduling algorithm.\n\t// There is no good interface to determine if the new installation\n\t// size will safely fit on the cluster. This could, in theory, be done\n\t// when the size request change comes in on the API, but would require\n\t// new scheduling logic. For now, take care when resizing.\n\t// TODO: address these issue.\n\tcr.Spec.Size = installation.Size // Appropriate replicas and resources will be set by Operator.\n\n\tcr.Spec.MattermostLicenseSecret = \"\"\n\tsecretName := fmt.Sprintf(\"%s-license\", name)\n\tif installation.License != \"\" {\n\t\tsecretName, err = provisioner.prepareCILicenseSecret(installation, clusterInstallation, k8sClient)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"failed to prepare license secret\")\n\t\t}\n\n\t\tcr.Spec.MattermostLicenseSecret = secretName\n\t} else {\n\t\terr = k8sClient.Clientset.CoreV1().Secrets(clusterInstallation.Namespace).Delete(ctx, secretName, metav1.DeleteOptions{})\n\t\tif k8sErrors.IsNotFound(err) {\n\t\t\tlogger.Infof(\"Secret %s/%s not found. Maybe the license was not set for this installation or was already deleted\", clusterInstallation.Namespace, secretName)\n\t\t}\n\t}\n\n\terr = provisioner.ensureFilestoreAndDatabase(cr, installation, clusterInstallation, k8sClient, logger)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to ensure database and filestore\")\n\t}\n\n\tmattermostEnv := getMattermostEnvWithOverrides(installation)\n\tcr.Spec.MattermostEnv = mattermostEnv.ToEnvList()\n\n\tcr.Spec.IngressAnnotations = getIngressAnnotations()\n\n\t_, err = k8sClient.MattermostClientsetV1Alpha.MattermostV1alpha1().ClusterInstallations(clusterInstallation.Namespace).Update(ctx, cr, metav1.UpdateOptions{})\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"failed to update cluster installation %s\", clusterInstallation.ID)\n\t}\n\n\tlogger.Info(\"Updated cluster installation\")\n\n\treturn nil\n}", "title": "" }, { "docid": "721f666afb872f03d583503942b5b65d", "score": "0.48149848", "text": "func DeletePartition(services *Services, entry *shards.RouterEntry, partition int) error {\n \n services.Logger.Printf(\"DELETING Partition %d From %s\", partition, entry.Address)\n request := cheshire.NewRequest(shards.PARTITION_DELETE, \"DELETE\") \n request.Params().Put(\"partition\", partition)\n\n services.Logger.Printf(\"NOW Deleting the partition from the origin server %s\", entry.Address)\n\n response, err := client.HttpApiCallSync(\n fmt.Sprintf(\"%s:%d\", entry.Address, entry.HttpPort),\n request,\n 300 * time.Second)\n\n if err != nil {\n return err\n }\n\n if response.StatusCode() != 200 {\n return fmt.Errorf(\"ERROR While deleting partition: %s\", response.StatusMessage())\n }\n return nil\n}", "title": "" }, { "docid": "fbfdcf9b70b9b4da2db884796ae70b40", "score": "0.481003", "text": "func (c *ClusterService) DeleteWithEvent(clusterName string) error {\n\tcluster, err := c.Get(clusterName)\n\tif err != nil {\n\t\treturn ErrDeleteCluster.InternalError(err)\n\t}\n\tif cluster == nil {\n\t\treturn errors.Errorf(\"not found\")\n\t}\n\n\tlogrus.Infof(\"deleting cluster: %+v\", cluster)\n\n\tif err := c.DeleteByName(clusterName); err != nil {\n\t\treturn ErrDeleteCluster.InternalError(err)\n\t}\n\n\tev := &apistructs.EventCreateRequest{\n\t\tEventHeader: apistructs.EventHeader{\n\t\t\tEvent: bundle.ClusterEvent,\n\t\t\tAction: bundle.DeleteAction,\n\t\t\tOrgID: \"-1\",\n\t\t\tProjectID: \"-1\",\n\t\t\tTimeStamp: time.Now().Format(\"2006-01-02 15:04:05\"),\n\t\t},\n\t\tSender: bundle.SenderClusterManager,\n\t\tContent: cluster,\n\t}\n\n\tif err = c.bdl.CreateEvent(ev); err != nil {\n\t\tlogrus.Warnf(\"[alert]failed to send cluster delete event, (%v)\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b4c781c0481e642a4691b240f4e2f37e", "score": "0.48081806", "text": "func (g *GRPCServer) DeleteKubernetesCluster(ctx context.Context, req *types.ResourceRequest) (*emptypb.Empty, error) {\n\tauth, err := g.authenticate(ctx)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\tif err := auth.DeleteKubernetesCluster(ctx, req.Name); err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\treturn &emptypb.Empty{}, nil\n}", "title": "" }, { "docid": "fac9b25fb19c3d5ec26633311f22ced3", "score": "0.48006436", "text": "func Delete(name string) error {\n\tif Exists(name) {\n\t\tps, err := deserialize()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tind := -1\n\t\tfor i, v := range ps {\n\t\t\tif v.Name == name {\n\t\t\t\tind = i\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tps = append(ps[:ind], ps[ind+1:]...)\n\t\terr = serialize(ps)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn deleteProjectDir(name)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "cbbb623de98a86e37fc097120157a50b", "score": "0.47986522", "text": "func (c *RDS) DeleteDBClusterRequest(input *DeleteDBClusterInput) (req *request.Request, output *DeleteDBClusterOutput) {\n\top := &request.Operation{\n\t\tName: opDeleteDBCluster,\n\t\tHTTPMethod: \"POST\",\n\t\tHTTPPath: \"/\",\n\t}\n\n\tif input == nil {\n\t\tinput = &DeleteDBClusterInput{}\n\t}\n\n\treq = c.newRequest(op, input, output)\n\toutput = &DeleteDBClusterOutput{}\n\treq.Data = output\n\treturn\n}", "title": "" }, { "docid": "9c23474d658b51f4fb3416dbfa2ab2ae", "score": "0.4796825", "text": "func (i *Index) Delete(name, version string) error {\n\ti.mu.Lock()\n\tdefer i.mu.Unlock()\n\tif err := i.refresh(); err != nil {\n\t\treturn err\n\t}\n\n\tidx, md := i.find(name, version)\n\tif md == nil {\n\t\treturn errors.New(\"gem not found\")\n\t}\n\t// delete from gems\n\ti.gems = append(i.gems[:idx], i.gems[idx+1:]...)\n\treturn i.save()\n}", "title": "" }, { "docid": "74853e5d45e08af05c1c4765d73fd2ab", "score": "0.47942498", "text": "func (c *Client) DeleteCluster(clusterID string) error {\n\tresp, err := c.doDelete(c.buildURL(\"/api/cluster/%s\", clusterID))\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer closeBody(resp)\n\n\tswitch resp.StatusCode {\n\tcase http.StatusAccepted:\n\t\treturn nil\n\n\tdefault:\n\t\treturn errors.Errorf(\"failed with status code %d\", resp.StatusCode)\n\t}\n}", "title": "" }, { "docid": "f7468d3db6c381bc50d739b94ab9cf0c", "score": "0.47907147", "text": "func Purge(c *db.Cluster, name string) error {\n\tlogger.Debugf(\"Remove node %s from the database\", name)\n\n\treturn c.Transaction(context.TODO(), func(ctx context.Context, tx *db.ClusterTx) error {\n\t\t// Get the node (if it doesn't exists an error is returned).\n\t\tnode, err := tx.GetNodeByName(ctx, name)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Failed to get member %q: %w\", name, err)\n\t\t}\n\n\t\terr = tx.ClearNode(ctx, node.ID)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Failed to clear member %q: %w\", name, err)\n\t\t}\n\n\t\terr = tx.RemoveNode(node.ID)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Failed to remove member %q: %w\", name, err)\n\t\t}\n\n\t\terr = cluster.DeleteCertificates(context.Background(), tx.Tx(), name, cluster.CertificateTypeServer)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Failed to remove member %q certificate from trust store: %w\", name, err)\n\t\t}\n\n\t\treturn nil\n\t})\n}", "title": "" }, { "docid": "5598e0bbba962f899c9349d0a78a1ad7", "score": "0.47906455", "text": "func (m *MockupOrganizationProvider) DeleteCluster(organizationID string, clusterID string) derrors.Error {\n\tm.Lock()\n\tdefer m.Unlock()\n\tif m.unsafeExistsCluster(organizationID, clusterID) {\n\t\tprevious := m.clusters[organizationID]\n\t\tnewList := make([]string, 0, len(previous)-1)\n\t\tfor _, id := range previous {\n\t\t\tif id != clusterID {\n\t\t\t\tnewList = append(newList, id)\n\t\t\t}\n\t\t}\n\t\tm.clusters[organizationID] = newList\n\t\treturn nil\n\t}\n\treturn derrors.NewNotFoundError(\"cluster\").WithParams(organizationID, clusterID)\n}", "title": "" }, { "docid": "9b3534d4e0f4393b73422226b8b20439", "score": "0.4781073", "text": "func (db *db) DeleteCluster(ctx context.Context, server string) error {\n\tsecret, err := db.getClusterSecret(server)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = db.deleteSecret(ctx, secret)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn db.settingsMgr.ResyncInformers()\n}", "title": "" } ]
42959a756d26fc6f455cfc8f01709483
ReceivedPrePolicy returns from NetworkInstance_Protocol_Bgp_Neighbor_AfiSafi_Prefixes the path struct for its child "receivedprepolicy".
[ { "docid": "8b71c31ae063ae4ab2104ccd7777216b", "score": "0.7820675", "text": "func (n *NetworkInstance_Protocol_Bgp_Neighbor_AfiSafi_Prefixes) ReceivedPrePolicy() *NetworkInstance_Protocol_Bgp_Neighbor_AfiSafi_Prefixes_ReceivedPrePolicy {\n\treturn &NetworkInstance_Protocol_Bgp_Neighbor_AfiSafi_Prefixes_ReceivedPrePolicy{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"received-pre-policy\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" } ]
[ { "docid": "7de70483d6c547145c0c3a974f4ba63e", "score": "0.7679354", "text": "func (n *NetworkInstance_Protocol_Bgp_Neighbor_AfiSafi_PrefixesAny) ReceivedPrePolicy() *NetworkInstance_Protocol_Bgp_Neighbor_AfiSafi_Prefixes_ReceivedPrePolicyAny {\n\treturn &NetworkInstance_Protocol_Bgp_Neighbor_AfiSafi_Prefixes_ReceivedPrePolicyAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"received-pre-policy\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "e904c41cddbe9a893444958641a2a257", "score": "0.75214964", "text": "func (n *Bgp_Neighbor_AfiSafi_Prefixes) ReceivedPrePolicy() *Bgp_Neighbor_AfiSafi_Prefixes_ReceivedPrePolicy {\n\treturn &Bgp_Neighbor_AfiSafi_Prefixes_ReceivedPrePolicy{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"received-pre-policy\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "e904c41cddbe9a893444958641a2a257", "score": "0.75206757", "text": "func (n *Bgp_Neighbor_AfiSafi_Prefixes) ReceivedPrePolicy() *Bgp_Neighbor_AfiSafi_Prefixes_ReceivedPrePolicy {\n\treturn &Bgp_Neighbor_AfiSafi_Prefixes_ReceivedPrePolicy{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"received-pre-policy\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "c7001bf94a7008e09d41b35b6515ad4a", "score": "0.7376452", "text": "func (n *Bgp_Neighbor_AfiSafi_PrefixesAny) ReceivedPrePolicy() *Bgp_Neighbor_AfiSafi_Prefixes_ReceivedPrePolicyAny {\n\treturn &Bgp_Neighbor_AfiSafi_Prefixes_ReceivedPrePolicyAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"received-pre-policy\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "1da05b5b0e72c332566c5e8df2755f2a", "score": "0.5922978", "text": "func (n *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibOutPre_RouteAny) Prefix() *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibOutPre_Route_PrefixAny {\n\treturn &NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibOutPre_Route_PrefixAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"prefix\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "bfbd40804974fdcd54b91b02320cd04d", "score": "0.5921841", "text": "func (n *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibOutPre_RouteAny) Prefix() *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibOutPre_Route_PrefixAny {\n\treturn &NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibOutPre_Route_PrefixAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"prefix\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "8b11ea43300580b2fdf2744aab0094ab", "score": "0.5880125", "text": "func (n *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibInPre_RouteAny) Prefix() *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibInPre_Route_PrefixAny {\n\treturn &NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibInPre_Route_PrefixAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"prefix\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "d5aabf61d34f6dade9c7e105a8dd5b47", "score": "0.58800286", "text": "func (n *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibInPre_RouteAny) Prefix() *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibInPre_Route_PrefixAny {\n\treturn &NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibInPre_Route_PrefixAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"prefix\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "b7df8f8c9952122693e518ab2cf413cd", "score": "0.57958657", "text": "func (n *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibInPre_Route) Prefix() *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibInPre_Route_Prefix {\n\treturn &NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibInPre_Route_Prefix{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"prefix\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "b7df8f8c9952122693e518ab2cf413cd", "score": "0.5794305", "text": "func (n *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibInPre_Route) Prefix() *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibInPre_Route_Prefix {\n\treturn &NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibInPre_Route_Prefix{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"prefix\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "9a5e8fdae5572ef355d17f1d09d2ef44", "score": "0.5781768", "text": "func (n *Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibOutPre_RouteAny) Prefix() *Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibOutPre_Route_PrefixAny {\n\treturn &Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibOutPre_Route_PrefixAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"prefix\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "c3246cdb2b93e5a2d38c150f4333f89e", "score": "0.57795304", "text": "func (n *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibInPre_Route) Prefix() *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibInPre_Route_Prefix {\n\treturn &NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibInPre_Route_Prefix{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"prefix\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "c3246cdb2b93e5a2d38c150f4333f89e", "score": "0.5779355", "text": "func (n *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibInPre_Route) Prefix() *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibInPre_Route_Prefix {\n\treturn &NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibInPre_Route_Prefix{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"prefix\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "8fc7e579a03a9a8ec1a7a03e7e1aa217", "score": "0.5772095", "text": "func (n *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibOutPre_Route) Prefix() *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibOutPre_Route_Prefix {\n\treturn &NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibOutPre_Route_Prefix{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"prefix\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "8fc7e579a03a9a8ec1a7a03e7e1aa217", "score": "0.57695526", "text": "func (n *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibOutPre_Route) Prefix() *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibOutPre_Route_Prefix {\n\treturn &NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibOutPre_Route_Prefix{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"prefix\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "b74b8266bf973570a1991bcc5fd36877", "score": "0.57683396", "text": "func (n *Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibOutPre_RouteAny) Prefix() *Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibOutPre_Route_PrefixAny {\n\treturn &Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibOutPre_Route_PrefixAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"prefix\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "7006e3b713f0eaeb02233ecadb441206", "score": "0.575625", "text": "func (n *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibOutPre_Route) Prefix() *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibOutPre_Route_Prefix {\n\treturn &NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibOutPre_Route_Prefix{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"prefix\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "7006e3b713f0eaeb02233ecadb441206", "score": "0.5755726", "text": "func (n *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibOutPre_Route) Prefix() *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibOutPre_Route_Prefix {\n\treturn &NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibOutPre_Route_Prefix{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"prefix\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "751aa34d07b2d132ca9562f71a64eb19", "score": "0.5729189", "text": "func (n *Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibInPre_RouteAny) Prefix() *Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibInPre_Route_PrefixAny {\n\treturn &Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibInPre_Route_PrefixAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"prefix\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "b46444573ea4ee960ab583dcabba48aa", "score": "0.57181954", "text": "func (n *Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibInPre_RouteAny) Prefix() *Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibInPre_Route_PrefixAny {\n\treturn &Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibInPre_Route_PrefixAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"prefix\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "6014478d75f215aa0c619d51bb433303", "score": "0.56874514", "text": "func (n *NetworkInstance_Protocol_Bgp_Neighbor_AfiSafi_AddPaths) EligiblePrefixPolicy() *NetworkInstance_Protocol_Bgp_Neighbor_AfiSafi_AddPaths_EligiblePrefixPolicy {\n\treturn &NetworkInstance_Protocol_Bgp_Neighbor_AfiSafi_AddPaths_EligiblePrefixPolicy{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"eligible-prefix-policy\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "6014478d75f215aa0c619d51bb433303", "score": "0.5686312", "text": "func (n *NetworkInstance_Protocol_Bgp_Neighbor_AfiSafi_AddPaths) EligiblePrefixPolicy() *NetworkInstance_Protocol_Bgp_Neighbor_AfiSafi_AddPaths_EligiblePrefixPolicy {\n\treturn &NetworkInstance_Protocol_Bgp_Neighbor_AfiSafi_AddPaths_EligiblePrefixPolicy{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"eligible-prefix-policy\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "dc380a9f978e52a27807d44e62a22272", "score": "0.56387997", "text": "func (n *Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibInPre_Route) Prefix() *Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibInPre_Route_Prefix {\n\treturn &Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibInPre_Route_Prefix{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"prefix\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "dc380a9f978e52a27807d44e62a22272", "score": "0.563758", "text": "func (n *Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibInPre_Route) Prefix() *Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibInPre_Route_Prefix {\n\treturn &Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibInPre_Route_Prefix{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"prefix\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "32f2bd3b90036b7e86f3f9c9b51e7e7f", "score": "0.5630615", "text": "func (n *Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibOutPre_Route) Prefix() *Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibOutPre_Route_Prefix {\n\treturn &Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibOutPre_Route_Prefix{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"prefix\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "32f2bd3b90036b7e86f3f9c9b51e7e7f", "score": "0.56289244", "text": "func (n *Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibOutPre_Route) Prefix() *Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibOutPre_Route_Prefix {\n\treturn &Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibOutPre_Route_Prefix{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"prefix\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "4c4ffb660868e10692d5d70365ffc2ba", "score": "0.560612", "text": "func (n *Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibInPre_Route) Prefix() *Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibInPre_Route_Prefix {\n\treturn &Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibInPre_Route_Prefix{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"prefix\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "4c4ffb660868e10692d5d70365ffc2ba", "score": "0.5605669", "text": "func (n *Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibInPre_Route) Prefix() *Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibInPre_Route_Prefix {\n\treturn &Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibInPre_Route_Prefix{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"prefix\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "ee870f3dd3e03f2ab5f022a6b05661a5", "score": "0.56014675", "text": "func (n *NetworkInstance_Protocol_Bgp_Global_AfiSafi_AddPaths) EligiblePrefixPolicy() *NetworkInstance_Protocol_Bgp_Global_AfiSafi_AddPaths_EligiblePrefixPolicy {\n\treturn &NetworkInstance_Protocol_Bgp_Global_AfiSafi_AddPaths_EligiblePrefixPolicy{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"eligible-prefix-policy\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "1d73f0aebe3c37efc15620192070bb46", "score": "0.5601099", "text": "func (n *Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibOutPre_Route) Prefix() *Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibOutPre_Route_Prefix {\n\treturn &Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibOutPre_Route_Prefix{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"prefix\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "ee870f3dd3e03f2ab5f022a6b05661a5", "score": "0.56002194", "text": "func (n *NetworkInstance_Protocol_Bgp_Global_AfiSafi_AddPaths) EligiblePrefixPolicy() *NetworkInstance_Protocol_Bgp_Global_AfiSafi_AddPaths_EligiblePrefixPolicy {\n\treturn &NetworkInstance_Protocol_Bgp_Global_AfiSafi_AddPaths_EligiblePrefixPolicy{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"eligible-prefix-policy\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "1d73f0aebe3c37efc15620192070bb46", "score": "0.55998355", "text": "func (n *Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibOutPre_Route) Prefix() *Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibOutPre_Route_Prefix {\n\treturn &Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibOutPre_Route_Prefix{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"prefix\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "06722d1fba77c07335483c7603051cce", "score": "0.55733836", "text": "func (n *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibInPost_RouteAny) Prefix() *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibInPost_Route_PrefixAny {\n\treturn &NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibInPost_Route_PrefixAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"prefix\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "7055c1615d1a0810d58f2d2189040ee9", "score": "0.55651355", "text": "func (n *NetworkInstance_Protocol_Bgp_PeerGroup_AfiSafi_AddPaths) EligiblePrefixPolicy() *NetworkInstance_Protocol_Bgp_PeerGroup_AfiSafi_AddPaths_EligiblePrefixPolicy {\n\treturn &NetworkInstance_Protocol_Bgp_PeerGroup_AfiSafi_AddPaths_EligiblePrefixPolicy{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"eligible-prefix-policy\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "7055c1615d1a0810d58f2d2189040ee9", "score": "0.556159", "text": "func (n *NetworkInstance_Protocol_Bgp_PeerGroup_AfiSafi_AddPaths) EligiblePrefixPolicy() *NetworkInstance_Protocol_Bgp_PeerGroup_AfiSafi_AddPaths_EligiblePrefixPolicy {\n\treturn &NetworkInstance_Protocol_Bgp_PeerGroup_AfiSafi_AddPaths_EligiblePrefixPolicy{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"eligible-prefix-policy\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "43562f7dfa6ab246689e3382713d36bf", "score": "0.5560843", "text": "func (n *Bgp_Neighbor_AfiSafi_AddPaths) EligiblePrefixPolicy() *Bgp_Neighbor_AfiSafi_AddPaths_EligiblePrefixPolicy {\n\treturn &Bgp_Neighbor_AfiSafi_AddPaths_EligiblePrefixPolicy{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"eligible-prefix-policy\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "43562f7dfa6ab246689e3382713d36bf", "score": "0.555903", "text": "func (n *Bgp_Neighbor_AfiSafi_AddPaths) EligiblePrefixPolicy() *Bgp_Neighbor_AfiSafi_AddPaths_EligiblePrefixPolicy {\n\treturn &Bgp_Neighbor_AfiSafi_AddPaths_EligiblePrefixPolicy{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"eligible-prefix-policy\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "e9a60d441259efa971f2df81aad31a1f", "score": "0.5550568", "text": "func (n *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibInPost_RouteAny) Prefix() *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibInPost_Route_PrefixAny {\n\treturn &NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibInPost_Route_PrefixAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"prefix\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "b335e274fcd2b3c72ba791cb7c1eacf0", "score": "0.5534511", "text": "func (n *NetworkInstance_Protocol_Bgp_Neighbor_AfiSafi_Prefixes) Received() *NetworkInstance_Protocol_Bgp_Neighbor_AfiSafi_Prefixes_Received {\n\treturn &NetworkInstance_Protocol_Bgp_Neighbor_AfiSafi_Prefixes_Received{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"received\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "b335e274fcd2b3c72ba791cb7c1eacf0", "score": "0.5534332", "text": "func (n *NetworkInstance_Protocol_Bgp_Neighbor_AfiSafi_Prefixes) Received() *NetworkInstance_Protocol_Bgp_Neighbor_AfiSafi_Prefixes_Received {\n\treturn &NetworkInstance_Protocol_Bgp_Neighbor_AfiSafi_Prefixes_Received{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"received\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "9977746cf1374d797b6324d150892280", "score": "0.5519161", "text": "func (n *Bgp_PeerGroup_AfiSafi_AddPaths) EligiblePrefixPolicy() *Bgp_PeerGroup_AfiSafi_AddPaths_EligiblePrefixPolicy {\n\treturn &Bgp_PeerGroup_AfiSafi_AddPaths_EligiblePrefixPolicy{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"eligible-prefix-policy\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "9977746cf1374d797b6324d150892280", "score": "0.55190945", "text": "func (n *Bgp_PeerGroup_AfiSafi_AddPaths) EligiblePrefixPolicy() *Bgp_PeerGroup_AfiSafi_AddPaths_EligiblePrefixPolicy {\n\treturn &Bgp_PeerGroup_AfiSafi_AddPaths_EligiblePrefixPolicy{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"eligible-prefix-policy\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "e27c2a41cea307ea5e11994b711045c3", "score": "0.55116373", "text": "func (n *Bgp_Global_AfiSafi_AddPaths) EligiblePrefixPolicy() *Bgp_Global_AfiSafi_AddPaths_EligiblePrefixPolicy {\n\treturn &Bgp_Global_AfiSafi_AddPaths_EligiblePrefixPolicy{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"eligible-prefix-policy\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "e27c2a41cea307ea5e11994b711045c3", "score": "0.5511157", "text": "func (n *Bgp_Global_AfiSafi_AddPaths) EligiblePrefixPolicy() *Bgp_Global_AfiSafi_AddPaths_EligiblePrefixPolicy {\n\treturn &Bgp_Global_AfiSafi_AddPaths_EligiblePrefixPolicy{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"eligible-prefix-policy\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "2c4d1699e9e49bc3d8b478a8dbdcecc6", "score": "0.5463308", "text": "func (n *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv4SrtePolicy_Neighbor_AdjRibInPre) RouteAny() *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv4SrtePolicy_Neighbor_AdjRibInPre_RouteAny {\n\treturn &NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv4SrtePolicy_Neighbor_AdjRibInPre_RouteAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"routes\", \"route\"},\n\t\t\tmap[string]interface{}{\"path-id\": \"*\", \"endpoint\": \"*\", \"color\": \"*\"},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "3ed1d37080e618730c24f238c4e9cc18", "score": "0.54604197", "text": "func (n *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6SrtePolicy_Neighbor_AdjRibInPre) RouteAny() *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6SrtePolicy_Neighbor_AdjRibInPre_RouteAny {\n\treturn &NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6SrtePolicy_Neighbor_AdjRibInPre_RouteAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"routes\", \"route\"},\n\t\t\tmap[string]interface{}{\"path-id\": \"*\", \"endpoint\": \"*\", \"color\": \"*\"},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "e937b2dd43a53ed13f4938a587b637cc", "score": "0.5459225", "text": "func (n *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibInPre) RouteAny() *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibInPre_RouteAny {\n\treturn &NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibInPre_RouteAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"routes\", \"route\"},\n\t\t\tmap[string]interface{}{\"prefix\": \"*\", \"path-id\": \"*\"},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "d9101c325452cee0382ce5eeb8a484ba", "score": "0.54520774", "text": "func (n *NetworkInstance_Protocol_Bgp_Neighbor_AfiSafi_AddPathsAny) EligiblePrefixPolicy() *NetworkInstance_Protocol_Bgp_Neighbor_AfiSafi_AddPaths_EligiblePrefixPolicyAny {\n\treturn &NetworkInstance_Protocol_Bgp_Neighbor_AfiSafi_AddPaths_EligiblePrefixPolicyAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"eligible-prefix-policy\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "db7ddfc8b42c69513b278f3843f140a1", "score": "0.5449804", "text": "func (n *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibInPre) RouteAny() *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibInPre_RouteAny {\n\treturn &NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibInPre_RouteAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"routes\", \"route\"},\n\t\t\tmap[string]interface{}{\"prefix\": \"*\", \"path-id\": \"*\"},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "e9c7260e45398ba3849937e52b013fb3", "score": "0.54352266", "text": "func (n *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibInPost_Route) Prefix() *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibInPost_Route_Prefix {\n\treturn &NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibInPost_Route_Prefix{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"prefix\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "e9c7260e45398ba3849937e52b013fb3", "score": "0.543518", "text": "func (n *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibInPost_Route) Prefix() *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibInPost_Route_Prefix {\n\treturn &NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibInPost_Route_Prefix{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"prefix\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "4e5e9970f0df8dac2e12771071b6fffb", "score": "0.54207903", "text": "func (o *ChassisConfigImport) GetPolicyPrefix() string {\n\tif o == nil || o.PolicyPrefix == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.PolicyPrefix\n}", "title": "" }, { "docid": "a1921c77da22804d9de6d6cca3010f90", "score": "0.54019177", "text": "func (n *Bgp_Neighbor_AfiSafi_AddPathsAny) EligiblePrefixPolicy() *Bgp_Neighbor_AfiSafi_AddPaths_EligiblePrefixPolicyAny {\n\treturn &Bgp_Neighbor_AfiSafi_AddPaths_EligiblePrefixPolicyAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"eligible-prefix-policy\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "eae7bda29c04ee7dae69dd8ae8f89882", "score": "0.5397751", "text": "func (n *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibOutPost_RouteAny) Prefix() *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibOutPost_Route_PrefixAny {\n\treturn &NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibOutPost_Route_PrefixAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"prefix\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "8fb36267d01aaceb95a11fbcfd8422e2", "score": "0.5388917", "text": "func (n *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_LocRib_RouteAny) Prefix() *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_LocRib_Route_PrefixAny {\n\treturn &NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_LocRib_Route_PrefixAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"prefix\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "7a1f9fdb2b4a36844f623e40cbea2dad", "score": "0.5386912", "text": "func (n *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibInPost_Route) Prefix() *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibInPost_Route_Prefix {\n\treturn &NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibInPost_Route_Prefix{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"prefix\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "7a1f9fdb2b4a36844f623e40cbea2dad", "score": "0.53865606", "text": "func (n *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibInPost_Route) Prefix() *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibInPost_Route_Prefix {\n\treturn &NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibInPost_Route_Prefix{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"prefix\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "25270a27251d7890ae3d215252ded090", "score": "0.53804934", "text": "func (n *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibInPreAny) RouteAnyPrefix(PathId uint32) *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibInPre_RouteAny {\n\treturn &NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibInPre_RouteAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"routes\", \"route\"},\n\t\t\tmap[string]interface{}{\"prefix\": \"*\", \"path-id\": PathId},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "74f5bba627220ba49fd344accbc5b625", "score": "0.5379639", "text": "func (n *Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibInPost_RouteAny) Prefix() *Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibInPost_Route_PrefixAny {\n\treturn &Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibInPost_Route_PrefixAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"prefix\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "f959956a2f7e4e97852489420671a7bb", "score": "0.53781295", "text": "func (n *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibOutPost_RouteAny) Prefix() *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibOutPost_Route_PrefixAny {\n\treturn &NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibOutPost_Route_PrefixAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"prefix\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "200b46fde67eab52036e8468663749a6", "score": "0.53773093", "text": "func (n *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibInPreAny) RouteAnyPrefix(PathId uint32) *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibInPre_RouteAny {\n\treturn &NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibInPre_RouteAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"routes\", \"route\"},\n\t\t\tmap[string]interface{}{\"prefix\": \"*\", \"path-id\": PathId},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "9f487160d5fd941521bb8a5969d54c75", "score": "0.53760415", "text": "func (n *NetworkInstance_Protocol_Bgp_Global_AfiSafi_AddPathsAny) EligiblePrefixPolicy() *NetworkInstance_Protocol_Bgp_Global_AfiSafi_AddPaths_EligiblePrefixPolicyAny {\n\treturn &NetworkInstance_Protocol_Bgp_Global_AfiSafi_AddPaths_EligiblePrefixPolicyAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"eligible-prefix-policy\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "b5c444aab11e3f6dbbaed0934072b2b3", "score": "0.5372793", "text": "func (n *Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibInPreAny) RouteAnyPrefix(PathId uint32) *Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibInPre_RouteAny {\n\treturn &Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibInPre_RouteAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"routes\", \"route\"},\n\t\t\tmap[string]interface{}{\"prefix\": \"*\", \"path-id\": PathId},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "3612951eef7116f660fda41524013ebb", "score": "0.53651863", "text": "func (n *Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibInPreAny) RouteAnyPrefix(PathId uint32) *Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibInPre_RouteAny {\n\treturn &Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibInPre_RouteAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"routes\", \"route\"},\n\t\t\tmap[string]interface{}{\"prefix\": \"*\", \"path-id\": PathId},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "8d2e428942be76c10d5137999b73260d", "score": "0.5363466", "text": "func (n *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv4Unicast_LocRib_RouteAny) Prefix() *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv4Unicast_LocRib_Route_PrefixAny {\n\treturn &NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv4Unicast_LocRib_Route_PrefixAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"prefix\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "85446dd062587c35ef2edc7f85326100", "score": "0.53498447", "text": "func (n *Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibInPost_RouteAny) Prefix() *Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibInPost_Route_PrefixAny {\n\treturn &Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibInPost_Route_PrefixAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"prefix\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "2b80509e85222d1e04d5d476424932c1", "score": "0.53436065", "text": "func (n *Bgp_Global_AfiSafi_AddPathsAny) EligiblePrefixPolicy() *Bgp_Global_AfiSafi_AddPaths_EligiblePrefixPolicyAny {\n\treturn &Bgp_Global_AfiSafi_AddPaths_EligiblePrefixPolicyAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"eligible-prefix-policy\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "d4d6f7f0d7bc900d6f49328ef17198c0", "score": "0.5341678", "text": "func (n *Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibOutPreAny) RouteAnyPrefix(PathId uint32) *Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibOutPre_RouteAny {\n\treturn &Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibOutPre_RouteAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"routes\", \"route\"},\n\t\t\tmap[string]interface{}{\"prefix\": \"*\", \"path-id\": PathId},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "675d76b9fdd6f18cc0903c1b6c17f77d", "score": "0.5333779", "text": "func (n *Bgp_PeerGroup_AfiSafi_AddPathsAny) EligiblePrefixPolicy() *Bgp_PeerGroup_AfiSafi_AddPaths_EligiblePrefixPolicyAny {\n\treturn &Bgp_PeerGroup_AfiSafi_AddPaths_EligiblePrefixPolicyAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"eligible-prefix-policy\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "b81e74fd3fce454e7e1bade0fa538f96", "score": "0.5331739", "text": "func (n *NetworkInstance_Protocol_Bgp_PeerGroup_AfiSafi_AddPathsAny) EligiblePrefixPolicy() *NetworkInstance_Protocol_Bgp_PeerGroup_AfiSafi_AddPaths_EligiblePrefixPolicyAny {\n\treturn &NetworkInstance_Protocol_Bgp_PeerGroup_AfiSafi_AddPaths_EligiblePrefixPolicyAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"eligible-prefix-policy\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "8db2ffddf169a99b002b518a43de4b43", "score": "0.532856", "text": "func (n *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibOutPreAny) RouteAnyPrefix(PathId uint32) *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibOutPre_RouteAny {\n\treturn &NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibOutPre_RouteAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"routes\", \"route\"},\n\t\t\tmap[string]interface{}{\"prefix\": \"*\", \"path-id\": PathId},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "2f27f6d7f3314978053485b14eb1e837", "score": "0.53280246", "text": "func (n *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibOutPreAny) RouteAnyPrefix(PathId uint32) *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibOutPre_RouteAny {\n\treturn &NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibOutPre_RouteAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"routes\", \"route\"},\n\t\t\tmap[string]interface{}{\"prefix\": \"*\", \"path-id\": PathId},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "37e315cc517454390f3dde7e7499d9b4", "score": "0.5326685", "text": "func (n *Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibOutPreAny) RouteAnyPrefix(PathId uint32) *Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibOutPre_RouteAny {\n\treturn &Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibOutPre_RouteAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"routes\", \"route\"},\n\t\t\tmap[string]interface{}{\"prefix\": \"*\", \"path-id\": PathId},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "2b88ff4382e94a150809365c2dc2242c", "score": "0.5302114", "text": "func (n *Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibInPre) RouteAny() *Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibInPre_RouteAny {\n\treturn &Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibInPre_RouteAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"routes\", \"route\"},\n\t\t\tmap[string]interface{}{\"prefix\": \"*\", \"path-id\": \"*\"},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "d901e719e0776cf527778cfd5b579989", "score": "0.52969694", "text": "func (n *Bgp_Rib_AfiSafi_Ipv6SrtePolicy_Neighbor_AdjRibInPre) RouteAny() *Bgp_Rib_AfiSafi_Ipv6SrtePolicy_Neighbor_AdjRibInPre_RouteAny {\n\treturn &Bgp_Rib_AfiSafi_Ipv6SrtePolicy_Neighbor_AdjRibInPre_RouteAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"routes\", \"route\"},\n\t\t\tmap[string]interface{}{\"path-id\": \"*\", \"endpoint\": \"*\", \"color\": \"*\"},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "1ca3e4a0d4ab4a723b242d6f1ac070ec", "score": "0.52964956", "text": "func (n *Bgp_Rib_AfiSafi_Ipv4SrtePolicy_Neighbor_AdjRibInPre) RouteAny() *Bgp_Rib_AfiSafi_Ipv4SrtePolicy_Neighbor_AdjRibInPre_RouteAny {\n\treturn &Bgp_Rib_AfiSafi_Ipv4SrtePolicy_Neighbor_AdjRibInPre_RouteAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"routes\", \"route\"},\n\t\t\tmap[string]interface{}{\"path-id\": \"*\", \"endpoint\": \"*\", \"color\": \"*\"},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "5d7668f955cfed2332f6800327a7117f", "score": "0.52887297", "text": "func (n *Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibInPre) RouteAny() *Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibInPre_RouteAny {\n\treturn &Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibInPre_RouteAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"routes\", \"route\"},\n\t\t\tmap[string]interface{}{\"prefix\": \"*\", \"path-id\": \"*\"},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "a95023d93fd166abb61332abf8b02bc1", "score": "0.527656", "text": "func (n *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibInPre) RouteAnyPrefix(PathId uint32) *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibInPre_RouteAny {\n\treturn &NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibInPre_RouteAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"routes\", \"route\"},\n\t\t\tmap[string]interface{}{\"prefix\": \"*\", \"path-id\": PathId},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "4a876ddc8c5b26aac16326d77a08b0c2", "score": "0.5271576", "text": "func (n *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibInPre) RouteAnyPrefix(PathId uint32) *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibInPre_RouteAny {\n\treturn &NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibInPre_RouteAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"routes\", \"route\"},\n\t\t\tmap[string]interface{}{\"prefix\": \"*\", \"path-id\": PathId},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "2bd21f064b03b208649fe87078a54514", "score": "0.526436", "text": "func (n *Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibOutPre) RouteAnyPrefix(PathId uint32) *Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibOutPre_RouteAny {\n\treturn &Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibOutPre_RouteAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"routes\", \"route\"},\n\t\t\tmap[string]interface{}{\"prefix\": \"*\", \"path-id\": PathId},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "012ff5832b32fdb71e29e61ad1c7c537", "score": "0.52637166", "text": "func (n *Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibInPre) RouteAnyPrefix(PathId uint32) *Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibInPre_RouteAny {\n\treturn &Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibInPre_RouteAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"routes\", \"route\"},\n\t\t\tmap[string]interface{}{\"prefix\": \"*\", \"path-id\": PathId},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "3c46bd6e8ae20e23cfc7ddbb7fcd12e6", "score": "0.52499473", "text": "func (n *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibOutPre) RouteAnyPrefix(PathId uint32) *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibOutPre_RouteAny {\n\treturn &NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibOutPre_RouteAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"routes\", \"route\"},\n\t\t\tmap[string]interface{}{\"prefix\": \"*\", \"path-id\": PathId},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "f202b2ef6b7843023f99665bec8f1737", "score": "0.52437454", "text": "func (n *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibOutPre) RouteAnyPrefix(PathId uint32) *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibOutPre_RouteAny {\n\treturn &NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibOutPre_RouteAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"routes\", \"route\"},\n\t\t\tmap[string]interface{}{\"prefix\": \"*\", \"path-id\": PathId},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "5d8f7ebfc163e8167fa65ba6b426c5c6", "score": "0.5243627", "text": "func (n *Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibInPre) RouteAnyPrefix(PathId uint32) *Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibInPre_RouteAny {\n\treturn &Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibInPre_RouteAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"routes\", \"route\"},\n\t\t\tmap[string]interface{}{\"prefix\": \"*\", \"path-id\": PathId},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "1352b52fc38a619d05eeb404ae855125", "score": "0.52391636", "text": "func (n *Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibInPost_Route) Prefix() *Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibInPost_Route_Prefix {\n\treturn &Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibInPost_Route_Prefix{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"prefix\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "4dba05d9161c58387deecc26b9dc0227", "score": "0.5238834", "text": "func (n *Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibOutPre) RouteAnyPrefix(PathId uint32) *Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibOutPre_RouteAny {\n\treturn &Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibOutPre_RouteAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"routes\", \"route\"},\n\t\t\tmap[string]interface{}{\"prefix\": \"*\", \"path-id\": PathId},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "1352b52fc38a619d05eeb404ae855125", "score": "0.5238757", "text": "func (n *Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibInPost_Route) Prefix() *Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibInPost_Route_Prefix {\n\treturn &Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibInPost_Route_Prefix{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"prefix\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "e8025ccf197919e7294b5d407d3fbd51", "score": "0.5211642", "text": "func (n *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_LocRib_Route) Prefix() *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_LocRib_Route_Prefix {\n\treturn &NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_LocRib_Route_Prefix{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"prefix\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "e8025ccf197919e7294b5d407d3fbd51", "score": "0.52099454", "text": "func (n *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_LocRib_Route) Prefix() *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_LocRib_Route_Prefix {\n\treturn &NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_LocRib_Route_Prefix{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"prefix\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "229848b6ad685c06cefa4930d024ec8c", "score": "0.52092916", "text": "func (n *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibOutPost_Route) Prefix() *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibOutPost_Route_Prefix {\n\treturn &NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibOutPost_Route_Prefix{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"prefix\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "229848b6ad685c06cefa4930d024ec8c", "score": "0.52089924", "text": "func (n *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibOutPost_Route) Prefix() *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibOutPost_Route_Prefix {\n\treturn &NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibOutPost_Route_Prefix{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"prefix\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "571ed7b2d4e5b5550ab62fa280da5714", "score": "0.52083653", "text": "func (n *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibOutPre) RouteAny() *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibOutPre_RouteAny {\n\treturn &NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibOutPre_RouteAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"routes\", \"route\"},\n\t\t\tmap[string]interface{}{\"prefix\": \"*\", \"path-id\": \"*\"},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "da589e1523f71c1a97fd73ab27e3136a", "score": "0.52037644", "text": "func (n *Bgp_Rib_AfiSafi_Ipv6Unicast_LocRib_RouteAny) Prefix() *Bgp_Rib_AfiSafi_Ipv6Unicast_LocRib_Route_PrefixAny {\n\treturn &Bgp_Rib_AfiSafi_Ipv6Unicast_LocRib_Route_PrefixAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"prefix\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "ee66934748d60eadb33ef718585f2469", "score": "0.52030295", "text": "func (n *Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibOutPost_RouteAny) Prefix() *Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibOutPost_Route_PrefixAny {\n\treturn &Bgp_Rib_AfiSafi_Ipv6Unicast_Neighbor_AdjRibOutPost_Route_PrefixAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"prefix\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "b20614658651b48646b2a785f91fce60", "score": "0.5196399", "text": "func (n *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibOutPre) RouteAny() *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibOutPre_RouteAny {\n\treturn &NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibOutPre_RouteAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"routes\", \"route\"},\n\t\t\tmap[string]interface{}{\"prefix\": \"*\", \"path-id\": \"*\"},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "38cacd64b35d38014336d262544d8543", "score": "0.519538", "text": "func (n *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6SrtePolicy_Neighbor_AdjRibOutPre) RouteAny() *NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6SrtePolicy_Neighbor_AdjRibOutPre_RouteAny {\n\treturn &NetworkInstance_Protocol_Bgp_Rib_AfiSafi_Ipv6SrtePolicy_Neighbor_AdjRibOutPre_RouteAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"routes\", \"route\"},\n\t\t\tmap[string]interface{}{\"path-id\": \"*\", \"endpoint\": \"*\", \"color\": \"*\"},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "722a01257671b58b9e7ecf8ed4c8dfdd", "score": "0.51951087", "text": "func (n *Bgp_Rib_AfiSafi_Ipv6SrtePolicy_Neighbor_AdjRibOutPre) RouteAny() *Bgp_Rib_AfiSafi_Ipv6SrtePolicy_Neighbor_AdjRibOutPre_RouteAny {\n\treturn &Bgp_Rib_AfiSafi_Ipv6SrtePolicy_Neighbor_AdjRibOutPre_RouteAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"routes\", \"route\"},\n\t\t\tmap[string]interface{}{\"path-id\": \"*\", \"endpoint\": \"*\", \"color\": \"*\"},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "11c5001740fd0375e612ccdf7f864e6e", "score": "0.51852715", "text": "func (n *Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibInPost_Route) Prefix() *Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibInPost_Route_Prefix {\n\treturn &Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibInPost_Route_Prefix{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"prefix\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "11c5001740fd0375e612ccdf7f864e6e", "score": "0.51851684", "text": "func (n *Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibInPost_Route) Prefix() *Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibInPost_Route_Prefix {\n\treturn &Bgp_Rib_AfiSafi_Ipv4Unicast_Neighbor_AdjRibInPost_Route_Prefix{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"prefix\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" } ]
07133a9d0e6a42fc39dac666856cb8be
GetAllPosts returns a slice of all posts
[ { "docid": "5041eda89fa15b92858301aa39aaddd8", "score": "0.7057553", "text": "func (s *Storage) GetAllPosts() []listing.Post {\n\tlist := []listing.Post{}\n\n\trecords, err := s.db.ReadAll(CollectionPost)\n\tif err != nil {\n\t\t// err handling omitted for simplicity\n\t\treturn list\n\t}\n\n\tfor _, r := range records {\n\t\tvar p Post\n\t\tvar post listing.Post\n\n\t\tif err := json.Unmarshal([]byte(r), &p); err != nil {\n\t\t\t// err handling omitted for simplicity\n\t\t\treturn list\n\t\t}\n\n\t\tpost.ID = p.ID\n\t\tpost.Body = p.Body\n\t\tpost.Created = p.Created\n\n\t\tlist = append(list, post)\n\t}\n\n\treturn list\n}", "title": "" } ]
[ { "docid": "2ceb744d46e4dd06fad062702aabab47", "score": "0.7911163", "text": "func GetAllPosts() []Post {\n\treturn posts\n}", "title": "" }, { "docid": "f9615061403d167f4cecc3f775ded656", "score": "0.76702565", "text": "func GetAllPosts(limit int) (allposts []Post, err error) { // NO LIMIT BECAUSE SMALL SCALE\r\n\tpost := Post{}\r\n\tif limit == 0 {\r\n\t\tlimit = GetPostCount()\r\n\t}\r\n\r\n\trows, err := db.Query(\"select id, created, title, content from posts limit ?\", limit) // selects part of db\r\n\tif err != nil {\r\n\t\tlog.Fatal(err)\r\n\t}\r\n\tdefer rows.Close() // IMPORTANT\r\n\r\n\tfor rows.Next() {\r\n\t\terr := rows.Scan(&post.Id, &post.Created, &post.Title, &post.Content) // scans, if err, err variable will change\r\n\t\tif err != nil { // else rows will be modified by scan\r\n\t\t\tlog.Fatal(err)\r\n\t\t}\r\n\t\tallposts = append(allposts, post)\r\n\t}\r\n\terr = rows.Err()\r\n\tif err != nil {\r\n\t\tlog.Fatal(err)\r\n\t}\r\n\t// fmt.Println(allposts[1].content)\r\n\treturn\r\n}", "title": "" }, { "docid": "57aadf5b759458030f353cc131998644", "score": "0.741832", "text": "func GetAllBlogPost() ([]*BlogPost, error) {}", "title": "" }, { "docid": "3c3d3658177855b3b464aef7e6137217", "score": "0.7242541", "text": "func (ps *PostService) GetPosts() ([]*model.Post, error) {\n\tres, err := model.MySqlDB.Query(\"SELECT * FROM posts\")\n\tutil.ChkErr(err)\n\n\tvar posts []*model.Post\n\tfor res.Next() {\n\t\tpost := &model.Post{}\n\t\tvar cDate, mDate string\n\t\terr = res.Scan(&post.Id, &post.Title, &post.Content, &cDate, &mDate)\n\t\tutil.ChkErr(err)\n\n\t\tloc, _ := time.LoadLocation(\"Asia/Shanghai\")\n\t\tpost.Create_at, err = time.ParseInLocation(\"2006-01-02 15:04:05\", cDate, loc)\n\t\tutil.ChkErr(err)\n\t\tpost.Modified_at, err = time.ParseInLocation(\"2006-01-02 15:04:05\", mDate, loc)\n\t\tutil.ChkErr(err)\n\n\t\tposts = append(posts, post)\n\t}\n\n\treturn posts, nil\n}", "title": "" }, { "docid": "7f0f44281813e4ed8068b9e6398ae489", "score": "0.7201085", "text": "func (m *MongoStorage) _GetPosts(mq models.MongoQuery, limit int, offset int, sort string, embedded []string, isFull bool) ([]models.Post, int, error) {\n\tvar posts []models.Post\n\n\tif globals.Conf.Environment != \"development\" {\n\t\tmq.State = \"published\"\n\t}\n\n\ttotal, err := m.GetDocuments(mq, limit, offset, sort, \"posts\", &posts)\n\n\tif err != nil {\n\t\treturn posts, 0, err\n\t}\n\n\tfor index := range posts {\n\t\tm.GetEmbeddedAsset(&posts[index], embedded)\n\t\tif isFull == false {\n\t\t\tposts[index].Content = nil\n\t\t}\n\n\t\tposts[index].Full = isFull\n\t}\n\n\treturn posts, total, nil\n}", "title": "" }, { "docid": "7de2eb937a0d55d48d718778fa4fbed5", "score": "0.7126086", "text": "func (b *Blog) GetAllPosts() []*Post {\n\tps := b.Posts\n\tsort.Sort(sort.Reverse(ByTime(ps)))\n\treturn ps\n}", "title": "" }, { "docid": "e108678bd7665f46e4b160a9be258bb1", "score": "0.71171147", "text": "func AllPosts(ctx context.Context, db *mongo.Database) ([]Post, error) {\r\n\tcol := db.Collection(collection)\r\n\toptions := options.Find()\r\n\toptions.SetLimit(20)\r\n\toptions.SetSort(bson.D{{\"_id\", -1}})\r\n\r\n\tcur, err := col.Find(ctx, bson.M{}, options)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\tposts := []Post{}\r\n\tif err := cur.All(ctx, &posts); err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\treturn posts, nil\r\n}", "title": "" }, { "docid": "0fd33f0dde07dc7cab5ed7e89584d3c2", "score": "0.70656586", "text": "func (bot *Bot) getAllPosts() ([]Post, error) {\n\tfbPosts := []fbPost{}\n\n\tsince := time.Date(top10Year, 1, 1, 0, 0, 0, 0, time.UTC)\n\tuntil := time.Date(top10Year, 12, 31, 23, 59, 59, 0, time.UTC)\n\n\tparams := url.Values{}\n\tparams.Add(\"date_format\", \"U\")\n\tparams.Add(\"fields\", \"id,created_time,message,permalink_url,reactions.limit(0).summary(1)\")\n\tparams.Add(\"limit\", postsPageSize)\n\tparams.Add(\"since\", strconv.FormatInt(since.Unix(), 10))\n\tparams.Add(\"until\", strconv.FormatInt(until.Unix(), 10))\n\n\tvar response postResponse\n\terr := bot.fbClient.Get(postsURL, params, &response)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfbPosts = append(fbPosts, response.Data...)\n\n\tfor response.Paging.Next != nil {\n\t\tfmt.Println(\"Fetching next page\")\n\t\t// Need to declare a fresh struct here so that Next will be nil if not in response\n\t\tvar tmpResponse postResponse\n\t\terr := bot.fbClient.GetAbsoluteURL(*response.Paging.Next, &tmpResponse)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tresponse = tmpResponse\n\n\t\tfbPosts = append(fbPosts, response.Data...)\n\t}\n\n\tfmt.Printf(\"\\nNumber of posts: %d\\n\\n\", len(fbPosts))\n\tposts := make([]Post, 0, len(fbPosts))\n\tfor _, fbPost := range fbPosts {\n\t\tposts = append(posts, fbPost.toPost())\n\t}\n\n\treturn posts, nil\n}", "title": "" }, { "docid": "079f84a44b5f9b608a61d3335bea49cc", "score": "0.70467895", "text": "func (p *Posts) All() ([]PostInterface, error) {\n\tvar err error = nil\n\tif p.parsedPosts == nil {\n\t\tr := struct {\n\t\t\tResponse struct {\n\t\t\t\tPosts []PostInterface `json:\"posts\"`\n\t\t\t} `json:\"response\"`\n\t\t}{}\n\t\tr.Response.Posts = makePostsFromMinis(p.Posts, p.client)\n\t\tif err = json.Unmarshal(p.response.body, &r); err != nil {\n\t\t\tp.parsedPosts = []PostInterface{}\n\t\t} else {\n\t\t\tp.parsedPosts = r.Response.Posts\n\t\t}\n\t}\n\treturn p.parsedPosts, err\n}", "title": "" }, { "docid": "ba8e6a909bd8ba4b5161118cf0e80552", "score": "0.7023272", "text": "func (db *DB) GetAllPosts() (posts []models.Post, err error) {\n\t// Prepare the query\n\tq := \"SELECT posts.slug, posts.user_id, users.name, posts.title, posts.body, posts.created, posts.modified FROM posts LEFT JOIN users ON posts.user_id = users.id ORDER BY datetime(created) DESC\"\n\trows, err := db.conn.Query(q)\n\tif err != nil {\n\t\t// Query preparation went wrong\n\t\treturn posts, err\n\t}\n\t// Make sure the rows iterator gets closed\n\tdefer rows.Close()\n\n\t// Loop over the received rows and store them in posts\n\tfor rows.Next() {\n\t\t// Initialize an empty post\n\t\tpost := models.Post{}\n\t\t// Fill the post through the row\n\t\tif err := rows.Scan(&post.Slug, &post.UserID, &post.Author, &post.Title, &post.Body, &post.Created, &post.Modified); err != nil {\n\t\t\treturn posts, err\n\t\t}\n\n\t\t// Append the post to posts (https://gobyexample.com/slices)\n\t\tposts = append(posts, post)\n\t}\n\n\treturn posts, err\n}", "title": "" }, { "docid": "cd47b9290e05a7181ff4f65deccd8331", "score": "0.69896376", "text": "func (api *API) GetAll(before int) (*PostList, error) {\n\tpath := fmt.Sprintf(\"/all?before=%d\", before)\n\treturn api.metaGet(&path)\n}", "title": "" }, { "docid": "38ef15fbb9a6c754f096d8576b3af941", "score": "0.6938869", "text": "func (d *DbConnection) GetAllPosts() ([]Post, error) {\n\t// Prepare query, takes a id argument, protects from sql injection\n\tstmt, err := d.Prepare(\"SELECT * FROM posts ORDER BY id DESC\")\n\tif err != nil {\n\t\tfmt.Println(\"GetAllPosts Preparation Err: \", err)\n\t}\n\n\t// Create Post struct for holding each row's data\n\tvar post Post\n\n\t// Slice to hold all of our posts we are getting back\n\tvar posts []Post\n\n\trows, err := stmt.Query()\n\n\tif err != nil {\n\t\tfmt.Println(\"Error scanning rows: \", err)\n\t}\n\n\tfor rows.Next() {\n\t\terr = rows.Scan(\n\t\t\t&post.ID,\n\t\t\t&post.Title,\n\t\t\t&post.Content,\n\t\t\t&post.Posted,\n\t\t)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Error scanning rows: \", err)\n\t\t}\n\t\tposts = append(posts, post)\n\t}\n\n\treturn posts, err\n}", "title": "" }, { "docid": "747d698db6952d571f558116ea5347a9", "score": "0.690634", "text": "func (conn *Connector) GetPosts(num int) *[]WpPost {\n\tvar result []WpPost\n\tconn.DB.Table(\"wp_posts\").Where(\" post_type like 'post'\").Order(\"ID desc\").Limit(num).Scan(&result)\n\treturn &result\n}", "title": "" }, { "docid": "46b5c201c204e73fa326448ae75f8d77", "score": "0.6842442", "text": "func (p PostController) GetPosts(ctx *gin.Context) {\n\tvar posts models.Post\n\n\tkeyword := ctx.Query(\"keyword\")\n\n\tdata, total, err := p.service.FindAll(posts, keyword)\n\n\tif err != nil {\n\t\tutil.ErrorJSON(ctx, http.StatusBadRequest, \"Failed to find questions\")\n\t\treturn\n\t}\n\trespArr := make([]map[string]interface{}, 0, 0)\n\n\tfor _, n := range *data {\n\t\tresp := n.ResponseMap()\n\t\trespArr = append(respArr, resp)\n\t}\n\n\tctx.JSON(http.StatusOK, &util.Response{\n\t\tSuccess: true,\n\t\tMessage: \"Post result set\",\n\t\tData: map[string]interface{}{\n\t\t\t\"rows\": respArr,\n\t\t\t\"total_rows\": total,\n\t\t}})\n}", "title": "" }, { "docid": "5e0254630538de62d682891d60256208", "score": "0.68390477", "text": "func (db *DB) AllPosts() ([]*models.Post, error) {\n\trows, err := db.Query(`\n\t\tSELECT posts.id,\n\t\t users.id,\n\t\t users.email,\n\t\t posts.body,\n\t\t posts.title,\n\t\t posts.created_at,\n\t\t posts.modified_at\n\t\tFROM posts\n\t\tLEFT JOIN users ON users.id = posts.user_id\n\t\tORDER BY posts.modified_at DESC\n\t`)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer rows.Close()\n\n\tvar posts []*models.Post\n\n\tfor rows.Next() {\n\t\tpost := models.Post{}\n\t\tif err := rows.Scan(&post.Id, &post.Author.Id, &post.Author.Email, &post.Body, &post.Title, &post.CreatedAt, &post.ModifiedAt); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tposts = append(posts, &post)\n\t}\n\n\treturn posts, nil\n}", "title": "" }, { "docid": "2007833551ac8a1c330a849903a2502f", "score": "0.682481", "text": "func (b *Blog) GetAllPosts() []*Post {\n\treturn b.getPostsWithDraft(true)\n}", "title": "" }, { "docid": "3d3d2d8e85d1c66f13b8e7e5ddc95061", "score": "0.6772027", "text": "func (k Keeper) GetPosts(ctx sdk.Context) (posts types.Posts) {\n\tposts = types.Posts{}\n\tk.IteratePosts(ctx, func(_ int64, post types.Post) (stop bool) {\n\t\tposts = append(posts, post)\n\t\treturn false\n\t})\n\n\treturn posts\n}", "title": "" }, { "docid": "7b8e085e1777552e6523af5e6b2590bf", "score": "0.671119", "text": "func (db *Database) GetPosts(ctx context.Context, collectionName string, size, skip int) ([]Post, error) {\n\tvar results []Post = make([]Post, 0)\n\n\t//Build query\n\tquery := db.Client.Collection(collectionName).OrderBy(\"date\", firestore.Desc)\n\n\t//Update\n\tif size != 0 && skip != 0 {\n\t\tquery = db.Client.Collection(collectionName).OrderBy(\"date\", firestore.Desc).Limit(size).Offset(skip)\n\t} else if size != 0 {\n\t\tquery = db.Client.Collection(collectionName).OrderBy(\"date\", firestore.Desc).Limit(size)\n\t} else if skip != 0 {\n\t\tquery = db.Client.Collection(collectionName).OrderBy(\"date\", firestore.Desc).Offset(skip)\n\t}\n\n\t//Call database to retrieve all posts\n\titer := query.Documents(ctx)\n\n\t//Iterate through the list of posts returned\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 results, err\n\t\t}\n\n\t\t//Decode the post and add to the list of results\n\t\tvar post Post\n\t\tdoc.DataTo(&post)\n\t\tpost.ID = doc.Ref.ID\n\n\t\tresults = append(results, post)\n\t}\n\n\treturn results, nil\n}", "title": "" }, { "docid": "8ead5ff926eac9b3fe2c57c644aae150", "score": "0.6703064", "text": "func (m *MongoStorage) GetFullPosts(mq models.MongoQuery, limit int, offset int, sort string, embedded []string) ([]models.Post, int, error) {\n\tif embedded == nil {\n\t\tembedded = []string{\"hero_image\", \"leading_image_portrait\", \"leading_video\", \"categories\", \"tags\", \"topic_full\", \"og_image\", \"writters\", \"photographers\", \"designers\", \"engineers\", \"relateds\", \"theme\"}\n\t}\n\n\treturn m._GetPosts(mq, limit, offset, sort, embedded, true)\n}", "title": "" }, { "docid": "467c0e5391c269275c9fd881226da1e5", "score": "0.6679849", "text": "func (api *API) _getPosts(netID gp.NetworkID, mode int, index int64, count int, category string) (posts []gp.PostSmall, err error) {\n\tposts = make([]gp.PostSmall, 0)\n\tvar q string\n\tif len(category) > 0 {\n\t\tq = baseQuery + categoryClause + notDeleted + notPending + byNetwork + whereCategory\n\t} else {\n\t\tq = baseQuery + notDeleted + notPending + byNetwork\n\t}\n\tswitch {\n\tcase mode == ByOffsetDescending:\n\t\tq += orderLinear\n\tcase mode == ChronologicallyAfterID:\n\t\tq += whereAfter + orderReverseChronological\n\t\tq = fmt.Sprintf(reverse, q)\n\tcase mode == ChronologicallyBeforeID:\n\t\tq += whereBefore + orderChronological\n\t}\n\ts, err := api.sc.Prepare(q)\n\tif err != nil {\n\t\treturn\n\t}\n\tvar rows *sql.Rows\n\tif len(category) > 0 {\n\t\trows, err = s.Query(netID, category, index, count)\n\t} else {\n\t\trows, err = s.Query(netID, index, count)\n\t}\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer rows.Close()\n\treturn api.scanPostRows(rows, false)\n}", "title": "" }, { "docid": "edb1657f339f8df95bc7134cc4f77bcf", "score": "0.6678585", "text": "func (pr *PostRepository) FindAll(page int, limit int) (domain.Posts, error) {\n\tvar posts domain.Posts\n\trows, err := pr.ConnMySQL.Query(`\n\t\tSELECT\n\t\t\t*\n\t\tFROM\n\t\t\tview_posts\n\t\tORDER BY id\n\t\tLIMIT ?, ?\n\t`, page*limit-limit, limit)\n\n\tdefer func() {\n\t\tif rerr := rows.Close(); rerr != nil {\n\t\t\terr = rerr\n\t\t}\n\t}()\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor rows.Next() {\n\t\tvar (\n\t\t\tpostID int\n\t\t\tadminID int\n\t\t\tcategoryID int\n\t\t\tpostTitle string\n\t\t\tpostMDBody string\n\t\t\tpostHTMLBody string\n\t\t\tpostStatus string\n\t\t\tpostCreatedAt time.Time\n\t\t\tpostUpdatedAt time.Time\n\t\t\tadminName string\n\t\t\tadminEmail string\n\t\t\tadminPassword string\n\t\t\tadminCreatedAt time.Time\n\t\t\tadminUpdatedAt time.Time\n\t\t\tcategoryName string\n\t\t\tcategoryCreatedAt time.Time\n\t\t\tcategoryUpdatedAt time.Time\n\t\t)\n\t\tif err = rows.Scan(\n\t\t\t&postID,\n\t\t\t&adminID,\n\t\t\t&categoryID,\n\t\t\t&postTitle,\n\t\t\t&postMDBody,\n\t\t\t&postHTMLBody,\n\t\t\t&postStatus,\n\t\t\t&postCreatedAt,\n\t\t\t&postUpdatedAt,\n\t\t\t&adminName,\n\t\t\t&adminEmail,\n\t\t\t&adminPassword,\n\t\t\t&adminCreatedAt,\n\t\t\t&adminUpdatedAt,\n\t\t\t&categoryName,\n\t\t\t&categoryCreatedAt,\n\t\t\t&categoryUpdatedAt,\n\t\t); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpost := domain.Post{\n\t\t\tID: postID,\n\t\t\tAdmin: domain.Admin{\n\t\t\t\tID: adminID,\n\t\t\t\tName: adminName,\n\t\t\t\tEmail: adminEmail,\n\t\t\t\tPassword: adminPassword,\n\t\t\t\tCreatedAt: adminCreatedAt,\n\t\t\t\tUpdatedAt: adminUpdatedAt,\n\t\t\t},\n\t\t\tCategory: domain.Category{\n\t\t\t\tID: categoryID,\n\t\t\t\tName: categoryName,\n\t\t\t\tCreatedAt: categoryCreatedAt,\n\t\t\t\tUpdatedAt: categoryUpdatedAt,\n\t\t\t},\n\t\t\tTitle: postTitle,\n\t\t\tMDBody: postMDBody,\n\t\t\tHTMLBody: postHTMLBody,\n\t\t\tStatus: postStatus,\n\t\t\tCreatedAt: postCreatedAt,\n\t\t\tUpdatedAt: postUpdatedAt,\n\t\t}\n\t\tposts = append(posts, post)\n\t}\n\n\tif err = rows.Err(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tpostIDs := []int{}\n\tfor _, p := range posts {\n\t\tpostIDs = append(postIDs, p.ID)\n\t}\n\n\tqueryTag := `\n\t\tSELECT\n\t\t\ttag_post.post_id AS tag_post_post_id,\n\t\t\ttags.id AS tag_id,\n\t\t\ttags.name AS tag_name,\n\t\t\ttags.created_at AS tag_created_at,\n\t\t\ttags.updated_at AS tag_updated_at\n\t\tFROM\n\t\t\ttags\n\t\tLEFT JOIN\n\t\t\ttag_post\n\t\tON\n\t\t\ttags.id = tag_post.tag_id\n\t\tWHERE\n\t\t\ttag_post.post_id\n\t\tIN\n\t\t\t(%s)\n\t`\n\n\tvar stmt string\n\tif len(postIDs) == 0 {\n\t\tstmt = fmt.Sprintf(queryTag, `\"\"`)\n\t} else {\n\t\tstmt = fmt.Sprintf(queryTag, strings.Trim(strings.Replace(fmt.Sprint(postIDs), \" \", \",\", -1), \"[]\"))\n\t}\n\n\trows, err = pr.ConnMySQL.Query(stmt)\n\n\tdefer func() {\n\t\tif rerr := rows.Close(); rerr != nil {\n\t\t\terr = rerr\n\t\t}\n\t}()\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor rows.Next() {\n\t\tvar (\n\t\t\ttagPostPostID int\n\t\t\ttagID int\n\t\t\ttagName string\n\t\t\ttagCreatedAt time.Time\n\t\t\ttagUpdatedAt time.Time\n\t\t)\n\t\tif err = rows.Scan(&tagPostPostID, &tagID, &tagName, &tagCreatedAt, &tagUpdatedAt); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor p := range posts {\n\t\t\tif posts[p].ID == tagPostPostID {\n\t\t\t\tposts[p].Tags = append(posts[p].Tags, domain.Tag{\n\t\t\t\t\tID: tagID,\n\t\t\t\t\tName: tagName,\n\t\t\t\t\tCreatedAt: tagCreatedAt,\n\t\t\t\t\tUpdatedAt: tagUpdatedAt,\n\t\t\t\t})\n\t\t\t}\n\n\t\t}\n\t}\n\n\tif err = rows.Err(); err != nil {\n\t\treturn nil, err\n\t}\n\n\trows, err = pr.ConnMySQL.Query(`\n\t\tSELECT\n \t\tcomments.id,\n \t\tcomments.post_id,\n \t\tcomments.body,\n \t\tcomments.status,\n \t\tcomments.created_at,\n \t\tcomments.updated_at\n\t\tFROM\n \t\tcomments\n \t\tJOIN\n \t\tposts\n \t\tON posts.id = comments.post_id\n\t\tORDER BY\n \t\tposts.id\n\t\tLIMIT ?, ?\n\t`, page*limit-limit, limit)\n\n\tdefer func() {\n\t\tif rerr := rows.Close(); rerr != nil {\n\t\t\terr = rerr\n\t\t}\n\t}()\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor rows.Next() {\n\t\tvar (\n\t\t\tcommentID int\n\t\t\tcommentPostID int\n\t\t\tcommentBody string\n\t\t\tcommentStatus string\n\t\t\tcommentCreatedAt time.Time\n\t\t\tcommentUpdatedAt time.Time\n\t\t)\n\t\tif err = rows.Scan(&commentID, &commentPostID, &commentBody, &commentStatus, &commentCreatedAt, &commentUpdatedAt); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor p := range posts {\n\t\t\tif posts[p].ID == commentPostID {\n\t\t\t\tposts[p].Comments = append(posts[p].Comments, domain.Comment{\n\t\t\t\t\tID: commentID,\n\t\t\t\t\tPostID: commentPostID,\n\t\t\t\t\tBody: commentBody,\n\t\t\t\t\tStatus: commentStatus,\n\t\t\t\t\tCreatedAt: commentCreatedAt,\n\t\t\t\t\tUpdatedAt: commentUpdatedAt,\n\t\t\t\t})\n\t\t\t}\n\n\t\t}\n\t}\n\n\tif err = rows.Err(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn posts, nil\n}", "title": "" }, { "docid": "aab15f9c8c4beecd86603b268b55d889", "score": "0.66738826", "text": "func getAll() {\n\n\tdb := dbConn()\n\n\tselDB, err := db.Query(\"SELECT * FROM Posts ORDER BY id DESC\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\n\tpost := Post{}\n\tposts := []Post{}\n\n\tfor selDB.Next() {\n\n\t\tvar id int\n\t\tvar title, body string\n\n\t\terr = selDB.Scan(&id, &title, &body)\n\t\tif err != nil {\n\t\t\tpanic(err.Error())\n\t\t}\n\n\t\tpost.Id = id\n\t\tpost.Title = title\n\t\tpost.Body = body\n\n\t\tposts = append(posts, post)\n\t}\n\n\tfor _, post := range posts {\n\t\tfmt.Println(post.Title)\n\t}\n\n\tdefer db.Close()\n}", "title": "" }, { "docid": "c5db0d4107e1637c04260e31a132f0de", "score": "0.6673536", "text": "func (server *Server) getAllPost(w http.ResponseWriter, r *http.Request) {\n\tpost := models.Post{}\n\n\tposts, err := post.FindAllPosts(server.DB)\n\tif err != nil {\n\t\tpanic(err)\n\t\treturn\n\n\t}\n\n\tresponses.JSON(w, http.StatusOK, posts)\n}", "title": "" }, { "docid": "7ba9ac4c3b1b0df273dc76a528923513", "score": "0.65813047", "text": "func (repo *postRepository) GetAll() (*models.Posts, *apperror.AppError) {\n\tmodel := make(models.Posts, 0)\n\n\ttx := repo.Store.Find(&model)\n\n\tif tx.Error != nil && !tx.RecordNotFound() {\n\t\treturn nil, apperror.New(ecode.ErrUnableToFetchPostCode, errors.New(ecode.ErrUnableToFetchPostMsg), ecode.ErrUnableToFetchPostMsg)\n\t}\n\n\treturn &model, nil\n}", "title": "" }, { "docid": "7ead49e6e671df65f0c7dcffa14ee385", "score": "0.6577014", "text": "func (repo *Repository) ListPosts() ([]*model.Post, error) {\n\tposts := []*model.Post{}\n\n\tctx := context.TODO()\n\n\tcur, err := repo.collection().Find(ctx, bson.M{})\n\tif err != nil {\n\t\treturn posts, err\n\t}\n\n\tfor cur.Next(ctx) {\n\t\trecord := &model.Post{}\n\n\t\terr := cur.Decode(record)\n\t\tif err != nil {\n\t\t\treturn posts, err\n\t\t}\n\n\t\tposts = append(posts, record)\n\t}\n\n\tif err := cur.Err(); err != nil {\n\t\treturn posts, err\n\t}\n\n\tcur.Close(ctx)\n\n\treturn posts, nil\n}", "title": "" }, { "docid": "56e244b29adae3091ff4f93bf3415e9f", "score": "0.65621173", "text": "func GetPosts() {\n\tvar posts []Post\n\n\t// prepare statement\n\tstmt := fmt.Sprintf(\"SELECT * FROM %s\", postTable)\n\terr := mysqlDBHandler.Query(stmt, map[string]interface{}{}, &posts)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\n\tfor _, post := range posts {\n\t\tfmt.Println(post.AuthorID, post.Content)\n\t}\n}", "title": "" }, { "docid": "6733adf4cdec88fd368bdcbc0c93db57", "score": "0.6556603", "text": "func printposts(){\n\tfor i := len(allposts) -1; i >= 0; i--{\n\t\tfmt.Println(allposts[i].Content)\n\t}\n}", "title": "" }, { "docid": "059770a4c1311984926bb24815dcf65a", "score": "0.6547609", "text": "func GetPosts(db db.Db, limit int, order string, page int, authors, tags bool, filters string, fields string) ([]models.Post, int, error) {\n\tvar posts []models.Post\n\tvar query *mgo.Query\n\n\t// get cloned mongodb session\n\tsess := db.GetSession()\n\n\t// default query initialize with filters available or not\n\tif filters != \"\" {\n\t\tquery = sess.DB(config.DB_NAME).C(config.POST_COLLECTION_NAME).Find(prepareFilters(filters))\n\t} else {\n\t\tquery = sess.DB(config.DB_NAME).C(config.POST_COLLECTION_NAME).Find(nil)\n\t}\n\n\t// execution 1: get count of posts\n\tcount, _ := query.Count()\n\n\t// check fields and split them apart\n\tvar fieldsP []string\n\tif fields != \"\" {\n\t\tfieldsP = strings.Split(fields, \",\")\n\t}\n\tif len(fieldsP) > 0 {\n\t\t// make bson query\n\t\tvar selectors = make(bson.M)\n\t\tfor _, v := range fieldsP {\n\t\t\tselectors[v] = 1\n\t\t}\n\t\t// construct Select query from selectors\n\t\tquery = query.Select(selectors)\n\t}\n\n\t// pagination\n\tif page > 1 {\n\t\tquery = query.Skip((page - 1) * limit)\n\t}\n\n\t// sorting and limiting\n\tquery = query.Sort(order).Limit(limit)\n\n\t// execution 2: execute the main query\n\terr := query.All(&posts)\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\treturn nil, 0, err\n\t}\n\tdefer sess.Close()\n\n\t// attach authors field if needed\n\tif !authors {\n\t\tfor i := range posts {\n\t\t\tposts[i].Authors = nil\n\t\t\tposts[i].PrimaryAuthor = nil\n\t\t}\n\t}\n\n\t// attach tags field if needed\n\tif !tags {\n\t\tfor i := range posts {\n\t\t\tposts[i].Tags = nil\n\t\t\tposts[i].PrimaryTag = nil\n\t\t}\n\t}\n\treturn posts, count, nil\n}", "title": "" }, { "docid": "21cb6a48d484c6584c3ed4da90842c94", "score": "0.65294117", "text": "func (p *PostHandler) GetPosts(c echo.Context) error {\n\tlimitS := c.QueryParam(\"limit\")\n\tlimit, _ := strconv.Atoi(limitS)\n\n\tctx := c.Request().Context()\n\n\tposts := p.PostService.GetPosts(ctx, limit)\n\n\treturn c.JSON(http.StatusOK, posts)\n}", "title": "" }, { "docid": "9e0aea4d631fa9f4b70da3fa0222e330", "score": "0.6512879", "text": "func Posts(filter bson.M) ([]structure.Post, error) {\n\tsession := mgoSession.Copy()\n\tdefer session.Close()\n\n\tc := session.DB(dbName).C(\"posts\")\n\n\tvar posts []structure.Post\n\terr := c.Find(filter).All(&posts)\n\n\treturn posts, err\n}", "title": "" }, { "docid": "8d23df0eea97ff7f45b9c016c02cb500", "score": "0.6477356", "text": "func Posts() []Post {\n\tmu.Lock()\n\tdefer mu.Unlock()\n\n\tcopiedPosts := make([]Post, 0, len(posts))\n\tfor _, p := range posts {\n\t\tcopiedPosts = append(copiedPosts, p)\n\t}\n\n\tsort.Sort(byCreatedAt(copiedPosts))\n\treturn copiedPosts\n}", "title": "" }, { "docid": "1314a10861c0c43b7672690b552af25e", "score": "0.6398198", "text": "func PostsGet(c *gin.Context) {\n\tdb := models.GetDB()\n\tvar posts []models.Post\n\tdb.Order(\"id desc\").Where(\"published = ?\", true).Find(&posts)\n\th := DefaultH(c)\n\th[\"Title\"] = getSetting(\"blogs_title\")\n\th[\"Posts\"] = posts\n\tc.HTML(http.StatusOK, \"posts/public_index\", h)\n}", "title": "" }, { "docid": "c957b850569953235dd00f9ebbfa1748", "score": "0.638898", "text": "func GetPostses(offset int, limit int, field string) (*[]*Posts, error) {\n\tvar _Posts = new([]*Posts)\n\terr := Engine.Table(\"posts\").Limit(limit, offset).Desc(field).Find(_Posts)\n\treturn _Posts, err\n}", "title": "" }, { "docid": "9274214a96249995b5e994e1ea5271df", "score": "0.63874054", "text": "func (api *API) Posts() (*PostsResponse, error) {\n\treturn api.FilteredPosts(Filter{})\n}", "title": "" }, { "docid": "f6454804c541b76fc134238a3f2e5317", "score": "0.6382794", "text": "func GetAllPost(w http.ResponseWriter, r *http.Request) {\n\tvar posts []entity.Post\n\tmydatabase.Connector.Find(&posts)\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\tjson.NewEncoder(w).Encode(posts)\n\txml.NewEncoder(w).Encode(posts)\n}", "title": "" }, { "docid": "1aa7dbad7f1bd37ac2233d643ca5b295", "score": "0.63816917", "text": "func (q cmfPortalPostQuery) All(ctx context.Context, exec boil.ContextExecutor) (CMFPortalPostSlice, error) {\n\tvar o []*CMFPortalPost\n\n\terr := q.Bind(ctx, exec, &o)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"models: failed to assign all query results to CMFPortalPost slice\")\n\t}\n\n\tif len(cmfPortalPostAfterSelectHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterSelectHooks(ctx, exec); err != nil {\n\t\t\t\treturn o, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn o, nil\n}", "title": "" }, { "docid": "ff650881c41e2d9ef22230e8f680bf63", "score": "0.63606113", "text": "func GetPostsesByPostDateAndToPingAndPostContentFiltered(offset int, limit int, PostDate_ time.Time, ToPing_ string, PostContentFiltered_ string) (*[]*Posts, error) {\n\tvar _Posts = new([]*Posts)\n\terr := Engine.Table(\"posts\").Where(\"post_date = ? and to_ping = ? and post_content_filtered = ?\", PostDate_, ToPing_, PostContentFiltered_).Limit(limit, offset).Find(_Posts)\n\treturn _Posts, err\n}", "title": "" }, { "docid": "e302aa77788cba607c14118726dbde3e", "score": "0.6334064", "text": "func PostList() ([]*model.Post, error) {\n\tp := &model.Post{}\n\treturn p.All()\n}", "title": "" }, { "docid": "dcb5630d5993c88dcd66b746847e737b", "score": "0.63006365", "text": "func (api *API) getUserPosts(userID, perspective gp.UserID, mode int, index int64, count int, category string) (posts []gp.PostSmall, err error) {\n\tposts = make([]gp.PostSmall, 0)\n\tvar q string\n\tif len(category) > 0 {\n\t\tq = baseQuery + categoryClause + notDeleted + notPending + byPoster + category\n\t} else {\n\t\tq = baseQuery + notDeleted + notPending + byPoster\n\t}\n\tswitch {\n\tcase mode == ByOffsetDescending:\n\t\tq += orderLinear\n\tcase mode == ChronologicallyAfterID:\n\t\tq += whereAfter + orderChronological\n\tcase mode == ChronologicallyBeforeID:\n\t\tq += whereBefore + orderChronological\n\t}\n\ts, err := api.sc.Prepare(q)\n\tif err != nil {\n\t\treturn\n\t}\n\tvar rows *sql.Rows\n\tif len(category) > 0 {\n\t\trows, err = s.Query(userID, perspective, category, index, count)\n\t} else {\n\t\trows, err = s.Query(userID, perspective, index, count)\n\t}\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer rows.Close()\n\treturn api.scanPostRows(rows, true)\n}", "title": "" }, { "docid": "a8ae74cf44642f83a47cbb50d5f0b455", "score": "0.62936366", "text": "func (pr *PostRepository) FindAllPublish(page int, limit int) (domain.Posts, error) {\n\tvar posts domain.Posts\n\trows, err := pr.ConnMySQL.Query(`\n\t\tSELECT\n\t\t\t*\n\t\tFROM\n\t\t\tview_posts\n\t\tWHERE\n\t\t\tstatus = \"publish\"\n\t\tORDER BY id\n\t\tLIMIT ?, ?\n\t`, page*limit-limit, limit)\n\n\tdefer func() {\n\t\tif rerr := rows.Close(); rerr != nil {\n\t\t\terr = rerr\n\t\t}\n\t}()\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor rows.Next() {\n\t\tvar (\n\t\t\tpostID int\n\t\t\tadminID int\n\t\t\tcategoryID int\n\t\t\tpostTitle string\n\t\t\tpostMDBody string\n\t\t\tpostHTMLBody string\n\t\t\tpostStatus string\n\t\t\tpostCreatedAt time.Time\n\t\t\tpostUpdatedAt time.Time\n\t\t\tadminName string\n\t\t\tadminEmail string\n\t\t\tadminPassword string\n\t\t\tadminCreatedAt time.Time\n\t\t\tadminUpdatedAt time.Time\n\t\t\tcategoryName string\n\t\t\tcategoryCreatedAt time.Time\n\t\t\tcategoryUpdatedAt time.Time\n\t\t)\n\t\tif err = rows.Scan(\n\t\t\t&postID,\n\t\t\t&adminID,\n\t\t\t&categoryID,\n\t\t\t&postTitle,\n\t\t\t&postMDBody,\n\t\t\t&postHTMLBody,\n\t\t\t&postStatus,\n\t\t\t&postCreatedAt,\n\t\t\t&postUpdatedAt,\n\t\t\t&adminName,\n\t\t\t&adminEmail,\n\t\t\t&adminPassword,\n\t\t\t&adminCreatedAt,\n\t\t\t&adminUpdatedAt,\n\t\t\t&categoryName,\n\t\t\t&categoryCreatedAt,\n\t\t\t&categoryUpdatedAt,\n\t\t); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpost := domain.Post{\n\t\t\tID: postID,\n\t\t\tAdmin: domain.Admin{\n\t\t\t\tID: adminID,\n\t\t\t\tName: adminName,\n\t\t\t\tEmail: adminEmail,\n\t\t\t\tPassword: adminPassword,\n\t\t\t\tCreatedAt: adminCreatedAt,\n\t\t\t\tUpdatedAt: adminUpdatedAt,\n\t\t\t},\n\t\t\tCategory: domain.Category{\n\t\t\t\tID: categoryID,\n\t\t\t\tName: categoryName,\n\t\t\t\tCreatedAt: categoryCreatedAt,\n\t\t\t\tUpdatedAt: categoryUpdatedAt,\n\t\t\t},\n\t\t\tTitle: postTitle,\n\t\t\tMDBody: postMDBody,\n\t\t\tHTMLBody: postHTMLBody,\n\t\t\tStatus: postStatus,\n\t\t\tCreatedAt: postCreatedAt,\n\t\t\tUpdatedAt: postUpdatedAt,\n\t\t}\n\t\tposts = append(posts, post)\n\t}\n\n\tif err = rows.Err(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tpostIDs := []int{}\n\tfor _, p := range posts {\n\t\tpostIDs = append(postIDs, p.ID)\n\t}\n\n\tqueryTag := `\n\t\tSELECT\n\t\t\ttag_post.post_id AS tag_post_post_id,\n\t\t\ttags.id AS tag_id,\n\t\t\ttags.name AS tag_name,\n\t\t\ttags.created_at AS tag_created_at,\n\t\t\ttags.updated_at AS tag_updated_at\n\t\tFROM\n\t\t\ttags\n\t\tLEFT JOIN\n\t\t\ttag_post\n\t\tON\n\t\t\ttags.id = tag_post.tag_id\n\t\tWHERE\n\t\t\ttag_post.post_id\n\t\tIN\n\t\t\t(%s)\n\t`\n\n\tvar stmt string\n\tif len(postIDs) == 0 {\n\t\tstmt = fmt.Sprintf(queryTag, `\"\"`)\n\t} else {\n\t\tstmt = fmt.Sprintf(queryTag, strings.Trim(strings.Replace(fmt.Sprint(postIDs), \" \", \",\", -1), \"[]\"))\n\t}\n\n\trows, err = pr.ConnMySQL.Query(stmt)\n\n\tdefer func() {\n\t\tif rerr := rows.Close(); rerr != nil {\n\t\t\terr = rerr\n\t\t}\n\t}()\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor rows.Next() {\n\t\tvar (\n\t\t\ttagPostPostID int\n\t\t\ttagID int\n\t\t\ttagName string\n\t\t\ttagCreatedAt time.Time\n\t\t\ttagUpdatedAt time.Time\n\t\t)\n\t\tif err = rows.Scan(&tagPostPostID, &tagID, &tagName, &tagCreatedAt, &tagUpdatedAt); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor p := range posts {\n\t\t\tif posts[p].ID == tagPostPostID {\n\t\t\t\tposts[p].Tags = append(posts[p].Tags, domain.Tag{\n\t\t\t\t\tID: tagID,\n\t\t\t\t\tName: tagName,\n\t\t\t\t\tCreatedAt: tagCreatedAt,\n\t\t\t\t\tUpdatedAt: tagUpdatedAt,\n\t\t\t\t})\n\t\t\t}\n\n\t\t}\n\t}\n\n\tif err = rows.Err(); err != nil {\n\t\treturn nil, err\n\t}\n\n\trows, err = pr.ConnMySQL.Query(`\n\t\tSELECT\n \t\tcomments.id,\n \t\tcomments.post_id,\n \t\tcomments.body,\n \t\tcomments.status,\n \t\tcomments.created_at,\n \t\tcomments.updated_at\n\t\tFROM\n \t\tcomments\n \t\tJOIN\n \t\tposts\n \t\tON posts.id = comments.post_id\n\t\tWHERE\n \t\tposts.status = \"publish\"\n\t\tAND comments.status = \"publish\"\n\t\tORDER BY\n \t\tposts.id\n\t\tLIMIT ?, ?\n\t`, page*limit-limit, limit)\n\n\tdefer func() {\n\t\tif rerr := rows.Close(); rerr != nil {\n\t\t\terr = rerr\n\t\t}\n\t}()\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor rows.Next() {\n\t\tvar (\n\t\t\tcommentID int\n\t\t\tcommentPostID int\n\t\t\tcommentBody string\n\t\t\tcommentStatus string\n\t\t\tcommentCreatedAt time.Time\n\t\t\tcommentUpdatedAt time.Time\n\t\t)\n\t\tif err = rows.Scan(&commentID, &commentPostID, &commentBody, &commentStatus, &commentCreatedAt, &commentUpdatedAt); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor p := range posts {\n\t\t\tif posts[p].ID == commentPostID {\n\t\t\t\tposts[p].Comments = append(posts[p].Comments, domain.Comment{\n\t\t\t\t\tID: commentID,\n\t\t\t\t\tPostID: commentPostID,\n\t\t\t\t\tBody: commentBody,\n\t\t\t\t\tStatus: commentStatus,\n\t\t\t\t\tCreatedAt: commentCreatedAt,\n\t\t\t\t\tUpdatedAt: commentUpdatedAt,\n\t\t\t\t})\n\t\t\t}\n\n\t\t}\n\t}\n\n\tif err = rows.Err(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn posts, nil\n}", "title": "" }, { "docid": "6dda4491714bdb564ff2a8397107ff89", "score": "0.627789", "text": "func GetPostsesByPostDateAndPostContentFiltered(offset int, limit int, PostDate_ time.Time, PostContentFiltered_ string) (*[]*Posts, error) {\n\tvar _Posts = new([]*Posts)\n\terr := Engine.Table(\"posts\").Where(\"post_date = ? and post_content_filtered = ?\", PostDate_, PostContentFiltered_).Limit(limit, offset).Find(_Posts)\n\treturn _Posts, err\n}", "title": "" }, { "docid": "a22f4c29419ad9c3d718b0427de0cbbf", "score": "0.6276849", "text": "func GetPostsesViaPostContentFiltered(offset int, limit int, PostContentFiltered_ string, field string) (*[]*Posts, error) {\n\tvar _Posts = new([]*Posts)\n\terr := Engine.Table(\"posts\").Where(\"post_content_filtered = ?\", PostContentFiltered_).Limit(limit, offset).Desc(field).Find(_Posts)\n\treturn _Posts, err\n}", "title": "" }, { "docid": "e6db7426fb0645b09f2075953c23eb5a", "score": "0.62566376", "text": "func ReadAllPosts() ([]Post, error) {\n\tvar results []Post\n\terr := db.C(\"posts\").Find(nil).All(&results)\n\tcheckError(err)\n\n\tif results == nil {\n\t\tresults = []Post{}\n\t}\n\n\treturn results, err\n}", "title": "" }, { "docid": "dd4d65b09d5c16ee466094bdb07c03ba", "score": "0.6243482", "text": "func GetPostsesByPostDateAndPostContentAndToPing(offset int, limit int, PostDate_ time.Time, PostContent_ string, ToPing_ string) (*[]*Posts, error) {\n\tvar _Posts = new([]*Posts)\n\terr := Engine.Table(\"posts\").Where(\"post_date = ? and post_content = ? and to_ping = ?\", PostDate_, PostContent_, ToPing_).Limit(limit, offset).Find(_Posts)\n\treturn _Posts, err\n}", "title": "" }, { "docid": "ff0e33ff9df94116f3d51dbc002007d3", "score": "0.6236762", "text": "func GetPostsesByToPingAndPostContentFiltered(offset int, limit int, ToPing_ string, PostContentFiltered_ string) (*[]*Posts, error) {\n\tvar _Posts = new([]*Posts)\n\terr := Engine.Table(\"posts\").Where(\"to_ping = ? and post_content_filtered = ?\", ToPing_, PostContentFiltered_).Limit(limit, offset).Find(_Posts)\n\treturn _Posts, err\n}", "title": "" }, { "docid": "25f0c7a0183ceccfe3cab9522dc9cff3", "score": "0.6219015", "text": "func GetPostsesByPostDateAndPostTitleAndPostContentFiltered(offset int, limit int, PostDate_ time.Time, PostTitle_ string, PostContentFiltered_ string) (*[]*Posts, error) {\n\tvar _Posts = new([]*Posts)\n\terr := Engine.Table(\"posts\").Where(\"post_date = ? and post_title = ? and post_content_filtered = ?\", PostDate_, PostTitle_, PostContentFiltered_).Limit(limit, offset).Find(_Posts)\n\treturn _Posts, err\n}", "title": "" }, { "docid": "dad4d982d3bdb7c2918bfa7ca27b3398", "score": "0.6217054", "text": "func GetPostsesByToPingAndPostContentFilteredAndGuid(offset int, limit int, ToPing_ string, PostContentFiltered_ string, Guid_ string) (*[]*Posts, error) {\n\tvar _Posts = new([]*Posts)\n\terr := Engine.Table(\"posts\").Where(\"to_ping = ? and post_content_filtered = ? and guid = ?\", ToPing_, PostContentFiltered_, Guid_).Limit(limit, offset).Find(_Posts)\n\treturn _Posts, err\n}", "title": "" }, { "docid": "55680174317a67b1168059035c127926", "score": "0.6216294", "text": "func (p *dbPosts) getPosts(id string, db *sql.DB) (dbPosts, error) {\n\tvar rows *sql.Rows\n\tvar err error\n\tvar posts = dbPosts{}\n\tif id != \"\" {\n\t\trows, err = db.Query(GETONEPOST, id)\n\t} else {\n\t\trows, err = db.Query(GETALLPOSTS)\n\t}\n\tif err != nil {\n\t\treturn posts, fmt.Errorf(\"error in db.query: %v\", err)\n\t}\n\tfor rows.Next() {\n\t\tpost := Post{}\n\t\terr = rows.Scan(&post.ID, &post.Title, &post.Summary, &post.Body, &post.Date)\n\t\tif err != nil {\n\t\t\treturn posts, fmt.Errorf(\"error in row.scan: %v\", err)\n\t\t}\n\t\tposts = append(posts, post)\n\t}\n\tif err := rows.Close(); err != nil {\n\t\treturn posts, err\n\t}\n\treturn posts, nil\n}", "title": "" }, { "docid": "0e695d10dff5cd2231f6ca987ffaa9e2", "score": "0.6198483", "text": "func (k Keeper) GetPostsFiltered(ctx sdk.Context, params types.QueryPostsParams) types.Posts {\n\tfilteredPosts := types.Posts{}\n\tk.IteratePosts(ctx, func(_ int64, post types.Post) (stop bool) {\n\t\tmatchParentID, matchCreationTime, matchAllowsComments, matchSubspace, matchCreator := true, true, true, true, true\n\n\t\t// match parent id if valid\n\t\tif params.ParentID != nil {\n\t\t\tmatchParentID = params.ParentID.Equals(post.ParentID)\n\t\t}\n\n\t\t// match creation time if valid height\n\t\tif params.CreationTime != nil {\n\t\t\tmatchCreationTime = params.CreationTime.Equal(post.Created)\n\t\t}\n\n\t\t// match allows comments\n\t\tif params.AllowsComments != nil {\n\t\t\tmatchAllowsComments = *params.AllowsComments == post.AllowsComments\n\t\t}\n\n\t\t// match subspace if provided\n\t\tif len(params.Subspace) > 0 {\n\t\t\tmatchSubspace = params.Subspace == post.Subspace\n\t\t}\n\n\t\t// match creator address (if supplied)\n\t\tif len(params.Creator) > 0 {\n\t\t\tmatchCreator = params.Creator.Equals(post.Creator)\n\t\t}\n\n\t\tif matchParentID && matchCreationTime && matchAllowsComments && matchSubspace && matchCreator {\n\t\t\tfilteredPosts = append(filteredPosts, post)\n\t\t}\n\n\t\treturn false\n\t})\n\n\t// Sort the posts\n\tsort.Slice(filteredPosts, func(i, j int) bool {\n\t\tvar result bool\n\t\tfirst, second := filteredPosts[i], filteredPosts[j]\n\n\t\tswitch params.SortBy {\n\t\tcase types.PostSortByCreationDate:\n\t\t\tresult = first.Created.Before(second.Created)\n\t\t\tif params.SortOrder == types.PostSortOrderDescending {\n\t\t\t\tresult = first.Created.After(second.Created)\n\t\t\t}\n\n\t\tdefault:\n\t\t\tresult = first.PostID < second.PostID\n\t\t\tif params.SortOrder == types.PostSortOrderDescending {\n\t\t\t\tresult = first.PostID > second.PostID\n\t\t\t}\n\t\t}\n\n\t\t// This should never be reached\n\t\treturn result\n\t})\n\n\t// Default page\n\tpage := params.Page\n\tif page == 0 {\n\t\tpage = 1\n\t}\n\n\tstart, end := client.Paginate(len(filteredPosts), page, params.Limit, 100)\n\tif start < 0 || end < 0 {\n\t\tfilteredPosts = types.Posts{}\n\t} else {\n\t\tfilteredPosts = filteredPosts[start:end]\n\t}\n\n\treturn filteredPosts\n}", "title": "" }, { "docid": "58db53fffe4cb081c1300f3f3fc613c9", "score": "0.6190913", "text": "func (c *Container) GetPosts(bpk cipher.PubKey, tRef skyobject.Reference) ([]*typ.Post, error) {\n\tw := c.c.LastRoot(bpk).Walker()\n\tbc := &typ.BoardContainer{}\n\tif e := w.AdvanceFromRoot(bc, makeBoardContainerFinder(w.Root())); e != nil {\n\t\treturn nil, e\n\t}\n\ttp := &typ.ThreadPage{}\n\tif e := w.AdvanceFromRefsField(\"ThreadPages\", tp, makeThreadPageFinder(w, tRef)); e != nil {\n\t\treturn nil, e\n\t}\n\tposts := make([]*typ.Post, len(tp.Posts))\n\tfor i, pRef := range tp.Posts {\n\t\tpData, has := c.c.Get(pRef)\n\t\tif has == false {\n\t\t\tcontinue\n\t\t}\n\t\tposts[i] = new(typ.Post)\n\t\tif e := encoder.DeserializeRaw(pData, posts[i]); e != nil {\n\t\t\treturn nil, e\n\t\t}\n\t\tposts[i].Ref = cipher.SHA256(pRef).Hex()\n\t}\n\treturn posts, nil\n}", "title": "" }, { "docid": "7c149ba29dea76df5c7201be1a31ba91", "score": "0.61748594", "text": "func GetPostsesByPostDateAndPostTitleAndToPing(offset int, limit int, PostDate_ time.Time, PostTitle_ string, ToPing_ string) (*[]*Posts, error) {\n\tvar _Posts = new([]*Posts)\n\terr := Engine.Table(\"posts\").Where(\"post_date = ? and post_title = ? and to_ping = ?\", PostDate_, PostTitle_, ToPing_).Limit(limit, offset).Find(_Posts)\n\treturn _Posts, err\n}", "title": "" }, { "docid": "d36560c320f107dfaddbaea26fd28c94", "score": "0.6168313", "text": "func GetPostsesByIdAndToPingAndPostContentFiltered(offset int, limit int, Id_ int64, ToPing_ string, PostContentFiltered_ string) (*[]*Posts, error) {\n\tvar _Posts = new([]*Posts)\n\terr := Engine.Table(\"posts\").Where(\"id = ? and to_ping = ? and post_content_filtered = ?\", Id_, ToPing_, PostContentFiltered_).Limit(limit, offset).Find(_Posts)\n\treturn _Posts, err\n}", "title": "" }, { "docid": "8ca75c83592d181ffa79b09d50da9af7", "score": "0.6165099", "text": "func GetPostsesByPostTitleAndToPingAndPostContentFiltered(offset int, limit int, PostTitle_ string, ToPing_ string, PostContentFiltered_ string) (*[]*Posts, error) {\n\tvar _Posts = new([]*Posts)\n\terr := Engine.Table(\"posts\").Where(\"post_title = ? and to_ping = ? and post_content_filtered = ?\", PostTitle_, ToPing_, PostContentFiltered_).Limit(limit, offset).Find(_Posts)\n\treturn _Posts, err\n}", "title": "" }, { "docid": "c3dd212d0c68cb8b8b7e76d1ffd0f1ee", "score": "0.615862", "text": "func GetPostsesByPostDateAndToPing(offset int, limit int, PostDate_ time.Time, ToPing_ string) (*[]*Posts, error) {\n\tvar _Posts = new([]*Posts)\n\terr := Engine.Table(\"posts\").Where(\"post_date = ? and to_ping = ?\", PostDate_, ToPing_).Limit(limit, offset).Find(_Posts)\n\treturn _Posts, err\n}", "title": "" }, { "docid": "a36ed976c4382bfa9159b7de83ec0470", "score": "0.61585635", "text": "func GetPostsesByPingedAndPostContentFiltered(offset int, limit int, Pinged_ string, PostContentFiltered_ string) (*[]*Posts, error) {\n\tvar _Posts = new([]*Posts)\n\terr := Engine.Table(\"posts\").Where(\"pinged = ? and post_content_filtered = ?\", Pinged_, PostContentFiltered_).Limit(limit, offset).Find(_Posts)\n\treturn _Posts, err\n}", "title": "" }, { "docid": "f06ef661cac5accae5565e5647a93447", "score": "0.6149548", "text": "func GetPosts(client ClientInterface, name string, params url.Values) (*Posts, error) {\n\treturn queryPosts(client, \"/blog/%s/posts\", name, params)\n}", "title": "" }, { "docid": "2203bc935705db8c8011517cc522ee5a", "score": "0.6148754", "text": "func (c *PostController) ListAll(\n\tcurrentApp *app.App,\n\torigin uint64,\n\topts object.QueryOptions,\n) (*PostFeed, error) {\n\topts.Owned = &defaultOwned\n\topts.Types = []string{TypePost}\n\topts.Visibilities = []object.Visibility{\n\t\tobject.VisibilityPublic,\n\t\tobject.VisibilityGlobal,\n\t}\n\n\tos, err := c.objects.Query(currentApp.Namespace(), opts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tps := postsFromObjects(os)\n\n\terr = enrichCounts(c.events, c.objects, currentApp, ps)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = enrichIsLiked(c.events, currentApp, origin, ps)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tum, err := user.MapFromIDs(c.users, currentApp.Namespace(), ps.OwnerIDs()...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, u := range um {\n\t\terr = enrichRelation(c.connections, currentApp, origin, u)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn &PostFeed{\n\t\tPosts: ps,\n\t\tUserMap: um,\n\t}, nil\n}", "title": "" }, { "docid": "8878979875a15c3388b9b1117d70f884", "score": "0.61481583", "text": "func GetPostsesByPostDateAndPostContentAndPostContentFiltered(offset int, limit int, PostDate_ time.Time, PostContent_ string, PostContentFiltered_ string) (*[]*Posts, error) {\n\tvar _Posts = new([]*Posts)\n\terr := Engine.Table(\"posts\").Where(\"post_date = ? and post_content = ? and post_content_filtered = ?\", PostDate_, PostContent_, PostContentFiltered_).Limit(limit, offset).Find(_Posts)\n\treturn _Posts, err\n}", "title": "" }, { "docid": "c318650f083fc9ecc0da4a333bd234d9", "score": "0.6147092", "text": "func (r RepoBlog) List(index int, length int) ([]model.Posts, error) {\n\t// Open connection\n\tdb := r.Connect()\n\n\t// Close the connection at the end\n\tdefer db.Close()\n\n\tvar list []model.Posts\n\n\t// Retrieve objects from database\n\tresults, err := db.Query(r.listQuery, length, (index-1)*length)\n\n\t// Check if there's something wrong with the query\n\tif err != nil {\n\t\treturn list, err\n\t}\n\n\tfor results.Next() {\n\t\tvar model model.Posts\n\n\t\terr := results.Scan(\n\t\t\t&model.CategoryTitle,\n\t\t\t&model.CategoryURL,\n\t\t\t&model.Tags,\n\t\t\t&model.Title,\n\t\t\t&model.URL,\n\t\t\t&model.ImageURL,\n\t\t\t&model.Description,\n\t\t\t&model.DatePublished,\n\t\t\t&model.Author)\n\n\t\t// Check if there's something wrong with scanning the row\n\t\tif err != nil {\n\t\t\treturn list, err\n\t\t}\n\n\t\t// Add it if it's ok\n\t\tlist = append(list, model)\n\t}\n\n\t// Returns list of objects obtained from database\n\treturn list, nil\n}", "title": "" }, { "docid": "2e6adfe4be5e9884b2c3ba91b450450d", "score": "0.61469007", "text": "func ListPosts() (posts []Post, err error) {\n\tutils.LogInfo(\"ListPosts() called\")\n\tctx := context.Background()\n\tclient := getDBClient()\n\n\titer := client.Collection(\"posts\").Documents(ctx)\n\tdefer iter.Stop()\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\tlog.Fatalf(\"Failed to iterate: %v\", err)\n\t\t}\n\n\t\tvar pdb PostDB\n\t\tdoc.DataTo(&pdb)\n\n\t\tposts = append(posts, convertPostDBToPost(pdb))\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "867f5896b8ebb77b6cf0cc6839938c7e", "score": "0.6144575", "text": "func GetPostsesByPostDateAndPostContent(offset int, limit int, PostDate_ time.Time, PostContent_ string) (*[]*Posts, error) {\n\tvar _Posts = new([]*Posts)\n\terr := Engine.Table(\"posts\").Where(\"post_date = ? and post_content = ?\", PostDate_, PostContent_).Limit(limit, offset).Find(_Posts)\n\treturn _Posts, err\n}", "title": "" }, { "docid": "db8c8de5fba76fca78e9a2268f36316f", "score": "0.61386883", "text": "func GetPostsesByToPingAndPingedAndPostContentFiltered(offset int, limit int, ToPing_ string, Pinged_ string, PostContentFiltered_ string) (*[]*Posts, error) {\n\tvar _Posts = new([]*Posts)\n\terr := Engine.Table(\"posts\").Where(\"to_ping = ? and pinged = ? and post_content_filtered = ?\", ToPing_, Pinged_, PostContentFiltered_).Limit(limit, offset).Find(_Posts)\n\treturn _Posts, err\n}", "title": "" }, { "docid": "eef63a299209995c65417fd08902d400", "score": "0.612792", "text": "func GetPostsesByPostContentAndToPing(offset int, limit int, PostContent_ string, ToPing_ string) (*[]*Posts, error) {\n\tvar _Posts = new([]*Posts)\n\terr := Engine.Table(\"posts\").Where(\"post_content = ? and to_ping = ?\", PostContent_, ToPing_).Limit(limit, offset).Find(_Posts)\n\treturn _Posts, err\n}", "title": "" }, { "docid": "5e8c252e2bcb9aece2c31cbde5126467", "score": "0.6109851", "text": "func (l *Label) Posts() ([]Post, error) {\n\tvar posts []Post\n\n\tdb, err := openDatabase(&l.db)\n\tif err != nil {\n\t\treturn posts, err\n\t}\n\tdefer db.Close()\n\n\tstmt, err := db.Prepare(findPostsByLabelId)\n\tif err != nil {\n\t\treturn posts, err\n\t}\n\tdefer stmt.Close()\n\n\trows, err := stmt.Query(l.Id())\n\tif err != nil {\n\t\treturn posts, err\n\t}\n\n\tfor rows.Next() {\n\t\tvar id int64\n\t\tvar authorId int64\n\t\tvar title string\n\t\tvar content string\n\t\tvar imageURL string\n\t\tvar date time.Time\n\n\t\terr := rows.Scan(&id,\n\t\t\t&authorId,\n\t\t\t&title,\n\t\t\t&content,\n\t\t\t&imageURL,\n\t\t\t&date)\n\n\t\tif err != nil {\n\t\t\treturn posts, err\n\t\t}\n\t\tp := Post{\n\t\t\tid: id,\n\t\t\tauthorId: authorId,\n\t\t\ttitle: title,\n\t\t\tcontent: content,\n\t\t\timageURL: imageURL,\n\t\t\tdate: date,\n\t\t\tdb: l.db,\n\t\t}\n\t\tposts = append(posts, p)\n\t}\n\n\treturn posts, nil\n}", "title": "" }, { "docid": "8de0d0c4e95a2094a956fb5bd7449bf4", "score": "0.6098933", "text": "func GetPostsesByPostContentAndToPingAndPinged(offset int, limit int, PostContent_ string, ToPing_ string, Pinged_ string) (*[]*Posts, error) {\n\tvar _Posts = new([]*Posts)\n\terr := Engine.Table(\"posts\").Where(\"post_content = ? and to_ping = ? and pinged = ?\", PostContent_, ToPing_, Pinged_).Limit(limit, offset).Find(_Posts)\n\treturn _Posts, err\n}", "title": "" }, { "docid": "7aa7e1e8ab1f2fd5cf1237cd0956d80c", "score": "0.60987127", "text": "func (api *API) GetUserPosts(userID gp.UserID, perspective gp.UserID, mode int, index int64, count int, category string) (posts []gp.PostSmall, err error) {\n\tposts = make([]gp.PostSmall, 0)\n\tposts, err = api.getUserPosts(userID, perspective, mode, index, count, category)\n\tif err != nil {\n\t\treturn\n\t}\n\tfor i := range posts {\n\t\tprocessed, err := api.postProcess(posts[i], perspective)\n\t\tif err == nil {\n\t\t\tposts[i] = processed\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "30da6e1d3c85bb2e97a1303d2697b89d", "score": "0.6097151", "text": "func GetPostsesByPostContentAndPostTitleAndToPing(offset int, limit int, PostContent_ string, PostTitle_ string, ToPing_ string) (*[]*Posts, error) {\n\tvar _Posts = new([]*Posts)\n\terr := Engine.Table(\"posts\").Where(\"post_content = ? and post_title = ? and to_ping = ?\", PostContent_, PostTitle_, ToPing_).Limit(limit, offset).Find(_Posts)\n\treturn _Posts, err\n}", "title": "" }, { "docid": "748647f7a2f3013eeb287b7124774ea8", "score": "0.60950685", "text": "func GetPostsesByPostDateAndPingStatusAndPostContentFiltered(offset int, limit int, PostDate_ time.Time, PingStatus_ string, PostContentFiltered_ string) (*[]*Posts, error) {\n\tvar _Posts = new([]*Posts)\n\terr := Engine.Table(\"posts\").Where(\"post_date = ? and ping_status = ? and post_content_filtered = ?\", PostDate_, PingStatus_, PostContentFiltered_).Limit(limit, offset).Find(_Posts)\n\treturn _Posts, err\n}", "title": "" }, { "docid": "e88c1848435ad6c9a51c7977bc7cea6e", "score": "0.6083754", "text": "func GetPostsesByPostDateAndPingedAndPostContentFiltered(offset int, limit int, PostDate_ time.Time, Pinged_ string, PostContentFiltered_ string) (*[]*Posts, error) {\n\tvar _Posts = new([]*Posts)\n\terr := Engine.Table(\"posts\").Where(\"post_date = ? and pinged = ? and post_content_filtered = ?\", PostDate_, Pinged_, PostContentFiltered_).Limit(limit, offset).Find(_Posts)\n\treturn _Posts, err\n}", "title": "" }, { "docid": "558c5eff49338ff6770bdfcce5dbe249", "score": "0.60799927", "text": "func (p *Usecase) FetchAll(userID string) ([]postModel.Post, error) {\n\treturn p.postRepository.FetchAll(userID)\n}", "title": "" }, { "docid": "38bae678bc9b12c821ae3a2e4962d157", "score": "0.6076317", "text": "func GetPostsesByPostDateAndPostContentFilteredAndPostMimeType(offset int, limit int, PostDate_ time.Time, PostContentFiltered_ string, PostMimeType_ string) (*[]*Posts, error) {\n\tvar _Posts = new([]*Posts)\n\terr := Engine.Table(\"posts\").Where(\"post_date = ? and post_content_filtered = ? and post_mime_type = ?\", PostDate_, PostContentFiltered_, PostMimeType_).Limit(limit, offset).Find(_Posts)\n\treturn _Posts, err\n}", "title": "" }, { "docid": "140339b713f742555b62c2de2c41c92e", "score": "0.6075457", "text": "func GetPostsesByPostDateAndPostContentFilteredAndGuid(offset int, limit int, PostDate_ time.Time, PostContentFiltered_ string, Guid_ string) (*[]*Posts, error) {\n\tvar _Posts = new([]*Posts)\n\terr := Engine.Table(\"posts\").Where(\"post_date = ? and post_content_filtered = ? and guid = ?\", PostDate_, PostContentFiltered_, Guid_).Limit(limit, offset).Find(_Posts)\n\treturn _Posts, err\n}", "title": "" }, { "docid": "ba74e010d03e3a477a43d359271982d7", "score": "0.6073612", "text": "func GetPostsesByPostContentAndToPingAndPostContentFiltered(offset int, limit int, PostContent_ string, ToPing_ string, PostContentFiltered_ string) (*[]*Posts, error) {\n\tvar _Posts = new([]*Posts)\n\terr := Engine.Table(\"posts\").Where(\"post_content = ? and to_ping = ? and post_content_filtered = ?\", PostContent_, ToPing_, PostContentFiltered_).Limit(limit, offset).Find(_Posts)\n\treturn _Posts, err\n}", "title": "" }, { "docid": "71294169efef36e5de8f9f690ad3256e", "score": "0.60711193", "text": "func GetPostsesByToPingAndPinged(offset int, limit int, ToPing_ string, Pinged_ string) (*[]*Posts, error) {\n\tvar _Posts = new([]*Posts)\n\terr := Engine.Table(\"posts\").Where(\"to_ping = ? and pinged = ?\", ToPing_, Pinged_).Limit(limit, offset).Find(_Posts)\n\treturn _Posts, err\n}", "title": "" }, { "docid": "5bab091c6e0cc0650b125420f8d559ff", "score": "0.60700125", "text": "func (c *CXO) GetPosts(bpk cipher.PubKey, tRef skyobject.Reference) ([]*typ.Post, error) {\n\tc.Lock(c.GetPosts)\n\tdefer c.Unlock()\n\n\tvar reverse = true\n\n\tw := c.c.LastFullRoot(bpk).Walker()\n\tbc := &typ.BoardContainer{}\n\tif e := w.AdvanceFromRoot(bc, makeBoardContainerFinder(w.Root())); e != nil {\n\t\treturn nil, e\n\t}\n\ttp := &typ.ThreadPage{}\n\tif e := w.AdvanceFromRefsField(\"ThreadPages\", tp, makeThreadPageFinder(w, tRef)); e != nil {\n\t\treturn nil, e\n\t}\n\tposts := make([]*typ.Post, len(tp.Posts))\n\tobtainPost := func(i int, pRef skyobject.Reference) error {\n\t\tpData, has := c.c.Get(pRef)\n\t\tif has == false {\n\t\t\treturn nil\n\t\t}\n\t\tposts[i] = new(typ.Post)\n\t\tif e := encoder.DeserializeRaw(pData, posts[i]); e != nil {\n\t\t\treturn e\n\t\t}\n\t\tposts[i].Ref = cipher.SHA256(pRef).Hex()\n\t\treturn nil\n\t}\n\tif reverse {\n\t\tj := 0\n\t\tfor i := len(tp.Posts) - 1; i >= 0; i-- {\n\t\t\tif e := obtainPost(j, tp.Posts[i]); e != nil {\n\t\t\t\treturn nil, e\n\t\t\t}\n\t\t\tj += 1\n\t\t}\n\t} else {\n\t\tfor i, pRef := range tp.Posts {\n\t\t\tif e := obtainPost(i, pRef); e != nil {\n\t\t\t\treturn nil, e\n\t\t\t}\n\t\t}\n\t}\n\treturn posts, nil\n}", "title": "" }, { "docid": "71bd021bf654b94062e211400509564b", "score": "0.60692096", "text": "func GetPostsesByToPingAndPostContentFilteredAndPostMimeType(offset int, limit int, ToPing_ string, PostContentFiltered_ string, PostMimeType_ string) (*[]*Posts, error) {\n\tvar _Posts = new([]*Posts)\n\terr := Engine.Table(\"posts\").Where(\"to_ping = ? and post_content_filtered = ? and post_mime_type = ?\", ToPing_, PostContentFiltered_, PostMimeType_).Limit(limit, offset).Find(_Posts)\n\treturn _Posts, err\n}", "title": "" }, { "docid": "66c42643d5e08b9305756f4aac8d7083", "score": "0.606484", "text": "func GetPosts(groupID, count string) (*Posts, error) {\n\tbody, _, err := http.Get(fmt.Sprintf(\"%s/method/wall.get?owner_id=-%s&count=%s&filter=all&access_token=%s&v=%s\", APIURL, groupID, count, accessToken, APIVersion), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar posts Posts\n\tif err := json.Unmarshal(body, &posts); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &posts, nil\n}", "title": "" }, { "docid": "0d7bf44d4569f98c782cc4fd91b2597d", "score": "0.6063775", "text": "func GetPostsesByPostTitleAndPostContentFiltered(offset int, limit int, PostTitle_ string, PostContentFiltered_ string) (*[]*Posts, error) {\n\tvar _Posts = new([]*Posts)\n\terr := Engine.Table(\"posts\").Where(\"post_title = ? and post_content_filtered = ?\", PostTitle_, PostContentFiltered_).Limit(limit, offset).Find(_Posts)\n\treturn _Posts, err\n}", "title": "" }, { "docid": "1f9fffd8a1e7ec0fd29fbb302d5795af", "score": "0.6059958", "text": "func (b *Blog) GetPublishedPosts() []*Post {\n\tps := []*Post{}\n\tfor _, p := range b.Posts {\n\t\tif !p.IsDraft {\n\t\t\tps = append(ps, p)\n\t\t}\n\t}\n\tsort.Sort(sort.Reverse(ByTime(ps)))\n\treturn ps\n}", "title": "" }, { "docid": "fa676a38d197f79c4e7f66aa52bce020", "score": "0.60580647", "text": "func GetPostsesByPostDateAndToPingAndPostMimeType(offset int, limit int, PostDate_ time.Time, ToPing_ string, PostMimeType_ string) (*[]*Posts, error) {\n\tvar _Posts = new([]*Posts)\n\terr := Engine.Table(\"posts\").Where(\"post_date = ? and to_ping = ? and post_mime_type = ?\", PostDate_, ToPing_, PostMimeType_).Limit(limit, offset).Find(_Posts)\n\treturn _Posts, err\n}", "title": "" }, { "docid": "c30d8e22179fab7cced69c57f5dc1d51", "score": "0.6048991", "text": "func (pr *PostRepository) FindAllPublishByTag(page int, limit int, name string) (domain.Posts, error) {\n\tvar posts domain.Posts\n\trows, err := pr.ConnMySQL.Query(`\n\tSELECT\n\t\t*\n\tFROM\n\t\tview_posts\n\tWHERE\n\t\tid\n\tIN (\n\t\tSELECT\n \t\tpost_id\n\t\tFROM\n \ttags\n\t\tLEFT JOIN\n \ttag_post\n\t\tON\n \ttags.id = tag_post.tag_id\n\t\tWHERE\n\t\t\ttags.name = ?\n\t\t)\n\tORDER BY id\n\tLIMIT ?, ?\n\t`, name, page*limit-limit, limit)\n\n\tdefer func() {\n\t\tif rerr := rows.Close(); rerr != nil {\n\t\t\terr = rerr\n\t\t}\n\t}()\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor rows.Next() {\n\t\tvar (\n\t\t\tpostID int\n\t\t\tadminID int\n\t\t\tcategoryID int\n\t\t\tpostTitle string\n\t\t\tpostMDBody string\n\t\t\tpostHTMLBody string\n\t\t\tpostStatus string\n\t\t\tpostCreatedAt time.Time\n\t\t\tpostUpdatedAt time.Time\n\t\t\tadminName string\n\t\t\tadminEmail string\n\t\t\tadminPassword string\n\t\t\tadminCreatedAt time.Time\n\t\t\tadminUpdatedAt time.Time\n\t\t\tcategoryName string\n\t\t\tcategoryCreatedAt time.Time\n\t\t\tcategoryUpdatedAt time.Time\n\t\t)\n\t\tif err = rows.Scan(\n\t\t\t&postID,\n\t\t\t&adminID,\n\t\t\t&categoryID,\n\t\t\t&postTitle,\n\t\t\t&postMDBody,\n\t\t\t&postHTMLBody,\n\t\t\t&postStatus,\n\t\t\t&postCreatedAt,\n\t\t\t&postUpdatedAt,\n\t\t\t&adminName,\n\t\t\t&adminEmail,\n\t\t\t&adminPassword,\n\t\t\t&adminCreatedAt,\n\t\t\t&adminUpdatedAt,\n\t\t\t&categoryName,\n\t\t\t&categoryCreatedAt,\n\t\t\t&categoryUpdatedAt,\n\t\t); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpost := domain.Post{\n\t\t\tID: postID,\n\t\t\tAdmin: domain.Admin{\n\t\t\t\tID: adminID,\n\t\t\t\tName: adminName,\n\t\t\t\tEmail: adminEmail,\n\t\t\t\tPassword: adminPassword,\n\t\t\t\tCreatedAt: adminCreatedAt,\n\t\t\t\tUpdatedAt: adminUpdatedAt,\n\t\t\t},\n\t\t\tCategory: domain.Category{\n\t\t\t\tID: categoryID,\n\t\t\t\tName: categoryName,\n\t\t\t\tCreatedAt: categoryCreatedAt,\n\t\t\t\tUpdatedAt: categoryUpdatedAt,\n\t\t\t},\n\t\t\tTitle: postTitle,\n\t\t\tMDBody: postMDBody,\n\t\t\tHTMLBody: postHTMLBody,\n\t\t\tStatus: postStatus,\n\t\t\tCreatedAt: postCreatedAt,\n\t\t\tUpdatedAt: postUpdatedAt,\n\t\t}\n\t\tposts = append(posts, post)\n\t}\n\n\tif err = rows.Err(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tpostIDs := []int{}\n\tfor _, p := range posts {\n\t\tpostIDs = append(postIDs, p.ID)\n\t}\n\n\tqueryTag := `\n\t\tSELECT\n\t\t\ttag_post.post_id AS tag_post_post_id,\n\t\t\ttags.id AS tag_id,\n\t\t\ttags.name AS tag_name,\n\t\t\ttags.created_at AS tag_created_at,\n\t\t\ttags.updated_at AS tag_updated_at\n\t\tFROM\n\t\t\ttags\n\t\tLEFT JOIN\n\t\t\ttag_post\n\t\tON\n\t\t\ttags.id = tag_post.tag_id\n\t\tWHERE\n\t\t\ttag_post.post_id\n\t\tIN\n\t\t\t(%s)\n\t`\n\n\tvar stmt string\n\tif len(postIDs) == 0 {\n\t\tstmt = fmt.Sprintf(queryTag, `\"\"`)\n\t} else {\n\t\tstmt = fmt.Sprintf(queryTag, strings.Trim(strings.Replace(fmt.Sprint(postIDs), \" \", \",\", -1), \"[]\"))\n\t}\n\n\trows, err = pr.ConnMySQL.Query(stmt)\n\n\tdefer func() {\n\t\tif rerr := rows.Close(); rerr != nil {\n\t\t\terr = rerr\n\t\t}\n\t}()\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor rows.Next() {\n\t\tvar (\n\t\t\ttagPostPostID int\n\t\t\ttagID int\n\t\t\ttagName string\n\t\t\ttagCreatedAt time.Time\n\t\t\ttagUpdatedAt time.Time\n\t\t)\n\t\tif err = rows.Scan(&tagPostPostID, &tagID, &tagName, &tagCreatedAt, &tagUpdatedAt); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor p := range posts {\n\t\t\tif posts[p].ID == tagPostPostID {\n\t\t\t\tposts[p].Tags = append(posts[p].Tags, domain.Tag{\n\t\t\t\t\tID: tagID,\n\t\t\t\t\tName: tagName,\n\t\t\t\t\tCreatedAt: tagCreatedAt,\n\t\t\t\t\tUpdatedAt: tagUpdatedAt,\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n\n\tif err = rows.Err(); err != nil {\n\t\treturn nil, err\n\t}\n\n\trows, err = pr.ConnMySQL.Query(`\n\t\tSELECT\n\t\t\tcomments.id,\n \t\tcomments.post_id,\n \t\tcomments.body,\n \t\tcomments.status,\n \t\tcomments.created_at,\n \t\tcomments.updated_at\n\t\tFROM\n\t\t\tcomments\n\t\t\tJOIN\n\t\t\t\tposts\n\t\t\tON posts.id = comments.post_id\n\t\tWHERE\n\t\t\tposts.id IN(\n\t\t\t\tSELECT\n\t\t\t\t\ttag_post.post_id\n\t\t\t\tFROM\n\t\t\t\t\ttags\n\t\t\t\t\tLEFT JOIN\n\t\t\t\t\t\ttag_post\n\t\t\t\t\tON tags.id = tag_post.tag_id\n\t\t\t\tWHERE\n\t\t\t\t\ttags.name = ?\n\t\t\t)\n\t\tAND posts.status = \"publish\"\n\t\tAND comments.status = \"publish\"\n\t\tORDER BY\n\t\t\tposts.id\n\t\tLIMIT ?, ?\n\t`, name, page*limit-limit, limit)\n\n\tdefer func() {\n\t\tif rerr := rows.Close(); rerr != nil {\n\t\t\terr = rerr\n\t\t}\n\t}()\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor rows.Next() {\n\t\tvar (\n\t\t\tcommentID int\n\t\t\tcommentPostID int\n\t\t\tcommentBody string\n\t\t\tcommentStatus string\n\t\t\tcommentCreatedAt time.Time\n\t\t\tcommentUpdatedAt time.Time\n\t\t)\n\t\tif err = rows.Scan(&commentID, &commentPostID, &commentBody, &commentStatus, &commentCreatedAt, &commentUpdatedAt); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor p := range posts {\n\t\t\tif posts[p].ID == commentPostID {\n\t\t\t\tposts[p].Comments = append(posts[p].Comments, domain.Comment{\n\t\t\t\t\tID: commentID,\n\t\t\t\t\tPostID: commentPostID,\n\t\t\t\t\tBody: commentBody,\n\t\t\t\t\tStatus: commentStatus,\n\t\t\t\t\tCreatedAt: commentCreatedAt,\n\t\t\t\t\tUpdatedAt: commentUpdatedAt,\n\t\t\t\t})\n\t\t\t}\n\n\t\t}\n\t}\n\n\tif err = rows.Err(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn posts, nil\n}", "title": "" }, { "docid": "87a6e0c00fc90f82746f101dc4a5cc09", "score": "0.6045321", "text": "func GetPostsesByPostDateAndPostNameAndPostContentFiltered(offset int, limit int, PostDate_ time.Time, PostName_ string, PostContentFiltered_ string) (*[]*Posts, error) {\n\tvar _Posts = new([]*Posts)\n\terr := Engine.Table(\"posts\").Where(\"post_date = ? and post_name = ? and post_content_filtered = ?\", PostDate_, PostName_, PostContentFiltered_).Limit(limit, offset).Find(_Posts)\n\treturn _Posts, err\n}", "title": "" }, { "docid": "8fd80867766c5a141f17be6e2d6b4257", "score": "0.6043364", "text": "func (m *MongoStorage) GetMetaOfPosts(mq models.MongoQuery, limit int, offset int, sort string, embedded []string) ([]models.Post, int, error) {\n\tif embedded == nil {\n\t\tembedded = []string{\"hero_image\", \"leading_image_portrait\", \"categories\", \"tags\", \"topic\", \"og_image\", \"theme\"}\n\t}\n\n\treturn m._GetPosts(mq, limit, offset, sort, embedded, false)\n}", "title": "" }, { "docid": "789d6fc380ec52e8ed9117e356c6121b", "score": "0.60325456", "text": "func (v PostsResource) List(c buffalo.Context) error {\n\t// Get the DB connection from the context\n\ttx := c.Value(\"tx\").(*pop.Connection)\n\n\tposts := &models.Posts{}\n\t// You can order your list here. Just change\n\terrp := tx.Where(\"user_id = ?\", c.Value(\"current_user_id\")).All(posts)\n\n\t// to:\n\t// err := tx.Order(\"create_at desc\").All(posts)\n\tif errp != nil {\n\t\treturn errors.WithStack(errp)\n\t}\n\t// Make posts available inside the html template\n\tc.Set(\"posts\", posts)\n\n\treturn c.Render(200, r.HTML(\"posts/index.html\"))\n}", "title": "" }, { "docid": "3a1c6888d26ade2ea649d0f89df2f9fb", "score": "0.60286987", "text": "func GetPostsesByIdAndPostDateAndPostContentFiltered(offset int, limit int, Id_ int64, PostDate_ time.Time, PostContentFiltered_ string) (*[]*Posts, error) {\n\tvar _Posts = new([]*Posts)\n\terr := Engine.Table(\"posts\").Where(\"id = ? and post_date = ? and post_content_filtered = ?\", Id_, PostDate_, PostContentFiltered_).Limit(limit, offset).Find(_Posts)\n\treturn _Posts, err\n}", "title": "" }, { "docid": "25c6ecd1c5c994ad39ecc34ae03f83dc", "score": "0.60268813", "text": "func GetPostsesByPostContentAndPostNameAndToPing(offset int, limit int, PostContent_ string, PostName_ string, ToPing_ string) (*[]*Posts, error) {\n\tvar _Posts = new([]*Posts)\n\terr := Engine.Table(\"posts\").Where(\"post_content = ? and post_name = ? and to_ping = ?\", PostContent_, PostName_, ToPing_).Limit(limit, offset).Find(_Posts)\n\treturn _Posts, err\n}", "title": "" }, { "docid": "a25f555be1106b0889eeb5fd0ddf9bbb", "score": "0.6026258", "text": "func GetPostsesByPostContentAndPostContentFiltered(offset int, limit int, PostContent_ string, PostContentFiltered_ string) (*[]*Posts, error) {\n\tvar _Posts = new([]*Posts)\n\terr := Engine.Table(\"posts\").Where(\"post_content = ? and post_content_filtered = ?\", PostContent_, PostContentFiltered_).Limit(limit, offset).Find(_Posts)\n\treturn _Posts, err\n}", "title": "" }, { "docid": "98589ae5bb8a8d5c2d2411af29820c60", "score": "0.6025671", "text": "func getPosts(ctx context.Context, feeds []string) []*Post {\n\tvar posts []*Post\n\tfor _, feed := range feeds {\n\t\tparser := gofeed.NewParser()\n\t\tfeed, err := parser.ParseURLWithContext(feed, ctx)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\t\tfor _, item := range feed.Items {\n\t\t\tpublished := item.PublishedParsed\n\t\t\tif published == nil {\n\t\t\t\tpublished = item.UpdatedParsed\n\t\t\t}\n\t\t\tif published.Before(time.Now().Add(-relevantDuration)) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tparsedLink, err := url.Parse(item.Link)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t}\n\t\t\tposts = append(posts, &Post{\n\t\t\t\tLink: item.Link,\n\t\t\t\tTitle: item.Title,\n\t\t\t\tPublished: *published,\n\t\t\t\tHost: parsedLink.Host,\n\t\t\t})\n\t\t}\n\t}\n\n\t// Sort items chronologically descending\n\tsort.Slice(posts, func(i, j int) bool {\n\t\treturn posts[i].Published.After(posts[j].Published)\n\t})\n\n\treturn posts\n}", "title": "" }, { "docid": "09999a566f362c9dc2c9c1eac024db1b", "score": "0.6025411", "text": "func GetPostsesByPostNameAndToPingAndPostContentFiltered(offset int, limit int, PostName_ string, ToPing_ string, PostContentFiltered_ string) (*[]*Posts, error) {\n\tvar _Posts = new([]*Posts)\n\terr := Engine.Table(\"posts\").Where(\"post_name = ? and to_ping = ? and post_content_filtered = ?\", PostName_, ToPing_, PostContentFiltered_).Limit(limit, offset).Find(_Posts)\n\treturn _Posts, err\n}", "title": "" }, { "docid": "cbc7b054883d8b5be049fd0b4b7cacf7", "score": "0.60244757", "text": "func (db *PostDBPGX) ListPost(username string, createdAtSortOrder SortOrder) ([]*Post, error) {\n\tconn, err := pgx.Connect(context.Background(), db.URL)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer conn.Close(context.Background())\n\n\tsortOrder := createdAtSortOrder\n\n\trows, err := conn.Query(context.Background(),\n\t\tfmt.Sprintf(\"SELECT id, username, description, created_at FROM post WHERE username = COALESCE(NULLIF($1, ''), username) ORDER BY created_at %s\", sortOrder),\n\t\tusername)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\n\tpostList := make([]*Post, 0)\n\tfor rows.Next() {\n\t\tvar post Post\n\t\tif err := rows.Scan(&post.ID, &post.Username, &post.Description, &post.CreatedAt); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpostList = append(postList, &post)\n\t}\n\n\treturn postList, nil\n}", "title": "" }, { "docid": "1da907808ed827bb2f85007fc0b9b9be", "score": "0.60162747", "text": "func GetPostsesByPostDateAndPostNameAndToPing(offset int, limit int, PostDate_ time.Time, PostName_ string, ToPing_ string) (*[]*Posts, error) {\n\tvar _Posts = new([]*Posts)\n\terr := Engine.Table(\"posts\").Where(\"post_date = ? and post_name = ? and to_ping = ?\", PostDate_, PostName_, ToPing_).Limit(limit, offset).Find(_Posts)\n\treturn _Posts, err\n}", "title": "" }, { "docid": "9920df397cb8286fa0d354e71384b40e", "score": "0.6015215", "text": "func GetPostsesByPostDateAndPostStatusAndPostContentFiltered(offset int, limit int, PostDate_ time.Time, PostStatus_ string, PostContentFiltered_ string) (*[]*Posts, error) {\n\tvar _Posts = new([]*Posts)\n\terr := Engine.Table(\"posts\").Where(\"post_date = ? and post_status = ? and post_content_filtered = ?\", PostDate_, PostStatus_, PostContentFiltered_).Limit(limit, offset).Find(_Posts)\n\treturn _Posts, err\n}", "title": "" }, { "docid": "1a97b5ec2daf487fd4a03a45065179a1", "score": "0.6014013", "text": "func GetPostsesByPostDateAndToPingAndPinged(offset int, limit int, PostDate_ time.Time, ToPing_ string, Pinged_ string) (*[]*Posts, error) {\n\tvar _Posts = new([]*Posts)\n\terr := Engine.Table(\"posts\").Where(\"post_date = ? and to_ping = ? and pinged = ?\", PostDate_, ToPing_, Pinged_).Limit(limit, offset).Find(_Posts)\n\treturn _Posts, err\n}", "title": "" }, { "docid": "d8f5d90d9490f5ba9277b9e00f1aaf3c", "score": "0.60115373", "text": "func GetPostsesByPostDateAndPostContentAndCommentCount(offset int, limit int, PostDate_ time.Time, PostContent_ string, CommentCount_ int64) (*[]*Posts, error) {\n\tvar _Posts = new([]*Posts)\n\terr := Engine.Table(\"posts\").Where(\"post_date = ? and post_content = ? and comment_count = ?\", PostDate_, PostContent_, CommentCount_).Limit(limit, offset).Find(_Posts)\n\treturn _Posts, err\n}", "title": "" }, { "docid": "435fddf952b7bfbe5ce074e3d8930ffe", "score": "0.6009242", "text": "func GetPostsesByPostContentFilteredAndPostMimeType(offset int, limit int, PostContentFiltered_ string, PostMimeType_ string) (*[]*Posts, error) {\n\tvar _Posts = new([]*Posts)\n\terr := Engine.Table(\"posts\").Where(\"post_content_filtered = ? and post_mime_type = ?\", PostContentFiltered_, PostMimeType_).Limit(limit, offset).Find(_Posts)\n\treturn _Posts, err\n}", "title": "" }, { "docid": "87f9224a6ec3125bdbb804f65458c5a9", "score": "0.60076946", "text": "func GetPostsesByPostContentFilteredAndGuid(offset int, limit int, PostContentFiltered_ string, Guid_ string) (*[]*Posts, error) {\n\tvar _Posts = new([]*Posts)\n\terr := Engine.Table(\"posts\").Where(\"post_content_filtered = ? and guid = ?\", PostContentFiltered_, Guid_).Limit(limit, offset).Find(_Posts)\n\treturn _Posts, err\n}", "title": "" }, { "docid": "527e9be18bea2d1aeeda964ccc776d3d", "score": "0.60043406", "text": "func getPosts(w http.ResponseWriter, r *http.Request) {\n\n\n\n\n\n\n\n\t\tif (r.Method == \"GET\"){\n\n\n\t\t\t//fmt.Fprintln(w,r.URL.Path[len(\"/get/\"):] )\n\t\t\tc := appengine.NewContext(r)\n\n\n\n\n\t\t\tif(r.URL.Path[len(\"/get/\"):]!=\"\"){\n\n\t\t\t\tid,_:=strconv.ParseInt(r.URL.Path[len(\"/get/\"):], 10, 64)\n\t\t\t\t\n\t\t\t\t//controllare errore\n\n\t\t\t\tq := datastore.NewQuery(\"Post\").Filter(\"ID=\",id)\n\t\t\t\tposts := make([]Post, 0, 10)\n\t\t\t\tif _, err := q.GetAll(c, &posts); err != nil {\n\t\t\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tp:=posts[0]\n\t\t\t\tb, err := json.Marshal(p)\n\t\t\t\tif err != nil {\n\t\t\t\t\tfmt.Println(\"error:\", err)\n\t\t\t\t}\n\n\t\t\t\tfmt.Fprint(w, string(b))\n\n\t\t\t\t\n\n\t\t\t} else {\n\n\t\t\t\t\n\n\t\t\t\tq := datastore.NewQuery(\"Post\")\n\n\n\t\t\t\tposts := make([]Post, 0, 10)\n\t\t\t\tif _, err := q.GetAll(c, &posts); err != nil {\n\t\t\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\n\t\t//fmt.Fprintln(w, posts)\n\t\t\t\tb, err := json.Marshal(posts)\n\t\t\t\tif err != nil {\n\t\t\t\t\tfmt.Println(\"error:\", err)\n\t\t\t\t}\n\n\t\t\t\tfmt.Fprint(w, string(b))\n\n\n\t\t\t}\n\n\n\n\t\t} else {\n\n\n\n\t\t\thttp.Error(w, \"Wrong Method\", http.StatusMethodNotAllowed)\n\t\t\treturn\n\n\t\t}\n\n\t}", "title": "" }, { "docid": "94b616fb9d59b42dd32c6972cacfa0c2", "score": "0.6002788", "text": "func GetPostsesByPostDateAndPostTitle(offset int, limit int, PostDate_ time.Time, PostTitle_ string) (*[]*Posts, error) {\n\tvar _Posts = new([]*Posts)\n\terr := Engine.Table(\"posts\").Where(\"post_date = ? and post_title = ?\", PostDate_, PostTitle_).Limit(limit, offset).Find(_Posts)\n\treturn _Posts, err\n}", "title": "" }, { "docid": "be818d06b725cdc7e7dfc01073c54db6", "score": "0.60017425", "text": "func GetPostsesByToPingAndPostContentFilteredAndMenuOrder(offset int, limit int, ToPing_ string, PostContentFiltered_ string, MenuOrder_ int) (*[]*Posts, error) {\n\tvar _Posts = new([]*Posts)\n\terr := Engine.Table(\"posts\").Where(\"to_ping = ? and post_content_filtered = ? and menu_order = ?\", ToPing_, PostContentFiltered_, MenuOrder_).Limit(limit, offset).Find(_Posts)\n\treturn _Posts, err\n}", "title": "" }, { "docid": "24159d2d56b18dc6dc71edc2c71d45e8", "score": "0.60007894", "text": "func GetPostsesByPostDateAndToPingAndCommentCount(offset int, limit int, PostDate_ time.Time, ToPing_ string, CommentCount_ int64) (*[]*Posts, error) {\n\tvar _Posts = new([]*Posts)\n\terr := Engine.Table(\"posts\").Where(\"post_date = ? and to_ping = ? and comment_count = ?\", PostDate_, ToPing_, CommentCount_).Limit(limit, offset).Find(_Posts)\n\treturn _Posts, err\n}", "title": "" } ]
a58579fa20063134a80370c8cb73e4c0
Tenant applies equality check predicate on the "tenant" field. It's identical to TenantEQ.
[ { "docid": "04ee0e778c15c637161d44869876e0f2", "score": "0.74262494", "text": "func Tenant(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldTenant), v))\n\t})\n}", "title": "" } ]
[ { "docid": "1761e908968e2877eca7ae379ed22480", "score": "0.7979707", "text": "func TenantEQ(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldTenant), v))\n\t})\n}", "title": "" }, { "docid": "e3fba123da88b5278137f3215d6a1308", "score": "0.7464882", "text": "func TenantEqualFold(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.EqualFold(s.C(FieldTenant), v))\n\t})\n}", "title": "" }, { "docid": "44b04d6e0096272198cb0724042095ab", "score": "0.6574943", "text": "func TenantGTE(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldTenant), v))\n\t})\n}", "title": "" }, { "docid": "a5677d678d2c2668ab08674abb15aad0", "score": "0.65715593", "text": "func TenantContains(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.Contains(s.C(FieldTenant), v))\n\t})\n}", "title": "" }, { "docid": "bdc018fae2ddbabc72ce79058737d4dc", "score": "0.63618845", "text": "func TenantContainsFold(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldTenant), v))\n\t})\n}", "title": "" }, { "docid": "876f23b1f64657d1889c1335a19a037c", "score": "0.6281489", "text": "func TenantIn(vs ...string) predicate.User {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.User(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(FieldTenant), v...))\n\t})\n}", "title": "" }, { "docid": "e3ce725271253bbc0560cbabfdd335d0", "score": "0.6160589", "text": "func (m *LeaseMutation) Tenant() (r string, exists bool) {\n\tv := m.tenant\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "3ce06167b406153afbb32de4bb1bb973", "score": "0.6120729", "text": "func (m *UserMutation) Tenant() (r string, exists bool) {\n\tv := m.tenant\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "1f5471ca347e32551cfe1258d1278ce5", "score": "0.60445887", "text": "func TenantGT(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldTenant), v))\n\t})\n}", "title": "" }, { "docid": "3ee4a721acd84f7d1cd057172f6bdaf8", "score": "0.6024938", "text": "func TenantLTE(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldTenant), v))\n\t})\n}", "title": "" }, { "docid": "d74d9e15e17f5cec3f4317ea3c4e8c54", "score": "0.59914863", "text": "func IsTenant(tenant string) bool {\n\tif exists := isTenant(tenant); exists {\n\t\treturn true\n\t}\n\n\tif err := updateTenants(); err != nil {\n\t\tlog.Errorf(\"failed to query admin/v2/tenants error: %v\", err)\n\t}\n\treturn isTenant(tenant)\n}", "title": "" }, { "docid": "830563c1431eb62514c0a1a09195bd64", "score": "0.585784", "text": "func (s *MultiElasticsearch) Tenant(tenant string) Store {\n\tkv, found := s.stores[tenant]\n\tif !found {\n\t\tkv = NewElasticsearch(s.config, s.client, tenant, s.typeName)\n\t\ts.stores[tenant] = kv\n\t}\n\treturn kv\n}", "title": "" }, { "docid": "ad23c23eb5c61b82245381460c08e4ba", "score": "0.5806529", "text": "func TenantHasSuffix(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldTenant), v))\n\t})\n}", "title": "" }, { "docid": "f546d5a37bb78deaab7d677a4a113aa7", "score": "0.57031536", "text": "func TenantLT(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldTenant), v))\n\t})\n}", "title": "" }, { "docid": "b3aef6493b555dd7c669e30f7f3e7e9a", "score": "0.5692928", "text": "func TenantNEQ(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.NEQ(s.C(FieldTenant), v))\n\t})\n}", "title": "" }, { "docid": "3e24fd32ca6ff50b9bbeebd62555e27b", "score": "0.5609443", "text": "func Tenant(tenant string) Modifier {\n\treturn func(r *http.Request) error {\n\t\tr.Header.Set(\"Hawkular-Tenant\", tenant)\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "3e24fd32ca6ff50b9bbeebd62555e27b", "score": "0.5609443", "text": "func Tenant(tenant string) Modifier {\n\treturn func(r *http.Request) error {\n\t\tr.Header.Set(\"Hawkular-Tenant\", tenant)\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "b3c0224373e6ccbb23f30db5b535bdb1", "score": "0.55181104", "text": "func TenantNotIn(vs ...string) predicate.User {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.User(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.NotIn(s.C(FieldTenant), v...))\n\t})\n}", "title": "" }, { "docid": "9c87ea4b3bc82a3bfceafb439188f65c", "score": "0.5431992", "text": "func TenantHasPrefix(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldTenant), v))\n\t})\n}", "title": "" }, { "docid": "b0e8bd4f6bbdfc657de8f5462ad15b19", "score": "0.54053026", "text": "func (o FioSpecVolumeVolumeSourceQuobyteOutput) Tenant() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v FioSpecVolumeVolumeSourceQuobyte) *string { return v.Tenant }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "3d66a819391dbdc0f8c1ecde3acc3e16", "score": "0.5376263", "text": "func (nuo *NodeUpdateOne) SetTenant(s string) *NodeUpdateOne {\n\tnuo.mutation.SetTenant(s)\n\treturn nuo\n}", "title": "" }, { "docid": "80b06d6de823c68038dfae3f0fa200b5", "score": "0.53668463", "text": "func (o *StorageNetAppCifsShareAllOf) SetTenant(v StorageNetAppStorageVmRelationship) {\n\to.Tenant = &v\n}", "title": "" }, { "docid": "101d6680eb946617f614328bbe873c05", "score": "0.5357093", "text": "func (uuo *UserUpdateOne) SetTenant(s string) *UserUpdateOne {\n\tuuo.mutation.SetTenant(s)\n\treturn uuo\n}", "title": "" }, { "docid": "5abf62b5ce7b96e9aab4f96bdfb5d5f2", "score": "0.5343512", "text": "func (r *queryResolver) TenantByExternalID(ctx context.Context, id string) (*graphql.Tenant, error) {\n\treturn r.tenant.Tenant(ctx, id)\n}", "title": "" }, { "docid": "f55adea453282a3a3152df15214ff055", "score": "0.5335252", "text": "func (o IopingSpecVolumeVolumeSourceQuobyteOutput) Tenant() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v IopingSpecVolumeVolumeSourceQuobyte) *string { return v.Tenant }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "02d949c3a376208f29ced80c5ed2be61", "score": "0.53133583", "text": "func TenantResourceQuota(tenant string) string {\n\treturn tenant\n}", "title": "" }, { "docid": "5151c8de883a55d7c3eea46ef3e73c0d", "score": "0.53058904", "text": "func (t *Tenants) Set(tenant *Tenant) error {\n\tw := &bytes.Buffer{}\n\tif err := tenant.Encode(w); err != nil {\n\t\treturn err\n\t}\n\treturn t.store.Set(tenant.ID, w.Bytes())\n}", "title": "" }, { "docid": "b16895e374f84a8a5c8c1840bb55b9b7", "score": "0.53056663", "text": "func (uu *UserUpdate) SetTenant(s string) *UserUpdate {\n\tuu.mutation.SetTenant(s)\n\treturn uu\n}", "title": "" }, { "docid": "86c2cc237fd2b44d00c1729972e4c613", "score": "0.5304801", "text": "func (m *UserMutation) SetTenant(s string) {\n\tm.tenant = &s\n}", "title": "" }, { "docid": "92e25cdfc445cf16a0c5a213806a3c30", "score": "0.5292064", "text": "func (a *DefaultApiService) ShowTenant(ctx _context.Context, id string) ApiShowTenantRequest {\n\treturn ApiShowTenantRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tid: id,\n\t}\n}", "title": "" }, { "docid": "3b923ff50787b780e096821656831ead", "score": "0.5285859", "text": "func (o *GetDeploymentPreview1Params) SetTenant(tenant string) {\n\to.Tenant = tenant\n}", "title": "" }, { "docid": "4ec3d434b3a2e0c332cc02f0e8ac32b0", "score": "0.528268", "text": "func (nu *NodeUpdate) SetTenant(s string) *NodeUpdate {\n\tnu.mutation.SetTenant(s)\n\treturn nu\n}", "title": "" }, { "docid": "9247d99c601ce868e311c95aec5baecd", "score": "0.52798223", "text": "func (o *DcimSitesReadParams) SetTenant(tenant *string) {\n\to.Tenant = tenant\n}", "title": "" }, { "docid": "b0aff678be78fcf6c231cf8152fab0c7", "score": "0.5248949", "text": "func (m *LeaseMutation) SetTenant(s string) {\n\tm.tenant = &s\n}", "title": "" }, { "docid": "61812771cc8212b1939aea584d101f59", "score": "0.5230376", "text": "func SubEQ(v string) predicate.Account {\n\treturn predicate.Account(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldSub), v))\n\t})\n}", "title": "" }, { "docid": "f4b861023b6f2aa08d36126e804ac655", "score": "0.52254", "text": "func withTenant(node *Tenant) tenantOption {\n\treturn func(m *TenantMutation) {\n\t\tm.oldValue = func(context.Context) (*Tenant, error) {\n\t\t\treturn node, nil\n\t\t}\n\t\tm.id = &node.ID\n\t}\n}", "title": "" }, { "docid": "ea6f766dec9c8e2b522477af78962075", "score": "0.52113277", "text": "func SetTenant(tenant string) func(*AviSession) error {\n\treturn func(sess *AviSession) error {\n\t\treturn sess.setTenant(tenant)\n\t}\n}", "title": "" }, { "docid": "44a5a781d3ae650503603b43febca300", "score": "0.5203279", "text": "func (gc *GroupCreate) SetTenant(s string) *GroupCreate {\n\tgc.mutation.SetTenant(s)\n\treturn gc\n}", "title": "" }, { "docid": "b5915d8145a51340e920e69ab5284aac", "score": "0.5155065", "text": "func (c *TenantController) Update(ctx *app.UpdateTenantContext) error {\n\tuserToken := goajwt.ContextJWT(ctx)\n\tif userToken == nil {\n\t\treturn jsonapi.JSONErrorResponse(ctx, errors.NewUnauthorizedError(\"Missing JWT token\"))\n\t}\n\tttoken := &auth.TenantToken{Token: userToken}\n\ttenant, err := c.tenantService.GetTenant(ttoken.Subject())\n\tif err != nil {\n\t\treturn jsonapi.JSONErrorResponse(ctx, errors.NewNotFoundError(\"tenants\", ttoken.Subject().String()))\n\t}\n\n\t// fetch the cluster the user belongs to\n\tuser, err := c.authClientService.GetUser(ctx)\n\tif err != nil {\n\t\treturn jsonapi.JSONErrorResponse(ctx, err)\n\t}\n\n\tif user.UserData.Cluster == nil {\n\t\tlog.Error(ctx, nil, \"no cluster defined for tenant\")\n\t\treturn jsonapi.JSONErrorResponse(ctx, errors.NewInternalError(ctx, fmt.Errorf(\"unable to provision to undefined cluster\")))\n\t}\n\n\tcluster, err := c.clusterService.GetCluster(ctx, *user.UserData.Cluster)\n\tif err != nil {\n\t\tlog.Error(ctx, map[string]interface{}{\n\t\t\t\"err\": err,\n\t\t\t\"cluster_url\": *user.UserData.Cluster,\n\t\t}, \"unable to fetch cluster\")\n\t\treturn jsonapi.JSONErrorResponse(ctx, errors.NewInternalError(ctx, err))\n\t}\n\n\t// create openshift config\n\topenshiftConfig := openshift.NewConfig(c.config, user.UserData, cluster.User, cluster.Token, cluster.APIURL)\n\n\t// update tenant config\n\ttenant.OSUsername = user.OpenShiftUsername\n\tif tenant.NsBaseName == \"\" {\n\t\ttenant.NsBaseName = env.RetrieveUserName(user.OpenShiftUsername)\n\t}\n\tif err = c.tenantService.SaveTenant(tenant); err != nil {\n\t\tlog.Error(ctx, map[string]interface{}{\n\t\t\t\"err\": err,\n\t\t}, \"unable to update tenant configuration\")\n\t\treturn jsonapi.JSONErrorResponse(ctx, errors.NewInternalError(ctx, fmt.Errorf(\"unable to update tenant configuration: %v\", err)))\n\t}\n\n\tgo func() {\n\t\tctx := ctx\n\t\tt := tenant\n\t\terr = openshift.RawUpdateTenant(\n\t\t\tctx,\n\t\t\topenshiftConfig,\n\t\t\tInitTenant(ctx, openshiftConfig.MasterURL, c.tenantService, t),\n\t\t\tuser.OpenShiftUsername,\n\t\t\ttenant.NsBaseName)\n\n\t\tif err != nil {\n\t\t\tsentry.LogError(ctx, map[string]interface{}{\n\t\t\t\t\"os_user\": user.OpenShiftUsername,\n\t\t\t}, err, \"unable initialize tenant\")\n\t\t}\n\t}()\n\n\tctx.ResponseData.Header().Set(\"Location\", rest.AbsoluteURL(ctx.RequestData.Request, app.TenantHref()))\n\treturn ctx.Accepted()\n}", "title": "" }, { "docid": "2d95e4dea33de809dd385cad9dca9b54", "score": "0.51409334", "text": "func TransfertobankaccountEQ(v float64) predicate.Bulk {\n\treturn predicate.Bulk(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldTransfertobankaccount), v))\n\t})\n}", "title": "" }, { "docid": "3edbbd053c464942ac52b5bce06faa9e", "score": "0.51378256", "text": "func SecretEQ(v string) predicate.Account {\n\treturn predicate.Account(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldSecret), v))\n\t})\n}", "title": "" }, { "docid": "5d77e28b449d7b19fe5a6ec90bd0cd75", "score": "0.5129777", "text": "func TenantExists(ctx context.Context, exec boil.ContextExecutor, iD string) (bool, error) {\n\tvar exists bool\n\tsql := \"select exists(select 1 from `tenants` where `id`=? limit 1)\"\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, iD)\n\t}\n\trow := exec.QueryRowContext(ctx, sql, iD)\n\n\terr := row.Scan(&exists)\n\tif err != nil {\n\t\treturn false, errors.Wrap(err, \"dbmodel: unable to check if tenants exists\")\n\t}\n\n\treturn exists, nil\n}", "title": "" }, { "docid": "4dc8b4da6d79706a7d69037b9abd8a1f", "score": "0.5102901", "text": "func (o *DcimRacksListParams) SetTenant(tenant *string) {\n\to.Tenant = tenant\n}", "title": "" }, { "docid": "848000ebfae2af3ee429203dc3886611", "score": "0.5102099", "text": "func (db *MySQLDB) UpdateTenant(ctx context.Context, tenant *Tenant) error {\n\tfLog := mysqlLog.WithField(\"func\", \"UpdateTenant\").WithField(\"RequestID\", ctx.Value(constants.RequestID))\n\n\texist, err := db.IsTenantRecIDExist(ctx, tenant.RecID)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !exist {\n\t\treturn ErrNotFound\n\t}\n\n\torigin, err := db.GetTenantByRecID(ctx, tenant.RecID)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdomainChanged := origin.Domain != tenant.Domain\n\n\tq := \"UPDATE HANSIP_TENANT SET TENANT_NAME=?, TENANT_DOMAIN=?, DESCRIPTION=? WHERE REC_ID=?\"\n\t_, err = db.instance.ExecContext(ctx, q,\n\t\ttenant.Name, tenant.Domain, tenant.Description, tenant.RecID)\n\tif err != nil {\n\t\tfLog.Errorf(\"db.instance.ExecContext got %s. SQL = %s\", err.Error(), q)\n\t\treturn &ErrDBExecuteError{\n\t\t\tWrapped: err,\n\t\t\tMessage: \"Error UpdateTenant\",\n\t\t\tSQL: q,\n\t\t}\n\t}\n\n\tif domainChanged {\n\t\tq = \"UPDATE HANSIP_ROLE SET ROLE_DOMAIN=? WHERE ROLE_DOMAIN=?\"\n\t\t_, err = db.instance.ExecContext(ctx, q,\n\t\t\ttenant.Domain, origin.Domain)\n\t\tif err != nil {\n\t\t\tfLog.Errorf(\"db.instance.ExecContext got %s. SQL = %s\", err.Error(), q)\n\t\t\treturn &ErrDBExecuteError{\n\t\t\t\tWrapped: err,\n\t\t\t\tMessage: \"Error UpdateTenant\",\n\t\t\t\tSQL: q,\n\t\t\t}\n\t\t}\n\n\t\tq = \"UPDATE HANSIP_GROUP SET GROUP_DOMAIN=? WHERE GROUP_DOMAIN=?\"\n\t\t_, err = db.instance.ExecContext(ctx, q,\n\t\t\ttenant.Domain, origin.Domain)\n\t\tif err != nil {\n\t\t\tfLog.Errorf(\"db.instance.ExecContext got %s. SQL = %s\", err.Error(), q)\n\t\t\treturn &ErrDBExecuteError{\n\t\t\t\tWrapped: err,\n\t\t\t\tMessage: \"Error UpdateTenant\",\n\t\t\t\tSQL: q,\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b01f0d557d4e0c38c1d7eea611457ffb", "score": "0.5101458", "text": "func (ct *ctrlerCtx) WatchTenant(handler TenantHandler) error {\n\tkind := \"Tenant\"\n\n\t// see if we already have a watcher\n\tct.Lock()\n\t_, ok := ct.watchCancel[kind]\n\tct.Unlock()\n\tif ok {\n\t\treturn fmt.Errorf(\"Tenant watcher already exists\")\n\t}\n\n\t// save handler\n\tct.Lock()\n\tct.handlers[kind] = handler\n\tct.Unlock()\n\n\t// run Tenant watcher in a go routine\n\tct.runTenantWatcher()\n\n\treturn nil\n}", "title": "" }, { "docid": "6945f52d2e0ec595c8a0e750fb12c6b9", "score": "0.50954044", "text": "func (d *DB) TenantDB(schema string) *pg.DB {\n\treturn d.tenantDB.WithParam(\"schema\", pg.Ident(schema)).WithContext(context.WithValue(context.Background(), KeySchema, schema))\n}", "title": "" }, { "docid": "0d5d2788d6678bfb9ca0a4cea6e676bb", "score": "0.5091756", "text": "func (api *tenantAPI) Update(obj *cluster.Tenant) 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 err\n\t\t}\n\n\t\t_, err = apicl.ClusterV1().Tenant().Update(context.Background(), obj)\n\t\treturn err\n\t}\n\n\tapi.ct.handleTenantEvent(&kvstore.WatchEvent{Object: obj, Type: kvstore.Updated})\n\treturn nil\n}", "title": "" }, { "docid": "7bdb9b95b6bc9c5c45f7fbebba8ad437", "score": "0.50799596", "text": "func (s *AppAuthorizationSummary) SetTenant(v *Tenant) *AppAuthorizationSummary {\n\ts.Tenant = v\n\treturn s\n}", "title": "" }, { "docid": "13ee2c81348d9583e8b21e60e0f4330c", "score": "0.5074973", "text": "func ShowTenant(ctx context.Context, config tenantConfig) (*tenant.TenantSingle, error) {\n\n\tc, err := createClient(ctx, config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tres, err := c.ShowTenant(goasupport.ForwardContextRequestID(ctx), tenant.ShowTenantPath())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif res.StatusCode == http.StatusOK {\n\t\ttenant, err := c.DecodeTenantSingle(res)\n\t\tif err != nil {\n\t\t\treturn nil, errors.NewInternalError(ctx, err)\n\t\t}\n\t\treturn tenant, nil\n\t} else if res.StatusCode > 400 {\n\t\tjsonErr, err := c.DecodeJSONAPIErrors(res)\n\t\tif err == nil {\n\t\t\tif len(jsonErr.Errors) > 0 {\n\t\t\t\treturn nil, errors.NewInternalError(ctx, fmt.Errorf(jsonErr.Errors[0].Detail))\n\t\t\t}\n\t\t}\n\t}\n\treturn nil, errors.NewInternalError(ctx, fmt.Errorf(\"Unknown response \"+res.Status))\n}", "title": "" }, { "docid": "159cf5c74fab1b74e752f24061d44f31", "score": "0.50749034", "text": "func tenantHandler(formatter *render.Render) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, req *http.Request) {\n\t\tsetupResponse(&w, req)\n\n\t\tif (*req).Method == \"OPTIONS\" {\n\t\t\tfmt.Println(\"PREFLIGHT Request\")\n\t\t\treturn\n\t\t}\n\t\tsession, err := mgo.Dial(mongodb_server)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tdefer session.Close()\n\t\tsession.SetMode(mgo.Monotonic, true)\n\t\tparams := mux.Vars(req)\n\t\tvar id string = params[\"id\"]\n\t\tfmt.Println(\"Tenant ID: \", id)\n\t\tvar result bson.M\n\t\tif id == \"\" {\n\t\t\tformatter.JSON(w, http.StatusBadRequest, \"Tenant ID Missing\")\n\t\t} else {\n\t\t\tc := session.DB(mongodb_database).C(mongodb_collection)\n\t\t\terr = c.Find(bson.M{\"id\":id}).One(&result)\n\t\t\tif err != nil {\n\t\t\tfmt.Println(\" Tenant: \", err)\n\t\t\tformatter.JSON(w, http.StatusBadRequest, \"Not Found\")\n\t\t\t}\n\t\t\tfmt.Println(\" Tenant: \", result)\n\t\t\tformatter.JSON(w, http.StatusOK, result)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "65fd314767440d9af642629daa32e566", "score": "0.50675106", "text": "func (ct *ctrlerCtx) diffTenant(apicl apiclient.Services) {\n\topts := api.ListWatchOptions{}\n\n\t// get a list of all objects from API server\n\tobjlist, err := apicl.ClusterV1().Tenant().List(context.Background(), &opts)\n\tif err != nil {\n\t\tct.logger.Errorf(\"Error getting a list of objects. Err: %v\", err)\n\t\treturn\n\t}\n\n\tct.logger.Infof(\"diffTenant(): TenantList returned %d objects\", len(objlist))\n\n\t// build an object map\n\tobjmap := make(map[string]*cluster.Tenant)\n\tfor _, obj := range objlist {\n\t\tobjmap[obj.GetKey()] = obj\n\t}\n\n\tlist, err := ct.Tenant().List(context.Background(), &opts)\n\tif err != nil && !strings.Contains(err.Error(), \"not found in local cache\") {\n\t\tct.logger.Infof(\"Failed to get a list of objects. Err: %s\", err)\n\t\treturn\n\t}\n\n\t// if an object is in our local cache and not in API server, trigger delete for it\n\tfor _, obj := range list {\n\t\t_, ok := objmap[obj.GetKey()]\n\t\tif !ok {\n\t\t\tct.logger.Infof(\"diffTenant(): Deleting existing object %#v since its not in apiserver\", obj.GetKey())\n\t\t\tevt := kvstore.WatchEvent{\n\t\t\t\tType: kvstore.Deleted,\n\t\t\t\tKey: obj.GetKey(),\n\t\t\t\tObject: &obj.Tenant,\n\t\t\t}\n\t\t\tct.handleTenantEvent(&evt)\n\t\t}\n\t}\n\n\t// trigger create event for all others\n\tfor _, obj := range objlist {\n\t\tct.logger.Infof(\"diffTenant(): Adding object %#v\", obj.GetKey())\n\t\tevt := kvstore.WatchEvent{\n\t\t\tType: kvstore.Created,\n\t\t\tKey: obj.GetKey(),\n\t\t\tObject: obj,\n\t\t}\n\t\tct.handleTenantEvent(&evt)\n\t}\n}", "title": "" }, { "docid": "16fc2589492e54371571349450cfd2d3", "score": "0.50373024", "text": "func (o FioSpecVolumeVolumeSourceQuobytePtrOutput) Tenant() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *FioSpecVolumeVolumeSourceQuobyte) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Tenant\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "e70a5dd93082162a340447b1083d184d", "score": "0.5037038", "text": "func (tq *TenantQuery) Unique(unique bool) *TenantQuery {\n\ttq.ctx.Unique = &unique\n\treturn tq\n}", "title": "" }, { "docid": "267043538c7e575124ede92f8931e426", "score": "0.5025498", "text": "func (s *UpdateAppAuthorizationInput) SetTenant(v *Tenant) *UpdateAppAuthorizationInput {\n\ts.Tenant = v\n\treturn s\n}", "title": "" }, { "docid": "56cc9415586a31c591be233a43914616", "score": "0.50234824", "text": "func (m *AadUserConversationMember) SetTenantId(value *string)() {\n m.tenantId = value\n}", "title": "" }, { "docid": "cc8cd82a8d6ba2998e210150f934c3a6", "score": "0.50233215", "text": "func (q tenantQuery) One(ctx context.Context, exec boil.ContextExecutor) (*Tenant, error) {\n\to := &Tenant{}\n\n\tqueries.SetLimit(q.Query, 1)\n\n\terr := q.Bind(ctx, exec, o)\n\tif err != nil {\n\t\tif errors.Is(err, sql.ErrNoRows) {\n\t\t\treturn nil, sql.ErrNoRows\n\t\t}\n\t\treturn nil, errors.Wrap(err, \"dbmodel: failed to execute a one query for tenants\")\n\t}\n\n\tif err := o.doAfterSelectHooks(ctx, exec); err != nil {\n\t\treturn o, err\n\t}\n\n\treturn o, nil\n}", "title": "" }, { "docid": "a3c94689d39f56db6edac911e5a35dfb", "score": "0.5017758", "text": "func QuotaInstanceEQ(v int) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldQuotaInstance), v))\n\t})\n}", "title": "" }, { "docid": "28e67d02ec30b69b1499ddc970fecc60", "score": "0.501589", "text": "func DeleteTenant(id int) (err error) {\n\to := orm.NewOrm()\n\tv := Tenant{Id: id}\n\t// ascertain id exists in the database\n\tif err = o.Read(&v); err == nil {\n\t\tvar num int64\n\t\tif num, err = o.Delete(&Tenant{Id: id}); err == nil {\n\t\t\tfmt.Println(\"Number of records deleted in database:\", num)\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "ca42dc1080d40c85d9953b0e9a5b8600", "score": "0.50091857", "text": "func (uc *UserCreate) SetTenant(s string) *UserCreate {\n\tuc.tenant = &s\n\treturn uc\n}", "title": "" }, { "docid": "ca42dc1080d40c85d9953b0e9a5b8600", "score": "0.50091857", "text": "func (uc *UserCreate) SetTenant(s string) *UserCreate {\n\tuc.tenant = &s\n\treturn uc\n}", "title": "" }, { "docid": "2cda0163638b1b633e440688b600e863", "score": "0.49706185", "text": "func (c *TenantController) Update(ctx *app.UpdateTenantContext) error {\n\tuserToken := goajwt.ContextJWT(ctx)\n\tif userToken == nil {\n\t\treturn jsonapi.JSONErrorResponse(ctx, errors.NewUnauthorizedError(\"Missing JWT token\"))\n\t}\n\tttoken := &TenantToken{token: userToken}\n\ttenant, err := c.tenantService.GetTenant(ttoken.Subject())\n\tif err != nil {\n\t\treturn jsonapi.JSONErrorResponse(ctx, errors.NewNotFoundError(\"tenants\", ttoken.Subject().String()))\n\t}\n\n\t// fetch the cluster the user belongs to\n\tuser, err := c.userService.GetUser(ctx, ttoken.Subject())\n\tif err != nil {\n\t\treturn jsonapi.JSONErrorResponse(ctx, err)\n\t}\n\n\tif user.Cluster == nil {\n\t\tlog.Error(ctx, nil, \"no cluster defined for tenant\")\n\t\treturn jsonapi.JSONErrorResponse(ctx, errors.NewInternalError(ctx, fmt.Errorf(\"unable to provision to undefined cluster\")))\n\t}\n\n\t// fetch the users cluster token\n\topenshiftUsername, _, err := c.resolveTenant(ctx, *user.Cluster, userToken.Raw)\n\tif err != nil {\n\t\tlog.Error(ctx, map[string]interface{}{\n\t\t\t\"err\": err,\n\t\t\t\"cluster_url\": *user.Cluster,\n\t\t}, \"unable to fetch tenant token from auth\")\n\t\treturn jsonapi.JSONErrorResponse(ctx, errors.NewUnauthorizedError(\"Could not resolve user token\"))\n\t}\n\n\tcluster, err := c.resolveCluster(ctx, *user.Cluster)\n\tif err != nil {\n\t\tlog.Error(ctx, map[string]interface{}{\n\t\t\t\"err\": err,\n\t\t\t\"cluster_url\": *user.Cluster,\n\t\t}, \"unable to fetch cluster\")\n\t\treturn jsonapi.JSONErrorResponse(ctx, errors.NewInternalError(ctx, err))\n\t}\n\n\t// create openshift config\n\topenshiftConfig := openshift.NewConfig(c.defaultOpenshiftConfig, user, cluster.User, cluster.Token, cluster.APIURL)\n\n\tgo func() {\n\t\tctx := ctx\n\t\tt := tenant\n\t\terr = openshift.RawUpdateTenant(\n\t\t\tctx,\n\t\t\topenshiftConfig,\n\t\t\tInitTenant(ctx, openshiftConfig.MasterURL, c.tenantService, t),\n\t\t\topenshiftUsername,\n\t\t\tc.templateVars)\n\n\t\tif err != nil {\n\t\t\tlog.Error(ctx, map[string]interface{}{\n\t\t\t\t\"err\": err,\n\t\t\t\t\"os_user\": openshiftUsername,\n\t\t\t}, \"unable initialize tenant\")\n\t\t}\n\t}()\n\n\tctx.ResponseData.Header().Set(\"Location\", rest.AbsoluteURL(ctx.RequestData.Request, app.TenantHref()))\n\treturn ctx.Accepted()\n}", "title": "" }, { "docid": "f4c1585094a9f2d773b8d3355eb4fc99", "score": "0.49705425", "text": "func (s *CreateAppAuthorizationInput) SetTenant(v *Tenant) *CreateAppAuthorizationInput {\n\ts.Tenant = v\n\treturn s\n}", "title": "" }, { "docid": "cd97013eafbdaae527b43ac722770920", "score": "0.496546", "text": "func (api *tenantAPI) Delete(obj *cluster.Tenant) 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 err\n\t\t}\n\n\t\t_, err = apicl.ClusterV1().Tenant().Delete(context.Background(), &obj.ObjectMeta)\n\t\treturn err\n\t}\n\n\tapi.ct.handleTenantEvent(&kvstore.WatchEvent{Object: obj, Type: kvstore.Deleted})\n\treturn nil\n}", "title": "" }, { "docid": "3b6721d6c37898115b9293126afa5395", "score": "0.4962205", "text": "func TenantID() string {\n\treturn tenantID\n}", "title": "" }, { "docid": "3b6721d6c37898115b9293126afa5395", "score": "0.4962205", "text": "func TenantID() string {\n\treturn tenantID\n}", "title": "" }, { "docid": "3b6721d6c37898115b9293126afa5395", "score": "0.4962205", "text": "func TenantID() string {\n\treturn tenantID\n}", "title": "" }, { "docid": "fc920e18776413211545a535d5c55429", "score": "0.494278", "text": "func (m *LeaseMutation) Idtenant() (r string, exists bool) {\n\tv := m.idtenant\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "4aa9225a0a4a6932bc9bba29fe1fae66", "score": "0.49424917", "text": "func (r *queryResolver) Tenants(ctx context.Context, first *int, after *graphql.PageCursor, searchTerm *string) (*graphql.TenantPage, error) {\n\treturn r.tenant.Tenants(ctx, first, after, searchTerm)\n}", "title": "" }, { "docid": "9b7266745c138ecc4c1ac48c0d94ce89", "score": "0.4938524", "text": "func (o IopingSpecVolumeVolumeSourceQuobytePtrOutput) Tenant() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *IopingSpecVolumeVolumeSourceQuobyte) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Tenant\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "543347212a643a98207d01347abaf0d6", "score": "0.49374506", "text": "func UpdateTenant(p Tenant, db *database.DB) error {\n\n\tvar tenant Tenant\n\n\tresult := db.Client.Find(&tenant, p.ID)\n\tif result.Error != nil {\n\t\treturn ErrTenantNotFound\n\t}\n\n\t// update fields\n\ttenant.Name = p.Name\n\ttenant.Description = p.Description\n\n\tupdateresult := db.Client.Save(&tenant)\n\tif updateresult.Error != nil {\n\t\treturn ErrTenantNotFound\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "32a3854883fd477a56d3ae9a40c09059", "score": "0.4928125", "text": "func (c *Config) isTenant(label map[string]string) (bool, string) {\n\n\tif c.tenantReceiverSelector != nil {\n\t\tfor k, expected := range c.tenantReceiverSelector.MatchLabels {\n\t\t\tif v, exists := label[k]; exists && v == expected {\n\t\t\t\tif v, exists := label[c.tenantKey]; exists {\n\t\t\t\t\treturn true, v\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\treturn false, \"\"\n}", "title": "" }, { "docid": "14deb11c030072ef2a3f0b197a9d9c70", "score": "0.49281126", "text": "func ActiveEQ(v bool) predicate.User {\n\treturn predicate.User(sql.FieldEQ(FieldActive, v))\n}", "title": "" }, { "docid": "40dbe647ee089dc9fa156705aecbf475", "score": "0.490959", "text": "func (o *StorageNetAppCifsShareAllOf) GetTenant() StorageNetAppStorageVmRelationship {\n\tif o == nil || o.Tenant == nil {\n\t\tvar ret StorageNetAppStorageVmRelationship\n\t\treturn ret\n\t}\n\treturn *o.Tenant\n}", "title": "" }, { "docid": "dd33cece7a201ecbe7f5e07e31f7b4f1", "score": "0.48907372", "text": "func (o FastTcpAppOutput) Tenant() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *FastTcpApp) pulumi.StringOutput { return v.Tenant }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "116618441e73a6dabffc2a1006e3e95d", "score": "0.48870412", "text": "func (s *AppAuthorization) SetTenant(v *Tenant) *AppAuthorization {\n\ts.Tenant = v\n\treturn s\n}", "title": "" }, { "docid": "d7920f7b4d6b4905557d5b52cc6da934", "score": "0.48612958", "text": "func (suite *TenantTestSuite) TestDeleteTenant() {\n\n\trequest, _ := http.NewRequest(\"DELETE\", \"/api/v2/admin/tenants/6ac7d684-1f8e-4a02-a502-720e8f11e50b\", strings.NewReader(\"\"))\n\trequest.Header.Set(\"x-api-key\", suite.clientkey)\n\trequest.Header.Set(\"Accept\", \"application/json\")\n\tresponse := httptest.NewRecorder()\n\n\tsuite.router.ServeHTTP(response, request)\n\n\tcode := response.Code\n\toutput := response.Body.String()\n\n\tmetricProfileJSON := `{\n \"status\": {\n \"message\": \"Tenant Successfully Deleted\",\n \"code\": \"200\"\n }\n}`\n\t// Check that we must have a 200 ok code\n\tsuite.Equal(200, code, \"Internal Server Error\")\n\t// Compare the expected and actual json response\n\tsuite.Equal(metricProfileJSON, output, \"Response body mismatch\")\n\n\t// check that the element has actually been Deleted\n\t// connect to mongodb\n\tsession, err := mgo.Dial(suite.cfg.MongoDB.Host)\n\tdefer session.Close()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t// try to retrieve item\n\tvar result map[string]interface{}\n\tc := session.DB(suite.cfg.MongoDB.Db).C(\"tenants\")\n\terr = c.Find(bson.M{\"id\": \"6ac7d684-1f8e-4a02-a502-720e8f11e50b\"}).One(&result)\n\n\tsuite.NotEqual(err, nil, \"No not found error\")\n\tsuite.Equal(err.Error(), \"not found\", \"No not found error\")\n}", "title": "" }, { "docid": "5324af959235258ff893aaab2b917fbd", "score": "0.4860908", "text": "func FindTenantP(ctx context.Context, exec boil.ContextExecutor, iD string, selectCols ...string) *Tenant {\n\tretobj, err := FindTenant(ctx, exec, iD, selectCols...)\n\tif err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n\n\treturn retobj\n}", "title": "" }, { "docid": "9382c4590b2b56e18f34b860177167c8", "score": "0.4856402", "text": "func (c *TenantController) Show(ctx *app.ShowTenantContext) error {\n\tuserToken := goajwt.ContextJWT(ctx)\n\tif userToken == nil {\n\t\treturn jsonapi.JSONErrorResponse(ctx, errors.NewUnauthorizedError(\"Missing JWT token\"))\n\t}\n\n\tttoken := &auth.TenantToken{Token: userToken}\n\ttenantID := ttoken.Subject()\n\ttenant, err := c.tenantService.GetTenant(tenantID)\n\tif err != nil {\n\t\treturn jsonapi.JSONErrorResponse(ctx, errors.NewNotFoundError(\"tenants\", tenantID.String()))\n\t}\n\n\tnamespaces, err := c.tenantService.GetNamespaces(tenantID)\n\tif err != nil {\n\t\treturn jsonapi.JSONErrorResponse(ctx, err)\n\t}\n\n\tresult := &app.TenantSingle{Data: convertTenant(ctx, tenant, namespaces, c.clusterService.GetCluster)}\n\treturn ctx.OK(result)\n}", "title": "" }, { "docid": "33bd7ad878cc5a1f615db925bff76419", "score": "0.48475653", "text": "func (r *mutationResolver) WriteTenant(ctx context.Context, in graphql.BusinessTenantMappingInput) (string, error) {\n\treturn r.tenant.WriteSingle(ctx, in)\n}", "title": "" }, { "docid": "2d0204ecc57399ac414ba778ef2d4ff8", "score": "0.48459113", "text": "func (tm *TenantsManager) FetchTenant(ctx context.Context, externalTenantID string) (*model.BusinessTenantMappingInput, error) {\n\tadditionalFields := map[string]string{\n\t\ttm.config.QueryConfig.EntityField: externalTenantID,\n\t}\n\tconfigProvider := eventsQueryConfigProviderWithAdditionalFields(tm.config, additionalFields)\n\n\tfetchedTenants, err := fetchCreatedTenantsWithRetries(ctx, tm.eventAPIClient, tm.config.RetryAttempts, tm.supportedEventTypes, configProvider)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(fetchedTenants) >= 1 {\n\t\tlog.C(ctx).Infof(\"Tenant found from central region with universal client\")\n\t\treturn &fetchedTenants[0], err\n\t}\n\n\tlog.C(ctx).Infof(\"Tenant not found from central region, checking regional APIs\")\n\n\ttenantChan := make(chan *model.BusinessTenantMappingInput, len(tm.regionalClients))\n\tfor region, regionalClient := range tm.regionalClients {\n\t\tgo func(ctx context.Context, region string, regionalClient EventAPIClient, ch chan *model.BusinessTenantMappingInput) {\n\t\t\tctx = context.WithValue(ctx, TenantRegionCtxKey, region)\n\t\t\tcreatedRegionalTenants, err := fetchCreatedTenantsWithRetries(ctx, regionalClient, tm.config.RetryAttempts, tm.supportedEventTypes, configProvider)\n\t\t\tif err != nil {\n\t\t\t\tlog.C(ctx).WithError(err).Errorf(\"Failed to fetch created tenants from region %s: %v\", region, err)\n\t\t\t}\n\n\t\t\tif len(createdRegionalTenants) == 1 {\n\t\t\t\tlog.C(ctx).Infof(\"Tenant found in region %s\", region)\n\t\t\t\tif createdRegionalTenants[0].Region == \"\" {\n\t\t\t\t\tcreatedRegionalTenants[0].Region = region\n\t\t\t\t}\n\t\t\t\tch <- &createdRegionalTenants[0]\n\t\t\t} else {\n\t\t\t\tlog.C(ctx).Warnf(\"Tenant not found in region %s\", region)\n\t\t\t\tch <- nil\n\t\t\t}\n\t\t}(ctx, region, regionalClient, tenantChan)\n\t}\n\n\tpendingRegionalInfo := len(tm.regionalClients)\n\tif pendingRegionalInfo == 0 {\n\t\t// TODO return error when lazy store is reverted\n\t\tlog.C(ctx).Error(\"no regions are configured\")\n\t\treturn nil, nil\n\t}\n\n\tvar tenant *model.BusinessTenantMappingInput\n\tfor result := range tenantChan {\n\t\tif result != nil {\n\t\t\ttenant = result\n\t\t\tbreak\n\t\t}\n\t\tpendingRegionalInfo--\n\t\tif pendingRegionalInfo == 0 {\n\t\t\t// TODO return error when lazy store is reverted\n\t\t\tlog.C(ctx).Error(\"tenant not found in all configured regions\")\n\t\t\treturn nil, nil\n\t\t}\n\t}\n\n\treturn tenant, nil\n}", "title": "" }, { "docid": "114878ca5e429c717b6f316eae7bcebb", "score": "0.48364112", "text": "func (api *tenantAPI) SyncDelete(obj *cluster.Tenant) error {\n\tvar writeErr 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 err\n\t\t}\n\n\t\t_, writeErr = apicl.ClusterV1().Tenant().Delete(context.Background(), &obj.ObjectMeta)\n\t}\n\n\tif writeErr == nil {\n\t\tapi.ct.handleTenantEvent(&kvstore.WatchEvent{Object: obj, Type: kvstore.Deleted})\n\t}\n\n\treturn writeErr\n}", "title": "" }, { "docid": "968298b613d13a56f486d628a6755f8c", "score": "0.48085293", "text": "func (r *mutationResolver) SubscribeTenant(ctx context.Context, providerID, subaccountID, providerSubaccountID, consumerTenantID, region, subscriptionAppName string, subscriptionPayload string) (bool, error) {\n\treturn r.subscription.SubscribeTenant(ctx, providerID, subaccountID, providerSubaccountID, consumerTenantID, region, subscriptionAppName, subscriptionPayload)\n}", "title": "" }, { "docid": "af01d7ce82d5c0c95816b026a0126b1b", "score": "0.48071304", "text": "func SetShortPathRequestTenant(req *http.Request) (*http.Request, error) {\n\n\tctx := req.Context()\n\n\trequestor, exists := request.UserFrom(ctx)\n\tif !exists {\n\t\treturn nil, errors.New(\"The user info is missing.\")\n\t}\n\n\tuserTenant := requestor.GetTenant()\n\tif userTenant == metav1.TenantNone {\n\t\t// temporary workaround\n\t\t// tracking issue: https://github.com/futurewei-cloud/arktos/issues/102\n\t\tuserTenant = metav1.TenantSystem\n\t\t//When https://github.com/futurewei-cloud/arktos/issues/102 is done, remove the above line\n\t\t// and enable the following two lines.\n\t\t//responsewriters.InternalError(w, req, errors.New(fmt.Sprintf(\"The tenant in the user info of %s is empty. \", requestor.GetName())))\n\t\t//return\n\t}\n\n\trequestInfo, exists := request.RequestInfoFrom(ctx)\n\tif !exists {\n\t\treturn nil, errors.New(\"The request info is missing.\")\n\t}\n\n\t// for a reqeust from a regular user, if the tenant in the object is empty, use the tenant from user info\n\t// this is what we call \"short-path\", which allows users to use traditional Kubernets API in the multi-tenancy Arktos\n\tresourceTenant := requestInfo.Tenant\n\tif resourceTenant == metav1.TenantNone && userTenant != metav1.TenantSystem {\n\t\trequestInfo.Tenant = userTenant\n\t}\n\n\treq = req.WithContext(request.WithRequestInfo(ctx, requestInfo))\n\n\treturn req, nil\n}", "title": "" }, { "docid": "e18c7b59713789527c73755529ae80a8", "score": "0.47968322", "text": "func (m *mockTenantQueryableWithFilter) Querier(ctx context.Context, _, _ int64) (storage.Querier, error) {\n\ttenantIDs, err := tenant.TenantIDs(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tq := mockTenantQuerier{\n\t\ttenant: tenantIDs[0],\n\t\textraLabels: m.extraLabels,\n\t\tctx: ctx,\n\t}\n\n\t// set warning if exists\n\tif m.warningsByTenant != nil {\n\t\tif w, ok := m.warningsByTenant[q.tenant]; ok {\n\t\t\tq.warnings = append([]error(nil), w...)\n\t\t}\n\t}\n\n\t// set queryErr if exists\n\tif m.queryErrByTenant != nil {\n\t\tif err, ok := m.queryErrByTenant[q.tenant]; ok {\n\t\t\tq.queryErr = err\n\t\t}\n\t}\n\n\treturn q, nil\n}", "title": "" }, { "docid": "c7ec6318c8dd0e3fb9b99b423414a817", "score": "0.47950813", "text": "func getCurrentTenant() *Tenant {\n\tif currentTenant == nil {\n\t\ttenants, err := providers.Tenants()\n\t\tif err != nil || len(tenants) != 1 {\n\t\t\treturn nil\n\t\t}\n\t\t// Set unqiue tenant as selected\n\t\tlog.Println(\"Unique tenant set\")\n\t\tfor name := range tenants {\n\t\t\tservice, err := providers.GetService(name)\n\t\t\tif err != nil {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tcurrentTenant = &Tenant{name: name, Service: service}\n\t\t}\n\t}\n\treturn currentTenant\n}", "title": "" }, { "docid": "61dc2aa0459d845916a5d1c2cd48541e", "score": "0.47839668", "text": "func CheckTenantAccess(c echo.Context) *echo.HTTPError {\n\tif !TLS {\n\t\treturn nil\n\t}\n\n\tcert := getCert(c)\n\tif cert == nil {\n\t\terr := errors.New(\"Client certificate with valid SANs is required for tenant access\")\n\t\treturn echo.NewHTTPError(http.StatusForbidden, err.Error())\n\t}\n\n\tif cert.Subject.CommonName == wildcard || cert.Subject.CommonName == networkWildcard {\n\t\treturn nil\n\t}\n\tfor _, san := range cert.DNSNames {\n\t\tif san == wildcard || san == networkWildcard {\n\t\t\treturn nil\n\t\t}\n\t}\n\tglog.Infof(\"Client cert %s does not have wildcard access\", util.FormatPkixSubject(&cert.Subject))\n\treturn echo.NewHTTPError(http.StatusForbidden, \"Client certificate is not authorized\")\n}", "title": "" }, { "docid": "684e0141ca7151432de5a2e972ba91ac", "score": "0.4779736", "text": "func (suite *TenantTestSuite) TestUpdateTenant() {\n\n\t// create json input data for the request\n\tputData := `\n {\n \"info\":{\n\t\t\t\t\"name\":\"new_mutants\",\n\t\t\t\t\"email\":\"yo@yo\",\n\t\t\t\t\"website\":\"website\"\n\t\t\t},\n \"db_conf\": [\n {\n \"store\":\"ar\",\n \"server\":\"localhost\",\n \"port\":27017,\n \"database\":\"ar_db\",\n \"username\":\"admin\",\n \"password\":\"3NCRYPT3D\"\n },\n {\n \"store\":\"status\",\n \"server\":\"localhost\",\n \"port\":27017,\n \"database\":\"status_db\",\n \"username\":\"admin\",\n \"password\":\"3NCRYPT3D\"\n }],\n \"users\": [\n {\n \"name\":\"xavier\",\n \"email\":\"xavier@email.com\",\n \"api_key\":\"X4V13R\"\n },\n {\n \"name\":\"magneto\",\n \"email\":\"magneto@email.com\",\n \"api_key\":\"M4GN3T0\"\n }]\n }`\n\n\tjsonOutput := `{\n \"status\": {\n \"message\": \"Tenant successfully updated\",\n \"code\": \"200\"\n }\n}`\n\n\trequest, _ := http.NewRequest(\"PUT\", \"/api/v2/admin/tenants/6ac7d684-1f8e-4a02-a502-720e8f11e50c\", strings.NewReader(putData))\n\trequest.Header.Set(\"x-api-key\", suite.clientkey)\n\trequest.Header.Set(\"Accept\", \"application/json\")\n\tresponse := httptest.NewRecorder()\n\n\tsuite.router.ServeHTTP(response, request)\n\n\tcode := response.Code\n\toutput := response.Body.String()\n\n\tsuite.Equal(200, code, \"Internal Server Error\")\n\t// Compare the expected and actual xml response\n\tsuite.Equal(jsonOutput, output, \"Response body mismatch\")\n\n}", "title": "" }, { "docid": "c81e65ca74abc47de58a02b02406f5d3", "score": "0.47787616", "text": "func (c *TenantController) Show(ctx *app.ShowTenantContext) error {\n\ttoken := goajwt.ContextJWT(ctx)\n\tif token == nil {\n\t\treturn jsonapi.JSONErrorResponse(ctx, errors.NewUnauthorizedError(\"Missing JWT token\"))\n\t}\n\n\tttoken := &TenantToken{token: token}\n\ttenantID := ttoken.Subject()\n\ttenant, err := c.tenantService.GetTenant(tenantID)\n\tif err != nil {\n\t\treturn jsonapi.JSONErrorResponse(ctx, errors.NewNotFoundError(\"tenants\", tenantID.String()))\n\t}\n\n\tnamespaces, err := c.tenantService.GetNamespaces(tenantID)\n\tif err != nil {\n\t\treturn jsonapi.JSONErrorResponse(ctx, err)\n\t}\n\n\tresult := &app.TenantSingle{Data: convertTenant(ctx, tenant, namespaces, c.resolveCluster)}\n\treturn ctx.OK(result)\n}", "title": "" }, { "docid": "42545dc05a3f0609279376809f315461", "score": "0.4777421", "text": "func (p *ResourceCondition) addTenantToFilter(action string, tenant tenantMatcher) {\n\tp.actionTenantFilter[action] = append(p.actionTenantFilter[action], tenant)\n}", "title": "" }, { "docid": "f338a00de91f15e290b201531742674c", "score": "0.47765496", "text": "func setTenant(c *cli.Context) error {\n\terr := checkArgCount(c, 1)\n\tif err != nil {\n\t\treturn err\n\t}\n\tname := c.Args().First()\n\n\tclient.Photonclient, err = client.GetClient(c)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Ensure tenant exists\n\tid, err := findTenantID(name)\n\tif len(id) == 0 || err != nil {\n\t\treturn err\n\t}\n\n\tconfig, err := cf.LoadConfig()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tconfig.Tenant = &cf.TenantConfiguration{Name: name, ID: id}\n\terr = cf.SaveConfig(config)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = clearConfigProject(\"\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !c.GlobalIsSet(\"non-interactive\") {\n\t\tfmt.Printf(\"Tenant set to '%s'\\n\", name)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a3ef2cd44f96a75e410d54cac82dab54", "score": "0.47645846", "text": "func fnTenant(ctx Context, doc *JDoc, params []string) interface{} {\n\tstats := ctx.Value(EelTotalStats).(*ServiceStats)\n\tif params == nil || params[0] != \"\" {\n\t\tctx.Log().Error(\"error_type\", \"func_tenant\", \"op\", \"tenant\", \"cause\", \"no_parameters_expected\", \"params\", params)\n\t\tstats.IncErrors()\n\t\tAddError(ctx, SyntaxError{fmt.Sprintf(\"no parameters expected in call to tenant function\"), \"tenant\", params})\n\t\treturn \"\"\n\t}\n\th := GetCurrentHandlerConfig(ctx)\n\tif h == nil {\n\t\tctx.Log().Error(\"error_type\", \"func_tenant\", \"op\", \"tenant\", \"cause\", \"no_handler\", \"params\", params)\n\t\tstats.IncErrors()\n\t\tAddError(ctx, RuntimeError{fmt.Sprintf(\"current handler not found in call to tenant function\"), \"tenant\", params})\n\t\treturn \"\"\n\t}\n\t//Add logic to separating tenant and partner\n\tallowPartner := GetConfig(ctx).AllowPartner\n\tif h.TenantId == \"_default\" {\n\t\t//The default tenant handler is used. We need to drill-down into context to find out the actual tenant\n\t\ttenantHeaderKey := GetConfig(ctx).HttpTenantHeader\n\t\tif ctx.Value(tenantHeaderKey) != nil {\n\t\t\tcombinedTenant := ctx.Value(tenantHeaderKey).(string)\n\t\t\ttenant := \"\"\n\t\t\tif allowPartner && strings.LastIndex(combinedTenant, \"_\") > 0 && strings.LastIndex(combinedTenant, \"_\") < len(combinedTenant)-1 {\n\t\t\t\ttenant = combinedTenant[:strings.LastIndex(combinedTenant, \"_\")]\n\t\t\t} else {\n\t\t\t\ttenant = combinedTenant\n\t\t\t}\n\t\t\treturn tenant\n\t\t}\n\t}\n\tcombinedTenant := h.TenantId\n\ttenant := \"\"\n\tif allowPartner && strings.LastIndex(combinedTenant, \"_\") > 0 && strings.LastIndex(combinedTenant, \"_\") < len(combinedTenant)-1 {\n\t\ttenant = combinedTenant[:strings.LastIndex(combinedTenant, \"_\")]\n\t} else {\n\t\ttenant = combinedTenant\n\t}\n\treturn tenant\n}", "title": "" }, { "docid": "f0302073e8a2bdc9cc4fa5770c637c8a", "score": "0.4758585", "text": "func QuotaStorageEQ(v int) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldQuotaStorage), v))\n\t})\n}", "title": "" }, { "docid": "11eddbf5adbfced92ed0ac02987ec075", "score": "0.47542965", "text": "func (m *LeaseMutation) ResetTenant() {\n\tm.tenant = nil\n}", "title": "" }, { "docid": "02e62c28473d5f15a11a928550bc3233", "score": "0.47467643", "text": "func (o *IpamIPAddressesListParams) SetTenant(tenant *string) {\n\to.Tenant = tenant\n}", "title": "" }, { "docid": "d3a135a4edc81cd0f568e20cc5930451", "score": "0.47443324", "text": "func (s *TenantListener) Set(ctx context.Context, in *pb.TenantName) (empty *googleprotobuf.Empty, err error) {\n\tempty = &googleprotobuf.Empty{}\n\tif s == nil {\n\t\treturn empty, status.Errorf(codes.FailedPrecondition, fail.InvalidInstanceError().Message())\n\t}\n\tif in == nil {\n\t\treturn empty, status.Errorf(codes.InvalidArgument, fail.InvalidParameterError(\"in\", \"cannot be nil\").Message())\n\t}\n\tname := in.GetName()\n\t// FIXME: validate parameters\n\n\ttracer := debug.NewTracer(nil, fmt.Sprintf(\"('%s')\", name), true).WithStopwatch().GoingIn()\n\tdefer tracer.OnExitTrace()()\n\tdefer fail.OnExitLogError(tracer.TraceMessage(\"\"), &err)()\n\n\tctx, cancelFunc := context.WithCancel(ctx)\n\t// FIXME: handle error\n\tif err := srvutils.JobRegister(ctx, cancelFunc, \"Tenant Set \"+name); err == nil {\n\t\tdefer srvutils.JobDeregister(ctx)\n\t}\n\n\tif currentTenant != nil && currentTenant.name == in.GetName() {\n\t\treturn empty, nil\n\t}\n\n\tservice, err := iaas.UseService(in.GetName())\n\tif err != nil {\n\t\treturn empty, fmt.Errorf(\"unable to set tenant '%s': %s\", name, getUserMessage(err))\n\t}\n\tcurrentTenant = &Tenant{name: in.GetName(), Service: service}\n\tlog.Infof(\"Current tenant is now '%s'\", name)\n\treturn empty, nil\n}", "title": "" }, { "docid": "41071f6ad9f15bf46efb0d6557e8fdd1", "score": "0.47419658", "text": "func FindTenant(ctx context.Context, exec boil.ContextExecutor, iD string, selectCols ...string) (*Tenant, error) {\n\ttenantObj := &Tenant{}\n\n\tsel := \"*\"\n\tif len(selectCols) > 0 {\n\t\tsel = strings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, selectCols), \",\")\n\t}\n\tquery := fmt.Sprintf(\n\t\t\"select %s from `tenants` where `id`=?\", sel,\n\t)\n\n\tq := queries.Raw(query, iD)\n\n\terr := q.Bind(ctx, exec, tenantObj)\n\tif err != nil {\n\t\tif errors.Is(err, sql.ErrNoRows) {\n\t\t\treturn nil, sql.ErrNoRows\n\t\t}\n\t\treturn nil, errors.Wrap(err, \"dbmodel: unable to select from tenants\")\n\t}\n\n\tif err = tenantObj.doAfterSelectHooks(ctx, exec); err != nil {\n\t\treturn tenantObj, err\n\t}\n\n\treturn tenantObj, nil\n}", "title": "" }, { "docid": "42b1beae7727db11e3012a98edb11734", "score": "0.47411233", "text": "func TestTenantAddDelete(t *testing.T) {\n\t// tenant params\n\ttenant := client.Tenant{\n\t\tTenantName: \"tenant1\",\n\t}\n\n\t// create a tenant\n\terr := contivClient.TenantPost(&tenant)\n\tcheckError(t, \"create tenant\", err)\n\n\t// Get the tenant and verify it exists\n\tgotTenant, err := contivClient.TenantGet(\"tenant1\")\n\tcheckError(t, \"get tenant\", err)\n\n\tif gotTenant.TenantName != tenant.TenantName {\n\t\tt.Fatalf(\"Got invalid tenant name. expecting %s. Got %s\", tenant.TenantName, gotTenant.TenantName)\n\t}\n\n\t// delete tenant\n\terr = contivClient.TenantDelete(\"tenant1\")\n\tcheckError(t, \"delete tenant\", err)\n\n\t// find again and make sure its gone\n\t_, err = contivClient.TenantGet(\"tenant1\")\n\tif err == nil {\n\t\tt.Fatalf(\"Tenant was not deleted\")\n\t}\n}", "title": "" }, { "docid": "f8f89b2074973db25fc828e4f384ceb6", "score": "0.47366908", "text": "func TenantExists(name string) bool {\n\tvar tenant bool\n\n\tc, err := getIdentityClient()\n\tif err != nil {\n\t\tlog.Println(\"Error getting Identity Client: \", err)\n\t\treturn false\n\t}\n\n\topts := tenants.ListOpts{Limit: 20}\n\tpager := tenants.List(c, &opts)\n\t// brute force the whole tenant list to get tenant details?\n\tpager.EachPage(\n\t\tfunc(page pagination.Page) (bool, error) {\n\t\t\ttenantList, _ := tenants.ExtractTenants(page)\n\t\t\tfor _, t := range tenantList {\n\t\t\t\t// \"t\" is tenants.Tenant\n\t\t\t\tif t.ID == name || t.Name == name {\n\t\t\t\t\ttenant = true\n\t\t\t\t\t// stop iterating and return tenant\n\t\t\t\t\treturn false, nil\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true, nil\n\t\t},\n\t)\n\treturn tenant\n}", "title": "" }, { "docid": "7a339a3b2fb1ae51de411bf2cdc58f25", "score": "0.4730866", "text": "func (o *StorageNetAppCifsShareAllOf) GetTenantOk() (*StorageNetAppStorageVmRelationship, bool) {\n\tif o == nil || o.Tenant == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Tenant, true\n}", "title": "" }, { "docid": "e384f8b1ee788ea91ef90e3667f8320e", "score": "0.47284925", "text": "func (m *CloudPcConnection) SetTenantId(value *string)() {\n err := m.GetBackingStore().Set(\"tenantId\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" } ]
e40d4f0a09ea3f1d0c1431b612761962
replaceActiveNode() replaces a "dead" node in the active view with a node randomly chosen from the passive view.
[ { "docid": "c86b3a2692a53823e29796a17ed9e36d", "score": "0.76708865", "text": "func (ag *agent) replaceActiveNode(node *node.Node) {\n\t// TODO add the node to passive view instead of removing.\n\tag.aView.Lock()\n\tif !ag.aView.Remove(node.Id) {\n\t\tag.aView.Unlock()\n\t\treturn\n\t}\n\tag.aView.Unlock()\n\tnode.Conn.Close()\n\n\tag.pView.RLock()\n\tfor {\n\t\tnd := chooseRandomNode(ag.pView, 0)\n\t\tag.pView.RUnlock()\n\t\tif nd == nil {\n\t\t\tlog.Warningf(\"No nodes in passive view\\n\")\n\t\t\tbreak\n\t\t}\n\n\t\tif conn, err := ag.connect(nd.Addr); err != nil {\n\t\t\tlog.Errorf(\"Agent.replaceActiveNode(): Failed to connect %s: %v, drop from passive view.\", nd.Addr(), err)\n\t\t\tag.pView.Lock()\n\t\t\tag.pView.Remove(nd.Id)\n\t\t\tag.pView.Unlock()\n\t\t\tcontinue\n\t\t} else {\n\t\t\tnd.Conn = conn\n\t\t}\n\n\t\tpriority := message.Neighbor_Low\n\t\tif ag.aView.Len() == 0 {\n\t\t\tmessage.Neighbor_High\n\t\t}\n\t\tif accepted, err := ag.neighbor(nd, priority); err != nil {\n\t\t\tlog.Errorf(\"Agent.replaceActiveNode(): Failed to neighbor: %v\\n\", err)\n\t\t\tnd.Conn.Close()\n\t\t} else if accpeted {\n\t\t\tag.aView.Lock()\n\t\t\tag.pView.Lock()\n\t\t\tag.pView.Remove(nd.Id)\n\t\t\tag.addNodeActiveView(nd)\n\t\t\tag.aView.Unlock()\n\t\t\tag.pView.Unlock()\n\t\t\tbreak\n\t\t}\n\t}\n\n\tag.aView.RLock()\n\tag.pView.Lock()\n\tag.addNodePassiveView(node)\n\tag.pView.Unlock()\n\tag.aView.RunLock()\n\n\tag.resendFailedMessages()\n}", "title": "" } ]
[ { "docid": "9b7deec723663d6c0d59e853dd4104f3", "score": "0.6084662", "text": "func (_AccelerateNode *AccelerateNodeTransactor) ReplaceNode(opts *bind.TransactOpts, enode string, idx uint32) (*types.Transaction, error) {\n\treturn _AccelerateNode.contract.Transact(opts, \"replaceNode\", enode, idx)\n}", "title": "" }, { "docid": "7ea6d5ba7d2bab8b7bf01ca5fb869c73", "score": "0.57176024", "text": "func (_AccelerateNode *AccelerateNodeTransactorSession) ReplaceNode(enode string, idx uint32) (*types.Transaction, error) {\n\treturn _AccelerateNode.Contract.ReplaceNode(&_AccelerateNode.TransactOpts, enode, idx)\n}", "title": "" }, { "docid": "678366eee8e1a10d7eff440c778c17d1", "score": "0.56536025", "text": "func (_AccelerateNode *AccelerateNodeSession) ReplaceNode(enode string, idx uint32) (*types.Transaction, error) {\n\treturn _AccelerateNode.Contract.ReplaceNode(&_AccelerateNode.TransactOpts, enode, idx)\n}", "title": "" }, { "docid": "04b1508cd72e165eb3f4a7337faddbbf", "score": "0.5547019", "text": "func replaceNodeRoute(ip *net.IPNet) {\n\tif ip == nil {\n\t\treturn\n\t}\n\n\trouteUtils.ReplaceRoute(createNodeRoute(ip))\n}", "title": "" }, { "docid": "8dc16f9f8e025753c457e9734327de89", "score": "0.5454822", "text": "func (n *node) replaceNode(parent *node, replacement *node) {\n\tif n == parent.left {\n\t\tparent.left = replacement\n\t} else {\n\t\tparent.right = replacement\n\t}\n}", "title": "" }, { "docid": "5ca6b1f8fbc0f18d24a617c5bdc3f637", "score": "0.5293403", "text": "func (ag *agent) addNodeActiveView(node *node.Node) {\n\tif !ag.aView.Has(node.Id) {\n\t\tfor ag.aView.Len() >= ag.cfg.AViewMaxSize {\n\t\t\tn := chooseRandomNode(ag.aView, 0)\n\t\t\tag.aView.Remove(n.Id)\n\t\t\tgo ag.disconnect(n)\n\t\t\tag.addNodePassiveView(n)\n\t\t\t//ag.pView.Add(n.Id, n)\n\t\t}\n\t}\n\tgo ag.serveNode(node)\n\tif old := ag.aView.Add(node.Id, node); old != nil {\n\t\told.(*node.Node).Conn.Close()\n\t}\n}", "title": "" }, { "docid": "31d031c51bec09204a8b78d0229a4db3", "score": "0.5206409", "text": "func replaceNode(c, p, x *node) {\n\tif x != nil {\n\t\tx.parent = p\n\t}\n\tif p == nil { // root case\n\t\treturn\n\t} else if p.left == c {\n\t\tp.left = x\n\t} else if p.right == c {\n\t\tp.right = x\n\t} else {\n\t\tassert(false, \"unhandled parent/child case\")\n\t}\n}", "title": "" }, { "docid": "e6196fa9c57f05604864781df0b5b8a0", "score": "0.5190778", "text": "func (ag *agent) addNodePassiveView(node *node.Node) {\n\tif node.Id == ag.id || ag.aView.Has(node.Id) || ag.pView.Has(node.Id) {\n\t\treturn\n\t}\n\tfor ag.pView.Len() >= ag.cfg.PViewSize {\n\t\tn := chooseRandomNode(ag.pView, 0)\n\t\tag.pView.Remove(n.Id)\n\t}\n\tag.pView.Add(node.Id, node)\n}", "title": "" }, { "docid": "f44e21133212e602fa9c6d9e712a83e4", "score": "0.51352704", "text": "func (group *NodeGroup) ResetDeadNode(nid int) {\n\tgroup.mux.RLock()\n\tdefer group.mux.RUnlock()\n\n\tif group == nil || nid <= 0 {\n\t\treturn\n\t}\n\n\tfor i := range group.nodes {\n\t\tif group.nodes[i].ID == nid {\n\t\t\tatomic.StoreUint32(&group.nodes[i].failCount, 0)\n\t\t\tatomic.StoreInt64(&group.nodes[i].failTime, 0)\n\t\t\tbreak\n\t\t}\n\t}\n}", "title": "" }, { "docid": "4b81f614c6f347ac76fae8083bbcc9f4", "score": "0.5025733", "text": "func GrabElection() error {\n\t_, err := db.ExecVTOrc(`\n\t\t\treplace into active_node (\n\t\t\t\t\tanchor, hostname, token, first_seen_active, last_seen_active\n\t\t\t\t) values (\n\t\t\t\t\t1, ?, ?, now(), now()\n\t\t\t\t)\n\t\t\t`,\n\t\tThisHostname, util.ProcessToken.Hash,\n\t)\n\tif err != nil {\n\t\tlog.Error(err)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "f531f935e34b226f068b0a702470c210", "score": "0.49837136", "text": "func (r *RBTree) replace(n *node) *node {\n\n\tif n.r != nil {\n\t\tcurr := n.r\n\t\tfor curr.l != nil {\n\t\t\tcurr = curr.l\n\t\t}\n\t\treturn curr\n\t}\n\n\tif n.l != nil {\n\t\tcurr := n.l\n\t\tfor curr.r != nil {\n\t\t\tcurr = curr.r\n\t\t}\n\t\treturn curr\n\t}\n\n\treturn n\n}", "title": "" }, { "docid": "ca4f52c01ab6fe463a93f2329927b69f", "score": "0.49078956", "text": "func (n *node) replace(new *node){\n\tpN := n.parent;\n\tif pN != nil {\n\t\tif pN.leaves[0] == n {\n\t\t\tpN.leaves[0] = new;\n\t\t} else {\n\t\t\tpN.leaves[1] = new;\n\t\t}\n\t}\n\tif new != nil {\n\t\tnew.parent = pN;\n\t}\n}", "title": "" }, { "docid": "c110b5c59d786718c7031a470c6b367a", "score": "0.4894034", "text": "func swapNode(greed []int, i1, i2 int) bool {\n\ttmp := greed[i1]\n\tgreed[i1] = greed[i2]\n\tgreed[i2] = tmp\n\treturn true\n}", "title": "" }, { "docid": "13f2f14cec2cee8e2833e5831b63ae8f", "score": "0.4891931", "text": "func (n *Node) Replace(node *Node) {\n\tnode.next = n.next\n\tnode.next.prev = node\n\tnode.prev = n.prev\n\tnode.prev.next = node\n}", "title": "" }, { "docid": "50d882539da7446c7130986c7197e188", "score": "0.47861183", "text": "func (b TBoard) EvalNode(depth int) TNode {\n\tb.AlphaBeta(depth)\n\treturn b.Node()\n}", "title": "" }, { "docid": "f5d868c3bdac58abd74285bf37200d79", "score": "0.4697414", "text": "func (t *PRbTree) Replace(item Item) Item {\n\taddr, succ := t.insert(item)\n\tif addr == nil || succ {\n\t\treturn nil\n\t}\n\tr := *addr\n\t*addr = item\n\treturn r\n}", "title": "" }, { "docid": "8d152f03bb77d48940f2f10e273e2d16", "score": "0.4662011", "text": "func (node *Node) ResetDead() {\n\tif node.marker == nil {\n\t\treturn\n\t}\n\tnode.marker.Reset()\n}", "title": "" }, { "docid": "0f1c2bfcf9af3480fecafbe300c02bbf", "score": "0.46336392", "text": "func (group *NodeGroup) MarkDeadNode(nid int) {\n\tgroup.mux.RLock()\n\tdefer group.mux.RUnlock()\n\n\tif group == nil || nid <= 0 {\n\t\treturn\n\t}\n\n\tfor i := range group.nodes {\n\t\tif group.nodes[i].ID == nid {\n\t\t\tatomic.AddUint32(&group.nodes[i].failCount, 1)\n\t\t\tatomic.StoreInt64(&group.nodes[i].failTime, time.Now().Unix())\n\t\t\tbreak\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f50b18b94f9ca7aa799cb7c9ceb896fc", "score": "0.45994568", "text": "func Replace(arr Interface, node interface{}) interface{} {\n\ttop := arr.ItemAt(0)\n\tarr.Set(0, node)\n\tpercolateDown(arr, 0)\n\treturn top\n}", "title": "" }, { "docid": "b8b53c20a8fcb9dc9989be8fbcd19698", "score": "0.4586714", "text": "func (r *ServerRoom) replaceCurrentState(ev *gomatrixserverlib.Event) {\n\ttuple := fmt.Sprintf(\"%s\\x1f%s\", ev.Type(), *ev.StateKey())\n\tr.State[tuple] = ev\n}", "title": "" }, { "docid": "70edd3ac87e119e1d702bcd798429dc6", "score": "0.45808223", "text": "func (n *GroupNode) Replace(node *ProviderNode) (err error) {\n\tfor i, in := range n.in {\n\t\tif node.Key() != in.Key() {\n\t\t\tcontinue\n\t\t}\n\n\t\tn.in[i] = node\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "89a0842c0647b21796fc82123a5acb3f", "score": "0.4553233", "text": "func Reelect() error {\n\t_, err := db.ExecVTOrc(`delete from active_node where anchor = 1`)\n\tif err != nil {\n\t\tlog.Error(err)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "b9bb02208e7177f85ac44e7a477f3932", "score": "0.4507926", "text": "func MirrorNode(nc *nats.Conn, id, newParent, origin string) error {\n\t// fetch the node because we need to know its type\n\tnodes, err := GetNodes(nc, \"all\", id, \"\", true)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(nodes) < 1 {\n\t\treturn errors.New(\"Error fetching node to get type\")\n\t}\n\n\terr = SendEdgePoints(nc, id, newParent, data.Points{\n\t\t{Type: data.PointTypeTombstone, Value: 0, Origin: origin},\n\t\t{Type: data.PointTypeNodeType, Text: nodes[0].Type, Origin: origin},\n\t}, true)\n\n\treturn err\n}", "title": "" }, { "docid": "9f7bba4d40d2b220074beaa2a5c30485", "score": "0.44969177", "text": "func (m *Pruning) delNode(rng *rand.Rand, g *neat.Genome) {\n\n\ttype check struct {\n\t\tAsSource []neat.Connection\n\t\tAsTarget []neat.Connection\n\t}\n\n\t// Build a map of available nodes to delete\n\tvar chk check\n\tvar node neat.Node\n\tavail := make(map[neat.Node]check)\n\tfor _, node = range g.Nodes {\n\t\tif node.NeuronType == neat.Hidden {\n\t\t\tchk = check{make([]neat.Connection, 0, 5), make([]neat.Connection, 0, 5)}\n\t\t\tfor _, conn := range g.Conns {\n\t\t\t\tif conn.Source == node.Innovation {\n\t\t\t\t\tchk.AsSource = append(chk.AsSource, conn)\n\t\t\t\t} else if conn.Target == node.Innovation {\n\t\t\t\t\tchk.AsTarget = append(chk.AsTarget, conn)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif len(chk.AsSource) <= 1 || len(chk.AsTarget) <= 1 {\n\t\t\t\tavail[node] = chk\n\t\t\t}\n\t\t}\n\t}\n\tif len(avail) == 0 {\n\t\treturn // there are nodes available to delete\n\t}\n\n\t// Pick a node to delete\n\tfor node, chk = range avail {\n\t\tbreak\n\t}\n\n\t// Remove dead-end connections\n\tif len(chk.AsSource) == 0 {\n\t\tfor _, conn := range chk.AsTarget {\n\t\t\tdelete(g.Conns, conn.Innovation)\n\t\t}\n\t} else if len(chk.AsTarget) == 0 {\n\t\tfor _, conn := range chk.AsSource {\n\t\t\tdelete(g.Conns, conn.Innovation)\n\t\t}\n\t} else {\n\t\t// Bypass this node in all the connections. Only one of the slices will have more than 1 connection\n\t\tfor _, sc := range chk.AsSource {\n\t\t\tfor _, tc := range chk.AsTarget {\n\t\t\t\tsc.Target = tc.Target\n\t\t\t\ttc.Source = sc.Source\n\t\t\t\tg.Conns[sc.Innovation] = sc\n\t\t\t\tg.Conns[tc.Innovation] = tc\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "fd21ce2f65d4dc55e3e5962ee6c062e5", "score": "0.44381103", "text": "func AttemptElection() (bool, error) {\n\t{\n\t\tsqlResult, err := db.ExecVTOrc(`\n\t\tinsert ignore into active_node (\n\t\t\t\tanchor, hostname, token, first_seen_active, last_seen_active\n\t\t\t) values (\n\t\t\t\t1, ?, ?, now(), now()\n\t\t\t)\n\t\t`,\n\t\t\tThisHostname, util.ProcessToken.Hash,\n\t\t)\n\t\tif err != nil {\n\t\t\tlog.Error(err)\n\t\t\treturn false, err\n\t\t}\n\t\trows, err := sqlResult.RowsAffected()\n\t\tif err != nil {\n\t\t\tlog.Error(err)\n\t\t\treturn false, err\n\t\t}\n\t\tif rows > 0 {\n\t\t\t// We managed to insert a row\n\t\t\treturn true, nil\n\t\t}\n\t}\n\t{\n\t\t// takeover from a node that has been inactive\n\t\tsqlResult, err := db.ExecVTOrc(`\n\t\t\tupdate active_node set\n\t\t\t\thostname = ?,\n\t\t\t\ttoken = ?,\n\t\t\t\tfirst_seen_active=now(),\n\t\t\t\tlast_seen_active=now()\n\t\t\twhere\n\t\t\t\tanchor = 1\n\t\t\t and last_seen_active < (now() - interval ? second)\n\t\t`,\n\t\t\tThisHostname, util.ProcessToken.Hash, config.ActiveNodeExpireSeconds,\n\t\t)\n\t\tif err != nil {\n\t\t\tlog.Error(err)\n\t\t\treturn false, err\n\t\t}\n\t\trows, err := sqlResult.RowsAffected()\n\t\tif err != nil {\n\t\t\tlog.Error(err)\n\t\t\treturn false, err\n\t\t}\n\t\tif rows > 0 {\n\t\t\t// We managed to update a row: overtaking a previous leader\n\t\t\treturn true, nil\n\t\t}\n\t}\n\t{\n\t\t// Update last_seen_active is this very node is already the active node\n\t\tsqlResult, err := db.ExecVTOrc(`\n\t\t\tupdate active_node set\n\t\t\t\tlast_seen_active=now()\n\t\t\twhere\n\t\t\t\tanchor = 1\n\t\t\t\tand hostname = ?\n\t\t\t\tand token = ?\n\t\t`,\n\t\t\tThisHostname, util.ProcessToken.Hash,\n\t\t)\n\t\tif err != nil {\n\t\t\tlog.Error(err)\n\t\t\treturn false, err\n\t\t}\n\t\trows, err := sqlResult.RowsAffected()\n\t\tif err != nil {\n\t\t\tlog.Error(err)\n\t\t\treturn false, err\n\t\t}\n\t\tif rows > 0 {\n\t\t\t// Reaffirmed our own leadership\n\t\t\treturn true, nil\n\t\t}\n\t}\n\treturn false, nil\n}", "title": "" }, { "docid": "9901d02381aa1c1869ce3086c3901843", "score": "0.44124997", "text": "func ReplaceRoute(route Route) error {\n\treturn nil\n}", "title": "" }, { "docid": "276241c9fe4871453e75bb8cb98c3577", "score": "0.43788362", "text": "func NewNodeReplacementHandler(c client.Client, opts *Options) *NodeReplacementHandler {\n\topts.Complete()\n\treturn &NodeReplacementHandler{\n\t\tclient: c,\n\t\tk8sClient: opts.k8sClient,\n\t\tevictionGracePeriod: *opts.EvictionGracePeriod,\n\t\tdrainTimeout: *opts.DrainTimeout,\n\t\tignoreAllDaemonSets: *opts.IgnoreAllDaemonSets,\n\t\tdeleteLocalData: *opts.DeleteLocalData,\n\t\tforcePodDeletion: *opts.ForcePodDeletion,\n\t}\n}", "title": "" }, { "docid": "adfc645459493a897779bed76b8f33b9", "score": "0.437014", "text": "func (p *proxy) rmNode(w http.ResponseWriter, r *http.Request, msg *apc.ActMsg) {\n\tvar (\n\t\topts apc.ActValRmNode\n\t\tsmap = p.owner.smap.get()\n\t)\n\tif err := cos.MorphMarshal(msg.Value, &opts); err != nil {\n\t\tp.writeErrf(w, r, cmn.FmtErrMorphUnmarshal, p.si, msg.Action, msg.Value, err)\n\t\treturn\n\t}\n\tsi := smap.GetNode(opts.DaemonID)\n\tif si == nil {\n\t\terr := cos.NewErrNotFound(\"%s: node %s\", p.si, opts.DaemonID)\n\t\tp.writeErr(w, r, err, http.StatusNotFound)\n\t\treturn\n\t}\n\tvar inMaint bool\n\tif smap.InMaintOrDecomm(si) {\n\t\t// only (maintenance => decommission|shutdown) permitted\n\t\tsname := si.StringEx()\n\t\tswitch msg.Action {\n\t\tcase apc.ActDecommissionNode, apc.ActDecommissionCluster,\n\t\t\tapc.ActShutdownNode, apc.ActShutdownCluster, apc.ActRmNodeUnsafe:\n\t\t\tonl := true\n\t\t\tflt := nlFilter{Kind: apc.ActRebalance, OnlyRunning: &onl}\n\t\t\tif nl := p.notifs.find(flt); nl != nil {\n\t\t\t\tp.writeErrf(w, r, \"rebalance[%s] is currently running, please try (%s %s) later\",\n\t\t\t\t\tnl.UUID(), msg.Action, si.StringEx())\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif !smap.InMaint(si) {\n\t\t\t\tnlog.Errorln(\"Warning: \" + sname + \" is currently being decommissioned\")\n\t\t\t}\n\t\t\tinMaint = true\n\t\t\t// proceeding anyway\n\t\tdefault:\n\t\t\tif smap.InMaint(si) {\n\t\t\t\tp.writeErrMsg(w, r, sname+\" is already in maintenance mode\")\n\t\t\t} else {\n\t\t\t\tp.writeErrMsg(w, r, sname+\" is currently being decommissioned\")\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t}\n\tif p.SID() == opts.DaemonID {\n\t\tp.writeErrf(w, r, \"%s is the current primary, cannot perform action %q on itself\", p, msg.Action)\n\t\treturn\n\t}\n\n\tnlog.Infof(\"%s: %s(%s) opts=%v\", p, msg.Action, si.StringEx(), opts)\n\n\tswitch {\n\tcase si.IsProxy():\n\t\tif _, err := p.mcastMaint(msg, si, false /*reb*/, false /*maintPostReb*/); err != nil {\n\t\t\tp.writeErr(w, r, cmn.NewErrFailedTo(p, msg.Action, si, err))\n\t\t\treturn\n\t\t}\n\t\terrCode, err := p.rmNodeFinal(msg, si, nil)\n\t\tif err != nil {\n\t\t\tp.writeErr(w, r, cmn.NewErrFailedTo(p, msg.Action, si, err), errCode)\n\t\t}\n\tcase msg.Action == apc.ActRmNodeUnsafe: // target unsafe\n\t\tif !opts.SkipRebalance {\n\t\t\terr := errors.New(\"unsafe must be unsafe\")\n\t\t\tdebug.AssertNoErr(err)\n\t\t\tp.writeErr(w, r, err)\n\t\t\treturn\n\t\t}\n\t\terrCode, err := p.rmNodeFinal(msg, si, nil)\n\t\tif err != nil {\n\t\t\tp.writeErr(w, r, cmn.NewErrFailedTo(p, msg.Action, si, err), errCode)\n\t\t}\n\tdefault: // target\n\t\treb := !opts.SkipRebalance && cmn.GCO.Get().Rebalance.Enabled && !inMaint\n\t\tnlog.Infof(\"%s: %s reb=%t\", p, msg.Action, reb)\n\t\tif reb {\n\t\t\tif err := p.canRebalance(); err != nil {\n\t\t\t\tp.writeErr(w, r, err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif err := p.beginRmTarget(si, msg); err != nil {\n\t\t\t\tp.writeErr(w, r, err)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\trebID, err := p.rmTarget(si, msg, reb)\n\t\tif err != nil {\n\t\t\tp.writeErr(w, r, cmn.NewErrFailedTo(p, msg.Action, si, err))\n\t\t\treturn\n\t\t}\n\t\tif rebID != \"\" {\n\t\t\tw.Header().Set(cos.HdrContentLength, strconv.Itoa(len(rebID)))\n\t\t\tw.Write(cos.UnsafeB(rebID))\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c58b7f44f7d4df51562eea93858a7c51", "score": "0.43412563", "text": "func killOneNode(live_table [][]bool, candidates []Node){\n for i:=0; i < 8; i++{\n if (candidates[i].status){\n // kill it, update statuses\n live_table[i][i] = false\n candidates[i].status = false\n return\n }\n }\n}", "title": "" }, { "docid": "f70af3a12b9327557a1e6b78a8d1efd4", "score": "0.43250912", "text": "func Assign(state *state.State, gateway *Gateway, nodes []db.RaftNode) error {\n\t// Figure out our own address.\n\taddress := \"\"\n\terr := state.DB.Cluster.Transaction(context.TODO(), func(ctx context.Context, tx *db.ClusterTx) error {\n\t\tvar err error\n\t\taddress, err = tx.GetLocalNodeAddress(ctx)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Failed to fetch the address of this cluster member: %w\", err)\n\t\t}\n\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Ensure we actually have an address.\n\tif address == \"\" {\n\t\treturn fmt.Errorf(\"Cluster member is not exposed on the network\")\n\t}\n\n\t// Figure out our node identity.\n\tvar info *db.RaftNode\n\tfor i, node := range nodes {\n\t\tif node.Address == address {\n\t\t\tinfo = &nodes[i]\n\t\t}\n\t}\n\n\t// Ensure that our address was actually included in the given list of raft nodes.\n\tif info == nil {\n\t\treturn fmt.Errorf(\"This member is not included in the given list of database nodes\")\n\t}\n\n\t// Replace our local list of raft nodes with the given one (which\n\t// includes ourselves).\n\terr = state.DB.Node.Transaction(context.TODO(), func(ctx context.Context, tx *db.NodeTx) error {\n\t\terr = tx.ReplaceRaftNodes(nodes)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Failed to set raft nodes: %w\", err)\n\t\t}\n\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar transactor func(context.Context, func(ctx context.Context, tx *db.ClusterTx) error) error\n\n\t// If we are already running a dqlite node, it means we have cleanly\n\t// joined the cluster before, using the roles support API. In that case\n\t// there's no need to restart the gateway and we can just change our\n\t// dqlite role.\n\tif gateway.IsDqliteNode() {\n\t\ttransactor = state.DB.Cluster.Transaction\n\t\tgoto assign\n\t}\n\n\t// If we get here it means that we are an upgraded node from cluster\n\t// without roles support, or we didn't cleanly join the cluster. Either\n\t// way, we don't have a dqlite node running, so we need to restart the\n\t// gateway.\n\n\t// Lock regular access to the cluster database since we don't want any\n\t// other database code to run while we're reconfiguring raft.\n\terr = state.DB.Cluster.EnterExclusive()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed to acquire cluster database lock: %w\", err)\n\t}\n\n\ttransactor = state.DB.Cluster.ExitExclusive\n\n\t// Wipe all existing raft data, for good measure (perhaps they were\n\t// somehow leftover).\n\terr = os.RemoveAll(state.OS.GlobalDatabaseDir())\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed to remove existing raft data: %w\", err)\n\t}\n\n\t// Re-initialize the gateway. This will create a new raft factory an\n\t// dqlite driver instance, which will be exposed over gRPC by the\n\t// gateway handlers.\n\terr = gateway.init(false)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed to re-initialize gRPC SQL gateway: %w\", err)\n\t}\n\nassign:\n\tlogger.Info(\"Changing local dqlite raft role\", logger.Ctx{\"id\": info.ID, \"local\": info.Address, \"role\": info.Role})\n\n\tctx, cancel := context.WithTimeout(context.Background(), time.Minute)\n\tdefer cancel()\n\n\tclient, err := client.FindLeader(ctx, gateway.NodeStore(), client.WithDialFunc(gateway.raftDial()))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Connect to cluster leader: %w\", err)\n\t}\n\n\tdefer func() { _ = client.Close() }()\n\n\t// Figure out our current role.\n\trole := db.RaftRole(-1)\n\tcluster, err := client.Cluster(ctx)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Fetch current cluster configuration: %w\", err)\n\t}\n\n\tfor _, server := range cluster {\n\t\tif server.ID == info.ID {\n\t\t\trole = server.Role\n\t\t\tbreak\n\t\t}\n\t}\n\tif role == -1 {\n\t\treturn fmt.Errorf(\"Node %s does not belong to the current raft configuration\", address)\n\t}\n\n\t// If we're stepping back from voter to spare, let's first transition\n\t// to stand-by first and wait for the configuration change to be\n\t// notified to us. This prevent us from thinking we're still voters and\n\t// potentially disrupt the cluster.\n\tif role == db.RaftVoter && info.Role == db.RaftSpare {\n\t\terr = client.Assign(ctx, info.ID, db.RaftStandBy)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Failed to step back to stand-by: %w\", err)\n\t\t}\n\n\t\tlocal, err := gateway.getClient()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Failed to get local dqlite client: %w\", err)\n\t\t}\n\n\t\tnotified := false\n\t\tfor i := 0; i < 10; i++ {\n\t\t\ttime.Sleep(500 * time.Millisecond)\n\t\t\tservers, err := local.Cluster(context.Background())\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"Failed to get current cluster: %w\", err)\n\t\t\t}\n\n\t\t\tfor _, server := range servers {\n\t\t\t\tif server.ID != info.ID {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tif server.Role == db.RaftStandBy {\n\t\t\t\t\tnotified = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif notified {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif !notified {\n\t\t\treturn fmt.Errorf(\"Timeout waiting for configuration change notification\")\n\t\t}\n\t}\n\n\t// Give the Assign operation a bit more budget in case we're promoting\n\t// to voter, since that might require a snapshot transfer.\n\tif info.Role == db.RaftVoter {\n\t\tctx, cancel = context.WithTimeout(context.Background(), 20*time.Second)\n\t\tdefer cancel()\n\t}\n\n\terr = client.Assign(ctx, info.ID, info.Role)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed to assign role: %w\", err)\n\t}\n\n\tgateway.info = info\n\n\t// Unlock regular access to our cluster database.\n\terr = transactor(context.TODO(), func(ctx context.Context, tx *db.ClusterTx) error {\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Cluster database initialization failed: %w\", err)\n\t}\n\n\t// Generate partial heartbeat request containing just a raft node list.\n\tif state.Endpoints != nil {\n\t\tNotifyHeartbeat(state, gateway)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c021d6e9b59eff6468dea4bb3c2dc41a", "score": "0.43216056", "text": "func chooseRandomNode(view *arraymap.ArrayMap, excludeId uint64) *node.Node {\n\tif view.Len() == 0 {\n\t\treturn nil\n\t}\n\tindex := rand.Intn(view.Len())\n\tnd := view.GetValueAt(index).(*node.Node)\n\tif nd.Id == excludeId {\n\t\tif view.Len() == 1 {\n\t\t\treturn nil\n\t\t}\n\t\tnd = view.GetValueAt((index + 1) % view.Len()).(*node.Node)\n\t}\n\treturn nd\n}", "title": "" }, { "docid": "fb0bea4dcdbf3e9f2e39048bf3be0ed0", "score": "0.43191785", "text": "func (a *StaticAutorepair) RepairNodes(toBeRepairedNodes []*apiv1.Node) {\n\tasgs := a.AutorepairingContext.CloudProvider.NodeGroups()\n\n\tfor _, asg := range asgs {\n\t\tasgToBeRepariedNodes, _ := a.AsgNotReadyNodes(asg, toBeRepairedNodes)\n\t\t//glog.Info(\"\\n\\n\\n\")\n\t\t//glog.Infof(\"--- Repairing %d nodes for asg-%d ---\", len(asgToBeRepariedNodes), (i+1))\n\t\ta.AsgRepairNodes(asg, asgToBeRepariedNodes)\n\t}\n}", "title": "" }, { "docid": "603cfdb9cc5de643dedf37ee000da857", "score": "0.42868796", "text": "func (c *PoolCluster) Replace(dst interface{}, opts ...Option) (Result, error) {\n\ts, _ := c.Session()\n\tdebugPrint(\"db: [session #%v] Replace\", s.v)\n\treturn s.Replace(dst, opts...)\n}", "title": "" }, { "docid": "16a582184bf086a1eb320d3b07046fc5", "score": "0.4285333", "text": "func (s *PresenceService) UpsertNode(ctx context.Context, server types.Server) (*types.KeepAlive, error) {\n\tif server.GetNamespace() == \"\" {\n\t\tserver.SetNamespace(apidefaults.Namespace)\n\t}\n\n\tif n := server.GetNamespace(); n != apidefaults.Namespace {\n\t\treturn nil, trace.BadParameter(\"cannot place node in namespace %q, custom namespaces are deprecated\", n)\n\t}\n\tvalue, err := services.MarshalServer(server)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\tlease, err := s.Put(ctx, backend.Item{\n\t\tKey: backend.Key(nodesPrefix, server.GetNamespace(), server.GetName()),\n\t\tValue: value,\n\t\tExpires: server.Expiry(),\n\t\tID: server.GetResourceID(),\n\t})\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\tif server.Expiry().IsZero() {\n\t\treturn &types.KeepAlive{}, nil\n\t}\n\treturn &types.KeepAlive{\n\t\tType: types.KeepAlive_NODE,\n\t\tLeaseID: lease.ID,\n\t\tName: server.GetName(),\n\t}, nil\n}", "title": "" }, { "docid": "53654c9f1f266ac8fc12d30e4353a2fe", "score": "0.42420915", "text": "func (r *Raft) removeNode(id uint64) {\n\t// Your Code Here (3A).\n\tif _, ok := r.Prs[id]; ok {\n\t\tdelete(r.Prs, id)\n\t\tif r.isLeader() {\n\t\t\tr.updateCommit()\n\t\t}\n\t}\n\tr.PendingConfIndex = None\n}", "title": "" }, { "docid": "1b4d702df72d9c1a649150c573e2f029", "score": "0.42371848", "text": "func (queue BHeap) Replace(node Node) (PriorityQueue, Node) {\n\ttmp := queue[0]\n\tqueue[0] = node\n\tqueue.siftDown(0)\n\treturn queue, tmp\n}", "title": "" }, { "docid": "c6cf247ddcc900160fbc8feb0718c929", "score": "0.42352584", "text": "func (c *ConnectorAdapter) Replace(space interface{},\n\ttuple interface{}) (*tarantool.Response, error) {\n\treturn c.pool.Replace(space, tuple, c.mode)\n}", "title": "" }, { "docid": "6ca4516a69deb6dcd9b0d515fe7495b0", "score": "0.4229416", "text": "func replace(t *Binary, c *Binary) {\n\tif t.isLeftChild() {\n\t\tt.Parent.Left = c\n\t} else if t.Parent != nil {\n\t\tt.Parent.Right = c\n\t}\n\tc.Parent = t.Parent\n\tc.Insert(t.Value)\n}", "title": "" }, { "docid": "5e80e041b1b60916171950951b4d9ee0", "score": "0.42196798", "text": "func (c *Class) Replace(info *Object) error {\n\tif info == nil {\n\t\treturn ErrNoArg\n\t}\n\toptions, err := validateClassObject(unix.RTM_NEWTCLASS, info)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn c.action(unix.RTM_NEWTCLASS, netlink.Create, &info.Msg, options)\n}", "title": "" }, { "docid": "2c0f5a7c768c0beaefe038d014305df9", "score": "0.42028806", "text": "func (lavalink *Lavalink) removeNode(node *Node) error {\n\tidx := -1\n\tfor i, n := range lavalink.nodes {\n\t\tif n == *node {\n\t\t\tidx = i\n\t\t\tbreak\n\t\t}\n\t}\n\tif idx == -1 {\n\t\treturn errNodeNotFound\n\t}\n\n\tnode.stop()\n\n\t// temp var for easier reading\n\tn := lavalink.nodes\n\tz := len(n) - 1\n\n\tn[idx] = n[z] // swap idx with last\n\tn = n[:z]\n\n\tlavalink.nodes = n\n\treturn nil\n}", "title": "" }, { "docid": "ef3ba6b6fb9c716271feaa9a36bdb33b", "score": "0.4202132", "text": "func replaceWithLeftMax(tree *AvlTree) {\n\ttree.root = Max(tree.left)\n\tremoveMaxFromSubtree(&tree.left)\n\ttree.updateHeight()\n}", "title": "" }, { "docid": "bca76ddb2e8c884d5a1542606c12eb22", "score": "0.41951978", "text": "func setKeyToDeadNode(key string) {\n\tvar kvVal ValReply\n\n\tputArgs := PutArgs{\n\t\tKey: key,\n\t\tVal: \"dead\"}\n\terr := client.Call(\"KeyValService.Put\", putArgs, &kvVal)\n\tcheckError(err)\n}", "title": "" }, { "docid": "f86459fe5269db0a24e5ad96aa8399b2", "score": "0.4189795", "text": "func (hn *hostNode) removeNode() {\n\thn.weight = hn.weight.Sub(hn.hostEntry.weight)\n\thn.taken = false\n\tcurrent := hn.parent\n\tfor current != nil {\n\t\tcurrent.weight = current.weight.Sub(hn.hostEntry.weight)\n\t\tcurrent = current.parent\n\t}\n}", "title": "" }, { "docid": "f66f8d0e8ef296eae1bc810f4f54e343", "score": "0.41798517", "text": "func Rebalance(state *state.State, gateway *Gateway, unavailableMembers []string) (string, []db.RaftNode, error) {\n\t// If we're a standalone node, do nothing.\n\tif gateway.memoryDial != nil {\n\t\treturn \"\", nil, nil\n\t}\n\n\tnodes, err := gateway.currentRaftNodes()\n\tif err != nil {\n\t\treturn \"\", nil, fmt.Errorf(\"Get current raft nodes: %w\", err)\n\t}\n\n\troles, err := newRolesChanges(state, gateway, nodes, unavailableMembers)\n\tif err != nil {\n\t\treturn \"\", nil, err\n\t}\n\n\trole, candidates := roles.Adjust(gateway.info.ID)\n\n\tif role == -1 {\n\t\t// No node to promote\n\t\treturn \"\", nodes, nil\n\t}\n\n\tlocalClusterAddress := state.LocalConfig.ClusterAddress()\n\n\t// Check if we have a spare node that we can promote to the missing role.\n\tcandidateAddress := candidates[0].Address\n\tlogger.Info(\"Found cluster member whose role needs to be changed\", logger.Ctx{\"candidateAddress\": candidateAddress, \"newRole\": role, \"local\": localClusterAddress})\n\n\tfor i, node := range nodes {\n\t\tif node.Address == candidateAddress {\n\t\t\tnodes[i].Role = role\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn candidateAddress, nodes, nil\n}", "title": "" }, { "docid": "cdc90b68a0bb8835530cee4341bc2228", "score": "0.41797724", "text": "func (b *Board4) NeighborActive(c Coord4, d Coord4) bool {\n\tc.x += d.x\n\tc.y += d.y\n\tc.z += d.z\n\tc.w += d.w\n\tif active, ok := b.grid[c.Pack()]; ok {\n\t\treturn active\n\t}\n\treturn false\n}", "title": "" }, { "docid": "8094ef943143a40444a2c6cefb3a7085", "score": "0.41637346", "text": "func (tr *RTree) Replace(\n\toldMin, oldMax [2]float32, oldData interface{},\n\tnewMin, newMax [2]float32, newData interface{},\n) {\n\tif tr.deleteWithResult(oldMin, oldMax, oldData) {\n\t\ttr.Insert(newMin, newMax, newData)\n\t}\n}", "title": "" }, { "docid": "5a46c10100eafe4bda08a1a31c61179e", "score": "0.4162399", "text": "func (c *Animator) ChooseNode(ctx context.Context, rhs *RequestHandlerState) {\n\trhs.RetryLater = true\n}", "title": "" }, { "docid": "c5365818fad8cf101f9f058d02334af7", "score": "0.41593698", "text": "func (c *pageCache) replace(p *page) {\n\tc.used--\n\tif *memLog {\n\t\tlog.Printf(\"replacing %s\\n\", p)\n\t}\n\tp.prev = nil\n\tp.next = nil\n\tc.free = append(c.free, p)\n}", "title": "" }, { "docid": "50f9ca5b6d6d1d4d5e0edb78666727f9", "score": "0.41592118", "text": "func (pe *PodEvictor) replacePodNodeNameNodeAffinity(affinity *v1.Affinity, nodeName, ownerID string) (*v1.Affinity,\n\tint) {\n\tnodeSelReq := v1.NodeSelectorRequirement{\n\t\tKey: \"kubernetes.io/hostname\",\n\t\tOperator: v1.NodeSelectorOpNotIn,\n\t\tValues: []string{nodeName},\n\t}\n\n\tnodeSelector := &v1.NodeSelector{\n\t\tNodeSelectorTerms: []v1.NodeSelectorTerm{\n\t\t\t{\n\t\t\t\tMatchExpressions: []v1.NodeSelectorRequirement{nodeSelReq},\n\t\t\t},\n\t\t},\n\t}\n\n\tcount := 1\n\tif affinity == nil {\n\t\treturn &v1.Affinity{\n\t\t\tNodeAffinity: &v1.NodeAffinity{\n\t\t\t\tRequiredDuringSchedulingIgnoredDuringExecution: nodeSelector,\n\t\t\t},\n\t\t}, count\n\t}\n\n\tif affinity.NodeAffinity == nil {\n\t\taffinity.NodeAffinity = &v1.NodeAffinity{\n\t\t\tRequiredDuringSchedulingIgnoredDuringExecution: nodeSelector,\n\t\t}\n\t\treturn affinity, count\n\t}\n\n\tnodeAffinity := affinity.NodeAffinity\n\tif nodeAffinity.RequiredDuringSchedulingIgnoredDuringExecution == nil {\n\t\tnodeAffinity.RequiredDuringSchedulingIgnoredDuringExecution = nodeSelector\n\t\treturn affinity, count\n\t}\n\n\tterms := nodeAffinity.RequiredDuringSchedulingIgnoredDuringExecution.NodeSelectorTerms\n\tif terms == nil {\n\t\tnodeAffinity.RequiredDuringSchedulingIgnoredDuringExecution.NodeSelectorTerms = []v1.NodeSelectorTerm{\n\t\t\t{\n\t\t\t\tMatchFields: []v1.NodeSelectorRequirement{nodeSelReq},\n\t\t\t},\n\t\t}\n\t\treturn affinity, count\n\t}\n\n\tnewTerms := make([]v1.NodeSelectorTerm, 0)\n\tfor _, term := range terms {\n\t\tif term.MatchExpressions == nil {\n\t\t\tcontinue\n\t\t}\n\t\tmes, noScheduleCount := pe.getNodeSelectorRequirement(term, nodeName, ownerID, nodeSelReq)\n\t\tcount = noScheduleCount\n\t\tterm.MatchExpressions = mes\n\t\tnewTerms = append(newTerms, term)\n\t}\n\n\t// Replace node selector with the new one.\n\tnodeAffinity.RequiredDuringSchedulingIgnoredDuringExecution.NodeSelectorTerms = newTerms\n\taffinity.NodeAffinity = nodeAffinity\n\treturn affinity, count\n}", "title": "" }, { "docid": "222c4f6188370089757c94289d6b2a9e", "score": "0.4159114", "text": "func (g *GRPCServer) UpsertNode(ctx context.Context, node *types.ServerV2) (*types.KeepAlive, error) {\n\tauth, err := g.authenticate(ctx)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\t// Extract peer (remote host) from context and if the node sent 0.0.0.0 as\n\t// its address (meaning it did not set an advertise address) update it with\n\t// the address of the peer.\n\tp, ok := peer.FromContext(ctx)\n\tif !ok {\n\t\treturn nil, trace.BadParameter(\"unable to find peer\")\n\t}\n\tnode.SetAddr(utils.ReplaceLocalhost(node.GetAddr(), p.Addr.String()))\n\n\tkeepAlive, err := auth.ServerWithRoles.UpsertNode(ctx, node)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\treturn keepAlive, nil\n}", "title": "" }, { "docid": "3f10ff622c42eccb15e63db35b7d6fff", "score": "0.4140008", "text": "func SetNodeUnschedulable(node *v1.Node) {\n\tnode.Spec.Unschedulable = true\n}", "title": "" }, { "docid": "381e9e0a9d5d77d11b629bcdf1ea3231", "score": "0.41380268", "text": "func UpdateNode(n *Node, routesTypes RouteType, ownAddr net.IP) {\n\tclusterConf.Lock()\n\tdefer clusterConf.Unlock()\n\n\tni := n.Identity()\n\n\toldNode, oldNodeExists := clusterConf.nodes[ni]\n\t// Ignore kubernetes updates if the node already exists and its source\n\t// was not from kubernetes. Also ignore any updates if the oldNode was\n\t// updated by the local agent.\n\tif oldNodeExists {\n\t\tswitch {\n\t\tcase oldNode.Source != FromKubernetes && n.Source == FromKubernetes:\n\t\t\treturn\n\t\tcase oldNode.Source == FromAgentLocal && n.Source != FromAgentLocal:\n\t\t\treturn\n\t\t}\n\t}\n\n\tif (routesTypes & TunnelRoute) != 0 {\n\t\t// FIXME if PodCIDR is empty retrieve the CIDR from the KVStore\n\t\tlog.WithFields(logrus.Fields{\n\t\t\tlogfields.IPAddr: n.GetNodeIP(false),\n\t\t\tlogfields.V4Prefix: n.IPv4AllocCIDR,\n\t\t\tlogfields.V6Prefix: n.IPv6AllocCIDR,\n\t\t}).Debug(\"bpf: Setting tunnel endpoint\")\n\n\t\t// Update the tunnel mapping of the node. In case the node has\n\t\t// changed its CIDR range, a new entry in the map is created.\n\t\t// The old entry is removed in the next step to ensure that the\n\t\t// update appears atomic in the datapath.\n\t\tupdateTunnelMapping(n, n.IPv4AllocCIDR)\n\t\tupdateTunnelMapping(n, n.IPv6AllocCIDR)\n\n\t\t// Handle the case when the CIDR range of the node has changed\n\t\t// or the node no longer announce a CIDR range and remove the\n\t\t// entry in the tunnel map\n\t\tif oldNodeExists {\n\t\t\tif tunnelCIDRDeletionRequired(oldNode.IPv4AllocCIDR, n.IPv4AllocCIDR) {\n\t\t\t\tdeleteTunnelMapping(oldNode.IPv4AllocCIDR)\n\t\t\t}\n\n\t\t\tif tunnelCIDRDeletionRequired(oldNode.IPv6AllocCIDR, n.IPv6AllocCIDR) {\n\t\t\t\tdeleteTunnelMapping(oldNode.IPv6AllocCIDR)\n\t\t\t}\n\t\t}\n\t}\n\n\tif (routesTypes & DirectRoute) != 0 {\n\t\tupdateIPRoute(oldNode, n, ownAddr)\n\t}\n\n\tclusterConf.nodes[ni] = n\n\tclusterConf.replaceHostRoutes()\n}", "title": "" }, { "docid": "1b459d00c1eca1e9d93f9f467a0a49c5", "score": "0.412432", "text": "func Replace(d Routable) bool {\n\tn := d.FQDN()\n\n\tlock.Lock()\n\toldRoute, exists := endpoints[n]\n\tif exists {\n\t\tgo oldRoute.Replaced()\n\t}\n\n\tendpoints[n] = d\n\tlock.Unlock()\n\n\treturn exists\n}", "title": "" }, { "docid": "cc85fdf64d579d153ce91ac0008d7e25", "score": "0.41109192", "text": "func (c *Animator) NodeDelete(ctx context.Context, rhs *RequestHandlerState) {\n\trhs.RetryLater = true\n}", "title": "" }, { "docid": "46c7303655340040e0ca6561d4e67be0", "score": "0.41104963", "text": "func (m *Potassium) MaxIdleNode(nodes []*types.Node) (*types.Node, error) {\n\tif len(nodes) < 1 {\n\t\treturn nil, types.ErrInsufficientNodes\n\t}\n\tpos := 0\n\tnode := nodes[pos]\n\tmin := float64(node.CPU.Total())/float64(node.InitCPU.Total()) + float64(node.MemCap)/float64(node.InitMemCap)\n\tfor i, node := range nodes {\n\t\tidle := float64(node.CPU.Total())/float64(node.InitCPU.Total()) + float64(node.MemCap)/float64(node.InitMemCap)\n\t\tif idle < min {\n\t\t\tpos = i\n\t\t\tmin = idle\n\t\t}\n\t}\n\treturn nodes[pos], nil\n}", "title": "" }, { "docid": "69c266c7cd8f3ad3990045af959ea00f", "score": "0.41098806", "text": "func (p *Pool) selectNode(selected nodeList) (Node, error) {\n\n\tdefer scopedLock(&p.mutx)()\n\n\tif len(p.nodes) == 0 {\n\t\treturn Node{}, errors.New(\"disque: no nodes in pool\")\n\t}\n\n\tnodes := nodeList{}\n\tfor _, node := range p.nodes {\n\t\tif node.Priority <= maxPriority && !selected.contains(node) {\n\t\t\tnodes = append(nodes, node)\n\t\t}\n\t}\n\tif len(nodes) == 0 {\n\t\treturn Node{}, errors.New(\"disque: no nodes left to select from\")\n\t}\n\n\treturn nodes[rand.Intn(len(nodes))], nil\n\n}", "title": "" }, { "docid": "994fc9c882a57cb5f08498016c945152", "score": "0.4104051", "text": "func (m *BlockModifier) ReplaceNPCTable(npcTable decode.NPCTable) error {\n\tif len(npcTable.NPCs) == 0 {\n\t\treturn nil\n\t}\n\n\tdb, err := decode.DecodeBlock(m.body, m.dim)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcb, err := decode.CarveBlock(m.body, m.dim)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ten, err := decode.EncodeNPCTable(npcTable, db.CentralDir.NPCTable)\n\tif err != nil {\n\t\treturn err\n\t}\n\toverflow := len(en) - len(cb.NPCTable)\n\n\tif overflow != 0 {\n\t\treturn wlerr.Errorf(\n\t\t\t\"failed to replace NPC table: \"+\n\t\t\t\t\"replacement has size different from original: overflow=%d\",\n\t\t\toverflow)\n\t}\n\n\toff := db.Offsets.NPCTable\n\tcopy(m.body.SecSection[off:off+len(en)], en)\n\n\treturn nil\n}", "title": "" }, { "docid": "f443b591efaea246d2755df2d78c05b0", "score": "0.41033846", "text": "func (it *PRbIter) Replace(new Item) Item {\n\tif it == nil || it.node == nil || new == nil {\n\t\treturn nil\n\t}\n\told := it.node.data\n\tit.node.data = new\n\treturn old\n}", "title": "" }, { "docid": "6924cff155ec9d533d46fb8a9c2a9261", "score": "0.40757495", "text": "func replacegroup(s, d int) {\n\tfor _, c := range group2grid[s] {\n\t\tassigngroup(c, d)\n\t}\n\tdelete(group2grid, s)\n}", "title": "" }, { "docid": "a2f2ee94d101141b46edb6f46111f1ab", "score": "0.4074672", "text": "func generateNodeGroup(nodeGroup cloudprovider.NodeGroup,\n\tupcomingNodes map[string]int, newPriorities priorities,\n\tnodeDeletionTracker *NodeDeletionTracker) (*NodeGroup, error) {\n\ttargetSize, err := nodeGroup.TargetSize()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get target size of nodegroup %v: %v\", nodeGroup.Id(), err)\n\t}\n\tnodes, err := nodeGroup.Nodes()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get nodes of nodegroup %v: %v\", nodeGroup.Id(), err)\n\t}\n\ttemplate, err := nodeGroup.TemplateNodeInfo()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get node template of nodegroup %v: %v\", nodeGroup.Id(), err)\n\t}\n\tips := make([]string, 0)\n\tfor _, n := range nodes {\n\t\tips = append(ips, n.Id)\n\t}\n\tpriority := 0\n\tif newPriorities != nil {\n\t\tp, ok := newPriorities[nodeGroup.Id()]\n\t\tif ok {\n\t\t\tpriority = p\n\t\t}\n\t}\n\tdeletingSize := nodeDeletionTracker.GetDeletionsInProgress(nodeGroup.Id())\n\n\treturn &NodeGroup{\n\t\tNodeGroupID: nodeGroup.Id(),\n\t\tMaxSize: nodeGroup.MaxSize(),\n\t\tMinSize: nodeGroup.MinSize(),\n\t\tDesiredSize: targetSize,\n\t\tUpcomingSize: upcomingNodes[nodeGroup.Id()],\n\t\tDeletingSize: deletingSize,\n\t\tNodeTemplate: Template{\n\t\t\tCPU: template.Allocatable.MilliCPU / 1000,\n\t\t\tMem: template.Allocatable.Memory,\n\t\t\tGPU: template.Allocatable.ScalarResources[gpu.ResourceNvidiaGPU],\n\t\t\tLabels: template.Node().Labels,\n\t\t\tTaints: template.Node().Spec.Taints,\n\t\t},\n\t\tNodeIPs: ips,\n\t\tPriority: priority,\n\t}, nil\n}", "title": "" }, { "docid": "ff1f21e97a412968a321eac23d6952f7", "score": "0.4072836", "text": "func (t *BuildTree) replaceOrRegister(state *BuildTreeNode) {\n\tchild := state.Edges[state.lastChildKey]\n\n\tif child.hasChildren() {\n\t\tt.replaceOrRegister(child)\n\t}\n\t// If there exists a state q in the tree such that\n\t// it is in the register and equivalent\n\t// to (duplicate of) the child:\n\t// \t1) Set the state's lastChildKey to q\n\t//\t2) delete child\n\t// Otherwise, add child to the register.\n\t// (Deleting the child is implicitly garbage-collected.)\n\tchildHash := child.hash()\n\tif equiv, ok := t.register[childHash]; ok {\n\t\tstate.Edges[equiv.char] = equiv\n\t\tt.nodeCount--\n\t} else {\n\t\tt.register[childHash] = child\n\t}\n}", "title": "" }, { "docid": "a8f1999ab79181458b4b9a9faf43d6ea", "score": "0.40727973", "text": "func (_Dosproxy *DosproxyTransactor) UnregisterNode(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Dosproxy.contract.Transact(opts, \"unregisterNode\")\n}", "title": "" }, { "docid": "c0197e3f4e66c52b3e6f9ae289a7d68f", "score": "0.40684745", "text": "func (m *MockupOrganizationProvider) DeleteNode(organizationID string, nodeID string) derrors.Error {\n\tm.Lock()\n\tdefer m.Unlock()\n\tif m.unsafeExistsNode(organizationID, nodeID) {\n\t\tprevious := m.nodes[organizationID]\n\t\tnewList := make([]string, 0, len(previous)-1)\n\t\tfor _, id := range previous {\n\t\t\tif id != nodeID {\n\t\t\t\tnewList = append(newList, id)\n\t\t\t}\n\t\t}\n\t\tm.nodes[organizationID] = newList\n\t\treturn nil\n\t}\n\treturn derrors.NewNotFoundError(\"node\").WithParams(organizationID, nodeID)\n}", "title": "" }, { "docid": "789e1a459ac83b758f889817189ea1bd", "score": "0.4067591", "text": "func removeNodeFromList(deadNode *pb.Node) {\n\tfor i, node := range nodeList.Nodes {\n\t\t// Since both pointers, just compares their address\n\t\tif node == deadNode {\n\t\t\tnodeList.Nodes = append(nodeList.Nodes[:i], nodeList.Nodes[i+1:]...)\n\t\t\tif len(nodeList.Nodes) > 0 {\n\t\t\t\tnotifyNodeUpdate(deadNode, false)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ef75e2f6961e65400f2d4e5a56132cbf", "score": "0.4050432", "text": "func (o *StorageNetAppBaseIpInterface) SetCurrentNode(v string) {\n\to.CurrentNode = &v\n}", "title": "" }, { "docid": "a7c538d99e3be21d7dfbab106a01cb94", "score": "0.40475875", "text": "func (p Transpose) Replaced(from, to core.Sequenceable) core.Sequenceable {\n\tif core.IsIdenticalTo(p, from) {\n\t\treturn to\n\t}\n\tif core.IsIdenticalTo(p.Target, from) {\n\t\treturn Transpose{Target: to, Semitones: p.Semitones}\n\t}\n\t// https://play.golang.org/p/qHbbK_sTo84\n\tif r, ok := p.Target.(core.Replaceable); ok {\n\t\treturn r.Replaced(from, to)\n\t}\n\treturn p\n}", "title": "" }, { "docid": "8de114844ae7e951f00b749546495b2d", "score": "0.40462738", "text": "func (o *Object) ReplaceArchetype(a *data.Archetype) {\n\to.Archetype = a\n\to.blocking = o.Archetype.Blocking\n\n\t// Force a refresh.\n\to.tile.gameMap.RefreshObject(o.id)\n\n\t// Clear old timers.\n\to.timers = make([]Timer, 0)\n\t// Inactive object if we have no timers.\n\tif len(o.Archetype.Timers) == 0 {\n\t\to.tile.gameMap.InactiveObject(o.id)\n\t} else {\n\t\t// Otherwise add timers!\n\t\to.addTimers(o.Archetype.Timers)\n\t}\n}", "title": "" }, { "docid": "d533e4bb2072a4da6b68bf76a3075af0", "score": "0.40442702", "text": "func (self *Device) SetNodeA(member bool) {\n self.Object.Set(\"node\", member)\n}", "title": "" }, { "docid": "52c2b14a7fc6f069cd236909d4132cb2", "score": "0.40330997", "text": "func (t *TreeView) SetCurrentNode(node *TreeNode) *TreeView {\n\tt.currentNode = node\n\treturn t\n}", "title": "" }, { "docid": "b8b971107ae36d1c1776998e2bd475bd", "score": "0.40326583", "text": "func (g *activityGauge) SetActive(key string) {\n\tg.mu.Lock()\n\tdefer g.mu.Unlock()\n\n\ts := g.states[key]\n\ts.tick = time.Now()\n\tg.states[key] = s\n}", "title": "" }, { "docid": "564b6c96f915ff67274f15dc1a09e115", "score": "0.40245077", "text": "func (r *Ring) RemoveNode(id string) {}", "title": "" }, { "docid": "bca5ea003ca67111ad5c5a8f25b2a44f", "score": "0.40219364", "text": "func (rt *routingTable) Node(nodeID NodeID, addr net.UDPAddr) (n *node, wasInserted bool) {\n\tn = rt.FindByAddress(addr)\n\tif n != nil {\n\t\treturn n, false\n\t}\n\n\tn = newNode(addr, nodeID)\n\n\trt.Insert(n)\n\treturn n, true\n}", "title": "" }, { "docid": "03096cd442163ab2388a4ce2af595f3c", "score": "0.40132356", "text": "func (gui *Gui) replaceContext(c Context) error {\n\tgui.g.Update(func(*gocui.Gui) error {\n\t\tgui.State.ContextManager.Lock()\n\t\tdefer gui.State.ContextManager.Unlock()\n\n\t\tif len(gui.State.ContextManager.ContextStack) == 0 {\n\t\t\tgui.State.ContextManager.ContextStack = []Context{c}\n\t\t} else {\n\t\t\t// replace the last item with the given item\n\t\t\tgui.State.ContextManager.ContextStack = append(gui.State.ContextManager.ContextStack[0:len(gui.State.ContextManager.ContextStack)-1], c)\n\t\t}\n\n\t\treturn gui.activateContext(c)\n\t})\n\n\treturn nil\n}", "title": "" }, { "docid": "50c5c4d87585bf9b1a05f75e635df754", "score": "0.40015233", "text": "func rebalance(node *treeNode) *treeNode {\n\tif node.ltree.getHeight()-node.rtree.getHeight() == 2 {\n\t\tltree := node.ltree\n\n\t\tif ltree.ltree.getHeight() <= ltree.rtree.getHeight() {\n\t\t\tnode = node.rotateLeftRight()\n\t\t} else {\n\t\t\tnode = node.rotateRight()\n\t\t}\n\n\t} else if node.rtree.getHeight()-node.ltree.getHeight() == 2 {\n\t\trtree := node.rtree\n\n\t\tif rtree.rtree.getHeight() <= rtree.ltree.getHeight() {\n\t\t\tnode = node.rotateRightLeft()\n\t\t} else {\n\t\t\tnode = node.rotateLeft()\n\t\t}\n\t}\n\n\tnode.height = node.maxHeight() + 1\n\treturn node\n}", "title": "" }, { "docid": "70b198c34adb2f07a572ac9b89363b14", "score": "0.40011686", "text": "func (b *blockWalker) replaceVar(v ir.Node, typ meta.TypesMap, reason string, flags meta.VarFlags) {\n\tb.ctx.sc.ReplaceVar(v, typ, reason, flags)\n\tsv, ok := v.(*ir.SimpleVar)\n\tif !ok {\n\t\treturn\n\t}\n\n\tb.trackVarName(v, sv.Name)\n}", "title": "" }, { "docid": "6a633eeed0a203d7120961175eed8aeb", "score": "0.39991882", "text": "func RemoveFromCircle(node Node) {\n //Generate a string identifier for node and add to circle\n nodeStr := \"localhost:\" + strconv.Itoa(node.Port)\n circle.Remove(Hashcode(nodeStr))\n fmt.Println(\"Removed Node\", nodeStr, \"Hashcode\", Hashcode(nodeStr))\n}", "title": "" }, { "docid": "3e93eba7126c8b9f7afb276cd35cdd75", "score": "0.39990532", "text": "func (s *Service) ReplaceVariable(ctx context.Context, m *platform.Variable) error {\n\ts.variableKV.Store(m.ID.String(), m)\n\treturn nil\n}", "title": "" }, { "docid": "d290e2211d3d92c7f8fa0b0d18ed461f", "score": "0.39883408", "text": "func (ag *agent) handleShuffle(msg *message.Shuffle) {\n\tag.aView.Lock()\n\tag.pView.Lock()\n\tdefer ag.aView.Unlock()\n\tdefer ag.pView.Unlock()\n\n\tttl := msg.GetTtl()\n\tif ttl > 0 && ag.aView.Len() > 1 {\n\t\tnode := chooseRandomNode(ag.aView, msg.GetId())\n\t\tmsg.Ttl = proto.Uint32(ttl - 1)\n\t\tgo ag.forwardShuffle(node, msg)\n\t\treturn\n\t}\n\n\tcandidates := msg.GetCandidates()\n\treplyCandidates := chooseRandomCandidates(ag.pView, len(candidates))\n\tgo ag.shuffleReply(msg, replyCandidates)\n\ti := 0\n\tfor _, candidate := range candidates {\n\t\tnode := &node.Node{\n\t\t\tId: candidate.GetId(),\n\t\t\tAddr: candidate.GetAddr(),\n\t\t}\n\t\t//ag.addNodePassiveView(node)\n\t\tif node.Id == ag.id || ag.aView.Has(node.Id) || ag.pView.Has(node.Id) {\n\t\t\tcontinue\n\t\t}\n\t\tfor ag.pView.Len() >= ag.cfg.PViewSize {\n\t\t\tif i < len(replyCandidates) {\n\t\t\t\tag.pView.Remove(replyCandidates[i].GetId())\n\t\t\t\ti++\n\t\t\t} else {\n\t\t\t\tn := chooseRandomNode(ag.pView, 0)\n\t\t\t\tag.pView.Remove(n.Id)\n\t\t\t}\n\t\t}\n\t\tag.pView.Add(node.Id, node)\n\t}\n\treturn\n}", "title": "" }, { "docid": "1f0c7bedabfd6c5733a3006241dff9c1", "score": "0.39847463", "text": "func (_AccelerateNode *AccelerateNodeTransactor) ResetEthNode(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _AccelerateNode.contract.Transact(opts, \"resetEthNode\")\n}", "title": "" }, { "docid": "81df9afb074192eb9afde247012f3095", "score": "0.39781284", "text": "func (_RollupEventBridge *RollupEventBridgeTransactor) NodeRejected(opts *bind.TransactOpts, nodeNum *big.Int) (*types.Transaction, error) {\n\treturn _RollupEventBridge.contract.Transact(opts, \"nodeRejected\", nodeNum)\n}", "title": "" }, { "docid": "b929b2bc2c5ad42d291f0947d6c58ca5", "score": "0.3975896", "text": "func (fn fnode) replace(i, j int, rep fnode) fnode {\n\tnr := len(rep)\n\td := nr - (j - i)\n\tfn = bytes.Grow(fn, d)\n\tcopy(fn[i+nr:], fn[j:])\n\tcopy(fn[i:], rep)\n\tif d < 0 {\n\t\tfn = fn[:len(fn)+d]\n\t}\n\treturn fn\n}", "title": "" }, { "docid": "7114c58f5c9889b867d224034c1673e5", "score": "0.39709613", "text": "func (node *Node) replace(text string, root map[string]*Node) string {\n\tif root == nil || text == \"\" {\n\t\treturn text\n\t}\n\ttextr := []rune(text)\n\ti, s, e, l := 0, 0, 0, len(textr)\n\tbf := bytes.Buffer{}\n\twords := make(map[string]*Node)\n\tvar back []*Node\nloop:\n\tfor e < l {\n\t\twords = root\n\t\ti = e\n\t\t// Maximum Matching Principle, Matching Backwards First\n\t\tfor ; i < l; i++ {\n\t\t\tword := string(textr[i])\n\t\t\tif n, ok := words[word]; ok {\n\t\t\t\tback = append(back, n)\n\t\t\t\tif n.Child != nil {\n\t\t\t\t\twords = n.Child\n\t\t\t\t} else if n.Placeholders != \"\" {\n\t\t\t\t\tbf.WriteString(string(textr[s:e]))\n\t\t\t\t\tbf.WriteString(n.Placeholders)\n\t\t\t\t\ti++\n\t\t\t\t\ts, e = i, i\n\t\t\t\t\tcontinue loop\n\t\t\t\t} else {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t} else if n != nil && n.Placeholders != \"\" {\n\t\t\t\tbf.WriteString(string(textr[s:e]))\n\t\t\t\tbf.WriteString(n.Placeholders)\n\t\t\t\ts, e = i, i\n\t\t\t\tcontinue loop\n\t\t\t} else {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\t// Backward match fails, backtracking.\n\t\tfor ; i > e; i-- {\n\t\t\tbl := len(back)\n\t\t\tif bl == 0 {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tlast := back[bl-1]\n\t\t\tback = back[:bl-1]\n\t\t\tif last.Placeholders != \"\" {\n\t\t\t\tbf.WriteString(string(textr[s:e]))\n\t\t\t\tbf.WriteString(last.Placeholders)\n\t\t\t\ts, e = i, i\n\t\t\t\tcontinue loop\n\t\t\t}\n\t\t}\n\n\t\te++\n\t\tback = back[:0]\n\t}\n\tbf.WriteString(string(textr[s:e]))\n\n\treturn bf.String()\n}", "title": "" }, { "docid": "6c8222b55744abb40df7e9dde18dbd6e", "score": "0.39694953", "text": "func ExampleEC2_ReplaceRoute_shared00() {\n\tsvc := ec2.New(session.New())\n\tinput := &ec2.ReplaceRouteInput{\n\t\tDestinationCidrBlock: aws.String(\"10.0.0.0/16\"),\n\t\tGatewayId: aws.String(\"vgw-9a4cacf3\"),\n\t\tRouteTableId: aws.String(\"rtb-22574640\"),\n\t}\n\n\tresult, err := svc.ReplaceRoute(input)\n\tif err != nil {\n\t\tif aerr, ok := err.(awserr.Error); ok {\n\t\t\tswitch aerr.Code() {\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": "9bf20349f92a12828f82959286ee881a", "score": "0.3968448", "text": "func (md *MetadataMgr) rebalanceNodes() error {\n\t// lock metadatamgr from doing other things\n\tmd.Lock()\n\tdefer md.Unlock()\n\n\t// get most used and least used nodes and see if they differ by atleast two\n\tmoNode := md.cluster.GetMostUsedNode()\n\tluNode := md.cluster.GetLeastUsedNode()\n\tif moNode != nil && luNode != nil && (moNode.NumShards-luNode.NumShards) >= 2 {\n\t\t// pick a shard on this node that doesnt have a replica on target node\n\t\tmovingShard, err := md.cluster.FindMoveCandidateOnNode(moNode, luNode.NodeUUID)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Could not find a shard to move on node %s. Err: %v\", moNode.NodeUUID, err)\n\t\t\treturn err\n\t\t}\n\n\t\tlog.Infof(\"%s/%s Moving replica %d/%d from node %s to %s\", md.clusterType, md.nodeUUID, movingShard.ShardID, movingShard.ReplicaID, movingShard.NodeUUID, luNode.NodeUUID)\n\n\t\t// create a new replica (this will sync data from primary)\n\t\t_, err = md.createNewReplica(movingShard.shard, luNode.NodeUUID)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Error creating new replica. Err: %v\", err)\n\t\t\treturn err\n\t\t}\n\n\t\t// remove replica\n\t\terr = md.removeReplica(movingShard, movingShard.NodeUUID)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Error removing the replica %+v. Err: %v\", movingShard, err)\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b1f1da3eca1eea49152422395322af70", "score": "0.39606783", "text": "func (e *Executor) ReplaceVariables(initial, task string, vars Vars) (string, error) {\n\tvars, err := e.getVariables(task, vars)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\ttempl, err := template.New(\"\").Funcs(templateFuncs).Parse(initial)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tb := bytes.NewBuffer(nil)\n\tif err = templ.Execute(b, vars); err != nil {\n\t\treturn \"\", err\n\t}\n\treturn b.String(), nil\n}", "title": "" }, { "docid": "6dd596f65b70612bd8111a57a7e07cf6", "score": "0.39600956", "text": "func (h *HashRing) RemoveNode(name string) {\n\th.Lock()\n\n\tnewNodes := []*node{}\n\tfor _, n := range h.nodes {\n\t\tif n.nodeName != name {\n\t\t\tnewNodes = append(newNodes, n)\n\t\t}\n\t}\n\n\th.nodes = newNodes\n\n\th.Unlock()\n}", "title": "" }, { "docid": "f00429a41ca3dbb88afe525c17ddda05", "score": "0.39554575", "text": "func (_AccelerateNode *AccelerateNodeTransactor) ResetIpfsNode(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _AccelerateNode.contract.Transact(opts, \"resetIpfsNode\")\n}", "title": "" }, { "docid": "481abb22adbd422dd2002c1af0308650", "score": "0.395337", "text": "func DeleteNode(ni Identity, routesTypes RouteType) {\n\tclusterConf.Lock()\n\tdefer clusterConf.Unlock()\n\n\tif n, ok := clusterConf.nodes[ni]; ok {\n\t\tif (routesTypes & TunnelRoute) != 0 {\n\t\t\tlog.WithFields(logrus.Fields{\n\t\t\t\tlogfields.IPAddr: n.GetNodeIP(false),\n\t\t\t\tlogfields.V4Prefix: n.IPv4AllocCIDR,\n\t\t\t\tlogfields.V6Prefix: n.IPv6AllocCIDR,\n\t\t\t}).Debug(\"bpf: Removing tunnel endpoint\")\n\n\t\t\tdeleteTunnelMapping(n.IPv4AllocCIDR)\n\t\t\tdeleteTunnelMapping(n.IPv6AllocCIDR)\n\n\t\t\t// Always delete routes when in tunnel mode as well.\n\t\t\tdeleteNodeRoute(n.IPv4AllocCIDR)\n\t\t\tdeleteNodeRoute(n.IPv6AllocCIDR)\n\t\t}\n\t\tif (routesTypes & DirectRoute) != 0 {\n\t\t\tdeleteIPRoute(n)\n\t\t}\n\t\tdelete(clusterConf.nodes, ni)\n\t\tclusterConf.replaceHostRoutes()\n\t}\n}", "title": "" }, { "docid": "c4534495f24341e483667bbc252b998f", "score": "0.3946221", "text": "func (pc *PoolConfig) replaceBlockDevice() {\n\tglog.V(2).Info(\"block device replacement is not supported yet\")\n}", "title": "" }, { "docid": "2468e3f935206ef07da0d28fcb4bc30b", "score": "0.39419746", "text": "func updateNode(id ident, fn func(*node)) {\n\tn := nodes[id]\n\tfn(&n)\n\tnodes[id] = n\n}", "title": "" }, { "docid": "0477853ffbb629ad8609989eae5d358e", "score": "0.3938768", "text": "func (r *NodeDomain) RegisterNodeNoWait(pk string, role string) {\n\tvar args [2]interface{}\n\targs[0] = pk\n\targs[1] = role\n\n\tvar argsSerialized []byte\n\n\terr := proxyctx.Current.Serialize(args, &argsSerialized)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t_, err = proxyctx.Current.RouteCall(r.Reference, false, \"RegisterNode\", argsSerialized)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "52805abefdfe9cc926281be9f660741e", "score": "0.39337054", "text": "func CopyNode(t *testing.T, clockSource *fakeclock.FakeClock, oldNode *TestNode, forceNewCluster bool, kr *SimpleKeyRotator) (*TestNode, context.Context) {\n\twrappedListener := RecycleWrappedListener(oldNode.Listener)\n\tsecurityConfig := oldNode.SecurityConfig\n\tserverOpts := []grpc.ServerOption{grpc.Creds(securityConfig.ServerTLSCreds)}\n\ts := grpc.NewServer(serverOpts...)\n\n\tcfg := raft.DefaultNodeConfig()\n\n\tif kr == nil {\n\t\tkr = oldNode.KeyRotator\n\t}\n\n\tnewNodeOpts := raft.NodeOptions{\n\t\tID: securityConfig.ClientTLSCreds.NodeID(),\n\t\tAddr: oldNode.Address,\n\t\tConfig: cfg,\n\t\tStateDir: oldNode.StateDir,\n\t\tForceNewCluster: forceNewCluster,\n\t\tClockSource: clockSource,\n\t\tSendTimeout: 2 * time.Second,\n\t\tTLSCredentials: securityConfig.ClientTLSCreds,\n\t\tKeyRotator: kr,\n\t}\n\n\tctx, cancel := context.WithCancel(context.Background())\n\tn := raft.NewNode(newNodeOpts)\n\n\thealthServer := health.NewHealthServer()\n\tapi.RegisterHealthServer(s, healthServer)\n\traft.Register(s, n)\n\n\tgo func() {\n\t\t// After stopping, we should receive an error from Serve\n\t\trequire.Error(t, s.Serve(wrappedListener))\n\t}()\n\n\thealthServer.SetServingStatus(\"Raft\", api.HealthCheckResponse_SERVING)\n\n\treturn &TestNode{\n\t\tNode: n,\n\t\tListener: wrappedListener,\n\t\tSecurityConfig: securityConfig,\n\t\tAddress: newNodeOpts.Addr,\n\t\tStateDir: newNodeOpts.StateDir,\n\t\tcancel: cancel,\n\t\tServer: s,\n\t\tKeyRotator: kr,\n\t}, ctx\n}", "title": "" }, { "docid": "8fea1f2b34572a445657b9db7d8e7db8", "score": "0.3930692", "text": "func Replace(fstTmpl *fasttemplate.Template, replaceMap map[string]string, allowUnresolved bool) (string, error) {\n\tvar unresolvedErr error\n\treplacedTmpl := fstTmpl.ExecuteFuncString(func(w io.Writer, tag string) (int, error) {\n\t\treplacement, ok := replaceMap[tag]\n\t\tif !ok {\n\t\t\tif allowUnresolved {\n\t\t\t\t// just write the same string back\n\t\t\t\treturn w.Write([]byte(fmt.Sprintf(\"{{%s}}\", tag)))\n\t\t\t}\n\t\t\tunresolvedErr = errors.Errorf(errors.CodeBadRequest, \"failed to resolve {{%s}}\", tag)\n\t\t\treturn 0, nil\n\t\t}\n\t\t// The following escapes any special characters (e.g. newlines, tabs, etc...)\n\t\t// in preparation for substitution\n\t\treplacement = strconv.Quote(replacement)\n\t\treplacement = replacement[1 : len(replacement)-1]\n\t\treturn w.Write([]byte(replacement))\n\t})\n\tif unresolvedErr != nil {\n\t\treturn \"\", unresolvedErr\n\t}\n\treturn replacedTmpl, nil\n}", "title": "" }, { "docid": "933da6808e22cafc4d1a395753fbba7e", "score": "0.39296976", "text": "func NewNode(Seq int, State AcceptorState) *Node {\n\treturn &Node{State, Seq, nil}\n}", "title": "" }, { "docid": "df5a7f3c4519e7489f535f24303992c2", "score": "0.39197454", "text": "func (m *SyncManager) transitionPassiveSyncer(s *GossipSyncer) error {\n\tlog.Debugf(\"Transitioning passive GossipSyncer(%x) to active\",\n\t\ts.cfg.peerPub)\n\n\tif err := s.ProcessSyncTransition(ActiveSync); err != nil {\n\t\treturn err\n\t}\n\n\tm.Lock()\n\tm.activeSyncers[s.cfg.peerPub] = s\n\tdelete(m.pendingActiveSyncers, s.cfg.peerPub)\n\tm.Unlock()\n\n\treturn nil\n}", "title": "" }, { "docid": "87141f1528ad6667930f4f0d57086243", "score": "0.39089146", "text": "func MoveNode(nc *nats.Conn, id, oldParent, newParent, origin string) error {\n\tif newParent == oldParent {\n\t\treturn errors.New(\"can't move node to itself\")\n\t}\n\n\t// fetch the node because we need to know its type\n\tnodes, err := GetNodes(nc, \"all\", id, \"\", true)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(nodes) < 1 {\n\t\treturn errors.New(\"Error fetching node to get type\")\n\t}\n\n\terr = SendEdgePoints(nc, id, newParent, data.Points{\n\t\t{Type: data.PointTypeTombstone, Value: 0, Origin: origin},\n\t\t{Type: data.PointTypeNodeType, Text: nodes[0].Type, Origin: origin},\n\t}, true)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = SendEdgePoint(nc, id, oldParent, data.Point{\n\t\tType: data.PointTypeTombstone,\n\t\tValue: 1,\n\t}, true)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ad07f07e8a1840672eb98e84b8647be5", "score": "0.38953966", "text": "func rightRotate(presentNode *Node) {\n\t// a--\n\t// |\n\t// b -- ==> -- b --\n\t// | | |\n\t// c a c\n\n\t// Rename nodes to easy notation.\n\tA := presentNode\n\tB := presentNode.rightChild\n\n\t// Treat corner cases.\n\tif A.parent != nil {\n\t\tif A == A.parent.leftChild {\n\t\t\tA.parent.leftChild = B\n\t\t} else {\n\t\t\tA.parent.rightChild = B\n\t\t}\n\t}\n\n\t// Change pointers to perform rotation.\n\tB.parent = A.parent\n\tA.parent = B\n\tA.rightChild = B.leftChild\n\n\t// Take care of children of rotated node\n\tif B.leftChild != nil {\n\t\tB.leftChild.parent = A\n\t}\n\tB.leftChild = A\n\n\t// Re-compute balance factor.\n\t// Note: order is relevant here.\n\tcomputeBalanceFactor(A)\n\tcomputeBalanceFactor(B)\n}", "title": "" }, { "docid": "981897eda51ee802e6662c33012d7cda", "score": "0.38923797", "text": "func (pn *paxosNode) handleReplace(finishChan chan struct{}, errorChan chan error) {\n\targs := paxosrpc.ReplaceServerArgs{\n\t\tSrvID: pn.srvId,\n\t\tHostport: pn.myHostPort,\n\t}\n\tcollectChan := make(chan struct{})\n\t// call ReplaceServer RPC call to every node\n\tfor _, cli := range pn.cliMap {\n\t\tgo pn.callReplaceServer(args, cli, collectChan, errorChan)\n\t}\n\tfor i := 0; i < pn.numNodes; i++ {\n\t\t<-collectChan\n\t}\n\t// get node data from one of the nodes\n\tcatchupArgs := paxosrpc.ReplaceCatchupArgs{}\n\tfor _, cli := range pn.cliMap {\n\t\tvar reply paxosrpc.ReplaceCatchupReply\n\t\terr := cli.Call(\"PaxosNode.RecvReplaceCatchup\", catchupArgs, &reply)\n\t\tif err != nil {\n\t\t\terrorChan <- err\n\t\t\treturn\n\t\t}\n\t\tvar newNode paxosNode\n\t\tjson.Unmarshal(reply.Data, &newNode)\n\t\tpn.KeyValue.Value = newNode.KeyValue.Value\n\t\tpn.KeyN.Value = newNode.KeyN.Value\n\t\tpn.KeyNp.Value = newNode.KeyNp.Value\n\t\tbreak\n\t}\n\tfinishChan <- struct{}{}\n}", "title": "" }, { "docid": "2dceec70b90740a0f83f39035589e942", "score": "0.38897693", "text": "func (w World) nextStateDead(c Cell) bool {\n\tn := w.Neighbors(c)\n\n\tif n == 3 {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "244e07db33fd4a13b6f1600cde4e23df", "score": "0.388961", "text": "func createNewActiveRSToReplaceInactiveRS(bgd *demov1.BlueGreenDeployment, kubeClient *kubernetes.Clientset) error {\n\trsClient := kubeClient.ExtensionsV1beta1().ReplicaSets(bgd.Namespace)\n\tnewActiveRSName := inactiveRS.Name\n\tnewActiveRSColor := inactiveRS.Spec.Template.Labels[\"color\"]\n\terr := rsClient.Delete(inactiveRS.Name, &metav1.DeleteOptions{})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to delete inactive RS %q: %v\", newActiveRSName, err)\n\t}\n\n\tif err := waitRSDeletionToComplete(inactiveRS, rsClient); err != nil {\n\t\tfmt.Errorf(\"timeout waiting inactive RS %q deletion: %v\", inactiveRS.Name, err)\n\t}\n\n\tnewRS, err := rsClient.Create(newReplicaSet(newActiveRSName, newActiveRSColor, bgd, false))\n\tif err != nil && !errors.IsAlreadyExists(err) {\n\t\treturn fmt.Errorf(\"failed to create a new RS %q: %v\", newRS.Name, err)\n\t} else if err == nil {\n\t\tfmt.Printf(\"created a new RS %q\\n\\n\", newRS.Name)\n\t}\n\n\tnewActiveRS, err := scaleRS(newRS, bgd.Spec.Replicas, rsClient)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to scale up new RS %q: %v\", newRS.Name, err)\n\t}\n\n\tencodedPodTemplateSpec, err := json.Marshal(bgd.Spec.Template.Spec)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to encode bgd pod template spec: %v\", err)\n\t}\n\tnewActiveRS.Annotations[bgdPodTemplateSpecAnnotation] = fmt.Sprintf(\"%s\", encodedPodTemplateSpec)\n\n\tsvc, err = updateService(svc.Name, bgd.Namespace, kubeClient, func(service *corev1.Service) {\n\t\tupdatedLabels := newActiveRS.Spec.Template.Labels\n\t\tservice.Labels = updatedLabels\n\t\tservice.Spec.Selector = updatedLabels\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to update service %q to point to new active RS %q: %v\", svc.Name, newActiveRS.Name, err)\n\t}\n\n\tnewInactiveRS, err := scaleRS(activeRS, 0, rsClient)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to scale down active RS %q: %v\", activeRS.Name, err)\n\t}\n\tnewInactiveRS.Annotations[bgdPodTemplateSpecAnnotation] = activeRS.Annotations[bgdPodTemplateSpecAnnotation]\n\n\tactiveRS = newActiveRS\n\tinactiveRS = newInactiveRS\n\tfmt.Printf(\"active RS: %q, inactive RS: %q, service label selectors: %q\\n\\n\", activeRS.Name, inactiveRS.Name, svc.Spec.Selector)\n\treturn nil\n}", "title": "" } ]
a1fa0591291ac239950e96c6ea87d275
NewKeeper create new keeper and returns object
[ { "docid": "ac3a9c2c2e7dd495958fc07cc4acae2b", "score": "0.6966699", "text": "func NewKeeper(\n\tcdc codec.BinaryMarshaler,\n\tstoreKey sdk.StoreKey,\n\tparamstore paramtypes.Subspace,\n\tchainKeeper chainKeeper.Keeper,\n\tbankKeeper bankKeeper.Keeper,\n\tmoduleCommunicator ModuleCommunicator,\n) Keeper {\n\tif !paramstore.HasKeyTable() {\n\t\tparamstore = paramstore.WithKeyTable(types.ParamKeyTable())\n\t}\n\treturn Keeper{\n\t\tcdc: cdc,\n\t\tstoreKey: storeKey,\n\t\tparamSubspace: paramstore,\n\t\tChainKeeper: chainKeeper,\n\t\tBankKeeper: bankKeeper,\n\t\tModuleCommunicator: moduleCommunicator,\n\t}\n}", "title": "" } ]
[ { "docid": "c4c58e953223a6d28b1da5fc125c4da2", "score": "0.75172454", "text": "func NewKeeper(cdc *codec.Codec, key sdk.StoreKey, instanceKeeper types.InstanceKeeper, ownershipKeeper types.OwnershipKeeper) Keeper {\n\tkeeper := Keeper{\n\t\tstoreKey: key,\n\t\tcdc: cdc,\n\t\tinstanceKeeper: instanceKeeper,\n\t\townershipKeeper: ownershipKeeper,\n\t}\n\treturn keeper\n}", "title": "" }, { "docid": "5d1f9b0ef0e017575fd2efe1b19a3532", "score": "0.74696034", "text": "func NewKeeper(cdc *codec.Codec, key sdk.StoreKey) Keeper {\n\tkeeper := Keeper{\n\t\tstoreKey: key,\n\t}\n\treturn keeper\n}", "title": "" }, { "docid": "9802f24b4ab3573293878d9e9cb5c1a2", "score": "0.7459492", "text": "func NewKeeper(cdc *codec.Codec, key sdk.StoreKey) Keeper {\n\tkeeper := Keeper{\n\t\tstoreKey: key,\n\t\tcdc: cdc,\n\t}\n\treturn keeper\n}", "title": "" }, { "docid": "850ff985f0062b25b6450785a334fe56", "score": "0.745928", "text": "func NewKeeper(cdc *codec.Codec, key sdk.StoreKey, sk types.StakingKeeper, paramspace types.ParamSubspace) Keeper {\n\treturn Keeper{\n\t\tstoreKey: key,\n\t\tcdc: cdc,\n\t\tsk: sk,\n\t\tparamspace: paramspace.WithKeyTable(types.ParamKeyTable()),\n\t}\n}", "title": "" }, { "docid": "de4184fc1d9cff764439e25858cbf324", "score": "0.74560916", "text": "func NewKeeper(cdc *codec.Codec, key sdk.StoreKey, bk types.BankKeeper, ak types.AuthKeeper, paramSpace params.Subspace) Keeper {\n\treturn Keeper{\n\t\tstoreKey: key,\n\t\tbk: bk,\n\t\tak: ak,\n\t\tcdc: cdc,\n\t\tparamSpace: paramSpace.WithTypeTable(types.ParamTypeTable()),\n\t}\n}", "title": "" }, { "docid": "fb917f0e3368c72f734b057a55843924", "score": "0.7439101", "text": "func NewKeeper(cdc *codec.Codec, storeKey sdk.StoreKey) Keeper {\n\treturn Keeper{\n\t\tStoreKey: storeKey,\n\t\tCdc: cdc,\n\t}\n}", "title": "" }, { "docid": "fb917f0e3368c72f734b057a55843924", "score": "0.7439101", "text": "func NewKeeper(cdc *codec.Codec, storeKey sdk.StoreKey) Keeper {\n\treturn Keeper{\n\t\tStoreKey: storeKey,\n\t\tCdc: cdc,\n\t}\n}", "title": "" }, { "docid": "e61944c6641e468cbc08f8aa23c7dc13", "score": "0.73989594", "text": "func NewKeeper(cdc *codec.Codec, storeKey sdk.StoreKey) Keeper {\n\treturn Keeper{\n\t\tcdc: cdc,\n\t\tstoreKey: storeKey,\n\t}\n}", "title": "" }, { "docid": "3534c40dbb16d0a18ccba80a2db17a94", "score": "0.73589706", "text": "func NewKeeper(cdc *codec.Codec, key sdk.StoreKey, paramspace types.ParamSubspace) Keeper {\n\tkeeper := Keeper{\n\t\tstoreKey: key,\n\t\tcdc: cdc,\n\t\tparamspace: paramspace.WithKeyTable(types.ParamKeyTable()),\n\t}\n\treturn keeper\n}", "title": "" }, { "docid": "3534c40dbb16d0a18ccba80a2db17a94", "score": "0.73589706", "text": "func NewKeeper(cdc *codec.Codec, key sdk.StoreKey, paramspace types.ParamSubspace) Keeper {\n\tkeeper := Keeper{\n\t\tstoreKey: key,\n\t\tcdc: cdc,\n\t\tparamspace: paramspace.WithKeyTable(types.ParamKeyTable()),\n\t}\n\treturn keeper\n}", "title": "" }, { "docid": "7d086dba3d9c0954f554374592f3ae6e", "score": "0.73403174", "text": "func NewKeeper(\n\tcdc *codec.Codec,\n\tstoreKey sdk.StoreKey,\n\tparamSpace params.Subspace,\n\taccountKeeper auth.AccountKeeper,\n\tdistributionKeeper distribution.Keeper,\n) Keeper {\n\tps := paramSpace.WithKeyTable(types.ParamKeyTable())\n\treturn Keeper{\n\t\tcdc: cdc,\n\t\tstoreKey: storeKey,\n\t\tparamSubspace: ps,\n\t\taccountKeeper: accountKeeper,\n\t\tdistributionKeeper: distributionKeeper,\n\t}\n}", "title": "" }, { "docid": "06717e9825e1f6c2f5e78d86833ac6b7", "score": "0.7311481", "text": "func NewKeeper(cdc *codec.Codec, storeKey sdk.StoreKey, coinKeeper types.BankKeeper) Keeper {\n\treturn Keeper{\n\t\tcdc: cdc,\n\t\tstoreKey: storeKey,\n\t\tCoinKeeper: coinKeeper,\n\t}\n}", "title": "" }, { "docid": "412cb57cac2312e7b3cfed4e057b012b", "score": "0.72884375", "text": "func NewKeeper(coinKeeper bank.Keeper, storeKey sdk.StoreKey, cdc *codec.Codec) Keeper {\n\treturn Keeper{\n\t\tCoinKeeper: coinKeeper,\n\t\tstoreKey: storeKey,\n\t\tcdc: cdc,\n\t}\n}", "title": "" }, { "docid": "917ea65a1715be4144548ce829301580", "score": "0.72830385", "text": "func NewKeeper(cdc *codec.Codec, key sdk.StoreKey, paramSpace params.Subspace, supplyKeeper types.SupplyKeeper, codespace sdk.CodespaceType) Keeper {\n\n\treturn Keeper{\n\t\tstoreKey: key,\n\t\tcdc: cdc,\n\t\tparamSpace: paramSpace.WithKeyTable(ParamKeyTable()),\n\t\tSupplyKeeper: supplyKeeper,\n\t\tcodespace: codespace,\n\t}\n}", "title": "" }, { "docid": "2f36cba72b1fa89bd4004d6a79999e10", "score": "0.72724736", "text": "func NewKeeper(cdc *codec.Codec, key sdk.StoreKey, paramSpace params.Subspace, feeCollectorName string,\n\tbankKeeper bank.Keeper, supplyKeeper supply.Keeper, accountKeeper auth.AccountKeeper, stakingKeeper staking.Keeper,\n\tregisterKeeper register.Keeper,\n) Keeper {\n\tkeeper := Keeper{\n\t\tcdc: cdc,\n\t\tstoreKey: key,\n\t\tparamSpace: paramSpace.WithKeyTable(types.ParamKeyTable()),\n\t\tfeeCollectorName: feeCollectorName,\n\t\tBankKeeper: bankKeeper,\n\t\tSupplyKeeper: supplyKeeper,\n\t\tAccountKeeper: accountKeeper,\n\t\tStakingKeeper: stakingKeeper,\n\t\tRegisterKeeper: registerKeeper,\n\t}\n\treturn keeper\n}", "title": "" }, { "docid": "be5d90bd02578b4fe08b8da5c714f0e6", "score": "0.7264668", "text": "func NewKeeper(storeKey sdk.StoreKey, cdc *codec.Codec) Keeper {\n\treturn Keeper{\n\t\tStoreKey: storeKey,\n\t\tCdc: cdc,\n\t}\n}", "title": "" }, { "docid": "bad49c47fa26bb54c9a56cfe6aaffcc2", "score": "0.72637147", "text": "func NewKeeper(\n\tcdc *codec.Codec, key sdk.StoreKey,\n\tchannelKeeper types.ChannelKeeper, portKeeper types.PortKeeper,\n\taccountKeeper auth.AccountKeeper, bankKeeper bank.Keeper,\n\tscopedKeeper capability.ScopedKeeper,\n) Keeper {\n\n\treturn Keeper{\n\t\tstoreKey: key,\n\t\tcdc: cdc,\n\t\taccountKeeper: accountKeeper,\n\t\tbankKeeper: bankKeeper,\n\t\tchannelKeeper: channelKeeper,\n\t\tportKeeper: portKeeper,\n\t\tscopedKeeper: scopedKeeper,\n\t}\n}", "title": "" }, { "docid": "f43bf5e64468efc01326a8522cb62a9d", "score": "0.722407", "text": "func NewKeeper(\n\tcdc *codec.Codec,\n\tstoreKey sdk.StoreKey,\n\tparamStore params.Subspace,\n\trouter msmodule.MsRouter,\n\tpermsRequesters ...perms.RequestModulePermissions,\n) Keeper {\n\tk := Keeper{\n\t\tcdc: cdc,\n\t\tstoreKey: storeKey,\n\t\tparamStore: paramStore.WithKeyTable(types.ParamKeyTable()),\n\t\trouter: router,\n\t\tmodulePerms: types.NewModulePerms(),\n\t}\n\tfor _, requester := range permsRequesters {\n\t\tk.modulePerms.AutoAddRequester(requester)\n\t}\n\n\treturn k\n}", "title": "" }, { "docid": "84bd7cd6dc03915b07fe7dd554552377", "score": "0.71934575", "text": "func NewKeeper(opts ...Option) (Keeper, error) {\n\t// Dependency injection.\n\to := []Option{\n\t\tWithAddrOption(\"localhost\"),\n\t\tWithPortOption(\"8500\"),\n\t\tWithConfigOption(consul_api.DefaultConfig()),\n\t}\n\to = append(o, opts...)\n\tct := &Container{}\n\tfor _, opt := range o {\n\t\topt.apply(ct)\n\t}\n\n\t// Connect to consul.\n\tct.config.Address = ct.address()\n\tclient, err := consul_api.NewClient(ct.config)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"[err] consul client\")\n\t}\n\tct.catalog = client.Catalog()\n\tct.agent = client.Agent()\n\treturn Keeper(ct), nil\n}", "title": "" }, { "docid": "deea0741f3e3c3c2df7beb351c21e022", "score": "0.7190728", "text": "func NewKeeper(cdc *codec.LegacyAmino, storeKey sdk.StoreKey,\r\n\tparamspace params.Subspace, accountKeeper types.AccountKeeper,\r\n\tbankKeeper types.BankKeeper, supplyKeeper types.SupplyKeeper, treasuryKeeper types.TreasuryKeeper, router sdk.Router,\r\n\tsupportedFeatures string,\r\n\twasmConfig *config.Config) Keeper {\r\n\thomeDir := viper.GetString(flags.FlagHome)\r\n\twasmer, err := wasm.NewWasmer(filepath.Join(homeDir, config.DBDir), supportedFeatures, 0)\r\n\r\n\tif err != nil {\r\n\t\tpanic(err)\r\n\t}\r\n\r\n\t// set KeyTable if it has not already been set\r\n\tif !paramspace.HasKeyTable() {\r\n\t\tparamspace = paramspace.WithKeyTable(types.ParamKeyTable())\r\n\t}\r\n\r\n\treturn Keeper{\r\n\t\tstoreKey: storeKey,\r\n\t\tcdc: cdc,\r\n\t\tparamSpace: paramspace,\r\n\t\twasmer: *wasmer,\r\n\t\taccountKeeper: accountKeeper,\r\n\t\tbankKeeper: bankKeeper,\r\n\t\tsupplyKeeper: supplyKeeper,\r\n\t\ttreasuryKeeper: treasuryKeeper,\r\n\t\trouter: router,\r\n\t\twasmConfig: wasmConfig,\r\n\t\tloggingWhitelist: wasmConfig.WhitelistToMap(),\r\n\t\tmsgParser: types.NewModuleMsgParser(),\r\n\t\tquerier: types.NewModuleQuerier(),\r\n\t}\r\n}", "title": "" }, { "docid": "2f323748c6cf8e102291efbc14707a07", "score": "0.7160324", "text": "func NewKeeper(\n\tcdc *codec.Codec, key sdk.StoreKey, fileDir string, feeCollectorName string,\n\tparamSpace params.Subspace, supplyKeeper types.SupplyKeeper,\n\tstakingKeeper types.StakingKeeper, distrKeeper types.DistrKeeper,\n\towasmVM *owasm.Vm,\n) Keeper {\n\tif !paramSpace.HasKeyTable() {\n\t\tparamSpace = paramSpace.WithKeyTable(ParamKeyTable())\n\t}\n\treturn Keeper{\n\t\tstoreKey: key,\n\t\tcdc: cdc,\n\t\tfileCache: filecache.New(fileDir),\n\t\tfeeCollectorName: feeCollectorName,\n\t\tparamSpace: paramSpace,\n\t\tsupplyKeeper: supplyKeeper,\n\t\tstakingKeeper: stakingKeeper,\n\t\tdistrKeeper: distrKeeper,\n\t\towasmVM: owasmVM,\n\t}\n}", "title": "" }, { "docid": "16f738a7a1b12f13d3ed31bf806f747c", "score": "0.7156657", "text": "func NewKeeper(\n\tcdc codec.BinaryMarshaler,\n\tstoreKey sdk.StoreKey,\n\tparamSubspace paramtypes.Subspace,\n\tchainKeeper chainManagerKeeper.Keeper,\n\tstakingKeeper stakingKeeper.Keeper,\n\tcheckpointKeeper checkpointKeeper.Keeper,\n\tcaller helper.ContractCaller,\n) Keeper {\n\t// create keeper\n\tif !paramSubspace.HasKeyTable() {\n\t\tparamSubspace = paramSubspace.WithKeyTable(types.ParamKeyTable())\n\t}\n\tkeeper := Keeper{\n\t\tcdc: cdc,\n\t\tstoreKey: storeKey,\n\t\tparamSpace: paramSubspace,\n\t\tchainKeeper: chainKeeper,\n\t\tsk: stakingKeeper,\n\t\tcheckpointKeeper: checkpointKeeper,\n\t\tContractCaller: caller,\n\t}\n\treturn keeper\n}", "title": "" }, { "docid": "cf5ec76ff39875fe70a55a8ed74ad186", "score": "0.7119878", "text": "func NewKeeper(\n\tcdc *codec.Codec,\n\tstoreKey sdk.StoreKey,\n\tparamStore params.Subspace,\n\tpermsRequesters ...perms.RequestModulePermissions,\n) Keeper {\n\tk := Keeper{\n\t\tcdc: cdc,\n\t\tstoreKey: storeKey,\n\t\tparamStore: paramStore.WithKeyTable(types.ParamKeyTable()),\n\t\tmodulePerms: types.NewModulePerms(),\n\t}\n\tfor _, requester := range permsRequesters {\n\t\tk.modulePerms.AutoAddRequester(requester)\n\t}\n\n\treturn k\n}", "title": "" }, { "docid": "6cd57d2a0a0984bd9cdd547c8ce8dbcb", "score": "0.70632964", "text": "func NewKeeper(cdc *codec.Codec, storeKey sdk.StoreKey, paramSpace params.Subspace, tokens TokenKeeper) Keeper {\n\tps := paramSpace.WithKeyTable(types.ParamKeyTable())\n\treturn Keeper{\n\t\tcdc: cdc,\n\t\tstoreKey: storeKey,\n\t\ttokens: tokens,\n\t\tparamSpace: ps,\n\t}\n}", "title": "" }, { "docid": "1b87e1d4f3d2386a99ca404acafbcd62", "score": "0.7030753", "text": "func NewKeeper(cdc *codec.Codec, key, tkey sdk.StoreKey, supplyKeeper types.SupplyKeeper,\n\tparamstore params.Subspace) Keeper {\n\n\t// ensure bonded and not bonded module accounts are set\n\tif addr := supplyKeeper.GetModuleAddress(types.BondedPoolName); addr == nil {\n\t\tpanic(fmt.Sprintf(\"%s module account has not been set\", types.BondedPoolName))\n\t}\n\n\tif addr := supplyKeeper.GetModuleAddress(types.NotBondedPoolName); addr == nil {\n\t\tpanic(fmt.Sprintf(\"%s module account has not been set\", types.NotBondedPoolName))\n\t}\n\n\treturn Keeper{\n\t\tstoreKey: key,\n\t\tstoreTKey: tkey,\n\t\tcdc: cdc,\n\t\tsupplyKeeper: supplyKeeper,\n\t\tparamstore: paramstore.WithKeyTable(ParamKeyTable()),\n\t\thooks: nil,\n\t\tvalidatorCache: make(map[string]cachedValidator, aminoCacheSize),\n\t\tvalidatorCacheList: list.New(),\n\t}\n}", "title": "" }, { "docid": "a74b97ba1e4d6093f66779ffa9caf359", "score": "0.7014517", "text": "func NewKeeper(cdc *codec.Codec, mapStoreKey sdk.StoreKey, verifyStoreKey sdk.StoreKey) Keeper {\n\tkeeper := Keeper{\n\t\tmapStoreKey: mapStoreKey,\n\t\tverifyStoreKey: verifyStoreKey,\n\t\tcdc: cdc,\n\t}\n\treturn keeper\n}", "title": "" }, { "docid": "f7fe5ccea982a1a16f663ab4c52b01cf", "score": "0.69731736", "text": "func NewKeeper(\n\tbankKeeper bankkeeper.Keeper,\n\tstakingKeeper stakingkeeper.Keeper,\n\taccountKeeper authkeeper.AccountKeeper,\n\tamount int64,\n\trateLimit time.Duration,\n\tstoreKey sdk.StoreKey,\n\tcdc codec.BinaryMarshaler) Keeper {\n\treturn Keeper{\n\t\tBankKeeper: bankKeeper,\n\t\tStakingKeeper: stakingKeeper,\n\t\tAccountKeeper: accountKeeper,\n\t\tamount: amount,\n\t\tLimit: rateLimit,\n\t\tstoreKey: storeKey,\n\t\tcdc: cdc,\n\t}\n}", "title": "" }, { "docid": "c9b4646c043867e5655967b51c879ab8", "score": "0.6856303", "text": "func newTreeKeeper(length int) (tk *TreeKeeper) {\n\ttk = &TreeKeeper{}\n\ttk.Input = make(chan msg.Request, length)\n\ttk.Shutdown = make(chan struct{})\n\ttk.Stop = make(chan struct{})\n\treturn\n}", "title": "" }, { "docid": "1db0235e2919f92792fa710b840e1a0d", "score": "0.685057", "text": "func NewKeeper(\n\tcdc codec.Codec,\n\tkey storetypes.StoreKey,\n\tparamstore paramtypes.Subspace,\n\taccountKeeper types.AccountKeeper,\n\tbankKeeper types.BankKeeper,\n\tliquidKeeper types.LiquidKeeper,\n\thardKeeper types.HardKeeper,\n\tsavingsKeeper types.SavingsKeeper,\n\tdistKeeper types.DistributionKeeper,\n) Keeper {\n\tif !paramstore.HasKeyTable() {\n\t\tparamstore = paramstore.WithKeyTable(types.ParamKeyTable())\n\t}\n\n\treturn Keeper{\n\t\tkey: key,\n\t\tcdc: cdc,\n\t\tparamSubspace: paramstore,\n\t\taccountKeeper: accountKeeper,\n\t\tbankKeeper: bankKeeper,\n\t\tliquidKeeper: liquidKeeper,\n\t\thardKeeper: hardKeeper,\n\t\tsavingsKeeper: savingsKeeper,\n\t\tdistKeeper: distKeeper,\n\t}\n}", "title": "" }, { "docid": "cbc4ae738c60a3ab494813467f6c6edc", "score": "0.6707193", "text": "func NewKeeper(\n\tcdc codec.BinaryCodec,\n\tkey storetypes.StoreKey,\n\tak types.AccountKeeper,\n\tbk types.BankKeeper,\n\tauthority string,\n) *Keeper {\n\t// ensure bonded and not bonded module accounts are set\n\tif addr := ak.GetModuleAddress(types.BondedPoolName); addr == nil {\n\t\tpanic(fmt.Sprintf(\"%s module account has not been set\", types.BondedPoolName))\n\t}\n\n\tif addr := ak.GetModuleAddress(types.NotBondedPoolName); addr == nil {\n\t\tpanic(fmt.Sprintf(\"%s module account has not been set\", types.NotBondedPoolName))\n\t}\n\n\t// ensure that authority is a valid AccAddress\n\tif _, err := sdk.AccAddressFromBech32(authority); err != nil {\n\t\tpanic(\"authority is not a valid acc address\")\n\t}\n\n\treturn &Keeper{\n\t\tstoreKey: key,\n\t\tcdc: cdc,\n\t\tauthKeeper: ak,\n\t\tbankKeeper: bk,\n\t\thooks: nil,\n\t\tauthority: authority,\n\t}\n}", "title": "" }, { "docid": "7af5bd1e0b531dbff2413494ba3f31f5", "score": "0.6491193", "text": "func NewKeeper(publishers chan int) *Keeper {\n\tlast := last{\n\t\tmutex: &sync.RWMutex{},\n\t}\n\treturn &Keeper{\n\t\tmanagers: make(map[string]int),\n\t\tactiveRegion: \"us-east-1\",\n\t\tmutex: &sync.RWMutex{},\n\t\tpublishers: publishers,\n\t\tlast: last,\n\t}\n}", "title": "" }, { "docid": "af6ce358b62cbc7c1983c34ba3705115", "score": "0.59604394", "text": "func makeTestKit(account types.AccountKeeper, bank types.BankKeeper) (Keeper, sdk.Context) {\n\tencodingConfig := params.MakeEncodingConfig()\n\tcdc := encodingConfig.Marshaler\n\tpushAction := func(ctx sdk.Context, action vm.Jsonable) error {\n\t\treturn nil\n\t}\n\n\tparamsTStoreKey := sdk.NewTransientStoreKey(paramstypes.TStoreKey)\n\tparamsStoreKey := sdk.NewKVStoreKey(paramstypes.StoreKey)\n\tpk := paramskeeper.NewKeeper(cdc, encodingConfig.Amino, paramsStoreKey, paramsTStoreKey)\n\n\tsubspace := pk.Subspace(types.ModuleName)\n\tkeeper := NewKeeper(cdc, vbankStoreKey, subspace, account, bank, \"feeCollectorName\", pushAction)\n\n\tdb := dbm.NewMemDB()\n\tms := store.NewCommitMultiStore(db)\n\tms.MountStoreWithDB(vbankStoreKey, sdk.StoreTypeIAVL, db)\n\tms.MountStoreWithDB(paramsStoreKey, sdk.StoreTypeIAVL, db)\n\tms.MountStoreWithDB(paramsTStoreKey, sdk.StoreTypeTransient, db)\n\terr := ms.LoadLatestVersion()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tctx := sdk.NewContext(ms, tmproto.Header{}, false, log.NewNopLogger())\n\n\tkeeper.SetParams(ctx, types.DefaultParams())\n\tkeeper.SetState(ctx, types.State{})\n\treturn keeper, ctx\n}", "title": "" }, { "docid": "007bde926bfe608c1e2581694f694cd6", "score": "0.581509", "text": "func NewKeeperController(configAgent *config.Agent, botName string, gitKind string, gitToken string, serverURL string, maxRecordsPerPool int, historyURI string, statusURI string, ns string) (keeper.Controller, error) {\n\tgithubAppSecretDir := util.GetGitHubAppSecretDir()\n\tif githubAppSecretDir != \"\" {\n\t\treturn NewGitHubAppKeeperController(githubAppSecretDir, configAgent, botName, gitKind, maxRecordsPerPool, historyURI, statusURI, ns)\n\t}\n\n\tvar scmClient *scm.Client\n\tvar err error\n\tif gitKind == \"gitea\" {\n\t\t// gitea returns 403 if the gitToken isn't passed here\n\t\tscmClient, err = factory.NewClient(gitKind, serverURL, gitToken)\n\t} else {\n\t\tscmClient, err = factory.NewClient(gitKind, serverURL, \"\")\n\t}\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"cannot create SCM client\")\n\t}\n\tutil.AddAuthToSCMClient(scmClient, gitToken, false)\n\tgitproviderClient := scmprovider.ToClient(scmClient, botName)\n\tgitClient, err := git.NewClient(serverURL, botName)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"creating git client\")\n\t}\n\tgitClient.SetCredentials(botName, func() []byte {\n\t\treturn []byte(gitToken)\n\t})\n\n\tfileBrowsers, err := filebrowser.NewFileBrowsers(serverURL, filebrowser.NewFileBrowserFromScmClient(gitproviderClient))\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"failed to create the git file browsers\")\n\t}\n\n\ttektonClient, _, lhClient, _, err := clients.GetAPIClients()\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"Error creating kubernetes resource clients.\")\n\t}\n\tlauncherClient := launcher.NewLauncher(lhClient, ns)\n\tc, err := keeper.NewController(gitproviderClient, gitproviderClient, fileBrowsers, launcherClient, tektonClient, lhClient, ns, configAgent.Config, gitClient, maxRecordsPerPool, historyURI, statusURI, nil)\n\treturn c, err\n}", "title": "" }, { "docid": "a759fad39340f050904f1069bd8f19bc", "score": "0.57675534", "text": "func NewBaseKeeper(ak types.AccountKeeper,\n\tparamSpace params.Subspace,\n\tblacklistedAddrs map[string]bool) BaseKeeper {\n\n\tps := paramSpace.WithKeyTable(types.ParamKeyTable())\n\treturn BaseKeeper{\n\t\tBaseSendKeeper: NewBaseSendKeeper(ak, ps, blacklistedAddrs),\n\t\tak: ak,\n\t\tparamSpace: ps,\n\t}\n}", "title": "" }, { "docid": "a5b7fdc5001c7527e8347e34dd33726f", "score": "0.57283044", "text": "func New(ctx context.Context, url string) (*Cypher, error) {\n\tk, err := secrets.OpenKeeper(ctx, url)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Cypher{keeper: k}, nil\n}", "title": "" }, { "docid": "240490231f4dd837e830b270268c515d", "score": "0.56877995", "text": "func NewLogKeeper() *logKeeper {\n\treturn &logKeeper{\n\t\tloghook: test.NewGlobal(),\n\t}\n}", "title": "" }, { "docid": "dfc6cd2f73d39c454826d86f50934ef6", "score": "0.5632171", "text": "func NewZookeeper(config *conf.Config) (z *Zookeeper, err error) {\n\tvar (\n\t\ts <-chan zk.Event\n\t)\n\tz = &Zookeeper{}\n\tif z.c, s, err = zk.Connect(config.Zookeeper.Addrs, config.Zookeeper.Timeout.Duration); err != nil {\n\t\tlog.Errorf(\"zk.Connect(\\\"%v\\\") error(%v)\", config.Zookeeper.Addrs, err)\n\t\treturn\n\t}\n\tz.config = config\n\tgo func() {\n\t\tvar e zk.Event\n\t\tfor {\n\t\t\tif e = <-s; e.Type == 0 {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tlog.Infof(\"zookeeper get a event: %s\", e.State.String())\n\t\t}\n\t}()\n\treturn\n}", "title": "" }, { "docid": "8b8819a651fdb4c57a6bfa5e892c95b5", "score": "0.5609418", "text": "func NewNodeKeeperMock(t minimock.Tester) *NodeKeeperMock {\n\tm := &NodeKeeperMock{t: t}\n\n\tif controller, ok := t.(minimock.MockController); ok {\n\t\tcontroller.RegisterMocker(m)\n\t}\n\n\tm.GetAccessorMock = mNodeKeeperMockGetAccessor{mock: m}\n\tm.GetClaimQueueMock = mNodeKeeperMockGetClaimQueue{mock: m}\n\tm.GetCloudHashMock = mNodeKeeperMockGetCloudHash{mock: m}\n\tm.GetConsensusInfoMock = mNodeKeeperMockGetConsensusInfo{mock: m}\n\tm.GetOriginMock = mNodeKeeperMockGetOrigin{mock: m}\n\tm.GetOriginAnnounceClaimMock = mNodeKeeperMockGetOriginAnnounceClaim{mock: m}\n\tm.GetOriginJoinClaimMock = mNodeKeeperMockGetOriginJoinClaim{mock: m}\n\tm.GetSnapshotCopyMock = mNodeKeeperMockGetSnapshotCopy{mock: m}\n\tm.GetWorkingNodeMock = mNodeKeeperMockGetWorkingNode{mock: m}\n\tm.GetWorkingNodesMock = mNodeKeeperMockGetWorkingNodes{mock: m}\n\tm.GetWorkingNodesByRoleMock = mNodeKeeperMockGetWorkingNodesByRole{mock: m}\n\tm.IsBootstrappedMock = mNodeKeeperMockIsBootstrapped{mock: m}\n\tm.MoveSyncToActiveMock = mNodeKeeperMockMoveSyncToActive{mock: m}\n\tm.SetCloudHashMock = mNodeKeeperMockSetCloudHash{mock: m}\n\tm.SetInitialSnapshotMock = mNodeKeeperMockSetInitialSnapshot{mock: m}\n\tm.SetIsBootstrappedMock = mNodeKeeperMockSetIsBootstrapped{mock: m}\n\tm.SyncMock = mNodeKeeperMockSync{mock: m}\n\n\treturn m\n}", "title": "" }, { "docid": "2dff627c149fdc636c7e73e1f6a7cc39", "score": "0.5565624", "text": "func NewZooKeeperLock(c ZooKeeperLockConfig) (*ZooKeeperLock, error) {\n\tvar zkl = &ZooKeeperLock{\n\t\tOwnerKey: c.OwnerKey,\n\t\tTTL: c.TTL,\n\t}\n\n\tvar err error\n\tvar nilLog = log.New(ioutil.Discard, \"\", 0)\n\n\t// Dial zk.\n\tzkl.c, _, err = zk.Connect([]string{c.Address}, 10*time.Second, zk.WithLogger(nilLog))\n\tif err != nil {\n\t\treturn zkl, err\n\t}\n\n\t// Sanitize the path.\n\tzkl.Path = fmt.Sprintf(\"/%s\", strings.Trim(c.Path, \"/\"))\n\n\treturn zkl, zkl.init()\n}", "title": "" }, { "docid": "2e076619531c46be426e372ef61b93a8", "score": "0.55502397", "text": "func NewFileKeeper(filePath string) FileKeeper {\n\treturn FileKeeper{\n\t\tmutex: sync.Mutex{},\n\t\tmemoryKeeper: NewInMemoryKeeper(),\n\t\tfilePath: filePath,\n\t}\n}", "title": "" }, { "docid": "255625180b04ee19d2e04999847d908d", "score": "0.5515802", "text": "func (w wiersz) newKardane(st int) (k kardane) {\n\tk = kardane{id: nastId(\"karty\"), stanowisko: st, nazwa_lok: w.nazlok, dalsze_losy: w.losy, dzieje_badan: w.hisbad, literatura: w.liter, autorzy: w.autor, chronologia: w.chrono, konsultant: w.konsul, arkusz_mapy: w.godlo, metryka_hist: w.zrodla}\n\treturn\n}", "title": "" }, { "docid": "8533a1a0ed138f436432f819b2919c60", "score": "0.54500175", "text": "func NewNodeKeeper(nodeID core.RecordRef) NodeKeeper {\n\treturn &nodekeeper{\n\t\tnodeID: nodeID,\n\t\tstate: undefined,\n\t\tactive: make(map[core.RecordRef]*core.ActiveNode),\n\t\tsync: make([]*core.ActiveNode, 0),\n\t\tunsync: make([]*core.ActiveNode, 0),\n\t\tunsyncWaiters: make([]chan *UnsyncList, 0),\n\t}\n}", "title": "" }, { "docid": "23452ef78a346e883c0698b65060f1c1", "score": "0.54153275", "text": "func newKClient(inCluster bool) (*KClient, error) {\n\tvar kc KClient\n\tif inCluster {\n\t\tcs, err := CreateICClientSet()\n\t\tif err != nil {\n\t\t\treturn &kc, err\n\t\t}\n\t\tkc.cs = cs\n\t\tkc.listOpts = metav1.ListOptions{}\n\t\treturn &kc, nil\n\t}\n\tcs, err := CreateOCClientSet()\n\tif err != nil {\n\t\treturn &kc, err\n\t}\n\tkc.cs = cs\n\tkc.listOpts = metav1.ListOptions{}\n\treturn &kc, nil\n}", "title": "" }, { "docid": "be12b90aceb9fedcd5109001cd83097d", "score": "0.53240967", "text": "func NewPushKeyKeeper(state *tree.SafeTree, db storagetypes.Tx) *PushKeyKeeper {\n\treturn &PushKeyKeeper{state: state, db: db}\n}", "title": "" }, { "docid": "84d0b82f1b1438ad47259ad3fa16e056", "score": "0.532085", "text": "func NewKlevrManager() (*KlevrManager, error) {\n\trouter := mux.NewRouter()\n\n\tinstance := &KlevrManager{\n\t\tRootRouter: router,\n\t\tEventQueue: common.NewMutexQueue(),\n\t}\n\n\tinstance.InstanceID = fmt.Sprintf(\"%v_%v\", &instance, time.Now().UTC().Unix())\n\n\treturn instance, nil\n}", "title": "" }, { "docid": "e0085bcc5f5761afcffe358ab2844880", "score": "0.52992916", "text": "func New() KeyPathMap {\n\treturn &node{}\n}", "title": "" }, { "docid": "9dc328c61fef19cec884074dca164f73", "score": "0.5289941", "text": "func startNewTree(key []byte, ptr *Record) *node {\n\troot := &node{isLeaf: true}\n\troot.keys[0] = key\n\troot.ptrs[0] = ptr\n\troot.ptrs[ORDER-1] = nil\n\troot.parent = nil\n\troot.numKeys++\n\treturn root\n}", "title": "" }, { "docid": "56f31f131bcbf825417ffbaa986f7fae", "score": "0.526939", "text": "func New(zkSvr string, options ...Option) *Client {\n\tservers, chroot, err := parseZkConnStr(zkSvr)\n\tif err != nil || len(servers) == 0 {\n\t\t// yes, panic!\n\t\tpanic(\"invalid zkSvr\")\n\t}\n\n\tc := &Client{\n\t\tzkSvr: zkSvr,\n\t\tchroot: chroot,\n\t\tservers: servers,\n\t\tsessionTimeout: defaultSessionTimeout,\n\t\twithRetry: false, // without retry by default\n\t\tacl: zk.WorldACL(zk.PermAll),\n\t\twrapErrorWithPath: false,\n\t\tstateChangeListeners: []ZkStateListener{},\n\t\tbirthCry: false,\n\t\tchildChangeListeners: map[string][]ZkChildListener{},\n\t\tchildWatchStopper: map[string]chan struct{}{},\n\t\tdataChangeListeners: map[string][]ZkDataListener{},\n\t\tdataWatchStopper: map[string]chan struct{}{},\n\t\tDebug: false,\n\t}\n\tc.isConnected.Set(false)\n\n\tfor _, option := range options {\n\t\toption(c)\n\t}\n\n\treturn c\n}", "title": "" }, { "docid": "190fa29867542ecd32d35beb787a10df", "score": "0.5255822", "text": "func (k Keeper) NewStaking(ctx sdk.Context, farmer sdk.AccAddress) types.Staking {\n\tid := k.GetNextStakingIDWithUpdate(ctx)\n\treturn types.Staking{\n\t\tId: id,\n\t\tFarmer: farmer.String(),\n\t\tStakedCoins: sdk.NewCoins(),\n\t\tQueuedCoins: sdk.NewCoins(),\n\t}\n}", "title": "" }, { "docid": "856e1d43ae178a4cbe5f27fd6c5ca22e", "score": "0.5226215", "text": "func (b *Bucket) New(o Object, key *string) error { return b.c.New(o, b.nm, key, nil) }", "title": "" }, { "docid": "28967d48f6d0425071e6e0a71e0f1842", "score": "0.5212906", "text": "func (z *Zookeeper) NewNode(fpath string) (node string, err error) {\n\tif node, err = z.c.Create(path.Join(fpath, \"\")+\"/\", []byte(\"\"), int32(zk.FlagEphemeral|zk.FlagSequence), zk.WorldACL(zk.PermAll)); err != nil {\n\t\tlog.Errorf(\"zk.Create error(%v)\", err)\n\t} else {\n\t\tnode = path.Base(node)\n\t}\n\treturn\n}", "title": "" }, { "docid": "d438f31a102f48be7739e3c487f8d351", "score": "0.5211172", "text": "func New(key string, value interface{}) Logger {\n\tif root == nil {\n\t\tfmt.Println(\"no root\")\n\t}\n\treturn root.New(key, value)\n}", "title": "" }, { "docid": "dc7be9862d34f71725dce3b2c5522002", "score": "0.51975083", "text": "func Create() *Trie {\n\tnew := &Trie{}\n\tnew.children = make([]*Trie, 26) // only lowercase letter\n\treturn new\n}", "title": "" }, { "docid": "e1d5c3693c88c8d46f2d3b269d95fa84", "score": "0.5196484", "text": "func New(cli *etcdv3.Client) locker.Locker {\n\treturn &etcdLocker{cli: cli}\n}", "title": "" }, { "docid": "f829c0db1e723075a8c88fc38ec7286d", "score": "0.51951176", "text": "func NewKerl() *Kerl {\r\n\tk := &Kerl{\r\n\t\ts: keccak.New384(),\r\n\t}\r\n\treturn k\r\n}", "title": "" }, { "docid": "d338354fdb699234195fdfcbb6cef41d", "score": "0.5192415", "text": "func New() *Keydir {\n\n\tvar dataDirectory string = \"data\"\n\n\tdir := make(map[string]keydirValue)\n\n\tfiles, err := ioutil.ReadDir(dataDirectory)\n\n\tif err != nil {\n\t\tos.Mkdir(\"./data\", 0777)\n\t}\n\n\tvar fileNumber int = len(files)\n\n\tvar fileName string = fmt.Sprintf(\"%s/data.%d.dfile\", dataDirectory, fileNumber)\n\n\tfile, err := os.Create(fileName)\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tk := &Keydir{dir:dir, dataFileDirectory:dataDirectory, dataFile:file, currentDataOffset:0}\n\n\treturn k\n}", "title": "" }, { "docid": "a0f8b85420da5c6981712e88501f43fe", "score": "0.5161649", "text": "func New(ctx context.Context, next http.Handler, config *Config, name string) (http.Handler, error) {\n\treturn &Mkz{\n\t\tnext: next,\n\t\tname: name,\n\t}, nil\n}", "title": "" }, { "docid": "397a6a3007cf15e423625812578d0868", "score": "0.514967", "text": "func New(keeperAddr, domain, nodeID, component string, rawSubscription []string, tags map[string]string) *Client {\n\tfor k := range rawSubscription {\n\t\trawSubscription[k] = filepath.Join(\"/\", rawSubscription[k])\n\t}\n\thostname, _ := os.Hostname()\n\tnodeInfo := model.NewNodeInfo(nodeID, hostname, keeperAddr, domain, component, rawSubscription, tags)\n\tc := &Client{\n\t\tnode: model.NewNode(*nodeInfo),\n\t\trpc: gorpc.NewClient(gorpc.NewNetOptions(ConnectTimeout, ReadTimeout, WriteTimeout)),\n\t\tdata: map[string]interface{}{},\n\t}\n\treturn c\n}", "title": "" }, { "docid": "1842b8cc2bf6a9e279b5f0d90ae6674a", "score": "0.5149159", "text": "func New(namespace string) (*Kong, error) {\n\ttr := &http.Transport{\n\t\tTLSClientConfig: &tls.Config{InsecureSkipVerify: true},\n\t}\n\tclient := &http.Client{Transport: tr, Timeout: time.Second * 10}\n\n\tk := &Kong{\n\t\tclient: client,\n\t\tKongAdminURL: GetKongAdminURL(namespace),\n\t}\n\treturn k, nil\n}", "title": "" }, { "docid": "31e7e240b92b0e88f3cbef8b55b3a7d8", "score": "0.5146151", "text": "func (h Handler) Create(info map[string]interface{}) (code int, resp []byte, err error) {\n\tpath := h.Path(info[\"path\"].(string))\n\tdata := []byte(info[\"data\"].(string))\n\n\tvar acls []zk.ACL\n\tif info[\"acl\"] == nil {\n\t\tacls = h.acl\n\t} else {\n\t\t_acls := info[\"acl\"].([]interface{})\n\t\tacls = make([]zk.ACL, len(_acls))\n\t\tfor i, acl := range _acls {\n\t\t\t_acl := acl.(map[string]interface{})\n\t\t\tacls[i].Perms = int32(_acl[\"perms\"].(float64))\n\t\t\tacls[i].Scheme = _acl[\"scheme\"].(string)\n\t\t\tacls[i].ID = _acl[\"id\"].(string)\n\t\t}\n\t}\n\n\tvar ephemeral bool\n\tif info[\"ephemeral\"] != nil {\n\t\tephemeral = info[\"ephemeral\"].(bool)\n\t}\n\n\tvar sequential bool\n\tif info[\"sequential\"] != nil {\n\t\tsequential = info[\"sequential\"].(bool)\n\t}\n\n\tif ephemeral && sequential {\n\t\tpath, err = h.zk.CreateProtectedEphemeralSequential(path, data, acls)\n\t} else {\n\t\tvar flags int32\n\t\tif ephemeral {\n\t\t\tflags |= zk.FlagEphemeral\n\t\t}\n\t\tif sequential {\n\t\t\tflags |= zk.FlagSequence\n\t\t}\n\t\tpath, err = h.zk.Create(path, data, flags, acls)\n\t}\n\n\tif err == nil {\n\t\tresp, err = json.Marshal(map[string]interface{}{\"path\": path})\n\t} else if err == zk.ErrNodeExists {\n\t\tcode = http.StatusNotAcceptable\n\t} else if err == zk.ErrNoNode {\n\t\tcode = http.StatusNotFound\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "678c0062c5beeebd25e3360202600991", "score": "0.51377875", "text": "func (c *Connection) Keeper() {\n\tlog.Println(c.network, \"spawned Keeper\")\n\tcontext := make(map[string]string)\n\tcontext[\"Network\"] = c.network\n\tfor {\n\t\tselect {\n\t\tcase <-c.quitkeeper:\n\t\t\tif c.quitrecv != nil {\n\t\t\t\tclose(c.quitrecv)\n\t\t\t}\n\t\t\treturn\n\t\tcase <-c.reconnect:\n\t\t}\n\n\t\tc.l.Lock()\n\t\tif c.quitrecv != nil {\n\t\t\tclose(c.quitrecv)\n\t\t}\n\t\tc.quitrecv = make(chan struct{}, 1)\n\t\tservers := c.cfg.LookupStringSlice(context, \"Servers\")\n\n\t\tserver := servers[rand.Intn(len(servers))]\n\t\tlog.Println(c.network, \"connecting to\", server)\n\t\terr := c.Dial(server)\n\t\tc.l.Unlock()\n\t\tif err == nil {\n\t\t\tgo c.Receiver()\n\n\t\t\tlog.Println(c.network, \"Initializing IRC connection\")\n\t\t\tc.Sender(Message{\n\t\t\t\tCommand: \"NICK\",\n\t\t\t\tTrailing: c.cfg.LookupString(context, \"Nick\"),\n\t\t\t})\n\t\t\tc.Sender(Message{\n\t\t\t\tCommand: \"USER\",\n\t\t\t\tParams: []string{c.cfg.LookupString(context, \"User\"), \"0\", \"*\"},\n\t\t\t\tTrailing: c.cfg.LookupString(context, \"RealName\"),\n\t\t\t})\n\t\t} else {\n\t\t\tlog.Println(c.network, \"connection error\", err.Error())\n\t\t\ttime.Sleep(time.Second * 3)\n\t\t\tc.reconnect <- struct{}{}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b985d090f35be63470ec38ac03adf7fc", "score": "0.51149154", "text": "func New(o onet.Onet, kp *key.Pair, publicKeys []kyber.Point) *DKG {\n\trpc := o.MakeRPC(\"pdkg\", newHandler(kp, publicKeys))\n\n\treturn &DKG{\n\t\trpc: rpc,\n\t}\n}", "title": "" }, { "docid": "6eb7b4c50bb04b9138c3a1b851239ef0", "score": "0.5098109", "text": "func NewWrappedAccountKeeper(ak authkeeper.AccountKeeper) *WrappedAccountKeeper {\n\treturn &WrappedAccountKeeper{\n\t\tAccountKeeper: ak,\n\t\tAccountWrapper: DefaultAccountWrapper,\n\t}\n}", "title": "" }, { "docid": "9e2391f445c648f118ed0189b741dc81", "score": "0.5088836", "text": "func (t *testClient) TreeNew() (*trillian.Tree, *trillian.SignedLogRoot, error) {\n\tt.Lock()\n\tdefer t.Unlock()\n\n\t// Create trillian tree\n\ttree := trillian.Tree{\n\t\tTreeId: rand.Int63(),\n\t\tTreeState: trillian.TreeState_ACTIVE,\n\t\tTreeType: trillian.TreeType_LOG,\n\t\tDisplayName: \"\",\n\t\tDescription: \"\",\n\t}\n\tt.trees[tree.TreeId] = &tree\n\n\t// Initialize leaves\n\tt.leaves[tree.TreeId] = []*trillian.LogLeaf{}\n\n\treturn &tree, nil, nil\n}", "title": "" }, { "docid": "9f49c1d8253eded54426d606a54e34e8", "score": "0.5083306", "text": "func newClient(kv string, addr string, config *store.Config) (*Store, error) {\n\tif kv != string(store.BOLTDB) {\n\t\treturn nil, fmt.Errorf(\"unsupported KV store\")\n\t}\n\n\tif config == nil {\n\t\tconfig = &store.Config{}\n\t}\n\n\t// Parse file path\n\ts, err := boltdb.New(strings.Split(addr, \",\"), config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tds := &Store{scope: scope.Local, store: s}\n\tds.cache = newCache(ds)\n\n\treturn ds, nil\n}", "title": "" }, { "docid": "27693d16ac9d60f4bc7431f89563a8f7", "score": "0.5074485", "text": "func newKVTree() *kvTree {\n\treturn &kvTree{\n\t\ttree: btree.New(64),\n\t}\n}", "title": "" }, { "docid": "8bbe6002157d0953f77414633a66f2e4", "score": "0.50721586", "text": "func New(addr, dc, token string, timeout time.Duration) (*Getter, error) {\n\treturn NewWithFolderPrefix(addr, dc, token, \"\", timeout)\n}", "title": "" }, { "docid": "e3415f256130df1a0d4e0bff2a7eb9b3", "score": "0.50702816", "text": "func New(name string) Key {\n\treturn &key{name}\n}", "title": "" }, { "docid": "5c30f2a2daa05d3447e3884652a2ef00", "score": "0.50668293", "text": "func create(kv *api.KV, k *keysync.APIKeys, args []string) {\n\tif len(args) == 0 {\n\t\tprintHelp(\"create\")\n\t}\n\n\tkeyName := args[0]\n\n\t// Check if the key name is already used.\n\tif k.KeyNameExists(keyName) {\n\t\tfmt.Printf(\"Key %s already exists\\n\", keyName)\n\t\tos.Exit(0)\n\t}\n\n\tkey := genKey(keyName)\n\n\t// Register the key in Consul.\n\tp := &api.KVPair{Key: \"polymur/gateway/keys/\" + keyName, Value: []byte(key)}\n\t_, err := kv.Put(p, nil)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tos.Exit(1)\n\t}\n\n\tfmt.Printf(\"Successfully registered %s with key %s\\n\", keyName, key)\n}", "title": "" }, { "docid": "980693dff76b1f4ffdd7905cb0b4ada6", "score": "0.5064107", "text": "func NewManager(zkSvr string, zroot string) cluster.Manager {\n\tif len(zroot) > 0 {\n\t\trootPath = zroot\n\t}\n\n\treturn &controller{\n\t\tzc: zkclient.New(zkSvr, zkclient.WithWrapErrorWithPath()),\n\t}\n}", "title": "" }, { "docid": "f199280e38c2c01f8542d676e0c6b52c", "score": "0.5062747", "text": "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileZookeeper{client: mgr.GetClient(), scheme: mgr.GetScheme()}\n}", "title": "" }, { "docid": "91a3d597029a02aaf14d61284a53ba90", "score": "0.5054843", "text": "func New(folivoraSecret string) *Root {\n\treturn &Root{\n\t\tfolivoraSecret: folivoraSecret,\n\t}\n}", "title": "" }, { "docid": "f7087920c87f889a4aa2f140fb1713a2", "score": "0.504147", "text": "func New(label string) (KeyManager, error) {\n\tif constructor, present := registry[label]; present {\n\t\treturn constructor(), nil\n\t}\n\treturn nil, &errUnsupportedKeyManager{label}\n}", "title": "" }, { "docid": "f4034e994113e855384679a4bbfcd59d", "score": "0.503862", "text": "func NewHistoryKeeper(cdc codec.Codec, key sdk.StoreKey, stakingkeeper staking.StakingKeeper, db dbm.DB) HistoryKeeper {\n\treturn HistoryKeeper{\n\t\tStoreKey: key,\n\t\tcdc: cdc,\n\t\tstakingKeeper: stakingkeeper,\n\t\tdatabase: db,\n\t}\n}", "title": "" }, { "docid": "bc6e39d28fb99106116a36364dbe136a", "score": "0.50334364", "text": "func newLeafNode(elements []*pairs, bs *blockService) (*DiskNode, error) {\r\n\tnode := &DiskNode{keys: elements, blockService: bs}\r\n\t//persist the node to disk\r\n\terr := bs.saveNewNodeToDisk(node)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\treturn node, nil\r\n}", "title": "" }, { "docid": "ff7d96e72ca625e93d5223a7dcc21431", "score": "0.50305694", "text": "func newKVStore() *kvStore {\n\tkvStore := kvStore{\n\t\tstore: map[string]string{},\n\t}\n\treturn &kvStore\n}", "title": "" }, { "docid": "f8f168d91a38f2143509947384a571e8", "score": "0.5024273", "text": "func (e *etcdStore) Create(ctx context.Context, key string, obj runtime.Object) error {\n\t// Do a version check before storing to kvstore. Without this check, an non-API object can be store in kvstore\n\t// but the Create call would fail\n\t_, err := runtime.GetObjectMeta(obj)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, resp, err := e.putHelper(ctx, key, obj, clientv3.Compare(clientv3.ModRevision(key), \"=\", 0))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !resp.Succeeded {\n\t\treturn kvstore.NewKeyExistsError(key, 0)\n\t}\n\n\treturn e.objVersioner.SetVersion(obj, uint64(resp.Responses[0].GetResponsePut().Header.Revision))\n}", "title": "" }, { "docid": "e3e9e3839f2a38b789c1672c123e1a9d", "score": "0.5021025", "text": "func NewNode(id Key) *Node {\n return &Node{data: map[Key]string{}}\n}", "title": "" }, { "docid": "a238cdf7305518913d76d6f4decb927f", "score": "0.5017298", "text": "func New(d string, z provider.Zone) (*Service, error) {\n c, err := etcd.ClientForZone(d, z)\n if err != nil {\n return nil, err\n }\n return &Service{z, c}, nil\n}", "title": "" }, { "docid": "a14c043d71997dcf234ca87eb3638c5d", "score": "0.5014115", "text": "func New(host string, port int, user string, password string) (*KodiRPCClient, error) {\n\n\tendpoint, err := url.Parse(\"http://\" + host + \":\" + strconv.Itoa(port) + \"/jsonrpc\")\n\tif err != nil {\n\t\treturn nil, errors.New(\"Unable to create kodi URL : \" + err.Error())\n\t}\n\n\tauth := user + \":\" + password\n\tauth = base64.StdEncoding.EncodeToString([]byte(auth))\n\n\treturn &KodiRPCClient{\n\t\tendpoint: endpoint.String(),\n\t\tauth: auth,\n\t\tnextID: 0,\n\t}, nil\n\n}", "title": "" }, { "docid": "2f95021d761a0e834da198d20b84ea55", "score": "0.5012783", "text": "func Create() (*K8S, error) {\n\tkubeconfig := os.Getenv(\"KUBECONFIG\")\n\tif kubeconfig == \"\" {\n\t\treturn nil, fmt.Errorf(\"KUBECONFIG not given\")\n\t}\n\n\tconfig, err := clientcmd.BuildConfigFromFlags(\"\", kubeconfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclientset, err := kubernetes.NewForConfig(config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &K8S{clientset}, nil\n}", "title": "" }, { "docid": "c24d3071725ba5127237bac09aa9f70f", "score": "0.50108963", "text": "func newKVStore(propChannel chan<- string, commitC <-chan *string, groupids []string) *KVStore {\n\n\ts := &KVStore{\n\t\tproposeChannel:propChannel,\n\t}\n\ts.store = make(map[string]map[string]string)\n\tfor _, v := range groupids {\n\t\ts.store[v] = make(map[string]string)\n\t}\n\tgo s.readCommitChannel(commitC)\n\treturn s\n}", "title": "" }, { "docid": "71c8e8d93b1d869538d4b2032e0e6ca6", "score": "0.5002726", "text": "func (l *Logic) PushKeyKeeper() core.PushKeyKeeper {\n\treturn l.pushKeyKeeper\n}", "title": "" }, { "docid": "327489494f2954091da6ed6d5e1b16c4", "score": "0.49969116", "text": "func NewKadRouter(keyfile string) Router {\n return kadRouter{\n ib: make(chan Message),\n }\n}", "title": "" }, { "docid": "386cfcb7512d7bb9c77085c592ac2109", "score": "0.49875933", "text": "func newRoot(rootFile string, fac upspin.Factotum, s storage.Storage) (*root, error) {\n\tvar rootRef string\n\tvar err error\n\tif s != nil {\n\t\t// Use the provided factotum to generate the secret reference.\n\t\tif fac == nil {\n\t\t\treturn nil, errors.Str(\"cannot backup root: config has no factotum\")\n\t\t}\n\t\tbase := filepath.Base(rootFile)\n\t\trootRef, err = hashRoot(base, fac)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// Try to access the storage backend now\n\t\t// so a misconfiguration is caught at startup.\n\t\t_, err = s.Download(rootRef)\n\t\tif err != nil && !errors.Is(errors.NotExist, err) {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tf, err := os.OpenFile(rootFile, os.O_RDWR|os.O_CREATE, 0600)\n\tif err != nil {\n\t\treturn nil, errors.E(errors.IO, err)\n\t}\n\tr := &root{file: f}\n\tif s != nil {\n\t\tr.ref = rootRef\n\t\tr.saveRoot = make(chan bool, 1)\n\t\tr.saveDone = make(chan bool)\n\t\tgo r.saveLoop(s)\n\t}\n\treturn r, nil\n}", "title": "" }, { "docid": "25fd5c224560b24e63c86afd8c66f34e", "score": "0.4986508", "text": "func New(engine coreStorage.KV) *KV {\n\tkv := &KV{\n\t\tengine: engine,\n\t}\n\n\treturn kv\n}", "title": "" }, { "docid": "86f525bc0886447a01b621339c0b8505", "score": "0.49829927", "text": "func newKVStore() (*kvStore, error) {\n\treturn &kvStore{\n\t\tstore: make(map[string][]byte),\n\t}, nil\n}", "title": "" }, { "docid": "ee6eae6b8b65de137e09de3269645986", "score": "0.498026", "text": "func newKarydiaConfigs(c *KarydiaV1alpha1Client) *karydiaConfigs {\n\treturn &karydiaConfigs{\n\t\tclient: c.RESTClient(),\n\t}\n}", "title": "" }, { "docid": "17eff653172d76652d2415dd7785eeaf", "score": "0.49680704", "text": "func New(kvs *kvstore.KeyValueStore) http.Handler {\n\tvar router = mux.NewRouter().StrictSlash(true)\n\trouter.Handle(\"/{key}\", keyGetHandler{kvs}).Methods(http.MethodGet)\n\trouter.Handle(\"/{key}\", keySetHandler{kvs}).Methods(http.MethodPost)\n\treturn router\n}", "title": "" }, { "docid": "4b2c2b6dc168da6579d7da2d3ddfea22", "score": "0.49660993", "text": "func (in *Zookeeper) DeepCopy() *Zookeeper {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Zookeeper)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "fde87b894c57ec9730253d1dc5efed6d", "score": "0.4959044", "text": "func New(client *http.Client, baseURL string) (*Kongo, error) {\n\tif baseURL == \"\" {\n\t\treturn nil, errors.New(\"Empty URL is not allowed\")\n\t}\n\n\tparsedURL, err := url.Parse(baseURL)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn NewClient(client, parsedURL)\n}", "title": "" }, { "docid": "c3516fff874ef0170057c182ee8d5481", "score": "0.49578163", "text": "func New() *DataStore { return &DataStore{} }", "title": "" }, { "docid": "1c8edae6c51b8005af3259c918450258", "score": "0.49499744", "text": "func (t *KeyValueTree) Create(keys ...string) *KeyValueChanger {\n\tvar path []nodeContent\n\tfor _, key := range keys {\n\t\tpath = append(path, keyValue{key, nil})\n\t}\n\tn, err := t.container.root.create(path...)\n\treturn &KeyValueChanger{n, err}\n}", "title": "" }, { "docid": "51f17e5d49291fedbcc97e0f95ece692", "score": "0.49408454", "text": "func CreateNewTorrentKey(c *redis.Client, key string) {\n\tif c == nil {\n\t\tc = OpenClient()\n\t}\n\n\tc.SAdd(key, \"complete\", \"incomplete\")\n\n}", "title": "" }, { "docid": "2b97f00c4cb13765d679577e2529fbe3", "score": "0.49271393", "text": "func newNode() *Node {\n\treturn &Node{\n\t\tKeys: make([][]byte, order-1),\n\t\tpointers: make([]interface{}, order),\n\t\tisLeaf: false,\n\t\tparent: nil,\n\t\tKeysNum: 0,\n\t}\n}", "title": "" }, { "docid": "d23241c2e2f0e8b3635dfa8e67e2e942", "score": "0.49268463", "text": "func New() Tree {\n\treturn newArt()\n}", "title": "" }, { "docid": "b2cce5d8285810e9afe04d77949f76ac", "score": "0.49107152", "text": "func New(cfg keyring.Config) (*Store, error) {\n\tif os.Getenv(\"KEYRING_DEBUG\") != \"\" {\n\t\tkeyring.Debug = true\n\t}\n\n\tkr, err := keyring.Open(cfg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tst := &Store{\n\t\tcfg: cfg,\n\t\tkr: kr,\n\t}\n\treturn st, nil\n}", "title": "" }, { "docid": "eae46ff0da95f6657d676667b965d6c5", "score": "0.49008965", "text": "func New(transport runtime.ClientTransport, formats strfmt.Registry) *PeacemakrClient {\n\t// ensure nullable parameters have default\n\tif formats == nil {\n\t\tformats = strfmt.Default\n\t}\n\n\tcli := new(PeacemakrClient)\n\tcli.Transport = transport\n\n\tcli.Billing = billing.New(transport, formats)\n\n\tcli.Client = client.New(transport, formats)\n\n\tcli.CryptoConfig = crypto_config.New(transport, formats)\n\n\tcli.KeyDerivationServiceRegistry = key_derivation_service_registry.New(transport, formats)\n\n\tcli.KeyService = key_service.New(transport, formats)\n\n\tcli.Login = login.New(transport, formats)\n\n\tcli.Org = org.New(transport, formats)\n\n\tcli.PhoneHome = phone_home.New(transport, formats)\n\n\tcli.ServerManagement = server_management.New(transport, formats)\n\n\treturn cli\n}", "title": "" }, { "docid": "c52ea21ef70748ebf736904bef629e52", "score": "0.48905787", "text": "func (client *ZkClient) Create(path string, nodeType int32, data string) (string, error) {\n\tacl := zk.WorldACL(zk.PermAll)\n\treturn client.conn.Create(path, []byte(data), nodeType, acl)\n}", "title": "" }, { "docid": "bce98fe2efa0fcd5488785f0e7929e9f", "score": "0.4888633", "text": "func newMount(name, path string) *Folder {\n\tf := newFolder(name)\n\tf.Path = path\n\treturn f\n}", "title": "" } ]
e94d5d79d387aafad144dc77d40a80dd
Checked check all done
[ { "docid": "6ce71e46d293ef2038abf367685bcea4", "score": "0.5346814", "text": "func (pf *PF) Checked() bool {\n\tpf.mutex.RLock()\n\tdefer pf.mutex.RUnlock()\n\treturn pf.checked\n}", "title": "" } ]
[ { "docid": "131516a88550dcfdae4030be2b594232", "score": "0.63712335", "text": "func (plan *Plan) checkComplete() (Changed bool) {\n\tvar count int //number of items completed\n\t// size of the items slice\n\tsize := len(plan.Items)\n\t//Check that there are actually items\n\tif size == 0 {\n\t\treturn false\n\t}\n\n\t//run through all the items and check if it is completed\n\tfor _, item := range plan.Items {\n\t\tif item.Completed == true {\n\t\t\tcount++\n\t\t}\n\t}\n\n\t//calculate percentage completed of plan\n\tpercentage := (count / size) * 100\n\t//Check if plan has been completed\n\tif percentage == 100 {\n\t\tplan.Completed = true\n\t} else {\n\t\tplan.Completed = false\n\t}\n\n\t//Check that nothing has changed to the plan\n\tif plan.Percentage == percentage {\n\t\treturn false\n\t}\n\n\tplan.Percentage = percentage\n\treturn true\n}", "title": "" }, { "docid": "264a13eaf8ece0aa3f77f56f08fc5e0f", "score": "0.6130618", "text": "func (d *delegateID3UI) checkSuccess() {\n\n\tcheck := func() bool {\n\t\td.Lock()\n\t\tdefer d.Unlock()\n\t\tif !d.foundTwitter {\n\t\t\td.T.Logf(\"delegate3IDUI#checkSuccess: check twitter failed\")\n\t\t\treturn false\n\t\t}\n\t\tif !d.foundGithub {\n\t\t\td.T.Logf(\"delegate3IDUI#checkSuccess: check github failed\")\n\t\t\treturn false\n\t\t}\n\t\tif !d.displayedCard {\n\t\t\td.T.Logf(\"delegate3IDUI#checkSuccess: didn't display card\")\n\t\t\treturn false\n\t\t}\n\t\treturn true\n\t}\n\tn := 10\n\twait := 2 * time.Millisecond\n\tfor i := 0; i < n; i++ {\n\t\tif check() {\n\t\t\treturn\n\t\t}\n\t\td.T.Logf(\"Hit a race! Waiting %v for delegateID3UI#checkSuccess check to work\", wait)\n\t\ttime.Sleep(wait)\n\t\twait *= 2\n\t}\n\td.T.Fatalf(\"Tried %d times to get successes and failed\", n)\n}", "title": "" }, { "docid": "826396441cc6b6d86b94bd964a372830", "score": "0.60042566", "text": "func (os *objectState) checkComplete(stats *Stats) {\n\tif os.blockedBy > 0 {\n\t\treturn\n\t}\n\tstats.Start(os.obj)\n\n\t// Fire all callbacks.\n\tfor _, fn := range os.callbacks {\n\t\tfn()\n\t}\n\tos.callbacks = nil\n\n\t// Clear all blocked objects.\n\tfor _, other := range os.blocking {\n\t\tother.blockedBy--\n\t\tother.checkComplete(stats)\n\t}\n\tos.blocking = nil\n\tstats.Done()\n}", "title": "" }, { "docid": "8619dd516d756bfe5d0358bed47eef16", "score": "0.5954966", "text": "func checkAllRequested() {\n\tvar requestCount int\n\tfor _, v := range linkList {\n\t\tif v.hasRequested == 1 {\n\t\t\trequestCount++\n\t\t}\n\t}\n\n\tif requestCount == len(linkList) {\n\t\tfinish = true\n\t}\n}", "title": "" }, { "docid": "5b74958693a3811473bb542f1674213e", "score": "0.58699524", "text": "func (a *httpAsker) CheckAll(ctx context.Context) error {\n\tvar wg sync.WaitGroup\n\n\tfor _, site := range a.SitesService.GetAll() {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn ctx.Err()\n\t\tdefault:\n\t\t\twg.Add(1)\n\t\t\tgo a.checkSite(ctx, site, &wg)\n\t\t}\n\t}\n\twg.Wait()\n\n\treturn nil\n\n}", "title": "" }, { "docid": "7abef9258332448b66231d2ab063b79f", "score": "0.5864788", "text": "func doCheck() {\n\tvar currentGames []ActiveGames\n\tfor {\n\t\tactive, finished, err := getGames(AuthToken)\n\t\tif err != nil {\n\t\t\tfatalLogger(err)\n\t\t}\n\t\t// For every game returned by the API, add it to the tracked list or update the list if its already present.\n\t\tfor _, newGame := range active {\n\t\t\tgameFound := false\n\t\t\tfor i, curGame := range currentGames {\n\t\t\t\tif newGame.Gameid == curGame.Gameid {\n\t\t\t\t\tgameFound = true\n\t\t\t\t\tif curGame.Lastupdatedtime.Before(newGame.Lastupdatedtime) {\n\t\t\t\t\t\t// There has been an update. Update our listing.\n\t\t\t\t\t\tlog.Printf(\"Updating game %d in active list\\n\", curGame.Gameid)\n\t\t\t\t\t\tcurrentGames[i] = newGame\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !gameFound {\n\t\t\t\t// Game not in our list, add it.\n\t\t\t\tlog.Printf(\"Adding game %d to active list\\n\", newGame.Gameid)\n\t\t\t\tcurrentGames = append(currentGames, newGame)\n\t\t\t}\n\t\t}\n\n\t\t// If a game is in the finished list & our list, remove it.\n\t\tfor _, finishedGame := range finished {\n\t\t\tfor i, curGame := range currentGames {\n\t\t\t\tif curGame.Gameid == finishedGame {\n\t\t\t\t\tlog.Printf(\"Removing game %d from active list\\n\", finishedGame)\n\t\t\t\t\tcurrentGames = append(currentGames[:i], currentGames[i+1:]...)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor i, game := range currentGames {\n\t\t\tif needsNotification(game){\n\t\t\t\t//TODO: Play sound/terminal bell? Option to disable?\n\t\t\t\t//TODO: Add insults :D\n\t\t\t\terr := beeep.Notify(\"Star Realms\", fmt.Sprintf(\"It is your turn in a game with %s\", game.Opponentname), \"notify.png\")\n\t\t\t\tif err != nil {\n\t\t\t\t\tfatalLogger(err)\n\t\t\t\t}\n\t\t\t\tlog.Printf(\"Notified for turn in game %d\", game.Gameid)\n\t\t\t\tcurrentGames[i].Hasnotified = true\n\t\t\t}\n\t\t}\n\t\t//TODO: Make recheck value customizable with lower limit\n\t\ttime.Sleep(60 * time.Second)\n\t}\n}", "title": "" }, { "docid": "54f22e5d13521183a6b387d7997d2639", "score": "0.5774183", "text": "func (c *check) Execute() (interface{}, error) { return c.checkFn() }", "title": "" }, { "docid": "168b11db3ef91bad331e415dea7bd8b6", "score": "0.5730758", "text": "func (Check) All() {\n\tmg.SerialDeps(Check.License, Check.GoLint)\n}", "title": "" }, { "docid": "c0ef286f646914c24e6c243632f85c7c", "score": "0.5694754", "text": "func (c *Circum) Checked() bool {\n\tme := c.Hither\n\tyou := !me\n\t// When it is your turn\n\tc.Hither = you\n\tdefer func() {\n\t\tc.Hither = me\n\t}()\n\t//\tfmt.Println(\"c\",c)\n\tfor _, nc := range c.maybeNexts() {\n\t\t// You captured my king\n\t\tif nc.Hand[you][OU] > 0 {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "16d1d36f9ed15d71f8404b2bddde621d", "score": "0.566314", "text": "func (c *All) Check(msg types.Message) bool {\n\tc.mCount.Incr(1)\n\tif msg.Len() > 0 {\n\t\tfor i := 0; i < msg.Len(); i++ {\n\t\t\tif !c.child.Check(message.Lock(msg, i)) {\n\t\t\t\tc.mFalse.Incr(1)\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\tc.mTrue.Incr(1)\n\t\treturn true\n\t}\n\tc.mFalse.Incr(1)\n\treturn false\n}", "title": "" }, { "docid": "df983b3fe30fe98552934b966a0a58ba", "score": "0.56600744", "text": "func OK(done chan bool) bool {\n\tselect {\n\tcase ok := <-done:\n\t\tif ok {\n\t\t\treturn ok\n\t\t}\n\n\t}\n\treturn false\n}", "title": "" }, { "docid": "13e3e5510972e93e3742aced3f3d67f0", "score": "0.5655515", "text": "func (res CheckResult) OK() bool {\n\treturn len(res) == 0\n}", "title": "" }, { "docid": "f9db4b5291f5eb5dddc813945e3ef465", "score": "0.5647783", "text": "func (shell *Shell) Check() {\n\tshell.shouldRestart = shell.checkStatus()\n}", "title": "" }, { "docid": "3f26db9a2a69f319c6bcb6f9750b03a3", "score": "0.5596243", "text": "func Check() {\n\tmg.SerialDeps(mage.Format, Update, mage.Check)\n}", "title": "" }, { "docid": "3f26db9a2a69f319c6bcb6f9750b03a3", "score": "0.5596243", "text": "func Check() {\n\tmg.SerialDeps(mage.Format, Update, mage.Check)\n}", "title": "" }, { "docid": "cc3e02297c89a3d50e1e98a68615f87d", "score": "0.5590225", "text": "func (mc *Checker) CheckAll() error {\n\tfor _, metric := range mc.metrics.AllMetrics() {\n\t\tif mc.FailedMetric(metric.Name, metric.Peer) {\n\t\t\terr := mc.alert(metric.Peer, metric.Name)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "7a6dcb0df0477928e5e778a4f39d3c4f", "score": "0.5560284", "text": "func checkIndividualKeys(keys []string) {\n\twork := make(chan string)\n\tquit := make(chan int)\n\tstartCheckers(work, quit)\n\tfor i, _ := range keys {\n\t\twork <- keys[i]\n\t}\n\tnotifyDone(work)\n\twaitForAcks(quit)\n}", "title": "" }, { "docid": "6b4e60607acb579ffb61e8573948c4fe", "score": "0.55569136", "text": "func CheckCheck() {\n\tfmt.Println(\"hello! TODO.... (the other commands are imported)\")\n}", "title": "" }, { "docid": "752f3a7806dd48a9cf7c6dbff4403461", "score": "0.55551165", "text": "func (s *Setup) Check(ctx context.Context) error {\n\tfor _, err := range s.errs {\n\t\ttesting.ContextLogf(ctx, \"Setup %q failed: %s\", s.name, err)\n\t}\n\tif len(s.errs) > 0 {\n\t\treturn errors.Wrapf(s.errs[0], \"setup %q had %d items fail, first failure\", s.name, len(s.errs))\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9740c87b879bf7a80a5c34ad034df0d0", "score": "0.5553381", "text": "func (ec *EmptyCreate) check() error {\n\treturn nil\n}", "title": "" }, { "docid": "399370120a9bf4107b77f5d5e08b7338", "score": "0.5524336", "text": "func (s State) Check() sdk.SimpleDB {\n\treturn s.checkTx\n}", "title": "" }, { "docid": "9f1e42756f98102921f7dc3467e6e169", "score": "0.55149305", "text": "func CheckAll(ctx context.Context, g *Graph) {\n\tg.MergeNodes(ctx)\n\tif trace.HadError(ctx) {\n\t\t// can't proceed without merged nodes\n\t\treturn\n\t}\n\tg.CheckReferences(ctx, CheckReferences)\n\tg.CheckFields(ctx, CheckFieldType)\n\tg.CheckSubtypes(ctx, CheckWrapperType)\n\t// TODO: rest aren't implemented\n}", "title": "" }, { "docid": "d089c67e8678b3b62fab0149aba4d308", "score": "0.55091643", "text": "func checkAllSites() {\n\t// Check for internet-connection\n\tif !lib.GetConfiguration().Application.RunCheckIfOffline {\n\t\tres, err := goreq.Request{Uri: \"https://google.com\", Method: \"HEAD\", UserAgent: \"UpAndRunning2 (https://github.com/MarvinMenzerath/UpAndRunning2)\", MaxRedirects: 1, Timeout: 5 * time.Second}.Do()\n\t\tif err != nil {\n\t\t\tlogging.MustGetLogger(\"\").Warning(\"Did not check Websites because of missing internet-connection: \", err)\n\t\t\treturn\n\t\t} else {\n\t\t\tif res.StatusCode != 200 {\n\t\t\t\tlogging.MustGetLogger(\"\").Warning(\"Did not check Websites because of missing internet-connection.\")\n\t\t\t\tres.Body.Close()\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\n\t// Query the Database\n\tdb := lib.GetDatabase()\n\trows, err := db.Query(\"SELECT id, protocol, url, checkMethod FROM websites WHERE enabled = 1;\")\n\tif err != nil {\n\t\tlogging.MustGetLogger(\"\").Error(\"Unable to fetch Websites: \", err)\n\t\treturn\n\t}\n\tdefer rows.Close()\n\n\t// Check every Website\n\tcount := 0\n\tfor rows.Next() {\n\t\tvar website lib.Website\n\t\terr = rows.Scan(&website.Id, &website.Protocol, &website.Url, &website.CheckMethod)\n\t\tif err != nil {\n\t\t\tlogging.MustGetLogger(\"\").Error(\"Unable to read Website-Row: \", err)\n\t\t\treturn\n\t\t}\n\t\tgo website.RunCheck(false)\n\t\tcount++\n\t\ttime.Sleep(time.Millisecond * 200)\n\t}\n\n\t// Check for Errors\n\terr = rows.Err()\n\tif err != nil {\n\t\tlogging.MustGetLogger(\"\").Error(\"Unable to read Website-Rows: \", err)\n\t\treturn\n\t}\n\n\tlogging.MustGetLogger(\"\").Info(\"Checked \" + strconv.Itoa(count) + \" active Websites.\")\n}", "title": "" }, { "docid": "8a29bc49b5e48afec9d9c06c8f8cab7b", "score": "0.54985976", "text": "func checkFinished(valid_keys map[int]bool) (byte, bool) {\n\n\tnumber_true := 0\n\tkey_byte_found := 0\n\n\t// count how many valid keys there are\n\tfor idx, val := range valid_keys {\n\t\tif val {\n\t\t\tnumber_true ++\n\t\t\tkey_byte_found = idx\n\t\t}\n\t}\n\t// if only one key is, we can stop\n\tif number_true == 1 {\n\t\treturn byte(key_byte_found), true\n\t}\n\n\treturn 0, false\n}", "title": "" }, { "docid": "0b46a7484b54baa9d7cbb1a4e70baa7b", "score": "0.54953945", "text": "func (s Status) Check() bool {\n\tif s < Inactivated {\n\t\treturn false\n\t}\n\n\tif s > Delete {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "7e96cbed56991e6a069d2bea2991605f", "score": "0.5488366", "text": "func (c *Simple) checkAndSet() {\n\tvar isTripped bool\n\n\tswitch c.cbFactor {\n\tcase factorErrorRatio:\n\t\t// check if amount of network errors exceed threshold over sliding window, threshold for comparison should be < 1.0 i.e. .5 = 50th percentile\n\t\tif c.metrics.NetworkErrorRatio() > c.Threshold {\n\t\t\tisTripped = true\n\t\t}\n\tcase factorLatency:\n\t\t// check if threshold in milliseconds is reached and trip\n\t\thist, err := c.metrics.LatencyHistogram()\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\n\t\tl := hist.LatencyAtQuantile(c.Threshold)\n\t\tif l.Nanoseconds()/int64(time.Millisecond) > int64(c.Threshold) {\n\t\t\tisTripped = true\n\t\t}\n\tcase factorStatusCodeRatio:\n\t\t// check ratio of error status codes of sliding window, threshold for comparison should be < 1.0 i.e. .5 = 50th percentile\n\t\tif c.metrics.ResponseCodeRatio(500, 600, 0, 600) > c.Threshold {\n\t\t\tisTripped = true\n\t\t}\n\t}\n\n\tif isTripped {\n\t\tc.metrics.Reset()\n\t\tatomic.AddInt32(&c.tripped, 1)\n\n\t\t// wait TripDuration amount before allowing operations to resume.\n\t\tt := time.NewTimer(time.Duration(c.Config.TripDuration))\n\t\t<-t.C\n\n\t\tatomic.AddInt32(&c.tripped, -1)\n\t}\n}", "title": "" }, { "docid": "7e6c92b0b74bd5ca020264215c98c8c2", "score": "0.54819816", "text": "func (NilHealthcheck) Check() {}", "title": "" }, { "docid": "ee2ede0aec196c9dc28b4436888c4b8c", "score": "0.5477711", "text": "func (fxt *TestFixture) Check() error {\n\tfor _, fn := range fxt.checkFuncs {\n\t\tif err := fn(); err != nil {\n\t\t\treturn errs.Wrap(err, \"check function failed\")\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "30ca84bf3aece1a09bf69df864a47966", "score": "0.54772985", "text": "func All(checkers ...Checker) Checker {\n\treturn func() (bool, string, error) {\n\t\tfor _, ckr := range checkers {\n\t\t\tok, msg, err := ckr()\n\t\t\tif err != nil {\n\t\t\t\treturn ok, msg, err\n\t\t\t}\n\t\t}\n\t\treturn true, \"all checks passed.\", nil\n\t}\n}", "title": "" }, { "docid": "9bc58c60871c36985cabeb07d550355f", "score": "0.5476322", "text": "func (s *StatsInfo) DoneChecking(remote string) {\n\ts.checking.del(remote)\n\ts.mu.Lock()\n\ts.checks++\n\ts.mu.Unlock()\n}", "title": "" }, { "docid": "c5b0434384df22ddcc1071e5ca31f7e4", "score": "0.5475163", "text": "func CheckOK(c bool, args ...interface{}) {\n\tif c {\n\t\treturn\n\t}\n\tlg.Log(Format(args...))\n\tpanic(\"CHECK failure\")\n}", "title": "" }, { "docid": "487f237eb2b8236b071c4e19fe7c889d", "score": "0.5471574", "text": "func (c *Check) run() State {\n\n\t// Since this is an Scored check\n\t// without tests return a 'WARN' to alert\n\t// the user that this check needs attention\n\tif c.Scored && len(strings.TrimSpace(c.Type)) == 0 && c.Tests == nil {\n\t\tc.Reason = \"There are no tests\"\n\t\tc.State = WARN\n\t\treturn c.State\n\t}\n\n\t// If check type is skip, force result to INFO\n\tif c.Type == \"skip\" {\n\t\tc.Reason = \"Test marked as skip\"\n\t\tc.State = INFO\n\t\treturn c.State\n\t}\n\n\t// If check type is manual force result to WARN\n\tif c.Type == MANUAL {\n\t\tc.Reason = \"Test marked as a manual test\"\n\t\tc.State = WARN\n\t\treturn c.State\n\t}\n\n\tlastCommand := c.Audit\n\thasAuditConfig := c.AuditConfig != \"\"\n\n\tstate, finalOutput, retErrmsgs := performTest(c.Audit, c.Tests)\n\tif len(state) > 0 {\n\t\tc.Reason = retErrmsgs\n\t\tc.State = state\n\t\treturn c.State\n\t}\n\terrmsgs := retErrmsgs\n\n\t// If something went wrong with the 'Audit' command\n\t// and an 'AuditConfig' command was provided, use it to\n\t// execute tests\n\tif (finalOutput == nil || !finalOutput.testResult) && hasAuditConfig {\n\t\tlastCommand = c.AuditConfig\n\n\t\tnItems := len(c.Tests.TestItems)\n\t\t// The reason we're creating a copy of the \"tests\"\n\t\t// is so that tests can executed\n\t\t// with the AuditConfig command\n\t\t// against the Path only\n\t\tcurrentTests := &tests{\n\t\t\tBinOp: c.Tests.BinOp,\n\t\t\tTestItems: make([]*testItem, nItems),\n\t\t}\n\n\t\tfor i := 0; i < nItems; i++ {\n\t\t\tti := c.Tests.TestItems[i]\n\t\t\tnti := &testItem{\n\t\t\t\t// Path is used to test Command Param values\n\t\t\t\t// AuditConfig ==> Path\n\t\t\t\tPath: ti.Path,\n\t\t\t\tSet: ti.Set,\n\t\t\t\tCompare: ti.Compare,\n\t\t\t}\n\t\t\tcurrentTests.TestItems[i] = nti\n\t\t}\n\n\t\tstate, finalOutput, retErrmsgs = performTest(c.AuditConfig, currentTests)\n\t\tif len(state) > 0 {\n\t\t\tc.Reason = retErrmsgs\n\t\t\tc.State = state\n\t\t\treturn c.State\n\t\t}\n\t\terrmsgs += retErrmsgs\n\t}\n\n\tif finalOutput != nil && finalOutput.testResult {\n\t\tc.State = PASS\n\t\tc.ActualValue = finalOutput.actualResult\n\t\tc.ExpectedResult = finalOutput.ExpectedResult\n\t} else {\n\t\tif c.Scored {\n\t\t\tc.State = FAIL\n\t\t} else {\n\t\t\tc.Reason = errmsgs\n\t\t\tc.State = WARN\n\t\t}\n\t}\n\n\tif finalOutput != nil {\n\t\tglog.V(3).Infof(\"Check.ID: %s Command: %q TestResult: %t State: %q \\n\", c.ID, lastCommand, finalOutput.testResult, c.State)\n\t} else {\n\t\tglog.V(3).Infof(\"Check.ID: %s Command: %q TestResult: <<EMPTY>> \\n\", c.ID, lastCommand)\n\t}\n\n\tif errmsgs != \"\" {\n\t\tglog.V(2).Info(errmsgs)\n\t}\n\treturn c.State\n}", "title": "" }, { "docid": "02c48d40d04d7e18132e123a53aeefaf", "score": "0.54628366", "text": "func (s *Sentry) RunCheck() {\n\tfor i := range s.targets {\n\t\tif s.targets[i].NeedsCheck() {\n\t\t\ts.CheckLink(&s.targets[i])\n\t\t\ts.targets[i].ResetRunTime()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9d81d5aaea966352f6afd771d040258a", "score": "0.5454087", "text": "func (r PermissionCheckers) Check() error {\n\tfor _, r := range r {\n\t\tif err := r.Check(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e4de447d34e5d31ce5d90e5accdf8ced", "score": "0.54387385", "text": "func (doc *CheckOsCommand) checkOsAll() error {\n\t// 1. build all cmd\n\terr := doc.buildAllOsCmd()\n\tif err != nil {\n\t\tfmt.Printf(\"[failed] check os failed! err: %s \\n\", err.Error())\n\t}\n\n\t// 2. one by one exec cmd\n\tfor _, allCheckExecCmd := range AllCheckExecCmds {\n\t\tswitch allCheckExecCmd.Scope {\n\t\tcase OperatorCommand:\n\t\t\tdoc.execOperatorCmd(&allCheckExecCmd)\n\t\tdefault:\n\t\t\tdoc.execBladeCmd(&allCheckExecCmd, true)\n\t\t}\n\t}\n\n\t// 3. output the result\n\tvar output [][]string\n\tfor _, checkExecCmd := range AllCheckExecCmds {\n\t\tfor _, execResult := range checkExecCmd.ExecResult {\n\t\t\toneOutput := []string{checkExecCmd.ExpName, checkExecCmd.ActionName, execResult.result, execResult.info}\n\t\t\toutput = append(output, oneOutput)\n\t\t}\n\t}\n\tdoc.outPutTheResult(output)\n\treturn nil\n}", "title": "" }, { "docid": "b999ef6933e8f16af88d156e66d2f306", "score": "0.5437069", "text": "func (ds *DockerService) startChecking(c *Container) {\n\tfor _, chk := range c.HealthChecks {\n\t\tgo ds.startCheckLoop(c, chk)\n\t}\n}", "title": "" }, { "docid": "c08c47f5b96b2b63075ff569775f5b71", "score": "0.54362285", "text": "func (c *Simple) OK() bool {\n\treturn atomic.LoadInt32(&c.tripped) == 0\n}", "title": "" }, { "docid": "16318494c70542f632da77604a47016c", "score": "0.54267824", "text": "func (u *updater) Check() error {\n\tu.mu.Lock()\n\tdefer u.mu.Unlock()\n\n\treturn u.status\n}", "title": "" }, { "docid": "16318494c70542f632da77604a47016c", "score": "0.54267824", "text": "func (u *updater) Check() error {\n\tu.mu.Lock()\n\tdefer u.mu.Unlock()\n\n\treturn u.status\n}", "title": "" }, { "docid": "370f36392f23f2b0a3336797ee92c4fd", "score": "0.5422811", "text": "func (fuo *FileimportUpdateOne) check() error {\n\tif v, ok := fuo.mutation.Filename(); ok {\n\t\tif err := fileimport.FilenameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"filename\", err: fmt.Errorf(\"ent: validator failed for field \\\"filename\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := fuo.mutation.Filetype(); ok {\n\t\tif err := fileimport.FiletypeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"filetype\", err: fmt.Errorf(\"ent: validator failed for field \\\"filetype\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := fuo.mutation.Status(); ok {\n\t\tif err := fileimport.StatusValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"status\", err: fmt.Errorf(\"ent: validator failed for field \\\"status\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5480a737bfc413a982b67dbce53feab6", "score": "0.542199", "text": "func (c *CompositeChecker) Check() error {\n\tc.mu.Lock()\n\tdefer c.mu.Unlock()\n\n\tfor _, checker := range c.checkers {\n\t\tif err := checker.Check(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6dcdc632b4339d71f229c50a98c07d19", "score": "0.54148567", "text": "func (c *Checker) doChecks() types.Attempts {\n\tchecks := make(types.Attempts, c.Attempts)\n\n\tpinger, _ := NewPinger(c.URL)\n\tpinger.SetPrivileged(c.Privileged)\n\tpinger.Count = c.Count\n\tpinger.Timeout = c.Timeout.Duration\n\tpinger.Interval = c.Interval.Duration\n\n\tfor i := 0; i < c.Attempts; i++ {\n\t\tstart := time.Now()\n\n\t\terr := pinger.Run()\n\n\t\tchecks[i].RTT = time.Since(start)\n\t\tif err != nil {\n\t\t\tchecks[i].Error = err.Error()\n\t\t\tcontinue\n\t\t}\n\t\tc.stats = pinger.Statistics()\n\n\t\terr = c.checkDown(c.stats)\n\t\tif err != nil {\n\t\t\tchecks[i].Error = err.Error()\n\t\t}\n\t}\n\n\treturn checks\n}", "title": "" }, { "docid": "814dc7fb6cf58d7508d948dbb42a09b3", "score": "0.54141927", "text": "func (hc *Check) healthcheck() {\n\tif hc.Checker == nil {\n\t\treturn\n\t}\n\tstart := time.Now()\n\n\tvar result *Result\n\tif hc.dryrun {\n\t\tresult = complete(start, \"dryrun mode; always succeed\", true, nil)\n\t} else {\n\t\tresult = hc.execute()\n\t}\n\n\tstatus := \"SUCCESS\"\n\tif !result.Success {\n\t\tstatus = \"FAILURE\"\n\t}\n\tlog.Infof(\"%d: (%s) %s: %v\", hc.Id, hc, status, result)\n\n\thc.lock.Lock()\n\n\thc.start = start\n\thc.result = result\n\n\tvar state State\n\tif result.Success {\n\t\tstate = StateHealthy\n\t\thc.failed = 0\n\t\thc.successes++\n\t} else {\n\t\thc.failed++\n\t\thc.failures++\n\t\tstate = StateUnhealthy\n\t}\n\n\tif hc.state == StateHealthy && hc.failed > 0 && hc.failed <= uint64(hc.Config.Retries) {\n\t\tlog.Infof(\"%d: Failure %d - retrying...\", hc.Id, hc.failed)\n\t\tstate = StateHealthy\n\t}\n\ttransition := (hc.state != state)\n\thc.state = state\n\n\thc.lock.Unlock()\n\n\tif transition {\n\t\thc.Notify()\n\t}\n}", "title": "" }, { "docid": "909ee51648cb0e4a2558ec8fb249f242", "score": "0.5410671", "text": "func (c *Any) Check(msg types.Message) bool {\n\tc.mCount.Incr(1)\n\tfor i := 0; i < msg.Len(); i++ {\n\t\tif c.child.Check(message.Lock(msg, i)) {\n\t\t\tc.mTrue.Incr(1)\n\t\t\treturn true\n\t\t}\n\t}\n\tc.mFalse.Incr(1)\n\treturn false\n}", "title": "" }, { "docid": "9990c059847f084e42abc72cf2cd921c", "score": "0.541061", "text": "func (ds *DockerService) stopAllChecking() {\n\tfor cid, cancel := range ds.RunningChecks {\n\t\tlog.Daemon.WithField(\"service\", internalTypes.DockerService).Infof(\"stopping check for %s\", cid)\n\t\tcancel()\n\t\tdelete(ds.RunningChecks, cid)\n\t}\n}", "title": "" }, { "docid": "953b56669abadb03a653f9efebda15a2", "score": "0.5406705", "text": "func (feed *Feed) Check() {\n\tlog.Debug(\"Check mails\")\n\tif !feed.IsValid() {\n\t\tfeed.callResult(0, errors.New(\"No account informations provided.\"))\n\t\treturn\n\t}\n\n\tcount := feed.Count() // save current count.\n\tfeed.Clear() // reset list.\n\te := feed.get() // Get new data.\n\tfeed.callResult(feed.Count()-count, e)\n}", "title": "" }, { "docid": "adb45ee73169f4d30730eefce6f9463a", "score": "0.5405159", "text": "func (facts *PipelineRunFacts) checkFinalTasksDone() bool {\n\treturn facts.checkTasksDone(facts.FinalTasksGraph)\n}", "title": "" }, { "docid": "e6872288d41de8e1c84f657b86e31354", "score": "0.53782016", "text": "func CheckAllFields(fields []FormFieldInterface) interface{} {\n\tpanicChannel := make(chan interface{})\n\n\tgo func() {\n\t\tdefer func() {\n\t\t\tpanicChannel <- recover()\n\t\t}()\n\n\t\tfor _, field := range fields {\n\t\t\tfield.PreCheck()\n\t\t}\n\t}()\n\n\treturn <-panicChannel\n}", "title": "" }, { "docid": "21ea8e64d59b83104ea94119e42580ba", "score": "0.53732944", "text": "func (e *TryConfirmCancel) isReady(tccKeyMap sync.Map) bool {\n\tvar isReady = true\n\t// all try is ready\n\ttccKeyMap.Range(func(key, value interface{}) bool {\n\t\tif ready, ok := value.(bool); ok {\n\t\t\tif !ready {\n\t\t\t\tisReady = ready\n\t\t\t\treturn false\n\t\t\t}\n\t\t} else {\n\t\t\tisReady = false\n\t\t}\n\t\treturn true\n\t})\n\treturn isReady\n}", "title": "" }, { "docid": "d8056fd670ef091fe93d839daea19a0a", "score": "0.5371849", "text": "func (manager *ParallelTestOutputManager) getAllTestsPassed() bool {\n\tmanager.mutex.Lock()\n\tdefer manager.mutex.Unlock()\n\n\tallTestsPassed := true\n\tfor _, output := range manager.testOutputs {\n\t\ttestHadNoIssues := PASSED == getTestStatusFromResult(output.executionErr, output.testPassed)\n\t\tallTestsPassed = allTestsPassed && testHadNoIssues\n\t}\n\treturn allTestsPassed\n}", "title": "" }, { "docid": "96fac331ef59fc07c9e73803d71a81f4", "score": "0.5363902", "text": "func (pdruo *PingDetectorResultUpdateOne) check() error {\n\tif v, ok := pdruo.mutation.Result(); ok {\n\t\tif err := pingdetectorresult.ResultValidator(int8(v)); err != nil {\n\t\t\treturn &ValidationError{Name: \"result\", err: fmt.Errorf(`ent: validator failed for field \"PingDetectorResult.result\": %w`, err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2f5d1716dbad0b8b1d6ac3fba3c0ef7c", "score": "0.53524673", "text": "func (cq *CheckQueue) Run() error {\n\tfor _, check := range cq.Checks {\n\t\tif cq.Err = check(); cq.Err != nil {\n\t\t\treturn cq.Err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e6c6d6e6364710226f6c03b72f942918", "score": "0.5351998", "text": "func (e *MultipleEventChecker) Check(eventCh <-chan *crossconnect.CrossConnectEvent) error {\n\tif len(e.Events) == 0 {\n\t\treturn errors.New(\"events array can't be empty\")\n\t}\n\n\tfor _, event := range e.Events {\n\t\tif err := event.Check(eventCh); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "5e3e73a43970c7f5b282f5c4841cbd12", "score": "0.53495526", "text": "func (c *checkEndpointsImpl) CheckAll(options CheckAllOptions) icinga.Results {\n\tresults := icinga.NewResults()\n\tresults.Add(c.CheckAvailableAddresses(options.CheckAvailableAddressesOptions))\n\treturn results\n}", "title": "" }, { "docid": "6243c8b655b7ab3210782e57854baa77", "score": "0.5347569", "text": "func (m *Master) Done() bool {\n\t// Your code here.\n\tret := m.mapMaster.AllDone() && m.reduceMaster.AllDone()\n\tif ret {\n\t\tlog.Println(\"all done, exiting...\")\n\t\ttime.Sleep(3 * time.Second)\n\t}\n\n\treturn ret\n}", "title": "" }, { "docid": "85fa46641ec693222d587fee68efef40", "score": "0.53459054", "text": "func (fuo *FileUpdateOne) check() error {\n\tif v, ok := fuo.mutation.Name(); ok {\n\t\tif err := file.NameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"name\", err: fmt.Errorf(\"ent: validator failed for field \\\"name\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := fuo.mutation.GetType(); ok {\n\t\tif err := file.TypeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"type\", err: fmt.Errorf(\"ent: validator failed for field \\\"type\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := fuo.mutation.Md5(); ok {\n\t\tif err := file.Md5Validator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"md5\", err: fmt.Errorf(\"ent: validator failed for field \\\"md5\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := fuo.mutation.Path(); ok {\n\t\tif err := file.PathValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"path\", err: fmt.Errorf(\"ent: validator failed for field \\\"path\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "dbdded991a210e4752a02b5ef889d7a3", "score": "0.5341759", "text": "func (c *LongTermChecker) Check() {\n\tc.t.Reset(c.d)\n}", "title": "" }, { "docid": "afda10ff21e3985b854802ca1f5f5fc7", "score": "0.5330912", "text": "func (m *trainStatus) checkAlt() bool {\n\treturn m.preStatus != m.newStatus\n}", "title": "" }, { "docid": "5c7bd88d2166401da15965734010f01b", "score": "0.532895", "text": "func (c *CheckBox) Check(g *gocui.Gui, v *gocui.View) error {\n\tif v.Buffer() != \"\" {\n\t\tv.Clear()\n\t\tc.isChecked = false\n\t} else {\n\t\tfmt.Fprint(v, \"X\")\n\t\tc.isChecked = true\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "18c498d7a221ad93d8b4a5855c536cb5", "score": "0.5328099", "text": "func (puo *PointkycrvUpdateOne) check() error {\n\tif v, ok := puo.mutation.WalletID(); ok {\n\t\tif err := pointkycrv.WalletIDValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"WalletID\", err: fmt.Errorf(\"ent: validator failed for field \\\"WalletID\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := puo.mutation.StatusGen(); ok {\n\t\tif err := pointkycrv.StatusGenValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"StatusGen\", err: fmt.Errorf(\"ent: validator failed for field \\\"StatusGen\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := puo.mutation.GetType(); ok {\n\t\tif err := pointkycrv.TypeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"Type\", err: fmt.Errorf(\"ent: validator failed for field \\\"Type\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d00ac11643ea64a07e97fa3d76d80678", "score": "0.53272974", "text": "func (client *Client) checkAllDependencies(noReport bool) {\n\thealthy := true\n\tfor _, v := range client.Response.Dependencies {\n\t\tfor _, d := range v {\n\t\t\td.checkDependency()\n\t\t\tif !d.Validated {\n\t\t\t\thealthy = false\n\t\t\t}\n\t\t}\n\t}\n\n\tif !healthy {\n\t\tclient.Response.Healthy = false\n\t\terr := client.Report()\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"failed to report to Sonar: %v\\n\", err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e7c895026c6d4353e9e0a11137cfc836", "score": "0.5313824", "text": "func check_and_complete(unit *WorkUnit) bool {\n\thash_bytes := sha1.Sum(unit.nonced)\n\thash_hex := hex.EncodeToString(hash_bytes[:])\n\tunit.hash = hash_hex\n\tif hash_hex >= unit.difficulty {\n\t\tlog.Println(\"Hash of\", hash_hex, \"not small enough for difficulty\", unit.difficulty);\n\t\tlog.Println(\"Work unit:\", string(unit.tononce))\n\t\treturn false\n\t}\n\t\n\t// Store the hash so we know not to get confused about it in the future.\n\tstore_hash(hash_hex)\n\n\tcommit := unit.nonced[len(unit.header):]\n\tif err := ioutil.WriteFile(\"commit.txt\", commit, 0644); err != nil {\n\t\tlog.Fatalln(\"Error writing to commit.txt:\", err)\n\t}\n\n\tif err := exec.Command(\"git\", \"hash-object\", \"-t\", \"commit\", \"commit.txt\", \"-w\").Run(); err != nil {\n\t\tlog.Fatalln(\"Git hash-object error:\", err)\n\t}\n\n\tif err := exec.Command(\"git\", \"reset\", \"--hard\", hash_hex).Run(); err != nil {\n\t\tlog.Fatalln(\"Git reset to\", hash_hex, \"error:\", err)\n\t}\n\n\tcmd := exec.Command(\"git\", \"push\", \"origin\", \"master\")\n\tcmd.Stdout = os.Stdout\n\tcmd.Stderr = os.Stderr\n\tif err := cmd.Run(); err != nil {\n\t\tlog.Println(\"Git push failed:\", err)\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "11e3b8f960b912fb58207b829f688480", "score": "0.5313536", "text": "func (suo *StockUpdateOne) check() error {\n\tif v, ok := suo.mutation.Symbol(); ok {\n\t\tif err := stock.SymbolValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"symbol\", err: fmt.Errorf(`ent: validator failed for field \"Stock.symbol\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := suo.mutation.Name(); ok {\n\t\tif err := stock.NameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"name\", err: fmt.Errorf(`ent: validator failed for field \"Stock.name\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := suo.mutation.Short(); ok {\n\t\tif err := stock.ShortValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"short\", err: fmt.Errorf(`ent: validator failed for field \"Stock.short\": %w`, err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "70ab20945bbc5d42e610077b03edd76a", "score": "0.53131855", "text": "func (c *checker) Check() {\n\t// We don't want caller to accidently grab the error, so we stub out the\n\t// call here.\n\treturn\n}", "title": "" }, { "docid": "df0698530569131ec8baa70207923c58", "score": "0.5310718", "text": "func (l *ContainerList) runCheck(r *Result, f func(c ContainerInfo) bool, msg string) {\n\tvar badContainers []string\n\tfor _, container := range *l {\n\t\tif f(container.Info) == false {\n\t\t\tbadContainers = append(badContainers, container.ID)\n\t\t}\n\t}\n\tif len(badContainers) == 0 {\n\t\tr.Pass()\n\t} else {\n\t\toutput := fmt.Sprintf(msg,\n\t\t\tbadContainers)\n\t\tr.Fail(output)\n\t}\n\treturn\n}", "title": "" }, { "docid": "b3eee078277d82b26352ff96e99678c5", "score": "0.53051597", "text": "func checkTrue(s cL.Symptom) int {\n\tif s.Checked == \"true\" {\n\t\treturn 1\n\t}\n\treturn 0\n}", "title": "" }, { "docid": "1caa4274f492c5a103d554901f64f553", "score": "0.529513", "text": "func runCheck(b *TheBot, games map[uint64]bool) (digest []string, err error) {\n\terr = b.getUserInfo()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tdefer fmt.Println(\"bot check finished\")\n\n\t_, err = b.parseGiveaways(games)\n\treturn b.enteredGiveAways, err\n}", "title": "" }, { "docid": "c63cae67c058c2b6935b13eaf78e722d", "score": "0.5288377", "text": "func (m *StorageMock) AllFinished() bool {\n\t// if expectation series were set then invocations count should be equal to expectations count\n\tif len(m.AllMock.expectationSeries) > 0 {\n\t\treturn atomic.LoadUint64(&m.AllCounter) == uint64(len(m.AllMock.expectationSeries))\n\t}\n\n\t// if main expectation was set then invocations count should be greater than zero\n\tif m.AllMock.mainExpectation != nil {\n\t\treturn atomic.LoadUint64(&m.AllCounter) > 0\n\t}\n\n\t// if func was set then invocations count should be greater than zero\n\tif m.AllFunc != nil {\n\t\treturn atomic.LoadUint64(&m.AllCounter) > 0\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "79cf3245bce24baad7687c09f1b4fe8d", "score": "0.5287076", "text": "func (c *checker) Finish() {\n\tc.ctx.Finish()\n\tc.ctx.Check()\n}", "title": "" }, { "docid": "66256ec1556145518a93954c687ef2c0", "score": "0.5286198", "text": "func (m *Master) Done() bool {\n\tret := false\n\n\t// Your code here.\n\tif m.allReduceDone {\n\t\tret = true\n\t}\n\n\treturn ret\n}", "title": "" }, { "docid": "c546448eb3fe68679e3af0256b3f5b00", "score": "0.52820027", "text": "func (p *NetworkWatchersVerifyIPFlowPoller) Done() bool {\n\treturn p.pt.Done()\n}", "title": "" }, { "docid": "0b15f21f256e5a0e70a507dda0bc4b63", "score": "0.52792495", "text": "func (puo *PregnancystatusUpdateOne) check() error {\n\tif v, ok := puo.mutation.Pregnancystatus(); ok {\n\t\tif err := pregnancystatus.PregnancystatusValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"Pregnancystatus\", err: fmt.Errorf(\"ent: validator failed for field \\\"Pregnancystatus\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e0eeca21d9f2e6ead2b872549c16a043", "score": "0.52781516", "text": "func (u *User)rulesCheck() {\n\tfmt.Println(\"business logic here\")\n}", "title": "" }, { "docid": "fa1966fbad272cacb5e0f83c15512c40", "score": "0.52740985", "text": "func (h *StandardHealthcheck) Check() {\n\th.f(h)\n}", "title": "" }, { "docid": "ccab604e736f1e9a97d8e4a529780c47", "score": "0.52703893", "text": "func (c *Coordinator) Done() bool {\n\t//ret := false\n\t// Your code here.\n\tmu.Lock()\n\toverall := c.map_stage_completed_status && c.reduce_stage_completed_status\n\tmu.Unlock()\n\treturn overall\n}", "title": "" }, { "docid": "03176277ffd29f16828dff11353b8cb7", "score": "0.52644867", "text": "func (m *Master) Done() bool {\n\t//ret := false\n\t// Your code here.\n\tfor _, info := range m.reduceTasks {\n\t\tif info.Status != COMPLETED {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "1c48a8b26c3b0b2b03f0cf25dffcd7b1", "score": "0.52635986", "text": "func (u Unlimited) Check(job *datastore.Job) (bool, error) {\n\treturn true, nil\n}", "title": "" }, { "docid": "6f094ff0db6edeaee42f92bacb78c00c", "score": "0.5263341", "text": "func (fuo *FileUpdateOne) check() error {\n\tif v, ok := fuo.mutation.GetType(); ok {\n\t\tif err := file.TypeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"type\", err: fmt.Errorf(\"ent: validator failed for field \\\"type\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := fuo.mutation.Size(); ok {\n\t\tif err := file.SizeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"size\", err: fmt.Errorf(\"ent: validator failed for field \\\"size\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3dae73a0eca405b6c43d45c60683130a", "score": "0.52597547", "text": "func check() bool{\n\tout, err := exec.Command(\"sh\", \"-c\", \"sudo python /home/pi/PMconc.py\").Output()\n if err != nil {\n\t\tacc = true\n fmt.Println(\"error occured %s\", err)\n } else {\n stringout := string(out)\n stringout = strings.TrimSpace(stringout)\n\t\tif stringout == \"0\" {\n\t\t\tacc = true\n\t\t}\n //fmt.Println(acc)\n }\n\t return acc\n}", "title": "" }, { "docid": "f290fbf52076bdd5ba2827e6f10fe09f", "score": "0.52549934", "text": "func check(t *testing.T, currentState *int32, expectedState int32) {\n\tassert.Equal(t, expectedState, atomic.LoadInt32(currentState))\n\tatomic.AddInt32(currentState, 1)\n}", "title": "" }, { "docid": "dc3b9a9ad5c7b0d8b5ce345f61df02d1", "score": "0.525306", "text": "func (self *CoinTransaction)Check(block *Block,trChanges *map[string]string)bool{\n return true\n}", "title": "" }, { "docid": "10ee71f93286c6de42fdfc3308df979e", "score": "0.52528584", "text": "func RunChecks(tasks []Task) (pass bool, err error) {\n\tfor _, task := range tasks {\n\t\tpass, err = task.Check()\n\t\tif !pass || err != nil {\n\t\t\treturn false, err\n\t\t}\n\t}\n\treturn true, nil\n}", "title": "" }, { "docid": "a86bbb2378a2d9ee43c6c47bc587acc0", "score": "0.5248098", "text": "func (r *Runner) work() {\n\tlog.Debug(\"Ready to process checks...\")\n\tdefer TestWg.Done()\n\tdefer runnerStats.Add(\"Workers\", -1)\n\n\tfor check := range r.pending {\n\t\t// see if the check is already running\n\t\tr.m.Lock()\n\t\tif _, isRunning := r.runningChecks[check.ID()]; isRunning {\n\t\t\tlog.Debugf(\"Check %s is already running, skip execution...\", check)\n\t\t\tr.m.Unlock()\n\t\t\tcontinue\n\t\t} else {\n\t\t\tr.runningChecks[check.ID()] = check\n\t\t\trunnerStats.Add(\"RunningChecks\", 1)\n\t\t}\n\t\tr.m.Unlock()\n\n\t\tdoLog, lastLog := shouldLog(check.ID())\n\n\t\tif doLog {\n\t\t\tlog.Infoc(\"Running check\", \"check\", check)\n\t\t} else {\n\t\t\tlog.Debugc(\"Running check\", \"check\", check)\n\t\t}\n\n\t\t// run the check\n\t\tvar err error\n\t\tt0 := time.Now()\n\n\t\terr = check.Run()\n\t\tlongRunning := check.Interval() == 0\n\n\t\twarnings := check.GetWarnings()\n\n\t\t// use the default sender for the service checks\n\t\tsender, e := aggregator.GetDefaultSender()\n\t\tif e != nil {\n\t\t\tlog.Errorf(\"Error getting default sender: %v. Not sending status check for %s\", e, check)\n\t\t}\n\t\tserviceCheckTags := []string{fmt.Sprintf(\"check:%s\", check.String())}\n\t\tserviceCheckStatus := metrics.ServiceCheckOK\n\n\t\thostname := getHostname()\n\n\t\tif len(warnings) != 0 {\n\t\t\t// len returns int, and this expect int64, so it has to be converted\n\t\t\trunnerStats.Add(\"Warnings\", int64(len(warnings)))\n\t\t\tserviceCheckStatus = metrics.ServiceCheckWarning\n\t\t}\n\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Error running check %s: %s\", check, err)\n\t\t\trunnerStats.Add(\"Errors\", 1)\n\t\t\tserviceCheckStatus = metrics.ServiceCheckCritical\n\t\t}\n\n\t\tif sender != nil && !longRunning {\n\t\t\tsender.ServiceCheck(\"datadog.agent.check_status\", serviceCheckStatus, hostname, serviceCheckTags, \"\")\n\t\t\tsender.Commit()\n\t\t}\n\n\t\t// remove the check from the running list\n\t\tr.m.Lock()\n\t\tdelete(r.runningChecks, check.ID())\n\t\tr.m.Unlock()\n\n\t\t// publish statistics about this run\n\t\trunnerStats.Add(\"RunningChecks\", -1)\n\t\trunnerStats.Add(\"Runs\", 1)\n\n\t\tr.m.Lock()\n\t\tif !longRunning || len(warnings) != 0 || err != nil {\n\t\t\t// If the scheduler isn't assigned (it should), just add stats\n\t\t\t// otherwise only do so if the check is in the scheduler\n\t\t\tif r.scheduler == nil || r.scheduler.IsCheckScheduled(check.ID()) {\n\t\t\t\tmStats, _ := check.GetMetricStats()\n\t\t\t\taddWorkStats(check, time.Since(t0), err, warnings, mStats)\n\t\t\t}\n\t\t}\n\t\tr.m.Unlock()\n\n\t\tl := \"Done running check\"\n\t\tif doLog {\n\t\t\tif lastLog {\n\t\t\t\tl = l + fmt.Sprintf(\", next runs will be logged every %v runs\", config.Datadog.GetInt64(\"logging_frequency\"))\n\t\t\t}\n\t\t\tlog.Infoc(l, \"check\", check.String())\n\t\t} else {\n\t\t\tlog.Debugc(l, \"check\", check.String())\n\t\t}\n\n\t\tif check.Interval() == 0 {\n\t\t\tlog.Infof(\"Check %v one-time's execution has finished\", check)\n\t\t\treturn\n\t\t}\n\t}\n\n\tlog.Debug(\"Finished processing checks.\")\n}", "title": "" }, { "docid": "5ffca830dfe68f558835b90ecf2ce26b", "score": "0.5246173", "text": "func (p *NetworkVirtualAppliancesCreateOrUpdatePoller) Done() bool {\n\treturn p.pt.Done()\n}", "title": "" }, { "docid": "cb3aa1cac6c45dddbb831d8364298781", "score": "0.52452755", "text": "func (m *CheckListItemMutation) Checked() (r bool, exists bool) {\n\tv := m.checked\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "e2f1b7bdfb1227da87547042a434fa1e", "score": "0.52368784", "text": "func (c *ConsulBackend) runCheck(sealed bool) error {\n\t// Run a TTL check\n\tagent := c.client.Agent()\n\tif !sealed {\n\t\treturn agent.PassTTL(c.checkID(), \"Vault Unsealed\")\n\t} else {\n\t\treturn agent.FailTTL(c.checkID(), \"Vault Sealed\")\n\t}\n}", "title": "" }, { "docid": "47af363e4bb12a7a96428fd066208b81", "score": "0.5234418", "text": "func (wuo *WatchlistUpdateOne) check() error {\n\tif v, ok := wuo.mutation.Name(); ok {\n\t\tif err := watchlist.NameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"Name\", err: fmt.Errorf(\"ent: validator failed for field \\\"Name\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := wuo.mutation.TaxID(); ok {\n\t\tif err := watchlist.TaxIDValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"TaxID\", err: fmt.Errorf(\"ent: validator failed for field \\\"TaxID\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := wuo.mutation.UserUpload(); ok {\n\t\tif err := watchlist.UserUploadValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"UserUpload\", err: fmt.Errorf(\"ent: validator failed for field \\\"UserUpload\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b7cf34d9c7cfcd9ce4b4cb9103cdb5f4", "score": "0.5233939", "text": "func (c *TD) setPassed() {\n\tstatus := constants.Status{\n\t\tStatus: constants.StatusPass,\n\t\tLifecycle: c.currentLifecycle,\n\t\tFatal: false,\n\t}\n\tc.statuses = append(c.statuses, status)\n}", "title": "" }, { "docid": "c762b5404419b0f96c0f324b138c08f2", "score": "0.5233315", "text": "func (hdruo *HTTPDetectorResultUpdateOne) check() error {\n\tif v, ok := hdruo.mutation.Result(); ok {\n\t\tif err := httpdetectorresult.ResultValidator(int8(v)); err != nil {\n\t\t\treturn &ValidationError{Name: \"result\", err: fmt.Errorf(`ent: validator failed for field \"HTTPDetectorResult.result\": %w`, err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "44894155b954289be7a71ae8cea41780", "score": "0.5232828", "text": "func (smuo *StockManagerUpdateOne) check() error {\n\tif v, ok := smuo.mutation.SemaineA(); ok {\n\t\tif err := stockmanager.SemaineAValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"SemaineA\", err: fmt.Errorf(\"ent: validator failed for field \\\"SemaineA\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := smuo.mutation.SemaineB(); ok {\n\t\tif err := stockmanager.SemaineBValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"SemaineB\", err: fmt.Errorf(\"ent: validator failed for field \\\"SemaineB\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := smuo.mutation.SemaineC(); ok {\n\t\tif err := stockmanager.SemaineCValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"SemaineC\", err: fmt.Errorf(\"ent: validator failed for field \\\"SemaineC\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := smuo.mutation.SemaineD(); ok {\n\t\tif err := stockmanager.SemaineDValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"SemaineD\", err: fmt.Errorf(\"ent: validator failed for field \\\"SemaineD\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := smuo.mutation.SemaineE(); ok {\n\t\tif err := stockmanager.SemaineEValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"SemaineE\", err: fmt.Errorf(\"ent: validator failed for field \\\"SemaineE\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := smuo.mutation.SemaineF(); ok {\n\t\tif err := stockmanager.SemaineFValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"SemaineF\", err: fmt.Errorf(\"ent: validator failed for field \\\"SemaineF\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := smuo.mutation.SemaineG(); ok {\n\t\tif err := stockmanager.SemaineGValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"SemaineG\", err: fmt.Errorf(\"ent: validator failed for field \\\"SemaineG\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := smuo.mutation.SemaineH(); ok {\n\t\tif err := stockmanager.SemaineHValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"SemaineH\", err: fmt.Errorf(\"ent: validator failed for field \\\"SemaineH\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3642dfd7842f00340d2629306a5849db", "score": "0.52201813", "text": "func (siuo *SubItemUpdateOne) check() error {\n\tif v, ok := siuo.mutation.Name(); ok {\n\t\tif err := subitem.NameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"name\", err: fmt.Errorf(\"ent: validator failed for field \\\"name\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := siuo.mutation.Icon(); ok {\n\t\tif err := subitem.IconValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"icon\", err: fmt.Errorf(\"ent: validator failed for field \\\"icon\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := siuo.mutation.Link(); ok {\n\t\tif err := subitem.LinkValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"link\", err: fmt.Errorf(\"ent: validator failed for field \\\"link\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "cf462062dacad9a709b0ab3bbfa534a5", "score": "0.5217871", "text": "func (uuo *UserUpdateOne) check() error {\n\tif v, ok := uuo.mutation.Name(); ok {\n\t\tif err := user.NameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"name\", err: fmt.Errorf(`entv1: validator failed for field \"User.name\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := uuo.mutation.Blob(); ok {\n\t\tif err := user.BlobValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"blob\", err: fmt.Errorf(`entv1: validator failed for field \"User.blob\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := uuo.mutation.State(); ok {\n\t\tif err := user.StateValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"state\", err: fmt.Errorf(`entv1: validator failed for field \"User.state\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := uuo.mutation.Workplace(); ok {\n\t\tif err := user.WorkplaceValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"workplace\", err: fmt.Errorf(`entv1: validator failed for field \"User.workplace\": %w`, err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "998108e29262fa63179530c3b40ac89a", "score": "0.52138", "text": "func (s *MetaStore) Done(meta *checkMeta) {\n\ts.Lock()\n\tmeta.running = false\n\ts.Unlock()\n}", "title": "" }, { "docid": "fcec537dc64aca0b214a02d73614b12f", "score": "0.52133346", "text": "func (p *BackupInstancesClientValidateForRestorePoller) Done() bool {\n\treturn p.pt.Done()\n}", "title": "" }, { "docid": "f456259285dcf2bf3284c87cab5c5dcb", "score": "0.52115643", "text": "func (n *Loop) checkResult(result int) bool {\n\tif result > game.GameFinished {\n\t\tif result == game.Draw {\n\t\t\tn.GameResult = GameResultDraw\n\t\t} else if (result == game.Player1Win && n.firstPlayer == 0) ||\n\t\t\t(result == game.Player2Win && n.firstPlayer == 1) {\n\t\t\tn.GameResult = GameResultMeWin\n\t\t} else {\n\t\t\tn.GameResult = GameResultHeWin\n\t\t}\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "e80100abb7b0a1ff5f5a5382103c322b", "score": "0.5208406", "text": "func (s *Suite) checkEmpty() {\n\ts.c.Assert(s.q.Len(), check.Equals, 0)\n}", "title": "" }, { "docid": "82fc5a7216405f3fcce1ed77f3aab972", "score": "0.52042127", "text": "func (auo *AdminUpdateOne) check() error {\n\tif v, ok := auo.mutation.Email(); ok {\n\t\tif err := admin.EmailValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"email\", err: fmt.Errorf(\"ent: validator failed for field \\\"email\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := auo.mutation.Username(); ok {\n\t\tif err := admin.UsernameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"username\", err: fmt.Errorf(\"ent: validator failed for field \\\"username\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := auo.mutation.Password(); ok {\n\t\tif err := admin.PasswordValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"password\", err: fmt.Errorf(\"ent: validator failed for field \\\"password\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d48eefaf01f46f984dc61b05d5fc9fd2", "score": "0.5203636", "text": "func checkAll(sudoku *[9][9]int, x int, y int, value int) bool {\n\treturn checkSquare(sudoku, x, y, value) &&\n\t\tcheckRow(sudoku, x, y, value) &&\n\t\tcheckColumn(sudoku, x, y, value)\n}", "title": "" }, { "docid": "aa1542e87b348b3484bf3ac4cdc77790", "score": "0.51933396", "text": "func (m *Master) Done() bool {\n\tret := false\n\n\t// Your code here.\n\n\n\treturn ret\n}", "title": "" }, { "docid": "40fa2b3838a0a3cad51752c2d1165e01", "score": "0.5192531", "text": "func (ruo *RecruitmentUpdateOne) check() error {\n\tif v, ok := ruo.mutation.Title(); ok {\n\t\tif err := recruitment.TitleValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"title\", err: fmt.Errorf(\"ent: validator failed for field \\\"title\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := ruo.mutation.Content(); ok {\n\t\tif err := recruitment.ContentValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"content\", err: fmt.Errorf(\"ent: validator failed for field \\\"content\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" } ]
00410598bacaf9316b2c6b889aa96480
GoString 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": "645b13f0fbe2125510662c95a82cd757", "score": "0.0", "text": "func (s DeveloperUserAlreadyRegisteredException) GoString() string {\n\treturn s.String()\n}", "title": "" } ]
[ { "docid": "209f0ca319514f420a9b219d4e6407fc", "score": "0.61458313", "text": "func (s ApiPassthrough) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "27d311f685e6799a5346d860dceb8261", "score": "0.61399823", "text": "func (v *RPC) String() string {\n\tif v == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\tvar fields [10]string\n\ti := 0\n\tfields[i] = fmt.Sprintf(\"SpanContext: %v\", v.SpanContext)\n\ti++\n\tfields[i] = fmt.Sprintf(\"CallerName: %v\", v.CallerName)\n\ti++\n\tfields[i] = fmt.Sprintf(\"ServiceName: %v\", v.ServiceName)\n\ti++\n\tfields[i] = fmt.Sprintf(\"Encoding: %v\", v.Encoding)\n\ti++\n\tfields[i] = fmt.Sprintf(\"Procedure: %v\", v.Procedure)\n\ti++\n\tif v.Headers != nil {\n\t\tfields[i] = fmt.Sprintf(\"Headers: %v\", v.Headers)\n\t\ti++\n\t}\n\tif v.ShardKey != nil {\n\t\tfields[i] = fmt.Sprintf(\"ShardKey: %v\", *(v.ShardKey))\n\t\ti++\n\t}\n\tif v.RoutingKey != nil {\n\t\tfields[i] = fmt.Sprintf(\"RoutingKey: %v\", *(v.RoutingKey))\n\t\ti++\n\t}\n\tif v.RoutingDelegate != nil {\n\t\tfields[i] = fmt.Sprintf(\"RoutingDelegate: %v\", *(v.RoutingDelegate))\n\t\ti++\n\t}\n\tif v.Body != nil {\n\t\tfields[i] = fmt.Sprintf(\"Body: %v\", v.Body)\n\t\ti++\n\t}\n\n\treturn fmt.Sprintf(\"RPC{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" }, { "docid": "e0f5a58ecaf50ed33ec2a7c0afae36ed", "score": "0.6050917", "text": "func (p *Parameter) String() string {\n\tdata, _ := json.Marshal(p) //nolint:errchkjson // returns empty string on error\n\treturn string(data)\n}", "title": "" }, { "docid": "2e110f24163468aae67d3b2ae207c5b6", "score": "0.6043128", "text": "func (s Member) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "b4630d33b70c5844b5e64ade660963a3", "score": "0.59675694", "text": "func (s Member) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b4630d33b70c5844b5e64ade660963a3", "score": "0.59675694", "text": "func (s Member) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b4630d33b70c5844b5e64ade660963a3", "score": "0.59675694", "text": "func (s Member) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b4630d33b70c5844b5e64ade660963a3", "score": "0.59675694", "text": "func (s Member) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b4630d33b70c5844b5e64ade660963a3", "score": "0.5967411", "text": "func (s Member) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b4630d33b70c5844b5e64ade660963a3", "score": "0.596564", "text": "func (s Member) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "41112ccec69ed7e5695800fb71ff6fea", "score": "0.592005", "text": "func (rp RequestParam) String() string {\n\treturn rp.name + \":\" + rp.value\n}", "title": "" }, { "docid": "accd4137f896762440eab638351d91b7", "score": "0.5900242", "text": "func (s ExtraParam) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d95172027cde329e808e45600a7c3aeb", "score": "0.58919257", "text": "func (p *Param) String() string {\n\tif p.Name != \"\" {\n\t\treturn fmt.Sprintf(\"%v[name=%v]\", p.Type.String(), p.Name)\n\t}\n\treturn p.Type.String()\n}", "title": "" }, { "docid": "0283ad9a395e675fe0a9ec712bceb034", "score": "0.5864879", "text": "func (s RequestParametersStruct) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "7422e92ddcee98e4ae227fd7e12e513f", "score": "0.5858062", "text": "func (s GroupMember) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "0cac5cf7ba8a7cfec01584f819c0b895", "score": "0.5850525", "text": "func (cwm ClanWarMember) String() string {\n\tb, _ := json.Marshal(cwm)\n\treturn string(b)\n}", "title": "" }, { "docid": "796d3da09122d3a6eda8d85cd2072b9e", "score": "0.5781972", "text": "func (s GetMemberOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "796d3da09122d3a6eda8d85cd2072b9e", "score": "0.5781169", "text": "func (s GetMemberOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "db46495338ceb36924c9a961792081f1", "score": "0.5764946", "text": "func (s Parameter) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "6c58d1f8601f0c53d043a6c6c5dc49da", "score": "0.5751309", "text": "func layerString(v reflect.Value, anonymous bool, writeSpace bool) string {\n\t// Let String() functions take precedence.\n\tif v.CanInterface() {\n\t\tif s, ok := v.Interface().(fmt.Stringer); ok {\n\t\t\treturn s.String()\n\t\t}\n\t}\n\t// Reflect, and spit out all the exported fields as key=value.\n\tswitch v.Type().Kind() {\n\tcase reflect.Interface, reflect.Ptr:\n\t\tif v.IsNil() {\n\t\t\treturn \"nil\"\n\t\t}\n\t\tr := v.Elem()\n\t\treturn layerString(r, anonymous, writeSpace)\n\tcase reflect.Struct:\n\t\tvar b bytes.Buffer\n\t\ttyp := v.Type()\n\t\tif !anonymous {\n\t\t\tb.WriteByte('{')\n\t\t}\n\t\tfor i := 0; i < v.NumField(); i++ {\n\t\t\t// Check if this is upper-case.\n\t\t\tftype := typ.Field(i)\n\t\t\tf := v.Field(i)\n\t\t\tif ftype.Anonymous {\n\t\t\t\tanonStr := layerString(f, true, writeSpace)\n\t\t\t\twriteSpace = writeSpace || anonStr != \"\"\n\t\t\t\tb.WriteString(anonStr)\n\t\t\t} else if ftype.PkgPath == \"\" { // exported\n\t\t\t\tif writeSpace {\n\t\t\t\t\tb.WriteByte(' ')\n\t\t\t\t}\n\t\t\t\twriteSpace = true\n\t\t\t\tfmt.Fprintf(&b, \"%s=%s\", typ.Field(i).Name, layerString(f, false, writeSpace))\n\t\t\t}\n\t\t}\n\t\tif !anonymous {\n\t\t\tb.WriteByte('}')\n\t\t}\n\t\treturn b.String()\n\tcase reflect.Slice:\n\t\tvar b bytes.Buffer\n\t\tb.WriteByte('[')\n\t\tif v.Len() > 4 {\n\t\t\tfmt.Fprintf(&b, \"..%d..\", v.Len())\n\t\t} else {\n\t\t\tfor j := 0; j < v.Len(); j++ {\n\t\t\t\tif j != 0 {\n\t\t\t\t\tb.WriteString(\", \")\n\t\t\t\t}\n\t\t\t\tb.WriteString(layerString(v.Index(j), false, false))\n\t\t\t}\n\t\t}\n\t\tb.WriteByte(']')\n\t\treturn b.String()\n\t}\n\treturn fmt.Sprintf(\"%v\", v.Interface())\n}", "title": "" }, { "docid": "faa3a6df557dd556d32df74f6fe9e1da", "score": "0.5732514", "text": "func StructToString(si interface{}) string {\n\trval := reflect.ValueOf(si).Elem()\n\ttipe := rval.Type()\n\tvar buffer bytes.Buffer\n\tbuffer.WriteString(\"{ \")\n\tfor i := 0; i < rval.NumField(); i++ {\n\t\ttf := tipe.Field(i)\n\t\tif !rval.FieldByName(tf.Name).CanSet() {\n\t\t\tcontinue // skip unexported fields\n\t\t}\n\t\tvar fStr string\n\t\ttagv := tf.Tag.Get(SecretTag)\n\t\tif tagv == \"password\" || tagv == \"username\" {\n\t\t\tfStr = fmt.Sprintf(\"%s:**** \", tf.Name)\n\t\t} else if tagv == \"url\" {\n\t\t\tval, ok := rval.Field(i).Interface().(string)\n\t\t\tif ok {\n\t\t\t\tval = GetMaskedURL(val)\n\t\t\t\tfStr = fmt.Sprintf(\"%s:%v \", tf.Name, val)\n\t\t\t} else {\n\t\t\t\tfStr = fmt.Sprintf(\"%s:%v \", tf.Name, rval.Field(i).Interface())\n\t\t\t}\n\t\t} else {\n\t\t\tfStr = fmt.Sprintf(\"%s:%v \", tf.Name, rval.Field(i).Interface())\n\t\t}\n\t\tbuffer.WriteString(fStr)\n\t}\n\tbuffer.WriteString(\" }\")\n\treturn buffer.String()\n}", "title": "" }, { "docid": "d882e5469cada469c07e60688de9f546", "score": "0.57310915", "text": "func (o *Developmentactivityaggregateparam) String() string {\n \n o.Metrics = []string{\"\"} \n o.GroupBy = []string{\"\"} \n \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "title": "" }, { "docid": "c5c771591673c2eea53ccd63b246b1b0", "score": "0.56828064", "text": "func (rp *Params) String(name string, value string, usage string) *string {\n\tif rp.fset == nil {\n\t\trp.fset = flag.NewFlagSet(\"anonymous\", flag.ExitOnError) // both args are unused.\n\t}\n\tp := new(string)\n\trp.fset.StringVar(p, name, value, usage)\n\treturn p\n}", "title": "" }, { "docid": "5cfbfb73e613c5fbc899afb26c99fb8b", "score": "0.5672333", "text": "func (o VserverGetRequestDesiredAttributes) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "4872527d47e2548d9def20083f60dcdb", "score": "0.56713414", "text": "func (o VserverGetRequest) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "85ce395912b475acdf3ad6330161a646", "score": "0.5670845", "text": "func (s ParameterNameValue) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "21b76ca7f7f0d64b84d5a5e4aa7bcffb", "score": "0.5662141", "text": "func (p Params) String() string {\n\tvar sb strings.Builder\n\tsb.WriteString(\"Params:\")\n\tsb.WriteString(fmt.Sprintf(\"TokenCacheSize:%v\\t\", p.TokenCacheSize))\n\tsb.WriteString(fmt.Sprintf(\"NewTokenFee:%v\\t\", p.NewTokenFee))\n\tsb.WriteString(fmt.Sprintf(\"ReservedSymbols:%s\\t\", strings.Join(p.ReservedSymbols, \",\")))\n\n\treturn sb.String()\n}", "title": "" }, { "docid": "74841839d2e20d32eda2604b690f38eb", "score": "0.5657828", "text": "func (s CreateMemberOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "9a2a32846e9d15057aac9e2f35e87213", "score": "0.5631596", "text": "func String(name, val string) Field {\n\treturn Field(zap.String(name, val))\n}", "title": "" }, { "docid": "ac25f3f6aea8da056068a0cf09489b4d", "score": "0.5611324", "text": "func (s DBParameterGroup) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "be5fe10413aca4c98011d6d93dfe98a4", "score": "0.560954", "text": "func (s GetMemberInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "be5fe10413aca4c98011d6d93dfe98a4", "score": "0.56094545", "text": "func (s GetMemberInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d9ee2b223b7036b0844ac2370527fbfe", "score": "0.55998653", "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": "5c518cab9a26cf655d1488d854d900db", "score": "0.5580231", "text": "func (s ApiCallDetails) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "ef0d371c5fc2163aaad4e4044a4ec646", "score": "0.5564703", "text": "func (a arg) String() string {\n\tswitch {\n\tcase a.plainText:\n\t\treturn combineKeyValue(a.key, a.value)\n\tdefault:\n\t\treturn combineKeyValue(a.key, argRedacted)\n\t}\n}", "title": "" }, { "docid": "1b1b87fc2777c2421db74b56907cfd22", "score": "0.55624074", "text": "func (o ExportPolicyGetRequestDesiredAttributes) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "a69e6d3c524cf7323692232ce1f978d0", "score": "0.5531993", "text": "func (o ExportPolicyGetRequest) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "4039a7529822df0c9338110f99a8d8d3", "score": "0.5529914", "text": "func (s ProcessorParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3ffc25a4edc5ca7652c4750de89130eb", "score": "0.55213726", "text": "func (s Parameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3ffc25a4edc5ca7652c4750de89130eb", "score": "0.55213726", "text": "func (s Parameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "24f0bfea8419e1d9c7653157a829aa39", "score": "0.5520648", "text": "func (op PipelineOp) String() string {\n\ts := make([]byte, 0, 32)\n\ts = append(s, \"get field \"...)\n\ts = strconv.AppendInt(s, int64(op.Field), 10)\n\tif op.DefaultValue == nil {\n\t\treturn string(s)\n\t}\n\ts = append(s, \" with default\"...)\n\treturn string(s)\n}", "title": "" }, { "docid": "24f0bfea8419e1d9c7653157a829aa39", "score": "0.5520648", "text": "func (op PipelineOp) String() string {\n\ts := make([]byte, 0, 32)\n\ts = append(s, \"get field \"...)\n\ts = strconv.AppendInt(s, int64(op.Field), 10)\n\tif op.DefaultValue == nil {\n\t\treturn string(s)\n\t}\n\ts = append(s, \" with default\"...)\n\treturn string(s)\n}", "title": "" }, { "docid": "724ad565afd14fd20d58dfce8e46b8ee", "score": "0.5503744", "text": "func String() string {\n\treturn fmt.Sprintf(\"%s %v Protocol %s %s\", Name, Version, ProtocolCompat, Additional)\n}", "title": "" }, { "docid": "fea6b1db8f7c88035ae711e8ab461794", "score": "0.54908603", "text": "func (s OriginGroupMember) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "c5ac32b50515a01e38f8086951fb488b", "score": "0.5475584", "text": "func (s CreateMemberInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "c636ce7d494602bf2b03d1557a31bcd2", "score": "0.54721165", "text": "func (p paramHeader) String() string {\n\treturn fmt.Sprintf(\"%s (%d): %s\", p.typ, p.len, hex.Dump(p.raw))\n}", "title": "" }, { "docid": "e08907aa8e2343abbd146a2fa2d11ddd", "score": "0.54713625", "text": "func (v *Bar_ArgNotStruct_Args) String() string {\n\tif v == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\tvar fields [1]string\n\ti := 0\n\tfields[i] = fmt.Sprintf(\"Request: %v\", v.Request)\n\ti++\n\n\treturn fmt.Sprintf(\"Bar_ArgNotStruct_Args{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" }, { "docid": "13fb8b2fa4c59192693dc487a49af6d4", "score": "0.5468962", "text": "func (p *Params) String() string {\n\tif p == nil {\n\t\treturn \"clip.Params(nil)\"\n\t}\n\tpt := reflect.TypeOf(p).Elem()\n\tpv := reflect.ValueOf(p).Elem()\n\tfcnt := pt.NumField()\n\tsb := strings.Builder{}\n\tsb.WriteString(\"clip.Params{ \")\n\tfor i := 0; i < fcnt; i++ {\n\t\tfld := pv.Field(i)\n\t\tif fld.IsNil() {\n\t\t\tcontinue\n\t\t}\n\t\tsb.WriteString(fmt.Sprintf(\"%s: %v; \", pt.Field(i).Name,\n\t\t\tfld.Elem().Interface()))\n\t}\n\tsb.WriteString(\"}\")\n\treturn sb.String()\n}", "title": "" }, { "docid": "b05fbb366f216fce0c964268232cf3bc", "score": "0.5463794", "text": "func (a Access) String() string {\n\t// Call Access' methods that take non arguments & return Access\n\t// if value == 0, return symbol/method that returns 0\n\t// Else, skip any method/symbol that returns 0;\n\t// append to string any method where return value & f == method's return value\n\t// return string\n\treturn enum.StringUintFlags(uint64(a), reflect.TypeOf(a), 16)\n}", "title": "" }, { "docid": "70654039945d2320f4eee3aa3a793d94", "score": "0.5461837", "text": "func (s KeyValuePair) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "70654039945d2320f4eee3aa3a793d94", "score": "0.54614043", "text": "func (s KeyValuePair) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "8652251f99cffbd32be4152d2d6a2ee9", "score": "0.5459905", "text": "func (p Params) String() string {\n\treturn fmt.Sprintf(`Coinswap Params:\n Fee:\t\t\t%s`, p.Fee.String(),\n\t)\n}", "title": "" }, { "docid": "3604a1d12813ce519872a998508d98c7", "score": "0.5449749", "text": "func (s GetMembersOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "92a42c204b0d48b7c0acfb1a1f415652", "score": "0.5445596", "text": "func (v ParamType) String() string {\n\tswitch v {\n\tcase ParamBody:\n\t\treturn \"body\"\n\tcase ParamParam:\n\t\treturn \"param\"\n\tcase ParamQuery:\n\t\treturn \"query\"\n\tcase ParamHeader:\n\t\treturn \"header\"\n\tcase ParamCookie:\n\t\treturn \"cookie\"\n\tcase ParamOneOf:\n\t\treturn \"oneOf\"\n\t}\n\treturn \"unknown\"\n}", "title": "" }, { "docid": "b5a12a6a081cfefe02aee76eec1bc881", "score": "0.5424019", "text": "func (s *Stat) String() string {\n\t// Print the name of the field along with value\n\treturn fmt.Sprintf(\"%+v\\n\", *s)\n}", "title": "" }, { "docid": "f4397312255b855d2bde494480875637", "score": "0.54204047", "text": "func String(key, value string) Field {\n\treturn zap.String(key, value)\n}", "title": "" }, { "docid": "21276484502155cbb2691f6fe52781ba", "score": "0.5412922", "text": "func (v Value) DebugString() string {\n\tswitch v.Type {\n\tcase bsontype.String:\n\t\tstr, ok := v.StringValueOK()\n\t\tif !ok {\n\t\t\treturn \"<malformed>\"\n\t\t}\n\t\treturn escapeString(str)\n\tcase bsontype.EmbeddedDocument:\n\t\tdoc, ok := v.DocumentOK()\n\t\tif !ok {\n\t\t\treturn \"<malformed>\"\n\t\t}\n\t\treturn doc.DebugString()\n\tcase bsontype.Array:\n\t\tarr, ok := v.ArrayOK()\n\t\tif !ok {\n\t\t\treturn \"<malformed>\"\n\t\t}\n\t\treturn arr.DebugString()\n\tcase bsontype.CodeWithScope:\n\t\tcode, scope, ok := v.CodeWithScopeOK()\n\t\tif !ok {\n\t\t\treturn \"\"\n\t\t}\n\t\treturn fmt.Sprintf(`{\"$code\":%s,\"$scope\":%s}`, code, scope.DebugString())\n\tdefault:\n\t\tstr := v.String()\n\t\tif str == \"\" {\n\t\t\treturn \"<malformed>\"\n\t\t}\n\t\treturn str\n\t}\n}", "title": "" }, { "docid": "0d6b867220b19e47e11b2823a3518237", "score": "0.5411409", "text": "func (r Reflection) String() string {\n\tswitch r {\n\tdefault:\n\t\tfallthrough\n\tcase ReflectionNormal:\n\t\treturn \"normal\"\n\tcase ReflectionX:\n\t\treturn \"x\"\n\tcase ReflectionY:\n\t\treturn \"y\"\n\t}\n}", "title": "" }, { "docid": "97a3e0ab0ec36bc8a67461db50075009", "score": "0.54078275", "text": "func (o NvmeRevertAnagrpidsRequest) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "a5801cfa047fa37eeeee06eeee90ad7f", "score": "0.5407229", "text": "func (mem *Member) String() string {\n\tstringGenes := make([]string, len(mem.Genes))\n\tfor i, v := range mem.Genes {\n\t\tstringGenes[i] = v.String()\n\t}\n\treturn fmt.Sprintf(\"Member:\\t(fitness: %d)\\n\\t%s\", mem.GetFitness(), strings.Join(stringGenes, \"\\n\\t\"))\n}", "title": "" }, { "docid": "b09c49d422f61e9129da7177ef187e07", "score": "0.5405612", "text": "func (s BaiduChannelRequest) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "2dfe657e573ecf06637fc2e4e700b49f", "score": "0.54016185", "text": "func String(v interface{}) string {\n\treturn StringWithOptions(v, nil)\n}", "title": "" }, { "docid": "9c66cccdde8c717e9a130db2918369c1", "score": "0.5386975", "text": "func (s ParameterStringFilter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "e7847f33e4d1d7a24590c684af7420f8", "score": "0.53860146", "text": "func (s APNSVoipChannelRequest) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "7fa9ae680372df047f172b65f4ed06b4", "score": "0.53836364", "text": "func (s ApiKey) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3107f91e219fa3fda8ed8349a56d77e6", "score": "0.5381751", "text": "func (p Params) String() string {\n\tvar sb strings.Builder\n\tsb.WriteString(\"Params: \\n\")\n\tsb.WriteString(fmt.Sprintf(\"PeggyID: %d\\n\", p.PeggyID))\n\tsb.WriteString(fmt.Sprintf(\"ContractHash: %d\\n\", p.ContractHash))\n\tsb.WriteString(fmt.Sprintf(\"StartBlock: %d\\n\", p.StartBlock))\n\treturn sb.String()\n}", "title": "" }, { "docid": "11a4e7851f5e03cc5470dce5aef81d39", "score": "0.5361241", "text": "func (s GetMembersInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "73c0cab2005d31098ef74dae88190f1f", "score": "0.5358429", "text": "func (s CreateMembersOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "73c0cab2005d31098ef74dae88190f1f", "score": "0.5358429", "text": "func (s CreateMembersOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "cc960b69484075f7d705c86497200ee5", "score": "0.5356622", "text": "func (s VoiceChannelRequest) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "c471264197302747595829b207344448", "score": "0.5347845", "text": "func PrettyString(v interface{}) string { return strutil.PrettyString(v, \"\", \"\", printHooks) }", "title": "" }, { "docid": "698af678258fa8512793cfde326e693f", "score": "0.5335963", "text": "func (s AccessMethod) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "27eb86d558a96611ff54c833faea7d98", "score": "0.53352946", "text": "func (s JsonFormatDescriptor) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b13f7e7e8df055f5f561869612c77e6b", "score": "0.5331431", "text": "func primitiveToString(param reflect.Value) string {\n\n\tvar value string\n\n\tswitch param.Kind() {\n\tcase reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:\n\t\tfallthrough\n\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\t\tvalue = fmt.Sprintf(\"%d\", param.Interface())\n\tcase reflect.Float64:\n\t\tvalue = strconv.FormatFloat(param.Interface().(float64), 'f', -1, 64)\n\tcase reflect.Float32:\n\t\tvalue = strconv.FormatFloat(float64(param.Interface().(float32)), 'f', -1, 32)\n\tcase reflect.String:\n\t\tvalue = fmt.Sprintf(\"%s\", param.Interface())\n\tcase reflect.Bool:\n\t\tvalue = fmt.Sprintf(\"%t\", param.Interface())\n\t}\n\n\treturn value\n}", "title": "" }, { "docid": "8d6355121c22a97fa6189cd1c641837f", "score": "0.5328872", "text": "func (p Params) String() string {\n\tvar sb strings.Builder\n\tsb.WriteString(\"Params: \\n\")\n\tsb.WriteString(fmt.Sprintf(\"DexListFee:%s\\n\", p.ListFee))\n\t//sb.WriteString(fmt.Sprintf(\"DexDelistFee:%s\\n\", p.DelistFee))\n\tsb.WriteString(fmt.Sprintf(\"TransferOwnershipFee:%s\\n\", p.TransferOwnershipFee))\n\tsb.WriteString(fmt.Sprintf(\"DelistMaxDepositPeriod:%s\\n\", p.DelistMaxDepositPeriod))\n\tsb.WriteString(fmt.Sprintf(\"DelistMinDeposit:%s\\n\", p.DelistMinDeposit))\n\tsb.WriteString(fmt.Sprintf(\"DelistVotingPeriod:%s\\n\", p.DelistMaxDepositPeriod))\n\tsb.WriteString(fmt.Sprintf(\"WithdrawPeriod:%d\\n\", p.WithdrawPeriod))\n\treturn sb.String()\n}", "title": "" }, { "docid": "3d190d1152af6172b7350972bdbe6848", "score": "0.5328189", "text": "func (p Params) String() string {\n\treturn fmt.Sprintf(`Params:\t\n\tMinters:\t\t\t%s\t\n\t`, p.Minters)\n}", "title": "" }, { "docid": "c995e62e6e2883149cb03d65ea13e7a5", "score": "0.53231853", "text": "func (p Params) String() string {\n\tvar sb strings.Builder\n\tsb.WriteString(\"Params: \\n\")\n\tsb.WriteString(fmt.Sprintf(\"GasPriceThreshold: %d\\n\", p.GasPriceThreshold))\n\tsb.WriteString(fmt.Sprintf(\"MaxMemoCharacters: %d\\n\", p.MaxMemoCharacters))\n\tsb.WriteString(fmt.Sprintf(\"TxSigLimit: %d\\n\", p.TxSigLimit))\n\t// sb.WriteString(fmt.Sprintf(\"TxSizeLimit: %d\\n\", p.TxSizeLimit))\n\tsb.WriteString(fmt.Sprintf(\"TxSizeCostPerByte: %d\\n\", p.TxSizeCostPerByte))\n\tsb.WriteString(fmt.Sprintf(\"SigVerifyCostED25519: %d\\n\", p.SigVerifyCostED25519))\n\tsb.WriteString(fmt.Sprintf(\"SigVerifyCostSecp256k1: %d\\n\", p.SigVerifyCostSecp256k1))\n\treturn sb.String()\n}", "title": "" }, { "docid": "90dc582744a0e2d72e7b9ef44b3e2283", "score": "0.53172654", "text": "func (f *Field) String() string {\n\treturn f.structField.String()\n}", "title": "" }, { "docid": "ebdcc76f17cd3c38330ad527a496f690", "score": "0.5312014", "text": "func (g GoStructCodeSnippet) String() string {\n\tvar b strings.Builder\n\tfor _, s := range []string{g.StructDef, g.ListKeys, g.Methods, g.Interfaces} {\n\t\tgenutil.WriteIfNotEmpty(&b, s)\n\t}\n\treturn b.String()\n}", "title": "" }, { "docid": "1d4e7d34766971f14676e1ed1bb0333d", "score": "0.53084135", "text": "func (s DocumentParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "660b6219c36433957afa564a2fd989f0", "score": "0.5298155", "text": "func (s OptionGroupMembership) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "bd3f578f09775f81dc01a514848b968f", "score": "0.5296998", "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}\n\treturn strings.Join(lines, \"\\n\")\n}", "title": "" }, { "docid": "e2e6447ffd70384dca6332c69c8ffdd5", "score": "0.52969974", "text": "func String(v interface{}) string {\n\tswitch s := v.(type) {\n\tcase string:\n\t\treturn s\n\tcase fmt.Stringer:\n\t\treturn s.String()\n\tdefault:\n\t\tb, _ := json.Marshal(v)\n\t\treturn string(b)\n\t}\n}", "title": "" }, { "docid": "ac1c21d007834c43d2cb656180567cef", "score": "0.5291461", "text": "func AddString(name string, value string, usage string, required bool, options ...Options) {\n\tdefaultParams.collection[name] = Parameter{\n\t\tName: name,\n\t\tDefaultValue: value,\n\t\tUsage: usage,\n\t\tRequired: required,\n\t\tOptions: parseOptions(options),\n\t\tvalueType: stringType,\n\t}\n\n\tflags.String(name, value, usage)\n}", "title": "" }, { "docid": "08be22a6aa099137c971bacc14704903", "score": "0.52909076", "text": "func (sf *StructField) String() (string, bool) {\n\tif sf.IsExist {\n\t\treturn cast.ToString(sf.FieldValue.Interface()), sf.IsExist\n\t}\n\treturn \"\", sf.IsExist\n}", "title": "" }, { "docid": "9582627c49d042aa550858f13d5db2d5", "score": "0.5288562", "text": "func (sf *UtilStringFlag) String() string {\n\treturn sf.val\n}", "title": "" }, { "docid": "3f9b199981a4e1345a0566bee40b0dc9", "score": "0.5275647", "text": "func (g Feature) String() string {\n\treturn g.JSON()\n}", "title": "" }, { "docid": "bdd064e8e8ae04be0f9fb22e3ae855ad", "score": "0.52699804", "text": "func (s ExportApiInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "ff5e36164a3ac20a1c3e997ce41e15b4", "score": "0.52629125", "text": "func (f Method) String() string {\n\treturn fmt.Sprintf(\"Name: %s (params: %s) (results: %s)\", f.Name, f.Params, f.Results)\n}", "title": "" }, { "docid": "e969d39e059652b06afea12a2ed7c337", "score": "0.52600634", "text": "func (s ParameterGroup) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "12464d698c01cb5597d16be5802fc720", "score": "0.5257896", "text": "func (s ApiKeyFilter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "05ea32beea84864b4180f553f66334ae", "score": "0.52540475", "text": "func (s ExportApiOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "f2131126c53ce9d241ade65d4c0e8c8c", "score": "0.5252743", "text": "func (v Verb) String() string {\n\treturn \"%\" + v.flags + v.verb\n}", "title": "" }, { "docid": "b842e2fdbe68d089a489cdc5bec6248b", "score": "0.5251404", "text": "func (s Member) GoString() string {\n\treturn s.String()\n}", "title": "" }, { "docid": "b842e2fdbe68d089a489cdc5bec6248b", "score": "0.5251404", "text": "func (s Member) GoString() string {\n\treturn s.String()\n}", "title": "" }, { "docid": "b842e2fdbe68d089a489cdc5bec6248b", "score": "0.5251404", "text": "func (s Member) GoString() string {\n\treturn s.String()\n}", "title": "" }, { "docid": "b842e2fdbe68d089a489cdc5bec6248b", "score": "0.5251404", "text": "func (s Member) GoString() string {\n\treturn s.String()\n}", "title": "" }, { "docid": "03900f1e47c2d3d3089d034abfdbcda0", "score": "0.5249868", "text": "func (p Params) String() string {\n\tbz, err := yaml.Marshal(p)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn string(bz)\n}", "title": "" }, { "docid": "b51061d65495b779a4e1e06403b3e5d8", "score": "0.52491313", "text": "func (o *Effectiveconfiguration) String() string {\n o.Properties = map[string]interface{}{\"\": Interface{}} \n o.Advanced = map[string]interface{}{\"\": Interface{}} \n \n \n o.Credentials = map[string]Credentialinfo{\"\": {}} \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "title": "" }, { "docid": "ada2d7931044ae1a7b9b5a5b7a3d011d", "score": "0.5238143", "text": "func (ed *ExposeDefinition) String() string {\n\t// A string map is reliable enough for our case, as the JSON implementation\n\t// takes care of the order of the provided fields. See\n\t// http://play.golang.org/p/U8nDgdga2X\n\tm := map[string]string{\n\t\t\"port\": ed.Port.String(),\n\t\t\"component\": ed.Component.String(),\n\t\t\"target_port\": ed.TargetPort.String(),\n\t}\n\n\traw, err := json.Marshal(m)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"%#v\\n\", mask(err)))\n\t}\n\n\treturn string(raw)\n}", "title": "" }, { "docid": "79f79cadd28fa45a671401aa7685c540", "score": "0.52372444", "text": "func (s GetParameterOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" } ]
15709b96cb015ee91848a7812e06f89e
Assert that a conflict is truly gone when DropJobConflicts is called
[ { "docid": "072edb2ae84da5826ef540a8313ae4a4", "score": "0.7567719", "text": "func TestHasConflictDropped(t *testing.T) {\n\tstate := NewState()\n\tstate.TrackJobConflicts(\"a\", []string{\"b\"})\n\n\tmatched, name := state.HasConflict(\"b\", []string{})\n\tif !matched || name != \"a\" {\n\t\tt.Errorf(\"Expected conflict with 'a'\")\n\t}\n\n\tstate.DropJobConflicts(\"a\")\n\tmatched, _ = state.HasConflict(\"b\", []string{})\n\tif matched {\n\t\tt.Errorf(\"Expected no conflict\")\n\t}\n}", "title": "" } ]
[ { "docid": "f6a225268385a9ff636f435195724ffb", "score": "0.6670326", "text": "func TestHasConflictPotentialMatch(t *testing.T) {\n\tstate := NewState()\n\tstate.TrackJobConflicts(\"a\", []string{})\n\n\tmatched, name := state.HasConflict(\"b\", []string{\"a\"})\n\tif !matched || name != \"a\" {\n\t\tt.Errorf(\"Expected conflict with 'a'\")\n\t}\n}", "title": "" }, { "docid": "7411bab5cac42138d8472e0fb832ed23", "score": "0.63937193", "text": "func TestHasConflictNoMatch(t *testing.T) {\n\tstate := NewState()\n\tstate.TrackJobConflicts(\"a\", []string{\"b\"})\n\n\tmatched, _ := state.HasConflict(\"c\", []string{\"d\"})\n\tif matched {\n\t\tt.Errorf(\"Expected no match\")\n\t}\n}", "title": "" }, { "docid": "9fba15cb69740367f6a9789a5b3cc031", "score": "0.637646", "text": "func TestHasConflictExistingMatch(t *testing.T) {\n\tstate := NewState()\n\tstate.TrackJobConflicts(\"a\", []string{\"b\"})\n\n\tmatched, name := state.HasConflict(\"b\", []string{})\n\tif !matched || name != \"a\" {\n\t\tt.Errorf(\"Expected conflict with 'a'\")\n\t}\n}", "title": "" }, { "docid": "2b723a06df6be6a8d6545164d093d6ae", "score": "0.61961716", "text": "func TestCancelJobWriteConflict(t *testing.T) {\n\tstore, dom := testkit.CreateMockStoreAndDomainWithSchemaLease(t, dbTestLease)\n\n\ttk1 := testkit.NewTestKit(t, store)\n\ttk2 := testkit.NewTestKit(t, store)\n\n\ttk1.MustExec(\"use test\")\n\n\ttk1.MustExec(\"create table t(id int)\")\n\n\tvar cancelErr error\n\tvar rs []sqlexec.RecordSet\n\thook := &callback.TestDDLCallback{Do: dom}\n\td := dom.DDL()\n\toriginalHook := d.GetHook()\n\td.SetHook(hook)\n\tdefer d.SetHook(originalHook)\n\n\t// Test when cancelling cannot be retried and adding index succeeds.\n\thook.OnJobRunBeforeExported = func(job *model.Job) {\n\t\tif job.Type == model.ActionAddIndex && job.State == model.JobStateRunning && job.SchemaState == model.StateWriteReorganization {\n\t\t\trequire.NoError(t, failpoint.Enable(\"github.com/pingcap/tidb/kv/mockCommitErrorInNewTxn\", `return(\"no_retry\")`))\n\t\t\tdefer func() { require.NoError(t, failpoint.Disable(\"github.com/pingcap/tidb/kv/mockCommitErrorInNewTxn\")) }()\n\t\t\trequire.NoError(t, failpoint.Enable(\"github.com/pingcap/tidb/ddl/mockFailedCommandOnConcurencyDDL\", `return(true)`))\n\t\t\tdefer func() {\n\t\t\t\trequire.NoError(t, failpoint.Disable(\"github.com/pingcap/tidb/ddl/mockFailedCommandOnConcurencyDDL\"))\n\t\t\t}()\n\n\t\t\tstmt := fmt.Sprintf(\"admin cancel ddl jobs %d\", job.ID)\n\t\t\trs, cancelErr = tk2.Session().Execute(context.Background(), stmt)\n\t\t}\n\t}\n\ttk1.MustExec(\"alter table t add index (id)\")\n\trequire.EqualError(t, cancelErr, \"mock failed admin command on ddl jobs\")\n\n\t// Test when cancelling is retried only once and adding index is cancelled in the end.\n\tvar jobID int64\n\thook.OnJobRunBeforeExported = func(job *model.Job) {\n\t\tif job.Type == model.ActionAddIndex && job.State == model.JobStateRunning && job.SchemaState == model.StateWriteReorganization {\n\t\t\tjobID = job.ID\n\t\t\tstmt := fmt.Sprintf(\"admin cancel ddl jobs %d\", job.ID)\n\t\t\trequire.NoError(t, failpoint.Enable(\"github.com/pingcap/tidb/kv/mockCommitErrorInNewTxn\", `return(\"retry_once\")`))\n\t\t\tdefer func() { require.NoError(t, failpoint.Disable(\"github.com/pingcap/tidb/kv/mockCommitErrorInNewTxn\")) }()\n\t\t\trs, cancelErr = tk2.Session().Execute(context.Background(), stmt)\n\t\t}\n\t}\n\ttk1.MustGetErrCode(\"alter table t add index (id)\", errno.ErrCancelledDDLJob)\n\trequire.NoError(t, cancelErr)\n\tresult := tk2.ResultSetToResultWithCtx(context.Background(), rs[0], \"cancel ddl job fails\")\n\tresult.Check(testkit.Rows(fmt.Sprintf(\"%d successful\", jobID)))\n}", "title": "" }, { "docid": "5caaccc4bca941cd081f4f4c287686f0", "score": "0.57204", "text": "func (srv *Service) isJobDeletable(projectSpec models.ProjectSpec, jobSpec models.JobSpec) error {\n\t// check if this job spec is dependency of any other job spec\n\tprojectJobSpecRepo := srv.projectJobSpecRepoFactory.New(projectSpec)\n\tdepsResolvedJobSpecs, err := srv.GetDependencyResolvedSpecs(projectSpec, projectJobSpecRepo, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, resolvedJobSpec := range depsResolvedJobSpecs {\n\t\tfor depJobSpecName := range resolvedJobSpec.Dependencies {\n\t\t\tif depJobSpecName == jobSpec.Name {\n\t\t\t\treturn errors.Errorf(\"cannot delete job %s since it's dependency of job %s\", jobSpec.Name,\n\t\t\t\t\tresolvedJobSpec.Name)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d4fdef9dd4a1853a96642ac491b1e26f", "score": "0.5636179", "text": "func TestDropPeersJob(t *testing.T) {\n\tstate := NewState()\n\tstate.TrackJobPeers(\"a\", []string{\"b\", \"c\"})\n\tstate.TrackJobPeers(\"d\", []string{\"c\"})\n\tstate.DropPeersJob(\"a\")\n\n\tpeers := state.GetJobsByPeer(\"c\")\n\tif len(peers) != 1 || peers[0] != \"d\" {\n\t\tt.Fatalf(\"Unexpected index of job peers %v\", peers)\n\t}\n}", "title": "" }, { "docid": "3fe6a013d2bfdd0c5d53d50d937336f5", "score": "0.55970407", "text": "func (w *deploymentWatcher) shouldFail() (fail, rollback bool, err error) {\n\tsnap, err := w.state.Snapshot()\n\tif err != nil {\n\t\treturn false, false, err\n\t}\n\n\td, err := snap.DeploymentByID(nil, w.deploymentID)\n\tif err != nil {\n\t\treturn false, false, err\n\t}\n\tif d == nil {\n\t\t// The deployment wasn't in the state store, possibly due to a system gc\n\t\treturn false, false, fmt.Errorf(\"deployment id not found: %q\", w.deploymentID)\n\t}\n\n\tfail = false\n\tfor tg, dstate := range d.TaskGroups {\n\t\t// If we are in a canary state we fail if there aren't enough healthy\n\t\t// allocs to satisfy DesiredCanaries\n\t\tif dstate.DesiredCanaries > 0 && !dstate.Promoted {\n\t\t\tif dstate.HealthyAllocs >= dstate.DesiredCanaries {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t} else if dstate.HealthyAllocs >= dstate.DesiredTotal {\n\t\t\tcontinue\n\t\t}\n\n\t\t// We have failed this TG\n\t\tfail = true\n\n\t\t// We don't need to autorevert this group\n\t\tupd := w.j.LookupTaskGroup(tg).Update\n\t\tif upd == nil || !upd.AutoRevert {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Unhealthy allocs and we need to autorevert\n\t\treturn fail, true, nil\n\t}\n\n\treturn fail, false, nil\n}", "title": "" }, { "docid": "003852a5f4216545ac89a0a6c67e818f", "score": "0.55724233", "text": "func TestCreateAccountWithConflict(t *testing.T) {\n\taccount_data := createAccountData()\n\tCreate(account_data)\n\tdefer Delete(account_data.ID, *account_data.Version)\n\t\n\terr := Create(account_data)\n\tif err != nil {\n\t\tswitch err.(type) {\n\t\t\tcase *ConflictError :\n\t\t\tdefault:\n t.Fatalf(\"This test must return an error ConflictError\")\n }\n\t} else {\n\t\tt.Fatalf(\"This test must return an error ConflictError\")\n\t}\n}", "title": "" }, { "docid": "a08a262bedbc9487530c2071a49b82c7", "score": "0.5560651", "text": "func TestBlueGreenAbort(t *testing.T) {\n\tf := newFixture(t)\n\tdefer f.Close()\n\n\tr1 := newBlueGreenRollout(\"foo\", 1, nil, \"bar\", \"\")\n\tr2 := bumpVersion(r1)\n\tr2.Status.Abort = true\n\tnow := timeutil.MetaNow()\n\tr2.Status.AbortedAt = &now\n\n\trs1 := newReplicaSetWithStatus(r1, 1, 1)\n\trs2 := newReplicaSetWithStatus(r2, 1, 1)\n\trs2PodHash := rs2.Labels[v1alpha1.DefaultRolloutUniqueLabelKey]\n\trs1PodHash := rs1.Labels[v1alpha1.DefaultRolloutUniqueLabelKey]\n\n\tserviceSelector := map[string]string{v1alpha1.DefaultRolloutUniqueLabelKey: rs2PodHash}\n\ts := newService(\"bar\", 80, serviceSelector, r2)\n\tf.kubeobjects = append(f.kubeobjects, s, rs1, rs2)\n\tf.replicaSetLister = append(f.replicaSetLister, rs1, rs2)\n\n\tr2 = updateBlueGreenRolloutStatus(r2, \"\", rs2PodHash, rs1PodHash, 1, 1, 2, 1, false, true, true)\n\tf.rolloutLister = append(f.rolloutLister, r2)\n\tf.objects = append(f.objects, r2)\n\tf.serviceLister = append(f.serviceLister, s)\n\n\tf.expectPatchServiceAction(s, rs1PodHash)\n\tpatchIndex := f.expectPatchRolloutAction(r2)\n\tf.run(getKey(r2, t))\n\texpectedConditions := generateConditionsPatch(true, conditions.RolloutAbortedReason, r2, true, \"\", false)\n\texpectedPatch := fmt.Sprintf(`{\n\t\t\"status\": {\n\t\t\t\"blueGreen\": {\n\t\t\t\t\"activeSelector\": \"%s\"\n\t\t\t},\n\t\t\t\"conditions\": %s,\n\t\t\t\"selector\": \"foo=bar,rollouts-pod-template-hash=%s\",\n\t\t\t\"phase\": \"Degraded\",\n\t\t\t\"message\": \"%s: %s\"\n\t\t}\t\n\t}`, rs1PodHash, expectedConditions, rs1PodHash, conditions.RolloutAbortedReason, fmt.Sprintf(conditions.RolloutAbortedMessage, 2))\n\tpatch := f.getPatchedRollout(patchIndex)\n\tassert.Equal(t, calculatePatch(r2, expectedPatch), patch)\n}", "title": "" }, { "docid": "7d3ddee0cb6004ccd48cc5dd3dc3b614", "score": "0.5535691", "text": "func TestDeletingAbortedReleases(t *testing.T) {\n\tf := newFixture(t)\n\tapp := newApplication(testAppName)\n\tf.objects = append(f.objects, app)\n\n\treleaseFoo := newRelease(\"foo\", app)\n\treleaseFoo.Annotations[shipper.ReleaseGenerationAnnotation] = \"0\"\n\n\treleaseBar := newRelease(\"bar\", app)\n\treleaseutil.SetGeneration(releaseBar, 1)\n\treleaseutil.SetReleaseCondition(&releaseBar.Status, *releaseutil.NewReleaseCondition(shipper.ReleaseConditionTypeComplete, corev1.ConditionTrue, \"\", \"\"))\n\treleaseBar.Spec.TargetStep = 2\n\treleaseBar.Status.AchievedStep = &shipper.AchievedStep{\n\t\tStep: 2,\n\t\tName: releaseBar.Spec.Environment.Strategy.Steps[2].Name,\n\t}\n\n\tf.objects = append(f.objects, releaseFoo, releaseBar)\n\n\tapp.Status.History = []string{\"foo\", \"bar\"}\n\n\texpectedApp := app.DeepCopy()\n\texpectedApp.Annotations[shipper.AppHighestObservedGenerationAnnotation] = \"1\"\n\tapputil.UpdateChartNameAnnotation(expectedApp, \"simple\")\n\tapputil.UpdateChartVersionRawAnnotation(expectedApp, \"0.0.1\")\n\tapputil.UpdateChartVersionResolvedAnnotation(expectedApp, \"0.0.1\")\n\n\texpectedApp.Status.Conditions = []shipper.ApplicationCondition{\n\t\t{\n\t\t\tType: shipper.ApplicationConditionTypeAborting,\n\t\t\tStatus: corev1.ConditionFalse,\n\t\t},\n\t\t{\n\t\t\tType: shipper.ApplicationConditionTypeBlocked,\n\t\t\tStatus: corev1.ConditionFalse,\n\t\t},\n\t\t{\n\t\t\tType: shipper.ApplicationConditionTypeReleaseSynced,\n\t\t\tStatus: corev1.ConditionTrue,\n\t\t},\n\t\t{\n\t\t\tType: shipper.ApplicationConditionTypeRollingOut,\n\t\t\tStatus: corev1.ConditionFalse,\n\t\t\tMessage: fmt.Sprintf(ReleaseActiveMessageFormat, releaseBar.Name),\n\t\t},\n\t\t{\n\t\t\tType: shipper.ApplicationConditionTypeValidHistory,\n\t\t\tStatus: corev1.ConditionTrue,\n\t\t},\n\t}\n\n\tf.expectReleaseDelete(releaseFoo)\n\tf.expectApplicationUpdate(expectedApp)\n\n\tf.expectedEvents = []string{\n\t\tfmt.Sprintf(`Normal ApplicationConditionChanged [] -> [Aborting False], [] -> [ValidHistory True], [] -> [ReleaseSynced True], [] -> [RollingOut False Release \"%s\" is active]`, releaseBar.Name),\n\t\t\"Normal ApplicationConditionChanged [] -> [Blocked False]\",\n\t}\n\n\tf.run()\n}", "title": "" }, { "docid": "784fd7ed29fd32a3edaf0e97b99f7706", "score": "0.5446067", "text": "func TestNoDeletionsWhileInProgress(t *testing.T) {\n\tt.Parallel()\n\tm1 := configMapNeedsDelete()\n\tm2 := configMapMarkedForDeletion()\n\ttc := testCase{\n\t\tmainClientObjects: []runtime.Object{\n\t\t\tm1,\n\t\t\tm2,\n\t\t},\n\t\tscClientObjects: []runtime.Object{\n\t\t\tserviceInstance(false, true, false),\n\t\t},\n\t\tbundle: &smith_v1.Bundle{\n\t\t\tObjectMeta: meta_v1.ObjectMeta{\n\t\t\t\tName: bundle1,\n\t\t\t\tNamespace: testNamespace,\n\t\t\t\tUID: bundle1uid,\n\t\t\t\tFinalizers: []string{bundlec.FinalizerDeleteResources},\n\t\t\t},\n\t\t\tSpec: smith_v1.BundleSpec{\n\t\t\t\tResources: []smith_v1.Resource{\n\t\t\t\t\t{\n\t\t\t\t\t\tName: resSi1,\n\t\t\t\t\t\tSpec: smith_v1.ResourceSpec{\n\t\t\t\t\t\t\tObject: &sc_v1b1.ServiceInstance{\n\t\t\t\t\t\t\t\tTypeMeta: meta_v1.TypeMeta{\n\t\t\t\t\t\t\t\t\tKind: \"ServiceInstance\",\n\t\t\t\t\t\t\t\t\tAPIVersion: sc_v1b1.SchemeGroupVersion.String(),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tObjectMeta: meta_v1.ObjectMeta{\n\t\t\t\t\t\t\t\t\tName: si1,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tSpec: serviceInstanceSpec,\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\tappName: testAppName,\n\t\tnamespace: testNamespace,\n\t\tenableServiceCatalog: true,\n\t\ttest: func(t *testing.T, ctx context.Context, cntrlr *bundlec.Controller, tc *testCase) {\n\t\t\ttc.defaultTest(t, ctx, cntrlr)\n\t\t\ttc.assertObjectsToBeDeleted(t, m2, m1)\n\t\t},\n\t}\n\ttc.run(t)\n}", "title": "" }, { "docid": "bfcf6d16bbec630df28090ce788662b9", "score": "0.540264", "text": "func checkTransientUnitConflicts(t *testing.T, trTarget TrUnitProp, trDep TrUnitProp) error {\n\tconn := setupConn(t)\n\tdefer conn.Close()\n\n\t// Start the dependent unit\n\terr := runStartTrUnit(t, conn, trDep)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Start the target unit\n\terr = runStartTrUnit(t, conn, trTarget)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tisTargetActive := false\n\tunit := getUnitStatusSingle(conn, trTarget.name)\n\tif unit != nil && unit.ActiveState == \"active\" {\n\t\tisTargetActive = true\n\t}\n\n\tisReqDepActive := false\n\tunit = getUnitStatusSingle(conn, trDep.name)\n\tif unit != nil && unit.ActiveState == \"active\" {\n\t\tisReqDepActive = true\n\t}\n\n\tif isTargetActive && isReqDepActive {\n\t\treturn fmt.Errorf(\"Conflicts didn't take place\")\n\t}\n\n\t// Stop the target unit\n\tif isTargetActive {\n\t\terr = runStopUnit(t, conn, trTarget)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tunit = getUnitStatusSingle(conn, trTarget.name)\n\t\tif unit != nil {\n\t\t\treturn fmt.Errorf(\"Test unit %s found in list, should be stopped\", trTarget.name)\n\t\t}\n\t}\n\n\t// Stop the dependent unit\n\tif isReqDepActive {\n\t\terr = runStopUnit(t, conn, trDep)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tunit = getUnitStatusSingle(conn, trDep.name)\n\t\tif unit != nil {\n\t\t\treturn fmt.Errorf(\"Test unit %s found in list, should be stopped\", trDep.name)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9ad1f032d2be3b3bb1b6926f05862581", "score": "0.5355372", "text": "func AssertThatJobDoesNotRunIfChanged(t *testing.T, p jobRunner, changedFile string) {\n\tassert.False(t, p.RunsAgainstChanges([]string{changedFile}), \"triggered by changed file [%s]\", changedFile)\n}", "title": "" }, { "docid": "05505911081cf254e982c62f05039db7", "score": "0.53271836", "text": "func Fail(ctx context.Context, store *coal.Store, job Job, reason string, delay time.Duration) error {\n\t// get meta and base\n\tmeta := GetMeta(job)\n\tbase := job.GetBase()\n\n\t// trace\n\tctx, span := xo.Trace(ctx, \"axe/Fail\")\n\tspan.Tag(\"name\", meta.Name)\n\tspan.Tag(\"label\", base.Label)\n\tspan.Tag(\"id\", job.ID().Hex())\n\tspan.Tag(\"reason\", reason)\n\tspan.Tag(\"delay\", delay.String())\n\tdefer span.End()\n\n\t// get time\n\tnow := time.Now()\n\n\t// update job\n\tfound, err := store.M(&Model{}).UpdateFirst(ctx, nil, bson.M{\n\t\t\"_id\": job.ID(),\n\t\t\"State\": Dequeued,\n\t}, bson.M{\n\t\t\"$set\": bson.M{\n\t\t\t\"State\": Failed,\n\t\t\t\"Available\": now.Add(delay),\n\t\t\t\"Ended\": now,\n\t\t},\n\t\t\"$push\": bson.M{\n\t\t\t\"Events\": Event{\n\t\t\t\tTimestamp: now,\n\t\t\t\tState: Failed,\n\t\t\t\tReason: reason,\n\t\t\t},\n\t\t},\n\t}, nil, false)\n\tif err != nil {\n\t\treturn err\n\t} else if !found {\n\t\treturn xo.F(\"missing job\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "296888ba788955571ec4beb34a6ec82f", "score": "0.52839094", "text": "func TestThatCausesDeadlock(t *testing.T) {\n\tctrl := gomock.NewController(t)\n\tmock := mock_service.NewMockFoo(ctrl)\n\n //We have neglected to set up the expected calls in this test\n\tnew(Service).Baz(context.Background(), mock)\n\n\tctrl.Finish()\n}", "title": "" }, { "docid": "5baab3bcabc7352f5cc95c2aabec2d6c", "score": "0.5256796", "text": "func assertDeletionInvariant(t *testing.T, original, updated *ServiceInstanceStatus) {\n\tactualCondition := updated.manage().GetCondition(ServiceInstanceConditionBackingResourceReady)\n\n\tactualOSB := updated.OSBStatus\n\n\tswitch actualCondition.Status {\n\tcase corev1.ConditionTrue:\n\t\ttestutil.AssertTrue(t, \"OSBStatus deprovisioned\", actualOSB.Deprovisioned != nil)\n\tcase corev1.ConditionFalse:\n\t\ttestutil.AssertTrue(t, \"OSBStatus deprovisionFailed\", actualOSB.DeprovisionFailed != nil)\n\tcase corev1.ConditionUnknown:\n\t\tif actualOSB.Deprovisioning == nil && !reflect.DeepEqual(actualOSB, original.OSBStatus) {\n\t\t\tt.Errorf(\"expected deprovisioning or no change got: %#v\", actualOSB)\n\t\t}\n\tdefault:\n\t\tt.Fatal(\"expected condition to be set\")\n\t}\n}", "title": "" }, { "docid": "908739451b5a5ffe5ae12647fa646961", "score": "0.5253512", "text": "func TestHasConflictComplexGlob(t *testing.T) {\n\tstate := NewState()\n\tstate.TrackJobConflicts(\"a\", []string{\"*.[1-9].service\"})\n\n\tmatched, name := state.HasConflict(\"web.2.service\", []string{})\n\tif !matched || name != \"a\" {\n\t\tt.Errorf(\"Expected conflict with 'a'\")\n\t}\n\n\tmatched, _ = state.HasConflict(\"app.99.service\", []string{})\n\tif matched {\n\t\tt.Errorf(\"Expected no conflict\")\n\t}\n}", "title": "" }, { "docid": "eac4d86308dd6b35c722756ffff5dc3e", "score": "0.5230632", "text": "func Test_util_conflict(t *testing.T) {\n\tu := util{}\n\tenc := JSONEncoder{}\n\trw := httptest.NewRecorder()\n\n\tmsg := \"already exists!\"\n\texpCode := http.StatusConflict\n\texpBody := fmt.Sprintf(`{\"code\":%d,\"message\":\"%s\"}`, expCode, msg)\n\n\tu.conflict(rw, enc, msg)\n\tassert.Equal(t, rw.Code, expCode, \"conflict() returned unexpected status code\")\n\tassert.Equal(t, rw.Body.String(), expBody, \"conflict() returned unexpected body\")\n}", "title": "" }, { "docid": "17ca41a456b82978a673a9dfe9e5ca43", "score": "0.52163154", "text": "func (j *Job) Fail() error {\n\terr := client.SAdd(JOB_FAILED_PREFIX+j.queueName, j.JSON).Err()\n\tif err != nil {\n\t\treturn errors.New(\"Failed to add to failed jobs set of job \" + j.ID + \" : \" + err.Error())\n\t}\n\terr = j.SetStatus(3, 0)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e3f650e80a7b399edfe85ea18d6d235c", "score": "0.521559", "text": "func AssertThatJobRunIfChanged(t *testing.T, p jobRunner, changedFile string) {\n\tassert.True(t, p.RunsAgainstChanges([]string{changedFile}), \"missed change [%s]\", changedFile)\n}", "title": "" }, { "docid": "858bbab8a11ea6e0fd63d5741f2ec61b", "score": "0.5206961", "text": "func (d *DetectorTestSuite) TestConflicts() {\n\n\t// We expect these to conflict by first name, Gender, ID, and BirthDate.\n\ttz, err := time.LoadLocation(\"America/New_York\")\n\td.NoError(err)\n\n\tmatch := &Match{\n\t\tResourceType: \"Patient\",\n\t\tLeft: &models.Patient{\n\t\t\tDomainResource: models.DomainResource{\n\t\t\t\tResource: models.Resource{\n\t\t\t\t\tId: bson.NewObjectId().Hex(),\n\t\t\t\t\tResourceType: \"Patient\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tGender: \"Male\",\n\t\t\tName: []models.HumanName{\n\t\t\t\tmodels.HumanName{\n\t\t\t\t\tFamily: \"Smith\",\n\t\t\t\t\tGiven: []string{\"John\"},\n\t\t\t\t},\n\t\t\t},\n\t\t\tBirthDate: &models.FHIRDateTime{\n\t\t\t\tTime: time.Date(1976, 12, 2, 0, 0, 0, 0, tz),\n\t\t\t\tPrecision: models.Date,\n\t\t\t},\n\t\t},\n\t\tRight: &models.Patient{\n\t\t\tDomainResource: models.DomainResource{\n\t\t\t\tResource: models.Resource{\n\t\t\t\t\tId: bson.NewObjectId().Hex(),\n\t\t\t\t\tResourceType: \"Patient\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tGender: \"Female\",\n\t\t\tName: []models.HumanName{\n\t\t\t\tmodels.HumanName{\n\t\t\t\t\tFamily: \"Smith\",\n\t\t\t\t\tGiven: []string{\"Jane\"},\n\t\t\t\t},\n\t\t\t},\n\t\t\tBirthDate: &models.FHIRDateTime{\n\t\t\t\tTime: time.Date(1976, 11, 1, 0, 0, 0, 0, tz),\n\t\t\t\tPrecision: models.Date,\n\t\t\t},\n\t\t},\n\t}\n\n\tdetector := new(Detector)\n\ttargetResource, oo := detector.Conflicts(match)\n\td.NotNil(oo)\n\td.NotNil(targetResource)\n\n\t// Validate the OperationOutcome first.\n\td.Len(oo.Issue, 1)\n\td.Len(oo.Issue[0].Location, 4)\n\td.Len(oo.Issue[0].Diagnostics, len(\"Patient:\"+bson.NewObjectId().Hex())) // Contains the resourceType and targetResourceID\n\n\texpected := []string{\"id\", \"gender\", \"birthDate\", \"name[0].given[0]\"}\n\tfor _, x := range expected {\n\t\td.True(contains(oo.Issue[0].Location, x))\n\t}\n\n\t// Validate the target resource. Should be the same as the left.\n\ttargetPatient, ok := targetResource.(*models.Patient)\n\td.True(ok)\n\tleft, ok := match.Left.(*models.Patient)\n\td.True(ok)\n\n\td.NotEmpty(targetPatient.Id)\n\td.Equal(left.Gender, targetPatient.Gender)\n\td.Equal(left.Name[0].Given[0], targetPatient.Name[0].Given[0])\n\td.Equal(left.Name[0].Family, targetPatient.Name[0].Family)\n\td.True(left.BirthDate.Time.Equal(targetPatient.BirthDate.Time))\n}", "title": "" }, { "docid": "d55374b688d1f462b6e04122dc27b49f", "score": "0.5185521", "text": "func (i NopInstrumentation) DeleteQuorumFailure() {}", "title": "" }, { "docid": "1a33976b9d2d7548084a05d2ca386d04", "score": "0.5160264", "text": "func EnsureJobDeleted(ctx context.Context, cli client.Client, contour *operatorv1alpha1.Contour) error {\n\tjob, err := currentJob(ctx, cli, contour)\n\tif err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\treturn nil\n\t\t}\n\t\treturn err\n\t}\n\tif labels.Exist(job, objcontour.OwnerLabels(contour)) {\n\t\tif err := cli.Delete(ctx, job); err != nil {\n\t\t\tif !errors.IsNotFound(err) {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "da88ee6ddb95ddae9f48473bff31f5da", "score": "0.5152047", "text": "func TestAbort(t *testing.T) {\n\tf := newFixture(t)\n\tapp := newApplication(testAppName)\n\t// Highest observed is higher than any known release. We have an older release\n\t// (gen 0) with a different cluster selector. We expect app template to be\n\t// reverted.\n\tapp.Annotations[shipper.AppHighestObservedGenerationAnnotation] = \"1\"\n\tapp.Spec.Template.ClusterRequirements = shipper.ClusterRequirements{\n\t\tRegions: []shipper.RegionRequirement{{Name: \"foo\"}},\n\t}\n\n\tf.objects = append(f.objects, app)\n\n\tenvHash := hashReleaseEnvironment(app.Spec.Template)\n\trelName := fmt.Sprintf(\"%s-%s-0\", testAppName, envHash)\n\n\trelease := newRelease(relName, app)\n\trelease.Annotations[shipper.ReleaseGenerationAnnotation] = \"0\"\n\trelease.Spec.TargetStep = 2\n\trelease.Status.AchievedStep = &shipper.AchievedStep{\n\t\tStep: 2,\n\t\tName: release.Spec.Environment.Strategy.Steps[2].Name,\n\t}\n\n\trelease.Spec.Environment.ClusterRequirements = shipper.ClusterRequirements{\n\t\tRegions: []shipper.RegionRequirement{{Name: \"bar\"}},\n\t}\n\n\tf.objects = append(f.objects, release)\n\n\tapp.Status.History = []string{relName, \"blorgblorgblorg\"}\n\n\texpectedApp := app.DeepCopy()\n\texpectedApp.Annotations[shipper.AppHighestObservedGenerationAnnotation] = \"0\"\n\tapputil.UpdateChartNameAnnotation(expectedApp, \"simple\")\n\tapputil.UpdateChartVersionRawAnnotation(expectedApp, \"0.0.1\")\n\tapputil.UpdateChartVersionResolvedAnnotation(expectedApp, \"0.0.1\")\n\t// Should have overwritten the old template with the generation 0 one.\n\texpectedApp.Spec.Template = release.Spec.Environment\n\n\texpectedApp.Status.History = []string{relName}\n\n\texpectedApp.Status.Conditions = []shipper.ApplicationCondition{\n\t\t{\n\t\t\tType: shipper.ApplicationConditionTypeAborting,\n\t\t\tStatus: corev1.ConditionTrue,\n\t\t\tReason: \"\",\n\t\t\tMessage: fmt.Sprintf(\"abort in progress, returning state to release %q\", relName),\n\t\t},\n\t\t{\n\t\t\tType: shipper.ApplicationConditionTypeBlocked,\n\t\t\tStatus: corev1.ConditionFalse,\n\t\t},\n\t\t{\n\t\t\tType: shipper.ApplicationConditionTypeRollingOut,\n\t\t\tStatus: corev1.ConditionTrue,\n\t\t},\n\t}\n\n\tf.expectApplicationUpdate(expectedApp)\n\n\tf.expectedEvents = []string{\n\t\tfmt.Sprintf(`Normal ApplicationConditionChanged [] -> [Blocked False], [] -> [Aborting True abort in progress, returning state to release \"%s\"], [] -> [RollingOut True]`, release.Name),\n\t}\n\n\tf.run()\n}", "title": "" }, { "docid": "ea3d53e8aeb0ed52fb9aeb795a7fdcf5", "score": "0.5145174", "text": "func TestFailedVerification(t *testing.T) {\n\tlogrus.SetLevel(logrus.FatalLevel)\n\t// Make an accumulator that has a quorum of 2 and fails verification\n\thdlr := &MockHandler{true, true, user.VotingCommittee{}, 3, false}\n\n\taccumulator := newAccumulator(hdlr, 4)\n\tgo accumulator.Accumulate()\n\n\tcreateAgreement := newAggroFactory(10)\n\n\t// Send two mock events to the accumulator\n\taccumulator.Process(createAgreement(1, 1, 1))\n\taccumulator.Process(createAgreement(1, 1, 2))\n\t// We should not get anything from the CollectedVotesChan\n\ttimer := time.After(100 * time.Millisecond)\n\tselect {\n\tcase <-accumulator.CollectedVotesChan:\n\t\tassert.FailNow(t, \"reached quorum when passed events should have been dropped\")\n\tcase <-timer:\n\t}\n}", "title": "" }, { "docid": "c31d7c437271e4eb8c03b090d21afcf3", "score": "0.5120247", "text": "func (s *WorkItemSuite) TestReorderWorkitemConflict() {\n\tpayload := minimumRequiredCreateWithType(workitem.SystemBug)\n\tpayload.Data.Attributes[workitem.SystemTitle] = \"Reorder Test WI\"\n\tpayload.Data.Attributes[workitem.SystemState] = workitem.SystemStateClosed\n\n\t// This workitem is created but not used to clearly test that the reorder workitem is moved between **two** workitems i.e. result1 and result2 and not to the **top** of the list\n\ttest.CreateWorkitemsCreated(s.T(), s.svc.Context, s.svc, s.workitemsCtrl, *payload.Data.Relationships.Space.Data.ID, &payload)\n\n\t_, result2 := test.CreateWorkitemsCreated(s.T(), s.svc.Context, s.svc, s.workitemsCtrl, *payload.Data.Relationships.Space.Data.ID, &payload)\n\t_, result3 := test.CreateWorkitemsCreated(s.T(), s.svc.Context, s.svc, s.workitemsCtrl, *payload.Data.Relationships.Space.Data.ID, &payload)\n\tpayload2 := minimumRequiredReorderPayload()\n\n\tvar dataArray []*app.WorkItem // dataArray contains the workitem(s) that have to be reordered\n\tresult3.Data.Attributes[\"version\"] = 101\n\tdataArray = append(dataArray, result3.Data)\n\tpayload2.Data = dataArray\n\tpayload2.Position.ID = result2.Data.ID // Position.ID specifies the workitem ID above or below which the workitem(s) should be placed\n\tpayload2.Position.Direction = string(workitem.DirectionAbove)\n\n\t_, err := test.ReorderWorkitemsConflict(s.T(), s.svc.Context, s.svc, s.workitemsCtrl, space.SystemSpace, &payload2) // Returns the workitems which are reordered\n\n\trequire.NotNil(s.T(), err)\n}", "title": "" }, { "docid": "008ac3553cb6551009b8f24ae0e5442d", "score": "0.5119324", "text": "func TestInMemoryBuildQueueInFlightDeduplicationAbandonExecuting(t *testing.T) {\n\tctrl, ctx := gomock.WithContext(context.Background(), t)\n\n\tcontentAddressableStorage := mock.NewMockBlobAccess(ctrl)\n\tclock := mock.NewMockClock(ctrl)\n\tclock.EXPECT().Now().Return(time.Unix(0, 0))\n\tuuidGenerator := mock.NewMockUUIDGenerator(ctrl)\n\tactionRouter := mock.NewMockActionRouter(ctrl)\n\tbuildQueue := scheduler.NewInMemoryBuildQueue(contentAddressableStorage, clock, uuidGenerator.Call, &buildQueueConfigurationForTesting, 10000, actionRouter, allowAllAuthorizer, allowAllAuthorizer, allowAllAuthorizer)\n\texecutionClient := getExecutionClient(t, buildQueue)\n\n\t// Announce a new worker, which creates a queue for operations.\n\tclock.EXPECT().Now().Return(time.Unix(1000, 0))\n\tresponse, err := buildQueue.Synchronize(ctx, &remoteworker.SynchronizeRequest{\n\t\tWorkerId: map[string]string{\n\t\t\t\"hostname\": \"worker123\",\n\t\t\t\"thread\": \"42\",\n\t\t},\n\t\tInstanceNamePrefix: \"main\",\n\t\tPlatform: platformForTesting,\n\t\tCurrentState: &remoteworker.CurrentState{\n\t\t\tWorkerState: &remoteworker.CurrentState_Executing_{\n\t\t\t\tExecuting: &remoteworker.CurrentState_Executing{\n\t\t\t\t\tActionDigest: &remoteexecution.Digest{\n\t\t\t\t\t\tHash: \"099a3f6dc1e8e91dbcca4ea964cd2237d4b11733\",\n\t\t\t\t\t\tSizeBytes: 123,\n\t\t\t\t\t},\n\t\t\t\t\tExecutionState: &remoteworker.CurrentState_Executing_FetchingInputs{\n\t\t\t\t\t\tFetchingInputs: &emptypb.Empty{},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t})\n\trequire.NoError(t, err)\n\ttestutil.RequireEqualProto(t, &remoteworker.SynchronizeResponse{\n\t\tNextSynchronizationAt: &timestamppb.Timestamp{Seconds: 1000},\n\t\tDesiredState: &remoteworker.DesiredState{\n\t\t\tWorkerState: &remoteworker.DesiredState_Idle{\n\t\t\t\tIdle: &emptypb.Empty{},\n\t\t\t},\n\t\t},\n\t}, response)\n\n\t// Let ten clients create ten operations. Because they all refer\n\t// to the same action, all requests should be deduplicated into\n\t// the same task. This means that we create ten initial size\n\t// class selectors, of which the last nine are abandoned\n\t// immediately.\n\toperationParameters := [...]struct {\n\t\tinvocationID string\n\t\toperationName string\n\t}{\n\t\t{\"0f0f22ec-908a-4ea7-8a78-b92ab4188e78\", \"b4667823-9f8e-451d-a3e4-4481ec67329f\"},\n\t\t{\"0f67bd82-2867-45ec-9412-f058f27d2686\", \"1b9e4aaf-b984-4ebc-9b51-0e31bf1b0edb\"},\n\t\t{\"3e3975fa-d723-42c6-bccb-a3358793f656\", \"e662fb47-f162-41b8-b29c-45b24fe9e273\"},\n\t\t{\"557cd041-1d24-423c-9733-f94c8d2916b2\", \"def137ac-7724-43ff-98f9-b16a3ba01dcd\"},\n\t\t{\"56a827ff-d0bb-4f90-839d-eb55d8060269\", \"64943e71-86c3-4153-a760-76c0ff30cd68\"},\n\t\t{\"849810af-2e0b-45ae-965d-28642d6c6453\", \"da009be0-93fe-40ad-9e03-a14e2bee2ff9\"},\n\t\t{\"9cadf0eb-1e28-49ea-b052-5d05cdc50303\", \"e0f4e177-369d-4412-a19c-b7b1969dd46e\"},\n\t\t{\"9ff4fd36-7123-4b59-90e2-7f49cd0af05e\", \"34f633ac-c418-4a1d-8a69-796990008e9c\"},\n\t\t{\"d0438436-cff3-45e1-9c0b-7e5af632c0a4\", \"46cdaa7c-6bfa-49e2-822e-31be760c51c5\"},\n\t\t{\"e4896008-d596-44c7-8df6-6ced53dff6b0\", \"88929b3e-f664-4f11-873d-40324d06378e\"},\n\t}\n\tinitialSizeClassLearner := mock.NewMockLearner(ctrl)\n\tfor i, p := range operationParameters {\n\t\tcontentAddressableStorage.EXPECT().Get(\n\t\t\tgomock.Any(),\n\t\t\tdigest.MustNewDigest(\"main\", remoteexecution.DigestFunction_SHA256, \"fc96ea0eee854b45950d3a7448332445730886691b992cb7917da0853664f7c2\", 123),\n\t\t).Return(buffer.NewProtoBufferFromProto(&remoteexecution.Action{\n\t\t\tCommandDigest: &remoteexecution.Digest{\n\t\t\t\tHash: \"f7a3ac7c17e535bc9b54ab13dbbb95a52ca1f1edaf9503ce23ccb3eca331a4f5\",\n\t\t\t\tSizeBytes: 456,\n\t\t\t},\n\t\t\tPlatform: platformForTesting,\n\t\t}, buffer.UserProvided))\n\n\t\tinitialSizeClassSelector := mock.NewMockSelector(ctrl)\n\t\trequestMetadata := &remoteexecution.RequestMetadata{\n\t\t\tToolInvocationId: p.invocationID,\n\t\t\tTargetId: \"//:hello_world\",\n\t\t}\n\t\trequestMetadataAny, err := anypb.New(requestMetadata)\n\t\trequire.NoError(t, err)\n\t\trequestMetadataBin, err := proto.Marshal(requestMetadata)\n\t\trequire.NoError(t, err)\n\t\tactionRouter.EXPECT().RouteAction(gomock.Any(), gomock.Any(), gomock.Any(), testutil.EqProto(t, requestMetadata)).Return(\n\t\t\tplatform.MustNewKey(\"main\", platformForTesting),\n\t\t\t[]invocation.Key{invocation.MustNewKey(requestMetadataAny)},\n\t\t\tinitialSizeClassSelector,\n\t\t\tnil,\n\t\t)\n\t\tif i == 0 {\n\t\t\tinitialSizeClassSelector.EXPECT().Select([]uint32{0}).\n\t\t\t\tReturn(0, 15*time.Minute, 30*time.Minute, initialSizeClassLearner)\n\t\t} else {\n\t\t\tinitialSizeClassSelector.EXPECT().Abandoned()\n\t\t}\n\n\t\tctxWithCancel, cancel := context.WithCancel(ctx)\n\n\t\tclock.EXPECT().Now().Return(time.Unix(1010+int64(i), 0))\n\t\ttimer := mock.NewMockTimer(ctrl)\n\t\tclock.EXPECT().NewTimer(time.Minute).Return(timer, nil)\n\t\ttimer.EXPECT().Stop().Return(true)\n\t\tuuidGenerator.EXPECT().Call().Return(uuid.Parse(p.operationName))\n\t\tstream, err := executionClient.Execute(\n\t\t\tmetadata.AppendToOutgoingContext(\n\t\t\t\tctxWithCancel,\n\t\t\t\t\"build.bazel.remote.execution.v2.requestmetadata-bin\",\n\t\t\t\tstring(requestMetadataBin)),\n\t\t\t&remoteexecution.ExecuteRequest{\n\t\t\t\tInstanceName: \"main\",\n\t\t\t\tActionDigest: &remoteexecution.Digest{\n\t\t\t\t\tHash: \"fc96ea0eee854b45950d3a7448332445730886691b992cb7917da0853664f7c2\",\n\t\t\t\t\tSizeBytes: 123,\n\t\t\t\t},\n\t\t\t})\n\t\trequire.NoError(t, err)\n\t\tupdate, err := stream.Recv()\n\t\trequire.NoError(t, err)\n\t\tmetadata, err := anypb.New(&remoteexecution.ExecuteOperationMetadata{\n\t\t\tStage: remoteexecution.ExecutionStage_QUEUED,\n\t\t\tActionDigest: &remoteexecution.Digest{\n\t\t\t\tHash: \"fc96ea0eee854b45950d3a7448332445730886691b992cb7917da0853664f7c2\",\n\t\t\t\tSizeBytes: 123,\n\t\t\t},\n\t\t})\n\t\trequire.NoError(t, err)\n\t\ttestutil.RequireEqualProto(t, &longrunningpb.Operation{\n\t\t\tName: p.operationName,\n\t\t\tMetadata: metadata,\n\t\t}, update)\n\n\t\t// Immediately cancel the request. The operation should\n\t\t// still be valid for the next minute.\n\t\t//\n\t\t// Because cancelling the RPC happens asynchronously, we\n\t\t// wait on clock.Now() to be called to ensure\n\t\t// InMemoryBuildQueue has detected the cancelation.\n\t\tcancelWait := make(chan struct{})\n\t\tclock.EXPECT().Now().Return(time.Unix(1010+int64(i), 0)).Do(func() {\n\t\t\tcancelWait <- struct{}{}\n\t\t})\n\t\tcancel()\n\t\t<-cancelWait\n\t}\n\n\t// Let one worker execute the task. Because of in-flight\n\t// deduplication, all ten operations should now be in the\n\t// EXECUTING stage.\n\tclock.EXPECT().Now().Return(time.Unix(1065, 0))\n\tresponse, err = buildQueue.Synchronize(ctx, &remoteworker.SynchronizeRequest{\n\t\tWorkerId: map[string]string{\n\t\t\t\"hostname\": \"worker123\",\n\t\t\t\"thread\": \"42\",\n\t\t},\n\t\tInstanceNamePrefix: \"main\",\n\t\tPlatform: platformForTesting,\n\t\tCurrentState: &remoteworker.CurrentState{\n\t\t\tWorkerState: &remoteworker.CurrentState_Idle{\n\t\t\t\tIdle: &emptypb.Empty{},\n\t\t\t},\n\t\t},\n\t})\n\trequire.NoError(t, err)\n\trequestMetadata, err := anypb.New(&remoteexecution.RequestMetadata{\n\t\tToolInvocationId: \"0f0f22ec-908a-4ea7-8a78-b92ab4188e78\",\n\t\tTargetId: \"//:hello_world\",\n\t})\n\trequire.NoError(t, err)\n\ttestutil.RequireEqualProto(t, &remoteworker.SynchronizeResponse{\n\t\tNextSynchronizationAt: &timestamppb.Timestamp{Seconds: 1075},\n\t\tDesiredState: &remoteworker.DesiredState{\n\t\t\tWorkerState: &remoteworker.DesiredState_Executing_{\n\t\t\t\tExecuting: &remoteworker.DesiredState_Executing{\n\t\t\t\t\tDigestFunction: remoteexecution.DigestFunction_SHA256,\n\t\t\t\t\tActionDigest: &remoteexecution.Digest{\n\t\t\t\t\t\tHash: \"fc96ea0eee854b45950d3a7448332445730886691b992cb7917da0853664f7c2\",\n\t\t\t\t\t\tSizeBytes: 123,\n\t\t\t\t\t},\n\t\t\t\t\tAction: &remoteexecution.Action{\n\t\t\t\t\t\tCommandDigest: &remoteexecution.Digest{\n\t\t\t\t\t\t\tHash: \"f7a3ac7c17e535bc9b54ab13dbbb95a52ca1f1edaf9503ce23ccb3eca331a4f5\",\n\t\t\t\t\t\t\tSizeBytes: 456,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tPlatform: platformForTesting,\n\t\t\t\t\t\tTimeout: &durationpb.Duration{Seconds: 1800},\n\t\t\t\t\t},\n\t\t\t\t\tQueuedTimestamp: &timestamppb.Timestamp{Seconds: 1010},\n\t\t\t\t\tAuxiliaryMetadata: []*anypb.Any{requestMetadata},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}, response)\n\n\t// Get listings of invocations known by the scheduler. Because\n\t// we're requesting this one minute after the operations were\n\t// created, we should gradually see this list shrink. Eventually\n\t// all invocations should be removed.\n\tinitialSizeClassLearner.EXPECT().Abandoned()\n\tinvocationName := &buildqueuestate.InvocationName{\n\t\tSizeClassQueueName: &buildqueuestate.SizeClassQueueName{\n\t\t\tPlatformQueueName: &buildqueuestate.PlatformQueueName{\n\t\t\t\tInstanceNamePrefix: \"main\",\n\t\t\t\tPlatform: platformForTesting,\n\t\t\t},\n\t\t},\n\t}\n\tfor i := 0; i <= len(operationParameters); i++ {\n\t\tclock.EXPECT().Now().Return(time.Unix(1069+int64(i), 0)).Times(3)\n\n\t\tinvocationStates, err := buildQueue.ListInvocationChildren(ctx, &buildqueuestate.ListInvocationChildrenRequest{\n\t\t\tInvocationName: invocationName,\n\t\t\tFilter: buildqueuestate.ListInvocationChildrenRequest_ALL,\n\t\t})\n\t\trequire.NoError(t, err)\n\t\trequire.Len(t, invocationStates.Children, len(operationParameters)-i)\n\n\t\tinvocationStates, err = buildQueue.ListInvocationChildren(ctx, &buildqueuestate.ListInvocationChildrenRequest{\n\t\t\tInvocationName: invocationName,\n\t\t\tFilter: buildqueuestate.ListInvocationChildrenRequest_ACTIVE,\n\t\t})\n\t\trequire.NoError(t, err)\n\t\trequire.Len(t, invocationStates.Children, len(operationParameters)-i)\n\n\t\tinvocationStates, err = buildQueue.ListInvocationChildren(ctx, &buildqueuestate.ListInvocationChildrenRequest{\n\t\t\tInvocationName: invocationName,\n\t\t\tFilter: buildqueuestate.ListInvocationChildrenRequest_QUEUED,\n\t\t})\n\t\trequire.NoError(t, err)\n\t\trequire.Empty(t, invocationStates.Children)\n\t}\n}", "title": "" }, { "docid": "a6e34f346c4c72e91b9cd821c8ad656a", "score": "0.5110317", "text": "func (ctx *ReorderWorkitemsContext) Conflict(r *JSONAPIErrors) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.api+json\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 409, r)\n}", "title": "" }, { "docid": "7b01d5528f41ddb1bb76d7fdfd81ebe9", "score": "0.5110115", "text": "func TestBlueGreenProgressDeadlineAbort(t *testing.T) {\n\t// Two cases to be tested:\n\t// 1. the rollout is making progress, but timeout just happens\n\t// 2. the rollout is not making progress due to timeout and the rollout spec\n\t// is changed to set ProgressDeadlineAbort\n\ttests := []bool{true, false}\n\n\tvar runRolloutProgressDeadlineAbort func(isTimeout bool)\n\trunRolloutProgressDeadlineAbort = func(isTimeout bool) {\n\t\tf := newFixture(t)\n\t\tdefer f.Close()\n\n\t\tr := newBlueGreenRollout(\"foo\", 1, nil, \"active\", \"preview\")\n\t\tprogressDeadlineSeconds := int32(1)\n\t\tr.Spec.ProgressDeadlineSeconds = &progressDeadlineSeconds\n\t\tr.Spec.ProgressDeadlineAbort = true\n\n\t\tf.rolloutLister = append(f.rolloutLister, r)\n\t\tf.objects = append(f.objects, r)\n\n\t\trs := newReplicaSetWithStatus(r, 1, 1)\n\t\tr.Status.UpdatedReplicas = 1\n\t\tr.Status.ReadyReplicas = 1\n\t\tr.Status.AvailableReplicas = 1\n\n\t\trsPodHash := rs.Labels[v1alpha1.DefaultRolloutUniqueLabelKey]\n\n\t\tvar progressingTimeoutCond *v1alpha1.RolloutCondition\n\t\tif isTimeout {\n\t\t\tmsg := fmt.Sprintf(\"ReplicaSet %q has timed out progressing.\", \"foo-\"+rsPodHash)\n\t\t\tprogressingTimeoutCond = conditions.NewRolloutCondition(v1alpha1.RolloutProgressing, corev1.ConditionFalse, conditions.TimedOutReason, msg)\n\t\t} else {\n\t\t\tprogressingTimeoutCond = conditions.NewRolloutCondition(v1alpha1.RolloutProgressing, corev1.ConditionTrue, conditions.TimedOutReason, conditions.TimedOutReason)\n\t\t}\n\t\tconditions.SetRolloutCondition(&r.Status, *progressingTimeoutCond)\n\n\t\tr.Status.BlueGreen.ActiveSelector = rsPodHash\n\t\tr.Status.BlueGreen.PreviewSelector = rsPodHash\n\n\t\tpreviewSvc := newService(\"preview\", 80, nil, r)\n\t\tselector := map[string]string{v1alpha1.DefaultRolloutUniqueLabelKey: rsPodHash}\n\t\tactiveSvc := newService(\"active\", 80, selector, r)\n\t\tf.kubeobjects = append(f.kubeobjects, previewSvc, activeSvc)\n\t\tf.serviceLister = append(f.serviceLister, previewSvc, activeSvc)\n\n\t\tf.kubeobjects = append(f.kubeobjects, rs)\n\t\tf.replicaSetLister = append(f.replicaSetLister, rs)\n\n\t\tf.expectPatchServiceAction(previewSvc, rsPodHash)\n\t\tpatchIndex := f.expectPatchRolloutAction(r)\n\t\tf.run(getKey(r, t))\n\n\t\tf.verifyPatchedRolloutAborted(patchIndex, \"foo-\"+rsPodHash)\n\t}\n\n\tfor _, tc := range tests {\n\t\trunRolloutProgressDeadlineAbort(tc)\n\t}\n}", "title": "" }, { "docid": "027cdbd20eae46f5d8834e636a21ad92", "score": "0.50865716", "text": "func (j *Job) Fail(errStr string) {\n\trunCount := j.RunCount + 1\n\n\tif runCount >= jobConfig.MaxRetryCount {\n\t\tstmt, err := db.Prepare(`UPDATE \"job\" SET status = 2, run_count = $2, elapsed = $3, last_error = $4 WHERE id = $1 RETURNING pg_advisory_unlock($1)`)\n\t\tif err != nil {\n\t\t\tlog.Print(err)\n\t\t\treturn\n\t\t}\n\n\t\t_, err = stmt.Exec(j.ID, runCount, j.Elapsed, errStr)\n\t\tif err != nil {\n\t\t\tlog.Print(err)\n\t\t\treturn\n\t\t}\n\t\tj.Status = 2\n\t} else {\n\t\tdelay := runCount*runCount*runCount*runCount + j.Timeout + j.RetryDelay + 15\n\t\tstmt, err := db.Prepare(`UPDATE \"job\" SET run_count = $2, retry_delay = $3, run_after = $4, elapsed = $5, last_error = $6, grabbed = null WHERE id = $1 RETURNING pg_advisory_unlock($1)`)\n\t\tif err != nil {\n\t\t\tlog.Print(err)\n\t\t\treturn\n\t\t}\n\n\t\t_, err = stmt.Exec(\n\t\t\tj.ID,\n\t\t\trunCount,\n\t\t\tdelay,\n\t\t\tj.RunAfter.Add(time.Duration(delay)*time.Second),\n\t\t\tj.Elapsed,\n\t\t\terrStr,\n\t\t)\n\t\tif err != nil {\n\t\t\tlog.Print(err)\n\t\t\treturn\n\t\t}\n\t\tj.RetryDelay = delay\n\t\tj.RunAfter = j.RunAfter.Add(time.Duration(delay) * time.Second)\n\t}\n\tj.RunCount++\n\tlog.Printf(\"Failed job id: %d, name: %s, payload: %s\", j.ID, j.Name, j.Payload)\n}", "title": "" }, { "docid": "a260890fd661f7be84e16b5f35e2daac", "score": "0.5079166", "text": "func TestInMemoryBuildQueueInFlightDeduplicationAbandonQueued(t *testing.T) {\n\tctrl, ctx := gomock.WithContext(context.Background(), t)\n\n\tcontentAddressableStorage := mock.NewMockBlobAccess(ctrl)\n\tclock := mock.NewMockClock(ctrl)\n\tclock.EXPECT().Now().Return(time.Unix(0, 0))\n\tuuidGenerator := mock.NewMockUUIDGenerator(ctrl)\n\tactionRouter := mock.NewMockActionRouter(ctrl)\n\tbuildQueue := scheduler.NewInMemoryBuildQueue(contentAddressableStorage, clock, uuidGenerator.Call, &buildQueueConfigurationForTesting, 10000, actionRouter, allowAllAuthorizer, allowAllAuthorizer, allowAllAuthorizer)\n\texecutionClient := getExecutionClient(t, buildQueue)\n\n\t// Announce a new worker, which creates a queue for operations.\n\tclock.EXPECT().Now().Return(time.Unix(1000, 0))\n\tresponse, err := buildQueue.Synchronize(ctx, &remoteworker.SynchronizeRequest{\n\t\tWorkerId: map[string]string{\n\t\t\t\"hostname\": \"worker123\",\n\t\t\t\"thread\": \"42\",\n\t\t},\n\t\tInstanceNamePrefix: \"main\",\n\t\tPlatform: platformForTesting,\n\t\tCurrentState: &remoteworker.CurrentState{\n\t\t\tWorkerState: &remoteworker.CurrentState_Executing_{\n\t\t\t\tExecuting: &remoteworker.CurrentState_Executing{\n\t\t\t\t\tActionDigest: &remoteexecution.Digest{\n\t\t\t\t\t\tHash: \"099a3f6dc1e8e91dbcca4ea964cd2237d4b11733\",\n\t\t\t\t\t\tSizeBytes: 123,\n\t\t\t\t\t},\n\t\t\t\t\tExecutionState: &remoteworker.CurrentState_Executing_FetchingInputs{\n\t\t\t\t\t\tFetchingInputs: &emptypb.Empty{},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t})\n\trequire.NoError(t, err)\n\ttestutil.RequireEqualProto(t, &remoteworker.SynchronizeResponse{\n\t\tNextSynchronizationAt: &timestamppb.Timestamp{Seconds: 1000},\n\t\tDesiredState: &remoteworker.DesiredState{\n\t\t\tWorkerState: &remoteworker.DesiredState_Idle{\n\t\t\t\tIdle: &emptypb.Empty{},\n\t\t\t},\n\t\t},\n\t}, response)\n\n\t// Let ten clients create ten operations. Because they all refer\n\t// to the same action, all requests should be deduplicated into\n\t// the same task. This means that we create ten initial size\n\t// class selectors, of which the last nine are abandoned\n\t// immediately.\n\toperationParameters := [...]struct {\n\t\tinvocationID string\n\t\toperationName string\n\t}{\n\t\t{\"0f0f22ec-908a-4ea7-8a78-b92ab4188e78\", \"b4667823-9f8e-451d-a3e4-4481ec67329f\"},\n\t\t{\"0f67bd82-2867-45ec-9412-f058f27d2686\", \"1b9e4aaf-b984-4ebc-9b51-0e31bf1b0edb\"},\n\t\t{\"3e3975fa-d723-42c6-bccb-a3358793f656\", \"e662fb47-f162-41b8-b29c-45b24fe9e273\"},\n\t\t{\"557cd041-1d24-423c-9733-f94c8d2916b2\", \"def137ac-7724-43ff-98f9-b16a3ba01dcd\"},\n\t\t{\"56a827ff-d0bb-4f90-839d-eb55d8060269\", \"64943e71-86c3-4153-a760-76c0ff30cd68\"},\n\t\t{\"849810af-2e0b-45ae-965d-28642d6c6453\", \"da009be0-93fe-40ad-9e03-a14e2bee2ff9\"},\n\t\t{\"9cadf0eb-1e28-49ea-b052-5d05cdc50303\", \"e0f4e177-369d-4412-a19c-b7b1969dd46e\"},\n\t\t{\"9ff4fd36-7123-4b59-90e2-7f49cd0af05e\", \"34f633ac-c418-4a1d-8a69-796990008e9c\"},\n\t\t{\"d0438436-cff3-45e1-9c0b-7e5af632c0a4\", \"46cdaa7c-6bfa-49e2-822e-31be760c51c5\"},\n\t\t{\"e4896008-d596-44c7-8df6-6ced53dff6b0\", \"88929b3e-f664-4f11-873d-40324d06378e\"},\n\t}\n\tinitialSizeClassLearner := mock.NewMockLearner(ctrl)\n\tfor i, p := range operationParameters {\n\t\tcontentAddressableStorage.EXPECT().Get(\n\t\t\tgomock.Any(),\n\t\t\tdigest.MustNewDigest(\"main\", remoteexecution.DigestFunction_SHA256, \"fc96ea0eee854b45950d3a7448332445730886691b992cb7917da0853664f7c2\", 123),\n\t\t).Return(buffer.NewProtoBufferFromProto(&remoteexecution.Action{\n\t\t\tCommandDigest: &remoteexecution.Digest{\n\t\t\t\tHash: \"f7a3ac7c17e535bc9b54ab13dbbb95a52ca1f1edaf9503ce23ccb3eca331a4f5\",\n\t\t\t\tSizeBytes: 456,\n\t\t\t},\n\t\t}, buffer.UserProvided))\n\n\t\tinitialSizeClassSelector := mock.NewMockSelector(ctrl)\n\t\trequestMetadata := &remoteexecution.RequestMetadata{\n\t\t\tToolInvocationId: p.invocationID,\n\t\t}\n\t\trequestMetadataAny, err := anypb.New(requestMetadata)\n\t\trequire.NoError(t, err)\n\t\trequestMetadataBin, err := proto.Marshal(&remoteexecution.RequestMetadata{\n\t\t\tToolInvocationId: p.invocationID,\n\t\t})\n\t\trequire.NoError(t, err)\n\t\tactionRouter.EXPECT().RouteAction(gomock.Any(), gomock.Any(), gomock.Any(), testutil.EqProto(t, requestMetadata)).Return(\n\t\t\tplatform.MustNewKey(\"main\", platformForTesting),\n\t\t\t[]invocation.Key{invocation.MustNewKey(requestMetadataAny)},\n\t\t\tinitialSizeClassSelector,\n\t\t\tnil,\n\t\t)\n\t\tif i == 0 {\n\t\t\tinitialSizeClassSelector.EXPECT().Select([]uint32{0}).\n\t\t\t\tReturn(0, 15*time.Minute, 30*time.Minute, initialSizeClassLearner)\n\t\t} else {\n\t\t\tinitialSizeClassSelector.EXPECT().Abandoned()\n\t\t}\n\n\t\tctxWithCancel, cancel := context.WithCancel(ctx)\n\n\t\tclock.EXPECT().Now().Return(time.Unix(1010+int64(i), 0))\n\t\ttimer := mock.NewMockTimer(ctrl)\n\t\tclock.EXPECT().NewTimer(time.Minute).Return(timer, nil)\n\t\ttimer.EXPECT().Stop().Return(true)\n\t\tuuidGenerator.EXPECT().Call().Return(uuid.Parse(p.operationName))\n\t\tstream, err := executionClient.Execute(\n\t\t\tmetadata.AppendToOutgoingContext(\n\t\t\t\tctxWithCancel,\n\t\t\t\t\"build.bazel.remote.execution.v2.requestmetadata-bin\",\n\t\t\t\tstring(requestMetadataBin)),\n\t\t\t&remoteexecution.ExecuteRequest{\n\t\t\t\tInstanceName: \"main\",\n\t\t\t\tActionDigest: &remoteexecution.Digest{\n\t\t\t\t\tHash: \"fc96ea0eee854b45950d3a7448332445730886691b992cb7917da0853664f7c2\",\n\t\t\t\t\tSizeBytes: 123,\n\t\t\t\t},\n\t\t\t})\n\t\trequire.NoError(t, err)\n\t\tupdate, err := stream.Recv()\n\t\trequire.NoError(t, err)\n\t\tmetadata, err := anypb.New(&remoteexecution.ExecuteOperationMetadata{\n\t\t\tStage: remoteexecution.ExecutionStage_QUEUED,\n\t\t\tActionDigest: &remoteexecution.Digest{\n\t\t\t\tHash: \"fc96ea0eee854b45950d3a7448332445730886691b992cb7917da0853664f7c2\",\n\t\t\t\tSizeBytes: 123,\n\t\t\t},\n\t\t})\n\t\trequire.NoError(t, err)\n\t\ttestutil.RequireEqualProto(t, &longrunningpb.Operation{\n\t\t\tName: p.operationName,\n\t\t\tMetadata: metadata,\n\t\t}, update)\n\n\t\t// Immediately cancel the request. The operation should\n\t\t// still be valid for the next minute.\n\t\t//\n\t\t// Because cancelling the RPC happens asynchronously, we\n\t\t// wait on clock.Now() to be called to ensure\n\t\t// InMemoryBuildQueue has detected the cancelation.\n\t\tcancelWait := make(chan struct{})\n\t\tclock.EXPECT().Now().Return(time.Unix(1010+int64(i), 0)).Do(func() {\n\t\t\tcancelWait <- struct{}{}\n\t\t})\n\t\tcancel()\n\t\t<-cancelWait\n\t}\n\n\t// Get listings of invocations known by the scheduler. Because\n\t// we're requesting this one minute after the operations were\n\t// created, we should gradually see this list shrink. Eventually\n\t// all invocations should be removed.\n\tinitialSizeClassLearner.EXPECT().Abandoned()\n\tinvocationName := &buildqueuestate.InvocationName{\n\t\tSizeClassQueueName: &buildqueuestate.SizeClassQueueName{\n\t\t\tPlatformQueueName: &buildqueuestate.PlatformQueueName{\n\t\t\t\tInstanceNamePrefix: \"main\",\n\t\t\t\tPlatform: platformForTesting,\n\t\t\t},\n\t\t},\n\t}\n\tfor i := 0; i <= len(operationParameters); i++ {\n\t\tclock.EXPECT().Now().Return(time.Unix(1069+int64(i), 0)).Times(3)\n\n\t\tinvocationStates, err := buildQueue.ListInvocationChildren(ctx, &buildqueuestate.ListInvocationChildrenRequest{\n\t\t\tInvocationName: invocationName,\n\t\t\tFilter: buildqueuestate.ListInvocationChildrenRequest_ALL,\n\t\t})\n\t\trequire.NoError(t, err)\n\t\trequire.Len(t, invocationStates.Children, len(operationParameters)-i)\n\n\t\tinvocationStates, err = buildQueue.ListInvocationChildren(ctx, &buildqueuestate.ListInvocationChildrenRequest{\n\t\t\tInvocationName: invocationName,\n\t\t\tFilter: buildqueuestate.ListInvocationChildrenRequest_ACTIVE,\n\t\t})\n\t\trequire.NoError(t, err)\n\t\trequire.Len(t, invocationStates.Children, len(operationParameters)-i)\n\n\t\tinvocationStates, err = buildQueue.ListInvocationChildren(ctx, &buildqueuestate.ListInvocationChildrenRequest{\n\t\t\tInvocationName: invocationName,\n\t\t\tFilter: buildqueuestate.ListInvocationChildrenRequest_QUEUED,\n\t\t})\n\t\trequire.NoError(t, err)\n\t\trequire.Len(t, invocationStates.Children, len(operationParameters)-i)\n\t}\n}", "title": "" }, { "docid": "1ba00828989c8c55631007eb2f83e695", "score": "0.50620705", "text": "func TestUpdateFromTaskResultMismatched(t *testing.T) {\n\tnow := time.Now().UTC().Round(time.Microsecond)\n\ttask := &Task{\n\t\tId: \"A\",\n\t\tTaskKey: TaskKey{\n\t\t\tRepoState: RepoState{\n\t\t\t\tRepo: \"A\",\n\t\t\t\tRevision: \"A\",\n\t\t\t},\n\t\t\tName: \"A\",\n\t\t\tForcedJobId: \"A\",\n\t\t},\n\t\tCreated: now,\n\t\tCommits: []string{\"A\", \"B\"},\n\t\tSwarmingTaskId: \"A\",\n\t}\n\tcopy := task.Copy()\n\n\ttestError := func(s *TaskResult, msg string) {\n\t\tchanged, err := task.UpdateFromTaskResult(s)\n\t\trequire.False(t, changed)\n\t\trequire.Error(t, err)\n\t\trequire.Contains(t, err.Error(), msg)\n\t}\n\n\ts := &TaskResult{\n\t\tID: \"A\",\n\t\tCreated: now,\n\t\tStatus: TASK_STATUS_FAILURE,\n\t\tTags: map[string][]string{\n\t\t\tSWARMING_TAG_ID: {\"B\"},\n\t\t\tSWARMING_TAG_NAME: {\"A\"},\n\t\t\tSWARMING_TAG_REPO: {\"A\"},\n\t\t\tSWARMING_TAG_REVISION: {\"A\"},\n\t\t},\n\t}\n\ttestError(s, \"Id does not match\")\n\n\ts.Tags[SWARMING_TAG_ID] = []string{\"A\"}\n\ts.Tags[SWARMING_TAG_NAME] = []string{\"B\"}\n\ttestError(s, \"Name does not match\")\n\n\ts.Tags[SWARMING_TAG_NAME] = []string{\"A\"}\n\ts.Tags[SWARMING_TAG_REPO] = []string{\"B\"}\n\ttestError(s, \"Repo does not match\")\n\n\ts.Tags[SWARMING_TAG_REPO] = []string{\"A\"}\n\ts.Tags[SWARMING_TAG_REVISION] = []string{\"B\"}\n\ttestError(s, \"Revision does not match\")\n\n\ts.Tags[SWARMING_TAG_REVISION] = []string{\"A\"}\n\ts.Created = now.Add(time.Hour)\n\ttestError(s, \"Creation time has changed\")\n\n\ts.Created = now\n\ts.ID = \"D\"\n\ttestError(s, ErrUnknownId.Error())\n\n\t// Unchanged.\n\tassertdeep.Equal(t, task, copy)\n}", "title": "" }, { "docid": "fd50180cb351db1f4ba24ce184208eff", "score": "0.5061501", "text": "func TestSyncdChartListenerFailure(t *testing.T) {\n\tlistenerErr := errors.New(\"chart listener internal error\")\n\n\ts := New(\n\t\tblockingChartListener{ShouldFail: listenerErr},\n\t\tnopChartReconciler{},\n\t\tblockingImageListener{},\n\t\tnopImageReconciler{},\n\t)\n\n\terr := s.Run(context.Background())\n\n\tassert.Len(t, err, 2)\n\tassert.Contains(t, err, listenerErr)\n\tassert.Contains(t, err, context.Canceled)\n}", "title": "" }, { "docid": "50d0bab19c785aef266407d56cf3831a", "score": "0.5055", "text": "func Aborted(violations ...*ConflictViolation) error {\n\treturn &ConflictFailure{Violations: violations}\n}", "title": "" }, { "docid": "e40b5d7621552e87c26777099296583c", "score": "0.50545317", "text": "func TestPackageDropWithPeerLockIsError(t *testing.T) {\n\tenv := initTestEnv(t)\n\n\tenv.storeProvider.Close()\n\n\t// lock is at the PARENT directory of the storage folder.\n\tlockPath := filepath.Join(env.tempdir, transientStorageLockName)\n\tfileLock := leveldbhelper.NewFileLock(lockPath)\n\trequire.NoError(t, fileLock.Lock())\n\tdefer fileLock.Unlock()\n\n\trequire.ErrorContains(t, Drop(env.storedir, \"drop-with-lock\"),\n\t\t\"as another peer node command is executing, wait for that command to complete its execution or terminate it before retrying\")\n}", "title": "" }, { "docid": "2ff6e09153160bf180a33b32203b88da", "score": "0.50457966", "text": "func (q *Query) CheckConflict(q2 *Query) error {\n\tif q == nil || q2 == nil {\n\t\treturn nil\n\t}\n\n\tif q.Policy != q2.Policy {\n\t\treturn nil\n\t}\n\n\tfor _, op := range q.Operations {\n\t\tfor _, op2 := range q2.Operations {\n\t\t\tif err := op.CheckConflict(op2); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "328fe248e73d457c5fd2d06614451411", "score": "0.50453126", "text": "func testContractorIncompleteMaintenanceAlert(t *testing.T, tg *siatest.TestGroup) {\n\t// The renter shouldn't have any alerts apart from the pre-registered\n\t// testing alerts.\n\tr := tg.Renters()[0]\n\tdag, err := r.DaemonAlertsGet()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif len(dag.Alerts) != 12 {\n\t\tt.Fatal(\"number of alerts is not 12\")\n\t}\n\t// Save the seed for later.\n\twsg, err := r.WalletSeedsGet()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\t// Lock the renter.\n\tif err := r.WalletLockPost(); err != nil {\n\t\tt.Fatal(\"Failed to lock wallet\", err)\n\t}\n\t// The renter should have 1 alert once we have mined enough blocks to trigger a\n\t// renewal.\n\texpectedAlert := modules.Alert{\n\t\tSeverity: modules.SeverityWarning,\n\t\tMsg: contractor.AlertMSGWalletLockedDuringMaintenance,\n\t\tCause: modules.ErrLockedWallet.Error(),\n\t\tModule: \"contractor\",\n\t}\n\terr = build.Retry(100, 100*time.Millisecond, func() error {\n\t\t// Mine a block to trigger contract maintenance.\n\t\tif err := tg.Miners()[0].MineBlock(); err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// Make sure the alert is sane.\n\t\treturn r.IsAlertRegistered(expectedAlert)\n\t})\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\t// Unlock the renter.\n\tif err := r.WalletUnlockPost(wsg.PrimarySeed); err != nil {\n\t\tt.Fatal(\"Failed to lock wallet\", err)\n\t}\n\t// Mine a block to trigger contract maintenance.\n\tif err := tg.Miners()[0].MineBlock(); err != nil {\n\t\tt.Fatal(\"Failed to mine block\", err)\n\t}\n\t// The renter should have 0 alerts now.\n\terr = build.Retry(1000, 100*time.Millisecond, func() error {\n\t\tdag, err = r.DaemonAlertsGet()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(dag.Alerts) != 0 {\n\t\t\treturn fmt.Errorf(\"Expected 0 alert but got %v\", len(dag.Alerts))\n\t\t}\n\t\treturn nil\n\t})\n}", "title": "" }, { "docid": "968984f737f339fee5d7d95c537e1c0b", "score": "0.5040283", "text": "func TestRemove_Dep_FAIL(t *testing.T) {\n\tpi := CreatePackageIndexer()\n\td := &Package{name: \"gmp\"}\n\tp := &Package{name:\"cloog\", deps: []*Package{d}}\n\tpi.packs[d.name] = d\n\tpi.packs[p.name] = p\n\tif pi.Remove(d) != FAIL {\n\t\tt.Errorf(\"Expected removing to fail\") \n\t}\n}", "title": "" }, { "docid": "525a68a22b997a7646b772136fc0cef1", "score": "0.5027512", "text": "func (t *ConcurrentT) FailBarrier(name string) {\n\tt.spawnStage(name, 1).FailNow()\n}", "title": "" }, { "docid": "a5946bd090ec2c4c67c78be0ab6f3081", "score": "0.5019363", "text": "func (r *mockRepoManager) assertForceUpdate() {\n\tr.mtx.RLock()\n\tdefer r.mtx.RUnlock()\n\tassert.Equal(r.t, 0, r.forceUpdateCount)\n}", "title": "" }, { "docid": "b11c828cfa578e444b38f51d7cff364b", "score": "0.49987125", "text": "func TestTxnWaitQueueUpdateNotPushedTxn(t *testing.T) {\n\tdefer leaktest.AfterTest(t)()\n\tdefer log.Scope(t).Close(t)\n\ttc := testContext{}\n\tstopper := stop.NewStopper()\n\tdefer stopper.Stop(context.Background())\n\ttc.Start(t, stopper)\n\n\ttxn, err := createTxnForPushQueue(context.Background(), &tc)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tpusher := newTransaction(\"pusher\", roachpb.Key(\"a\"), 1, tc.Clock())\n\treq := roachpb.PushTxnRequest{\n\t\tPushType: roachpb.PUSH_ABORT,\n\t\tPusherTxn: *pusher,\n\t\tPusheeTxn: txn.TxnMeta,\n\t}\n\n\tq := tc.repl.concMgr.TxnWaitQueue()\n\tq.Enable(1 /* leaseSeq */)\n\tq.EnqueueTxn(txn)\n\n\tretCh := make(chan RespWithErr, 1)\n\tgo func() {\n\t\tresp, pErr := q.MaybeWaitForPush(context.Background(), &req)\n\t\tretCh <- RespWithErr{resp, pErr}\n\t}()\n\n\ttestutils.SucceedsSoon(t, func() error {\n\t\texpDeps := []uuid.UUID{pusher.ID}\n\t\tif deps := q.GetDependents(txn.ID); !reflect.DeepEqual(deps, expDeps) {\n\t\t\treturn errors.Errorf(\"expected GetDependents %+v; got %+v\", expDeps, deps)\n\t\t}\n\t\treturn nil\n\t})\n\n\tupdatedTxn := *txn\n\tupdatedTxn.WriteTimestamp = txn.WriteTimestamp.Add(1, 0)\n\tq.UpdateTxn(context.Background(), &updatedTxn)\n\n\trespWithErr := <-retCh\n\tif respWithErr.resp != nil {\n\t\tt.Errorf(\"on non-committed txn update, expected nil response; got %+v\", respWithErr.resp)\n\t}\n\tif respWithErr.pErr != nil {\n\t\tt.Errorf(\"expected nil error; got %s\", respWithErr.pErr)\n\t}\n\ttestutils.SucceedsSoon(tc.TB, func() error {\n\t\treturn checkAllGaugesZero(tc)\n\t})\n}", "title": "" }, { "docid": "62db6f2300b4195323639fcfcb466ff3", "score": "0.4993002", "text": "func verifyChange(t *testing.T, changes []*ChangeEntry, docID string, isBackfill bool) {\n\tfor _, change := range changes {\n\t\tif change.ID == docID {\n\t\t\thasBackfill := change.Seq.TriggeredBy > 0\n\t\t\tif isBackfill != hasBackfill {\n\t\t\t\tassertFailed(t, fmt.Sprintf(\"VerifyChange failed for docID %s: expected backfill: %v, actual backfill: %v\", docID, isBackfill, hasBackfill))\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t}\n\tassertFailed(t, fmt.Sprintf(\"VerifyChange failed - DocID %s not found in set\", docID))\n}", "title": "" }, { "docid": "8cf5822614cd07d250988c066cfc9bcf", "score": "0.4977016", "text": "func TestManifest_Commit_RemoveSegmentConflict(t *testing.T) {\n\tfs := vfs.CreateMemDir()\n\n\tm := NewManifest()\n\tm.AddSegment(newTestSegment(t, fs, 1, 1, []uint32{1}))\n\tm.AddSegment(newTestSegment(t, fs, 2, 2, []uint32{1}))\n\trequire.NoError(t, m.Commit(fs, 2, nil))\n\n\tm2 := m.Clone()\n\tm2.RemoveSegment(m2.Segments[1])\n\trequire.NoError(t, m2.Commit(fs, 3, m))\n\n\tm3 := m.Clone()\n\tm3.RemoveSegment(m3.Segments[1])\n\terr := m3.Commit(fs, 4, m2)\n\trequire.Error(t, err, \"commit should fail, we removed the same segment twice\")\n\trequire.True(t, IsConflict(err), \"commit should fail with a conflict error\")\n}", "title": "" }, { "docid": "e0871401fabb06f23b302c13d761bee3", "score": "0.49692613", "text": "func validateNameConflict(ctx context.Context, t *testing.T, profile string) {\n\trr, err := Run(t, exec.CommandContext(ctx, Target(), \"node\", \"list\", \"-p\", profile))\n\tif err != nil {\n\t\tt.Errorf(\"failed to run node list. args %q : %v\", rr.Command(), err)\n\t}\n\tcurNodeNum := strings.Count(rr.Stdout.String(), profile)\n\n\t// Start new profile. It's expected failure\n\tprofileName := fmt.Sprintf(\"%s-m0%d\", profile, curNodeNum)\n\tstartArgs := append([]string{\"start\", \"-p\", profileName}, StartArgs()...)\n\trr, err = Run(t, exec.CommandContext(ctx, Target(), startArgs...))\n\tif err == nil {\n\t\tt.Errorf(\"expected start profile command to fail. args %q\", rr.Command())\n\t}\n\n\t// Start new profile temporary profile to conflict node name.\n\tprofileName = fmt.Sprintf(\"%s-m0%d\", profile, curNodeNum+1)\n\tstartArgs = append([]string{\"start\", \"-p\", profileName}, StartArgs()...)\n\trr, err = Run(t, exec.CommandContext(ctx, Target(), startArgs...))\n\tif err != nil {\n\t\tt.Errorf(\"failed to start profile. args %q : %v\", rr.Command(), err)\n\t}\n\n\t// Add a node to the current cluster. It's expected failure\n\taddArgs := []string{\"node\", \"add\", \"-p\", profile}\n\trr, err = Run(t, exec.CommandContext(ctx, Target(), addArgs...))\n\tif err == nil {\n\t\tt.Errorf(\"expected add node command to fail. args %q : %v\", rr.Command(), err)\n\t}\n\n\trr, err = Run(t, exec.CommandContext(ctx, Target(), \"delete\", \"-p\", profileName))\n\tif err != nil {\n\t\tt.Logf(\"failed to clean temporary profile. args %q : %v\", rr.Command(), err)\n\t}\n}", "title": "" }, { "docid": "eb567e87cd702f8cdc1bbdd94313de47", "score": "0.4938917", "text": "func TestTargetNamespacesGotDeleted(t *testing.T) {\n\ttargetNamespace1 := \"fred\"\n\ttargetNamespace2 := \"george\"\n\tactiveNamespace1 := \"fred\"\n\tactiveNamespace2 := \"george\"\n\n\tk := kabanerov1alpha2.Kabanero{\n\t\tObjectMeta: metav1.ObjectMeta{Name: \"kabanero\", Namespace: \"kabanero\"},\n\t\tSpec: kabanerov1alpha2.KabaneroSpec{\n\t\t\tTargetNamespaces: []string{targetNamespace1, targetNamespace2},\n\t\t},\n\t\tStatus: kabanerov1alpha2.KabaneroStatus {\n\t\t\tTargetNamespaces: kabanerov1alpha2.TargetNamespaceStatus {\n\t\t\t\tNamespaces: []string{activeNamespace1, activeNamespace2},\n\t\t\t\tReady: \"True\",\n\t\t\t},\n\t\t},\n\t}\n\n\t// Set up pre-existing objects\n\texistingNamespaces := make(map[string]bool)\n\texistingNamespaces[activeNamespace1] = true\n\texistingRoleBinding1 := client.ObjectKey{Name: \"kabanero-pipeline-deploy-rolebinding\", Namespace: activeNamespace1}\n\texistingRoleBinding2 := client.ObjectKey{Name: \"kabanero-cli-deploy-rolebinding\", Namespace: activeNamespace1}\n\t\n\texistingRoleBindings := make(map[client.ObjectKey]bool)\n\texistingRoleBindings[existingRoleBinding1] = true\n\texistingRoleBindings[existingRoleBinding2] = true\n\tclient := targetnamespaceTestClient{existingRoleBindings, existingNamespaces}\n\t\n\terr := reconcileTargetNamespaces(context.TODO(), &k, client, nslog)\n\n\tif err == nil {\n\t\tt.Fatal(\"Did not return an error, but should have because namespace \\\"george\\\" does not exist\")\n\t}\n\n\t// Make sure the kabanero status was not updated with the target namespace,\n\t// since it did not exist.\n\tif len(k.Status.TargetNamespaces.Namespaces) != 1 {\n\t\tt.Fatal(fmt.Sprintf(\"Kabanero status should have 1 target namespace, but has %v: %v\", len(k.Status.TargetNamespaces.Namespaces), k.Status.TargetNamespaces.Namespaces))\n\t}\n\n\tif k.Status.TargetNamespaces.Namespaces[0] != \"fred\" {\n\t\tt.Fatal(fmt.Sprintf(\"Kabanero status target namespace is not \\\"fred\\\", but is %v\", k.Status.TargetNamespaces.Namespaces[0]))\n\t}\n\t\n\tif k.Status.TargetNamespaces.Ready != \"False\" {\n\t\tt.Fatal(fmt.Sprintf(\"Kabanero target namespace status is not False: %v\", k.Status.TargetNamespaces.Ready))\n\t}\n\n\tif len(k.Status.TargetNamespaces.Message) == 0 {\n\t\tt.Fatal(\"Kabanero target namespace status contains no error message\")\n\t}\n\n\t// Make sure the RoleBinding map got cleared.\n\tif len(client.objs) != 2 {\n\t\tt.Fatal(fmt.Sprintf(\"Should have created two RoleBindings, but created %v: %#v\", len(client.objs), client.objs))\n\t}\n}", "title": "" }, { "docid": "ed513c38bd5e546e821949450067eb80", "score": "0.49385166", "text": "func verifyCascadingDeletionForReplicaSet(clientset *fedclientset.Clientset, clusters fedframework.ClusterSlice, orphanDependents *bool, nsName, rsName string) {\n\tBy(fmt.Sprintf(\"Deleting replica set %s\", rsName))\n\tdeleteReplicaSetOrFail(clientset, nsName, rsName, orphanDependents)\n\n\tBy(fmt.Sprintf(\"Verifying replica sets %s in underlying clusters\", rsName))\n\terrMessages := []string{}\n\tfor _, cluster := range clusters {\n\t\tclusterName := cluster.Name\n\t\t_, err := cluster.Extensions().ReplicaSets(nsName).Get(rsName, metav1.GetOptions{})\n\t\tif (orphanDependents == nil || *orphanDependents == true) && errors.IsNotFound(err) {\n\t\t\terrMessages = append(errMessages, fmt.Sprintf(\"unexpected NotFound error for replica set %s in cluster %s, expected replica set to exist\", rsName, clusterName))\n\t\t} else if (orphanDependents != nil && *orphanDependents == false) && (err == nil || !errors.IsNotFound(err)) {\n\t\t\terrMessages = append(errMessages, fmt.Sprintf(\"expected NotFound error for replica set %s in cluster %s, got error: %v\", rsName, clusterName, err))\n\t\t}\n\t}\n\tif len(errMessages) != 0 {\n\t\tframework.Failf(\"%s\", strings.Join(errMessages, \"; \"))\n\t}\n}", "title": "" }, { "docid": "e7e189e19c2e8628efc2feb1117acd3c", "score": "0.49322522", "text": "func (r *ProjectReconciler) assertDeletedProject(ctx context.Context, log logr.Logger, harborClient *h.RESTClient,\n\tproject *v1alpha2.Project) error {\n\tp, exists, err := FetchHarborProjectIfExists(ctx, harborClient, project.Name)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif exists {\n\t\tif err := DeleteHarborProject(ctx, harborClient, p); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tlog.Info(\"pulling finalizers\", project.Name, project.Namespace)\n\thelper.PullFinalizer(project, internal.FinalizerName)\n\thelper.PullFinalizer(project, internal.OldFinalizerName)\n\n\treturn nil\n}", "title": "" }, { "docid": "9cf433eea336548659219fd15f2805ed", "score": "0.49206635", "text": "func verifyCascadingDeletionForReplicaSet(clientset *fedclientset.Clientset, clusters map[string]*cluster, orphanDependents *bool, nsName string) {\n\treplicaSet := createReplicaSetOrFail(clientset, newReplicaSet(nsName, FederationReplicaSetPrefix, 5, nil))\n\treplicaSetName := replicaSet.Name\n\t// Check subclusters if the replicaSet was created there.\n\tBy(fmt.Sprintf(\"Waiting for replica sets %s to be created in all underlying clusters\", replicaSetName))\n\terr := wait.Poll(5*time.Second, 2*time.Minute, func() (bool, error) {\n\t\tfor _, cluster := range clusters {\n\t\t\t_, err := cluster.Extensions().ReplicaSets(nsName).Get(replicaSetName, metav1.GetOptions{})\n\t\t\tif err != nil && errors.IsNotFound(err) {\n\t\t\t\treturn false, nil\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn false, err\n\t\t\t}\n\t\t}\n\t\treturn true, nil\n\t})\n\tframework.ExpectNoError(err, \"Not all replica sets created\")\n\n\tBy(fmt.Sprintf(\"Deleting replica set %s\", replicaSetName))\n\tdeleteReplicaSetOrFail(clientset, nsName, replicaSetName, orphanDependents)\n\n\tBy(fmt.Sprintf(\"Verifying replica sets %s in underlying clusters\", replicaSetName))\n\terrMessages := []string{}\n\tfor clusterName, clusterClientset := range clusters {\n\t\t_, err := clusterClientset.Extensions().ReplicaSets(nsName).Get(replicaSetName, metav1.GetOptions{})\n\t\tif (orphanDependents == nil || *orphanDependents == true) && errors.IsNotFound(err) {\n\t\t\terrMessages = append(errMessages, fmt.Sprintf(\"unexpected NotFound error for replica set %s in cluster %s, expected replica set to exist\", replicaSetName, clusterName))\n\t\t} else if (orphanDependents != nil && *orphanDependents == false) && (err == nil || !errors.IsNotFound(err)) {\n\t\t\terrMessages = append(errMessages, fmt.Sprintf(\"expected NotFound error for replica set %s in cluster %s, got error: %v\", replicaSetName, clusterName, err))\n\t\t}\n\t}\n\tif len(errMessages) != 0 {\n\t\tframework.Failf(\"%s\", strings.Join(errMessages, \"; \"))\n\t}\n}", "title": "" }, { "docid": "67cf8ba46259244126949d9042f2a3fc", "score": "0.49133602", "text": "func (s *CanarySuite) TestCanaryScaleDownOnAbort() {\n\ts.Given().\n\t\tHealthyRollout(`@functional/canary-scaledownonabort.yaml`).\n\t\tWhen().\n\t\tUpdateSpec(). // update to revision 2\n\t\tWaitForRolloutStatus(\"Paused\").\n\t\tAbortRollout().\n\t\tWaitForRolloutStatus(\"Degraded\").\n\t\tThen().\n\t\t// Expect that the canary service selector has been moved back to stable\n\t\tExpectServiceSelector(\"canary-scaledowndelay-canary\", map[string]string{\"app\": \"canary-scaledowndelay\", \"rollouts-pod-template-hash\": \"66597877b7\"}, false).\n\t\tWhen().\n\t\tSleep(3*time.Second).\n\t\tThen().\n\t\tExpectRevisionPodCount(\"2\", 0)\n}", "title": "" }, { "docid": "8479fee15bb73067f3cd9c6f68512c67", "score": "0.49065277", "text": "func testUpdateManyConflictRollback(t *testing.T, s MetaStore) []StoredTUFMeta {\n\tvar gun data.GUN = \"testGUN\"\n\tsuccessBatch := make([]StoredTUFMeta, 4)\n\tupdates := make([]MetaUpdate, 4)\n\tfor i, role := range data.BaseRoles {\n\t\tsuccessBatch[i] = SampleCustomTUFObj(gun, role, 1, nil)\n\t\tupdates[i] = MakeUpdate(successBatch[i])\n\t}\n\n\trequire.NoError(t, s.UpdateMany(gun, updates))\n\n\tbefore, err := s.GetChanges(\"0\", 1000, \"\")\n\tif _, ok := s.(RethinkDB); !ok {\n\t\trequire.NoError(t, err)\n\t}\n\n\t// conflicts with what's in DB\n\tbadBatch := make([]StoredTUFMeta, 4)\n\tfor i, role := range data.BaseRoles {\n\t\tversion := 2\n\t\tif role == data.CanonicalTargetsRole {\n\t\t\tversion = 1\n\t\t}\n\t\ttufdata := []byte(fmt.Sprintf(\"%s_%s_%d_bad\", gun, role, version))\n\t\tbadBatch[i] = SampleCustomTUFObj(gun, role, version, tufdata)\n\t\tupdates[i] = MakeUpdate(badBatch[i])\n\t}\n\n\t// check no changes were written when there was a conflict+rollback\n\tafter, err := s.GetChanges(\"0\", 1000, \"\")\n\tif _, ok := s.(RethinkDB); !ok {\n\t\trequire.NoError(t, err)\n\t}\n\trequire.Equal(t, len(before), len(after))\n\n\terr = s.UpdateMany(gun, updates)\n\trequire.Error(t, err)\n\trequire.IsType(t, ErrOldVersion{}, err)\n\n\t// self-conflicting, in that it's a duplicate, but otherwise no DB conflicts\n\tduplicate := SampleCustomTUFObj(gun, data.CanonicalTimestampRole, 3, []byte(\"duplicate\"))\n\tduplicateUpdate := MakeUpdate(duplicate)\n\terr = s.UpdateMany(gun, []MetaUpdate{duplicateUpdate, duplicateUpdate})\n\trequire.Error(t, err)\n\trequire.IsType(t, ErrOldVersion{}, err)\n\n\tassertExpectedTUFMetaInStore(t, s, successBatch, true)\n\n\tfor _, tufObj := range append(badBatch, duplicate) {\n\t\tchecksumBytes := sha256.Sum256(tufObj.Data)\n\t\tchecksum := hex.EncodeToString(checksumBytes[:])\n\n\t\t_, _, err = s.GetChecksum(tufObj.Gun, tufObj.Role, checksum)\n\t\trequire.Error(t, err)\n\t\trequire.IsType(t, ErrNotFound{}, err)\n\t}\n\n\treturn successBatch\n}", "title": "" }, { "docid": "3e5a515b428a6e7aee3029c3b96dbcd7", "score": "0.48945552", "text": "func waitForDeletion(t *testing.T, bundleName string) {\n\tfor i := 0; i < 120; i++ {\n\t\tresp, body, _, err := httpClient.SendGet(GetDistDetails().GetUrl()+\"api/v1/release_bundle/\"+bundleName+\"/\"+bundleVersion+\"/distribution\", true, distHttpDetails)\n\t\tassert.NoError(t, err)\n\t\tif resp.StatusCode == http.StatusNotFound {\n\t\t\treturn\n\t\t}\n\t\tif resp.StatusCode != http.StatusOK {\n\t\t\tt.Error(resp.Status)\n\t\t\tt.Error(string(body))\n\t\t\treturn\n\t\t}\n\t\tt.Log(\"Waiting for distribution deletion \" + bundleName + \"/\" + bundleVersion + \"...\")\n\t\ttime.Sleep(time.Second)\n\t}\n\tt.Error(\"Timeout for release bundle deletion \" + bundleName + \"/\" + bundleVersion)\n}", "title": "" }, { "docid": "481bd313ca75ca5531b19c4d3b240d62", "score": "0.48859277", "text": "func (r *Reconciler) fail(claim corev1alpha1.ResourceClaim, reason, msg string) (reconcile.Result, error) {\n\tclaim.ClaimStatus().SetFailed(reason, msg)\n\treturn ResultRequeue, r.Update(ctx, claim)\n}", "title": "" }, { "docid": "3384f522a5d2036c40db4e13e6d8f238", "score": "0.48788312", "text": "func TestTakeOrder_Already_Taken(t *testing.T) {\n\ta := assert.New(t)\n\n\t// init the mock database\n\tmodels.InitMockModel()\n\n\t// set up expected result\n\tconst orderId = 1\n\torder1 := models.Order{ID: orderId, Status: models.StatusTaken, Distance: rand.Intn(5000)}\n\torders := []models.Order{order1}\n\n\t// get the router\n\tr := InitRouter()\n\n\t// make the struct into map for the database mock\n\tvar expectMap []map[string]interface{}\n\ti, _ := json.Marshal(orders)\n\t_ = json.Unmarshal(i, &expectMap)\n\n\t// mock the query that get the order by id\n\tmocket.Catcher.NewMock().WithQuery(`SELECT * FROM \"orders\" WHERE`).WithReply(expectMap)\n\tdefer mocket.Catcher.Reset()\n\n\t// create request body\n\tvar takeOrderRequest requests.TakeOrderRequest\n\ttakeOrderRequest.Status = models.StatusTaken\n\treqBody, err := createJson(takeOrderRequest)\n\n\ta.Nil(err, \"should not have problem with create json\")\n\n\t// make request to recorder\n\tw := httptest.NewRecorder()\n\treq, _ := http.NewRequest(http.MethodPatch, \"/orders/1\", reqBody)\n\tr.ServeHTTP(w, req)\n\n\t// check response code\n\ta.Equal(http.StatusConflict, w.Code, \"server should return back 409 Conflict\")\n\n\t// parsing the error response\n\tvar errorResponse e.ResponseError\n\terr = parseJson(w.Body, &errorResponse)\n\ta.Nil(err, \"should not error out upon parsing error\")\n\ta.NotNil(errorResponse, \"server should have error response\")\n\ta.Equal(e.ErrOrderAlreadyTaken.Error(), errorResponse.Error, \"error response should match the error content\")\n}", "title": "" }, { "docid": "98f845a66b93b99a8628553b53f6a2d9", "score": "0.48787323", "text": "func (s *stage) FailNow() {\n\ts.failed.Set()\n\tdefer s.wg.Done()\n\ts.ct.FailNow()\n}", "title": "" }, { "docid": "797ef967bd1d86839828722c8cdb1c62", "score": "0.48771402", "text": "func TestTxnWaitQueueUpdateTxn(t *testing.T) {\n\tdefer leaktest.AfterTest(t)()\n\tdefer log.Scope(t).Close(t)\n\ttc := testContext{}\n\tstopper := stop.NewStopper()\n\tdefer stopper.Stop(context.Background())\n\ttc.Start(t, stopper)\n\n\ttxn, err := createTxnForPushQueue(context.Background(), &tc)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tpusher1 := newTransaction(\"pusher1\", roachpb.Key(\"a\"), 1, tc.Clock())\n\tpusher2 := newTransaction(\"pusher2\", roachpb.Key(\"a\"), 1, tc.Clock())\n\treq1 := roachpb.PushTxnRequest{\n\t\tPushType: roachpb.PUSH_ABORT,\n\t\tPusherTxn: *pusher1,\n\t\tPusheeTxn: txn.TxnMeta,\n\t}\n\treq2 := req1\n\treq2.PusherTxn = *pusher2\n\n\tq := tc.repl.concMgr.TxnWaitQueue()\n\tq.Enable(1 /* leaseSeq */)\n\tq.EnqueueTxn(txn)\n\tm := tc.store.txnWaitMetrics\n\tassert.EqualValues(tc, 1, m.PusheeWaiting.Value())\n\n\tretCh := make(chan RespWithErr, 2)\n\tgo func() {\n\t\tresp, pErr := q.MaybeWaitForPush(context.Background(), &req1)\n\t\tretCh <- RespWithErr{resp, pErr}\n\t}()\n\ttestutils.SucceedsSoon(t, func() error {\n\t\texpDeps := []uuid.UUID{pusher1.ID}\n\t\tif deps := q.GetDependents(txn.ID); !reflect.DeepEqual(deps, expDeps) {\n\t\t\treturn errors.Errorf(\"expected GetDependents %+v; got %+v\", expDeps, deps)\n\t\t}\n\t\treturn nil\n\t})\n\ttestutils.SucceedsSoon(t, func() error {\n\t\tif act, exp := m.PusherWaiting.Value(), int64(1); act != exp {\n\t\t\treturn errors.Errorf(\"%d pushers, but want %d\", act, exp)\n\t\t}\n\t\tif act, exp := m.PusheeWaiting.Value(), int64(1); act != exp {\n\t\t\treturn errors.Errorf(\"%d pushees, but want %d\", act, exp)\n\t\t}\n\t\tif act, exp := m.QueryWaiting.Value(), int64(1); act != exp {\n\t\t\treturn errors.Errorf(\"%d queries, but want %d\", act, exp)\n\t\t}\n\t\treturn nil\n\t})\n\n\tgo func() {\n\t\tresp, pErr := q.MaybeWaitForPush(context.Background(), &req2)\n\t\tretCh <- RespWithErr{resp, pErr}\n\t}()\n\ttestutils.SucceedsSoon(t, func() error {\n\t\texpDeps := []uuid.UUID{pusher1.ID, pusher2.ID}\n\t\tif deps := q.GetDependents(txn.ID); !reflect.DeepEqual(deps, expDeps) {\n\t\t\treturn errors.Errorf(\"expected GetDependents %+v; got %+v\", expDeps, deps)\n\t\t}\n\t\tif act, exp := m.PusherWaiting.Value(), int64(2); act != exp {\n\t\t\treturn errors.Errorf(\"%d pushers, but want %d\", act, exp)\n\t\t}\n\t\tif act, exp := m.PusheeWaiting.Value(), int64(1); act != exp {\n\t\t\treturn errors.Errorf(\"%d pushees, but want %d\", act, exp)\n\t\t}\n\t\tif act, exp := m.QueryWaiting.Value(), int64(2); act != exp {\n\t\t\treturn errors.Errorf(\"%d queries, but want %d\", act, exp)\n\t\t}\n\t\treturn nil\n\t})\n\n\tupdatedTxn := *txn\n\tupdatedTxn.Status = roachpb.COMMITTED\n\tq.UpdateTxn(context.Background(), &updatedTxn)\n\ttestutils.SucceedsSoon(tc.TB, func() error {\n\t\treturn checkAllGaugesZero(tc)\n\t})\n\n\tfor i := 0; i < 2; i++ {\n\t\trespWithErr := <-retCh\n\t\tif respWithErr.resp == nil || respWithErr.resp.PusheeTxn.Status != roachpb.COMMITTED {\n\t\t\tt.Errorf(\"expected committed txn response; got %+v, err=%v\", respWithErr.resp, respWithErr.pErr)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "40e5d80f7fdf793902e5b87bf8b5882d", "score": "0.48671848", "text": "func TestNoPanicInvalidUpdate(t *testing.T) {\n\n\trt := rest.NewRestTester(t, nil)\n\tdefer rt.Close()\n\n\tdocId := \"conflictTest\"\n\n\t// Create doc\n\tresponse := rt.SendAdminRequest(\"PUT\", \"/{{.keyspace}}/\"+docId, `{\"value\":\"initial\"}`)\n\tresponse.DumpBody()\n\n\trest.RequireStatus(t, response, http.StatusCreated)\n\n\t// Discover revision ID\n\t// TODO: The schema for SG responses should be defined in our code somewhere to avoid this clunky approach\n\tvar responseDoc map[string]interface{}\n\tif err := base.JSONUnmarshal(response.Body.Bytes(), &responseDoc); err != nil {\n\t\tt.Fatalf(\"Error unmarshalling response: %v\", err)\n\t}\n\trevId := responseDoc[\"rev\"].(string)\n\trevGeneration, revIdHash := db.ParseRevID(revId)\n\tassert.Equal(t, 1, revGeneration)\n\n\t// Update doc (normal update, no conflicting revisions added)\n\tresponse = rt.SendAdminRequest(\"PUT\", \"/{{.keyspace}}/\"+docId, fmt.Sprintf(`{\"value\":\"secondval\", db.BodyRev:\"%s\"}`, revId))\n\tresponse.DumpBody()\n\n\t// Create conflict\n\tinput := fmt.Sprintf(`\n {\"value\": \"conflictval\",\n \"_revisions\": {\"start\": 2, \"ids\": [\"conflicting_rev\", \"%s\"]}}`, revIdHash)\n\n\tresponse = rt.SendAdminRequest(\"PUT\", fmt.Sprintf(\"/{{.keyspace}}/%s?new_edits=false\", docId), input)\n\tresponse.DumpBody()\n\tif err := base.JSONUnmarshal(response.Body.Bytes(), &responseDoc); err != nil {\n\t\tt.Fatalf(\"Error unmarshalling response: %v\", err)\n\t}\n\trevId = responseDoc[\"rev\"].(string)\n\trevGeneration, _ = db.ParseRevID(revId)\n\tassert.Equal(t, 2, revGeneration)\n\n\t// Create conflict again, should be a no-op and return the same response as previous attempt\n\tresponse = rt.SendAdminRequest(\"PUT\", fmt.Sprintf(\"/{{.keyspace}}/%s?new_edits=false\", docId), input)\n\tresponse.DumpBody()\n\tif err := base.JSONUnmarshal(response.Body.Bytes(), &responseDoc); err != nil {\n\t\tt.Fatalf(\"Error unmarshalling response: %v\", err)\n\t}\n\trevId = responseDoc[\"rev\"].(string)\n\trevGeneration, _ = db.ParseRevID(revId)\n\tassert.Equal(t, 2, revGeneration)\n\n}", "title": "" }, { "docid": "3730ecfa1f470c761503246720fa2f7d", "score": "0.48493016", "text": "func TestDeadlockDetection(t *testing.T) {\n\ttype TestConfig struct {\n\t\tconf config.Config\n\t\tisErrorExpected bool\n\t\tisReadyExpected bool\n\t}\n\ttests := map[string]TestConfig{\n\t\t\"Ready but deadlocked on WaitAllRsMembersUp\": {\n\t\t\tconf: testConfig(\"testdata/health-status-deadlocked.json\"),\n\t\t\tisReadyExpected: true,\n\t\t},\n\t\t\"Ready but deadlocked on WaitCanUpdate while changing the versions with multiple plans\": {\n\t\t\tconf: testConfig(\"testdata/health-status-deadlocked-with-prev-config.json\"),\n\t\t\tisReadyExpected: true,\n\t\t},\n\t\t\"Ready but deadlocked on WaitHasCorrectAutomationCredentials (HELP-39937, HELP-39966)\": {\n\t\t\tconf: testConfig(\"testdata/health-status-deadlocked-waiting-for-correct-automation-credentials.json\"),\n\t\t\tisReadyExpected: true,\n\t\t},\n\t\t\"Ready and no deadlock detected\": {\n\t\t\tconf: testConfig(\"testdata/health-status-no-deadlock.json\"),\n\t\t\tisReadyExpected: true,\n\t\t},\n\t\t\"Ready and positive scenario\": {\n\t\t\tconf: testConfig(\"testdata/health-status-ok.json\"),\n\t\t\tisReadyExpected: true,\n\t\t},\n\t\t\"Ready and Pod readiness is correctly checked when no ReplicationStatus is present on the file\": {\n\t\t\tconf: testConfig(\"testdata/health-status-no-replication.json\"),\n\t\t\tisReadyExpected: true,\n\t\t},\n\t\t\"Ready and MongoDB replication state is reported by agents\": {\n\t\t\tconf: testConfig(\"testdata/health-status-ok-no-replica-status.json\"),\n\t\t\tisReadyExpected: true,\n\t\t},\n\t\t\"Not Ready If replication state is not PRIMARY or SECONDARY, Pod is not ready\": {\n\t\t\tconf: testConfig(\"testdata/health-status-not-readable-state.json\"),\n\t\t\tisReadyExpected: false,\n\t\t},\n\t\t\"Not Ready because of less than 15 seconds passed by after the health file update\": {\n\t\t\tconf: testConfig(\"testdata/health-status-pending.json\"),\n\t\t\tisReadyExpected: false,\n\t\t},\n\t\t\"Not Ready because there are no plans\": {\n\t\t\tconf: testConfig(\"testdata/health-status-no-plans.json\"),\n\t\t\tisReadyExpected: false,\n\t\t},\n\t\t\"Not Ready because there are no statuses\": {\n\t\t\tconf: testConfig(\"testdata/health-status-no-plans.json\"),\n\t\t\tisReadyExpected: false,\n\t\t},\n\t\t\"Not Ready because there are no processes\": {\n\t\t\tconf: testConfig(\"testdata/health-status-no-processes.json\"),\n\t\t\tisReadyExpected: false,\n\t\t},\n\t\t\"Not Ready because mongod is down for 90 seconds\": {\n\t\t\tconf: testConfigWithMongoUp(\"testdata/health-status-ok.json\", time.Second*90),\n\t\t\tisReadyExpected: false,\n\t\t},\n\t\t\"Not Ready because mongod is down for 1 hour\": {\n\t\t\tconf: testConfigWithMongoUp(\"testdata/health-status-ok.json\", time.Hour*1),\n\t\t\tisReadyExpected: false,\n\t\t},\n\t\t\"Not Ready because mongod is down for 2 days\": {\n\t\t\tconf: testConfigWithMongoUp(\"testdata/health-status-ok.json\", time.Hour*48),\n\t\t\tisReadyExpected: false,\n\t\t},\n\t\t\"Ready and mongod is up for 30 seconds\": {\n\t\t\tconf: testConfigWithMongoUp(\"testdata/health-status-ok.json\", time.Second*30),\n\t\t\tisReadyExpected: true,\n\t\t},\n\t\t\"Ready and mongod is up for 1 second\": {\n\t\t\tconf: testConfigWithMongoUp(\"testdata/health-status-ok.json\", time.Second*30),\n\t\t\tisReadyExpected: true,\n\t\t},\n\t\t\"Not Ready because of mongod bootstrap errors\": {\n\t\t\tconf: testConfigWithMongoUp(\"testdata/health-status-error-tls.json\", time.Second*30),\n\t\t\tisReadyExpected: false,\n\t\t},\n\t\t\"Not Ready because of waiting on an upgrade start in a recomputed plan (a real scenario for an interrupted start in EA)\": {\n\t\t\tconf: testConfigWithMongoUp(\"testdata/health-status-enterprise-upgrade-interrupted.json\", time.Second*30),\n\t\t\tisReadyExpected: false,\n\t\t},\n\t}\n\tfor testName, _ := range tests {\n\t\ttestConfig := tests[testName]\n\t\tt.Run(testName, func(t *testing.T) {\n\t\t\tready, err := isPodReady(testConfig.conf)\n\t\t\tif testConfig.isErrorExpected {\n\t\t\t\tassert.Error(t, err)\n\t\t\t} else {\n\t\t\t\tassert.NoError(t, err)\n\t\t\t}\n\t\t\tassert.Equal(t, testConfig.isReadyExpected, ready)\n\t\t})\n\t}\n}", "title": "" }, { "docid": "e9da2aebe6da414bfa984f0d645c83d9", "score": "0.4844856", "text": "func expectSandboxFailureEvent(f *framework.Framework, pod *v1.Pod, msg string) {\n\teventSelector := fields.Set{\n\t\t\"involvedObject.kind\": \"Pod\",\n\t\t\"involvedObject.name\": pod.Name,\n\t\t\"involvedObject.namespace\": f.Namespace.Name,\n\t\t\"reason\": events.FailedCreatePodSandBox,\n\t}.AsSelector().String()\n\tframework.ExpectNoError(framework.WaitTimeoutForPodEvent(\n\t\tf.ClientSet, pod.Name, f.Namespace.Name, eventSelector, msg, framework.PodEventTimeout))\n}", "title": "" }, { "docid": "32ed990e93a7b06fc63f11bbf9cf00dd", "score": "0.48408398", "text": "func (t ConcT) FailBarrier(name string) {\n\tdefer t.ct.FailBarrier(name)\n\tt.FailNow()\n}", "title": "" }, { "docid": "1bd178575b3e7e171805649622e65617", "score": "0.48246586", "text": "func TestMultipleServerResendUnflushed(t *testing.T) {\n\tlog.Info(\"TestMultipleServerResendUnflushed\")\n\n\tconf := testMultipleServerResendUnflushedConf()\n\tconf.masterStopped = true\n\ttestTwoServers(t, conf)\n}", "title": "" }, { "docid": "5ba568fc9df6b8759d18990281451a7f", "score": "0.48229545", "text": "func TestFilterHostPortConflicts(t *testing.T) {\n\t// Reuse the pod spec with the same port to create a conflict.\n\tspec := api.PodSpec{Containers: []api.Container{{Ports: []api.ContainerPort{{HostPort: 80}}}}}\n\tvar pods = []api.BoundPod{\n\t\t{\n\t\t\tObjectMeta: api.ObjectMeta{\n\t\t\t\tUID: \"123456789\",\n\t\t\t\tName: \"newpod\",\n\t\t\t\tNamespace: \"foo\",\n\t\t\t},\n\t\t\tSpec: spec,\n\t\t},\n\t\t{\n\t\t\tObjectMeta: api.ObjectMeta{\n\t\t\t\tUID: \"987654321\",\n\t\t\t\tName: \"oldpod\",\n\t\t\t\tNamespace: \"foo\",\n\t\t\t},\n\t\t\tSpec: spec,\n\t\t},\n\t}\n\t// Make sure the BoundPods are in the reverse order of creation time.\n\tpods[1].CreationTimestamp = util.NewTime(time.Now())\n\tpods[0].CreationTimestamp = util.NewTime(time.Now().Add(1 * time.Second))\n\tfilteredPods := filterHostPortConflicts(pods)\n\tif len(filteredPods) != 1 {\n\t\tt.Fatalf(\"Expected one pod. Got pods %#v\", filteredPods)\n\t}\n\tif filteredPods[0].Name != \"oldpod\" {\n\t\tt.Fatalf(\"Expected pod %#v. Got pod %#v\", pods[1], filteredPods[0])\n\t}\n\n}", "title": "" }, { "docid": "eb01cc7209c0585cdb0d6f3c300fd631", "score": "0.48073632", "text": "func (r *Replica) checkConflicts(thisLeader int32, instance int32, deps []int32, otherLeader int32) (bool, []int32, bool) {\n\n\t// latest instance from other leader known to this replica\n\totherLeaderCrtInstance := r.crtInstance[otherLeader] - 1\n\tdep := deps[0]\n\n\t// no conflict, seen dep\n\tif dep == otherLeaderCrtInstance {\n\t\treturn false, deps, true\n\t}\n\n\t// no conflict, not seen dep yet\n\tif dep > otherLeaderCrtInstance {\n\t\treturn false, deps, false\n\t}\n\n\tnewDeps := make([]int32, DS)\n\tfor i := 0; i < DS; i++ {\n\t\tnewDeps[i] = deps[i]\n\t}\n\n\t// condition for a conflict:\n\t// If there exists a batch (i) from the other leader, which is later than dep and whose (i's) dep\n\t// is earlier than instance\n\tfor i := otherLeaderCrtInstance; i > dep; i-- {\n\t\tif r.InstanceSpace[otherLeader][i] != nil {\n\t\t\tiDep := r.preAcceptDeps[otherLeader][i]\n\t\t\tif iDep == -1 || iDep < instance {\n\t\t\t\tnewDeps[0] = i\n\t\t\t\treturn true, newDeps, true\n\t\t\t}\n\t\t} else {\n\t\t\t// this should not happen if we enforce the FIFO\n\t\t}\n\t}\n\n\treturn false, deps, true\n}", "title": "" }, { "docid": "e33a469ef449a80ed022b612795f09d1", "score": "0.478199", "text": "func TestSyncdImageListenerFailure(t *testing.T) {\n\tlistenerErr := errors.New(\"image listener internal error\")\n\n\ts := New(\n\t\tblockingChartListener{},\n\t\tnopChartReconciler{},\n\t\tblockingImageListener{ShouldFail: listenerErr},\n\t\tnopImageReconciler{},\n\t)\n\n\terr := s.Run(context.Background())\n\n\tassert.Len(t, err, 2)\n\tassert.Contains(t, err, listenerErr)\n\tassert.Contains(t, err, context.Canceled)\n}", "title": "" }, { "docid": "11077696cb80cfba3bb3ee2cda77f56d", "score": "0.4779387", "text": "func (e *JetKeeperMockAddDropConfirmationExpectation) Then(err error) *JetKeeperMock {\n\te.results = &JetKeeperMockAddDropConfirmationResults{err}\n\treturn e.mock\n}", "title": "" }, { "docid": "d1029c12dcc305ce56dbc66b2e4ced57", "score": "0.47711682", "text": "func fail(err error) error {\n\tfmt.Errorf(\"UpdateProjectBudgets: %v\", err)\n\treturn err\n}", "title": "" }, { "docid": "801f3e0da11dc87c005d49ed48615730", "score": "0.4761394", "text": "func (ctx *CreateWorkItemLinkContext) Conflict(r *JSONAPIErrors) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.api+json\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 409, r)\n}", "title": "" }, { "docid": "35730b6899639a5d5b9d232d2c12f7de", "score": "0.4757057", "text": "func (r *mockCodereview) pretendRollFailed(issue *gerrit.ChangeInfo, tryResults []*buildbucket.Build) {\n\tissue.Labels[gerrit.COMMITQUEUE_LABEL].All[0].Value = gerrit.COMMITQUEUE_LABEL_NONE\n\tr.modify(issue, tryResults)\n}", "title": "" }, { "docid": "8701b4a9bc129a9798bafa0059ae36b9", "score": "0.47495413", "text": "func (jc *JobController) DoFailOverByAction(job client.Object, pods []*corev1.Pod, action FailOverAction) (err error) {\n\n\tklog.Infof(\"failover is triggered for job %s/%s, action: %v\", job.GetNamespace(), job.GetName(), action)\n\n\tswitch action {\n\tcase FailOverRecreate:\n\t\terr = jc.RecreatePods(job, pods)\n\tcase FailOverInPlaceRestart:\n\t\terr = jc.RestartPods(job, pods)\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "e966738b5c3d5413bf2046f5e41e1a2e", "score": "0.4746913", "text": "func ExpectHyperParameterTuningJobToBeDeleted(tuningJob *hpojobv1.HyperparameterTuningJob) {\n\tvar actual hpojobv1.HyperparameterTuningJob\n\terr := k8sClient.Get(context.Background(), types.NamespacedName{\n\t\tNamespace: tuningJob.ObjectMeta.Namespace,\n\t\tName: tuningJob.ObjectMeta.Name,\n\t}, &actual)\n\tExpect(err).To(HaveOccurred())\n\tExpect(apierrs.IsNotFound(err)).To(Equal(true))\n}", "title": "" }, { "docid": "1d2ad454cd7437941588425ef2c575a3", "score": "0.47427902", "text": "func CheckConcurrencyValidation(t *testing.T, provider StoreProvider) {\n\texecute(t, provider, func(store eventsourcing.EventStore) error {\n\t\tfirstInstance := SimpleAggregate{}\n\t\tdummyKey := getDummyKey()\n\t\tfirstInstance.Initialize(dummyKey, GetTestRegistry(), store)\n\t\tfirstInstance.Refresh()\n\t\tfirstInstance.ApplyEvent(InitializeEvent{\n\t\t\tTargetValue: 3,\n\t\t})\n\n\t\tsecondInstance := SimpleAggregate{}\n\t\tsecondInstance.Initialize(dummyKey, GetTestRegistry(), store)\n\t\tsecondInstance.Refresh()\n\t\tsecondInstance.ApplyEvent(InitializeEvent{\n\t\t\tTargetValue: 5,\n\t\t})\n\n\t\tfirstCommitErr := firstInstance.Commit()\n\t\tif firstCommitErr != nil {\n\t\t\treturn firstCommitErr\n\t\t}\n\n\t\tsecondCommitErr := secondInstance.Commit()\n\t\tif secondCommitErr == nil {\n\t\t\treturn fmt.Errorf(\"Got no fault (expected a fault)\")\n\t\t}\n\n\t\tisFault, _ := eventsourcing.IsConcurrencyFault(secondCommitErr)\n\t\tif !isFault {\n\t\t\treturn fmt.Errorf(\"Expected concurrency fault, got: %v\", secondCommitErr)\n\t\t}\n\t\treturn nil\n\t})\n}", "title": "" }, { "docid": "2b604df52a1b5c6b56e12c9646eafe7d", "score": "0.47404674", "text": "func TestReconcileTargetNamespacesNamespaceNotExist(t *testing.T) {\n\ttargetNamespace := \"fred\"\n\tactiveNamespace := \"kabanero\"\n\tk := kabanerov1alpha2.Kabanero{\n\t\tObjectMeta: metav1.ObjectMeta{Name: \"kabanero\", Namespace: \"kabanero\"},\n\t\tSpec: kabanerov1alpha2.KabaneroSpec{\n\t\t\tTargetNamespaces: []string{targetNamespace},\n\t\t},\n\t\tStatus: kabanerov1alpha2.KabaneroStatus {\n\t\t\tTargetNamespaces: kabanerov1alpha2.TargetNamespaceStatus {\n\t\t\t\tNamespaces: []string{activeNamespace},\n\t\t\t\tReady: \"True\",\n\t\t\t},\n\t\t},\n\t}\n\n\t// Set up pre-existing objects\n\texistingNamespaces := make(map[string]bool)\n\texistingNamespaces[activeNamespace] = true\n\texistingRoleBinding := client.ObjectKey{Name: \"kabanero-pipeline-deploy-rolebinding\", Namespace: activeNamespace}\n\texistingRoleBindings := make(map[client.ObjectKey]bool)\n\texistingRoleBindings[existingRoleBinding] = true\n\tclient := targetnamespaceTestClient{existingRoleBindings, existingNamespaces}\n\t\n\terr := reconcileTargetNamespaces(context.TODO(), &k, client, nslog)\n\n\tif err == nil {\n\t\tt.Fatal(\"Did not return an error, but should have because namespace does not exist\")\n\t}\n\n\t// Make sure the kabanero status was not updated with the target namespace,\n\t// since it did not exist.\n\tif len(k.Status.TargetNamespaces.Namespaces) != 0 {\n\t\tt.Fatal(fmt.Sprintf(\"Kabanero status should have 0 target namespace, but has %v: %v\", len(k.Status.TargetNamespaces.Namespaces), k.Status.TargetNamespaces.Namespaces))\n\t}\n\n\tif k.Status.TargetNamespaces.Ready != \"False\" {\n\t\tt.Fatal(fmt.Sprintf(\"Kabanero target namespace status is not False: %v\", k.Status.TargetNamespaces.Ready))\n\t}\n\n\tif len(k.Status.TargetNamespaces.Message) == 0 {\n\t\tt.Fatal(\"Kabanero target namespace status contains no error message\")\n\t}\n\n\t// Make sure the RoleBinding map got cleared.\n\tif len(client.objs) != 0 {\n\t\tt.Fatal(fmt.Sprintf(\"Should have created 0 RoleBindings, but created %v: %#v\", len(client.objs), client.objs))\n\t}\n\n\t// OK, now create the namespace and make sure things resolve as per normal.\n\texistingNamespaces[targetNamespace] = true\n\n\terr = reconcileTargetNamespaces(context.TODO(), &k, client, nslog)\n\n\tif err != nil {\n\t\tt.Fatal(\"Returned error: \" + err.Error())\n\t}\n\n\t// Make sure the kabanero status was updated with the target namespace\n\tif len(k.Status.TargetNamespaces.Namespaces) != 1 {\n\t\tt.Fatal(fmt.Sprintf(\"Kabanero status should have 1 target namespace, but has %v: %v\", len(k.Status.TargetNamespaces.Namespaces), k.Status.TargetNamespaces.Namespaces))\n\t}\n\n\tif k.Status.TargetNamespaces.Namespaces[0] != targetNamespace {\n\t\tt.Fatal(fmt.Sprintf(\"After NS create, Kabanero status target namespace should be %v, but is %v\", targetNamespace, k.Status.TargetNamespaces.Namespaces[0]))\n\t}\n\n\tif k.Status.TargetNamespaces.Ready != \"True\" {\n\t\tt.Fatal(fmt.Sprintf(\"After NS create, Kabanero target namespace status is not True: %v\", k.Status.TargetNamespaces.Ready))\n\t}\n\n\tif len(k.Status.TargetNamespaces.Message) != 0 {\n\t\tt.Fatal(fmt.Sprintf(\"After NS create, Kabanero target namespace status contains an error message: %v\", k.Status.TargetNamespaces.Message))\n\t}\n\n\t// Make sure the RoleBindings got added in the correct namespace.\n\tif len(client.objs) != 2 {\n\t\tt.Fatal(fmt.Sprintf(\"After NS create, should have created two RoleBindings, but created %v: %#v\", len(client.objs), client.objs))\n\t}\n\n\tfor key, _ := range client.objs {\n\t\tif key.Namespace != targetNamespace {\n\t\t\tt.Fatal(fmt.Sprintf(\"After NS create, should have created RoleBinding in %v namespace, but created in %v namespace\", targetNamespace, key.Namespace))\n\t\t}\n\t}\n}", "title": "" }, { "docid": "21325a8651dc19af6988a12321c210a1", "score": "0.47391543", "text": "func (s *Syncer) ensureMeshAgreement(\n\tctx context.Context,\n\tdiffLayer types.LayerID,\n\topinions []*peerOpinion,\n\tresyncPeers map[p2p.Peer]struct{},\n) error {\n\tprevLid := diffLayer.Sub(1)\n\tprevHash, err := layers.GetAggregatedHash(s.cdb, prevLid)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"mesh hash check previous: %w\", err)\n\t}\n\n\tvar (\n\t\tfork types.LayerID\n\t\ted *fetch.EpochData\n\t)\n\tfor _, opn := range opinions {\n\t\tif opn.prevAggHash == (types.Hash32{}) {\n\t\t\tcontinue\n\t\t}\n\t\tif _, ok := resyncPeers[opn.peer]; ok {\n\t\t\tcontinue\n\t\t}\n\t\tif opn.prevAggHash == prevHash {\n\t\t\ts.forkFinder.UpdateAgreement(opn.peer, prevLid, prevHash, time.Now())\n\t\t\tcontinue\n\t\t}\n\n\t\tpeer := opn.peer\n\t\ts.logger.WithContext(ctx).With().Debug(\"found mesh disagreement\",\n\t\t\tlog.Stringer(\"node_prev_hash\", prevHash),\n\t\t\tlog.Stringer(\"peer\", peer),\n\t\t\tlog.Stringer(\"disagreed\", prevLid),\n\t\t\tlog.Stringer(\"peer_hash\", opn.prevAggHash),\n\t\t)\n\n\t\tif !s.forkFinder.NeedResync(prevLid, opn.prevAggHash) {\n\t\t\ts.logger.WithContext(ctx).With().Debug(\"already resynced based on the same diverged hash\",\n\t\t\t\tlog.Stringer(\"node_prev_hash\", prevHash),\n\t\t\t\tlog.Stringer(\"peer\", peer),\n\t\t\t\tlog.Stringer(\"disagreed\", prevLid),\n\t\t\t\tlog.Stringer(\"peer_hash\", opn.prevAggHash),\n\t\t\t)\n\t\t\tcontinue\n\t\t}\n\n\t\t// getting the atx IDs targeting this epoch\n\t\ted, err = s.dataFetcher.PeerEpochInfo(ctx, peer, diffLayer.GetEpoch()-1)\n\t\tif err != nil {\n\t\t\ts.logger.WithContext(ctx).With().Warning(\"failed to get epoch info\",\n\t\t\t\tlog.Stringer(\"peer\", peer),\n\t\t\t\tlog.Err(err),\n\t\t\t)\n\t\t\tcontinue\n\t\t}\n\t\tmissing := make(map[types.ATXID]struct{})\n\t\tfor _, id := range ed.AtxIDs {\n\t\t\tif _, ok := missing[id]; ok {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\thdr, _ := s.cdb.GetAtxHeader(id)\n\t\t\tif hdr == nil {\n\t\t\t\tmissing[id] = struct{}{}\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\tif len(missing) > 0 {\n\t\t\ttoFetch := maps.Keys(missing)\n\t\t\ts.logger.WithContext(ctx).With().Debug(\"fetching missing atxs from peer\",\n\t\t\t\tlog.Stringer(\"peer\", peer),\n\t\t\t\tlog.Array(\"missing_atxs\", log.ArrayMarshalerFunc(func(encoder zapcore.ArrayEncoder) error {\n\t\t\t\t\tfor _, id := range toFetch {\n\t\t\t\t\t\tencoder.AppendString(id.ShortString())\n\t\t\t\t\t}\n\t\t\t\t\treturn nil\n\t\t\t\t})),\n\t\t\t)\n\t\t\t// node and peer has different state. check if peer has valid ATXs to back up its opinions\n\t\t\tif err = s.dataFetcher.GetAtxs(ctx, toFetch); err != nil {\n\t\t\t\t// if the node cannot download the ATXs claimed by this peer, it does not trust this peer's mesh\n\t\t\t\ts.logger.WithContext(ctx).With().Warning(\"failed to download missing ATX claimed by peer\",\n\t\t\t\t\tlog.Stringer(\"peer\", peer),\n\t\t\t\t\tlog.Array(\"missing_atxs\", log.ArrayMarshalerFunc(func(encoder zapcore.ArrayEncoder) error {\n\t\t\t\t\t\tfor _, id := range toFetch {\n\t\t\t\t\t\t\tencoder.AppendString(id.ShortString())\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn nil\n\t\t\t\t\t})),\n\t\t\t\t\tlog.Err(err))\n\t\t\t\tcontinue\n\t\t\t}\n\t\t} else {\n\t\t\ts.logger.WithContext(ctx).With().Debug(\"peer does not have unknown atx\",\n\t\t\t\tlog.Stringer(\"peer\", peer),\n\t\t\t\tlog.Int(\"num_atxs\", len(ed.AtxIDs)),\n\t\t\t)\n\t\t}\n\n\t\t// find the divergent layer and adopt the peer's mesh from there\n\t\tfork, err = s.forkFinder.FindFork(ctx, peer, prevLid, opn.prevAggHash)\n\t\tif err != nil {\n\t\t\ts.logger.WithContext(ctx).With().Warning(\"failed to find fork\",\n\t\t\t\tlog.Stringer(\"peer\", peer),\n\t\t\t\tlog.Err(err),\n\t\t\t)\n\t\t\tcontinue\n\t\t}\n\n\t\tfrom := fork.Add(1)\n\t\tto := from\n\t\tfor lid := from; !lid.After(s.mesh.LatestLayer()); lid = lid.Add(1) {\n\t\t\t// ideally syncer should import opinions from peer and let tortoise decide whether to rerun\n\t\t\t// verifying tortoise or enter full tortoise mode.\n\t\t\t// however, for genesis running full tortoise with 10_000 layers as a sliding window is completely\n\t\t\t// viable. so here we don't sync opinions, just the data.\n\t\t\t// see https://github.com/spacemeshos/go-spacemesh/issues/2507\n\t\t\tif err = s.syncLayer(ctx, lid, peer); err != nil {\n\t\t\t\ts.logger.WithContext(ctx).With().Warning(\"mesh hash failed to sync layer\",\n\t\t\t\t\tlog.Stringer(\"sync_lid\", lid),\n\t\t\t\t\tlog.Err(err))\n\t\t\t}\n\t\t\tto = lid\n\t\t}\n\t\ts.logger.WithContext(ctx).With().Info(\"mesh hash synced data from peer\",\n\t\t\tlog.Stringer(\"peer\", peer),\n\t\t\tlog.Stringer(\"from\", from),\n\t\t\tlog.Stringer(\"to\", to))\n\t\tresyncPeers[opn.peer] = struct{}{}\n\t\ts.forkFinder.AddResynced(prevLid, opn.prevAggHash)\n\t}\n\n\t// clear the agreement cache after syncing new data\n\ts.forkFinder.Purge(true)\n\treturn nil\n}", "title": "" }, { "docid": "76d66f043b4291d13c2ab6471aad6e97", "score": "0.47265625", "text": "func TestEventQueueDeletedFinalStateUnknown(t *testing.T) {\n\tqueue := NewEventQueue(DeletionHandlingMetaNamespaceKeyFunc)\n\n\tobj1 := &metav1.ObjectMeta{Name: \"obj1\", Namespace: \"namespace1\"}\n\tobj2 := &metav1.ObjectMeta{Name: \"obj2\", Namespace: \"namespace1\"}\n\n\t// Make sure objects are in knownObjects but not in the delta queue,\n\t// to ensure we get DeletedFinalStateUnknown delta objects\n\tqueue.knownObjects.Add(obj1)\n\tqueue.knownObjects.Add(obj2)\n\n\t// This should create two DeletedFinalStateUnknown objects\n\tqueue.Replace([]interface{}{}, \"123\")\n\n\t// First test that we get actual DeletedFinalStateUnknown objects\n\tvar called bool\n\tvar processErr error\n\tif _, err := queue.Pop(func(delta cache.Delta) error {\n\t\tcalled = true\n\t\tif _, ok := delta.Object.(cache.DeletedFinalStateUnknown); !ok {\n\t\t\t// Capture error that Pop() logs the error but doesn't return\n\t\t\tprocessErr = fmt.Errorf(\"unexpected item type %T\", delta.Object)\n\t\t\treturn processErr\n\t\t}\n\t\treturn nil\n\t}, nil); err != nil {\n\t\tt.Fatalf(fmt.Sprintf(\"%v\", err))\n\t}\n\tif !called {\n\t\tt.Fatalf(\"Delta pop function wasn't called\")\n\t}\n\tif processErr != nil {\n\t\tt.Fatalf(\"Delta pop function returned error %v\", processErr)\n\t}\n\n\t// Repeat but this time make sure we get the objects we want, not DeletedFinalStateUnknown\n\tqueue = NewEventQueue(DeletionHandlingMetaNamespaceKeyFunc)\n\tqueue.knownObjects.Add(obj1)\n\tqueue.knownObjects.Add(obj2)\n\n\t// This should create two DeletedFinalStateUnknown objects\n\tqueue.Replace([]interface{}{}, \"123\")\n\n\t// Now test that we only get metav1.ObjectMeta objects since we passed that\n\t// as the expected type\n\tcalled = false\n\tif _, err := queue.Pop(func(delta cache.Delta) error {\n\t\tcalled = true\n\t\tif _, ok := delta.Object.(*metav1.ObjectMeta); !ok {\n\t\t\t// Capture error that Pop() logs the error but doesn't return\n\t\t\tprocessErr = fmt.Errorf(\"unexpected item type %T\", delta.Object)\n\t\t\treturn processErr\n\t\t}\n\t\treturn nil\n\t}, &metav1.ObjectMeta{}); err != nil {\n\t\tt.Fatalf(fmt.Sprintf(\"%v\", err))\n\t}\n\tif !called {\n\t\tt.Fatalf(\"Delta pop function wasn't called\")\n\t}\n\tif processErr != nil {\n\t\tt.Fatalf(\"Delta pop function returned error %v\", processErr)\n\t}\n}", "title": "" }, { "docid": "b5f0d7b54ace4ec933ccfa1927a399f5", "score": "0.4724722", "text": "func expectFailure(ctx context.Context, checkoutDir, label, config, define string) error {\n\tstep := fmt.Sprintf(\"Expect building %s with %s to fail\", label, define)\n\treturn td.Do(ctx, td.Props(step), func(ctx context.Context) error {\n\t\trunCmd := &sk_exec.Command{\n\t\t\tName: \"bazelisk\",\n\t\t\tArgs: append([]string{\"build\",\n\t\t\t\tlabel,\n\t\t\t\t\"--config=\" + config, // Should be defined in //bazel/buildrc\n\t\t\t\t\"--copt=-D\" + define + \"=1\",\n\t\t\t}),\n\t\t\tInheritEnv: true, // Makes sure bazelisk is on PATH\n\t\t\tDir: checkoutDir,\n\t\t\tLogStdout: true,\n\t\t\tLogStderr: true,\n\t\t}\n\t\t_, err := sk_exec.RunCommand(ctx, runCmd)\n\t\tif err == nil {\n\t\t\treturn fmt.Errorf(\"Expected a failure but didn't get one.\")\n\t\t}\n\t\treturn nil\n\t})\n}", "title": "" }, { "docid": "7f58045c2e32a009765c65adfc6d9f0a", "score": "0.4723645", "text": "func TestSchemaEnsure_CheckGracefulAbort(t *testing.T) {\n\tcheck := func(ctx context.Context, current int, tx *sql.Tx) error {\n\t\t_, err := tx.Exec(\"CREATE TABLE test (n INTEGER)\")\n\t\trequire.NoError(t, err)\n\t\treturn schema.ErrGracefulAbort\n\t}\n\n\tschema, db := newSchemaAndDB(t)\n\tschema.Add(updateCreateTable)\n\tschema.Check(check)\n\n\t_, err := schema.Ensure(db)\n\trequire.EqualError(t, err, \"schema check gracefully aborted\")\n\n\ttx, err := db.Begin()\n\tassert.NoError(t, err)\n\n\t// The table created by the check function still got committed.\n\t// to insert the row was not.\n\tids, err := query.SelectIntegers(context.Background(), tx, \"SELECT n FROM test\")\n\tassert.NoError(t, err)\n\tassert.Equal(t, []int{}, ids)\n}", "title": "" }, { "docid": "33d014f33c1dc5982d8963ed99c64e1d", "score": "0.47143096", "text": "func TestXactionQueryFinished(t *testing.T) {\n\ttype testConfig struct {\n\t\tbckNil bool\n\t\tkindNil bool\n\t\tshowActive *bool\n\t\texpectedStatsLen int\n\t}\n\tvar (\n\t\txactions = newRegistry()\n\t\tbmd = cluster.NewBaseBownerMock()\n\t\tbck1 = cluster.NewBck(\"test1\", cmn.ProviderAIS, cmn.NsGlobal)\n\t\tbck2 = cluster.NewBck(\"test2\", cmn.ProviderAIS, cmn.NsGlobal)\n\t\ttMock = cluster.NewTargetMock(bmd)\n\t)\n\tbmd.Add(bck1)\n\tbmd.Add(bck2)\n\n\txactBck1, err := xactions.RenewBckFastRename(tMock, \"uuid\", 123, bck1, bck1, \"phase\")\n\ttassert.Errorf(t, err == nil && xactBck1 != nil, \"Xaction must be created\")\n\txactBck2, err := xactions.RenewBckFastRename(tMock, \"uuid\", 123, bck2, bck2, \"phase\")\n\ttassert.Errorf(t, err == nil && xactBck2 != nil, \"Xaction must be created %v\", err)\n\txactBck1.Finish()\n\txactBck1, err = xactions.RenewBckFastRename(tMock, \"uuid\", 123, bck1, bck1, \"phase\")\n\ttassert.Errorf(t, err == nil && xactBck1 != nil, \"Xaction must be created\")\n\t_, err = xactions.RenewEvictDelete(tMock, bck1, &DeletePrefetchArgs{})\n\ttassert.Errorf(t, err == nil && xactBck2 != nil, \"Xaction must be created %v\", err)\n\n\tprintStates := func(showActive *bool) string {\n\t\ts := \"\"\n\t\tif showActive == nil {\n\t\t\ts += \"|RUNNING|FINISHED\"\n\t\t} else {\n\t\t\tif *showActive {\n\t\t\t\ts += \"|RUNNING\"\n\t\t\t} else {\n\t\t\t\ts += \"|FINISHED\"\n\t\t\t}\n\t\t}\n\t\treturn s\n\t}\n\tscenarioName := func(tc testConfig) string {\n\t\tname := \"\"\n\t\tif tc.bckNil {\n\t\t\tname += \"bck:empty\"\n\t\t} else {\n\t\t\tname += \"bck:set\"\n\t\t}\n\t\tif tc.kindNil {\n\t\t\tname += \"/Kind:empty\"\n\t\t} else {\n\t\t\tname += \"/Kind:set\"\n\t\t}\n\t\tname += fmt.Sprintf(\"/States:%s\", printStates(tc.showActive))\n\t\treturn name\n\t}\n\n\tf := func(t *testing.T, tc testConfig) {\n\t\tt.Run(scenarioName(tc), func(t *testing.T) {\n\t\t\tquery := RegistryXactFilter{}\n\t\t\tif !tc.bckNil {\n\t\t\t\tquery.Bck = bck1\n\t\t\t}\n\t\t\tif !tc.kindNil {\n\t\t\t\tquery.Kind = xactBck1.Kind()\n\t\t\t}\n\t\t\tquery.OnlyRunning = tc.showActive\n\t\t\tstats, err := xactions.GetStats(query)\n\t\t\ttassert.Errorf(t, err == nil, \"Error fetching Xact Stats %v for query %v\", err, query)\n\t\t\ttassert.Errorf(t, len(stats) == tc.expectedStatsLen, \"Length of result: %d != %d\", len(stats), tc.expectedStatsLen)\n\t\t})\n\t}\n\ttests := []testConfig{\n\t\t{bckNil: true, kindNil: true, showActive: api.Bool(false), expectedStatsLen: 1},\n\t\t{bckNil: true, kindNil: false, showActive: api.Bool(false), expectedStatsLen: 1},\n\t\t{bckNil: false, kindNil: true, showActive: api.Bool(false), expectedStatsLen: 1},\n\t\t{bckNil: false, kindNil: false, showActive: api.Bool(false), expectedStatsLen: 1},\n\t}\n\tfor _, test := range tests {\n\t\tf(t, test)\n\t}\n}", "title": "" }, { "docid": "e2d16ed60380c3162d06fdad76f18914", "score": "0.4707426", "text": "func TestDeployAbortOperation(t *testing.T) {\n\tres, err := GC.AbortOperation()\n\tassert.NotNil(t, res)\n\tassert.EqualValues(t, res.StatusCode, 200)\n\tassert.Nil(t, err)\n}", "title": "" }, { "docid": "2914393402bb4a4474a799a5ccd33d48", "score": "0.47022942", "text": "func (s *scheduler) processGangFailure(\n\tn respool.ResPool,\n\tgang *resmgrsvc.Gang,\n\tinvalidTasks map[string]error) *resmgrsvc.Gang {\n\tvar newTasks []*resmgr.Task\n\tvar deletedTasks []*resmgr.Task\n\n\tfor _, t := range gang.Tasks {\n\t\tif err, ok := invalidTasks[t.Id.Value]; ok {\n\t\t\tif err != errTaskIsNotPresent {\n\t\t\t\tnewTasks = append(newTasks, t)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tdeletedTasks = append(deletedTasks, t)\n\t\t}\n\t}\n\n\tif len(deletedTasks) > 0 {\n\t\t// we can not dequeue this gang Dropping them\n\t\t// As they can block the whole resource pool.\n\t\t// It could happen that the tasks have been killed\n\t\t// (Since the time they have been dequeued) and\n\t\t// removed from the tracker, so we need to drop\n\t\t// them from scheduling and remove their resources\n\t\t// from the resource pool allocation.\n\t\tlog.WithError(errTaskIsNotPresent).WithFields(log.Fields{\n\t\t\t\"deleted_tasks\": deletedTasks,\n\t\t\t\"from\": pt.TaskState_PENDING.String(),\n\t\t\t\"to\": pt.TaskState_READY.String(),\n\t\t}).Info(\"Removing deleted tasks\")\n\t\t// We need to remove the allocation from the resource pool\n\t\t// We are deleting allocation only for deleted tasks\n\t\tif err := n.SubtractFromAllocation(\n\t\t\tscalar.GetGangAllocation(\n\t\t\t\t&resmgrsvc.Gang{\n\t\t\t\t\tTasks: deletedTasks,\n\t\t\t\t})); err != nil {\n\t\t\tlog.WithField(\"gang\", gang).\n\t\t\t\tWithError(err).\n\t\t\t\tError(\"not able to remove allocation from respool\")\n\t\t}\n\t}\n\n\t// All the tasks are deleted from the gang, returning nil\n\tif len(newTasks) == 0 {\n\t\treturn nil\n\t}\n\n\t// Creating new gang with remaining tasks\n\treturn &resmgrsvc.Gang{\n\t\tTasks: newTasks,\n\t}\n}", "title": "" }, { "docid": "27865d15f130a8b52ae4de357a2ce0c7", "score": "0.4701641", "text": "func (ctx *UpdateWorkitemContext) Conflict(r *JSONAPIErrors) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.api+json\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 409, r)\n}", "title": "" }, { "docid": "276967e78b478c6a87cc0245eab3f93b", "score": "0.46993136", "text": "func TestValidateFail(t *testing.T) {\n\t// start OpenConfigd\n\tocd, err := startOcd(\"\")\n\tif err != nil {\n\t\tt.Fatalf(\"Couldn't start OpenConfigd.: %v\\n\", err)\n\t}\n\tSetOcdServer(\"\", uint16(2650))\n\n\t//start a client\n\tcli := &client{\n\t\tname: \"validateFail-client\",\n\t\tsubscribePaths: subscribePaths,\n\t\tvalResult: false,\n\t\tconfc: make(chan *ConfigMessage),\n\t\tt: t,\n\t}\n\tif err := cli.Start(); err != nil {\n\t\tocd.Process.Kill()\n\t\tt.Fatalf(\"Couldn't start %v: %v\\n\", cli.name, err)\n\t}\n\n\t// Add new configuration from cli\n\tif err := doSetCli(setNICmd); err != nil {\n\t\tcli.Stop()\n\t\tocd.Process.Kill()\n\t\tt.Fatal(err)\n\t}\n\t// Validate\n\tc := <-cli.confc\n\tif err := c.judgeConfResult(CM_Validate, expNI, false); err != nil {\n\t\tcli.Stop()\n\t\tocd.Process.Kill()\n\t\tt.Fatal(err)\n\t}\n\t// Commit\n\tselect {\n\tcase <-cli.confc:\n\t\tcli.Stop()\n\t\tocd.Process.Kill()\n\t\tt.Fatalf(\"Received a commit message unexpectedly.\\n\")\n\n\tcase <-time.After(TIMEOUT * time.Millisecond):\n\t\tt.Log(\"Didn't receive a commit message expectedly.\")\n\t}\n\n\t// tear down\n\tcli.Stop()\n\tif err := ocd.Process.Kill(); err != nil {\n\t\tt.Fatal(\"Couldn't stop OpenConfigd.: %v\", err)\n\t}\n\n\tt.Log(\"Client didn't receive a commit message after return validation failed, test passed.\")\n}", "title": "" }, { "docid": "ba3dc5e4b707ef5780c85f4da55c48b9", "score": "0.46950525", "text": "func (nl *NotificationListener) PropagateFinalityConflictNotifications() {\n\tnl.propagateFinalityConflictNotifications = true\n}", "title": "" }, { "docid": "4cee3db872ac4238e8af97d086aab133", "score": "0.46938854", "text": "func Test_upsertJob(t *testing.T) {\n\tkubeClient := fake.NewSimpleClientset()\n\n\trelease := genDummyRelease()\n\n\t// create\n\n\twant := &batchv1.Job{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: release.BlockName,\n\t\t\tLabels: release.Labels,\n\t\t\tNamespace: release.EnvId,\n\t\t},\n\t\tSpec: batchv1.JobSpec{\n\t\t\tActiveDeadlineSeconds: pointer.Int64Ptr(int64(release.JobSpec.TimeoutInSec)),\n\t\t\tBackoffLimit: pointer.Int32Ptr(0),\n\t\t\tTemplate: corev1.PodTemplateSpec{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tLabels: types.EnrichLabels(release.Labels, release.Id),\n\t\t\t\t},\n\t\t\t\tSpec: corev1.PodSpec{\n\t\t\t\t\tContainers: []corev1.Container{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: release.BlockName,\n\t\t\t\t\t\t\tImage: release.Image,\n\t\t\t\t\t\t\tEnv: []corev1.EnvVar{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"dummyKey0\",\n\t\t\t\t\t\t\t\t\tValue: \"dummyVal0\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tResources: corev1.ResourceRequirements{\n\t\t\t\t\t\t\t\tLimits: corev1.ResourceList{\n\t\t\t\t\t\t\t\t\tcorev1.ResourceMemory: resource.MustParse(release.Memory),\n\t\t\t\t\t\t\t\t\tcorev1.ResourceCPU: resource.MustParse(release.Cpu),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tRequests: corev1.ResourceList{\n\t\t\t\t\t\t\t\t\tcorev1.ResourceMemory: resource.MustParse(release.Memory),\n\t\t\t\t\t\t\t\t\tcorev1.ResourceCPU: resource.MustParse(release.Cpu),\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\tRestartPolicy: \"Never\",\n\t\t\t\t\tAutomountServiceAccountToken: pointer.BoolPtr(false),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\tgot, _ := upsertJob(kubeClient, release)\n\n\tif diff.Changed(want, got) {\n\t\tchangelog, _ := diff.Diff(want, got)\n\t\tt.Errorf(\"upsertJob_Create(fakeClient, %v); got and want different - %v\", release, changelog)\n\t}\n\n\t// update\n\t// should delete and create a new job\n\n\trelease.EnvVars[\"dummyKey1\"] = \"dummyVal1\"\n\n\twant = genJobObject(release)\n\twant.Namespace = release.EnvId\n\n\tgot, _ = upsertJob(kubeClient, release)\n\n\tif diff.Changed(want, got) {\n\t\tchangelog, _ := diff.Diff(want, got)\n\t\tt.Errorf(\"upsertJob_Update(fakeClient, %v); got and want different - %v\", release, changelog)\n\t}\n}", "title": "" }, { "docid": "b51f90c6bc6ef6964cc03dd9dcffc617", "score": "0.46935874", "text": "func TestSchemaEnsure_FailingHook(t *testing.T) {\n\tschema, db := newSchemaAndDB(t)\n\tschema.Add(updateCreateTable)\n\tschema.Hook(func(context.Context, int, *sql.Tx) error { return fmt.Errorf(\"boom\") })\n\t_, err := schema.Ensure(db)\n\tassert.EqualError(t, err, \"failed to execute hook (version 0): boom\")\n\n\ttx, err := db.Begin()\n\tassert.NoError(t, err)\n\n\t// Not update was applied.\n\ttables, err := query.SelectStrings(context.Background(), tx, \"SELECT name FROM sqlite_master WHERE type = 'table'\")\n\tassert.NoError(t, err)\n\tassert.NotContains(t, tables, \"schema\")\n\tassert.NotContains(t, tables, \"test\")\n}", "title": "" }, { "docid": "cbf0f1fde0ec7e617da1320115e081a8", "score": "0.46890345", "text": "func TestDropWithRunningPeerIsError(t *testing.T) {\n\tenv := initTestEnv(t)\n\n\t// env maintains an opened transient storage provider.\n\tsp := env.storeProvider.(*storeProvider)\n\trequire.NotNil(t, sp)\n\trequire.True(t, sp.fileLock.IsLocked())\n\n\t// Dropping while a provider is open is an error.\n\terr := Drop(env.storedir, \"some-magical-invalid-ledger-which-does-not-exist\")\n\trequire.Error(t, err, \"as another peer node command is executing,\"+\n\t\t\" wait for that command to complete its execution or terminate it before retrying\")\n}", "title": "" }, { "docid": "db96f1f30b50d7892cb503c39e74c4f6", "score": "0.46878493", "text": "func (j *Job) Conflicts() []string {\n\tconflicts, ok := j.Requirements()[fleetXConflicts]\n\tif ok {\n\t\treturn conflicts\n\t}\n\treturn make([]string, 0)\n}", "title": "" }, { "docid": "79bd90e7ec1a1a66d12751a2ce1dd62d", "score": "0.46824473", "text": "func TestReconcileActiveVersionsBadAsset(t *testing.T) {\n\t// The server that will host the pipeline zip\n\tserver := httptest.NewServer(stackHandler{})\n\tdefer server.Close()\n\n\tpipelineZipUrl := server.URL + badPipeline.name\n\tdesiredStack := Stack{\n\t\tName: \"java-microprofile\",\n\t\tId: \"java-microprofile\",\n\t\tVersion: \"0.2.5\",\n\t\tPipelines: []Pipelines{{Id: \"default\", Sha256: badPipeline.sha256, Url: pipelineZipUrl}},\n\t}\n\n\tstackResource := kabanerov1alpha2.Stack{\n\t\tObjectMeta: metav1.ObjectMeta{UID: myuid, Namespace: \"kabanero\"},\n\t\tSpec: kabanerov1alpha2.StackSpec{\n\t\t\tName: \"java-microprofile\",\n\t\t\tVersions: []kabanerov1alpha2.StackVersion{{\n\t\t\t\tVersion: \"0.2.5\",\n\t\t\t\tDesiredState: \"active\",\n\t\t\t\tPipelines: []kabanerov1alpha2.PipelineSpec{{\n\t\t\t\t\tId: desiredStack.Pipelines[0].Id,\n\t\t\t\t\tSha256: desiredStack.Pipelines[0].Sha256,\n\t\t\t\t\tHttps: kabanerov1alpha2.HttpsProtocolFile{Url: desiredStack.Pipelines[0].Url, SkipCertVerification: true},\n\t\t\t\t}},\n\t\t\t}},\n\t\t},\n\t\tStatus: kabanerov1alpha2.StackStatus{},\n\t}\n\n\tclient := unitTestClient{map[client.ObjectKey][]metav1.OwnerReference{}}\n\n\terr := reconcileActiveVersions(&stackResource, client, sctlog)\n\n\tif err != nil {\n\t\tt.Fatal(\"Returned error: \" + err.Error())\n\t}\n\n\t// Make sure the stack resource was updated with asset information\n\tif len(stackResource.Status.Versions[0].Pipelines) != 1 {\n\t\tt.Fatal(fmt.Sprintf(\"Stack status should have 1 pipeline, but has %v\", len(stackResource.Status.Versions[0].Pipelines)))\n\t}\n\n\tif stackResource.Status.Versions[0].Version != \"0.2.5\" {\n\t\tt.Fatal(fmt.Sprintf(\"Stack active version should be 0.2.5, but is %v\", stackResource.Status.Versions[0].Version))\n\t}\n\n\t// Make sure the assets were created in the stack status\n\tpipeline := stackResource.Status.Versions[0].Pipelines[0]\n\tif len(pipeline.ActiveAssets) != 2 {\n\t\tt.Fatal(fmt.Sprintf(\"Pipeline should have 2 assets, but has %v\", len(pipeline.ActiveAssets)))\n\t}\n\n\tfoundPipeline, foundTask := false, false\n\tfor _, asset := range pipeline.ActiveAssets {\n\t\tif asset.Name == \"java-microprofile-build-pipeline\" {\n\t\t\tif asset.Status != utils.AssetStatusActive {\n\t\t\t\tt.Fatal(fmt.Sprintf(\"Asset %v should have status active, but is %v\", asset.Name, asset.Status))\n\t\t\t}\n\t\t\tif asset.StatusMessage != \"\" {\n\t\t\t\tt.Fatal(fmt.Sprintf(\"Asset %v should have no status message, but has %v\", asset.Name, asset.StatusMessage))\n\t\t\t}\n\t\t\tfoundTask = true\n\t\t}\n\t\tif asset.Name == \"java-microprofile-build-task\" {\n\t\t\tif asset.Status != utils.AssetStatusFailed {\n\t\t\t\tt.Fatal(fmt.Sprintf(\"Asset %v should have status failed, but is %v\", asset.Name, asset.Status))\n\t\t\t}\n\t\t\tif asset.StatusMessage == \"\" {\n\t\t\t\tt.Fatal(fmt.Sprintf(\"Asset %v should have a status message, but has none\", asset.Name))\n\t\t\t}\n\t\t\tfoundPipeline = true\n\t\t}\n\t}\n\n\tif foundTask == false || foundPipeline == false {\n\t\tt.Fatal(fmt.Sprintf(\"Did not find expected assets: %v\", pipeline.ActiveAssets))\n\t}\n\n\t// Make sure the client has the correct objects.\n\tif len(client.objs) != 1 {\n\t\tt.Fatal(fmt.Sprintf(\"Client map should have 1 entry, but has %v: %v\", len(client.objs), client.objs))\n\t}\n\n\t// Make sure the client's objects have an owner set.\n\tfor key, obj := range client.objs {\n\t\tif len(obj) != 1 {\n\t\t\tt.Fatal(fmt.Sprintf(\"Client object %v should have 1 owner, but has %v: %v\", key, len(obj), obj))\n\t\t}\n\t\tif obj[0].UID != stackResource.UID {\n\t\t\tt.Fatal(fmt.Sprintf(\"Client object %v should have owner UID %v but has %v\", key, stackResource.UID, obj[0].UID))\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f1ae861a5e2796654ce7e51de2ab2f8d", "score": "0.46797383", "text": "func (nl *NotificationListener) PropagateFinalityConflictResolvedNotifications() {\n\tnl.propagateFinalityConflictResolvedNotifications = true\n}", "title": "" }, { "docid": "e1cb102fdae9b02873312203713d9ced", "score": "0.46760407", "text": "func (ctx *CreateSpaceIterationsContext) Conflict(r *JSONAPIErrors) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.api+json\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 409, r)\n}", "title": "" }, { "docid": "c2b9417e39f252ff5dacad251f34e413", "score": "0.46743956", "text": "func failZeebeJob(client worker.JobClient, job entities.Job, err error) {\n\tif err != nil {\n\t\tlog.Printf(\"error handling action: %v\\n\", err)\n\t}\n\n\tpayload, err := job.GetPayloadAsMap()\n\tif err != nil {\n\t\tlog.Fatalf(\"error getting payload: %v\", err)\n\t\treturn\n\t}\n\tpayload[\"error\"] = true\n\n\treq, err := client.NewCompleteJobCommand().JobKey(job.Key).PayloadFromMap(payload)\n\tif err != nil {\n\t\tlog.Fatalf(\"error completing job: %v\", err)\n\t\treturn\n\t}\n\n\tif _, err := req.Send(); err != nil {\n\t\tlog.Fatalf(\"error sending request: %v\", err)\n\t\treturn\n\t}\n\n\tlog.Println(\"Failed job\", job.JobHeaders.ElementId, \"of type\", job.Type)\n}", "title": "" }, { "docid": "d59d9758a2f3df87bfc982dba5d247e4", "score": "0.46714905", "text": "func TestLeaderVoteNotConflict(t *testing.T) {\n\tassertion := func(t *testing.T, numInstances int) {\n\t\tsuite := setupWithCustomConfig(t, numInstances, func(c *Config) {\n\t\t\tc.Masters[0].Quorum = numInstances/2 + 1 // force normal quorum\n\t\t})\n\t\tsuite.master.kill()\n\t\ttime.Sleep(suite.conf.Masters[0].DownAfter)\n\n\t\t// check if a given sentinel is in sdown state, and holds for a long time\n\t\t// others still see master is up\n\t\tgr := errgroup.Group{}\n\t\tsuite.mu.Lock()\n\t\tsuite.termsVote[1] = make([]termInfo, len(suite.instances))\n\t\tsuite.mu.Unlock()\n\t\tfor idx := range suite.instances {\n\t\t\tinstanceIdx := idx\n\t\t\tgr.Go(func() error {\n\t\t\t\tsuite.checkTermVoteOfSentinel(t, instanceIdx, 1)\n\t\t\t\treturn nil\n\t\t\t})\n\t\t}\n\t\tgr.Wait()\n\n\t\tgr2 := errgroup.Group{}\n\t\tfor idx := range suite.instances {\n\t\t\tlocalSentinel := suite.instances[idx]\n\t\t\tm := getSentinelMaster(defaultMasterAddr, localSentinel)\n\t\t\tm.mu.Lock()\n\n\t\t\tfor sentinelIdx := range m.sentinels {\n\t\t\t\tsi := m.sentinels[sentinelIdx]\n\t\t\t\tsi.mu.Lock()\n\t\t\t\tneighborID := si.runID\n\t\t\t\tsi.mu.Unlock()\n\n\t\t\t\tinstanceIdx := idx\n\n\t\t\t\tgr2.Go(func() error {\n\t\t\t\t\tsuite.checkTermVoteOfSentinelNeighbor(t, instanceIdx, neighborID, 1)\n\t\t\t\t\treturn nil\n\t\t\t\t})\n\t\t\t}\n\t\t\tm.mu.Unlock()\n\t\t}\n\t\tgr2.Wait()\n\n\t\tfor idx := range suite.instances {\n\t\t\tthisInstanceHistory := suite.termsVote[1][idx]\n\t\t\tthisInstanceVote := thisInstanceHistory.selfVote\n\n\t\t\tthisInstanceID := suite.instances[idx].runID\n\n\t\t\tfor idx2 := range suite.instances {\n\t\t\t\tif idx2 == idx {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tneiborInstanceVote := suite.termsVote[1][idx2]\n\t\t\t\tif neiborInstanceVote.neighborVotes[thisInstanceID] != thisInstanceVote {\n\t\t\t\t\tassert.Failf(t, \"conflict vote between instances\",\n\t\t\t\t\t\t\"instance %s records that instance %s voted for %s, but %s says it voted for %s\",\n\t\t\t\t\t\tsuite.instances[idx2].runID,\n\t\t\t\t\t\tthisInstanceID,\n\t\t\t\t\t\tneiborInstanceVote.neighborVotes[thisInstanceID],\n\t\t\t\t\t\tthisInstanceID,\n\t\t\t\t\t\tthisInstanceVote,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// 1.for each instance, compare its vote with how other instances records its vote\n\t\t// 2.record each instance leader, find real leader of that term\n\t\t// 3.find that real leader and check if its failover state is something in selecting slave\n\t}\n\tt.Run(\"3 instances do not conflict\", func(t *testing.T) {\n\t\tassertion(t, 3)\n\t})\n}", "title": "" }, { "docid": "eb2b8ead70fb7d092a56fc8c8ed0aca8", "score": "0.4671328", "text": "func (m *JetKeeperMock) MinimockAddDropConfirmationDone() bool {\n\tfor _, e := range m.AddDropConfirmationMock.expectations {\n\t\tif mm_atomic.LoadUint64(&e.Counter) < 1 {\n\t\t\treturn false\n\t\t}\n\t}\n\n\t// if default expectation was set then invocations count should be greater than zero\n\tif m.AddDropConfirmationMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterAddDropConfirmationCounter) < 1 {\n\t\treturn false\n\t}\n\t// if func was set then invocations count should be greater than zero\n\tif m.funcAddDropConfirmation != nil && mm_atomic.LoadUint64(&m.afterAddDropConfirmationCounter) < 1 {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "8163a1bc389995bc3ec9cd48bc5cf38c", "score": "0.46685174", "text": "func TestFailedContractRenewalAlert(t *testing.T) {\n\tif testing.Short() {\n\t\tt.SkipNow()\n\t}\n\tt.Parallel()\n\n\t// Create a testgroup.\n\tgroupParams := siatest.GroupParams{\n\t\tHosts: 2, // Need two host in order to upload. Min 1 datapiece and 1 paritypiece\n\t\tMiners: 1,\n\t}\n\ttestDir := contractorTestDir(t.Name())\n\ttg, err := siatest.NewGroupFromTemplate(testDir, groupParams)\n\tif err != nil {\n\t\tt.Fatal(\"Failed to create group: \", err)\n\t}\n\tdefer func() {\n\t\tif err := tg.Close(); err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t}()\n\n\t// Add a renter which won't be able to renew a contract.\n\trenterParams := node.Renter(filepath.Join(testDir, \"renter\"))\n\trenterParams.Allowance = siatest.DefaultAllowance\n\trenterParams.Allowance.Period = 10\n\trenterParams.Allowance.RenewWindow = 5\n\trenterParams.RenterDeps = &dependencies.DependencyDisableUploadGougingCheck{}\n\tdeps := dependencies.NewDependencyContractRenewalFail()\n\trenterParams.ContractorDeps = deps\n\tnodes, err := tg.AddNodes(renterParams)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tr := nodes[0]\n\n\t// The daemon shouldn't have any alerts besides the 3 testing alerts per\n\t// module.\n\tdag, err := r.DaemonAlertsGet()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif len(dag.Alerts) != 12 {\n\t\tt.Fatal(\"number of alerts is not 0\", len(dag.Alerts))\n\t}\n\n\t// Mine blocks to force contract renewal\n\terr = siatest.RenewContractsByRenewWindow(r, tg)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Check for alert\n\texpectedAlert := modules.Alert{\n\t\tSeverity: modules.SeverityCritical,\n\t\tCause: \"Renew failure due to dependency\",\n\t\tMsg: contractor.AlertMSGFailedContractRenewal,\n\t\tModule: \"contractor\",\n\t}\n\tm := tg.Miners()[0]\n\tnumTries := 0\n\terr = build.Retry(100, 100*time.Millisecond, func() error {\n\t\tnumTries++\n\t\tif numTries%10 == 0 {\n\t\t\terr = m.MineBlock()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\t// Since this alert cause can be multiple composed errors it can not use\n\t\t// the IsAlertRegistered helper method\n\t\tdag, err := r.DaemonAlertsGet()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, alert := range dag.Alerts {\n\t\t\tif alert.EqualsWithErrorCause(expectedAlert, expectedAlert.Cause) {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\treturn errors.New(\"alert is not registered\")\n\t})\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Disable the Dependency\n\tdeps.Disable()\n\n\t// The alert should now be cleared\n\tnumTries = 0\n\terr = build.Retry(100, 100*time.Millisecond, func() error {\n\t\tif numTries%10 == 0 {\n\t\t\terr = m.MineBlock()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\tnumTries++\n\t\t// Since this alert cause can be multiple composed errors it can not use\n\t\t// the IsAlertUnregistered helper method\n\t\tdag, err := r.DaemonAlertsGet()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, alert := range dag.Alerts {\n\t\t\tif alert.EqualsWithErrorCause(expectedAlert, expectedAlert.Cause) {\n\t\t\t\treturn errors.New(\"alert is registered\")\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\n\t// Wait for active contracts\n\tnumTries = 0\n\terr = build.Retry(100, 100*time.Millisecond, func() error {\n\t\tif numTries%10 == 0 {\n\t\t\terr = m.MineBlock()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\tnumTries++\n\t\treturn siatest.CheckExpectedNumberOfContracts(r, len(tg.Hosts()), 0, 0, 0, len(tg.Hosts()), 0)\n\t})\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Enable the dependency\n\tdeps.Enable()\n\n\t// Drain contracts\n\t_, err = siatest.DrainContractsByUploading(r, tg)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Confirm alert is registered for refresh\n\tnumTries = 0\n\terr = build.Retry(100, 100*time.Millisecond, func() error {\n\t\tif numTries%10 == 0 {\n\t\t\terr = m.MineBlock()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\tnumTries++\n\t\t// Since this alert casuse can be multiple composed errors it can not\n\t\t// use the IsAlertRegistered helper method\n\t\tdag, err := r.DaemonAlertsGet()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, alert := range dag.Alerts {\n\t\t\tif alert.EqualsWithErrorCause(expectedAlert, expectedAlert.Cause) {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\treturn errors.New(\"alert is not registered\")\n\t})\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\n\t// Disable the Dependency\n\tdeps.Disable()\n\n\t// The alert should now be cleared\n\tnumTries = 0\n\terr = build.Retry(100, 100*time.Millisecond, func() error {\n\t\tif numTries%10 == 0 {\n\t\t\terr = m.MineBlock()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\tnumTries++\n\t\t// Since this alert casuse can be multiple composed errors it can not\n\t\t// use the IsAlertUnregistered helper method\n\t\tdag, err := r.DaemonAlertsGet()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, alert := range dag.Alerts {\n\t\t\tif alert.EqualsWithErrorCause(expectedAlert, expectedAlert.Cause) {\n\t\t\t\treturn errors.New(\"alert is registered\")\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\n\t// Trigger the renew alert with a lower alert level by causing renewal\n\t// failures with only one host.\n}", "title": "" }, { "docid": "9225dc68deff3a349ffb2e7047be7090", "score": "0.46639308", "text": "func TestFailedAssets(t *testing.T) {\n\tvar sampleAsset = []kabanerov1alpha2.RepositoryAssetStatus{{Name: \"myAsset\", Digest: \"678910\", Status: \"active\"},\n\t\t{Name: \"myAsset2\", Digest: \"678911\", Status: \"failed\", StatusMessage: \"some failure\"},\n\t}\n\n\tvar samplePipelineStatus = []kabanerov1alpha2.PipelineStatus{{Name: \"myAsset\", Url: \"http://myurl.com\", Digest: \"1234\", ActiveAssets: sampleAsset}}\n\tvar sampleStackVersionStatus = []kabanerov1alpha2.StackVersionStatus{{Version: \"\", Location: \"\", Pipelines: samplePipelineStatus, Status: \"\", StatusMessage: \"\"}}\n\tstatus := kabanerov1alpha2.StackStatus{Versions: sampleStackVersionStatus}\n\n\tif failedAssets(status) == false {\n\t\tt.Fatal(\"Should be one failed asset in the status\")\n\t}\n}", "title": "" }, { "docid": "9225dc68deff3a349ffb2e7047be7090", "score": "0.46639308", "text": "func TestFailedAssets(t *testing.T) {\n\tvar sampleAsset = []kabanerov1alpha2.RepositoryAssetStatus{{Name: \"myAsset\", Digest: \"678910\", Status: \"active\"},\n\t\t{Name: \"myAsset2\", Digest: \"678911\", Status: \"failed\", StatusMessage: \"some failure\"},\n\t}\n\n\tvar samplePipelineStatus = []kabanerov1alpha2.PipelineStatus{{Name: \"myAsset\", Url: \"http://myurl.com\", Digest: \"1234\", ActiveAssets: sampleAsset}}\n\tvar sampleStackVersionStatus = []kabanerov1alpha2.StackVersionStatus{{Version: \"\", Location: \"\", Pipelines: samplePipelineStatus, Status: \"\", StatusMessage: \"\"}}\n\tstatus := kabanerov1alpha2.StackStatus{Versions: sampleStackVersionStatus}\n\n\tif failedAssets(status) == false {\n\t\tt.Fatal(\"Should be one failed asset in the status\")\n\t}\n}", "title": "" }, { "docid": "1c12eb69cdb3e4fcd0df4eef4b302206", "score": "0.4657576", "text": "func TestCourseCreationConflictCourse(t *testing.T) {\n\tcoursehandler.InitializeDynamoDbClient()\n\n\tjsonBody := simplejson.New()\n\tjsonBody.Set(\"name\", \"testexistentcourse\")\n\tjsonBody.Set(\"department\", \"testdepartment\")\n\tjsonBody.Set(\"year\", \"2018-2019\")\n\n\trequestBody, _ := jsonBody.MarshalJSON()\n\trequest, _ := http.NewRequest(http.MethodPost, \"/notification_management/api/v1.0/course\", bytes.NewBuffer(requestBody))\n\trequest.Header.Set(\"Content-Type\", \"application/json\")\n\n\tresponse := httptest.NewRecorder()\n\thandler := createTestMicroserviceCourseCreation()\n\t// simulates a request-response interaction between client and microservice\n\thandler.ServeHTTP(response, request)\n\n\tif response.Code != http.StatusConflict {\n\t\tt.Error(\"Expected 409 Conflict but got \" + strconv.Itoa(response.Code) + \" \" + http.StatusText(response.Code))\n\t}\n}", "title": "" }, { "docid": "e22107d89a48a704645e5332c9f9c8c2", "score": "0.46573734", "text": "func TestUnanimousBlamesLeadToServerBan(t *testing.T) {\n\tpoolSize := 5\n\th := newTestHarness(t, poolSize)\n\ttroubleClient := newTestClient(h)\n\texpectedBanData := make([]testServerBanData, 0)\n\n\t// repeat the new pool and blame process until troubleClient is banned\n\tfor i := 0; i < maxBanScore; i++ {\n\t\t// make a new pool\n\t\totherClients := h.NewPool(poolSize, testAmount, testVersion, troubleClient)\n\t\tallClients := append([]*testClient{troubleClient}, otherClients...)\n\t\t// everyone say something to avoid passive ban\n\t\tfor _, c := range allClients {\n\t\t\tc.BroadcastVerificationKey(allClients)\n\t\t}\n\n\t\t// all but one other client blames troubleClient\n\t\totherClients[0].Blame(troubleClient, allClients)\n\n\t\t// troubleClient tries to avoid blame by disconnecting!\n\t\t// It should not work - troubleClient should still be banned eventually.\n\t\ttroubleClient.Disconnect()\n\n\t\t// Blames continue.\n\t\t// Also since troubleClient disconnected, we only expect notifications\n\t\t// to go to remaining clients.\n\t\totherClients[1].Blame(troubleClient, otherClients)\n\n\t\t// duplicate blames from the same client should not be counted twice!\n\t\totherClients[2].Blame(troubleClient, otherClients)\n\t\totherClients[2].Blame(troubleClient, otherClients)\n\n\t\t// ban score does not change yet because it is not a unanimous vote\n\t\th.AssertServerBans(expectedBanData)\n\t\t// the last other client also blames troubleClient\n\t\t// this should cause troubleClient to be banned from the current pool\n\t\totherClients[3].Blame(troubleClient, otherClients)\n\t\t// troubleClient also gets a new or increased ban score\n\t\t// because this is now a unanimous vote\n\t\tif len(expectedBanData) == 0 {\n\t\t\t// create new ban score\n\t\t\texpectedBanData = append(expectedBanData, testServerBanData{\n\t\t\t\tclient: troubleClient,\n\t\t\t\tbanData: banData{score: 1},\n\t\t\t})\n\t\t} else {\n\t\t\t// increase existing ban score\n\t\t\texpectedBanData[0].banData.score++\n\t\t}\n\t\th.AssertServerBans(expectedBanData)\n\n\t\t// remaining players try to blame one of themselves, but the pool\n\t\t// only allows one ban even with a full vote.\n\t\tfor _, c := range otherClients {\n\t\t\tc.Blame(otherClients[0], otherClients)\n\t\t}\n\t\th.AssertServerBans(expectedBanData)\n\n\t\t// everybody drops\n\t\tfor _, c := range allClients {\n\t\t\tc.Disconnect()\n\t\t}\n\t\t// confirm no out of spec messages\n\t\th.WaitEmptyInboxes(allClients)\n\t}\n\n\t// confirm that troubleClient is banned and cannot connect to the server\n\ttroubleClient.Connect()\n\th.WaitNotConnected(troubleClient)\n\n\t// confirm after time limit troubleClient can connect again\n\t// This could be done with minimal server changes by making ban\n\t// cleanup time a variable, setting it very short for this test\n\t// and then waiting for it to clean up.\n}", "title": "" }, { "docid": "47873e9ff09a2c780d08547076af24f2", "score": "0.46551254", "text": "func TestReconcile(t *testing.T) {\n\tcases := []struct {\n\t\tname string\n\t\texpectedErrString string\n\t\tdnsZone *hivev1.DNSZone\n\t\texpectHostedZoneCreation bool\n\t\texpectHostedZoneDeletion bool\n\t\tlistHostedZonesOutput *route53.ListHostedZonesOutput\n\t\tlistHostedZonesError error\n\t\tcreateHostedZonesError error\n\t\tdeleteHostedZonesError error\n\t\texpectedLastSyncGeneration int64\n\t\tLastSyncTimestampCheck func(timeToCheck *metav1.Time, start, end time.Time) bool\n\t}{\n\t\t{\n\t\t\tname: \"DNSZone found, No corresponding route53 hostedzone\",\n\t\t\texpectHostedZoneCreation: true,\n\t\t\tdnsZone: validDNSZone.DeepCopy(),\n\t\t\tlistHostedZonesOutput: &route53.ListHostedZonesOutput{\n\t\t\t\tHostedZones: []*route53.HostedZone{\n\t\t\t\t\t{\n\t\t\t\t\t\tName: aws.String(\"not.the.right.zone.\"),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedLastSyncGeneration: 6,\n\t\t\tLastSyncTimestampCheck: inTimeSpan,\n\t\t},\n\t\t{\n\t\t\tname: \"DNSZone found, corresponding route53 hostedzone exists\",\n\t\t\tdnsZone: validDNSZone.DeepCopy(),\n\t\t\tlistHostedZonesOutput: &route53.ListHostedZonesOutput{\n\t\t\t\tHostedZones: []*route53.HostedZone{\n\t\t\t\t\tvalidRoute53HostedZone,\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedLastSyncGeneration: 6,\n\t\t\tLastSyncTimestampCheck: inTimeSpan,\n\t\t},\n\t\t{\n\t\t\tname: \"DNSZone found, in deleting state\",\n\t\t\tdnsZone: validDNSZoneBeingDeleted.DeepCopy(),\n\t\t\texpectHostedZoneDeletion: true,\n\t\t\tlistHostedZonesOutput: &route53.ListHostedZonesOutput{\n\t\t\t\tHostedZones: []*route53.HostedZone{\n\t\t\t\t\tvalidRoute53HostedZone,\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedLastSyncGeneration: 6,\n\t\t\tLastSyncTimestampCheck: inTimeSpan,\n\t\t},\n\t\t{\n\t\t\tname: \"DNSZone found, aws.ListHostedZone errors\",\n\t\t\tdnsZone: validDNSZone.DeepCopy(),\n\t\t\tlistHostedZonesOutput: &route53.ListHostedZonesOutput{\n\t\t\t\tHostedZones: []*route53.HostedZone{\n\t\t\t\t\tvalidRoute53HostedZone,\n\t\t\t\t},\n\t\t\t},\n\t\t\tlistHostedZonesError: errors.NewBadRequest(\"shame on you\"),\n\t\t\texpectedErrString: \"shame on you\",\n\t\t\texpectedLastSyncGeneration: 0, // LastSyncGeneration not updated since the sync failed.\n\t\t\tLastSyncTimestampCheck: func(timeToCheck *metav1.Time, start, end time.Time) bool { return timeToCheck == nil },\n\t\t},\n\t\t{\n\t\t\tname: \"DNSZone found, aws.CreateHostedZone errors\",\n\t\t\tdnsZone: validDNSZone.DeepCopy(),\n\t\t\tlistHostedZonesOutput: &route53.ListHostedZonesOutput{\n\t\t\t\tHostedZones: []*route53.HostedZone{},\n\t\t\t},\n\t\t\texpectHostedZoneCreation: true,\n\t\t\tcreateHostedZonesError: errors.NewBadRequest(\"shame on you\"),\n\t\t\texpectedErrString: \"shame on you\",\n\t\t\texpectedLastSyncGeneration: 0, // LastSyncGeneration not updated since the sync failed.\n\t\t\tLastSyncTimestampCheck: func(timeToCheck *metav1.Time, start, end time.Time) bool { return timeToCheck == nil },\n\t\t},\n\t\t{\n\t\t\tname: \"DNSZone found, aws.DeleteHostedZone errors\",\n\t\t\tdnsZone: validDNSZoneBeingDeleted.DeepCopy(),\n\t\t\tlistHostedZonesOutput: &route53.ListHostedZonesOutput{\n\t\t\t\tHostedZones: []*route53.HostedZone{\n\t\t\t\t\tvalidRoute53HostedZone,\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectHostedZoneDeletion: true,\n\t\t\tdeleteHostedZonesError: errors.NewBadRequest(\"shame on you\"),\n\t\t\texpectedErrString: \"shame on you\",\n\t\t\texpectedLastSyncGeneration: 0, // LastSyncGeneration not updated since the sync failed.\n\t\t\tLastSyncTimestampCheck: func(timeToCheck *metav1.Time, start, end time.Time) bool { return timeToCheck == nil },\n\t\t},\n\t}\n\n\tfor _, tc := range cases {\n\t\tt.Run(tc.name, func(t *testing.T) {\n\t\t\t// Arrange\n\t\t\tmocks := setupDefaultMocks(t)\n\n\t\t\tzr, _ := NewZoneReconciler(\n\t\t\t\ttc.dnsZone,\n\t\t\t\tmocks.fakeKubeClient,\n\t\t\t\tlog.WithField(\"controller\", controllerName),\n\t\t\t\tmocks.mockAWSClient,\n\t\t\t)\n\n\t\t\t// This is necessary for the mocks to report failures like methods not being called an expected number of times.\n\t\t\tdefer mocks.mockCtrl.Finish()\n\n\t\t\tsetFakeDNSZoneInKube(mocks, tc.dnsZone)\n\n\t\t\tlistHostedZonesMock := mocks.mockAWSClient.EXPECT().\n\t\t\t\tListHostedZones(gomock.Any()).\n\t\t\t\tReturn(tc.listHostedZonesOutput, tc.listHostedZonesError).\n\t\t\t\tTimes(1)\n\n\t\t\tif tc.expectHostedZoneCreation {\n\t\t\t\tmocks.mockAWSClient.EXPECT().\n\t\t\t\t\tCreateHostedZone(gomock.Any()).\n\t\t\t\t\tReturn(nil, tc.createHostedZonesError).\n\t\t\t\t\tTimes(1).\n\t\t\t\t\tAfter(listHostedZonesMock)\n\t\t\t}\n\n\t\t\tif tc.expectHostedZoneDeletion {\n\t\t\t\tmocks.mockAWSClient.EXPECT().\n\t\t\t\t\tDeleteHostedZone(gomock.Any()).\n\t\t\t\t\tReturn(nil, tc.deleteHostedZonesError).\n\t\t\t\t\tTimes(1).\n\t\t\t\t\tAfter(listHostedZonesMock)\n\t\t\t}\n\n\t\t\t// Act\n\t\t\terr := zr.Reconcile()\n\n\t\t\t// Assert\n\t\t\tassertErrorNilOrMessage(t, err, tc.expectedErrString)\n\n\t\t\t// Ensure the sync generation and timeStamp are being set properly given each test case circumstance.\n\t\t\tassert.Equal(t, tc.expectedLastSyncGeneration, zr.desiredState.Status.LastSyncGeneration)\n\t\t\tassert.True(t, tc.LastSyncTimestampCheck(zr.desiredState.Status.LastSyncTimestamp, time.Now().Add(-5*time.Minute), time.Now().Add(5*time.Minute)))\n\t\t})\n\t}\n}", "title": "" }, { "docid": "0efe11a5438bb3dd59ed1dc2a736a6b6", "score": "0.46531874", "text": "func TestTxnWaitQueueDependencyCycle(t *testing.T) {\n\tdefer leaktest.AfterTest(t)()\n\tdefer log.Scope(t).Close(t)\n\ttc := testContext{}\n\tstopper := stop.NewStopper()\n\tdefer stopper.Stop(context.Background())\n\ttc.Start(t, stopper)\n\n\ttxnA, err := createTxnForPushQueue(context.Background(), &tc)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\ttxnB, err := createTxnForPushQueue(context.Background(), &tc)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\ttxnC, err := createTxnForPushQueue(context.Background(), &tc)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\treqA := &roachpb.PushTxnRequest{\n\t\tRequestHeader: roachpb.RequestHeader{\n\t\t\tKey: txnB.Key,\n\t\t},\n\t\tPushType: roachpb.PUSH_ABORT,\n\t\tPusherTxn: *txnA,\n\t\tPusheeTxn: txnB.TxnMeta,\n\t}\n\treqB := &roachpb.PushTxnRequest{\n\t\tRequestHeader: roachpb.RequestHeader{\n\t\t\tKey: txnC.Key,\n\t\t},\n\t\tPushType: roachpb.PUSH_ABORT,\n\t\tPusherTxn: *txnB,\n\t\tPusheeTxn: txnC.TxnMeta,\n\t}\n\treqC := &roachpb.PushTxnRequest{\n\t\tRequestHeader: roachpb.RequestHeader{\n\t\t\tKey: txnA.Key,\n\t\t},\n\t\tPushType: roachpb.PUSH_ABORT,\n\t\tPusherTxn: *txnC,\n\t\tPusheeTxn: txnA.TxnMeta,\n\t}\n\n\tq := tc.repl.concMgr.TxnWaitQueue()\n\tq.Enable(1 /* leaseSeq */)\n\n\tctx, cancel := context.WithCancel(context.Background())\n\tdefer cancel()\n\tfor _, txn := range []*roachpb.Transaction{txnA, txnB, txnC} {\n\t\tq.EnqueueTxn(txn)\n\t}\n\tm := tc.store.txnWaitMetrics\n\tassert.EqualValues(tc, 0, m.DeadlocksTotal.Count())\n\n\treqs := []*roachpb.PushTxnRequest{reqA, reqB, reqC}\n\tretCh := make(chan ReqWithRespAndErr, len(reqs))\n\tfor _, req := range reqs {\n\t\tgo func(req *roachpb.PushTxnRequest) {\n\t\t\tresp, pErr := q.MaybeWaitForPush(ctx, req)\n\t\t\tretCh <- ReqWithRespAndErr{req, resp, pErr}\n\t\t}(req)\n\t}\n\n\t// Wait for first request to finish, which should break the dependency cycle\n\t// by performing a force push abort. This will allow all other requests to\n\t// proceed. At least one txn will be aborted by another txn, although it's\n\t// possible that up to two are in the case that the deadlock is detected by\n\t// multiple txns concurrently.\n\tvar pushed bool\n\tfor i := 0; i < len(reqs); i++ {\n\t\tret := <-retCh\n\t\tif ret.pErr != nil {\n\t\t\tif !testutils.IsPError(ret.pErr, context.Canceled.Error()) {\n\t\t\t\trequire.Regexp(t, `TransactionAbortedError\\(ABORT_REASON_PUSHER_ABORTED\\)`, ret.pErr)\n\t\t\t}\n\t\t} else {\n\t\t\tpushed = true\n\t\t\trequire.NotNil(t, ret.resp)\n\t\t\trequire.Equal(t, roachpb.ABORTED, ret.resp.PusheeTxn.Status)\n\n\t\t\t// Cancel the pushers' context after the deadlock is initially broken.\n\t\t\tcancel()\n\t\t}\n\t}\n\trequire.True(t, pushed)\n\trequire.GreaterOrEqual(t, m.DeadlocksTotal.Count(), int64(1))\n}", "title": "" }, { "docid": "c6cee2ca7534a6fd1e5bff60addb721a", "score": "0.4649697", "text": "func testFileNotificationOfChange(t testing.TB) {\n\tfile := NewFile().SetHeader(mockFileHeader())\n\tmockBatch := NewBatchPPD(mockBatchPPDHeader())\n\tmockBatch.AddEntry(mockPPDEntryDetailNOC())\n\tfile.AddBatch(mockBatch)\n\tif err := file.Create(); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif file.NotificationOfChange[0] != mockBatch {\n\t\tt.Error(\"BatchCOR added to File.AddBatch should exist in NotificationOfChange\")\n\t}\n}", "title": "" }, { "docid": "a9b537594a9235bc7e9fd33c56a9c361", "score": "0.464274", "text": "func (jm *JobsWithMissing) Commit() error {\n\tif jm.addToMissingIDs.Len() != 0 {\n\t\tif err := jm.state.AddMissingJobIDs(jm.addToMissingIDs); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tjm.addToMissingIDs.Clear()\n\t}\n\tif jm.removeFromMissingIDs.Len() != 0 {\n\t\tif err := jm.state.RemoveMissingJobIDs(jm.removeFromMissingIDs); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tjm.removeFromMissingIDs.Clear()\n\t}\n\treturn jm.Jobs.Commit()\n}", "title": "" } ]
a06c5411efd9eda06df82e8f9175ae4c
Symbol applies equality check predicate on the "symbol" field. It's identical to SymbolEQ.
[ { "docid": "025008983bfb1120369a9b06207a39dc", "score": "0.7414703", "text": "func Symbol(v string) predicate.Stock {\n\treturn predicate.Stock(sql.FieldEQ(FieldSymbol, v))\n}", "title": "" } ]
[ { "docid": "52d2ca34fa43d41eea2d5a1e1afec085", "score": "0.7993743", "text": "func SymbolEQ(v string) predicate.Hot {\n\treturn predicate.Hot(sql.FieldEQ(FieldSymbol, v))\n}", "title": "" }, { "docid": "2826e2aea9277428c54b54a9c46be9c8", "score": "0.79299736", "text": "func SymbolEQ(v string) predicate.Stock {\n\treturn predicate.Stock(sql.FieldEQ(FieldSymbol, v))\n}", "title": "" }, { "docid": "7d52cb60b16ec7e0e7f86a52d6293998", "score": "0.75964177", "text": "func Symbol(v string) predicate.Hot {\n\treturn predicate.Hot(sql.FieldEQ(FieldSymbol, v))\n}", "title": "" }, { "docid": "d9df01a195509099051eccd1c47e1a7f", "score": "0.6945464", "text": "func SymbolEqualFold(v string) predicate.Stock {\n\treturn predicate.Stock(sql.FieldEqualFold(FieldSymbol, v))\n}", "title": "" }, { "docid": "290bdce2d16568e2bce311b2e1a83968", "score": "0.6835229", "text": "func SymbolEqualFold(v string) predicate.Hot {\n\treturn predicate.Hot(sql.FieldEqualFold(FieldSymbol, v))\n}", "title": "" }, { "docid": "e4367e6fba136a41eef6b6bd8911c4cd", "score": "0.63837683", "text": "func (st *SymbolToken) Equal(o *SymbolToken) bool {\n\tif st.Text == nil && o.Text == nil {\n\t\tif st.Source == nil && o.Source == nil {\n\t\t\treturn true\n\t\t}\n\t\tif st.Source != nil && o.Source != nil {\n\t\t\treturn st.Source.Equal(o.Source)\n\t\t}\n\t\treturn false\n\t}\n\n\tif st.Text != nil && o.Text != nil {\n\t\treturn *st.Text == *o.Text\n\t}\n\treturn false\n}", "title": "" }, { "docid": "ad4f584450867ed0e378007f850e270d", "score": "0.62305623", "text": "func SymbolContains(v string) predicate.Stock {\n\treturn predicate.Stock(sql.FieldContains(FieldSymbol, v))\n}", "title": "" }, { "docid": "1c0ca3902ebd961cf57d24b4f475607e", "score": "0.60986555", "text": "func (st SymbolTable) BySymbol(text string) (Symbol, bool) {\n\tsym, ok := st.mapping[text]\n\treturn sym, ok\n}", "title": "" }, { "docid": "a91e9efd2e7dddd3d01e3cf1f1663b8c", "score": "0.59923434", "text": "func (m *OrderMutation) Symbol() (r string, exists bool) {\n\tv := m.symbol\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "230662f851e6ccc13d9c51deb9399cec", "score": "0.5983389", "text": "func SymbolContains(v string) predicate.Hot {\n\treturn predicate.Hot(sql.FieldContains(FieldSymbol, v))\n}", "title": "" }, { "docid": "3275e4c713b30220b7ba19633ff15c83", "score": "0.5980237", "text": "func CheckSymbol(f, s string) (int, bool) {\n\tvar val int\n\tvar ok bool\n\n\tval, ok = commonSymbols[s]\n\tif ok {\n\t\treturn val, ok\n\t}\n\n\tif _, ok := symbols[f]; !ok {\n\t\treturn -1, false\n\t}\n\n\tval, ok = symbols[f][s]\n\treturn val, ok\n}", "title": "" }, { "docid": "ec9d5104664a75f8eb80c56d0a94dbc9", "score": "0.59232295", "text": "func (b Bool) Symbol() Symbol {\n\tif b {\n\t\treturn T\n\t}\n\treturn Nil\n}", "title": "" }, { "docid": "ff40b7019c8daad5447cba12296cab4b", "score": "0.5877999", "text": "func (s *SymMap) Equal(s1 string, s2 string) bool {\r\n\tif !s.CaseSensitive {\r\n\t\treturn strings.EqualFold(s1, s2)\r\n\t}\r\n\treturn s1 == s2\r\n}", "title": "" }, { "docid": "95efbe449285aa8321b607f0ebd29ed6", "score": "0.5844315", "text": "func isSameSymbol(s1 RHSRuleSymbol, s2 RHSRuleSymbol) bool {\n\tsame := true\n\tif reflect.TypeOf(s1).String() != reflect.TypeOf(s2).String() ||\n\t\ts1.Name() != s2.Name() {\n\t\tsame = false\n\t} else {\n\t\tparamsIface := s1.Params()\n\t\tif params, isNtParams := paramsIface.(*NtRHSParams); isNtParams {\n\t\t\tg2ParamsIface := s2.Params()\n\t\t\tg2Params, isG2NtParams := g2ParamsIface.(*NtRHSParams)\n\t\t\tif !isG2NtParams {\n\t\t\t\tsame = false\n\t\t\t} else if g2Params != nil && params != nil {\n\t\t\t\tif g2Params.Optional != (*bool)(nil) && params.Optional != (*bool)(nil) &&\n\t\t\t\t\t*g2Params.Optional != *params.Optional {\n\t\t\t\t\tsame = false\n\t\t\t\t} else {\n\t\t\t\t\tif len(params.Conditions) != len(g2Params.Conditions) {\n\t\t\t\t\t\tsame = false\n\t\t\t\t\t} else {\n\t\t\t\t\t\tl := 0\n\t\t\t\t\t\tfor same && l < len(params.Conditions) {\n\t\t\t\t\t\t\tif params.Conditions[l] != g2Params.Conditions[l] {\n\t\t\t\t\t\t\t\tsame = false\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tl++\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif same {\n\t\t\t\t\t\t\tif len(params.Passthrough) != len(g2Params.Passthrough) {\n\t\t\t\t\t\t\t\tsame = false\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tl := 0\n\t\t\t\t\t\t\t\tfor same && l < len(params.Passthrough) {\n\t\t\t\t\t\t\t\t\tif params.Passthrough[l] != g2Params.Passthrough[l] {\n\t\t\t\t\t\t\t\t\t\tsame = false\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tl++\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}\n\t\t\t}\n\t\t} else if params, isTParams := paramsIface.(*TRHSParams); isTParams {\n\t\t\tg2ParamsIface := s2.Params()\n\t\t\tg2Params, isg2TParams := g2ParamsIface.(*TRHSParams)\n\t\t\tif !isg2TParams {\n\t\t\t\tsame = false\n\t\t\t} else if g2Params != nil && params != nil {\n\t\t\t\tif len(params.Conditions) != len(g2Params.Conditions) {\n\t\t\t\t\tsame = false\n\t\t\t\t} else {\n\t\t\t\t\tl := 0\n\t\t\t\t\tfor same && l < len(params.Conditions) {\n\t\t\t\t\t\tif params.Conditions[l] != g2Params.Conditions[l] {\n\t\t\t\t\t\t\tsame = false\n\t\t\t\t\t\t}\n\t\t\t\t\t\tl++\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} else if params, isCParams := paramsIface.(*CRHSParams); isCParams {\n\t\t\tg2ParamsIface := s2.Params()\n\t\t\tg2Params, isg2TParams := g2ParamsIface.(*CRHSParams)\n\t\t\tif !isg2TParams {\n\t\t\t\tsame = false\n\t\t\t} else if params != nil && g2Params != nil {\n\t\t\t\tif len(params.Conditions) != len(g2Params.Conditions) {\n\t\t\t\t\tsame = false\n\t\t\t\t} else {\n\t\t\t\t\tl := 0\n\t\t\t\t\tfor same && l < len(params.Conditions) {\n\t\t\t\t\t\tif params.Conditions[l] != g2Params.Conditions[l] {\n\t\t\t\t\t\t\tsame = false\n\t\t\t\t\t\t}\n\t\t\t\t\t\tl++\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} else if params, isLAParams := paramsIface.(*LaRHSParams); isLAParams {\n\t\t\tg2ParamsIface := s2.Params()\n\t\t\tg2Params, isg2TParams := g2ParamsIface.(*LaRHSParams)\n\t\t\tif !isg2TParams {\n\t\t\t\tsame = false\n\t\t\t} else if params != nil && g2Params != nil {\n\t\t\t\tif len(params.Exclude) != len(g2Params.Exclude) {\n\t\t\t\t\tsame = false\n\t\t\t\t} else {\n\t\t\t\t\tl := 0\n\t\t\t\t\tfor same && l < len(params.Exclude) {\n\t\t\t\t\t\trule := params.Exclude[l]\n\t\t\t\t\t\tm := 0\n\t\t\t\t\t\tfor same && m < len(rule) {\n\t\t\t\t\t\t\tsymbol := rule[m]\n\t\t\t\t\t\t\t// Generally there are no parameters in exclusion rule listings (Not in ECMAScript)\n\t\t\t\t\t\t\t// so we can just check against the name of the symbol.\n\t\t\t\t\t\t\tif symbol.Name() != g2Params.Exclude[l][m].Name() {\n\t\t\t\t\t\t\t\tsame = false\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tm++\n\t\t\t\t\t\t}\n\t\t\t\t\t\tl++\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\truleSymbolIface := s1\n\t\t\tconditional, isCond := ruleSymbolIface.(*ConditionalRHSRuleSymbol)\n\t\t\tif isCond {\n\t\t\t\tg2ruleSymbolIface := s2\n\t\t\t\tg2Conditional, isG2Cond := g2ruleSymbolIface.(*ConditionalRHSRuleSymbol)\n\t\t\t\tif !isG2Cond || (g2Conditional == nil && conditional != nil) ||\n\t\t\t\t\t(g2Conditional != nil && conditional == nil) {\n\t\t\t\t\tsame = false\n\t\t\t\t} else {\n\t\t\t\t\tif len(g2Conditional.Parts) != len(conditional.Parts) {\n\t\t\t\t\t\tsame = false\n\t\t\t\t\t} else {\n\t\t\t\t\t\ti := 0\n\t\t\t\t\t\tfor same && i < len(conditional.Parts) {\n\t\t\t\t\t\t\tsame = isSameSymbol(conditional.Parts[i], g2Conditional.Parts[i])\n\t\t\t\t\t\t\ti++\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif same {\n\t\t\t\t\t\t\tif (conditional.params != nil && g2Conditional.params == nil) ||\n\t\t\t\t\t\t\t\t(g2Conditional.params != nil && conditional.params == nil) {\n\t\t\t\t\t\t\t\tsame = false\n\t\t\t\t\t\t\t} else if conditional.params != nil && g2Conditional.params != nil {\n\t\t\t\t\t\t\t\tif len(conditional.params.Conditions) != len(g2Conditional.params.Conditions) {\n\t\t\t\t\t\t\t\t\tsame = false\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tfor same && i < len(conditional.params.Conditions) {\n\t\t\t\t\t\t\t\t\t\tif conditional.params.Conditions[i] != g2Conditional.params.Conditions[i] {\n\t\t\t\t\t\t\t\t\t\t\tsame = false\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\ti++\n\t\t\t\t\t\t\t\t\t}\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}\n\t\t\t}\n\t\t}\n\t}\n\treturn same\n}", "title": "" }, { "docid": "0db51a459b75e91f51d8d813b15e5b80", "score": "0.56592506", "text": "func (p *Provider) Symbol(name, value string) {\n\tp.symbols[name] = value\n}", "title": "" }, { "docid": "d6ca7c512abdb6a7028a167586cd26e7", "score": "0.5638878", "text": "func (sym Symbol) Symbol() (string, error) { return sym.Value().Symbol() }", "title": "" }, { "docid": "d29a3ded6d8afe067d2895543bfe45e0", "score": "0.559141", "text": "func SymbolContainsFold(v string) predicate.Stock {\n\treturn predicate.Stock(sql.FieldContainsFold(FieldSymbol, v))\n}", "title": "" }, { "docid": "af8f2e9c23fd65c32f16725f56fb050d", "score": "0.557429", "text": "func (m NoQuoteEntries) SetSymbol(v string) {\n\tm.Set(field.NewSymbol(v))\n}", "title": "" }, { "docid": "030ad508c9e62ec942bb58211c513476", "score": "0.5533913", "text": "func (o *ETFsHoldings) SetSymbol(v string) {\n\to.Symbol = &v\n}", "title": "" }, { "docid": "68c0c6c20da10c5145439472a6f8689f", "score": "0.55133206", "text": "func updateSymbol(sym map[string]int, s string) {\n\tif _, ok := commonSymbols[s]; ok {\n\t\treturn\n\t}\n\n\tif _, ok := sym[s]; ok {\n\t\treturn\n\t}\n\n\tsym[s] = addr\n\taddr++\n}", "title": "" }, { "docid": "a82faea212f2d42b8cb3bdfb54c46a7b", "score": "0.5508893", "text": "func TestIsSymbol(t *testing.T) {\n\tassert.True(t, isSymbol('$'))\n\tassert.True(t, isSymbol('-'))\n\tassert.True(t, isSymbol('+'))\n\tassert.True(t, isSymbol('('))\n\tassert.True(t, isSymbol(')'))\n\tassert.False(t, isSymbol('#'))\n}", "title": "" }, { "docid": "e14e4bcbc37f28a6245c11aabd2f8f90", "score": "0.5473663", "text": "func SymbolIn(vs ...string) predicate.Stock {\n\treturn predicate.Stock(sql.FieldIn(FieldSymbol, vs...))\n}", "title": "" }, { "docid": "96fcbc215b65547d1340bacc0651402b", "score": "0.54651016", "text": "func SymbolGTE(v string) predicate.Stock {\n\treturn predicate.Stock(sql.FieldGTE(FieldSymbol, v))\n}", "title": "" }, { "docid": "0ae776f9cabd8847e5be1f99e97388a5", "score": "0.5458182", "text": "func SymbolHasSuffix(v string) predicate.Stock {\n\treturn predicate.Stock(sql.FieldHasSuffix(FieldSymbol, v))\n}", "title": "" }, { "docid": "c908f7090318e7fe5ca77791c82089e1", "score": "0.5429861", "text": "func (_WETH9 *WETH9) Symbol(opts *bind.CallOpts) (string, error) {\n\tvar (\n\t\tret0 = new(string)\n\t)\n\tout := ret0\n\terr := _WETH9.Call(opts, out, \"symbol\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "fe56506d53f6ea43cb05a8dde73961eb", "score": "0.54022074", "text": "func (m NoQuoteEntries) HasSymbol() bool {\n\treturn m.Has(tag.Symbol)\n}", "title": "" }, { "docid": "9e9a072e1fcd00df288516d9a4992eaa", "score": "0.5373295", "text": "func expression(inputData *i.InputData) *st.SymTableEntry {\n\tx := simpleExpression(inputData)\n\tfor inputData.Sym == k.EQ || inputData.Sym == k.NE || inputData.Sym == k.LT || inputData.Sym == k.LE || inputData.Sym == k.GT || inputData.Sym == k.GE {\n\t\top := inputData.Sym\n\t\ts.GetSym(inputData)\n\t\ty := simpleExpression(inputData)\n\n\t\tif x.Tp == y.Tp {\n\t\t\tif x.EntryType == \"const\" && y.EntryType == \"const\" {\n\t\t\t\tif op == k.EQ {\n\t\t\t\t\tif x.Val == y.Val {\n\t\t\t\t\t\tx.Val = 1\n\t\t\t\t\t} else {\n\t\t\t\t\t\tx.Val = 0\n\t\t\t\t\t}\n\t\t\t\t} else if op == k.NE {\n\t\t\t\t\tif x.Val != y.Val {\n\t\t\t\t\t\tx.Val = 1\n\t\t\t\t\t} else {\n\t\t\t\t\t\tx.Val = 0\n\t\t\t\t\t}\n\t\t\t\t} else if op == k.LT {\n\t\t\t\t\tif x.Val < y.Val {\n\t\t\t\t\t\tx.Val = 1\n\t\t\t\t\t} else {\n\t\t\t\t\t\tx.Val = 0\n\t\t\t\t\t}\n\t\t\t\t} else if op == k.LE {\n\t\t\t\t\tif x.Val <= y.Val {\n\t\t\t\t\t\tx.Val = 1\n\t\t\t\t\t} else {\n\t\t\t\t\t\tx.Val = 0\n\t\t\t\t\t}\n\t\t\t\t} else if op == k.GT {\n\t\t\t\t\tif x.Val > y.Val {\n\t\t\t\t\t\tx.Val = 1\n\t\t\t\t\t} else {\n\t\t\t\t\t\tx.Val = 0\n\t\t\t\t\t}\n\t\t\t\t} else if op == k.GE {\n\t\t\t\t\tif x.Val >= y.Val {\n\t\t\t\t\t\tx.Val = 1\n\t\t\t\t\t} else {\n\t\t\t\t\t\tx.Val = 0\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tx.Tp = st.Bool\n\t\t\t} else {\n\t\t\t\tx = cg.GenRelation(op, x, y, inputData)\n\t\t\t}\n\t\t} else {\n\t\t\ts.PrintError(inputData, \"bad type\")\n\t\t}\n\t}\n\n\treturn x\n}", "title": "" }, { "docid": "4c7691eed38086641d5f2758508fc9c9", "score": "0.5340895", "text": "func (st *SymbolTable) Contains(symb string) bool {\n\tst.mu.RLock()\n\tdefer st.mu.RUnlock()\n\n\t_, found := st.m[symb]\n\treturn found\n}", "title": "" }, { "docid": "ebc016775a80107ff8aeb55d9623a151", "score": "0.5338318", "text": "func SymbolGTE(v string) predicate.Hot {\n\treturn predicate.Hot(sql.FieldGTE(FieldSymbol, v))\n}", "title": "" }, { "docid": "d22c5e4c5388d90d4a449b2bd59adeaa", "score": "0.5330561", "text": "func (m *OrderMutation) SetSymbol(s string) {\n\tm.symbol = &s\n}", "title": "" }, { "docid": "c74af4b2936a11e1fcd867a1cc1d5e4c", "score": "0.5313832", "text": "func (t Token) Equal(s string) bool {\n\treturn s == string(t)\n}", "title": "" }, { "docid": "ff44acc0e12a90c219643f4cdf25edd8", "score": "0.53040683", "text": "func SymbolIn(vs ...string) predicate.Hot {\n\treturn predicate.Hot(sql.FieldIn(FieldSymbol, vs...))\n}", "title": "" }, { "docid": "68074cbb21f9cb61b9be4a3a6bc31600", "score": "0.5296086", "text": "func (st *SymbolTable) SetSymbol(sm SourceMap) int {\n\tst.entries = append(st.entries, sm)\n\tif st.labels == nil {\n\t\tst.labels = make(map[string]int)\n\t}\n\ti := len(st.entries) - 1\n\tst.labels[sm.Label] = i\n\treturn st.labels[sm.Label]\n}", "title": "" }, { "docid": "68074cbb21f9cb61b9be4a3a6bc31600", "score": "0.5296086", "text": "func (st *SymbolTable) SetSymbol(sm SourceMap) int {\n\tst.entries = append(st.entries, sm)\n\tif st.labels == nil {\n\t\tst.labels = make(map[string]int)\n\t}\n\ti := len(st.entries) - 1\n\tst.labels[sm.Label] = i\n\treturn st.labels[sm.Label]\n}", "title": "" }, { "docid": "a30c1d28391ccb97b1130413ef76cef6", "score": "0.5288448", "text": "func (m NoUnderlyings) HasUnderlyingSymbol() bool {\n\treturn m.Has(tag.UnderlyingSymbol)\n}", "title": "" }, { "docid": "412c05430e68f6b94d519a438ac210b5", "score": "0.52847165", "text": "func SymbolGT(v string) predicate.Stock {\n\treturn predicate.Stock(sql.FieldGT(FieldSymbol, v))\n}", "title": "" }, { "docid": "2446cb40c573f2a90aa5063b5e07335f", "score": "0.52811015", "text": "func SymbolContainsFold(v string) predicate.Hot {\n\treturn predicate.Hot(sql.FieldContainsFold(FieldSymbol, v))\n}", "title": "" }, { "docid": "4bf114355e98fc29b10a753830b4bc98", "score": "0.524265", "text": "func (m NoQuoteEntries) HasUnderlyingSymbol() bool {\n\treturn m.Has(tag.UnderlyingSymbol)\n}", "title": "" }, { "docid": "0eee97776440a2ed61da8cfd52a8c913", "score": "0.5236703", "text": "func (o *ETFsHoldings) HasSymbol() bool {\n\tif o != nil && o.Symbol != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "503741ed3cb3e2e55cab4b6e868f1905", "score": "0.5223526", "text": "func SymbolHasSuffix(v string) predicate.Hot {\n\treturn predicate.Hot(sql.FieldHasSuffix(FieldSymbol, v))\n}", "title": "" }, { "docid": "b826df82566bc57df3c8cf547fd4c8b2", "score": "0.5201868", "text": "func isSymbolExists(s string) bool {\n\tvar result bool\n\tsymbols := []string{\"`\", \"~\", \",\", \".\", \"?\", \"!\", \"/\", \";\", \"&\", \"'\"}\n\n\tfor i := 0; i < len(symbols); i++ {\n\t\tif s == symbols[i] {\n\t\t\tresult = true\n\t\t}\n\t}\n\treturn result\n}", "title": "" }, { "docid": "7820f7d34262145232b12a6f4b4d17ba", "score": "0.5181182", "text": "func (vm *VirtualMachine) EvalSymbol(sm SourceMap) error {\n\tcallback, ok := vm.Operators[sm.Op]\n\tif ok == false {\n\t\treturn fmt.Errorf(\"ERROR (%d): `%s %s %s` is not a supported assignment.\\n\", sm.LineNo, sm.Op, sm.Label, sm.Source)\n\t}\n\n\t// Make the associated assignment and save the symbol to the symbol table.\n\tnewSM, err := callback(vm, sm)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvm.Symbols.SetSymbol(newSM)\n\treturn nil\n}", "title": "" }, { "docid": "1ad5052abb171d502d426b91883d2d4a", "score": "0.5178695", "text": "func (s *Symbols) Contains(symbol string) bool {\n\t_, ok := s.Map[symbol]\n\treturn ok\n}", "title": "" }, { "docid": "a8dc1d0d7d6a568b43c584ecdf7606e6", "score": "0.5177418", "text": "func HasSymbol(s string) bool {\n\tfor _, s := range s {\n\t\tif unicode.IsSymbol(s) || (!unicode.IsLetter(s) && !unicode.IsNumber(s) && !unicode.IsSpace(s)) {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "850af6fa36a45473a4f1bfc3676f55ba", "score": "0.5174235", "text": "func duplicateSymbol(symbols []*ast.Symbol) *ast.Symbol {\n\tlen := len(symbols)\n\tfor i, left := range symbols {\n\t\tif left.IsIgnored() {\n\t\t\tcontinue\n\t\t}\n\t\tfor _, right := range symbols[i+1 : len] {\n\t\t\tif left.DisplayName == right.DisplayName {\n\t\t\t\treturn left\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "025283abeb89583b6f4efc726f93e6d2", "score": "0.5172127", "text": "func (m ExecutionReport) SetSymbol(v string) {\n\tm.Set(field.NewSymbol(v))\n}", "title": "" }, { "docid": "79b38e976c407d8bdffa35dca7e26bb5", "score": "0.51660377", "text": "func (ctx *Context) symbol(name string) C.Z3_symbol {\n\tif sym, ok := ctx.syms[name]; ok {\n\t\treturn sym\n\t}\n\tcname := C.CString(name)\n\tdefer C.free(unsafe.Pointer(cname))\n\tvar sym C.Z3_symbol\n\tctx.do(func() {\n\t\tsym = C.Z3_mk_string_symbol(ctx.c, cname)\n\t\tctx.syms[name] = sym\n\t})\n\treturn sym\n}", "title": "" }, { "docid": "4f6e0d6d884fa8468f3ec138556e2f77", "score": "0.51652515", "text": "func (_BEP20 *BEP20Session) Symbol() (string, error) {\n\treturn _BEP20.Contract.Symbol(&_BEP20.CallOpts)\n}", "title": "" }, { "docid": "2fc6ec5b2964782a24fe4ef47dd8a40f", "score": "0.51628524", "text": "func (o *Development) SetSymbol(v string) {\n\to.Symbol = &v\n}", "title": "" }, { "docid": "227d4182881cb84aad9b7c3464129f1d", "score": "0.5154166", "text": "func (_StarNFT *StarNFTSession) Symbol() (string, error) {\n\treturn _StarNFT.Contract.Symbol(&_StarNFT.CallOpts)\n}", "title": "" }, { "docid": "70587ba3398aafd0bb910d5c70f39cef", "score": "0.51225907", "text": "func SymbolNEQ(v string) predicate.Stock {\n\treturn predicate.Stock(sql.FieldNEQ(FieldSymbol, v))\n}", "title": "" }, { "docid": "0d6827308f3b09597961a96ed1e882ec", "score": "0.5117414", "text": "func (so *loadingSharedObj) ContainsSymbol(sym string) bool {\n\t_, ok := so.exportedSymbols[sym]\n\treturn ok\n}", "title": "" }, { "docid": "4442df2d6e23536e051732b9dd16247b", "score": "0.5117181", "text": "func (m NoQuoteEntries) HasSymbolSfx() bool {\n\treturn m.Has(tag.SymbolSfx)\n}", "title": "" }, { "docid": "5ca645996ec4538ed37c1ddbfb66d3e4", "score": "0.5115916", "text": "func (m NoUnderlyings) HasUnderlyingSymbolSfx() bool {\n\treturn m.Has(tag.UnderlyingSymbolSfx)\n}", "title": "" }, { "docid": "5dd85bae196909ca7ce3ad24624f9bfb", "score": "0.51154315", "text": "func SymbolGT(v string) predicate.Hot {\n\treturn predicate.Hot(sql.FieldGT(FieldSymbol, v))\n}", "title": "" }, { "docid": "d1e75f1eddebf07e346826f18fc73d85", "score": "0.51130635", "text": "func SymbolNEQ(v string) predicate.Hot {\n\treturn predicate.Hot(sql.FieldNEQ(FieldSymbol, v))\n}", "title": "" }, { "docid": "42be39b3a9f959471714844a8ca1ff9a", "score": "0.508666", "text": "func (op Operation) Symbol() string {\n\treturn ops[op]\n}", "title": "" }, { "docid": "d39f05c3a92c4f1830edfdc71a8ee0bc", "score": "0.5075171", "text": "func (tok *JSTokenizer) isSymbol(t string) bool {\n\tif len(t) != 1 {\n\t\treturn false\n\t}\n\tr := rune(t[0])\n\treturn tokenize.SearchRunes(tok.symbols, r) != -1\n}", "title": "" }, { "docid": "c4de86ca3305e203c6f3a82948c166f3", "score": "0.50699884", "text": "func (m DerivativeSecurityListRequest) HasUnderlyingSymbol() bool {\n\treturn m.Has(tag.UnderlyingSymbol)\n}", "title": "" }, { "docid": "01efcbf263f664496b450b752d83f340", "score": "0.50681037", "text": "func (m NoUnderlyings) SetUnderlyingSymbol(v string) {\n\tm.Set(field.NewUnderlyingSymbol(v))\n}", "title": "" }, { "docid": "8a9f8f3e87bf9ddf55deae9f51577bae", "score": "0.5066326", "text": "func (m MetaData) Symbol() string {\n\treturn m[m.key(symbol)]\n}", "title": "" }, { "docid": "53da995dc47ffdf9e4f479b1cdd6ec09", "score": "0.5064609", "text": "func (_SonmDummyToken *SonmDummyTokenCaller) Symbol(opts *bind.CallOpts) (string, error) {\n\tvar (\n\t\tret0 = new(string)\n\t)\n\tout := ret0\n\terr := _SonmDummyToken.contract.Call(opts, out, \"symbol\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "86be299e9e5de6d14951574480543cdf", "score": "0.50621206", "text": "func (_UniswapV2Pair *UniswapV2PairSession) Symbol() (string, error) {\n\treturn _UniswapV2Pair.Contract.Symbol(&_UniswapV2Pair.CallOpts)\n}", "title": "" }, { "docid": "8bfde4f8f00945d70ecc736a9aae5505", "score": "0.50618666", "text": "func (o *Development) HasSymbol() bool {\n\tif o != nil && o.Symbol != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "d637e89aedee855b0be0190f75e1f99d", "score": "0.5061606", "text": "func SymbolLTE(v string) predicate.Stock {\n\treturn predicate.Stock(sql.FieldLTE(FieldSymbol, v))\n}", "title": "" }, { "docid": "6839c21545d576dd02fccdfc3151d788", "score": "0.5056552", "text": "func NewSymbol(s semantic.Symbol) Element {\n\treturn Element{\n\t\tisSymbol: true,\n\t\tsymbol: s,\n\t}\n}", "title": "" }, { "docid": "5ee105eb61c523a6045a3b32ea69d13b", "score": "0.505226", "text": "func (_UniswapV2ERC20 *UniswapV2ERC20Session) Symbol() (string, error) {\n\treturn _UniswapV2ERC20.Contract.Symbol(&_UniswapV2ERC20.CallOpts)\n}", "title": "" }, { "docid": "f74a0d77f42e3f48aa58e7b7592f9cf4", "score": "0.50502384", "text": "func (j *Jit) Symbol(e *Expr) *Expr {\n\tif j == nil || e.Jit != nil || e.Sym == nil || e.Sym.Desc.Class() != IntBind {\n\t\treturn e\n\t}\n\tsym := e.Sym\n\tidx := sym.Desc.Index()\n\tkind := jit.Kind(sym.Type.Kind())\n\tsize := int(kind.Size())\n\tif size == 0 || idx*8%size != 0 {\n\t\t// unaligned memory. not supported.\n\t\treturn e\n\t}\n\tif sym.Upn == 0 {\n\t\tmem, err := jit.MakeVar(idx, kind, j.RegIdConfig())\n\t\tif err != nil {\n\t\t\tif jit_verbose > 0 {\n\t\t\t\toutput.Debugf(\"jit symbol %v failed: %v\", sym, err)\n\t\t\t}\n\t\t} else {\n\t\t\te.Jit = mem\n\t\t\tif jit_verbose > 2 {\n\t\t\t\toutput.Debugf(\"jit symbol: %v => %v\", e, e.Jit)\n\t\t\t}\n\t\t}\n\t\treturn e\n\t}\n\t// on amd64 and arm64, in a func(env *Env) ...\n\t// the parameter env is on the stack at [RSP+8]\n\t// env = stack[env_param]\n\tvar env jit.Expr = j.Comp().MakeParam(8, jit.Uintptr)\n\tfor i := 0; i < sym.Upn; i++ {\n\t\t// env = env.Outer\n\t\tenv = jit.NewExprIdx(env, envOuter.index, jit.Uintptr)\n\t}\n\t// binds = env.Ints equivalent to &env.Ints[0]\n\tbinds := jit.NewExprIdx(env, envInts.index, jit.Uintptr)\n\t// binds[index]\n\te.Jit = jit.NewExprIdx(binds, jit.ConstInt(idx*8/size), kind)\n\t// output.Debugf(\"jit Symbol %v => e.Jit = %v, kind = %v\", sym, e.Jit, kind)\n\treturn e\n}", "title": "" }, { "docid": "eaa601e12608f6d4b1f6aaeda4e40a21", "score": "0.50473964", "text": "func (_StarNFT *StarNFTCaller) Symbol(opts *bind.CallOpts) (string, error) {\n\tvar (\n\t\tret0 = new(string)\n\t)\n\tout := ret0\n\terr := _StarNFT.contract.Call(opts, out, \"symbol\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "d9094a0c23542d362de629d5c7db3550", "score": "0.50436556", "text": "func (_SonmDummyToken *SonmDummyTokenSession) Symbol() (string, error) {\n\treturn _SonmDummyToken.Contract.Symbol(&_SonmDummyToken.CallOpts)\n}", "title": "" }, { "docid": "11e8ffab1acb3b49275fce49ecb960b6", "score": "0.5042567", "text": "func (c *CoinData) SetSymbol(symbol string) {\n\tc.Symbol = symbol\n}", "title": "" }, { "docid": "c53cee6cf06013046f4117902d97d959", "score": "0.5042324", "text": "func (e Element) Symbol() semantic.Symbol {\n\treturn e.symbol\n}", "title": "" }, { "docid": "b54e273b4653bfcf6d4f61ac3e298067", "score": "0.5040026", "text": "func (_Safemoon *SafemoonSession) Symbol() (string, error) {\n\treturn _Safemoon.Contract.Symbol(&_Safemoon.CallOpts)\n}", "title": "" }, { "docid": "61f6a8db2e2f4bd710438a9895b677c5", "score": "0.5033785", "text": "func (p SimplePair) Equal(p2 Pair) bool {\n\tp = p.Zap().(SimplePair)\n\treturn p.X.Equal(p2.XPart()) && p.Y.Equal(p2.YPart())\n}", "title": "" }, { "docid": "59b30b9eff5f47a0b2e6be9e285d8923", "score": "0.50143903", "text": "func (_IUniswapV2ERC20 *IUniswapV2ERC20Session) Symbol() (string, error) {\n\treturn _IUniswapV2ERC20.Contract.Symbol(&_IUniswapV2ERC20.CallOpts)\n}", "title": "" }, { "docid": "ee2b107eb614a2768bd8add0a11aa7fc", "score": "0.50112504", "text": "func (m OrderCancelRequest) HasSymbol() bool {\n\treturn m.Has(tag.Symbol)\n}", "title": "" }, { "docid": "43f25b67a76d96b3fbb0b4158a9603c7", "score": "0.50071096", "text": "func (_IUniswapV2Pair *IUniswapV2PairSession) Symbol() (string, error) {\n\treturn _IUniswapV2Pair.Contract.Symbol(&_IUniswapV2Pair.CallOpts)\n}", "title": "" }, { "docid": "5e4445ba3129d7eb866250614284c8c8", "score": "0.5006162", "text": "func eq(s1, s2 string) bool {\n\treturn s1 == s2\n}", "title": "" }, { "docid": "8ca8490de1bdb97567533c2a4656a40d", "score": "0.49760824", "text": "func (r *Repository) GetSymbol(symbol, exchange string) interface{} {\n\tswitch symbol {\n\tcase hitbtc.BTC + hitbtc.USD:\n\t\treturn &hitbtc.Symbol{\n\t\t\tBase: hitbtc.BTC,\n\t\t\tQuote: hitbtc.USD,\n\t\t\tID: hitbtc.BTC + hitbtc.USD,\n\t\t}\n\tcase hitbtc.ETH + hitbtc.USD:\n\t\treturn &hitbtc.Symbol{\n\t\t\tBase: hitbtc.ETH,\n\t\t\tQuote: hitbtc.USD,\n\t\t\tID: hitbtc.ETH + hitbtc.USD,\n\t\t}\n\tcase hitbtc.XRP + hitbtc.USD:\n\t\treturn &hitbtc.Symbol{\n\t\t\tBase: hitbtc.XRP,\n\t\t\tQuote: hitbtc.USD,\n\t\t\tID: hitbtc.XRP + hitbtc.USD,\n\t\t}\n\tcase hitbtc.XRP + hitbtc.BTC:\n\t\treturn &hitbtc.Symbol{\n\t\t\tBase: hitbtc.XRP,\n\t\t\tQuote: hitbtc.BTC,\n\t\t\tID: hitbtc.XRP + hitbtc.BTC,\n\t\t}\n\tcase hitbtc.XRP + hitbtc.ETH:\n\t\treturn &hitbtc.Symbol{\n\t\t\tBase: hitbtc.XRP,\n\t\t\tQuote: hitbtc.ETH,\n\t\t\tID: hitbtc.XRP + hitbtc.ETH,\n\t\t}\n\tcase binance.BTC + binance.USD:\n\t\treturn &binance.Symbol{\n\t\t\tBase: binance.BTC,\n\t\t\tQuote: binance.USD,\n\t\t\tID: binance.BTC + binance.USD,\n\t\t}\n\tcase binance.ETH + binance.USD:\n\t\treturn &binance.Symbol{\n\t\t\tBase: binance.ETH,\n\t\t\tQuote: binance.USD,\n\t\t\tID: binance.ETH + binance.USD,\n\t\t}\n\tcase binance.BNB + binance.USD:\n\t\treturn &binance.Symbol{\n\t\t\tBase: binance.BNB,\n\t\t\tQuote: binance.USD,\n\t\t\tID: binance.BNB + binance.USD,\n\t\t}\n\tcase binance.XRP + binance.USD:\n\t\treturn &binance.Symbol{\n\t\t\tBase: binance.XRP,\n\t\t\tQuote: binance.USD,\n\t\t\tID: binance.XRP + binance.USD,\n\t\t}\n\tcase binance.XRP + binance.BTC:\n\t\treturn &binance.Symbol{\n\t\t\tBase: binance.XRP,\n\t\t\tQuote: binance.BTC,\n\t\t\tID: binance.XRP + binance.BTC,\n\t\t}\n\tcase binance.XRP + binance.ETH:\n\t\treturn &binance.Symbol{\n\t\t\tBase: binance.XRP,\n\t\t\tQuote: binance.ETH,\n\t\t\tID: binance.XRP + binance.ETH,\n\t\t}\n\tcase binance.XRP + binance.BNB:\n\t\treturn &binance.Symbol{\n\t\t\tBase: binance.XRP,\n\t\t\tQuote: binance.BNB,\n\t\t\tID: binance.XRP + binance.BNB,\n\t\t}\n\tdefault:\n\t\tif exchange == binance.Exchange {\n\t\t\treturn &binance.Symbol{}\n\t\t} else if exchange == hitbtc.Exchange {\n\t\t\treturn &hitbtc.Symbol{}\n\t\t}\n\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "d8717a99d461f5f8331c7099c8992ff8", "score": "0.49739003", "text": "func (_WETH *WETHSession) Symbol() (string, error) {\n\treturn _WETH.Contract.Symbol(&_WETH.CallOpts)\n}", "title": "" }, { "docid": "1684770ecfb62c65ad5ef02b34a6f53c", "score": "0.4970203", "text": "func (m Message) Symbol() (*field.SymbolField, quickfix.MessageRejectError) {\n\tf := &field.SymbolField{}\n\terr := m.Body.Get(f)\n\treturn f, err\n}", "title": "" }, { "docid": "1684770ecfb62c65ad5ef02b34a6f53c", "score": "0.4970203", "text": "func (m Message) Symbol() (*field.SymbolField, quickfix.MessageRejectError) {\n\tf := &field.SymbolField{}\n\terr := m.Body.Get(f)\n\treturn f, err\n}", "title": "" }, { "docid": "2a212fafc928ae71bad798a02bc894aa", "score": "0.49667823", "text": "func (st *SymbolTable) contains(symbol string) bool {\n\t_, containsSymbol := st.symbols[symbol]\n\treturn containsSymbol\n}", "title": "" }, { "docid": "aacbafdf1f9c7981fc17286d137f8814", "score": "0.4965529", "text": "func (m ExecutionReport) HasSymbol() bool {\n\treturn m.Has(tag.Symbol)\n}", "title": "" }, { "docid": "752d6c2dddc7012cf2b1acdf416931bf", "score": "0.49651918", "text": "func (_DummyERC721Token *DummyERC721TokenSession) Symbol() (string, error) {\n\treturn _DummyERC721Token.Contract.Symbol(&_DummyERC721Token.CallOpts)\n}", "title": "" }, { "docid": "4b94a9d10e917dcb50c9f0b9c41e6ad1", "score": "0.49607122", "text": "func (_DummyERC721Token *DummyERC721TokenCaller) Symbol(opts *bind.CallOpts) (string, error) {\n\tvar (\n\t\tret0 = new(string)\n\t)\n\tout := ret0\n\terr := _DummyERC721Token.contract.Call(opts, out, \"symbol\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "1bb13eddc9ff8c97cd2dcc7d33daa15d", "score": "0.49604616", "text": "func (term *Term) Equal(compareToTerm *Term) bool {\n\treturn strings.ToLower(term.Key) == strings.ToLower(compareToTerm.Key)\n}", "title": "" }, { "docid": "669c6c48a4b4f977f6d4015533a29911", "score": "0.4957406", "text": "func SymbolLT(v string) predicate.Stock {\n\treturn predicate.Stock(sql.FieldLT(FieldSymbol, v))\n}", "title": "" }, { "docid": "6e32c1919464a1df5c5893c90b43bceb", "score": "0.4949201", "text": "func (_NPT *NPTSession) Symbol() (string, error) {\n\treturn _NPT.Contract.Symbol(&_NPT.CallOpts)\n}", "title": "" }, { "docid": "8fc1002b2ff06a2cf35a678eae47dac9", "score": "0.4938218", "text": "func (t *typeVariable) eq(other *typeVariable) bool {\n\tif t.name != other.name {\n\t\treturn false\n\t}\n\n\tif t.instance != nil && other.instance != nil {\n\t\tif !typeEq(t.instance, other.instance) {\n\t\t\tpanic(fmt.Sprintf(\"t %v != other %v: different instances, but same name: %q\", t, other, t.name))\n\t\t}\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "465083cbff21ffcef40fa2b3e5eeb037", "score": "0.4932742", "text": "func (_LegacyERC20ETH *LegacyERC20ETHSession) Symbol() (string, error) {\n\treturn _LegacyERC20ETH.Contract.Symbol(&_LegacyERC20ETH.CallOpts)\n}", "title": "" }, { "docid": "6ccb440c14847e1fddcbee2c06964ef4", "score": "0.49318698", "text": "func (_RTCoin *RTCoinSession) Symbol() (string, error) {\n\treturn _RTCoin.Contract.Symbol(&_RTCoin.CallOpts)\n}", "title": "" }, { "docid": "68b946f4f9cfa0a9bede4cfdb3868fe4", "score": "0.49316582", "text": "func (_EtherollToken *EtherollTokenCaller) Symbol(opts *bind.CallOpts) (string, error) {\n\tvar (\n\t\tret0 = new(string)\n\t)\n\tout := ret0\n\terr := _EtherollToken.contract.Call(opts, out, \"symbol\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "1f26e7addb99a344dfcec81539d185c4", "score": "0.49307942", "text": "func (m OrderCancelRequest) SetSymbol(v string) {\n\tm.Set(field.NewSymbol(v))\n}", "title": "" }, { "docid": "9490977af7781bc260557b6c132f6629", "score": "0.49190396", "text": "func (_ERC721Metadata *ERC721MetadataCaller) Symbol(opts *bind.CallOpts) (string, error) {\n\tvar (\n\t\tret0 = new(string)\n\t)\n\tout := ret0\n\terr := _ERC721Metadata.contract.Call(opts, out, \"symbol\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "9490977af7781bc260557b6c132f6629", "score": "0.49190396", "text": "func (_ERC721Metadata *ERC721MetadataCaller) Symbol(opts *bind.CallOpts) (string, error) {\n\tvar (\n\t\tret0 = new(string)\n\t)\n\tout := ret0\n\terr := _ERC721Metadata.contract.Call(opts, out, \"symbol\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "e25bd27b75278d7a9c0c47fbb07305f7", "score": "0.49118116", "text": "func Symbol(symbol string) StorageOption {\n\treturn func(key *StorageKey) {\n\t\tkey.Symbols = []string{symbol}\n\t}\n}", "title": "" }, { "docid": "b4a126083eb30f7556f860f87d1e23a8", "score": "0.49117646", "text": "func (m NoQuoteEntries) SetUnderlyingSymbol(v string) {\n\tm.Set(field.NewUnderlyingSymbol(v))\n}", "title": "" }, { "docid": "e5801f312004cd23347c8712feb0b183", "score": "0.4904385", "text": "func (_EtherollToken *EtherollTokenSession) Symbol() (string, error) {\n\treturn _EtherollToken.Contract.Symbol(&_EtherollToken.CallOpts)\n}", "title": "" }, { "docid": "0fc68ff61acd86a8b538b2a7530681bc", "score": "0.48881328", "text": "func (_ReporterToken *ReporterTokenCaller) Symbol(opts *bind.CallOpts) (string, error) {\n\tvar (\n\t\tret0 = new(string)\n\t)\n\tout := ret0\n\terr := _ReporterToken.contract.Call(opts, out, \"symbol\")\n\treturn *ret0, err\n}", "title": "" } ]
6e7a4e0e3491768a4b69f12d1a6fc3ee
SetGroupG of the adminUsergroup to the related item. Sets o.R.Group to related. Adds o to related.R.GroupAdminUsergroups. Uses the global database handle.
[ { "docid": "09dfd2107f6551df5b42aad8b47c253d", "score": "0.7740554", "text": "func (o *AdminUsergroup) SetGroupG(insert bool, related *AdminGroup) error {\n\treturn o.SetGroup(boil.GetDB(), insert, related)\n}", "title": "" } ]
[ { "docid": "f44c65fc71c34c41d83ed63a42d5f389", "score": "0.72803056", "text": "func (o *AdminUsergroup) SetGroup(exec boil.Executor, insert bool, related *AdminGroup) 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 \\\"admin_usergroup\\\" SET %s WHERE %s\",\n\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, []string{\"group_id\"}),\n\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", 2, adminUsergroupPrimaryKeyColumns),\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.GroupID = related.ID\n\tif o.R == nil {\n\t\to.R = &adminUsergroupR{\n\t\t\tGroup: related,\n\t\t}\n\t} else {\n\t\to.R.Group = related\n\t}\n\n\tif related.R == nil {\n\t\trelated.R = &adminGroupR{\n\t\t\tGroupAdminUsergroups: AdminUsergroupSlice{o},\n\t\t}\n\t} else {\n\t\trelated.R.GroupAdminUsergroups = append(related.R.GroupAdminUsergroups, o)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "0c9b92521e93e8751074d8e33b6a807d", "score": "0.68302625", "text": "func (o *AdminUsergroup) SetUserG(insert bool, related *AdminUser) error {\n\treturn o.SetUser(boil.GetDB(), insert, related)\n}", "title": "" }, { "docid": "2fd634a2352324ea64dcd4bb90a78b72", "score": "0.6372515", "text": "func (o *DjangoAdminLog) SetUserG(insert bool, related *AuthUser) error {\n\treturn o.SetUser(boil.GetDB(), insert, related)\n}", "title": "" }, { "docid": "6c81bbf6bb22da9ff6df711198ebf2f8", "score": "0.6295808", "text": "func AddAdminInGlobalGroup(db gorp.SqlExecutor, userID int64) error {\n\n\tquery := `SELECT id FROM \"group\" where name = $1`\n\tvar id int64\n\terr := db.QueryRow(query, SharedInfraGroup).Scan(&id)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tquery = `INSERT INTO group_user (group_id, user_id, group_admin) VALUES ($1, $2, true)`\n\t_, err = db.Exec(query, id, userID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f90e1ee58b75d312da3055eae3c6b168", "score": "0.61573553", "text": "func (o *AdminUsergroup) SetUser(exec boil.Executor, insert bool, related *AdminUser) 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 \\\"admin_usergroup\\\" SET %s WHERE %s\",\n\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, []string{\"user_id\"}),\n\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", 2, adminUsergroupPrimaryKeyColumns),\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 = &adminUsergroupR{\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 = &adminUserR{\n\t\t\tUserAdminUsergroups: AdminUsergroupSlice{o},\n\t\t}\n\t} else {\n\t\trelated.R.UserAdminUsergroups = append(related.R.UserAdminUsergroups, o)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9f2f3c0383d4f51d76874b4afc03f3f0", "score": "0.6100988", "text": "func (t *NetworkInstance_Mpls_TeGlobalAttributes) AppendAdminGroup(v *NetworkInstance_Mpls_TeGlobalAttributes_AdminGroup) error {\n\tkey := *v.AdminGroupName\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.AdminGroup == nil {\n\t\tt.AdminGroup = make(map[string]*NetworkInstance_Mpls_TeGlobalAttributes_AdminGroup)\n\t}\n\n\tif _, ok := t.AdminGroup[key]; ok {\n\t\treturn fmt.Errorf(\"duplicate key for list AdminGroup %v\", key)\n\t}\n\n\tt.AdminGroup[key] = v\n\treturn nil\n}", "title": "" }, { "docid": "9f2f3c0383d4f51d76874b4afc03f3f0", "score": "0.6100405", "text": "func (t *NetworkInstance_Mpls_TeGlobalAttributes) AppendAdminGroup(v *NetworkInstance_Mpls_TeGlobalAttributes_AdminGroup) error {\n\tkey := *v.AdminGroupName\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.AdminGroup == nil {\n\t\tt.AdminGroup = make(map[string]*NetworkInstance_Mpls_TeGlobalAttributes_AdminGroup)\n\t}\n\n\tif _, ok := t.AdminGroup[key]; ok {\n\t\treturn fmt.Errorf(\"duplicate key for list AdminGroup %v\", key)\n\t}\n\n\tt.AdminGroup[key] = v\n\treturn nil\n}", "title": "" }, { "docid": "9f2f3c0383d4f51d76874b4afc03f3f0", "score": "0.6100405", "text": "func (t *NetworkInstance_Mpls_TeGlobalAttributes) AppendAdminGroup(v *NetworkInstance_Mpls_TeGlobalAttributes_AdminGroup) error {\n\tkey := *v.AdminGroupName\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.AdminGroup == nil {\n\t\tt.AdminGroup = make(map[string]*NetworkInstance_Mpls_TeGlobalAttributes_AdminGroup)\n\t}\n\n\tif _, ok := t.AdminGroup[key]; ok {\n\t\treturn fmt.Errorf(\"duplicate key for list AdminGroup %v\", key)\n\t}\n\n\tt.AdminGroup[key] = v\n\treturn nil\n}", "title": "" }, { "docid": "9f2f3c0383d4f51d76874b4afc03f3f0", "score": "0.6099816", "text": "func (t *NetworkInstance_Mpls_TeGlobalAttributes) AppendAdminGroup(v *NetworkInstance_Mpls_TeGlobalAttributes_AdminGroup) error {\n\tkey := *v.AdminGroupName\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.AdminGroup == nil {\n\t\tt.AdminGroup = make(map[string]*NetworkInstance_Mpls_TeGlobalAttributes_AdminGroup)\n\t}\n\n\tif _, ok := t.AdminGroup[key]; ok {\n\t\treturn fmt.Errorf(\"duplicate key for list AdminGroup %v\", key)\n\t}\n\n\tt.AdminGroup[key] = v\n\treturn nil\n}", "title": "" }, { "docid": "99e9f65078a32239295eb25ec669ef13", "score": "0.6067342", "text": "func (t *Mpls_TeGlobalAttributes) AppendAdminGroup(v *Mpls_TeGlobalAttributes_AdminGroup) error {\n\tkey := *v.AdminGroupName\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.AdminGroup == nil {\n\t\tt.AdminGroup = make(map[string]*Mpls_TeGlobalAttributes_AdminGroup)\n\t}\n\n\tif _, ok := t.AdminGroup[key]; ok {\n\t\treturn fmt.Errorf(\"duplicate key for list AdminGroup %v\", key)\n\t}\n\n\tt.AdminGroup[key] = v\n\treturn nil\n}", "title": "" }, { "docid": "99e9f65078a32239295eb25ec669ef13", "score": "0.6067342", "text": "func (t *Mpls_TeGlobalAttributes) AppendAdminGroup(v *Mpls_TeGlobalAttributes_AdminGroup) error {\n\tkey := *v.AdminGroupName\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.AdminGroup == nil {\n\t\tt.AdminGroup = make(map[string]*Mpls_TeGlobalAttributes_AdminGroup)\n\t}\n\n\tif _, ok := t.AdminGroup[key]; ok {\n\t\treturn fmt.Errorf(\"duplicate key for list AdminGroup %v\", key)\n\t}\n\n\tt.AdminGroup[key] = v\n\treturn nil\n}", "title": "" }, { "docid": "99e9f65078a32239295eb25ec669ef13", "score": "0.6067342", "text": "func (t *Mpls_TeGlobalAttributes) AppendAdminGroup(v *Mpls_TeGlobalAttributes_AdminGroup) error {\n\tkey := *v.AdminGroupName\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.AdminGroup == nil {\n\t\tt.AdminGroup = make(map[string]*Mpls_TeGlobalAttributes_AdminGroup)\n\t}\n\n\tif _, ok := t.AdminGroup[key]; ok {\n\t\treturn fmt.Errorf(\"duplicate key for list AdminGroup %v\", key)\n\t}\n\n\tt.AdminGroup[key] = v\n\treturn nil\n}", "title": "" }, { "docid": "f8fa22fd18450e91fde38f83161fef80", "score": "0.5936924", "text": "func FindAdminUsergroupG(iD int, selectCols ...string) (*AdminUsergroup, error) {\n\treturn FindAdminUsergroup(boil.GetDB(), iD, selectCols...)\n}", "title": "" }, { "docid": "efe80682cbfdbd9bd270f26fb7acfc61", "score": "0.5927115", "text": "func (o *AdminUsergroup) Group(mods ...qm.QueryMod) adminGroupQuery {\n\tqueryMods := []qm.QueryMod{\n\t\tqm.Where(\"id=?\", o.GroupID),\n\t}\n\n\tqueryMods = append(queryMods, mods...)\n\n\tquery := AdminGroups(queryMods...)\n\tqueries.SetFrom(query.Query, \"\\\"admin_group\\\"\")\n\n\treturn query\n}", "title": "" }, { "docid": "655e162599a6e9e77646b88d8e1ea216", "score": "0.59206915", "text": "func (o *GroupsInvestor) SetGroup(ctx context.Context, exec boil.ContextExecutor, insert bool, related *Group) 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 \\\"groups_investors\\\" SET %s WHERE %s\",\n\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 0, []string{\"group_id\"}),\n\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", 0, groupsInvestorPrimaryKeyColumns),\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.GroupID = related.ID\n\tif o.R == nil {\n\t\to.R = &groupsInvestorR{\n\t\t\tGroup: related,\n\t\t}\n\t} else {\n\t\to.R.Group = related\n\t}\n\n\tif related.R == nil {\n\t\trelated.R = &groupR{\n\t\t\tGroupsInvestors: GroupsInvestorSlice{o},\n\t\t}\n\t} else {\n\t\trelated.R.GroupsInvestors = append(related.R.GroupsInvestors, o)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "186ceac70563fee6c77fbaacc0abac10", "score": "0.5888979", "text": "func (o *CollectionI18n) SetUserG(insert bool, related *User) error {\n\treturn o.SetUser(boil.GetDB(), insert, related)\n}", "title": "" }, { "docid": "c8c36025ef77307fed5e52e0f24b4d5d", "score": "0.57926583", "text": "func (o *AdminUsergroup) ReloadG() error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no AdminUsergroup provided for reload\")\n\t}\n\n\treturn o.Reload(boil.GetDB())\n}", "title": "" }, { "docid": "cba058abd3edeaaa6c53ec9636507168", "score": "0.5790668", "text": "func (o *WorksFor) SetUserG(insert bool, related *User) error {\n\treturn o.SetUser(boil.GetDB(), insert, related)\n}", "title": "" }, { "docid": "19acf7c37e112e746482293cf13ae125", "score": "0.5782071", "text": "func (t *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_TrafficEngineering_Tlv_Link_SubTlv) AppendAdminGroup(v *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_TrafficEngineering_Tlv_Link_SubTlv_AdminGroup) error {\n\tkey := *v.BitIndex\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.AdminGroup == nil {\n\t\tt.AdminGroup = make(map[uint8]*NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_TrafficEngineering_Tlv_Link_SubTlv_AdminGroup)\n\t}\n\n\tif _, ok := t.AdminGroup[key]; ok {\n\t\treturn fmt.Errorf(\"duplicate key for list AdminGroup %v\", key)\n\t}\n\n\tt.AdminGroup[key] = v\n\treturn nil\n}", "title": "" }, { "docid": "19acf7c37e112e746482293cf13ae125", "score": "0.5780838", "text": "func (t *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_TrafficEngineering_Tlv_Link_SubTlv) AppendAdminGroup(v *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_TrafficEngineering_Tlv_Link_SubTlv_AdminGroup) error {\n\tkey := *v.BitIndex\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.AdminGroup == nil {\n\t\tt.AdminGroup = make(map[uint8]*NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_TrafficEngineering_Tlv_Link_SubTlv_AdminGroup)\n\t}\n\n\tif _, ok := t.AdminGroup[key]; ok {\n\t\treturn fmt.Errorf(\"duplicate key for list AdminGroup %v\", key)\n\t}\n\n\tt.AdminGroup[key] = v\n\treturn nil\n}", "title": "" }, { "docid": "19acf7c37e112e746482293cf13ae125", "score": "0.57805574", "text": "func (t *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_TrafficEngineering_Tlv_Link_SubTlv) AppendAdminGroup(v *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_TrafficEngineering_Tlv_Link_SubTlv_AdminGroup) error {\n\tkey := *v.BitIndex\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.AdminGroup == nil {\n\t\tt.AdminGroup = make(map[uint8]*NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_TrafficEngineering_Tlv_Link_SubTlv_AdminGroup)\n\t}\n\n\tif _, ok := t.AdminGroup[key]; ok {\n\t\treturn fmt.Errorf(\"duplicate key for list AdminGroup %v\", key)\n\t}\n\n\tt.AdminGroup[key] = v\n\treturn nil\n}", "title": "" }, { "docid": "19acf7c37e112e746482293cf13ae125", "score": "0.57805574", "text": "func (t *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_TrafficEngineering_Tlv_Link_SubTlv) AppendAdminGroup(v *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_TrafficEngineering_Tlv_Link_SubTlv_AdminGroup) error {\n\tkey := *v.BitIndex\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.AdminGroup == nil {\n\t\tt.AdminGroup = make(map[uint8]*NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_TrafficEngineering_Tlv_Link_SubTlv_AdminGroup)\n\t}\n\n\tif _, ok := t.AdminGroup[key]; ok {\n\t\treturn fmt.Errorf(\"duplicate key for list AdminGroup %v\", key)\n\t}\n\n\tt.AdminGroup[key] = v\n\treturn nil\n}", "title": "" }, { "docid": "3e46acf41ac595ed66a96d71c495f846", "score": "0.5778883", "text": "func (recv *RadioMenuItem) SetGroup(group *glib.SList) {\n\tc_group := (*C.GSList)(C.NULL)\n\tif group != nil {\n\t\tc_group = (*C.GSList)(group.ToC())\n\t}\n\n\tC.gtk_radio_menu_item_set_group((*C.GtkRadioMenuItem)(recv.native), c_group)\n\n\treturn\n}", "title": "" }, { "docid": "52ddd32e6f6a194bb8bd23393c203b7d", "score": "0.5775519", "text": "func (o *AdminUsergroup) UpdateG(columns boil.Columns) (int64, error) {\n\treturn o.Update(boil.GetDB(), columns)\n}", "title": "" }, { "docid": "5986422926a94240ffbd80bda0846de5", "score": "0.569368", "text": "func (u *users) GroupPromote(name string, group string) error {\n\tro := &req.RequestOptions{\n\t\tData: map[string]string{\n\t\t\t\"groupid\": group,\n\t\t},\n\t}\n\treturn u.baseRequest(http.MethodPost, ro, name, \"subadmins\")\n}", "title": "" }, { "docid": "cb027b1a9a30ef15ed29357da2471d27", "score": "0.56666195", "text": "func (o *DjangoContentType) SetContentTypeDjangoAdminLogsG(insert bool, related ...*DjangoAdminLog) error {\n\treturn o.SetContentTypeDjangoAdminLogs(boil.GetDB(), insert, related...)\n}", "title": "" }, { "docid": "6bedd26b6bd1ba5b5b7a911ff2203e73", "score": "0.56659895", "text": "func (o *Session) SetUserG(insert bool, related *User) error {\n\treturn o.SetUser(boil.GetDB(), insert, related)\n}", "title": "" }, { "docid": "9edaa42a68e69e5dd907c6ba50f6bafc", "score": "0.5660205", "text": "func (t *NetworkInstance_Mpls_TeGlobalAttributes) NewAdminGroup(AdminGroupName string) (*NetworkInstance_Mpls_TeGlobalAttributes_AdminGroup, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.AdminGroup == nil {\n\t\tt.AdminGroup = make(map[string]*NetworkInstance_Mpls_TeGlobalAttributes_AdminGroup)\n\t}\n\n\tkey := AdminGroupName\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.AdminGroup[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list AdminGroup\", key)\n\t}\n\n\tt.AdminGroup[key] = &NetworkInstance_Mpls_TeGlobalAttributes_AdminGroup{\n\t\tAdminGroupName: &AdminGroupName,\n\t}\n\n\treturn t.AdminGroup[key], nil\n}", "title": "" }, { "docid": "9edaa42a68e69e5dd907c6ba50f6bafc", "score": "0.5660205", "text": "func (t *NetworkInstance_Mpls_TeGlobalAttributes) NewAdminGroup(AdminGroupName string) (*NetworkInstance_Mpls_TeGlobalAttributes_AdminGroup, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.AdminGroup == nil {\n\t\tt.AdminGroup = make(map[string]*NetworkInstance_Mpls_TeGlobalAttributes_AdminGroup)\n\t}\n\n\tkey := AdminGroupName\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.AdminGroup[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list AdminGroup\", key)\n\t}\n\n\tt.AdminGroup[key] = &NetworkInstance_Mpls_TeGlobalAttributes_AdminGroup{\n\t\tAdminGroupName: &AdminGroupName,\n\t}\n\n\treturn t.AdminGroup[key], nil\n}", "title": "" }, { "docid": "9edaa42a68e69e5dd907c6ba50f6bafc", "score": "0.5659214", "text": "func (t *NetworkInstance_Mpls_TeGlobalAttributes) NewAdminGroup(AdminGroupName string) (*NetworkInstance_Mpls_TeGlobalAttributes_AdminGroup, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.AdminGroup == nil {\n\t\tt.AdminGroup = make(map[string]*NetworkInstance_Mpls_TeGlobalAttributes_AdminGroup)\n\t}\n\n\tkey := AdminGroupName\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.AdminGroup[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list AdminGroup\", key)\n\t}\n\n\tt.AdminGroup[key] = &NetworkInstance_Mpls_TeGlobalAttributes_AdminGroup{\n\t\tAdminGroupName: &AdminGroupName,\n\t}\n\n\treturn t.AdminGroup[key], nil\n}", "title": "" }, { "docid": "9edaa42a68e69e5dd907c6ba50f6bafc", "score": "0.5659214", "text": "func (t *NetworkInstance_Mpls_TeGlobalAttributes) NewAdminGroup(AdminGroupName string) (*NetworkInstance_Mpls_TeGlobalAttributes_AdminGroup, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.AdminGroup == nil {\n\t\tt.AdminGroup = make(map[string]*NetworkInstance_Mpls_TeGlobalAttributes_AdminGroup)\n\t}\n\n\tkey := AdminGroupName\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.AdminGroup[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list AdminGroup\", key)\n\t}\n\n\tt.AdminGroup[key] = &NetworkInstance_Mpls_TeGlobalAttributes_AdminGroup{\n\t\tAdminGroupName: &AdminGroupName,\n\t}\n\n\treturn t.AdminGroup[key], nil\n}", "title": "" }, { "docid": "9c765b638f99505156837095a860e52c", "score": "0.5656079", "text": "func (o *RoleGroup) UpdateG(whitelist ...string) error {\n\treturn o.Update(boil.GetDB(), whitelist...)\n}", "title": "" }, { "docid": "0955deb38a1edad93c34802bfcb4ed69", "score": "0.56357807", "text": "func (o *TagI18n) SetUserG(insert bool, related *User) error {\n\treturn o.SetUser(boil.GetDB(), insert, related)\n}", "title": "" }, { "docid": "5ee08a6c7b1020f0513080211385f372", "score": "0.5629553", "text": "func (guo *GraphUpdateOne) SetGroup(g *Group) *GraphUpdateOne {\n\treturn guo.SetGroupID(g.ID)\n}", "title": "" }, { "docid": "a3fd14c102d7e544e81bd3f95ba74444", "score": "0.5612228", "text": "func (t *Mpls_TeGlobalAttributes) NewAdminGroup(AdminGroupName string) (*Mpls_TeGlobalAttributes_AdminGroup, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.AdminGroup == nil {\n\t\tt.AdminGroup = make(map[string]*Mpls_TeGlobalAttributes_AdminGroup)\n\t}\n\n\tkey := AdminGroupName\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.AdminGroup[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list AdminGroup\", key)\n\t}\n\n\tt.AdminGroup[key] = &Mpls_TeGlobalAttributes_AdminGroup{\n\t\tAdminGroupName: &AdminGroupName,\n\t}\n\n\treturn t.AdminGroup[key], nil\n}", "title": "" }, { "docid": "a3fd14c102d7e544e81bd3f95ba74444", "score": "0.5612228", "text": "func (t *Mpls_TeGlobalAttributes) NewAdminGroup(AdminGroupName string) (*Mpls_TeGlobalAttributes_AdminGroup, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.AdminGroup == nil {\n\t\tt.AdminGroup = make(map[string]*Mpls_TeGlobalAttributes_AdminGroup)\n\t}\n\n\tkey := AdminGroupName\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.AdminGroup[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list AdminGroup\", key)\n\t}\n\n\tt.AdminGroup[key] = &Mpls_TeGlobalAttributes_AdminGroup{\n\t\tAdminGroupName: &AdminGroupName,\n\t}\n\n\treturn t.AdminGroup[key], nil\n}", "title": "" }, { "docid": "a3fd14c102d7e544e81bd3f95ba74444", "score": "0.5612228", "text": "func (t *Mpls_TeGlobalAttributes) NewAdminGroup(AdminGroupName string) (*Mpls_TeGlobalAttributes_AdminGroup, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.AdminGroup == nil {\n\t\tt.AdminGroup = make(map[string]*Mpls_TeGlobalAttributes_AdminGroup)\n\t}\n\n\tkey := AdminGroupName\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.AdminGroup[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list AdminGroup\", key)\n\t}\n\n\tt.AdminGroup[key] = &Mpls_TeGlobalAttributes_AdminGroup{\n\t\tAdminGroupName: &AdminGroupName,\n\t}\n\n\treturn t.AdminGroup[key], nil\n}", "title": "" }, { "docid": "e5da4d10dc20834acb375056a306f3a9", "score": "0.5607555", "text": "func AddAdminUsergroupHook(hookPoint boil.HookPoint, adminUsergroupHook AdminUsergroupHook) {\n\tswitch hookPoint {\n\tcase boil.BeforeInsertHook:\n\t\tadminUsergroupBeforeInsertHooks = append(adminUsergroupBeforeInsertHooks, adminUsergroupHook)\n\tcase boil.BeforeUpdateHook:\n\t\tadminUsergroupBeforeUpdateHooks = append(adminUsergroupBeforeUpdateHooks, adminUsergroupHook)\n\tcase boil.BeforeDeleteHook:\n\t\tadminUsergroupBeforeDeleteHooks = append(adminUsergroupBeforeDeleteHooks, adminUsergroupHook)\n\tcase boil.BeforeUpsertHook:\n\t\tadminUsergroupBeforeUpsertHooks = append(adminUsergroupBeforeUpsertHooks, adminUsergroupHook)\n\tcase boil.AfterInsertHook:\n\t\tadminUsergroupAfterInsertHooks = append(adminUsergroupAfterInsertHooks, adminUsergroupHook)\n\tcase boil.AfterSelectHook:\n\t\tadminUsergroupAfterSelectHooks = append(adminUsergroupAfterSelectHooks, adminUsergroupHook)\n\tcase boil.AfterUpdateHook:\n\t\tadminUsergroupAfterUpdateHooks = append(adminUsergroupAfterUpdateHooks, adminUsergroupHook)\n\tcase boil.AfterDeleteHook:\n\t\tadminUsergroupAfterDeleteHooks = append(adminUsergroupAfterDeleteHooks, adminUsergroupHook)\n\tcase boil.AfterUpsertHook:\n\t\tadminUsergroupAfterUpsertHooks = append(adminUsergroupAfterUpsertHooks, adminUsergroupHook)\n\t}\n}", "title": "" }, { "docid": "87529faad46723c4695b76a86a8c4ec5", "score": "0.5604924", "text": "func (q adminUsergroupQuery) OneG() (*AdminUsergroup, error) {\n\treturn q.One(boil.GetDB())\n}", "title": "" }, { "docid": "4b67a3d8f323b463e409beccff61a17b", "score": "0.5600017", "text": "func (o *OrderItemOption) SetOrderItemG(ctx context.Context, insert bool, related *OrderItem) error {\n\treturn o.SetOrderItem(ctx, boil.GetContextDB(), insert, related)\n}", "title": "" }, { "docid": "8805f0ab3bcc06de57c9d626a13d81c2", "score": "0.55968726", "text": "func (o *OrderItemOption) SetOrderG(ctx context.Context, insert bool, related *Order) error {\n\treturn o.SetOrder(ctx, boil.GetContextDB(), insert, related)\n}", "title": "" }, { "docid": "f8c1ef9c96698d0a11a23d1a3dd5d35d", "score": "0.5594642", "text": "func (o *DjangoAdminLog) SetUserGP(insert bool, related *AuthUser) {\n\tif err := o.SetUser(boil.GetDB(), insert, related); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "af8ef867bbd3963e87a51be06c77ce2e", "score": "0.55884033", "text": "func (t *NetworkInstance_Mpls_TeGlobalAttributes) RenameAdminGroup(oldK, newK string) error {\n\tif _, ok := t.AdminGroup[newK]; ok {\n\t\treturn fmt.Errorf(\"key %v already exists in AdminGroup\", newK)\n\t}\n\n\te, ok := t.AdminGroup[oldK]\n\tif !ok {\n\t\treturn fmt.Errorf(\"key %v not found in AdminGroup\", oldK)\n\t}\n\te.AdminGroupName = &newK\n\n\tt.AdminGroup[newK] = e\n\tdelete(t.AdminGroup, oldK)\n\treturn nil\n}", "title": "" }, { "docid": "af8ef867bbd3963e87a51be06c77ce2e", "score": "0.55884033", "text": "func (t *NetworkInstance_Mpls_TeGlobalAttributes) RenameAdminGroup(oldK, newK string) error {\n\tif _, ok := t.AdminGroup[newK]; ok {\n\t\treturn fmt.Errorf(\"key %v already exists in AdminGroup\", newK)\n\t}\n\n\te, ok := t.AdminGroup[oldK]\n\tif !ok {\n\t\treturn fmt.Errorf(\"key %v not found in AdminGroup\", oldK)\n\t}\n\te.AdminGroupName = &newK\n\n\tt.AdminGroup[newK] = e\n\tdelete(t.AdminGroup, oldK)\n\treturn nil\n}", "title": "" }, { "docid": "af8ef867bbd3963e87a51be06c77ce2e", "score": "0.55884033", "text": "func (t *NetworkInstance_Mpls_TeGlobalAttributes) RenameAdminGroup(oldK, newK string) error {\n\tif _, ok := t.AdminGroup[newK]; ok {\n\t\treturn fmt.Errorf(\"key %v already exists in AdminGroup\", newK)\n\t}\n\n\te, ok := t.AdminGroup[oldK]\n\tif !ok {\n\t\treturn fmt.Errorf(\"key %v not found in AdminGroup\", oldK)\n\t}\n\te.AdminGroupName = &newK\n\n\tt.AdminGroup[newK] = e\n\tdelete(t.AdminGroup, oldK)\n\treturn nil\n}", "title": "" }, { "docid": "af8ef867bbd3963e87a51be06c77ce2e", "score": "0.5588066", "text": "func (t *NetworkInstance_Mpls_TeGlobalAttributes) RenameAdminGroup(oldK, newK string) error {\n\tif _, ok := t.AdminGroup[newK]; ok {\n\t\treturn fmt.Errorf(\"key %v already exists in AdminGroup\", newK)\n\t}\n\n\te, ok := t.AdminGroup[oldK]\n\tif !ok {\n\t\treturn fmt.Errorf(\"key %v not found in AdminGroup\", oldK)\n\t}\n\te.AdminGroupName = &newK\n\n\tt.AdminGroup[newK] = e\n\tdelete(t.AdminGroup, oldK)\n\treturn nil\n}", "title": "" }, { "docid": "b78e68845cd99cc6eaccf6178a015c8d", "score": "0.5583464", "text": "func (o *DjangoCommentFlag) SetUserG(insert bool, related *AuthUser) error {\n\treturn o.SetUser(boil.GetDB(), insert, related)\n}", "title": "" }, { "docid": "9758d56ef37568b86a76030f87d1a876", "score": "0.55769926", "text": "func (t *Mpls_TeGlobalAttributes) RenameAdminGroup(oldK, newK string) error {\n\tif _, ok := t.AdminGroup[newK]; ok {\n\t\treturn fmt.Errorf(\"key %v already exists in AdminGroup\", newK)\n\t}\n\n\te, ok := t.AdminGroup[oldK]\n\tif !ok {\n\t\treturn fmt.Errorf(\"key %v not found in AdminGroup\", oldK)\n\t}\n\te.AdminGroupName = &newK\n\n\tt.AdminGroup[newK] = e\n\tdelete(t.AdminGroup, oldK)\n\treturn nil\n}", "title": "" }, { "docid": "9758d56ef37568b86a76030f87d1a876", "score": "0.55752987", "text": "func (t *Mpls_TeGlobalAttributes) RenameAdminGroup(oldK, newK string) error {\n\tif _, ok := t.AdminGroup[newK]; ok {\n\t\treturn fmt.Errorf(\"key %v already exists in AdminGroup\", newK)\n\t}\n\n\te, ok := t.AdminGroup[oldK]\n\tif !ok {\n\t\treturn fmt.Errorf(\"key %v not found in AdminGroup\", oldK)\n\t}\n\te.AdminGroupName = &newK\n\n\tt.AdminGroup[newK] = e\n\tdelete(t.AdminGroup, oldK)\n\treturn nil\n}", "title": "" }, { "docid": "9758d56ef37568b86a76030f87d1a876", "score": "0.55752987", "text": "func (t *Mpls_TeGlobalAttributes) RenameAdminGroup(oldK, newK string) error {\n\tif _, ok := t.AdminGroup[newK]; ok {\n\t\treturn fmt.Errorf(\"key %v already exists in AdminGroup\", newK)\n\t}\n\n\te, ok := t.AdminGroup[oldK]\n\tif !ok {\n\t\treturn fmt.Errorf(\"key %v not found in AdminGroup\", oldK)\n\t}\n\te.AdminGroupName = &newK\n\n\tt.AdminGroup[newK] = e\n\tdelete(t.AdminGroup, oldK)\n\treturn nil\n}", "title": "" }, { "docid": "526c7fb27986abbf0199d2daf3eeef3c", "score": "0.5548552", "text": "func LinkSetGroup(link Link, group int) error {\n\treturn pkgHandle.LinkSetGroup(link, group)\n}", "title": "" }, { "docid": "08420bdb5a09ec6c77fdb5b24e409e98", "score": "0.5459805", "text": "func (recv *RadioAction) SetGroup(group *glib.SList) {\n\tc_group := (*C.GSList)(C.NULL)\n\tif group != nil {\n\t\tc_group = (*C.GSList)(group.ToC())\n\t}\n\n\tC.gtk_radio_action_set_group((*C.GtkRadioAction)(recv.native), c_group)\n\n\treturn\n}", "title": "" }, { "docid": "f259dce6184d223dc7cfc4f16fb86a30", "score": "0.5432467", "text": "func AdminAddUserToGroup(username string, groupName string) (string, error) {\n\tuserPoolId := os.Getenv(\"USER_POOL\")\n\tadminAddUserToGroupInput := &cognitoidp.AdminAddUserToGroupInput {\n\t\tUserPoolId: aws.String(userPoolId),\n\t\tUsername: aws.String(username),\n\t\tGroupName: aws.String(groupName),\n\t}\n\n\t_, err := client.AdminAddUserToGroup(adminAddUserToGroupInput)\n\tif err != nil {\n\t\treturn \"\", err\n\t} else {\n\t\treturn fmt.Sprintf(\n\t\t\t\"User %s has been added to group %s successfully.\", username, groupName,\n\t\t), err\n\t}\n}", "title": "" }, { "docid": "650a75e391700a9fd5cc144c2f6d1171", "score": "0.54225326", "text": "func (igr *InmemGroupRepository) SetGroup(group *Group) (string, error) {\n\tif group.AppID == \"\" {\n\t\treturn \"\", fmt.Errorf(\"Group AppID not specified\")\n\t}\n\n\tif group.ID == \"\" {\n\t\tgroup.ID = uuid.New().String()\n\t}\n\n\tgroup.LastUpdated = time.Now().Unix()\n\n\tigr.Lock()\n\tdefer igr.Unlock()\n\n\t// If the group does not exist, add it to the AppID index\n\tif _, gok := igr.groupsByID[group.ID]; !gok {\n\t\tappGroups, aok := igr.groupsByAppID[group.AppID]\n\t\tif !aok {\n\t\t\tappGroups = []string{}\n\t\t}\n\t\tappGroups = append(appGroups, group.ID)\n\t\tigr.groupsByAppID[group.AppID] = appGroups\n\t}\n\n\t// Set group in main index\n\tigr.groupsByID[group.ID] = group\n\n\treturn group.ID, nil\n}", "title": "" }, { "docid": "4bf635da170f2365605c71e999236690", "score": "0.541686", "text": "func (h *Handle) LinkSetGroup(link Link, group int) error {\n\tbase := link.Attrs()\n\th.ensureIndex(base)\n\treq := h.newNetlinkRequest(unix.RTM_SETLINK, unix.NLM_F_ACK)\n\n\tmsg := nl.NewIfInfomsg(unix.AF_UNSPEC)\n\tmsg.Index = int32(base.Index)\n\treq.AddData(msg)\n\n\tb := make([]byte, 4)\n\tnative.PutUint32(b, uint32(group))\n\n\tdata := nl.NewRtAttr(unix.IFLA_GROUP, b)\n\treq.AddData(data)\n\n\t_, err := req.Execute(unix.NETLINK_ROUTE, 0)\n\treturn err\n}", "title": "" }, { "docid": "7118244b136dd0a234fb554f03eff8ff", "score": "0.5413824", "text": "func AdminUsergroupExistsG(iD int) (bool, error) {\n\treturn AdminUsergroupExists(boil.GetDB(), iD)\n}", "title": "" }, { "docid": "4af6a64b2a6592a082d9cd7fbd25b2ee", "score": "0.53963715", "text": "func (t *NetworkInstance_Mpls_TeGlobalAttributes) GetAdminGroup(AdminGroupName string) *NetworkInstance_Mpls_TeGlobalAttributes_AdminGroup {\n\n\tif t == nil {\n\t\treturn nil\n\t}\n\n\tkey := AdminGroupName\n\n\tif lm, ok := t.AdminGroup[key]; ok {\n\t\treturn lm\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4af6a64b2a6592a082d9cd7fbd25b2ee", "score": "0.53963715", "text": "func (t *NetworkInstance_Mpls_TeGlobalAttributes) GetAdminGroup(AdminGroupName string) *NetworkInstance_Mpls_TeGlobalAttributes_AdminGroup {\n\n\tif t == nil {\n\t\treturn nil\n\t}\n\n\tkey := AdminGroupName\n\n\tif lm, ok := t.AdminGroup[key]; ok {\n\t\treturn lm\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4af6a64b2a6592a082d9cd7fbd25b2ee", "score": "0.53963715", "text": "func (t *NetworkInstance_Mpls_TeGlobalAttributes) GetAdminGroup(AdminGroupName string) *NetworkInstance_Mpls_TeGlobalAttributes_AdminGroup {\n\n\tif t == nil {\n\t\treturn nil\n\t}\n\n\tkey := AdminGroupName\n\n\tif lm, ok := t.AdminGroup[key]; ok {\n\t\treturn lm\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "29d3d57f8786a4f5991e31f50a30654a", "score": "0.5374311", "text": "func Group(c buffalo.Context) error {\n\tid, err := strconv.Atoi(c.Param(\"id\"))\n\tif err != nil {\n\t\treturn c.Error(http.StatusInternalServerError, err)\n\t}\n\tgroup, err := modelext.FindGroup(c, id)\n\tif err != nil {\n\t\treturn c.Error(http.StatusInternalServerError, err)\n\t}\n\tc.Set(\"group\", group)\n\tc.Set(\"users\", group.R.Users)\n\treturn c.Render(http.StatusOK, render.HTML(\"admin/group.html\", \"admin.html\"))\n}", "title": "" }, { "docid": "2eb4aa7d9d48e7bdf7a473c71c4c0b43", "score": "0.53729075", "text": "func (o *CollectionI18n) SetCollectionG(insert bool, related *Collection) error {\n\treturn o.SetCollection(boil.GetDB(), insert, related)\n}", "title": "" }, { "docid": "03a692b1f0016586766cd066ac1646ad", "score": "0.5358783", "text": "func (m *PrivilegedAccessGroupEligibilityScheduleInstance) SetGroup(value Groupable)() {\n err := m.GetBackingStore().Set(\"group\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "b6e01dbe5e8d042fb4f49ac9c3321cf6", "score": "0.5349704", "text": "func (recv *RadioButton) SetGroup(group *glib.SList) {\n\tc_group := (*C.GSList)(C.NULL)\n\tif group != nil {\n\t\tc_group = (*C.GSList)(group.ToC())\n\t}\n\n\tC.gtk_radio_button_set_group((*C.GtkRadioButton)(recv.native), c_group)\n\n\treturn\n}", "title": "" }, { "docid": "3535883030a3e32f7c82fff080b30037", "score": "0.53408486", "text": "func (t *NetworkInstance_Mpls_TeGlobalAttributes) GetAdminGroup(AdminGroupName string) *NetworkInstance_Mpls_TeGlobalAttributes_AdminGroup {\n\n\tkey := AdminGroupName\n\n\tif lm, ok := t.AdminGroup[key]; ok {\n\t\treturn lm\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "715820a8ca0e136a3202245e52a08e89", "score": "0.5340425", "text": "func (o *OrderItemOption) SetOptionG(ctx context.Context, insert bool, related *Option) error {\n\treturn o.SetOption(ctx, boil.GetContextDB(), insert, related)\n}", "title": "" }, { "docid": "a7dbd28947c29ff35ff3fe7426aab42f", "score": "0.5336799", "text": "func (o *UserKycDocument) SetUserG(insert bool, related *UserProfile) error {\n\treturn o.SetUser(boil.GetDB(), insert, related)\n}", "title": "" }, { "docid": "3e620388a24064ed44fb0806f609bee6", "score": "0.5335474", "text": "func (recv *RadioToolButton) SetGroup(group *glib.SList) {\n\tc_group := (*C.GSList)(C.NULL)\n\tif group != nil {\n\t\tc_group = (*C.GSList)(group.ToC())\n\t}\n\n\tC.gtk_radio_tool_button_set_group((*C.GtkRadioToolButton)(recv.native), c_group)\n\n\treturn\n}", "title": "" }, { "docid": "81474a7a76df46d95ba2fb478325d566", "score": "0.5329189", "text": "func (o *DjangoAdminLog) UpdateG(whitelist ...string) error {\n\treturn o.Update(boil.GetDB(), whitelist...)\n}", "title": "" }, { "docid": "d9b8eeb28e22651d2fed2eabb83c2454", "score": "0.5317589", "text": "func (o *DjangoAdminLog) SetContentTypeG(insert bool, related *DjangoContentType) error {\n\treturn o.SetContentType(boil.GetDB(), insert, related)\n}", "title": "" }, { "docid": "0ff3c76fd7224531a54b1f6b3fd63b25", "score": "0.5310697", "text": "func (s *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Subtlv) GetAdminGroup() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Subtlv_AdminGroup {\n\tif s != nil && s.AdminGroup != nil {\n\t\treturn s.AdminGroup\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0ff3c76fd7224531a54b1f6b3fd63b25", "score": "0.53099537", "text": "func (s *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Subtlv) GetAdminGroup() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Subtlv_AdminGroup {\n\tif s != nil && s.AdminGroup != nil {\n\t\treturn s.AdminGroup\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5d15b3a885e27b4b67e08262034536fa", "score": "0.53092504", "text": "func (recv *ImageMenuItem) SetAccelGroup(accelGroup *AccelGroup) {\n\tc_accel_group := (*C.GtkAccelGroup)(C.NULL)\n\tif accelGroup != nil {\n\t\tc_accel_group = (*C.GtkAccelGroup)(accelGroup.ToC())\n\t}\n\n\tC.gtk_image_menu_item_set_accel_group((*C.GtkImageMenuItem)(recv.native), c_accel_group)\n\n\treturn\n}", "title": "" }, { "docid": "67ded0c0efd793589ba36a60680f4c14", "score": "0.53092223", "text": "func (o *UserRelationship) UpdateG(whitelist ...string) error {\n\treturn o.Update(boil.GetDB(), whitelist...)\n}", "title": "" }, { "docid": "094740a7469f12cf716e5a947a9e3ee2", "score": "0.53057027", "text": "func (o *RoleGroup) SetRoleMenusG(insert bool, related ...*RoleMenu) error {\n\treturn o.SetRoleMenus(boil.GetDB(), insert, related...)\n}", "title": "" }, { "docid": "7ad2f424d81a07227e2e46f4e75353f0", "score": "0.5299", "text": "func (o *RuleStore) SetRuleGroup(ctx context.Context, userID string, namespace string, group *rules.RuleGroupDesc) error {\n\tdata, err := proto.Marshal(group)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tobjectKey := generateRuleObjectKey(userID, namespace, group.Name)\n\treturn o.client.PutObject(ctx, objectKey, bytes.NewReader(data))\n}", "title": "" }, { "docid": "b4fd5740eaff1c2d2b4c1a111c1a1a7c", "score": "0.5287424", "text": "func (o *Metric) SetCategoryG(insert bool, related *Category) error {\n\treturn o.SetCategory(boil.GetDB(), insert, related)\n}", "title": "" }, { "docid": "834dfd5188d0edee51ed0af22f1686f0", "score": "0.5286816", "text": "func (ruo *RequestUpdateOne) SetGroup(g *Group) *RequestUpdateOne {\n\treturn ruo.SetGroupID(g.ID)\n}", "title": "" }, { "docid": "5af5af57d510fe59edb0f2208cc53bbe", "score": "0.52867544", "text": "func (o *BraceletBracelet) SetUserG(insert bool, related *AuthUser) error {\n\treturn o.SetUser(boil.GetDB(), insert, related)\n}", "title": "" }, { "docid": "71231b03ccd0ece1523f8a356b6424fd", "score": "0.5280245", "text": "func (o *CollectionI18n) SetUserGP(insert bool, related *User) {\n\tif err := o.SetUser(boil.GetDB(), insert, related); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "d4da6485297516d4078c64fab9af43c1", "score": "0.5270213", "text": "func (o *AdminUsergroup) DeleteG() (int64, error) {\n\treturn o.Delete(boil.GetDB())\n}", "title": "" }, { "docid": "48836b76b7b62f0594306c3844f413a2", "score": "0.52669144", "text": "func (s *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv) GetAdminGroup() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_AdminGroup {\n\tif s != nil && s.AdminGroup != nil {\n\t\treturn s.AdminGroup\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1cbbf6f793f79358cf7adc07f74ba774", "score": "0.52663", "text": "func (recv *Menu) SetAccelGroup(accelGroup *AccelGroup) {\n\tc_accel_group := (*C.GtkAccelGroup)(C.NULL)\n\tif accelGroup != nil {\n\t\tc_accel_group = (*C.GtkAccelGroup)(accelGroup.ToC())\n\t}\n\n\tC.gtk_menu_set_accel_group((*C.GtkMenu)(recv.native), c_accel_group)\n\n\treturn\n}", "title": "" }, { "docid": "cce7a6f9976a6fb9a946a54c7f959f7d", "score": "0.5262347", "text": "func (t *Mpls_TeGlobalAttributes) GetAdminGroup(AdminGroupName string) *Mpls_TeGlobalAttributes_AdminGroup {\n\n\tif t == nil {\n\t\treturn nil\n\t}\n\n\tkey := AdminGroupName\n\n\tif lm, ok := t.AdminGroup[key]; ok {\n\t\treturn lm\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "cce7a6f9976a6fb9a946a54c7f959f7d", "score": "0.5262347", "text": "func (t *Mpls_TeGlobalAttributes) GetAdminGroup(AdminGroupName string) *Mpls_TeGlobalAttributes_AdminGroup {\n\n\tif t == nil {\n\t\treturn nil\n\t}\n\n\tkey := AdminGroupName\n\n\tif lm, ok := t.AdminGroup[key]; ok {\n\t\treturn lm\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ca4530d9e5da6a598babe4e96ae02700", "score": "0.5260339", "text": "func (o *Avatar) SetPartyG(insert bool, related *Party) error {\n\treturn o.SetParty(boil.GetDB(), insert, related)\n}", "title": "" }, { "docid": "aaf24075b127d485afa2e8b1a91c61b0", "score": "0.5255114", "text": "func (gu *GraphUpdate) SetGroup(g *Group) *GraphUpdate {\n\treturn gu.SetGroupID(g.ID)\n}", "title": "" }, { "docid": "ff2b6b66aa725e9c5bb389e7a486ec1a", "score": "0.5253814", "text": "func (o *UserToken) SetUserG(insert bool, related *User) error {\n\treturn o.SetUser(boil.GetDB(), insert, related)\n}", "title": "" }, { "docid": "24e4044c88f37fb1e8e1099cb6a489c1", "score": "0.52328306", "text": "func (o *DjangoCommentFlag) SetCommentG(insert bool, related *DjangoComment) error {\n\treturn o.SetComment(boil.GetDB(), insert, related)\n}", "title": "" }, { "docid": "5529b73e789df8aca43a3e2d6413792b", "score": "0.5216101", "text": "func UpgradeGroup(groupID uuid.UUID, connections []uuid.UUID, gameInfo model.Group) {\n\tif matchManagerInstance != nil {\n\t\tmatchManagerInstance.StartGame(groupID, connections, gameInfo)\n\t}\n}", "title": "" }, { "docid": "97c377560e749c035d619309af9696ae", "score": "0.5211248", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv) GetAdminGroup() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_AdminGroup {\n\tif t != nil && t.AdminGroup != nil {\n\t\treturn t.AdminGroup\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e2b4becee6565ac80581b1dbc52a7675", "score": "0.5210594", "text": "func (t *Mpls_TeGlobalAttributes) GetAdminGroup(AdminGroupName string) *Mpls_TeGlobalAttributes_AdminGroup {\n\n\tkey := AdminGroupName\n\n\tif lm, ok := t.AdminGroup[key]; ok {\n\t\treturn lm\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d4c6fdb7af58c3ce93c7d1f681d11f1e", "score": "0.52097434", "text": "func (s *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Subtlv) GetAdminGroup() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Subtlv_AdminGroup {\n\tif s != nil && s.AdminGroup != nil {\n\t\treturn s.AdminGroup\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d4c6fdb7af58c3ce93c7d1f681d11f1e", "score": "0.5209359", "text": "func (s *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Subtlv) GetAdminGroup() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Subtlv_AdminGroup {\n\tif s != nil && s.AdminGroup != nil {\n\t\treturn s.AdminGroup\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "73f3527f8ddb9189a3d3cb07b23e5144", "score": "0.52042323", "text": "func (o *DjangoContentType) SetContentTypeDjangoAdminLogsGP(insert bool, related ...*DjangoAdminLog) {\n\tif err := o.SetContentTypeDjangoAdminLogs(boil.GetDB(), insert, related...); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "39e40862ccd5ee6b994f51bc903090fe", "score": "0.51930505", "text": "func (o *RoleGroup) SetRoleCommandsG(insert bool, related ...*RoleCommand) error {\n\treturn o.SetRoleCommands(boil.GetDB(), insert, related...)\n}", "title": "" }, { "docid": "53ff93904093f0ec1864ff25064b9fd5", "score": "0.51781857", "text": "func (o *RoleGroup) SetRoleMenusGP(insert bool, related ...*RoleMenu) {\n\tif err := o.SetRoleMenus(boil.GetDB(), insert, related...); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "da29b524ff382eddb9de8adf61fbaa2c", "score": "0.516706", "text": "func (adminUsergroupL) LoadGroup(e boil.Executor, singular bool, maybeAdminUsergroup interface{}, mods queries.Applicator) error {\n\tvar slice []*AdminUsergroup\n\tvar object *AdminUsergroup\n\n\tif singular {\n\t\tobject = maybeAdminUsergroup.(*AdminUsergroup)\n\t} else {\n\t\tslice = *maybeAdminUsergroup.(*[]*AdminUsergroup)\n\t}\n\n\targs := make([]interface{}, 0, 1)\n\tif singular {\n\t\tif object.R == nil {\n\t\t\tobject.R = &adminUsergroupR{}\n\t\t}\n\t\targs = append(args, object.GroupID)\n\t} else {\n\tOuter:\n\t\tfor _, obj := range slice {\n\t\t\tif obj.R == nil {\n\t\t\t\tobj.R = &adminUsergroupR{}\n\t\t\t}\n\n\t\t\tfor _, a := range args {\n\t\t\t\tif a == obj.GroupID {\n\t\t\t\t\tcontinue Outer\n\t\t\t\t}\n\t\t\t}\n\n\t\t\targs = append(args, obj.GroupID)\n\t\t}\n\t}\n\n\tquery := NewQuery(qm.From(`admin_group`), qm.WhereIn(`id in ?`, args...))\n\tif mods != nil {\n\t\tmods.Apply(query)\n\t}\n\n\tresults, err := query.Query(e)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to eager load AdminGroup\")\n\t}\n\n\tvar resultSlice []*AdminGroup\n\tif err = queries.Bind(results, &resultSlice); err != nil {\n\t\treturn errors.Wrap(err, \"failed to bind eager loaded slice AdminGroup\")\n\t}\n\n\tif err = results.Close(); err != nil {\n\t\treturn errors.Wrap(err, \"failed to close results of eager load for admin_group\")\n\t}\n\tif err = results.Err(); err != nil {\n\t\treturn errors.Wrap(err, \"error occurred during iteration of eager loaded relations for admin_group\")\n\t}\n\n\tif len(adminUsergroupAfterSelectHooks) != 0 {\n\t\tfor _, obj := range resultSlice {\n\t\t\tif err := obj.doAfterSelectHooks(e); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(resultSlice) == 0 {\n\t\treturn nil\n\t}\n\n\tif singular {\n\t\tforeign := resultSlice[0]\n\t\tobject.R.Group = foreign\n\t\tif foreign.R == nil {\n\t\t\tforeign.R = &adminGroupR{}\n\t\t}\n\t\tforeign.R.GroupAdminUsergroups = append(foreign.R.GroupAdminUsergroups, object)\n\t\treturn nil\n\t}\n\n\tfor _, local := range slice {\n\t\tfor _, foreign := range resultSlice {\n\t\t\tif local.GroupID == foreign.ID {\n\t\t\t\tlocal.R.Group = foreign\n\t\t\t\tif foreign.R == nil {\n\t\t\t\t\tforeign.R = &adminGroupR{}\n\t\t\t\t}\n\t\t\t\tforeign.R.GroupAdminUsergroups = append(foreign.R.GroupAdminUsergroups, local)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "8816cb1c9163dfb268b7b9c47c56bfca", "score": "0.51663464", "text": "func (o *Client) SetParentG(insert bool, related *Client) error {\n\treturn o.SetParent(boil.GetDB(), insert, related)\n}", "title": "" }, { "docid": "9a798879c9bf337383d43f60f559314f", "score": "0.5165306", "text": "func (s *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv) GetAdminGroup() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_AdminGroup {\n\tif s != nil && s.AdminGroup != nil {\n\t\treturn s.AdminGroup\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2a35925b06e8f10dfdcb436b42e13552", "score": "0.51650065", "text": "func (o *UserVerificationToken) SetUserG(insert bool, related *User) error {\n\treturn o.SetUser(boil.GetDB(), insert, related)\n}", "title": "" } ]
2cc906473104f3a948c09dbf2a7b05e9
UpsertP attempts an insert using an executor, and does an update or ignore on conflict. UpsertP panics on error.
[ { "docid": "b9641043c10b6ae1f9e3418dbbc9f2fc", "score": "0.7508447", "text": "func (o *Stock) UpsertP(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) {\n\tif err := o.Upsert(exec, updateOnConflict, conflictColumns, updateColumns, whitelist...); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" } ]
[ { "docid": "bb6a5ef9fe3ea434317beaf02dc0e375", "score": "0.78420025", "text": "func (o *Container) UpsertP(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) {\n\tif err := o.Upsert(exec, updateOnConflict, conflictColumns, updateColumns, whitelist...); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "baa0c2b62029d2b29f563f0ea2dafa0f", "score": "0.778055", "text": "func (o *Storage) UpsertP(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) {\n\tif err := o.Upsert(exec, updateOnConflict, conflictColumns, updateColumns, whitelist...); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "8c0deba03bf4b21c1eac9018c08822d9", "score": "0.7663395", "text": "func (o *Sermon) UpsertP(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) {\n\tif err := o.Upsert(exec, updateOnConflict, conflictColumns, updateColumns, whitelist...); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "09920df7b199960af7e1b0baa82a813c", "score": "0.7632355", "text": "func (o *Instrument) UpsertP(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) {\n\tif err := o.Upsert(exec, updateOnConflict, conflictColumns, updateColumns, whitelist...); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "7643f11ad976c994cdab28e385076964", "score": "0.7622196", "text": "func (o *Actor) UpsertP(exec boil.Executor, updateColumns []string, whitelist ...string) {\n\tif err := o.Upsert(exec, updateColumns, whitelist...); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "4aef5141b2cc4be9d7c70626ef3da99f", "score": "0.7484284", "text": "func (o *DUser) UpsertP(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) {\n\tif err := o.Upsert(exec, updateOnConflict, conflictColumns, updateColumns, whitelist...); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "ca14ab7a799aadbafef459a365fd6b54", "score": "0.7462747", "text": "func (o *FeatureCvtermprop) UpsertP(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) {\n\tif err := o.Upsert(exec, updateOnConflict, conflictColumns, updateColumns, whitelist...); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "5380076bdcbbd864defa7c4958ff69d1", "score": "0.7409566", "text": "func (o *Race) UpsertP(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) {\n\tif err := o.Upsert(exec, updateOnConflict, conflictColumns, updateColumns, whitelist...); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "be8ee7b6c19ada9b8d60ee83bbd99391", "score": "0.7392397", "text": "func (o *Asset) UpsertP(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) {\n\tif err := o.Upsert(exec, updateOnConflict, conflictColumns, updateColumns, whitelist...); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "11d7bb48286c7c5c5083e79c257010b7", "score": "0.7343716", "text": "func (o *Balance) UpsertP(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) {\n\tif err := o.Upsert(exec, updateOnConflict, conflictColumns, updateColumns, whitelist...); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "979e79378d305dd1b7a836ebe5a09db6", "score": "0.73110867", "text": "func (o *ContentUnitsPerson) UpsertP(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) {\n\tif err := o.Upsert(exec, updateOnConflict, conflictColumns, updateColumns, whitelist...); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "8d3de649eec9ce2bc0c0cf0e6880e995", "score": "0.72731924", "text": "func (o *Chart) UpsertP(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) {\n\tif err := o.Upsert(exec, updateOnConflict, conflictColumns, updateColumns, whitelist...); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "0e291864a6675c483e98cafdaa1d0ae7", "score": "0.7228467", "text": "func (o *DMember) UpsertP(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) {\n\tif err := o.Upsert(exec, updateOnConflict, conflictColumns, updateColumns, whitelist...); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "c40835f818aaba544cadbda7d3efa52d", "score": "0.7190608", "text": "func (o *Language) UpsertP(exec boil.Executor, updateColumns []string, whitelist ...string) {\n\tif err := o.Upsert(exec, updateColumns, whitelist...); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "bcd3b8e8780794e0697ebe8cdc52cccc", "score": "0.7146455", "text": "func (o *ProcessedTransaction) Upsert(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no processed_transaction provided for upsert\")\n\t}\n\tcurrTime := time.Now().In(boil.GetLocation())\n\n\tif o.CreatedAt.IsZero() {\n\t\to.CreatedAt = currTime\n\t}\n\to.UpdatedAt = currTime\n\n\tif err := o.doBeforeUpsertHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(processedTransactionColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\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\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tprocessedTransactionUpsertCacheMut.RLock()\n\tcache, cached := processedTransactionUpsertCache[key]\n\tprocessedTransactionUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tprocessedTransactionColumns,\n\t\t\tprocessedTransactionColumnsWithDefault,\n\t\t\tprocessedTransactionColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tprocessedTransactionColumns,\n\t\t\tprocessedTransactionPrimaryKeyColumns,\n\t\t)\n\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert processed_transaction, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(processedTransactionPrimaryKeyColumns))\n\t\t\tcopy(conflict, processedTransactionPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"processed_transaction\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(processedTransactionType, processedTransactionMapping, 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(processedTransactionType, processedTransactionMapping, 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.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRow(cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.Exec(cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert processed_transaction\")\n\t}\n\n\tif !cached {\n\t\tprocessedTransactionUpsertCacheMut.Lock()\n\t\tprocessedTransactionUpsertCache[key] = cache\n\t\tprocessedTransactionUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(exec)\n}", "title": "" }, { "docid": "3aed96ea3f8cbbbc3a8093bf55f3bf6d", "score": "0.70731586", "text": "func (o *ReactionType) UpsertP(exec boil.Executor, updateColumns, insertColumns boil.Columns) {\n\tif err := o.Upsert(exec, updateColumns, insertColumns); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "82441dbe4196af7bddf210a786a96f8f", "score": "0.70610046", "text": "func (o *Payment) UpsertP(exec boil.Executor, updateColumns []string, whitelist ...string) {\n\tif err := o.Upsert(exec, updateColumns, whitelist...); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "d0996a7e7729d2f07653c01fbbf72187", "score": "0.7049186", "text": "func (o *Featureprop) UpsertP(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) {\n\tif err := o.Upsert(exec, updateOnConflict, conflictColumns, updateColumns, whitelist...); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "23c4bb39a3ec08d03f37232205136fd1", "score": "0.70473355", "text": "func (b *Bench4) Upsert(db XODB) error {\n\tvar err error\n\n\t// if already exist, bail\n\tif b._exists {\n\t\treturn errors.New(\"insert failed: already exists\")\n\t}\n\n\t// sql query\n\tconst sqlstr = `INSERT INTO public.bench4 (` +\n\t\t`Id, Text, Time, Name, Indexed` +\n\t\t`) VALUES (` +\n\t\t`$1, $2, $3, $4, $5` +\n\t\t`) ON CONFLICT (Id) DO UPDATE SET (` +\n\t\t`Id, Text, Time, Name, Indexed` +\n\t\t`) = (` +\n\t\t`EXCLUDED.Id, EXCLUDED.Text, EXCLUDED.Time, EXCLUDED.Name, EXCLUDED.Indexed` +\n\t\t`)`\n\n\t// run query\n\tXOLog(sqlstr, b.Id, b.Text, b.Time, b.Name, b.Indexed)\n\t_, err = db.Exec(sqlstr, b.Id, b.Text, b.Time, b.Name, b.Indexed)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// set existence\n\tb._exists = true\n\n\treturn nil\n}", "title": "" }, { "docid": "7842ce8bf73d1dc50359a3ab8520ccfb", "score": "0.70286196", "text": "func (o *Link) UpsertP(exec boil.Executor, updateColumns []string, whitelist ...string) {\n\tif err := o.Upsert(exec, updateColumns, whitelist...); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "4a56925de9aa4cffe18f73fad5f86a6d", "score": "0.7020778", "text": "func (o *DChannelOverwrite) UpsertP(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) {\n\tif err := o.Upsert(exec, updateOnConflict, conflictColumns, updateColumns, whitelist...); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "880a7e903dd63603768b2f3257a0a992", "score": "0.70057577", "text": "func (o *Organisation) UpsertP(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) {\n\tif err := o.Upsert(exec, updateOnConflict, conflictColumns, updateColumns, whitelist...); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "f7b86468c74027eaa569854772232fb7", "score": "0.7002886", "text": "func (o *Pubprop) UpsertP(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) {\n\tif err := o.Upsert(exec, updateOnConflict, conflictColumns, updateColumns, whitelist...); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "40d58f5a2537702c527ca114778eec95", "score": "0.6984788", "text": "func (o *NameRef) UpsertP(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) {\n\tif err := o.Upsert(exec, updateOnConflict, conflictColumns, updateColumns, whitelist...); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "f3cb69260bdd94388c72aa7777131345", "score": "0.69084316", "text": "func (o *Publishqueue) Upsert(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"stellarcore: no publishqueue provided for upsert\")\n\t}\n\n\tif err := o.doBeforeUpsertHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(publishqueueColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\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\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tpublishqueueUpsertCacheMut.RLock()\n\tcache, cached := publishqueueUpsertCache[key]\n\tpublishqueueUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tpublishqueueColumns,\n\t\t\tpublishqueueColumnsWithDefault,\n\t\t\tpublishqueueColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tpublishqueueColumns,\n\t\t\tpublishqueuePrimaryKeyColumns,\n\t\t)\n\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"stellarcore: unable to upsert publishqueue, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(publishqueuePrimaryKeyColumns))\n\t\t\tcopy(conflict, publishqueuePrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"publishqueue\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(publishqueueType, publishqueueMapping, 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(publishqueueType, publishqueueMapping, 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.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRow(cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.Exec(cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"stellarcore: unable to upsert publishqueue\")\n\t}\n\n\tif !cached {\n\t\tpublishqueueUpsertCacheMut.Lock()\n\t\tpublishqueueUpsertCache[key] = cache\n\t\tpublishqueueUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(exec)\n}", "title": "" }, { "docid": "3775cfa28467524aa4d68585efe5c7b6", "score": "0.68566316", "text": "func Upsert(ext sqlx.Ext, u Upserter) (status int, err error) {\n\tdefer func() {\n\t\tif Debug {\n\t\t\tlog.Println(statusToText(status), u)\n\t\t}\n\t}()\n\n\t// Try to update, return immediately if succcesful\n\tstatus, err = Update(ext, u)\n\tif err == nil {\n\t\treturn\n\t}\n\n\t// Can't update? Try insert\n\terr = Insert(ext, u)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\n\tstatus = Inserted\n\n\treturn\n}", "title": "" }, { "docid": "c4e9263c2b47d80ee1d09007fe5f9e0c", "score": "0.68233454", "text": "func (o *BloggerMood) UpsertP(exec boil.Executor, updateColumns []string, whitelist ...string) {\n\tif err := o.Upsert(exec, updateColumns, whitelist...); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "3012e0d87a5fd35bb45e3cc19267e9e2", "score": "0.68113154", "text": "func (o *OriginPackage) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no origin_packages provided for upsert\")\n\t}\n\tif !boil.TimestampsAreSkipped(ctx) {\n\t\tcurrTime := time.Now().In(boil.GetLocation())\n\n\t\tif queries.MustTime(o.CreatedAt).IsZero() {\n\t\t\tqueries.SetScanner(&o.CreatedAt, currTime)\n\t\t}\n\t\tqueries.SetScanner(&o.UpdatedAt, currTime)\n\t}\n\n\tif err := o.doBeforeUpsertHooks(ctx, exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(originPackageColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\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\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\toriginPackageUpsertCacheMut.RLock()\n\tcache, cached := originPackageUpsertCache[key]\n\toriginPackageUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\toriginPackageColumns,\n\t\t\toriginPackageColumnsWithDefault,\n\t\t\toriginPackageColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\toriginPackageColumns,\n\t\t\toriginPackagePrimaryKeyColumns,\n\t\t)\n\n\t\tif updateOnConflict && len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert origin_packages, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(originPackagePrimaryKeyColumns))\n\t\t\tcopy(conflict, originPackagePrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"origin_packages\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(originPackageType, originPackageMapping, 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(originPackageType, originPackageMapping, 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.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRowContext(ctx, cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.ExecContext(ctx, cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert origin_packages\")\n\t}\n\n\tif !cached {\n\t\toriginPackageUpsertCacheMut.Lock()\n\t\toriginPackageUpsertCache[key] = cache\n\t\toriginPackageUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(ctx, exec)\n}", "title": "" }, { "docid": "b6b571b0d8e03a0ec5cc04eed938f36a", "score": "0.6777953", "text": "func (o *Salt) Upsert(exec boil.Executor, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no salts provided for upsert\")\n\t}\n\tcurrTime := time.Now().In(boil.GetLocation())\n\n\tif queries.MustTime(o.CreatedAt).IsZero() {\n\t\tqueries.SetScanner(&o.CreatedAt, currTime)\n\t}\n\tqueries.SetScanner(&o.UpdatedAt, currTime)\n\n\tif err := o.doBeforeUpsertHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(saltColumnsWithDefault, o)\n\tnzUniques := queries.NonZeroDefaultSet(mySQLSaltUniqueColumns, 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\tsaltUpsertCacheMut.RLock()\n\tcache, cached := saltUpsertCache[key]\n\tsaltUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tsaltAllColumns,\n\t\t\tsaltColumnsWithDefault,\n\t\t\tsaltColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tsaltAllColumns,\n\t\t\tsaltPrimaryKeyColumns,\n\t\t)\n\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert salts, could not build update column list\")\n\t\t}\n\n\t\tret = strmangle.SetComplement(ret, nzUniques)\n\t\tcache.query = buildUpsertQueryMySQL(dialect, \"salts\", update, insert)\n\t\tcache.retQuery = fmt.Sprintf(\n\t\t\t\"SELECT %s FROM `salts` 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(saltType, saltMapping, 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(saltType, saltMapping, 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.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\tresult, err := exec.Exec(cache.query, vals...)\n\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert for salts\")\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 = uint(lastID)\n\tif lastID != 0 && len(cache.retMapping) == 1 && cache.retMapping[0] == saltMapping[\"id\"] {\n\t\tgoto CacheNoHooks\n\t}\n\n\tuniqueMap, err = queries.BindMapping(saltType, saltMapping, nzUniques)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to retrieve unique values for salts\")\n\t}\n\tnzUniqueCols = queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), uniqueMap)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.retQuery)\n\t\tfmt.Fprintln(boil.DebugWriter, nzUniqueCols...)\n\t}\n\terr = exec.QueryRow(cache.retQuery, nzUniqueCols...).Scan(returns...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to populate default values for salts\")\n\t}\n\nCacheNoHooks:\n\tif !cached {\n\t\tsaltUpsertCacheMut.Lock()\n\t\tsaltUpsertCache[key] = cache\n\t\tsaltUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(exec)\n}", "title": "" }, { "docid": "da53d67329d065e7dbacbd9a89390372", "score": "0.67413855", "text": "func (o *Friendship) UpsertP(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) {\n\tif err := o.Upsert(exec, updateOnConflict, conflictColumns, updateColumns, whitelist...); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "5f79867c715cf924c9718f0a511f9ad3", "score": "0.66760993", "text": "func (o *Peer) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no peers provided for upsert\")\n\t}\n\tif !boil.TimestampsAreSkipped(ctx) {\n\t\tcurrTime := time.Now().In(boil.GetLocation())\n\n\t\to.UpdatedAt = currTime\n\t\tif o.CreatedAt.IsZero() {\n\t\t\to.CreatedAt = currTime\n\t\t}\n\t}\n\n\tif err := o.doBeforeUpsertHooks(ctx, exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(peerColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\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\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tpeerUpsertCacheMut.RLock()\n\tcache, cached := peerUpsertCache[key]\n\tpeerUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tpeerAllColumns,\n\t\t\tpeerColumnsWithDefault,\n\t\t\tpeerColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tpeerAllColumns,\n\t\t\tpeerPrimaryKeyColumns,\n\t\t)\n\n\t\tinsert = strmangle.SetComplement(insert, peerGeneratedColumns)\n\t\tupdate = strmangle.SetComplement(update, peerGeneratedColumns)\n\n\t\tif updateOnConflict && len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert peers, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(peerPrimaryKeyColumns))\n\t\t\tcopy(conflict, peerPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"peers\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(peerType, peerMapping, 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(peerType, peerMapping, 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\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRowContext(ctx, cache.query, vals...).Scan(returns...)\n\t\tif errors.Is(err, sql.ErrNoRows) {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.ExecContext(ctx, cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert peers\")\n\t}\n\n\tif !cached {\n\t\tpeerUpsertCacheMut.Lock()\n\t\tpeerUpsertCache[key] = cache\n\t\tpeerUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(ctx, exec)\n}", "title": "" }, { "docid": "417960f24569fb9b87b1c0f18f17d2ed", "score": "0.6675876", "text": "func (o *Instrument) Upsert(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no instrument provided for upsert\")\n\t}\n\tcurrTime := time.Now().In(boil.GetLocation())\n\n\tif o.CreatedAt.IsZero() {\n\t\to.CreatedAt = currTime\n\t}\n\to.UpdatedAt = currTime\n\n\tif err := o.doBeforeUpsertHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(instrumentColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs postgres problems\n\tbuf := strmangle.GetBuffer()\n\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range updateColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range whitelist {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tinstrumentUpsertCacheMut.RLock()\n\tcache, cached := instrumentUpsertCache[key]\n\tinstrumentUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := strmangle.InsertColumnSet(\n\t\t\tinstrumentColumns,\n\t\t\tinstrumentColumnsWithDefault,\n\t\t\tinstrumentColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t\twhitelist,\n\t\t)\n\n\t\tupdate := strmangle.UpdateColumnSet(\n\t\t\tinstrumentColumns,\n\t\t\tinstrumentPrimaryKeyColumns,\n\t\t\tupdateColumns,\n\t\t)\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert instrument, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(instrumentPrimaryKeyColumns))\n\t\t\tcopy(conflict, instrumentPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = queries.BuildUpsertQueryPostgres(dialect, \"\\\"instruments\\\".\\\"instrument\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(instrumentType, instrumentMapping, 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(instrumentType, instrumentMapping, 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.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRow(cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.Exec(cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert instrument\")\n\t}\n\n\tif !cached {\n\t\tinstrumentUpsertCacheMut.Lock()\n\t\tinstrumentUpsertCache[key] = cache\n\t\tinstrumentUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(exec)\n}", "title": "" }, { "docid": "bcad1229bd9e19b748053c7e6883ace4", "score": "0.6673544", "text": "func (node *Proxy) Upsert(ctx context.Context, request *milvuspb.UpsertRequest) (*milvuspb.MutationResult, error) {\n\tctx, sp := otel.Tracer(typeutil.ProxyRole).Start(ctx, \"Proxy-Upsert\")\n\tdefer sp.End()\n\n\tlog := log.Ctx(ctx).With(\n\t\tzap.String(\"role\", typeutil.ProxyRole),\n\t\tzap.String(\"db\", request.DbName),\n\t\tzap.String(\"collection\", request.CollectionName),\n\t\tzap.String(\"partition\", request.PartitionName),\n\t\tzap.Uint32(\"NumRows\", request.NumRows),\n\t)\n\tlog.Debug(\"Start processing upsert request in Proxy\")\n\n\tif !node.checkHealthy() {\n\t\treturn &milvuspb.MutationResult{\n\t\t\tStatus: unhealthyStatus(),\n\t\t}, nil\n\t}\n\tmethod := \"Upsert\"\n\ttr := timerecord.NewTimeRecorder(method)\n\n\tmetrics.ProxyReceiveBytes.WithLabelValues(\n\t\tstrconv.FormatInt(paramtable.GetNodeID(), 10),\n\t\tmetrics.UpsertLabel, request.GetCollectionName()).Add(float64(proto.Size(request)))\n\tmetrics.ProxyFunctionCall.WithLabelValues(strconv.FormatInt(paramtable.GetNodeID(), 10), method, metrics.TotalLabel).Inc()\n\n\trequest.Base = commonpbutil.NewMsgBase(\n\t\tcommonpbutil.WithMsgType(commonpb.MsgType_Upsert),\n\t\tcommonpbutil.WithSourceID(paramtable.GetNodeID()),\n\t)\n\n\tit := &upsertTask{\n\t\tbaseMsg: msgstream.BaseMsg{\n\t\t\tHashValues: request.HashKeys,\n\t\t},\n\t\tctx: ctx,\n\t\tCondition: NewTaskCondition(ctx),\n\t\treq: request,\n\t\tresult: &milvuspb.MutationResult{\n\t\t\tStatus: merr.Status(nil),\n\t\t\tIDs: &schemapb.IDs{\n\t\t\t\tIdField: nil,\n\t\t\t},\n\t\t},\n\n\t\tidAllocator: node.rowIDAllocator,\n\t\tsegIDAssigner: node.segAssigner,\n\t\tchMgr: node.chMgr,\n\t\tchTicker: node.chTicker,\n\t}\n\n\tconstructFailedResponse := func(err error, errCode commonpb.ErrorCode) *milvuspb.MutationResult {\n\t\tnumRows := request.NumRows\n\t\terrIndex := make([]uint32, numRows)\n\t\tfor i := uint32(0); i < numRows; i++ {\n\t\t\terrIndex[i] = i\n\t\t}\n\n\t\treturn &milvuspb.MutationResult{\n\t\t\tStatus: &commonpb.Status{\n\t\t\t\tErrorCode: errCode,\n\t\t\t\tReason: err.Error(),\n\t\t\t},\n\t\t\tErrIndex: errIndex,\n\t\t}\n\t}\n\n\tlog.Debug(\"Enqueue upsert request in Proxy\",\n\t\tzap.Int(\"len(FieldsData)\", len(request.FieldsData)),\n\t\tzap.Int(\"len(HashKeys)\", len(request.HashKeys)))\n\n\tif err := node.sched.dmQueue.Enqueue(it); err != nil {\n\t\tlog.Info(\"Failed to enqueue upsert task\",\n\t\t\tzap.Error(err))\n\t\tmetrics.ProxyFunctionCall.WithLabelValues(strconv.FormatInt(paramtable.GetNodeID(), 10), method,\n\t\t\tmetrics.AbandonLabel).Inc()\n\t\treturn &milvuspb.MutationResult{\n\t\t\tStatus: merr.Status(err),\n\t\t}, nil\n\t}\n\n\tlog.Debug(\"Detail of upsert request in Proxy\",\n\t\tzap.Uint64(\"BeginTS\", it.BeginTs()),\n\t\tzap.Uint64(\"EndTS\", it.EndTs()))\n\n\tif err := it.WaitToFinish(); err != nil {\n\t\tlog.Info(\"Failed to execute insert task in task scheduler\",\n\t\t\tzap.Error(err))\n\t\tmetrics.ProxyFunctionCall.WithLabelValues(strconv.FormatInt(paramtable.GetNodeID(), 10), method,\n\t\t\tmetrics.FailLabel).Inc()\n\t\t// Not every error case changes the status internally\n\t\t// change status there to handle it\n\t\tif it.result.Status.ErrorCode == commonpb.ErrorCode_Success {\n\t\t\tit.result.Status.ErrorCode = commonpb.ErrorCode_UnexpectedError\n\t\t}\n\t\treturn constructFailedResponse(err, it.result.Status.ErrorCode), nil\n\t}\n\n\tif it.result.Status.ErrorCode != commonpb.ErrorCode_Success {\n\t\tsetErrorIndex := func() {\n\t\t\tnumRows := request.NumRows\n\t\t\terrIndex := make([]uint32, numRows)\n\t\t\tfor i := uint32(0); i < numRows; i++ {\n\t\t\t\terrIndex[i] = i\n\t\t\t}\n\t\t\tit.result.ErrIndex = errIndex\n\t\t}\n\t\tsetErrorIndex()\n\t}\n\n\tinsertReceiveSize := proto.Size(it.upsertMsg.InsertMsg)\n\tdeleteReceiveSize := proto.Size(it.upsertMsg.DeleteMsg)\n\n\trateCol.Add(internalpb.RateType_DMLUpsert.String(), float64(insertReceiveSize+deleteReceiveSize))\n\n\tmetrics.ProxyFunctionCall.WithLabelValues(strconv.FormatInt(paramtable.GetNodeID(), 10), method,\n\t\tmetrics.SuccessLabel).Inc()\n\tmetrics.ProxyMutationLatency.WithLabelValues(strconv.FormatInt(paramtable.GetNodeID(), 10), metrics.UpsertLabel).Observe(float64(tr.ElapseSpan().Milliseconds()))\n\tmetrics.ProxyCollectionMutationLatency.WithLabelValues(strconv.FormatInt(paramtable.GetNodeID(), 10), metrics.UpsertLabel, request.CollectionName).Observe(float64(tr.ElapseSpan().Milliseconds()))\n\n\tlog.Debug(\"Finish processing upsert request in Proxy\")\n\treturn it.result, nil\n}", "title": "" }, { "docid": "ddc8f9ec28d7ffb9733a400d6618fcb9", "score": "0.6663747", "text": "func (o *Storage) Upsert(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) error {\n\tif o == nil {\n\t\treturn errors.New(\"mdbmdbmodels: no storages provided for upsert\")\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(storageColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs postgres problems\n\tbuf := strmangle.GetBuffer()\n\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range updateColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range whitelist {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tstorageUpsertCacheMut.RLock()\n\tcache, cached := storageUpsertCache[key]\n\tstorageUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := strmangle.InsertColumnSet(\n\t\t\tstorageColumns,\n\t\t\tstorageColumnsWithDefault,\n\t\t\tstorageColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t\twhitelist,\n\t\t)\n\n\t\tupdate := strmangle.UpdateColumnSet(\n\t\t\tstorageColumns,\n\t\t\tstoragePrimaryKeyColumns,\n\t\t\tupdateColumns,\n\t\t)\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"mdbmdbmodels: unable to upsert storages, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(storagePrimaryKeyColumns))\n\t\t\tcopy(conflict, storagePrimaryKeyColumns)\n\t\t}\n\t\tcache.query = queries.BuildUpsertQueryPostgres(dialect, \"\\\"storages\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(storageType, storageMapping, 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(storageType, storageMapping, 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.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRow(cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.Exec(cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"mdbmdbmodels: unable to upsert storages\")\n\t}\n\n\tif !cached {\n\t\tstorageUpsertCacheMut.Lock()\n\t\tstorageUpsertCache[key] = cache\n\t\tstorageUpsertCacheMut.Unlock()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3b221a3d063fe998344bc45cf3655d3a", "score": "0.6660906", "text": "func (o *FeatureCvtermprop) Upsert(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) error {\n\tif o == nil {\n\t\treturn errors.New(\"chado: no feature_cvtermprop provided for upsert\")\n\t}\n\n\tif err := o.doBeforeUpsertHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(featureCvtermpropColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs postgres problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range updateColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range whitelist {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tfeatureCvtermpropUpsertCacheMut.RLock()\n\tcache, cached := featureCvtermpropUpsertCache[key]\n\tfeatureCvtermpropUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tvar ret []string\n\t\twhitelist, ret = strmangle.InsertColumnSet(\n\t\t\tfeatureCvtermpropColumns,\n\t\t\tfeatureCvtermpropColumnsWithDefault,\n\t\t\tfeatureCvtermpropColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t\twhitelist,\n\t\t)\n\t\tupdate := strmangle.UpdateColumnSet(\n\t\t\tfeatureCvtermpropColumns,\n\t\t\tfeatureCvtermpropPrimaryKeyColumns,\n\t\t\tupdateColumns,\n\t\t)\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"chado: unable to upsert feature_cvtermprop, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(featureCvtermpropPrimaryKeyColumns))\n\t\t\tcopy(conflict, featureCvtermpropPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = queries.BuildUpsertQueryPostgres(dialect, \"\\\"feature_cvtermprop\\\"\", updateOnConflict, ret, update, conflict, whitelist)\n\n\t\tcache.valueMapping, err = queries.BindMapping(featureCvtermpropType, featureCvtermpropMapping, whitelist)\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(featureCvtermpropType, featureCvtermpropMapping, 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.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRow(cache.query, vals...).Scan(returns...)\n\t} else {\n\t\t_, err = exec.Exec(cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"chado: unable to upsert for feature_cvtermprop\")\n\t}\n\n\tif !cached {\n\t\tfeatureCvtermpropUpsertCacheMut.Lock()\n\t\tfeatureCvtermpropUpsertCache[key] = cache\n\t\tfeatureCvtermpropUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(exec)\n}", "title": "" }, { "docid": "c153e87dcbce91a62f95cc78cd3ff6ed", "score": "0.66400445", "text": "func (o *Pubprop) Upsert(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) error {\n\tif o == nil {\n\t\treturn errors.New(\"chado: no pubprop provided for upsert\")\n\t}\n\n\tif err := o.doBeforeUpsertHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(pubpropColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs postgres problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range updateColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range whitelist {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tpubpropUpsertCacheMut.RLock()\n\tcache, cached := pubpropUpsertCache[key]\n\tpubpropUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tvar ret []string\n\t\twhitelist, ret = strmangle.InsertColumnSet(\n\t\t\tpubpropColumns,\n\t\t\tpubpropColumnsWithDefault,\n\t\t\tpubpropColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t\twhitelist,\n\t\t)\n\t\tupdate := strmangle.UpdateColumnSet(\n\t\t\tpubpropColumns,\n\t\t\tpubpropPrimaryKeyColumns,\n\t\t\tupdateColumns,\n\t\t)\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"chado: unable to upsert pubprop, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(pubpropPrimaryKeyColumns))\n\t\t\tcopy(conflict, pubpropPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = queries.BuildUpsertQueryPostgres(dialect, \"\\\"pubprop\\\"\", updateOnConflict, ret, update, conflict, whitelist)\n\n\t\tcache.valueMapping, err = queries.BindMapping(pubpropType, pubpropMapping, whitelist)\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(pubpropType, pubpropMapping, 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.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRow(cache.query, vals...).Scan(returns...)\n\t} else {\n\t\t_, err = exec.Exec(cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"chado: unable to upsert for pubprop\")\n\t}\n\n\tif !cached {\n\t\tpubpropUpsertCacheMut.Lock()\n\t\tpubpropUpsertCache[key] = cache\n\t\tpubpropUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(exec)\n}", "title": "" }, { "docid": "2869f8acd099de4936fea542612dc9c7", "score": "0.66365755", "text": "func (o *RSVPParticipant) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no rsvp_participants provided for upsert\")\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(rsvpParticipantColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\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\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\trsvpParticipantUpsertCacheMut.RLock()\n\tcache, cached := rsvpParticipantUpsertCache[key]\n\trsvpParticipantUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\trsvpParticipantAllColumns,\n\t\t\trsvpParticipantColumnsWithDefault,\n\t\t\trsvpParticipantColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\trsvpParticipantAllColumns,\n\t\t\trsvpParticipantPrimaryKeyColumns,\n\t\t)\n\n\t\tif updateOnConflict && len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert rsvp_participants, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(rsvpParticipantPrimaryKeyColumns))\n\t\t\tcopy(conflict, rsvpParticipantPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"rsvp_participants\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(rsvpParticipantType, rsvpParticipantMapping, 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(rsvpParticipantType, rsvpParticipantMapping, 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\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRowContext(ctx, cache.query, vals...).Scan(returns...)\n\t\tif errors.Is(err, sql.ErrNoRows) {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.ExecContext(ctx, cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert rsvp_participants\")\n\t}\n\n\tif !cached {\n\t\trsvpParticipantUpsertCacheMut.Lock()\n\t\trsvpParticipantUpsertCache[key] = cache\n\t\trsvpParticipantUpsertCacheMut.Unlock()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "4bb1f15b50b98ef3709b2eee36d58bfa", "score": "0.65892106", "text": "func (o *Snapshot) Upsert(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no snapshot provided for upsert\")\n\t}\n\tcurrTime := time.Now().In(boil.GetLocation())\n\n\tif o.CreatedAt.IsZero() {\n\t\to.CreatedAt = currTime\n\t}\n\to.UpdatedAt = currTime\n\n\tif err := o.doBeforeUpsertHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(snapshotColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\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\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tsnapshotUpsertCacheMut.RLock()\n\tcache, cached := snapshotUpsertCache[key]\n\tsnapshotUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tsnapshotColumns,\n\t\t\tsnapshotColumnsWithDefault,\n\t\t\tsnapshotColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tsnapshotColumns,\n\t\t\tsnapshotPrimaryKeyColumns,\n\t\t)\n\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert snapshot, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(snapshotPrimaryKeyColumns))\n\t\t\tcopy(conflict, snapshotPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"snapshot\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(snapshotType, snapshotMapping, 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(snapshotType, snapshotMapping, 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.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRow(cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.Exec(cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert snapshot\")\n\t}\n\n\tif !cached {\n\t\tsnapshotUpsertCacheMut.Lock()\n\t\tsnapshotUpsertCache[key] = cache\n\t\tsnapshotUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(exec)\n}", "title": "" }, { "docid": "c014fc4968c5aebb9cf27127d2fa7dfd", "score": "0.65781343", "text": "func (o *Actor) Upsert(exec boil.Executor, updateColumns []string, whitelist ...string) error {\n\tif o == nil {\n\t\treturn errors.New(\"sqlboiler: no actor provided for upsert\")\n\t}\n\n\tif err := o.doBeforeUpsertHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(actorColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs postgres problems\n\tbuf := strmangle.GetBuffer()\n\tfor _, c := range updateColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range whitelist {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tactorUpsertCacheMut.RLock()\n\tcache, cached := actorUpsertCache[key]\n\tactorUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := strmangle.InsertColumnSet(\n\t\t\tactorColumns,\n\t\t\tactorColumnsWithDefault,\n\t\t\tactorColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t\twhitelist,\n\t\t)\n\n\t\tupdate := strmangle.UpdateColumnSet(\n\t\t\tactorColumns,\n\t\t\tactorPrimaryKeyColumns,\n\t\t\tupdateColumns,\n\t\t)\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"sqlboiler: unable to upsert actor, could not build update column list\")\n\t\t}\n\n\t\tcache.query = queries.BuildUpsertQueryMySQL(dialect, \"actor\", update, insert)\n\t\tcache.retQuery = fmt.Sprintf(\n\t\t\t\"SELECT %s FROM `actor` WHERE `actor_id`=?\",\n\t\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, ret), \",\"),\n\t\t)\n\n\t\tcache.valueMapping, err = queries.BindMapping(actorType, actorMapping, 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(actorType, actorMapping, 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.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tresult, err := exec.Exec(cache.query, vals...)\n\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"sqlboiler: unable to upsert for actor\")\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.ActorID = uint16(lastID)\n\tif lastID != 0 && len(cache.retMapping) == 1 && cache.retMapping[0] == actorMapping[\"ActorID\"] {\n\t\tgoto CacheNoHooks\n\t}\n\n\tidentifierCols = []interface{}{\n\t\to.ActorID,\n\t}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.retQuery)\n\t\tfmt.Fprintln(boil.DebugWriter, identifierCols...)\n\t}\n\n\terr = exec.QueryRow(cache.retQuery, identifierCols...).Scan(returns...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"sqlboiler: unable to populate default values for actor\")\n\t}\n\nCacheNoHooks:\n\tif !cached {\n\t\tactorUpsertCacheMut.Lock()\n\t\tactorUpsertCache[key] = cache\n\t\tactorUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(exec)\n}", "title": "" }, { "docid": "19f5903ab28f8db0dd6a4d18062139e1", "score": "0.6568894", "text": "func (o *Container) Upsert(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) error {\n\tif o == nil {\n\t\treturn errors.New(\"public: no container provided for upsert\")\n\t}\n\n\tif err := o.doBeforeUpsertHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(containerColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs postgres problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range updateColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range whitelist {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tcontainerUpsertCacheMut.RLock()\n\tcache, cached := containerUpsertCache[key]\n\tcontainerUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tvar ret []string\n\t\twhitelist, ret = strmangle.InsertColumnSet(\n\t\t\tcontainerColumns,\n\t\t\tcontainerColumnsWithDefault,\n\t\t\tcontainerColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t\twhitelist,\n\t\t)\n\t\tupdate := strmangle.UpdateColumnSet(\n\t\t\tcontainerColumns,\n\t\t\tcontainerPrimaryKeyColumns,\n\t\t\tupdateColumns,\n\t\t)\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"public: unable to upsert container, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(containerPrimaryKeyColumns))\n\t\t\tcopy(conflict, containerPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = queries.BuildUpsertQueryPostgres(dialect, \"\\\"container\\\"\", updateOnConflict, ret, update, conflict, whitelist)\n\n\t\tcache.valueMapping, err = queries.BindMapping(containerType, containerMapping, whitelist)\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(containerType, containerMapping, 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.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRow(cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.Exec(cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"public: unable to upsert container\")\n\t}\n\n\tif !cached {\n\t\tcontainerUpsertCacheMut.Lock()\n\t\tcontainerUpsertCache[key] = cache\n\t\tcontainerUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(exec)\n}", "title": "" }, { "docid": "f42116cc56e0275016d656443498f1b8", "score": "0.6561792", "text": "func (o *Package) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no Packages provided for upsert\")\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(packageColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\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\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tpackageUpsertCacheMut.RLock()\n\tcache, cached := packageUpsertCache[key]\n\tpackageUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tpackageAllColumns,\n\t\t\tpackageColumnsWithDefault,\n\t\t\tpackageColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tpackageAllColumns,\n\t\t\tpackagePrimaryKeyColumns,\n\t\t)\n\n\t\tif updateOnConflict && len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert Packages, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(packagePrimaryKeyColumns))\n\t\t\tcopy(conflict, packagePrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"Packages\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(packageType, packageMapping, 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(packageType, packageMapping, 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\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRowContext(ctx, cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.ExecContext(ctx, cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert Packages\")\n\t}\n\n\tif !cached {\n\t\tpackageUpsertCacheMut.Lock()\n\t\tpackageUpsertCache[key] = cache\n\t\tpackageUpsertCacheMut.Unlock()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9b498040cc75120c862e472853ac506e", "score": "0.6560951", "text": "func (o *Race) Upsert(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no race provided for upsert\")\n\t}\n\n\tif err := o.doBeforeUpsertHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(raceColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs postgres problems\n\tbuf := strmangle.GetBuffer()\n\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range updateColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range whitelist {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\traceUpsertCacheMut.RLock()\n\tcache, cached := raceUpsertCache[key]\n\traceUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := strmangle.InsertColumnSet(\n\t\t\traceColumns,\n\t\t\traceColumnsWithDefault,\n\t\t\traceColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t\twhitelist,\n\t\t)\n\n\t\tupdate := strmangle.UpdateColumnSet(\n\t\t\traceColumns,\n\t\t\tracePrimaryKeyColumns,\n\t\t\tupdateColumns,\n\t\t)\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert race, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(racePrimaryKeyColumns))\n\t\t\tcopy(conflict, racePrimaryKeyColumns)\n\t\t}\n\t\tcache.query = queries.BuildUpsertQueryPostgres(dialect, \"\\\"race\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(raceType, raceMapping, 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(raceType, raceMapping, 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.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRow(cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.Exec(cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert race\")\n\t}\n\n\tif !cached {\n\t\traceUpsertCacheMut.Lock()\n\t\traceUpsertCache[key] = cache\n\t\traceUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(exec)\n}", "title": "" }, { "docid": "ff221f709a24c43d64950583481d4f06", "score": "0.652195", "text": "func (o *Document) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"dal: no document provided for upsert\")\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(documentColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\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\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tdocumentUpsertCacheMut.RLock()\n\tcache, cached := documentUpsertCache[key]\n\tdocumentUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tdocumentAllColumns,\n\t\t\tdocumentColumnsWithDefault,\n\t\t\tdocumentColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tdocumentAllColumns,\n\t\t\tdocumentPrimaryKeyColumns,\n\t\t)\n\n\t\tif updateOnConflict && len(update) == 0 {\n\t\t\treturn errors.New(\"dal: unable to upsert document, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(documentPrimaryKeyColumns))\n\t\t\tcopy(conflict, documentPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"document\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(documentType, documentMapping, 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(documentType, documentMapping, 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\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRowContext(ctx, cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.ExecContext(ctx, cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"dal: unable to upsert document\")\n\t}\n\n\tif !cached {\n\t\tdocumentUpsertCacheMut.Lock()\n\t\tdocumentUpsertCache[key] = cache\n\t\tdocumentUpsertCacheMut.Unlock()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "110bd2828dbd55ea8a1632c538e20eb1", "score": "0.6515928", "text": "func (o *Tag) Upsert(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"mdbmodels: no tags provided for upsert\")\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(tagColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\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\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\ttagUpsertCacheMut.RLock()\n\tcache, cached := tagUpsertCache[key]\n\ttagUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\ttagAllColumns,\n\t\t\ttagColumnsWithDefault,\n\t\t\ttagColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\ttagAllColumns,\n\t\t\ttagPrimaryKeyColumns,\n\t\t)\n\n\t\tif updateOnConflict && len(update) == 0 {\n\t\t\treturn errors.New(\"mdbmodels: unable to upsert tags, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(tagPrimaryKeyColumns))\n\t\t\tcopy(conflict, tagPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"tags\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(tagType, tagMapping, 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(tagType, tagMapping, 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.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRow(cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.Exec(cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"mdbmodels: unable to upsert tags\")\n\t}\n\n\tif !cached {\n\t\ttagUpsertCacheMut.Lock()\n\t\ttagUpsertCache[key] = cache\n\t\ttagUpsertCacheMut.Unlock()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2bf30674e13df41637a08d7e68e12598", "score": "0.6513994", "text": "func (o *RepsExpense) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no reps_expense provided for upsert\")\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(repsExpenseColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\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\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\trepsExpenseUpsertCacheMut.RLock()\n\tcache, cached := repsExpenseUpsertCache[key]\n\trepsExpenseUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\trepsExpenseAllColumns,\n\t\t\trepsExpenseColumnsWithDefault,\n\t\t\trepsExpenseColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\trepsExpenseAllColumns,\n\t\t\trepsExpensePrimaryKeyColumns,\n\t\t)\n\n\t\tif updateOnConflict && len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert reps_expense, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(repsExpensePrimaryKeyColumns))\n\t\t\tcopy(conflict, repsExpensePrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"reps_expense\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(repsExpenseType, repsExpenseMapping, 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(repsExpenseType, repsExpenseMapping, 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\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRowContext(ctx, cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.ExecContext(ctx, cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert reps_expense\")\n\t}\n\n\tif !cached {\n\t\trepsExpenseUpsertCacheMut.Lock()\n\t\trepsExpenseUpsertCache[key] = cache\n\t\trepsExpenseUpsertCacheMut.Unlock()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "73a380abbfb6ae300855260e55f247e0", "score": "0.6513282", "text": "func (o *Asset) Upsert(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) error {\n\tif o == nil {\n\t\treturn errors.New(\"public: no asset provided for upsert\")\n\t}\n\n\tif err := o.doBeforeUpsertHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(assetColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs postgres problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range updateColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range whitelist {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tassetUpsertCacheMut.RLock()\n\tcache, cached := assetUpsertCache[key]\n\tassetUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tvar ret []string\n\t\twhitelist, ret = strmangle.InsertColumnSet(\n\t\t\tassetColumns,\n\t\t\tassetColumnsWithDefault,\n\t\t\tassetColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t\twhitelist,\n\t\t)\n\t\tupdate := strmangle.UpdateColumnSet(\n\t\t\tassetColumns,\n\t\t\tassetPrimaryKeyColumns,\n\t\t\tupdateColumns,\n\t\t)\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"public: unable to upsert asset, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(assetPrimaryKeyColumns))\n\t\t\tcopy(conflict, assetPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = queries.BuildUpsertQueryPostgres(dialect, \"\\\"asset\\\"\", updateOnConflict, ret, update, conflict, whitelist)\n\n\t\tcache.valueMapping, err = queries.BindMapping(assetType, assetMapping, whitelist)\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(assetType, assetMapping, 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.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRow(cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.Exec(cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"public: unable to upsert asset\")\n\t}\n\n\tif !cached {\n\t\tassetUpsertCacheMut.Lock()\n\t\tassetUpsertCache[key] = cache\n\t\tassetUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(exec)\n}", "title": "" }, { "docid": "650664fb17f5b3843804f4f430995d09", "score": "0.64923024", "text": "func (o *Guitar) Upsert(ctx context.Context, exec boil.ContextExecutor, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no guitar provided for upsert\")\n\t}\n\tif !boil.TimestampsAreSkipped(ctx) {\n\t\tcurrTime := time.Now().In(boil.GetLocation())\n\n\t\tif o.CreatedAt.IsZero() {\n\t\t\to.CreatedAt = currTime\n\t\t}\n\t\tqueries.SetScanner(&o.UpdatedAt, currTime)\n\t}\n\n\tif err := o.doBeforeUpsertHooks(ctx, exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(guitarColumnsWithDefault, o)\n\tnzUniques := queries.NonZeroDefaultSet(mySQLGuitarUniqueColumns, 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\tguitarUpsertCacheMut.RLock()\n\tcache, cached := guitarUpsertCache[key]\n\tguitarUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tguitarAllColumns,\n\t\t\tguitarColumnsWithDefault,\n\t\t\tguitarColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tguitarAllColumns,\n\t\t\tguitarPrimaryKeyColumns,\n\t\t)\n\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert guitar, could not build update column list\")\n\t\t}\n\n\t\tret = strmangle.SetComplement(ret, nzUniques)\n\t\tcache.query = buildUpsertQueryMySQL(dialect, \"guitar\", update, insert)\n\t\tcache.retQuery = fmt.Sprintf(\n\t\t\t\"SELECT %s FROM `guitar` 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(guitarType, guitarMapping, 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(guitarType, guitarMapping, 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\t_, err = exec.ExecContext(ctx, cache.query, vals...)\n\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert for guitar\")\n\t}\n\n\tvar uniqueMap []uint64\n\tvar nzUniqueCols []interface{}\n\n\tif len(cache.retMapping) == 0 {\n\t\tgoto CacheNoHooks\n\t}\n\n\tuniqueMap, err = queries.BindMapping(guitarType, guitarMapping, nzUniques)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to retrieve unique values for guitar\")\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 guitar\")\n\t}\n\nCacheNoHooks:\n\tif !cached {\n\t\tguitarUpsertCacheMut.Lock()\n\t\tguitarUpsertCache[key] = cache\n\t\tguitarUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(ctx, exec)\n}", "title": "" }, { "docid": "ced9abdce113d026a7a5839e28214547", "score": "0.6490032", "text": "func (o *Image) Upsert(ctx context.Context, exec boil.ContextExecutor, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no images 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(imageColumnsWithDefault, o)\n\tnzUniques := queries.NonZeroDefaultSet(mySQLImageUniqueColumns, 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\timageUpsertCacheMut.RLock()\n\tcache, cached := imageUpsertCache[key]\n\timageUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\timageAllColumns,\n\t\t\timageColumnsWithDefault,\n\t\t\timageColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\timageAllColumns,\n\t\t\timagePrimaryKeyColumns,\n\t\t)\n\n\t\tif !updateColumns.IsNone() && len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert images, could not build update column list\")\n\t\t}\n\n\t\tret = strmangle.SetComplement(ret, nzUniques)\n\t\tcache.query = buildUpsertQueryMySQL(dialect, \"`images`\", update, insert)\n\t\tcache.retQuery = fmt.Sprintf(\n\t\t\t\"SELECT %s FROM `images` 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(imageType, imageMapping, 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(imageType, imageMapping, 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 images\")\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] == imageMapping[\"id\"] {\n\t\tgoto CacheNoHooks\n\t}\n\n\tuniqueMap, err = queries.BindMapping(imageType, imageMapping, nzUniques)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to retrieve unique values for images\")\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 images\")\n\t}\n\nCacheNoHooks:\n\tif !cached {\n\t\timageUpsertCacheMut.Lock()\n\t\timageUpsertCache[key] = cache\n\t\timageUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(ctx, exec)\n}", "title": "" }, { "docid": "a2271a51c64f1d24315853762eeb5e2b", "score": "0.6482536", "text": "func (t *Tag) Upsert(db XODB) error {\n\tvar err error\n\n\t// if already exist, bail\n\tif t._exists {\n\t\treturn errors.New(\"insert failed: already exists\")\n\t}\n\n\t// sql query\n\tconst sqlstr = `INSERT INTO public.tags (` +\n\t\t`Id, Name, Count, IsBlocked, CreatedTime` +\n\t\t`) VALUES (` +\n\t\t`$1, $2, $3, $4, $5` +\n\t\t`) ON CONFLICT (Id) DO UPDATE SET (` +\n\t\t`Id, Name, Count, IsBlocked, CreatedTime` +\n\t\t`) = (` +\n\t\t`EXCLUDED.Id, EXCLUDED.Name, EXCLUDED.Count, EXCLUDED.IsBlocked, EXCLUDED.CreatedTime` +\n\t\t`)`\n\n\t// run query\n\tXOLog(sqlstr, t.Id, t.Name, t.Count, t.IsBlocked, t.CreatedTime)\n\t_, err = db.Exec(sqlstr, t.Id, t.Name, t.Count, t.IsBlocked, t.CreatedTime)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// set existence\n\tt._exists = true\n\n\treturn nil\n}", "title": "" }, { "docid": "8091bb9527e3cd748f5fe9acfa70e97f", "score": "0.6480785", "text": "func (o *Page) Upsert(ctx context.Context, exec boil.ContextExecutor, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"repo: no page provided for upsert\")\n\t}\n\tif !boil.TimestampsAreSkipped(ctx) {\n\t\tcurrTime := time.Now().In(boil.GetLocation())\n\n\t\tif o.CreatedAt.IsZero() {\n\t\t\to.CreatedAt = currTime\n\t\t}\n\t\to.UpdatedAt = currTime\n\t}\n\n\tif err := o.doBeforeUpsertHooks(ctx, exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(pageColumnsWithDefault, o)\n\tnzUniques := queries.NonZeroDefaultSet(mySQLPageUniqueColumns, 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\tpageUpsertCacheMut.RLock()\n\tcache, cached := pageUpsertCache[key]\n\tpageUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tpageAllColumns,\n\t\t\tpageColumnsWithDefault,\n\t\t\tpageColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tpageAllColumns,\n\t\t\tpagePrimaryKeyColumns,\n\t\t)\n\n\t\tif !updateColumns.IsNone() && len(update) == 0 {\n\t\t\treturn errors.New(\"repo: unable to upsert page, could not build update column list\")\n\t\t}\n\n\t\tret = strmangle.SetComplement(ret, nzUniques)\n\t\tcache.query = buildUpsertQueryMySQL(dialect, \"`page`\", update, insert)\n\t\tcache.retQuery = fmt.Sprintf(\n\t\t\t\"SELECT %s FROM `page` 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(pageType, pageMapping, 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(pageType, pageMapping, 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, \"repo: unable to upsert for page\")\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] == pageMapping[\"id\"] {\n\t\tgoto CacheNoHooks\n\t}\n\n\tuniqueMap, err = queries.BindMapping(pageType, pageMapping, nzUniques)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"repo: unable to retrieve unique values for page\")\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, \"repo: unable to populate default values for page\")\n\t}\n\nCacheNoHooks:\n\tif !cached {\n\t\tpageUpsertCacheMut.Lock()\n\t\tpageUpsertCache[key] = cache\n\t\tpageUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(ctx, exec)\n}", "title": "" }, { "docid": "7650f8f11053995a9863473a6ec97bdf", "score": "0.64618576", "text": "func (o *OriginIntegration) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no origin_integrations provided for upsert\")\n\t}\n\tif !boil.TimestampsAreSkipped(ctx) {\n\t\tcurrTime := time.Now().In(boil.GetLocation())\n\n\t\tif queries.MustTime(o.CreatedAt).IsZero() {\n\t\t\tqueries.SetScanner(&o.CreatedAt, currTime)\n\t\t}\n\t\tqueries.SetScanner(&o.UpdatedAt, currTime)\n\t}\n\n\tif err := o.doBeforeUpsertHooks(ctx, exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(originIntegrationColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\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\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\toriginIntegrationUpsertCacheMut.RLock()\n\tcache, cached := originIntegrationUpsertCache[key]\n\toriginIntegrationUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\toriginIntegrationColumns,\n\t\t\toriginIntegrationColumnsWithDefault,\n\t\t\toriginIntegrationColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\toriginIntegrationColumns,\n\t\t\toriginIntegrationPrimaryKeyColumns,\n\t\t)\n\n\t\tif updateOnConflict && len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert origin_integrations, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(originIntegrationPrimaryKeyColumns))\n\t\t\tcopy(conflict, originIntegrationPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"origin_integrations\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(originIntegrationType, originIntegrationMapping, 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(originIntegrationType, originIntegrationMapping, 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.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRowContext(ctx, cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.ExecContext(ctx, cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert origin_integrations\")\n\t}\n\n\tif !cached {\n\t\toriginIntegrationUpsertCacheMut.Lock()\n\t\toriginIntegrationUpsertCache[key] = cache\n\t\toriginIntegrationUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(ctx, exec)\n}", "title": "" }, { "docid": "fbde4608db15ed895161de949ae980f6", "score": "0.64544296", "text": "func (o *Area) Upsert(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no areas provided for upsert\")\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(areaColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\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\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tareaUpsertCacheMut.RLock()\n\tcache, cached := areaUpsertCache[key]\n\tareaUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tareaAllColumns,\n\t\t\tareaColumnsWithDefault,\n\t\t\tareaColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tareaAllColumns,\n\t\t\tareaPrimaryKeyColumns,\n\t\t)\n\n\t\tif updateOnConflict && len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert areas, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(areaPrimaryKeyColumns))\n\t\t\tcopy(conflict, areaPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"areas\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(areaType, areaMapping, 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(areaType, areaMapping, 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.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRow(cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.Exec(cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert areas\")\n\t}\n\n\tif !cached {\n\t\tareaUpsertCacheMut.Lock()\n\t\tareaUpsertCache[key] = cache\n\t\tareaUpsertCacheMut.Unlock()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "708665735bf992105ae09785167d60b1", "score": "0.64495265", "text": "func (o *Withdrawal) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no withdrawals provided for upsert\")\n\t}\n\tif !boil.TimestampsAreSkipped(ctx) {\n\t\tcurrTime := time.Now().In(boil.GetLocation())\n\n\t\tif o.CreatedAt.IsZero() {\n\t\t\to.CreatedAt = currTime\n\t\t}\n\t}\n\n\tif err := o.doBeforeUpsertHooks(ctx, exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(withdrawalColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\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\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\twithdrawalUpsertCacheMut.RLock()\n\tcache, cached := withdrawalUpsertCache[key]\n\twithdrawalUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\twithdrawalAllColumns,\n\t\t\twithdrawalColumnsWithDefault,\n\t\t\twithdrawalColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\twithdrawalAllColumns,\n\t\t\twithdrawalPrimaryKeyColumns,\n\t\t)\n\n\t\tif updateOnConflict && len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert withdrawals, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(withdrawalPrimaryKeyColumns))\n\t\t\tcopy(conflict, withdrawalPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"withdrawals\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(withdrawalType, withdrawalMapping, 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(withdrawalType, withdrawalMapping, 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\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRowContext(ctx, cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.ExecContext(ctx, cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert withdrawals\")\n\t}\n\n\tif !cached {\n\t\twithdrawalUpsertCacheMut.Lock()\n\t\twithdrawalUpsertCache[key] = cache\n\t\twithdrawalUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(ctx, exec)\n}", "title": "" }, { "docid": "4073babc87265cf45641ee59df9b8067", "score": "0.64422446", "text": "func (o *PullRequest) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no pull_requests provided for upsert\")\n\t}\n\tif !boil.TimestampsAreSkipped(ctx) {\n\t\tcurrTime := time.Now().In(boil.GetLocation())\n\n\t\tif o.CreatedAt.IsZero() {\n\t\t\to.CreatedAt = currTime\n\t\t}\n\t\to.UpdatedAt = currTime\n\t}\n\n\tif err := o.doBeforeUpsertHooks(ctx, exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(pullRequestColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\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\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tpullRequestUpsertCacheMut.RLock()\n\tcache, cached := pullRequestUpsertCache[key]\n\tpullRequestUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tpullRequestColumns,\n\t\t\tpullRequestColumnsWithDefault,\n\t\t\tpullRequestColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tpullRequestColumns,\n\t\t\tpullRequestPrimaryKeyColumns,\n\t\t)\n\n\t\tif updateOnConflict && len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert pull_requests, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(pullRequestPrimaryKeyColumns))\n\t\t\tcopy(conflict, pullRequestPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"pull_requests\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(pullRequestType, pullRequestMapping, 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(pullRequestType, pullRequestMapping, 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.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRowContext(ctx, cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.ExecContext(ctx, cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert pull_requests\")\n\t}\n\n\tif !cached {\n\t\tpullRequestUpsertCacheMut.Lock()\n\t\tpullRequestUpsertCache[key] = cache\n\t\tpullRequestUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(ctx, exec)\n}", "title": "" }, { "docid": "a2a5a0e8342c41a55ffaa038e2eae745", "score": "0.643688", "text": "func (o *Toy) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no toys provided for upsert\")\n\t}\n\tif !boil.TimestampsAreSkipped(ctx) {\n\t\tcurrTime := time.Now().In(boil.GetLocation())\n\n\t\tif queries.MustTime(o.CreatedAt).IsZero() {\n\t\t\tqueries.SetScanner(&o.CreatedAt, currTime)\n\t\t}\n\t\tqueries.SetScanner(&o.UpdatedAt, currTime)\n\t}\n\n\tif err := o.doBeforeUpsertHooks(ctx, exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(toyColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\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\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\ttoyUpsertCacheMut.RLock()\n\tcache, cached := toyUpsertCache[key]\n\ttoyUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\ttoyAllColumns,\n\t\t\ttoyColumnsWithDefault,\n\t\t\ttoyColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\ttoyAllColumns,\n\t\t\ttoyPrimaryKeyColumns,\n\t\t)\n\n\t\tif updateOnConflict && len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert toys, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(toyPrimaryKeyColumns))\n\t\t\tcopy(conflict, toyPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"gqlboil\\\".\\\"toys\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(toyType, toyMapping, 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(toyType, toyMapping, 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\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRowContext(ctx, cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.ExecContext(ctx, cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert toys\")\n\t}\n\n\tif !cached {\n\t\ttoyUpsertCacheMut.Lock()\n\t\ttoyUpsertCache[key] = cache\n\t\ttoyUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(ctx, exec)\n}", "title": "" }, { "docid": "608a6616107e519d5633657d0f01092f", "score": "0.6431778", "text": "func (o *CompetitionsStage) Upsert(ctx context.Context, exec boil.ContextExecutor, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no competitions_stages provided for upsert\")\n\t}\n\tif !boil.TimestampsAreSkipped(ctx) {\n\t\tcurrTime := time.Now().In(boil.GetLocation())\n\n\t\tif queries.MustTime(o.CreatedAt).IsZero() {\n\t\t\tqueries.SetScanner(&o.CreatedAt, currTime)\n\t\t}\n\t\tqueries.SetScanner(&o.UpdatedAt, currTime)\n\t}\n\n\tif err := o.doBeforeUpsertHooks(ctx, exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(competitionsStageColumnsWithDefault, o)\n\tnzUniques := queries.NonZeroDefaultSet(mySQLCompetitionsStageUniqueColumns, 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\tcompetitionsStageUpsertCacheMut.RLock()\n\tcache, cached := competitionsStageUpsertCache[key]\n\tcompetitionsStageUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tcompetitionsStageColumns,\n\t\t\tcompetitionsStageColumnsWithDefault,\n\t\t\tcompetitionsStageColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tcompetitionsStageColumns,\n\t\t\tcompetitionsStagePrimaryKeyColumns,\n\t\t)\n\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert competitions_stages, could not build update column list\")\n\t\t}\n\n\t\tret = strmangle.SetComplement(ret, nzUniques)\n\t\tcache.query = buildUpsertQueryMySQL(dialect, \"competitions_stages\", update, insert)\n\t\tcache.retQuery = fmt.Sprintf(\n\t\t\t\"SELECT %s FROM `competitions_stages` 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(competitionsStageType, competitionsStageMapping, 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(competitionsStageType, competitionsStageMapping, 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.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\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 competitions_stages\")\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] == competitionsStageMapping[\"id\"] {\n\t\tgoto CacheNoHooks\n\t}\n\n\tuniqueMap, err = queries.BindMapping(competitionsStageType, competitionsStageMapping, nzUniques)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to retrieve unique values for competitions_stages\")\n\t}\n\tnzUniqueCols = queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), uniqueMap)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.retQuery)\n\t\tfmt.Fprintln(boil.DebugWriter, nzUniqueCols...)\n\t}\n\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 competitions_stages\")\n\t}\n\nCacheNoHooks:\n\tif !cached {\n\t\tcompetitionsStageUpsertCacheMut.Lock()\n\t\tcompetitionsStageUpsertCache[key] = cache\n\t\tcompetitionsStageUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(ctx, exec)\n}", "title": "" }, { "docid": "36148814eceedc2e7a6e3a4559426f64", "score": "0.6419325", "text": "func (o *Preference) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no preferences 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(preferenceColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\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\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tpreferenceUpsertCacheMut.RLock()\n\tcache, cached := preferenceUpsertCache[key]\n\tpreferenceUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tpreferenceAllColumns,\n\t\t\tpreferenceColumnsWithDefault,\n\t\t\tpreferenceColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tpreferenceAllColumns,\n\t\t\tpreferencePrimaryKeyColumns,\n\t\t)\n\n\t\tif updateOnConflict && len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert preferences, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(preferencePrimaryKeyColumns))\n\t\t\tcopy(conflict, preferencePrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"preferences\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(preferenceType, preferenceMapping, 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(preferenceType, preferenceMapping, 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\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRowContext(ctx, cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.ExecContext(ctx, cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert preferences\")\n\t}\n\n\tif !cached {\n\t\tpreferenceUpsertCacheMut.Lock()\n\t\tpreferenceUpsertCache[key] = cache\n\t\tpreferenceUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(ctx, exec)\n}", "title": "" }, { "docid": "b0f3c38bc1ad66f6a37551a3e3294668", "score": "0.6390482", "text": "func (o *Sermon) Upsert(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no sermons provided for upsert\")\n\t}\n\tcurrTime := time.Now().In(boil.GetLocation())\n\n\tif o.CreatedAt.Time.IsZero() {\n\t\to.CreatedAt.Time = currTime\n\t\to.CreatedAt.Valid = true\n\t}\n\to.UpdatedAt.Time = currTime\n\to.UpdatedAt.Valid = true\n\n\tif err := o.doBeforeUpsertHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(sermonColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs postgres problems\n\tbuf := strmangle.GetBuffer()\n\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range updateColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range whitelist {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tsermonUpsertCacheMut.RLock()\n\tcache, cached := sermonUpsertCache[key]\n\tsermonUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := strmangle.InsertColumnSet(\n\t\t\tsermonColumns,\n\t\t\tsermonColumnsWithDefault,\n\t\t\tsermonColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t\twhitelist,\n\t\t)\n\n\t\tupdate := strmangle.UpdateColumnSet(\n\t\t\tsermonColumns,\n\t\t\tsermonPrimaryKeyColumns,\n\t\t\tupdateColumns,\n\t\t)\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert sermons, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(sermonPrimaryKeyColumns))\n\t\t\tcopy(conflict, sermonPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = queries.BuildUpsertQueryPostgres(dialect, \"\\\"sermons\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(sermonType, sermonMapping, 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(sermonType, sermonMapping, 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.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRow(cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.Exec(cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert sermons\")\n\t}\n\n\tif !cached {\n\t\tsermonUpsertCacheMut.Lock()\n\t\tsermonUpsertCache[key] = cache\n\t\tsermonUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(exec)\n}", "title": "" }, { "docid": "ad06b38bf27ae228440f6897fe8a1d20", "score": "0.63876295", "text": "func (o *Hub) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no hubs 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(hubColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\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\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\thubUpsertCacheMut.RLock()\n\tcache, cached := hubUpsertCache[key]\n\thubUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\thubAllColumns,\n\t\t\thubColumnsWithDefault,\n\t\t\thubColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\thubAllColumns,\n\t\t\thubPrimaryKeyColumns,\n\t\t)\n\n\t\tif updateOnConflict && len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert hubs, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(hubPrimaryKeyColumns))\n\t\t\tcopy(conflict, hubPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"hubs\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(hubType, hubMapping, 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(hubType, hubMapping, 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\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRowContext(ctx, cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.ExecContext(ctx, cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert hubs\")\n\t}\n\n\tif !cached {\n\t\thubUpsertCacheMut.Lock()\n\t\thubUpsertCache[key] = cache\n\t\thubUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(ctx, exec)\n}", "title": "" }, { "docid": "6a15acf9a2adf23d4c6480a41f243362", "score": "0.63771826", "text": "func (o *Thing) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no things 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(thingColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\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\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tthingUpsertCacheMut.RLock()\n\tcache, cached := thingUpsertCache[key]\n\tthingUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tthingColumns,\n\t\t\tthingColumnsWithDefault,\n\t\t\tthingColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tthingColumns,\n\t\t\tthingPrimaryKeyColumns,\n\t\t)\n\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert things, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(thingPrimaryKeyColumns))\n\t\t\tcopy(conflict, thingPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"things\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(thingType, thingMapping, 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(thingType, thingMapping, 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.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRowContext(ctx, cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.ExecContext(ctx, cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert things\")\n\t}\n\n\tif !cached {\n\t\tthingUpsertCacheMut.Lock()\n\t\tthingUpsertCache[key] = cache\n\t\tthingUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(ctx, exec)\n}", "title": "" }, { "docid": "79976de6da3eb1095cea753f1518c5c3", "score": "0.6376381", "text": "func (o *Stock) Upsert(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) error {\n\tif o == nil {\n\t\treturn errors.New(\"chado: no stock provided for upsert\")\n\t}\n\n\tif err := o.doBeforeUpsertHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(stockColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs postgres problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range updateColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range whitelist {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tstockUpsertCacheMut.RLock()\n\tcache, cached := stockUpsertCache[key]\n\tstockUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tvar ret []string\n\t\twhitelist, ret = strmangle.InsertColumnSet(\n\t\t\tstockColumns,\n\t\t\tstockColumnsWithDefault,\n\t\t\tstockColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t\twhitelist,\n\t\t)\n\t\tupdate := strmangle.UpdateColumnSet(\n\t\t\tstockColumns,\n\t\t\tstockPrimaryKeyColumns,\n\t\t\tupdateColumns,\n\t\t)\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"chado: unable to upsert stock, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(stockPrimaryKeyColumns))\n\t\t\tcopy(conflict, stockPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = queries.BuildUpsertQueryPostgres(dialect, \"\\\"stock\\\"\", updateOnConflict, ret, update, conflict, whitelist)\n\n\t\tcache.valueMapping, err = queries.BindMapping(stockType, stockMapping, whitelist)\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(stockType, stockMapping, 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.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRow(cache.query, vals...).Scan(returns...)\n\t} else {\n\t\t_, err = exec.Exec(cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"chado: unable to upsert for stock\")\n\t}\n\n\tif !cached {\n\t\tstockUpsertCacheMut.Lock()\n\t\tstockUpsertCache[key] = cache\n\t\tstockUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(exec)\n}", "title": "" }, { "docid": "4c01b94d3fd3622fc628b38b5e1b8cfd", "score": "0.6369043", "text": "func (o *File) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no files provided for upsert\")\n\t}\n\tif !boil.TimestampsAreSkipped(ctx) {\n\t\tcurrTime := time.Now().In(boil.GetLocation())\n\n\t\tif queries.MustTime(o.Createdat).IsZero() {\n\t\t\tqueries.SetScanner(&o.Createdat, currTime)\n\t\t}\n\t\tqueries.SetScanner(&o.Updatedat, currTime)\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(fileColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\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\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tfileUpsertCacheMut.RLock()\n\tcache, cached := fileUpsertCache[key]\n\tfileUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tfileAllColumns,\n\t\t\tfileColumnsWithDefault,\n\t\t\tfileColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tfileAllColumns,\n\t\t\tfilePrimaryKeyColumns,\n\t\t)\n\n\t\tif updateOnConflict && len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert files, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(filePrimaryKeyColumns))\n\t\t\tcopy(conflict, filePrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"files\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(fileType, fileMapping, 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(fileType, fileMapping, 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\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRowContext(ctx, cache.query, vals...).Scan(returns...)\n\t\tif errors.Is(err, sql.ErrNoRows) {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.ExecContext(ctx, cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert files\")\n\t}\n\n\tif !cached {\n\t\tfileUpsertCacheMut.Lock()\n\t\tfileUpsertCache[key] = cache\n\t\tfileUpsertCacheMut.Unlock()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "5c2f17ef05cf951ee4b4b9e40ec28469", "score": "0.6366506", "text": "func (o *MultipleTransaction) Upsert(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no multiple_transaction provided for upsert\")\n\t}\n\tcurrTime := time.Now().In(boil.GetLocation())\n\n\tif o.CreatedAt.IsZero() {\n\t\to.CreatedAt = currTime\n\t}\n\to.UpdatedAt = currTime\n\n\tif err := o.doBeforeUpsertHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(multipleTransactionColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\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\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tmultipleTransactionUpsertCacheMut.RLock()\n\tcache, cached := multipleTransactionUpsertCache[key]\n\tmultipleTransactionUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tmultipleTransactionColumns,\n\t\t\tmultipleTransactionColumnsWithDefault,\n\t\t\tmultipleTransactionColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tmultipleTransactionColumns,\n\t\t\tmultipleTransactionPrimaryKeyColumns,\n\t\t)\n\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert multiple_transaction, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(multipleTransactionPrimaryKeyColumns))\n\t\t\tcopy(conflict, multipleTransactionPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"multiple_transaction\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(multipleTransactionType, multipleTransactionMapping, 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(multipleTransactionType, multipleTransactionMapping, 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.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRow(cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.Exec(cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert multiple_transaction\")\n\t}\n\n\tif !cached {\n\t\tmultipleTransactionUpsertCacheMut.Lock()\n\t\tmultipleTransactionUpsertCache[key] = cache\n\t\tmultipleTransactionUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(exec)\n}", "title": "" }, { "docid": "2c424e6910aa9f052b85423b165cd783", "score": "0.6364134", "text": "func (o *Fragrance) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no fragrance provided for upsert\")\n\t}\n\tif !boil.TimestampsAreSkipped(ctx) {\n\t\tcurrTime := time.Now().In(boil.GetLocation())\n\n\t\tif o.CreatedAt.IsZero() {\n\t\t\to.CreatedAt = currTime\n\t\t}\n\t\to.UpdatedAt = currTime\n\t}\n\n\tif err := o.doBeforeUpsertHooks(ctx, exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(fragranceColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\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\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tfragranceUpsertCacheMut.RLock()\n\tcache, cached := fragranceUpsertCache[key]\n\tfragranceUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tfragranceAllColumns,\n\t\t\tfragranceColumnsWithDefault,\n\t\t\tfragranceColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tfragranceAllColumns,\n\t\t\tfragrancePrimaryKeyColumns,\n\t\t)\n\n\t\tif updateOnConflict && len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert fragrance, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(fragrancePrimaryKeyColumns))\n\t\t\tcopy(conflict, fragrancePrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"fragrance\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(fragranceType, fragranceMapping, 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(fragranceType, fragranceMapping, 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\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRowContext(ctx, cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.ExecContext(ctx, cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert fragrance\")\n\t}\n\n\tif !cached {\n\t\tfragranceUpsertCacheMut.Lock()\n\t\tfragranceUpsertCache[key] = cache\n\t\tfragranceUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(ctx, exec)\n}", "title": "" }, { "docid": "36d0f3747f795889f5d9ba98ffe5ef65", "score": "0.6349956", "text": "func (o *Rental) Upsert(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no rental provided for upsert\")\n\t}\n\tcurrTime := time.Now().In(boil.GetLocation())\n\n\tif o.CreatedAt.IsZero() {\n\t\to.CreatedAt = currTime\n\t}\n\to.UpdatedAt = currTime\n\n\tif err := o.doBeforeUpsertHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(rentalColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\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\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\trentalUpsertCacheMut.RLock()\n\tcache, cached := rentalUpsertCache[key]\n\trentalUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\trentalColumns,\n\t\t\trentalColumnsWithDefault,\n\t\t\trentalColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\trentalColumns,\n\t\t\trentalPrimaryKeyColumns,\n\t\t)\n\n\t\tif updateOnConflict && len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert rental, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(rentalPrimaryKeyColumns))\n\t\t\tcopy(conflict, rentalPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"rental\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(rentalType, rentalMapping, 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(rentalType, rentalMapping, 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.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRow(cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.Exec(cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert rental\")\n\t}\n\n\tif !cached {\n\t\trentalUpsertCacheMut.Lock()\n\t\trentalUpsertCache[key] = cache\n\t\trentalUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(exec)\n}", "title": "" }, { "docid": "4bcb14a350e33072cf68332d66f09621", "score": "0.6345517", "text": "func (o *Account) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no accounts provided for upsert\")\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(accountColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\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\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\taccountUpsertCacheMut.RLock()\n\tcache, cached := accountUpsertCache[key]\n\taccountUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\taccountAllColumns,\n\t\t\taccountColumnsWithDefault,\n\t\t\taccountColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\taccountAllColumns,\n\t\t\taccountPrimaryKeyColumns,\n\t\t)\n\n\t\tif updateOnConflict && len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert accounts, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(accountPrimaryKeyColumns))\n\t\t\tcopy(conflict, accountPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"accounts\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(accountType, accountMapping, 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(accountType, accountMapping, 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\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRowContext(ctx, cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.ExecContext(ctx, cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert accounts\")\n\t}\n\n\tif !cached {\n\t\taccountUpsertCacheMut.Lock()\n\t\taccountUpsertCache[key] = cache\n\t\taccountUpsertCacheMut.Unlock()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ca2fa86fbfc162e7668182e49ccc146f", "score": "0.6344607", "text": "func (o *CMFPortalPost) Upsert(ctx context.Context, exec boil.ContextExecutor, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no cmf_portal_post 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(cmfPortalPostColumnsWithDefault, o)\n\tnzUniques := queries.NonZeroDefaultSet(mySQLCMFPortalPostUniqueColumns, 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\tcmfPortalPostUpsertCacheMut.RLock()\n\tcache, cached := cmfPortalPostUpsertCache[key]\n\tcmfPortalPostUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tcmfPortalPostAllColumns,\n\t\t\tcmfPortalPostColumnsWithDefault,\n\t\t\tcmfPortalPostColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tcmfPortalPostAllColumns,\n\t\t\tcmfPortalPostPrimaryKeyColumns,\n\t\t)\n\n\t\tif !updateColumns.IsNone() && len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert cmf_portal_post, could not build update column list\")\n\t\t}\n\n\t\tret = strmangle.SetComplement(ret, nzUniques)\n\t\tcache.query = buildUpsertQueryMySQL(dialect, \"`cmf_portal_post`\", update, insert)\n\t\tcache.retQuery = fmt.Sprintf(\n\t\t\t\"SELECT %s FROM `cmf_portal_post` 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(cmfPortalPostType, cmfPortalPostMapping, 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(cmfPortalPostType, cmfPortalPostMapping, 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_portal_post\")\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 = uint64(lastID)\n\tif lastID != 0 && len(cache.retMapping) == 1 && cache.retMapping[0] == cmfPortalPostMapping[\"id\"] {\n\t\tgoto CacheNoHooks\n\t}\n\n\tuniqueMap, err = queries.BindMapping(cmfPortalPostType, cmfPortalPostMapping, nzUniques)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to retrieve unique values for cmf_portal_post\")\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_portal_post\")\n\t}\n\nCacheNoHooks:\n\tif !cached {\n\t\tcmfPortalPostUpsertCacheMut.Lock()\n\t\tcmfPortalPostUpsertCache[key] = cache\n\t\tcmfPortalPostUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(ctx, exec)\n}", "title": "" }, { "docid": "9b0df8d7167565ca513e7235b5d71dd2", "score": "0.63356084", "text": "func (o *AdminStellarSigner) Upsert(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no admin_stellar_signer provided for upsert\")\n\t}\n\tcurrTime := time.Now().In(boil.GetLocation())\n\n\tif o.CreatedAt.IsZero() {\n\t\to.CreatedAt = currTime\n\t}\n\to.UpdatedAt = currTime\n\n\tif err := o.doBeforeUpsertHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(adminStellarSignerColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\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\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tadminStellarSignerUpsertCacheMut.RLock()\n\tcache, cached := adminStellarSignerUpsertCache[key]\n\tadminStellarSignerUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tadminStellarSignerColumns,\n\t\t\tadminStellarSignerColumnsWithDefault,\n\t\t\tadminStellarSignerColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tadminStellarSignerColumns,\n\t\t\tadminStellarSignerPrimaryKeyColumns,\n\t\t)\n\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert admin_stellar_signer, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(adminStellarSignerPrimaryKeyColumns))\n\t\t\tcopy(conflict, adminStellarSignerPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"admin_stellar_signer\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(adminStellarSignerType, adminStellarSignerMapping, 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(adminStellarSignerType, adminStellarSignerMapping, 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.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRow(cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.Exec(cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert admin_stellar_signer\")\n\t}\n\n\tif !cached {\n\t\tadminStellarSignerUpsertCacheMut.Lock()\n\t\tadminStellarSignerUpsertCache[key] = cache\n\t\tadminStellarSignerUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(exec)\n}", "title": "" }, { "docid": "2b76bc4cd82d76e65622f24b14e7e256", "score": "0.6327349", "text": "func (o *Patient) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no patient 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(patientColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\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\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tpatientUpsertCacheMut.RLock()\n\tcache, cached := patientUpsertCache[key]\n\tpatientUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tpatientAllColumns,\n\t\t\tpatientColumnsWithDefault,\n\t\t\tpatientColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tpatientAllColumns,\n\t\t\tpatientPrimaryKeyColumns,\n\t\t)\n\n\t\tif updateOnConflict && len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert patient, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(patientPrimaryKeyColumns))\n\t\t\tcopy(conflict, patientPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"patient\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(patientType, patientMapping, 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(patientType, patientMapping, 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\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRowContext(ctx, cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.ExecContext(ctx, cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert patient\")\n\t}\n\n\tif !cached {\n\t\tpatientUpsertCacheMut.Lock()\n\t\tpatientUpsertCache[key] = cache\n\t\tpatientUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(ctx, exec)\n}", "title": "" }, { "docid": "d19f5f99f6efee031b371a435f5e412c", "score": "0.63215584", "text": "func (o *Balance) Upsert(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no balances provided for upsert\")\n\t}\n\tcurrTime := time.Now().In(boil.GetLocation())\n\n\tif o.CreatedAt.IsZero() {\n\t\to.CreatedAt = currTime\n\t}\n\to.UpdatedAt = currTime\n\n\tif err := o.doBeforeUpsertHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(balanceColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs postgres problems\n\tbuf := strmangle.GetBuffer()\n\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range updateColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range whitelist {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tbalanceUpsertCacheMut.RLock()\n\tcache, cached := balanceUpsertCache[key]\n\tbalanceUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := strmangle.InsertColumnSet(\n\t\t\tbalanceColumns,\n\t\t\tbalanceColumnsWithDefault,\n\t\t\tbalanceColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t\twhitelist,\n\t\t)\n\n\t\tupdate := strmangle.UpdateColumnSet(\n\t\t\tbalanceColumns,\n\t\t\tbalancePrimaryKeyColumns,\n\t\t\tupdateColumns,\n\t\t)\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert balances, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(balancePrimaryKeyColumns))\n\t\t\tcopy(conflict, balancePrimaryKeyColumns)\n\t\t}\n\t\tcache.query = queries.BuildUpsertQueryPostgres(dialect, \"\\\"balances\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(balanceType, balanceMapping, 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(balanceType, balanceMapping, 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.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRow(cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.Exec(cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert balances\")\n\t}\n\n\tif !cached {\n\t\tbalanceUpsertCacheMut.Lock()\n\t\tbalanceUpsertCache[key] = cache\n\t\tbalanceUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(exec)\n}", "title": "" }, { "docid": "17a32c02ad93253bad9302c2d7c74535", "score": "0.6318891", "text": "func (t *Transaction) Upsert(transaction *models.Transaction) error {\n\tif transaction == nil {\n\t\treturn fmt.Errorf(\"cannot insert an empty transaction struct\")\n\t}\n\n\tif len(transaction.TransactionID) == 0 {\n\t\treturn fmt.Errorf(\"cannot insert an empty TransactionID\")\n\t}\n\n\tif len(transaction.ProposalID) == 0 {\n\t\treturn fmt.Errorf(\"cannot insert an empty ProposalID\")\n\t}\n\n\tif len(transaction.GiverID) == 0 {\n\t\treturn fmt.Errorf(\"cannot insert an empty GiverID\")\n\t}\n\n\tif len(transaction.TakerID) == 0 {\n\t\treturn fmt.Errorf(\"cannot insert an empty TakerID\")\n\t}\n\n\tif transaction.GiverReview == nil {\n\t\ttransaction.GiverReview = &models.Review{}\n\t}\n\n\tif transaction.TakerReview == nil {\n\t\ttransaction.GiverReview = &models.Review{}\n\t}\n\n\tdb := t.conn.Get()\n\n\t_, err := db.Exec(\n\t\tupsertTransaction,\n\t\ttransaction.TransactionID,\n\t\ttransaction.ProposalID,\n\t\ttransaction.GiverID,\n\t\ttransaction.TakerID,\n\t\ttransaction.GiverReview.Rating,\n\t\ttransaction.GiverReview.Comment,\n\t\ttransaction.TakerReview.Rating,\n\t\ttransaction.TakerReview.Comment,\n\t\ttransaction.Status,\n\t)\n\n\tif err != nil {\n\t\tif perr, ok := err.(*pq.Error); ok {\n\t\t\treturn fmt.Errorf(\"fail to try execute upsert transaction data: transaction=%v pq-error=%s\", transaction, perr)\n\t\t}\n\n\t\treturn fmt.Errorf(\"fail to try execute upsert transaction data: transaction=%v error=%s\", transaction, err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "820475412b002579aa099320066de621", "score": "0.6315535", "text": "func (o *Teacher) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no teacher provided for upsert\")\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(teacherColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\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\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tteacherUpsertCacheMut.RLock()\n\tcache, cached := teacherUpsertCache[key]\n\tteacherUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tteacherAllColumns,\n\t\t\tteacherColumnsWithDefault,\n\t\t\tteacherColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tteacherAllColumns,\n\t\t\tteacherPrimaryKeyColumns,\n\t\t)\n\n\t\tif updateOnConflict && len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert teacher, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(teacherPrimaryKeyColumns))\n\t\t\tcopy(conflict, teacherPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"teacher\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(teacherType, teacherMapping, 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(teacherType, teacherMapping, 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\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRowContext(ctx, cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.ExecContext(ctx, cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert teacher\")\n\t}\n\n\tif !cached {\n\t\tteacherUpsertCacheMut.Lock()\n\t\tteacherUpsertCache[key] = cache\n\t\tteacherUpsertCacheMut.Unlock()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "4184394b93c5c8f4f39b4a51ccebcb49", "score": "0.6308843", "text": "func (o *Teacher) Upsert(ctx context.Context, exec boil.ContextExecutor, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"model2: no teacher provided for upsert\")\n\t}\n\tif !boil.TimestampsAreSkipped(ctx) {\n\t\tcurrTime := time.Now().In(boil.GetLocation())\n\n\t\tif o.CreatedAt.IsZero() {\n\t\t\to.CreatedAt = currTime\n\t\t}\n\t\to.UpdatedAt = currTime\n\t}\n\n\tif err := o.doBeforeUpsertHooks(ctx, exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(teacherColumnsWithDefault, o)\n\tnzUniques := queries.NonZeroDefaultSet(mySQLTeacherUniqueColumns, 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\tteacherUpsertCacheMut.RLock()\n\tcache, cached := teacherUpsertCache[key]\n\tteacherUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tteacherAllColumns,\n\t\t\tteacherColumnsWithDefault,\n\t\t\tteacherColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tteacherAllColumns,\n\t\t\tteacherPrimaryKeyColumns,\n\t\t)\n\n\t\tif !updateColumns.IsNone() && len(update) == 0 {\n\t\t\treturn errors.New(\"model2: unable to upsert teacher, could not build update column list\")\n\t\t}\n\n\t\tret = strmangle.SetComplement(ret, nzUniques)\n\t\tcache.query = buildUpsertQueryMySQL(dialect, \"`teacher`\", update, insert)\n\t\tcache.retQuery = fmt.Sprintf(\n\t\t\t\"SELECT %s FROM `teacher` 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(teacherType, teacherMapping, 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(teacherType, teacherMapping, 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\t_, err = exec.ExecContext(ctx, cache.query, vals...)\n\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"model2: unable to upsert for teacher\")\n\t}\n\n\tvar uniqueMap []uint64\n\tvar nzUniqueCols []interface{}\n\n\tif len(cache.retMapping) == 0 {\n\t\tgoto CacheNoHooks\n\t}\n\n\tuniqueMap, err = queries.BindMapping(teacherType, teacherMapping, nzUniques)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"model2: unable to retrieve unique values for teacher\")\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, \"model2: unable to populate default values for teacher\")\n\t}\n\nCacheNoHooks:\n\tif !cached {\n\t\tteacherUpsertCacheMut.Lock()\n\t\tteacherUpsertCache[key] = cache\n\t\tteacherUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(ctx, exec)\n}", "title": "" }, { "docid": "c315b702d4c0f638f86fc23e667bec83", "score": "0.6305578", "text": "func (o *Chart) Upsert(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no chart provided for upsert\")\n\t}\n\n\tif err := o.doBeforeUpsertHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(chartColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs postgres problems\n\tbuf := strmangle.GetBuffer()\n\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range updateColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range whitelist {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tchartUpsertCacheMut.RLock()\n\tcache, cached := chartUpsertCache[key]\n\tchartUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := strmangle.InsertColumnSet(\n\t\t\tchartColumns,\n\t\t\tchartColumnsWithDefault,\n\t\t\tchartColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t\twhitelist,\n\t\t)\n\n\t\tupdate := strmangle.UpdateColumnSet(\n\t\t\tchartColumns,\n\t\t\tchartPrimaryKeyColumns,\n\t\t\tupdateColumns,\n\t\t)\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert chart, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(chartPrimaryKeyColumns))\n\t\t\tcopy(conflict, chartPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = queries.BuildUpsertQueryPostgres(dialect, \"\\\"chart\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(chartType, chartMapping, 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(chartType, chartMapping, 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.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRow(cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.Exec(cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert chart\")\n\t}\n\n\tif !cached {\n\t\tchartUpsertCacheMut.Lock()\n\t\tchartUpsertCache[key] = cache\n\t\tchartUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(exec)\n}", "title": "" }, { "docid": "11ed0e163ad32dc1ca6c261b24bdd9cd", "score": "0.6283269", "text": "func (o *EmailTimer) Upsert(exec boil.Executor, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no email_timer provided for upsert\")\n\t}\n\tcurrTime := time.Now().In(boil.GetLocation())\n\n\tif o.CreatedAt.IsZero() {\n\t\to.CreatedAt = currTime\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(emailTimerColumnsWithDefault, o)\n\tnzUniques := queries.NonZeroDefaultSet(mySQLEmailTimerUniqueColumns, 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\temailTimerUpsertCacheMut.RLock()\n\tcache, cached := emailTimerUpsertCache[key]\n\temailTimerUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\temailTimerColumns,\n\t\t\temailTimerColumnsWithDefault,\n\t\t\temailTimerColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\temailTimerColumns,\n\t\t\temailTimerPrimaryKeyColumns,\n\t\t)\n\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert email_timer, could not build update column list\")\n\t\t}\n\n\t\tret = strmangle.SetComplement(ret, nzUniques)\n\t\tcache.query = buildUpsertQueryMySQL(dialect, \"email_timer\", update, insert)\n\t\tcache.retQuery = fmt.Sprintf(\n\t\t\t\"SELECT %s FROM `email_timer` 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(emailTimerType, emailTimerMapping, 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(emailTimerType, emailTimerMapping, 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.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tresult, err := exec.Exec(cache.query, vals...)\n\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert for email_timer\")\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.DataID = uint64(lastID)\n\tif lastID != 0 && len(cache.retMapping) == 1 && cache.retMapping[0] == emailTimerMapping[\"data_id\"] {\n\t\tgoto CacheNoHooks\n\t}\n\n\tuniqueMap, err = queries.BindMapping(emailTimerType, emailTimerMapping, nzUniques)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to retrieve unique values for email_timer\")\n\t}\n\tnzUniqueCols = queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), uniqueMap)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.retQuery)\n\t\tfmt.Fprintln(boil.DebugWriter, nzUniqueCols...)\n\t}\n\n\terr = exec.QueryRow(cache.retQuery, nzUniqueCols...).Scan(returns...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to populate default values for email_timer\")\n\t}\n\nCacheNoHooks:\n\tif !cached {\n\t\temailTimerUpsertCacheMut.Lock()\n\t\temailTimerUpsertCache[key] = cache\n\t\temailTimerUpsertCacheMut.Unlock()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "12c01c1c7bed0c7eea366483d4e117cc", "score": "0.62786907", "text": "func (o *RecipeStep) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no recipe_step provided for upsert\")\n\t}\n\tif !boil.TimestampsAreSkipped(ctx) {\n\t\tcurrTime := time.Now().In(boil.GetLocation())\n\n\t\tif o.CreatedAt.IsZero() {\n\t\t\to.CreatedAt = currTime\n\t\t}\n\t\to.UpdatedAt = currTime\n\t}\n\n\tif err := o.doBeforeUpsertHooks(ctx, exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(recipeStepColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\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\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\trecipeStepUpsertCacheMut.RLock()\n\tcache, cached := recipeStepUpsertCache[key]\n\trecipeStepUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\trecipeStepAllColumns,\n\t\t\trecipeStepColumnsWithDefault,\n\t\t\trecipeStepColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\trecipeStepAllColumns,\n\t\t\trecipeStepPrimaryKeyColumns,\n\t\t)\n\n\t\tif updateOnConflict && len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert recipe_step, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(recipeStepPrimaryKeyColumns))\n\t\t\tcopy(conflict, recipeStepPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"recipe_step\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(recipeStepType, recipeStepMapping, 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(recipeStepType, recipeStepMapping, 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\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRowContext(ctx, cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.ExecContext(ctx, cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert recipe_step\")\n\t}\n\n\tif !cached {\n\t\trecipeStepUpsertCacheMut.Lock()\n\t\trecipeStepUpsertCache[key] = cache\n\t\trecipeStepUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(ctx, exec)\n}", "title": "" }, { "docid": "40d706da826e145e01747e82563fd43e", "score": "0.6270291", "text": "func (o *TwitterThread) Upsert(ctx context.Context, exec boil.ContextExecutor, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no TwitterThreads 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(twitterThreadColumnsWithDefault, o)\n\tnzUniques := queries.NonZeroDefaultSet(mySQLTwitterThreadUniqueColumns, 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\ttwitterThreadUpsertCacheMut.RLock()\n\tcache, cached := twitterThreadUpsertCache[key]\n\ttwitterThreadUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\ttwitterThreadAllColumns,\n\t\t\ttwitterThreadColumnsWithDefault,\n\t\t\ttwitterThreadColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\ttwitterThreadAllColumns,\n\t\t\ttwitterThreadPrimaryKeyColumns,\n\t\t)\n\n\t\tif !updateColumns.IsNone() && len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert TwitterThreads, could not build update column list\")\n\t\t}\n\n\t\tret = strmangle.SetComplement(ret, nzUniques)\n\t\tcache.query = buildUpsertQueryMySQL(dialect, \"`TwitterThreads`\", update, insert)\n\t\tcache.retQuery = fmt.Sprintf(\n\t\t\t\"SELECT %s FROM `TwitterThreads` 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(twitterThreadType, twitterThreadMapping, 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(twitterThreadType, twitterThreadMapping, 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\t_, err = exec.ExecContext(ctx, cache.query, vals...)\n\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert for TwitterThreads\")\n\t}\n\n\tvar uniqueMap []uint64\n\tvar nzUniqueCols []interface{}\n\n\tif len(cache.retMapping) == 0 {\n\t\tgoto CacheNoHooks\n\t}\n\n\tuniqueMap, err = queries.BindMapping(twitterThreadType, twitterThreadMapping, nzUniques)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to retrieve unique values for TwitterThreads\")\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 TwitterThreads\")\n\t}\n\nCacheNoHooks:\n\tif !cached {\n\t\ttwitterThreadUpsertCacheMut.Lock()\n\t\ttwitterThreadUpsertCache[key] = cache\n\t\ttwitterThreadUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(ctx, exec)\n}", "title": "" }, { "docid": "bda2a799a4ab9e10242992c91f364be6", "score": "0.6269248", "text": "func (conn *Connection) Upsert(space interface{}, tuple, ops interface{}) (*Response, error) {\n\treturn conn.UpsertAsync(space, tuple, ops).Get()\n}", "title": "" }, { "docid": "c65fa5b080ab2a6d558045ae864c5d4e", "score": "0.62443465", "text": "func (o *TicketReservation) Upsert(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no ticket_reservations provided for upsert\")\n\t}\n\n\tif err := o.doBeforeUpsertHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(ticketReservationColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\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\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tticketReservationUpsertCacheMut.RLock()\n\tcache, cached := ticketReservationUpsertCache[key]\n\tticketReservationUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tticketReservationColumns,\n\t\t\tticketReservationColumnsWithDefault,\n\t\t\tticketReservationColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tticketReservationColumns,\n\t\t\tticketReservationPrimaryKeyColumns,\n\t\t)\n\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert ticket_reservations, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(ticketReservationPrimaryKeyColumns))\n\t\t\tcopy(conflict, ticketReservationPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"ticket_reservations\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(ticketReservationType, ticketReservationMapping, 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(ticketReservationType, ticketReservationMapping, 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.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRow(cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.Exec(cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert ticket_reservations\")\n\t}\n\n\tif !cached {\n\t\tticketReservationUpsertCacheMut.Lock()\n\t\tticketReservationUpsertCache[key] = cache\n\t\tticketReservationUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(exec)\n}", "title": "" }, { "docid": "05d654a349e13115472277e055b3f86d", "score": "0.6236578", "text": "func (o *Topic) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no topics provided for upsert\")\n\t}\n\tcurrTime := time.Now().In(boil.GetLocation())\n\n\tif o.CreatedAt.IsZero() {\n\t\to.CreatedAt = currTime\n\t}\n\to.UpdatedAt = currTime\n\n\tif err := o.doBeforeUpsertHooks(ctx, exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(topicColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\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\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\ttopicUpsertCacheMut.RLock()\n\tcache, cached := topicUpsertCache[key]\n\ttopicUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\ttopicColumns,\n\t\t\ttopicColumnsWithDefault,\n\t\t\ttopicColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\ttopicColumns,\n\t\t\ttopicPrimaryKeyColumns,\n\t\t)\n\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert topics, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(topicPrimaryKeyColumns))\n\t\t\tcopy(conflict, topicPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"topics\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(topicType, topicMapping, 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(topicType, topicMapping, 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.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRowContext(ctx, cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.ExecContext(ctx, cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert topics\")\n\t}\n\n\tif !cached {\n\t\ttopicUpsertCacheMut.Lock()\n\t\ttopicUpsertCache[key] = cache\n\t\ttopicUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(ctx, exec)\n}", "title": "" }, { "docid": "068179aae80555f6279f2d6fd48cb8cc", "score": "0.62287784", "text": "func (c *Connector) Upsert(ctx context.Context, ei *dosa.EntityInfo, values map[string]dosa.FieldValue) error {\n\treturn nil\n}", "title": "" }, { "docid": "3fdd392722498685dff2d6169604da65", "score": "0.62271965", "text": "func (o *UserOrder) Upsert(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no user_order provided for upsert\")\n\t}\n\tcurrTime := time.Now().In(boil.GetLocation())\n\n\tif o.CreatedAt.IsZero() {\n\t\to.CreatedAt = currTime\n\t}\n\to.UpdatedAt = currTime\n\n\tif err := o.doBeforeUpsertHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(userOrderColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\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\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tuserOrderUpsertCacheMut.RLock()\n\tcache, cached := userOrderUpsertCache[key]\n\tuserOrderUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tuserOrderColumns,\n\t\t\tuserOrderColumnsWithDefault,\n\t\t\tuserOrderColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tuserOrderColumns,\n\t\t\tuserOrderPrimaryKeyColumns,\n\t\t)\n\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert user_order, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(userOrderPrimaryKeyColumns))\n\t\t\tcopy(conflict, userOrderPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"user_order\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(userOrderType, userOrderMapping, 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(userOrderType, userOrderMapping, 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.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRow(cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.Exec(cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert user_order\")\n\t}\n\n\tif !cached {\n\t\tuserOrderUpsertCacheMut.Lock()\n\t\tuserOrderUpsertCache[key] = cache\n\t\tuserOrderUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(exec)\n}", "title": "" }, { "docid": "3c37987a59552903ad987169c895de76", "score": "0.62084544", "text": "func (o *Source) Upsert(ctx context.Context, exec boil.ContextExecutor, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"orm: no sources provided for upsert\")\n\t}\n\tif !boil.TimestampsAreSkipped(ctx) {\n\t\tcurrTime := time.Now().In(boil.GetLocation())\n\n\t\tif o.CreatedAt.IsZero() {\n\t\t\to.CreatedAt = currTime\n\t\t}\n\t\to.UpdatedAt = currTime\n\t}\n\n\tif err := o.doBeforeUpsertHooks(ctx, exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(sourceColumnsWithDefault, o)\n\tnzUniques := queries.NonZeroDefaultSet(mySQLSourceUniqueColumns, 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\tsourceUpsertCacheMut.RLock()\n\tcache, cached := sourceUpsertCache[key]\n\tsourceUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tsourceAllColumns,\n\t\t\tsourceColumnsWithDefault,\n\t\t\tsourceColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tsourceAllColumns,\n\t\t\tsourcePrimaryKeyColumns,\n\t\t)\n\n\t\tif !updateColumns.IsNone() && len(update) == 0 {\n\t\t\treturn errors.New(\"orm: unable to upsert sources, could not build update column list\")\n\t\t}\n\n\t\tret = strmangle.SetComplement(ret, nzUniques)\n\t\tcache.query = buildUpsertQueryMySQL(dialect, \"`sources`\", update, insert)\n\t\tcache.retQuery = fmt.Sprintf(\n\t\t\t\"SELECT %s FROM `sources` 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(sourceType, sourceMapping, 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(sourceType, sourceMapping, 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, \"orm: unable to upsert for sources\")\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 = int64(lastID)\n\tif lastID != 0 && len(cache.retMapping) == 1 && cache.retMapping[0] == sourceMapping[\"id\"] {\n\t\tgoto CacheNoHooks\n\t}\n\n\tuniqueMap, err = queries.BindMapping(sourceType, sourceMapping, nzUniques)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"orm: unable to retrieve unique values for sources\")\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, \"orm: unable to populate default values for sources\")\n\t}\n\nCacheNoHooks:\n\tif !cached {\n\t\tsourceUpsertCacheMut.Lock()\n\t\tsourceUpsertCache[key] = cache\n\t\tsourceUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(ctx, exec)\n}", "title": "" }, { "docid": "a986d27920aad73f1a7f86e4bf23750a", "score": "0.6206747", "text": "func (o *CMFSlide) Upsert(ctx context.Context, exec boil.ContextExecutor, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no cmf_slide 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(cmfSlideColumnsWithDefault, o)\n\tnzUniques := queries.NonZeroDefaultSet(mySQLCMFSlideUniqueColumns, 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\tcmfSlideUpsertCacheMut.RLock()\n\tcache, cached := cmfSlideUpsertCache[key]\n\tcmfSlideUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tcmfSlideAllColumns,\n\t\t\tcmfSlideColumnsWithDefault,\n\t\t\tcmfSlideColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tcmfSlideAllColumns,\n\t\t\tcmfSlidePrimaryKeyColumns,\n\t\t)\n\n\t\tif !updateColumns.IsNone() && len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert cmf_slide, could not build update column list\")\n\t\t}\n\n\t\tret = strmangle.SetComplement(ret, nzUniques)\n\t\tcache.query = buildUpsertQueryMySQL(dialect, \"`cmf_slide`\", update, insert)\n\t\tcache.retQuery = fmt.Sprintf(\n\t\t\t\"SELECT %s FROM `cmf_slide` 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(cmfSlideType, cmfSlideMapping, 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(cmfSlideType, cmfSlideMapping, 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_slide\")\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] == cmfSlideMapping[\"id\"] {\n\t\tgoto CacheNoHooks\n\t}\n\n\tuniqueMap, err = queries.BindMapping(cmfSlideType, cmfSlideMapping, nzUniques)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to retrieve unique values for cmf_slide\")\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_slide\")\n\t}\n\nCacheNoHooks:\n\tif !cached {\n\t\tcmfSlideUpsertCacheMut.Lock()\n\t\tcmfSlideUpsertCache[key] = cache\n\t\tcmfSlideUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(ctx, exec)\n}", "title": "" }, { "docid": "cf5d90a559e5ee1fed6f2d503c23d79d", "score": "0.6200971", "text": "func (o *PaymentRequest) Upsert(ctx context.Context, exec boil.ContextExecutor, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no payment_request provided for upsert\")\n\t}\n\tif !boil.TimestampsAreSkipped(ctx) {\n\t\tcurrTime := time.Now().In(boil.GetLocation())\n\n\t\tqueries.SetScanner(&o.UpdatedAt, currTime)\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(paymentRequestColumnsWithDefault, o)\n\tnzUniques := queries.NonZeroDefaultSet(mySQLPaymentRequestUniqueColumns, 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\tpaymentRequestUpsertCacheMut.RLock()\n\tcache, cached := paymentRequestUpsertCache[key]\n\tpaymentRequestUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tpaymentRequestAllColumns,\n\t\t\tpaymentRequestColumnsWithDefault,\n\t\t\tpaymentRequestColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tpaymentRequestAllColumns,\n\t\t\tpaymentRequestPrimaryKeyColumns,\n\t\t)\n\n\t\tif !updateColumns.IsNone() && len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert payment_request, could not build update column list\")\n\t\t}\n\n\t\tret = strmangle.SetComplement(ret, nzUniques)\n\t\tcache.query = buildUpsertQueryMySQL(dialect, \"`payment_request`\", update, insert)\n\t\tcache.retQuery = fmt.Sprintf(\n\t\t\t\"SELECT %s FROM `payment_request` 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(paymentRequestType, paymentRequestMapping, 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(paymentRequestType, paymentRequestMapping, 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 payment_request\")\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 = int64(lastID)\n\tif lastID != 0 && len(cache.retMapping) == 1 && cache.retMapping[0] == paymentRequestMapping[\"id\"] {\n\t\tgoto CacheNoHooks\n\t}\n\n\tuniqueMap, err = queries.BindMapping(paymentRequestType, paymentRequestMapping, nzUniques)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to retrieve unique values for payment_request\")\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 payment_request\")\n\t}\n\nCacheNoHooks:\n\tif !cached {\n\t\tpaymentRequestUpsertCacheMut.Lock()\n\t\tpaymentRequestUpsertCache[key] = cache\n\t\tpaymentRequestUpsertCacheMut.Unlock()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "721cf69503b9d2bb29f3d86393a7293d", "score": "0.61990935", "text": "func (o *UserWallet) Upsert(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no user_wallet provided for upsert\")\n\t}\n\tcurrTime := time.Now().In(boil.GetLocation())\n\n\tif o.CreatedAt.IsZero() {\n\t\to.CreatedAt = currTime\n\t}\n\to.UpdatedAt = currTime\n\n\tif err := o.doBeforeUpsertHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(userWalletColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\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\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tuserWalletUpsertCacheMut.RLock()\n\tcache, cached := userWalletUpsertCache[key]\n\tuserWalletUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tuserWalletColumns,\n\t\t\tuserWalletColumnsWithDefault,\n\t\t\tuserWalletColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tuserWalletColumns,\n\t\t\tuserWalletPrimaryKeyColumns,\n\t\t)\n\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert user_wallet, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(userWalletPrimaryKeyColumns))\n\t\t\tcopy(conflict, userWalletPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"user_wallet\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(userWalletType, userWalletMapping, 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(userWalletType, userWalletMapping, 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.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRow(cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.Exec(cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert user_wallet\")\n\t}\n\n\tif !cached {\n\t\tuserWalletUpsertCacheMut.Lock()\n\t\tuserWalletUpsertCache[key] = cache\n\t\tuserWalletUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(exec)\n}", "title": "" }, { "docid": "832240567e0eed1b6fb2df2895d8fc4b", "score": "0.61709076", "text": "func (p *Proposal) Upsert(proposal *models.Proposal) error {\n\tif proposal == nil {\n\t\treturn fmt.Errorf(\"cannot insert an empty proposal struct\")\n\t}\n\n\tif len(proposal.UserID) == 0 {\n\t\treturn fmt.Errorf(\"cannot insert an empty UserID\")\n\t}\n\n\tif len(proposal.ProposalID) == 0 {\n\t\treturn fmt.Errorf(\"cannot insert an empty ProposalID\")\n\t}\n\n\tdb := p.conn.Get()\n\n\tlat := float64(0)\n\tlong := float64(0)\n\tareaRange := float64(0)\n\tareaTags := []string{}\n\n\tif proposal.TargetArea != nil {\n\t\tlat = proposal.TargetArea.Lat\n\t\tlong = proposal.TargetArea.Long\n\t\tareaRange = proposal.TargetArea.Range\n\n\t\tareaTags = common.NormalizeTagArray(proposal.TargetArea.AreaTags)\n\t}\n\n\tif proposal.DataToShare == nil {\n\t\tproposal.DataToShare = []models.DataToShare{}\n\t}\n\n\tif proposal.Images == nil {\n\t\tproposal.Images = []string{}\n\t}\n\n\t_, err := db.Exec(\n\t\tupsertProposal,\n\t\tproposal.ProposalID,\n\t\tproposal.UserID,\n\t\tproposal.Side,\n\t\tproposal.ProposalType,\n\t\tpq.Array(common.NormalizeTagArray(proposal.Tags)),\n\t\tproposal.Title,\n\t\tproposal.Description,\n\t\tproposal.ProposalValidate,\n\t\tlat,\n\t\tlong,\n\t\tareaRange,\n\t\tpq.Array(areaTags),\n\t\tproposal.IsActive,\n\t\tpq.Array(proposal.Images),\n\t\tpq.Array(proposal.DataToShare),\n\t\tproposal.ExposeUserData,\n\t\tproposal.EstimatedValue,\n\t)\n\n\tif err != nil {\n\t\tif perr, ok := err.(*pq.Error); ok {\n\t\t\treturn fmt.Errorf(\"fail to try execute upsert proposal data: proposal=%v pq-error=%s\", proposal, perr)\n\t\t}\n\n\t\treturn fmt.Errorf(\"fail to try execute upsert proposal data: proposal=%v error=%s\", proposal, err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "5c6b44f7d4c5a2e8454ff40f3b68a50e", "score": "0.6161185", "text": "func (o *InputAchievementTag) Upsert(ctx context.Context, exec boil.ContextExecutor, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no input_achievement_tags provided for upsert\")\n\t}\n\tif !boil.TimestampsAreSkipped(ctx) {\n\t\tcurrTime := time.Now().In(boil.GetLocation())\n\n\t\tif o.CreatedAt.IsZero() {\n\t\t\to.CreatedAt = currTime\n\t\t}\n\t}\n\n\tif err := o.doBeforeUpsertHooks(ctx, exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(inputAchievementTagColumnsWithDefault, o)\n\tnzUniques := queries.NonZeroDefaultSet(mySQLInputAchievementTagUniqueColumns, 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\tinputAchievementTagUpsertCacheMut.RLock()\n\tcache, cached := inputAchievementTagUpsertCache[key]\n\tinputAchievementTagUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tinputAchievementTagAllColumns,\n\t\t\tinputAchievementTagColumnsWithDefault,\n\t\t\tinputAchievementTagColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tinputAchievementTagAllColumns,\n\t\t\tinputAchievementTagPrimaryKeyColumns,\n\t\t)\n\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert input_achievement_tags, could not build update column list\")\n\t\t}\n\n\t\tret = strmangle.SetComplement(ret, nzUniques)\n\t\tcache.query = buildUpsertQueryMySQL(dialect, \"input_achievement_tags\", update, insert)\n\t\tcache.retQuery = fmt.Sprintf(\n\t\t\t\"SELECT %s FROM `input_achievement_tags` 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(inputAchievementTagType, inputAchievementTagMapping, 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(inputAchievementTagType, inputAchievementTagMapping, 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 input_achievement_tags\")\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.InputAchievementTagID = int(lastID)\n\tif lastID != 0 && len(cache.retMapping) == 1 && cache.retMapping[0] == inputAchievementTagMapping[\"input_achievement_tag_id\"] {\n\t\tgoto CacheNoHooks\n\t}\n\n\tuniqueMap, err = queries.BindMapping(inputAchievementTagType, inputAchievementTagMapping, nzUniques)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to retrieve unique values for input_achievement_tags\")\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 input_achievement_tags\")\n\t}\n\nCacheNoHooks:\n\tif !cached {\n\t\tinputAchievementTagUpsertCacheMut.Lock()\n\t\tinputAchievementTagUpsertCache[key] = cache\n\t\tinputAchievementTagUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(ctx, exec)\n}", "title": "" }, { "docid": "54b15ef81c75b2e633aae5eaa97f629d", "score": "0.6155607", "text": "func (p *Payment) Upsert(db XODB) error {\n\tvar err error\n\n\t// if already exist, bail\n\tif p._exists {\n\t\treturn errors.New(\"insert failed: already exists\")\n\t}\n\n\t// sql query\n\tconst sqlstr = `INSERT INTO public.payment (` +\n\t\t`id, appointment, price, order_id, status` +\n\t\t`) VALUES (` +\n\t\t`$1, $2, $3, $4, $5` +\n\t\t`) ON CONFLICT (id) DO UPDATE SET (` +\n\t\t`id, appointment, price, order_id, status` +\n\t\t`) = (` +\n\t\t`EXCLUDED.id, EXCLUDED.appointment, EXCLUDED.price, EXCLUDED.order_id, EXCLUDED.status` +\n\t\t`)`\n\n\t// run query\n\tXOLog(sqlstr, p.ID, p.Appointment, p.Price, p.OrderID, p.Status)\n\t_, err = db.Exec(sqlstr, p.ID, p.Appointment, p.Price, p.OrderID, p.Status)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// set existence\n\tp._exists = true\n\n\treturn nil\n}", "title": "" }, { "docid": "c89c455e8add5a1a3d9a9460b9e6586a", "score": "0.61501396", "text": "func (o *DUser) Upsert(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no d_users provided for upsert\")\n\t}\n\tcurrTime := time.Now().In(boil.GetLocation())\n\n\tif o.CreatedAt.IsZero() {\n\t\to.CreatedAt = currTime\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(dUserColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs postgres problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range updateColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range whitelist {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tdUserUpsertCacheMut.RLock()\n\tcache, cached := dUserUpsertCache[key]\n\tdUserUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tvar ret []string\n\t\twhitelist, ret = strmangle.InsertColumnSet(\n\t\t\tdUserColumns,\n\t\t\tdUserColumnsWithDefault,\n\t\t\tdUserColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t\twhitelist,\n\t\t)\n\t\tupdate := strmangle.UpdateColumnSet(\n\t\t\tdUserColumns,\n\t\t\tdUserPrimaryKeyColumns,\n\t\t\tupdateColumns,\n\t\t)\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert d_users, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(dUserPrimaryKeyColumns))\n\t\t\tcopy(conflict, dUserPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = queries.BuildUpsertQueryPostgres(dialect, \"\\\"d_users\\\"\", updateOnConflict, ret, update, conflict, whitelist)\n\n\t\tcache.valueMapping, err = queries.BindMapping(dUserType, dUserMapping, whitelist)\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(dUserType, dUserMapping, 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.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRow(cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.Exec(cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert d_users\")\n\t}\n\n\tif !cached {\n\t\tdUserUpsertCacheMut.Lock()\n\t\tdUserUpsertCache[key] = cache\n\t\tdUserUpsertCacheMut.Unlock()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "df94b5ca5bf378065034448ff376aceb", "score": "0.6146269", "text": "func (o *Project) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no projects provided for upsert\")\n\t}\n\tif !boil.TimestampsAreSkipped(ctx) {\n\t\tcurrTime := time.Now().In(boil.GetLocation())\n\n\t\tif o.CreatedAt.IsZero() {\n\t\t\to.CreatedAt = currTime\n\t\t}\n\t\to.UpdatedAt = currTime\n\t}\n\n\tif err := o.doBeforeUpsertHooks(ctx, exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(projectColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\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\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tprojectUpsertCacheMut.RLock()\n\tcache, cached := projectUpsertCache[key]\n\tprojectUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tprojectAllColumns,\n\t\t\tprojectColumnsWithDefault,\n\t\t\tprojectColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tprojectAllColumns,\n\t\t\tprojectPrimaryKeyColumns,\n\t\t)\n\n\t\tif updateOnConflict && len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert projects, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(projectPrimaryKeyColumns))\n\t\t\tcopy(conflict, projectPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"projects\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(projectType, projectMapping, 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(projectType, projectMapping, 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\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRowContext(ctx, cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.ExecContext(ctx, cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert projects\")\n\t}\n\n\tif !cached {\n\t\tprojectUpsertCacheMut.Lock()\n\t\tprojectUpsertCache[key] = cache\n\t\tprojectUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(ctx, exec)\n}", "title": "" }, { "docid": "e03a8af42381de78ddbc096840850151", "score": "0.6136969", "text": "func (o *PasswordReset) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"record: no password_resets provided for upsert\")\n\t}\n\tif !boil.TimestampsAreSkipped(ctx) {\n\t\tcurrTime := time.Now().In(boil.GetLocation())\n\n\t\tif o.CreatedAt.IsZero() {\n\t\t\to.CreatedAt = currTime\n\t\t}\n\t\to.UpdatedAt = currTime\n\t}\n\n\tif err := o.doBeforeUpsertHooks(ctx, exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(passwordResetColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\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\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tpasswordResetUpsertCacheMut.RLock()\n\tcache, cached := passwordResetUpsertCache[key]\n\tpasswordResetUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tpasswordResetColumns,\n\t\t\tpasswordResetColumnsWithDefault,\n\t\t\tpasswordResetColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tpasswordResetColumns,\n\t\t\tpasswordResetPrimaryKeyColumns,\n\t\t)\n\n\t\tif updateOnConflict && len(update) == 0 {\n\t\t\treturn errors.New(\"record: unable to upsert password_resets, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(passwordResetPrimaryKeyColumns))\n\t\t\tcopy(conflict, passwordResetPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"password_resets\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(passwordResetType, passwordResetMapping, 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(passwordResetType, passwordResetMapping, 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.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRowContext(ctx, cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.ExecContext(ctx, cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"record: unable to upsert password_resets\")\n\t}\n\n\tif !cached {\n\t\tpasswordResetUpsertCacheMut.Lock()\n\t\tpasswordResetUpsertCache[key] = cache\n\t\tpasswordResetUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(ctx, exec)\n}", "title": "" }, { "docid": "5c853e2f91efa5b46381e2be361d9015", "score": "0.6136194", "text": "func (o *DChannelOverwrite) Upsert(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no d_channel_overwrites provided for upsert\")\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(dChannelOverwriteColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs postgres problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range updateColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range whitelist {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tdChannelOverwriteUpsertCacheMut.RLock()\n\tcache, cached := dChannelOverwriteUpsertCache[key]\n\tdChannelOverwriteUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tvar ret []string\n\t\twhitelist, ret = strmangle.InsertColumnSet(\n\t\t\tdChannelOverwriteColumns,\n\t\t\tdChannelOverwriteColumnsWithDefault,\n\t\t\tdChannelOverwriteColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t\twhitelist,\n\t\t)\n\t\tupdate := strmangle.UpdateColumnSet(\n\t\t\tdChannelOverwriteColumns,\n\t\t\tdChannelOverwritePrimaryKeyColumns,\n\t\t\tupdateColumns,\n\t\t)\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert d_channel_overwrites, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(dChannelOverwritePrimaryKeyColumns))\n\t\t\tcopy(conflict, dChannelOverwritePrimaryKeyColumns)\n\t\t}\n\t\tcache.query = queries.BuildUpsertQueryPostgres(dialect, \"\\\"d_channel_overwrites\\\"\", updateOnConflict, ret, update, conflict, whitelist)\n\n\t\tcache.valueMapping, err = queries.BindMapping(dChannelOverwriteType, dChannelOverwriteMapping, whitelist)\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(dChannelOverwriteType, dChannelOverwriteMapping, 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.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRow(cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.Exec(cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert d_channel_overwrites\")\n\t}\n\n\tif !cached {\n\t\tdChannelOverwriteUpsertCacheMut.Lock()\n\t\tdChannelOverwriteUpsertCache[key] = cache\n\t\tdChannelOverwriteUpsertCacheMut.Unlock()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e702e490ec6312677b42069c0ca67eda", "score": "0.61303014", "text": "func (b *PgsqlBuilder) Upsert(table string, cols Params, constraints ...string) *Query {\n\tq := b.Insert(table, cols)\n\n\tnames := []string{}\n\tfor name := range cols {\n\t\tnames = append(names, name)\n\t}\n\tsort.Strings(names)\n\n\tlines := []string{}\n\tfor _, name := range names {\n\t\tvalue := cols[name]\n\t\tname = b.db.QuoteColumnName(name)\n\t\tif e, ok := value.(Expression); ok {\n\t\t\tlines = append(lines, name+\"=\"+e.Build(b.db, q.params))\n\t\t} else {\n\t\t\tlines = append(lines, fmt.Sprintf(\"%v={:p%v}\", name, len(q.params)))\n\t\t\tq.params[fmt.Sprintf(\"p%v\", len(q.params))] = value\n\t\t}\n\t}\n\n\tif len(constraints) > 0 {\n\t\tc := b.quoteColumns(constraints)\n\t\tq.sql += \" ON CONFLICT (\" + c + \") DO UPDATE SET \" + strings.Join(lines, \", \")\n\t} else {\n\t\tq.sql += \" ON CONFLICT DO UPDATE SET \" + strings.Join(lines, \", \")\n\t}\n\n\treturn b.NewQuery(q.sql).Bind(q.params)\n}", "title": "" }, { "docid": "448176266b6b6050b8be4d36707eee8b", "score": "0.61232233", "text": "func UpsertTx(db *sqlx.DB, u Upserter) (status int, err error) {\n\tdefer func() {\n\t\tif Debug {\n\t\t\tlog.Println(statusToText(status), u)\n\t\t}\n\t}()\n\n\ttx, err := db.Beginx()\n\tif err != nil {\n\t\tlog.Println(\"can't start transaction\", err)\n\t\treturn\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\ttx.Rollback()\n\t\t} else {\n\t\t\ttx.Commit()\n\t\t}\n\t}()\n\n\t// Try to update\n\tstatus, err = Update(tx, u)\n\n\t// If we have a nil error, we successfully updated. If we have\n\t// an err other than ErrNoIDReturned, we couldn't update for an\n\t// unexpected reason. In either case return.\n\tif err != ErrNoIDReturned {\n\t\treturn\n\t}\n\n\t// No ID returned in the update? Try insert\n\terr = Insert(tx, u)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\n\tstatus = Inserted\n\n\tif Debug {\n\t\tlog.Println(statusToText(status), u)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "8e01f4268f10820b7f9fc1e4b8833416", "score": "0.612275", "text": "func (n *News) Upsert(ctx context.Context, idb interface{}, now time.Time) error {\n\t// upsert\n\tconst sqlstr = `INSERT INTO public.news (` +\n\t\t`id, title, description, created_at, updated_at` +\n\t\t`) VALUES (` +\n\t\t`$1, $2, $3, $4, $5` +\n\t\t`)` +\n\t\t` ON CONFLICT (id) DO ` +\n\t\t`UPDATE SET ` +\n\t\t`title = EXCLUDED.title, description = EXCLUDED.description, created_at = EXCLUDED.created_at, updated_at = EXCLUDED.updated_at `\n\t// run\n\tlogf(sqlstr, n.ID, n.Title, n.Description, n.CreatedAt, n.UpdatedAt)\n\tswitch idb.(type) {\n\tcase *sqlx.DB:\n\t\tdb := idb.(*sqlx.DB)\n\t\tif _, err := db.ExecContext(ctx, sqlstr, n.ID, n.Title, n.Description, n.CreatedAt, n.UpdatedAt); err != nil {\n\t\t\treturn logerror(err)\n\t\t}\n\tcase *sqlx.Tx:\n\t\tdb := idb.(*sqlx.Tx)\n\t\tif _, err := db.ExecContext(ctx, sqlstr, n.ID, n.Title, n.Description, n.CreatedAt, n.UpdatedAt); err != nil {\n\t\t\treturn logerror(err)\n\t\t}\n\tdefault:\n\t\treturn logerror(fmt.Errorf(\"UNSUPPORTED TYPE: %T\", idb))\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "30f42b65fae2e31342accf3b251f2693", "score": "0.61219436", "text": "func (bbt *BooktestBookTag) Upsert(ctx context.Context, db DB) error {\n\tswitch {\n\tcase bbt._deleted: // deleted\n\t\treturn logerror(&ErrUpsertFailed{ErrMarkedForDeletion})\n\t}\n\t// upsert\n\tconst sqlstr = `INSERT INTO django.booktest_book_tags (` +\n\t\t`id, book_id, tag_id` +\n\t\t`) VALUES (` +\n\t\t`?, ?, ?` +\n\t\t`)` +\n\t\t` ON DUPLICATE KEY UPDATE ` +\n\t\t`book_id = VALUES(book_id), tag_id = VALUES(tag_id)`\n\t// run\n\tlogf(sqlstr, bbt.ID, bbt.BookID, bbt.TagID)\n\tif _, err := db.ExecContext(ctx, sqlstr, bbt.ID, bbt.BookID, bbt.TagID); err != nil {\n\t\treturn err\n\t}\n\t// set exists\n\tbbt._exists = true\n\treturn nil\n}", "title": "" }, { "docid": "43703be0163a4a5c67a85a3f290aab57", "score": "0.6103532", "text": "func (o *Location) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"db: no location 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(locationColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\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\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tlocationUpsertCacheMut.RLock()\n\tcache, cached := locationUpsertCache[key]\n\tlocationUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tlocationAllColumns,\n\t\t\tlocationColumnsWithDefault,\n\t\t\tlocationColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tlocationAllColumns,\n\t\t\tlocationPrimaryKeyColumns,\n\t\t)\n\n\t\tif updateOnConflict && len(update) == 0 {\n\t\t\treturn errors.New(\"db: unable to upsert location, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(locationPrimaryKeyColumns))\n\t\t\tcopy(conflict, locationPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"location\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(locationType, locationMapping, 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(locationType, locationMapping, 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\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRowContext(ctx, cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.ExecContext(ctx, cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"db: unable to upsert location\")\n\t}\n\n\tif !cached {\n\t\tlocationUpsertCacheMut.Lock()\n\t\tlocationUpsertCache[key] = cache\n\t\tlocationUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(ctx, exec)\n}", "title": "" }, { "docid": "8244e7daba7a3348e241c1290e6e635b", "score": "0.61031944", "text": "func (o *SessionsClosed) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no sessions_closed provided for upsert\")\n\t}\n\tif !boil.TimestampsAreSkipped(ctx) {\n\t\tcurrTime := time.Now().In(boil.GetLocation())\n\n\t\to.UpdatedAt = currTime\n\t\tif o.CreatedAt.IsZero() {\n\t\t\to.CreatedAt = currTime\n\t\t}\n\t}\n\n\tif err := o.doBeforeUpsertHooks(ctx, exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(sessionsClosedColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\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\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tsessionsClosedUpsertCacheMut.RLock()\n\tcache, cached := sessionsClosedUpsertCache[key]\n\tsessionsClosedUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tsessionsClosedAllColumns,\n\t\t\tsessionsClosedColumnsWithDefault,\n\t\t\tsessionsClosedColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tsessionsClosedAllColumns,\n\t\t\tsessionsClosedPrimaryKeyColumns,\n\t\t)\n\n\t\tif updateOnConflict && len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert sessions_closed, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(sessionsClosedPrimaryKeyColumns))\n\t\t\tcopy(conflict, sessionsClosedPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"sessions_closed\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(sessionsClosedType, sessionsClosedMapping, 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(sessionsClosedType, sessionsClosedMapping, 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\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRowContext(ctx, cache.query, vals...).Scan(returns...)\n\t\tif errors.Is(err, sql.ErrNoRows) {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.ExecContext(ctx, cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert sessions_closed\")\n\t}\n\n\tif !cached {\n\t\tsessionsClosedUpsertCacheMut.Lock()\n\t\tsessionsClosedUpsertCache[key] = cache\n\t\tsessionsClosedUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(ctx, exec)\n}", "title": "" }, { "docid": "3a83bdda8e93a3a357bcaadc25440060", "score": "0.6101481", "text": "func (c *apiClient) upsert(link string, body, ret interface{}, opts ...CallOption) (*Response, error) {\n\topts = append(opts, Upsert())\n\tdata, err := stringify(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbuf := bytes.NewBuffer(data)\n\tif c.config.PartitionKeyStructField != \"\" {\n\t\tpartKey := reflect.ValueOf(body).Elem().FieldByName(c.config.PartitionKeyStructField)\n\t\tpartKeyI := partKey.Interface()\n\t\topts = append(opts, PartitionKey(partKeyI))\n\t}\n\treturn c.method(http.MethodPost, link, http.StatusOK, ret, buf, opts...)\n}", "title": "" } ]
606b2fc484eca3928f8a0a88186b668d
Delete an app instance.
[ { "docid": "b9212bb1f62333fd0a963a6512462038", "score": "0.5547186", "text": "func (dao *appDao) Delete(kit *kit.Kit, g *table.App) error {\n\tif g == nil {\n\t\treturn errors.New(\"app is nil\")\n\t}\n\n\tif err := g.ValidateDelete(); err != nil {\n\t\treturn err\n\t}\n\n\t// 删除操作, 获取当前记录做审计\n\tm := dao.genQ.App\n\tq := dao.genQ.App.WithContext(kit.Ctx)\n\toldOne, err := q.Where(m.ID.Eq(g.ID), m.BizID.Eq(g.BizID)).Take()\n\tif err != nil {\n\t\treturn err\n\t}\n\tad := dao.auditDao.DecoratorV2(kit, g.BizID).PrepareDelete(oldOne)\n\teDecorator := dao.event.Eventf(kit)\n\n\t// 多个使用事务处理\n\tdeleteTx := func(tx *gen.Query) error {\n\t\tq = tx.App.WithContext(kit.Ctx)\n\t\tif _, err = q.Where(m.BizID.Eq(g.BizID)).Delete(g); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// archived this deleted app to archive table.\n\t\tif err = dao.archiveApp(kit, tx, oldOne); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err = ad.Do(tx); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// fire the event with txn to ensure the if save the event failed then the business logic is failed anyway.\n\t\tone := types.Event{\n\t\t\tSpec: &table.EventSpec{\n\t\t\t\tResource: table.Application,\n\t\t\t\tResourceID: g.ID,\n\t\t\t\tOpType: table.DeleteOp,\n\t\t\t},\n\t\t\tAttachment: &table.EventAttachment{BizID: g.BizID, AppID: g.ID},\n\t\t\tRevision: &table.CreatedRevision{Creator: kit.User},\n\t\t}\n\t\tif err = eDecorator.Fire(one); err != nil {\n\t\t\tlogs.Errorf(\"fire delete app: %s event failed, err: %v, rid: %s\", g.ID, err, kit.Rid)\n\t\t\treturn errors.New(\"fire event failed, \" + err.Error())\n\t\t}\n\n\t\treturn nil\n\t}\n\terr = dao.genQ.Transaction(deleteTx)\n\n\teDecorator.Finalizer(err)\n\n\tif err != nil {\n\t\tlogs.Errorf(\"delete app: %d failed, err: %v, rid: %v\", g.ID, err, kit.Rid)\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" } ]
[ { "docid": "7e716686e14ae3da5dac80dcf3f0ddae", "score": "0.7732172", "text": "func DeleteAppInstance(mc *rancher.MasterClient, data *appmgrcommon.AppInstanceData, version string) error {\n\n\twResource, _ := rancher.Lookup(mc, data.InstanceName, \"workload\")\n\n\tif wResource != nil {\n\t\tappInstance, err := mc.ProjectClient.Workload.ByID(wResource.ID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := mc.ProjectClient.Workload.Delete(appInstance); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Find the resource\n\tresource, err := rancher.Lookup(mc, data.InstanceName, \"app\")\n\tif resource == nil {\n\t\treturn nil\n\t}\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Lookup application instance by resource ID\n\tappInstance, err := mc.ProjectClient.App.ByID(resource.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Delete application instance\n\tlogrus.WithFields(logrus.Fields{\"instance\": data.InstanceName,\n\t\t\"version\": version}).Info(\"Deleting application\")\n\n\tif err := mc.ProjectClient.App.Delete(appInstance); err != nil {\n\t\treturn err\n\t}\n\n\tstartTime := time.Now()\n\tfor {\n\t\tif time.Since(startTime)/time.Second > 30 {\n\t\t\treturn fmt.Errorf(\"timed out waiting for deleting application instance %s-%s\", data.InstanceName, version)\n\t\t}\n\t\ta, _ := mc.ProjectClient.App.ByID(resource.ID)\n\t\tif a.ID == \"\" {\n\t\t\tbreak\n\t\t}\n\n\t\ttime.Sleep(500 * time.Millisecond)\n\t}\n\n\tlogrus.WithFields(logrus.Fields{\"instance\": data.InstanceName, \"version\": version, \"status\": \"OK\"}).Info(\"Deleting application\")\n\n\tif data.DeleteInstanceStorage {\n\t\tvolumeName := data.InstanceName + \"-pv\"\n\t\tclaimName := data.InstanceName + \"-pvc\"\n\t\tif err := DeleteStorage(mc, volumeName, claimName); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "7c89f92bd2c1de14c646942b5dd7ce83", "score": "0.69794816", "text": "func DeleteApp(c *gin.Context) {\n\tid := c.Param(\"id\")\n\tobjectID, err := primitive.ObjectIDFromHex(id)\n\n\tif err != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error(), \"code\": InvalidIdentifier})\n\t\tc.Abort()\n\t\treturn\n\t}\n\n\tapp := &drepository.Application{ID: objectID}\n\n\t_, err = app.Delete()\n\n\tif err != nil {\n\t\tc.JSON(http.StatusInternalServerError, gin.H{\"error\": err.Error(), \"code\": DeleteDbError})\n\t\tc.Abort()\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, gin.H{\"result\": true})\n}", "title": "" }, { "docid": "e737debff8bf30ae5028e0ca3b4f08a5", "score": "0.6743432", "text": "func (c *CommandLineClient) DeleteApp(labels *ObjectLabels) (*DeleteAppOutput, error) {\n\targuments := []string{\"delete\", \"all\", \"-l\", labels.Combined()}\n\n\toutput, err := c.RunOcCommand(arguments...)\n\treturn &DeleteAppOutput{Raw: output}, err\n}", "title": "" }, { "docid": "a1a1971ef280c3f764d608336a6b916f", "score": "0.6702131", "text": "func DeleteInstance(instance models.CustomCheckInstanceModel, org, token, hostName string) error {\n\turl := fmt.Sprintf(opaInstanceURLFormat, hostName, org, instance.CheckName, instance.InstanceName)\n\tresp, err := req.Delete(url, getHeaders(token))\n\tif err != nil {\n\t\treturn err\n\t}\n\tif resp.Response().StatusCode != http.StatusOK {\n\t\tlogrus.Errorf(\"Invalid response code: %s %v\", string(resp.Bytes()), resp.Response().StatusCode)\n\t\treturn errors.New(\"invalid response code\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c4d72507c7db9ec4d402064a1f7c7801", "score": "0.6604336", "text": "func (o *OpenStack) DeleteInstance(ctx *Context, instancename string) error {\n\tfmt.Println(\"un-implemented\")\n\treturn nil\n}", "title": "" }, { "docid": "aee96f75f5ae045cd2d988d0dc63f44b", "score": "0.65886015", "text": "func (bs *BusinessServer) DeleteApp(ctx context.Context, req *pb.DeleteAppReq) (*pb.DeleteAppResp, error) {\n\trtime := time.Now()\n\tlogger.V(2).Infof(\"DeleteApp[%d]| input[%+v]\", req.Seq, req)\n\tresponse := &pb.DeleteAppResp{Seq: req.Seq, ErrCode: pbcommon.ErrCode_E_OK, ErrMsg: \"OK\"}\n\n\tdefer func() {\n\t\tcost := bs.collector.StatRequest(\"DeleteApp\", response.ErrCode, rtime, time.Now())\n\t\tlogger.V(2).Infof(\"DeleteApp[%d]| output[%dms][%+v]\", req.Seq, cost, response)\n\t}()\n\n\taction := appaction.NewDeleteAction(bs.viper, bs.dataMgrCli, req, response)\n\tbs.executor.Execute(action)\n\n\treturn response, nil\n}", "title": "" }, { "docid": "09995d8fe6472643c7779e60f1031e46", "score": "0.65588206", "text": "func (c *LetsCloud) DeleteInstance(id string) error {\n\tif id == \"\" {\n\t\treturn errors.New(\"Please provide a valid instance identifier\")\n\t}\n\n\treq, err := c.requester.NewRequest(http.MethodDelete, baseURL+\"/instances/\"+id, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tb, err := c.requester.SendRequest(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfmt.Println(b)\n\n\tvar out domains.CommonResponse\n\n\terr = processResponse(b, &out)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !out.Success {\n\t\treturn errors.New(out.Message)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9f27384b3625a438a1fe1ebc690ab46f", "score": "0.65036106", "text": "func (r *REST) Delete(ctx kapi.Context, name string, options *kapi.DeleteOptions) (runtime.Object, error) {\n\tappObj, err := r.Get(ctx, name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tapplication := appObj.(*api.Application)\n\n\tif application.Status.Phase == api.ApplicationTerminating {\n\t\treturn r.store.Delete(ctx, name, options)\n\t}\n\tif application.Status.Phase == api.ApplicationTerminatingLabel {\n\t\treturn r.store.Delete(ctx, name, options)\n\t}\n\n\tif application.DeletionTimestamp.IsZero() {\n\t\tnow := unversioned.Now()\n\t\tapplication.DeletionTimestamp = &now\n\t\tapplication.Status.Phase = api.ApplicationTerminatingLabel\n\t\tresult, _, err := r.store.Update(ctx, application)\n\t\treturn result, err\n\t}\n\n\treturn r.store.Delete(ctx, name, options)\n}", "title": "" }, { "docid": "a2f998dd9b29c5baca7814055fb15d84", "score": "0.6460947", "text": "func (c *Client) AppDelete(id string) error {\n\treturn c.send(\"DELETE\", \"/api/v2/system/app/\"+id, 200, nil, nil)\n}", "title": "" }, { "docid": "c55881ee6aadcf7953f52688386e88c1", "score": "0.6434351", "text": "func (cs *ConfigServer) DeleteApp(ctx context.Context, req *pb.DeleteAppReq) (*pb.DeleteAppResp, error) {\n\trtime := time.Now()\n\tkit := common.RequestKit(ctx)\n\tlogger.V(2).Infof(\"%s[%s]| appcode: %s, user: %s, input[%+v]\", kit.Method, kit.Rid, kit.AppCode, kit.User, req)\n\n\tresponse := new(pb.DeleteAppResp)\n\n\tdefer func() {\n\t\tcost := cs.collector.StatRequest(kit.Method, response.Code, rtime, time.Now())\n\t\tlogger.V(2).Infof(\"%s[%s]| output[%dms][%+v]\", kit.Method, kit.Rid, cost, response)\n\t}()\n\n\taction := appaction.NewDeleteAction(kit, cs.viper, cs.authSvrCli, cs.dataMgrCli, req, response)\n\tif err := cs.executor.ExecuteWithAuth(action); err != nil {\n\t\tlogger.Errorf(\"%s[%s]| %+v\", kit.Method, kit.Rid, err)\n\t}\n\n\treturn response, nil\n}", "title": "" }, { "docid": "f8ecbf161f82a3ed7d3352bcc5fd7dcb", "score": "0.6431905", "text": "func (app *Application) Delete(args ...interface{}) *Application {\n\tapp.register(\"DELETE\", args...)\n\treturn app\n}", "title": "" }, { "docid": "bd03132b106bd3124216fb27257e14de", "score": "0.64014965", "text": "func (b *Backend) DeleteApplication(appId string) error {\n\ttasks, err := b.store.ListTasks(appId)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, task := range tasks {\n\t\t// Stop task health check\n\t\tb.sched.HealthCheckManager.StopCheck(task.Name)\n\n\t\t// Kill task via mesos\n\t\tresp, err := b.sched.KillTask(task)\n\t\tif err != nil {\n\t\t\tlogrus.Errorf(\"Kill task failed: %s\", err.Error())\n\t\t\tbreak\n\t\t}\n\n\t\t// Decline offer\n\t\tif resp.StatusCode == http.StatusAccepted {\n\t\t\tb.sched.DeclineResource(task.OfferId)\n\t\t}\n\n\t\t// Delete task from db\n\t\tif err := b.store.DeleteTask(task.Name); err != nil {\n\t\t\tlogrus.Errorf(\"Delete task %s from db failed: %s\", task.ID, err.Error())\n\t\t}\n\n\t\t// Delete task health check\n\t\tif err := b.store.DeleteCheck(task.Name); err != nil {\n\t\t\tlogrus.Errorf(\"Delete task health check %s from consul failed: %s\", task.ID, err.Error())\n\t\t}\n\n\t}\n\n\tversions, err := b.store.ListVersions(appId)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, version := range versions {\n\t\tif err := b.store.DeleteVersion(version); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn b.store.DeleteApplication(appId)\n}", "title": "" }, { "docid": "97ab0efa1a8c85d2bf1440a55034e29f", "score": "0.63770235", "text": "func DeleteInstance(cli bce.Client, instanceId string) error {\n\t// Build the request\n\treq := &bce.BceRequest{}\n\treq.SetUri(getInstanceUriWithId(instanceId))\n\treq.SetMethod(http.DELETE)\n\n\t// Send request and get response\n\tresp := &bce.BceResponse{}\n\tif err := cli.SendRequest(req, resp); err != nil {\n\t\treturn err\n\t}\n\tif resp.IsFail() {\n\t\treturn resp.ServiceError()\n\t}\n\n\tdefer func() { resp.Body().Close() }()\n\treturn nil\n}", "title": "" }, { "docid": "624c1af63092ecf26f4942201afdbf6c", "score": "0.63684505", "text": "func (rm *ResourceManager) DeleteApp(mode table.AppMode, id uint32) {\n\trm.App[mode] = deleteId(rm.App[mode], id)\n}", "title": "" }, { "docid": "a55a4f54cba32412b37cc26c0e9c2d0b", "score": "0.62752974", "text": "func deleteApp(id string) {\n\tappsToDelete = append(appsToDelete, id)\n}", "title": "" }, { "docid": "0ca09e0d83afc442f4258aca14eac883", "score": "0.6233903", "text": "func (c *SmartThingsClient) AppDelete(app string) error {\n\treq, err := c.newRequest(http.MethodDelete, fmt.Sprintf(\"/v1/apps/%s\", app), nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = c.do(req, nil)\n\treturn err\n}", "title": "" }, { "docid": "8fd690a9d3459899df1ee756be533020", "score": "0.62289023", "text": "func (o *DeleteOptions) DeleteApp() (string, error) {\n\tif err := appfile.Delete(o.Env.Name, o.AppName); err != nil && !os.IsNotExist(err) {\n\t\treturn \"\", err\n\t}\n\tctx := context.Background()\n\tvar app = new(corev1beta1.Application)\n\terr := o.Client.Get(ctx, client.ObjectKey{Name: o.AppName, Namespace: o.Env.Namespace}, app)\n\tif err != nil {\n\t\tif apierrors.IsNotFound(err) {\n\t\t\treturn fmt.Sprintf(\"app \\\"%s\\\" already deleted\", o.AppName), nil\n\t\t}\n\t\treturn \"\", fmt.Errorf(\"delete appconfig err: %w\", err)\n\t}\n\n\terr = o.Client.Delete(ctx, app)\n\tif err != nil && !apierrors.IsNotFound(err) {\n\t\treturn \"\", fmt.Errorf(\"delete application err: %w\", err)\n\t}\n\n\tfor _, cmp := range app.Spec.Components {\n\t\thealthScopeName, ok := cmp.Scopes[api.DefaultHealthScopeKey]\n\t\tif ok {\n\t\t\tvar healthScope corev1alpha2.HealthScope\n\t\t\tif err := o.Client.Get(ctx, client.ObjectKey{Namespace: o.Env.Namespace, Name: healthScopeName}, &healthScope); err != nil {\n\t\t\t\tif apierrors.IsNotFound(err) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\treturn \"\", fmt.Errorf(\"delete health scope %s err: %w\", healthScopeName, err)\n\t\t\t}\n\t\t\tif err = o.Client.Delete(ctx, &healthScope); err != nil {\n\t\t\t\treturn \"\", fmt.Errorf(\"delete health scope %s err: %w\", healthScopeName, err)\n\t\t\t}\n\t\t}\n\t}\n\treturn fmt.Sprintf(\"app \\\"%s\\\" deleted from env \\\"%s\\\"\", o.AppName, o.Env.Name), nil\n}", "title": "" }, { "docid": "ad33ba71f5c4d22d9f6fc917a4904229", "score": "0.6216599", "text": "func (c *Client) Delete(serviceInstanceName, appName string, opts ...DeleteOption) error {\n\tcfg := DeleteOptionDefaults().Extend(opts).toConfig()\n\treturn c.appsClient.Transform(cfg.Namespace, appName, func(app *v1alpha1.App) error {\n\t\tUnbindService(app, serviceInstanceName)\n\t\treturn nil\n\t})\n}", "title": "" }, { "docid": "d23fa8a35f0560df691d961cc20f97a1", "score": "0.6211475", "text": "func DeleteInstance(ctx context.Context, tx *sql.Tx, project string, name string) error {\n\tstmt, err := Stmt(tx, instanceDeleteByProjectAndName)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed to get \\\"instanceDeleteByProjectAndName\\\" prepared statement: %w\", err)\n\t}\n\n\tresult, err := stmt.Exec(project, name)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Delete \\\"instances\\\": %w\", err)\n\t}\n\n\tn, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Fetch affected rows: %w\", err)\n\t}\n\n\tif n == 0 {\n\t\treturn api.StatusErrorf(http.StatusNotFound, \"Instance not found\")\n\t} else if n > 1 {\n\t\treturn fmt.Errorf(\"Query deleted %d Instance rows instead of 1\", n)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "913b6b819a596805b6517935f1c6e103", "score": "0.61649114", "text": "func AppDeleteAction(clientConfig spinnaker.ClientConfig) cli.ActionFunc {\n\treturn func(cc *cli.Context) error {\n\t\tappName := cc.Args().Get(0)\n\n\t\tconfig := make(map[string]interface{})\n\n\t\tconfig[\"name\"] = appName\n\n\t\tdeleteAppJob := spinnaker.ApplicationJob{\n\t\t\tApplication: config,\n\t\t\tType: \"deleteApplication\",\n\t\t}\n\n\t\tdeleteApp := spinnaker.Task{\n\t\t\tApplication: appName,\n\t\t\tDescription: \"Delete Application: \" + appName,\n\t\t\tJob: []interface{}{deleteAppJob},\n\t\t}\n\n\t\tclient, err := clientFromContext(cc, clientConfig)\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"creating spinnaker client\")\n\t\t}\n\n\t\tlogrus.Info(\"Sending delete app task\")\n\t\tref, err := client.ApplicationSubmitTask(appName, deleteApp)\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"submitting task\")\n\t\t}\n\n\t\tresp, err := client.PollTaskStatus(ref.Ref, time.Duration(cc.GlobalInt(\"timeout\"))*time.Second)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"poll delete app status\")\n\t\t}\n\n\t\tif resp.Status == \"TERMINAL\" {\n\t\t\tlogrus.WithField(\"status\", resp.Status).Error(\"Task failed\")\n\t\t\tif retrofitErr := resp.ExtractRetrofitError(); retrofitErr != nil {\n\t\t\t\tprettyPrintJSON([]byte(retrofitErr.ResponseBody))\n\t\t\t} else {\n\t\t\t\tfmt.Printf(\"%#v\\n\", resp)\n\t\t\t}\n\t\t} else {\n\t\t\tlogrus.WithField(\"status\", resp.Status).Info(\"Task completed\")\n\t\t}\n\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "bbee90e438cf9d15dba8a7bc7b55b72d", "score": "0.6099492", "text": "func (r *swanClient) DeleteApplication(appID string) error {\n\tif err := r.apiDelete(APIApps+\"/\"+appID, nil, nil); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ab5284b4d6bf3e2452f61d00fdc08f6a", "score": "0.60741657", "text": "func (a *Client) DeleteApp(params *DeleteAppParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteAppOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewDeleteAppParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"deleteApp\",\n\t\tMethod: \"DELETE\",\n\t\tPathPattern: \"/apps/{appNameOrId}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &DeleteAppReader{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.(*DeleteAppOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\tunexpectedSuccess := result.(*DeleteAppDefault)\n\treturn nil, runtime.NewAPIError(\"unexpected success response: content available as default response in error\", unexpectedSuccess, unexpectedSuccess.Code())\n}", "title": "" }, { "docid": "e97f8e5d785eabf3fda71da8c4b6c6d9", "score": "0.59933364", "text": "func DeleteAppPermanently(app *App, db *gorm.DB) error {\n\treturn deleteApp(app, false, db)\n}", "title": "" }, { "docid": "b1d223edc1dab8c7d96ddb0ea4853063", "score": "0.59891343", "text": "func (a *AppPreviewSetsApiService) AppPreviewSetsDeleteInstance(ctx _context.Context, id string) (*_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)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/v1/appPreviewSets/{id}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"id\"+\"}\", _neturl.PathEscape(parameterToString(id, \"\")), -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\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn 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 == 400 {\n\t\t\tvar v ErrorResponse\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 localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v ErrorResponse\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 localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v ErrorResponse\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 localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 409 {\n\t\t\tvar v ErrorResponse\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 localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarHTTPResponse, newErr\n\t\t}\n\t\treturn localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "4e2b2de99a969c9b8e5cc004207ffd09", "score": "0.5946014", "text": "func (ins *ClusterInstances) DeleteInstance(instance *Instance) (*Instance, error) {\n\t// TODO(tamal): FixIt!\n\t//updates := &KubernetesInstance{Status: InstancePhaseDeleted}\n\t//cond := &KubernetesInstance{PHID: instance.PHID}\n\t//if _, err := ins.Store().Engine.Update(updates, cond); err != nil {\n\t//\treturn nil, errors.FromErr(err).WithContext(ins).Err()\n\t//} else {\n\tinstance.Status.Phase = InstancePhaseDeleted\n\treturn instance, nil\n\t//}\n}", "title": "" }, { "docid": "d75896d6153af7c85ef7d9d2395c0664", "score": "0.5936425", "text": "func (c *AppClient) Delete(ctx context.Context, guid string) (string, error) {\n\treturn c.client.delete(ctx, path.Format(\"/v3/apps/%s\", guid))\n}", "title": "" }, { "docid": "bab970bdf468e0dac1ab75d2b4cb2504", "score": "0.5936292", "text": "func (app *AppBundle) Delete() (err error) {\n\n\tbearer, err := app.authenticator.GetToken(\"code:all\")\n\tif err != nil {\n\t\treturn\n\t}\n\n\terr = deleteApp(app.path, app.name, bearer.AccessToken)\n\n\t// TODO: research for a more elegant way of self-removing\n\tapp.Parameters = AppParameters{}\n\tapp.Engine = \"\"\n\tapp.name = \"\"\n\tapp.ID = \"\"\n\tapp.Version = 0\n\tapp.authenticator = nil\n\tapp.path = \"\"\n\tapp.uploadURL = \"\"\n\n\treturn\n}", "title": "" }, { "docid": "19082eee2021d83464dd35a5c820061d", "score": "0.5929407", "text": "func (Executor) DeleteApp(nodeId string, appId string) (int, map[string]interface{}, error) {\n\tlogger.Logging(logger.DEBUG, \"IN\")\n\tdefer logger.Logging(logger.DEBUG, \"OUT\")\n\n\t// Get node including app specified by appId parameter.\n\tnode, err := nodeDbExecutor.GetNodeByAppID(nodeId, appId)\n\tif err != nil {\n\t\tlogger.Logging(logger.ERROR, err.Error())\n\t\treturn results.ERROR, nil, err\n\t}\n\n\taddress := getNodeAddress(node)\n\turls := util.MakeRequestUrl(address, url.Management(), url.Apps(), \"/\", appId)\n\n\t// Request delete target application\n\tcodes, respStr := httpExecutor.SendHttpRequest(\"DELETE\", urls, nil)\n\n\t// Convert the received response from string to map.\n\tresult := codes[0]\n\tif !util.IsSuccessCode(result) {\n\t\trespMap, err := convertRespToMap(respStr)\n\t\tif err != nil {\n\t\t\tlogger.Logging(logger.ERROR, err.Error())\n\t\t\treturn results.ERROR, nil, err\n\t\t}\n\t\treturn result, respMap, err\n\t}\n\n\t// if response code represents success, delete the appId from nodeDbExecutor.\n\terr = nodeDbExecutor.DeleteAppFromNode(nodeId, appId)\n\tif err != nil {\n\t\tlogger.Logging(logger.ERROR, err.Error())\n\t\treturn results.ERROR, nil, err\n\t}\n\n\terr = appDbExecutor.DeleteApp(appId)\n\tif err != nil {\n\t\tlogger.Logging(logger.ERROR, err.Error())\n\t\treturn results.ERROR, nil, err\n\t}\n\n\tnotiExecutor.UpdateSubscriber()\n\t\n\treturn result, nil, err\n}", "title": "" }, { "docid": "7fe8a8360fa58a6791c4ee3d2603aff9", "score": "0.590922", "text": "func (c *CR2UX) DeleteApp(ctx context.Context, targetApp *v1beta1.Application) error {\n\tif !c.shouldSync(ctx, targetApp, true) {\n\t\treturn nil\n\t}\n\tapp, appName, err := c.getApp(ctx, targetApp.Name, targetApp.Namespace)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Only for the unit test scenario\n\tif c.applicationService == nil {\n\t\treturn c.ds.Delete(ctx, &model.Application{Name: appName})\n\t}\n\treturn c.applicationService.DeleteApplication(ctx, app)\n}", "title": "" }, { "docid": "cbe0d7b3de2c9f267b575e3540bec425", "score": "0.59035295", "text": "func (c *Client) DeleteInstance(instanceID string, option *bce.SignOption) error {\n\tinstance, err := c.DescribeInstance(instanceID, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// release eip if necessary\n\tif len(instance.PublicIP) != 0 {\n\t\teipClient := eip.NewEIPClient(c.Config)\n\t\teipArg := &eip.EipArgs{\n\t\t\tIp: instance.PublicIP,\n\t\t}\n\t\t// not return err even if failed\n\t\teipClient.UnbindEip(eipArg)\n\t\teipClient.DeleteEip(eipArg)\n\t}\n\treq, err := bce.NewRequest(\"DELETE\", c.GetURL(\"v2/instance\"+\"/\"+instanceID, nil), nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = c.SendRequest(req, option)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a6c9845cc382d5352bde9f7fdae8a070", "score": "0.5894726", "text": "func (s *InstanceService) Delete(id int) (*http.Response, error) {\n\tapiError := new(APIError)\n\tresp, err := s.sling.New().Path(\"instances/\").Delete(strconv.Itoa(id)).Receive(nil, apiError)\n\treturn resp, relevantError(err, *apiError)\n}", "title": "" }, { "docid": "d9c9cc06d9d0fc452ad808b2e2b48622", "score": "0.58943677", "text": "func (client *Client) DeleteApplication(sid string) error {\n\tu, err := url.Parse(client.applicationBaeURL)\n\tif err != nil {\n\t\treturn err\n\t}\n\tu.Path = path.Join(u.Path, \"Accounts\", client.accountSid, \"Applications\", sid+\".json\")\n\treturn client.deleteRequest(u.String())\n}", "title": "" }, { "docid": "54c032e6b9ae7b396e279718e4df922b", "score": "0.58926797", "text": "func (a *ApplicationAPI) Delete(ctx context.Context, req *pb.DeleteApplicationRequest) (*pb.DeleteApplicationResponse, error) {\n\tvar eui lorawan.EUI64\n\tif err := eui.UnmarshalText([]byte(req.AppEUI)); err != nil {\n\t\treturn nil, grpc.Errorf(codes.InvalidArgument, err.Error())\n\t}\n\n\tif err := a.validator.Validate(ctx,\n\t\tauth.ValidateAPIMethod(\"Application.Delete\"),\n\t\tauth.ValidateApplication(eui),\n\t); err != nil {\n\t\treturn nil, grpc.Errorf(codes.Unauthenticated, \"authentication failed: %s\", err)\n\t}\n\n\tif err := storage.DeleteApplication(a.ctx.DB, eui); err != nil {\n\t\treturn nil, grpc.Errorf(codes.Unknown, err.Error())\n\t}\n\n\treturn &pb.DeleteApplicationResponse{}, nil\n}", "title": "" }, { "docid": "1bed6149f2a24d0817ee7b94178f2091", "score": "0.58879876", "text": "func DeleteInstance(conn *ec2.EC2, instance Instance) (Instance, error) {\n\tparams := &ec2.TerminateInstancesInput{\n\t\tInstanceIds: aws.StringSlice([]string{instance.InstanceID}),\n\t}\n\n\t_, err := conn.TerminateInstances(params)\n\tif err != nil {\n\t\treturn instance, err\n\t}\n\n\tinstance.Created = false\n\treturn instance, nil\n}", "title": "" }, { "docid": "4ace385d3ccbf38927e1f7faff06f4d5", "score": "0.588148", "text": "func (h *Heroku) DestroyApp(appName string) error {\n\turl := h.ApiHref + \"/apps/\" + appName\n\te := new(interface{})\n\trr := restclient.RequestResponse{\n\t\tUrl: url,\n\t\tMethod: \"DELETE\",\n\t\tUserinfo: h.userinfo(),\n\t\tError: e,\n\t}\n\tstatus, err := h.rc.Do(&rr)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif status != 200 {\n\t\tlog.Println(status)\n\t\tlog.Println(*e)\n\t\treturn BadResponse\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fdd27333f8c869def7d41ba1ee395a96", "score": "0.586128", "text": "func (service *AppInstallationsService) Delete(spaceID, appInstallationID string) error {\n\tpath := fmt.Sprintf(\"/spaces/%s/environments/%s/app_installations/%s\", spaceID, service.c.Environment, appInstallationID)\n\tmethod := \"DELETE\"\n\n\treq, err := service.c.newRequest(method, path, nil, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn service.c.do(req, nil)\n}", "title": "" }, { "docid": "818c2cfb62ba0758536b45b1dba9b03d", "score": "0.5811344", "text": "func (r *Server) delApp(appId string, tasks []*types.Task, versions []*types.Version) error {\n\tvar (\n\t\tcount = len(tasks)\n\t\tsucceed = int64(0)\n\t\twg sync.WaitGroup\n\t)\n\n\t// remove runtime tasks & db tasks firstly\n\tfor _, task := range tasks {\n\t\twg.Add(1)\n\t\tgo func(appId string, task *types.Task) {\n\t\t\tdefer wg.Done()\n\n\t\t\tif err := r.driver.SendEvent(appId, task); err != nil {\n\t\t\t\tlog.Errorf(\"Sending event got error: %v\", err)\n\t\t\t}\n\n\t\t\tif err := r.delTask(appId, task); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tatomic.AddInt64(&succeed, 1)\n\t\t}(appId, task)\n\t}\n\twg.Wait()\n\n\tif int(succeed) != count {\n\t\treturn fmt.Errorf(\"%d tasks kill / removed failed\", count-int(succeed))\n\t}\n\n\t// remove db versions\n\tfor _, version := range versions {\n\t\tif err := r.db.DeleteVersion(appId, version.ID); err != nil {\n\t\t\treturn fmt.Errorf(\"Delete version %s for app %s got error: %v\", version.ID, appId, err)\n\t\t}\n\t}\n\n\t// remove db app\n\tif err := r.db.DeleteApp(appId); err != nil {\n\t\treturn fmt.Errorf(\"Delete app %s got error: %v\", appId, err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "710566b609694a21dd404a8e3884c558", "score": "0.58086884", "text": "func DeleteServiceInstance(db *sql.DB, params url.Values) (data []byte, err error) {\r\n\tvar (\r\n\t\tresult sql.Result\r\n\t\tresponse = SQLResponse{}\r\n\t\ttx *sql.Tx\r\n\t\tname string\r\n\t\tserviceName string\r\n\t\torganizationName string\r\n\t)\r\n\r\n\tif tx, err = db.Begin(); err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\tif name, err = common.GetRequiredParam(params, \"name\"); err != nil {\r\n\t\treturn\r\n\t}\r\n\tif serviceName, err = common.GetRequiredParam(params, \"serviceName\"); err != nil {\r\n\t\treturn\r\n\t}\r\n\tif organizationName, err = common.GetRequiredParam(params, \"organizationName\"); err != nil {\r\n\t\treturn\r\n\t}\r\n\tif result, err = tx.Exec(\"DELETE FROM ServiceInstance WHERE name=? AND serviceName=? AND organizationName=?;\",\r\n\t\tname, serviceName, organizationName); err != nil {\r\n\t\ttx.Rollback()\r\n\t\treturn\r\n\t}\r\n\tif err = tx.Commit(); err != nil {\r\n\t\treturn\r\n\t}\r\n\tif response.AffectedRows, err = result.RowsAffected(); err != nil {\r\n\t\treturn\r\n\t}\r\n\tdata, err = json.Marshal(response)\r\n\treturn\r\n}", "title": "" }, { "docid": "923eae1c3766af2213a598b416b36562", "score": "0.5802533", "text": "func ApplicationDelete(w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r)\n\n\t// convert vars to something compatible with render_template\n\tm := make(map[string]interface{})\n\tfor k, v := range vars {\n\t\tm[k] = v\n\t}\n\tactionsOutput, err := services.RunActions(\"/v1/delete\", m)\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\toutputJSON, _ := json.MarshalIndent(actionsOutput, \"\", \" \")\n\tw.Write(outputJSON)\n\n\tif err != nil {\n\t\tw.Write([]byte(err.Error()))\n\t}\n\n\tcommon.LogInfo.Println(actionsOutput)\n}", "title": "" }, { "docid": "09d56536373fe145dcb63be368516afa", "score": "0.5791982", "text": "func (a *AppInfo) Delete(ctx AppContext) error {\n\treturn ctx.Db.Delete(a).Error\n}", "title": "" }, { "docid": "88e46826b3bb27f6350faadee1883d9e", "score": "0.5719827", "text": "func DeleteApplication(ctx *context.Context) {\n\tif err := auth_model.DeleteAccessTokenByID(ctx.FormInt64(\"id\"), ctx.Doer.ID); err != nil {\n\t\tctx.Flash.Error(\"DeleteAccessTokenByID: \" + err.Error())\n\t} else {\n\t\tctx.Flash.Success(ctx.Tr(\"settings.delete_token_success\"))\n\t}\n\n\tctx.JSONRedirect(setting.AppSubURL + \"/user/settings/applications\")\n}", "title": "" }, { "docid": "fddfacab4eca53b2969ba70d05896487", "score": "0.5712665", "text": "func (this *AppManager) DelApp(regId string) {\n\tthis.lock.Lock()\n\t_, ok := this.regappMap[regId]\n\tif ok {\n\t\tdelete(this.regappMap, regId)\n\t}\n\tthis.lock.Unlock()\n}", "title": "" }, { "docid": "a7e653b099a1b858b79310d6e4b4a265", "score": "0.5701998", "text": "func DeleteInstance(cloud Cloud, instance *cloudinstances.CloudInstance) error {\n\tklog.V(2).Infof(\"Detaching instance %q from instance group: %q\",\n\t\tinstance.ID, instance.CloudInstanceGroup.HumanName)\n\n\tgroup := instance.CloudInstanceGroup\n\tswitch obj := group.Raw.(type) {\n\tcase InstanceGroup:\n\t\t{\n\t\t\tvar svc InstanceGroupService\n\t\t\tswitch obj.Type() {\n\t\t\tcase InstanceGroupElastigroup:\n\t\t\t\tsvc = cloud.Elastigroup()\n\t\t\tcase InstanceGroupOcean:\n\t\t\t\tsvc = cloud.Ocean()\n\t\t\t}\n\n\t\t\treturn svc.Detach(context.Background(), obj.Id(), []string{instance.ID})\n\t\t}\n\tcase LaunchSpec:\n\t\t{\n\t\t\treturn cloud.Ocean().Detach(context.Background(), obj.OceanId(), []string{instance.ID})\n\t\t}\n\t}\n\n\treturn fmt.Errorf(\"spotinst: unexpected instance group type, got: %T\", group.Raw)\n}", "title": "" }, { "docid": "e01339268043ac3f3dcac75ed885df60", "score": "0.5671096", "text": "func (a *AuthenticatedUsers) DeleteAuthenticatedApp(app App) {\n\ta.lock.Lock()\n\tdelete(a.apps, app.AccessToken)\n\ta.lock.Unlock()\n}", "title": "" }, { "docid": "bfc46bfa7085f15e4350791c9e91656b", "score": "0.5661574", "text": "func (iac *InstanceAdminClient) DeleteInstance(ctx context.Context, instanceID string) error {\n\tctx = mergeOutgoingMetadata(ctx, iac.md)\n\treq := &btapb.DeleteInstanceRequest{Name: \"projects/\" + iac.project + \"/instances/\" + instanceID}\n\t_, err := iac.iClient.DeleteInstance(ctx, req)\n\treturn err\n}", "title": "" }, { "docid": "91ccfdb4a2eb919b8a1b59f627f056a0", "score": "0.5639805", "text": "func DeleteApplication(name string) error {\n\tgetApplicationResp, err := GetApplicationByName(name)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"find application failed with error: %v\", err)\n\t}\n\tif len(getApplicationResp) == 0 {\n\t\tfmt.Println(\"application does not exist\")\n\t\treturn nil\n\t}\n\tif len(getApplicationResp) > 1 {\n\t\treturn errors.New(\"multiple applications with same unique id exist\")\n\t}\n\n\treturn HTTPClient(http.MethodDelete, fmt.Sprintf(DeleteApplicationURI, getApplicationResp[0].ID), nil, nil)\n}", "title": "" }, { "docid": "fc8144c4a5089f973aa0d568ba02856e", "score": "0.56151664", "text": "func (c *Client) DeleteOAuthApp(id string) (*Result, *AppError) {\n\tdata := make(map[string]string)\n\tdata[\"id\"] = id\n\tif r, err := c.DoApiPost(\"/oauth/delete\", MapToJson(data)); err != nil {\n\t\treturn nil, err\n\t} else {\n\t\tdefer closeBody(r)\n\t\treturn &Result{r.Header.Get(HEADER_REQUEST_ID),\n\t\t\tr.Header.Get(HEADER_ETAG_SERVER), MapFromJson(r.Body)}, nil\n\t}\n}", "title": "" }, { "docid": "d4c74eda89c8efaa75b453425c49d091", "score": "0.5612512", "text": "func (c *Client) DeleteApplication(eui string) error {\n\treturn c.delete(\"/applications/\" + eui)\n}", "title": "" }, { "docid": "f87871b6258af91242eff41c13d6a141", "score": "0.558638", "text": "func ReleaseAppInstance(s *single.Single) (err error) {\n\tif s == nil {\n\t\treturn errors.New(\"an application instance (single.Single) was not specified\")\n\t}\n\n\t// Try to unlock the application instance\n\terr = s.TryUnlock()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"an error occurred attempting to release the application instance lock\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ab51d64d38ed6f14602c75c485be6fae", "score": "0.5580493", "text": "func (c *GuestbookController) Delete(ctx *app.DeleteGuestbookContext) error {\n\t// GuestbookController_Delete: start_implement\n\n\terr := c.appService.Delete(ctx.ID)\n\tif err != nil {\n\t\tif err.Error() == \"Data not found\" {\n\t\t\treturn ctx.NotFound()\n\t\t}\n\t\treturn ctx.BadRequest(&app.GuestbookError{\n\t\t\tCode: \"\",\n\t\t\tMsg: \"Can't delete an entry: \" + err.Error(),\n\t\t})\n\t}\n\n\treturn ctx.NoContent()\n\t// GuestbookController_Delete: end_implement\n}", "title": "" }, { "docid": "4dae74af4b2a8a9031c7c19aafaa0262", "score": "0.5575857", "text": "func (c *ApplicationPolicyServiceClient) Delete(\n\tctx context.Context,\n\tappID string,\n) error {\n\tif err := c.Set(ctx, appID, nil); err != nil {\n\t\treturn errors.Wrap(err, \"error deleting application policy\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9190f70a39ad16a9eab78fcaecbf3a35", "score": "0.55743915", "text": "func DeleteApplication(id string) (bool, error) {\n\n\terr := r.Table(\"applications\").Get(id).Delete().Exec(Session)\n\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\treturn true, err\n\n}", "title": "" }, { "docid": "4a5588d4dbcfb44ac81b1b3e89168521", "score": "0.5568864", "text": "func (ss *StackSet) DeleteInstance(name, account, region string) (string, error) {\n\tout, err := ss.client.DeleteStackInstances(&cloudformation.DeleteStackInstancesInput{\n\t\tStackSetName: aws.String(name),\n\t\tAccounts: aws.StringSlice([]string{account}),\n\t\tRegions: aws.StringSlice([]string{region}),\n\t\tRetainStacks: aws.Bool(false),\n\t})\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"delete stack instance in region %v for account %v for stackset %s: %w\",\n\t\t\tregion, account, name, err)\n\t}\n\treturn aws.StringValue(out.OperationId), nil\n}", "title": "" }, { "docid": "f54afab9d9ae828978efb630cb7b0236", "score": "0.55564326", "text": "func (r *Applications) DeleteApp(req appservice.DeleteRequest) error {\n\tif err := r.canDelete(req.Package); err != nil {\n\t\tif !req.Force {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\tr.config.Warnf(\"Force deleting app %v: %v.\", req.Package, err)\n\t}\n\tif r.config.Charts != nil {\n\t\tif err := r.config.Charts.RemoveFromIndex(req.Package); err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t}\n\tif err := r.deleteResourcesPackage(req.Package); err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\tif err := r.config.Packages.DeletePackage(req.Package); err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8b6629c73ec551250814c6700b079c58", "score": "0.5551316", "text": "func (manager *Manager) delete(application *model.Application) []error {\n\tlog.Printf(\"Call to delete with app: %s (%s)\\n\", application.ID, application.Name)\n\n\tstartTime := time.Now()\n\n\tdeploymentsClient := manager.clientset.AppsV1().Deployments(apiv1.NamespaceDefault)\n\tserviceClient := manager.clientset.CoreV1().Services(apiv1.NamespaceDefault)\n\n\terrors := make([]error, 0)\n\n\tfor _, s := range application.Services {\n\t\tdeploymentName := fmt.Sprintf(\"%s-%s\", application.ID, s.Id)\n\t\tdeletePolicy := metav1.DeletePropagationForeground\n\n\t\tlog.Printf(\"Deleting Deployment %s (%s)...\\n\", s.Id, deploymentName)\n\n\t\terr := deploymentsClient.Delete(deploymentName, &metav1.DeleteOptions{\n\t\t\tPropagationPolicy: &deletePolicy,\n\t\t})\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Cannot delete Deployment %s: %s\\n\", deploymentName, err)\n\t\t\terrors = append(errors, err)\n\t\t} else {\n\t\t\tlog.Printf(\"Deployment %s deleted.\\n\", s.Id)\n\t\t}\n\n\t\tfor _, image := range s.Images {\n\t\t\tfor _, port := range image.Ports {\n\t\t\t\tif port.Expose > 0 {\n\t\t\t\t\t// Remove the associated service\n\t\t\t\t\tserviceName := port.Name\n\n\t\t\t\t\tlog.Printf(\"Deleting Service %s...\\n\", serviceName)\n\n\t\t\t\t\tif err := serviceClient.Delete(serviceName, &metav1.DeleteOptions{\n\t\t\t\t\t\tPropagationPolicy: &deletePolicy,\n\t\t\t\t\t}); err != nil {\n\t\t\t\t\t\tlog.Printf(\"Cannot delete Service %s: %s\\n\", serviceName, err)\n\t\t\t\t\t\terrors = append(errors, err)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlog.Printf(\"Service %s deleted.\\n\", serviceName)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\telapsed := time.Since(startTime)\n\tlog.Printf(\"Remove took %v\\n\", elapsed)\n\n\tif len(errors) > 0 {\n\t\treturn errors\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "887cb8d94e280ff116c0db15064ef28c", "score": "0.5537757", "text": "func (Query) Delete(tx *gorm.DB, id string) error {\n\treturn mysql.Delete(tx, &Instance{}, \"instance_id = ?\", id)\n}", "title": "" }, { "docid": "2670dbd0b16175a22bad2dd6223eec7e", "score": "0.5535941", "text": "func DeleteAppByUIDPermanently(uid string, db *gorm.DB) error {\n\tapp, err := FindAppByUID(uid, db)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn deleteApp(app, false, db)\n}", "title": "" }, { "docid": "02a640dbc5518c4d58e6ad3c10dcf2a7", "score": "0.55343217", "text": "func deleteApplicant(w http.ResponseWriter, r *http.Request) {\n\tif err := parseSubmission(w, r); err != nil {\n\t\thttp.Error(w, \"Request parse error: \" + err.Error(), http.StatusInternalServerError)\n\t\tlog.Printf(\"error %v, status %v\\n\", \"Request parse error: \" + err.Error(),\n\t\t\thttp.StatusInternalServerError)\n\t\treturn\n\t}\n\taction := html.EscapeString(r.PostFormValue(\"action\"))\n\tappsession, err := applicantFromSession(action, r)\n\tif err != nil {\n\t\thttp.Error(w, \"Session store error: \" + err.Error(), http.StatusInternalServerError)\n\t\tlog.Printf(\"action %s, error %v, status %v\\n\", action, \"Session store error: \" + err.Error(),\n\t\t\thttp.StatusInternalServerError)\n\t\treturn\n\t}\n\t// copy old applicant from session\n\tapp := appsession\n\tdata := app.Data\n\tif app.ID != 0 && app.Data.ID != 0 {\n\t\tuser, err := getUserFromSession(r)\n\t\tif err == nil {\n\t\t\tdata.Model.DeletedBy = fmt.Sprintf(\"%s(%s)\",user.Fullname, user.Login)\n\t\t\tdata.Model.Deleter = user.ID\n\t\t} else {\n\t\t\tapp.Data.Model.UpdatedBy = \"self\"\n\t\t}\n\t\tmodel.Db().Save(&data)\n\t\tmodel.Db().Delete(&app)\n\t\tmodel.Db().Delete(&data)\n\t}\n\tw.WriteHeader(http.StatusNoContent)\n}", "title": "" }, { "docid": "ca438cdefd95be6149eaa6383be6a31e", "score": "0.5531139", "text": "func (s *API) DeleteApplication(req *DeleteApplicationRequest, opts ...scw.RequestOption) error {\n\tvar err error\n\n\tif fmt.Sprint(req.ApplicationID) == \"\" {\n\t\treturn errors.New(\"field ApplicationID cannot be empty in request\")\n\t}\n\n\tscwReq := &scw.ScalewayRequest{\n\t\tMethod: \"DELETE\",\n\t\tPath: \"/iam/v1alpha1/applications/\" + fmt.Sprint(req.ApplicationID) + \"\",\n\t\tHeaders: http.Header{},\n\t}\n\n\terr = s.client.Do(scwReq, nil, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "be99ed790afb82fed19180b6d6592341", "score": "0.55310434", "text": "func deleteApps(apiClient *rancher.MasterClient, appInstances []*common.AppInstanceData, catalogId, appName,\n\trepoPath string, purge bool) ([]*appmanager.AppInstance, error) {\n\n\t// Wait for the group of subroutines\n\tvar wg sync.WaitGroup\n\tvar errors []error\n\tvar doneList []*appmanager.AppInstance\n\n\t// iterate over the list of temporary data\n\tfor _, instance := range appInstances {\n\t\tif instance.NextAction != common.AppInstanceDataNextActionNone {\n\t\t\t// create a separate subroutine for a particular action\n\t\t\twg.Add(1)\n\t\t\tgo func(instance *common.AppInstanceData) {\n\t\t\t\tdefer wg.Done()\n\n\t\t\t\tswitch instance.NextAction {\n\t\t\t\tcase common.AppInstanceDataNextActionDelete:\n\t\t\t\t\tinstance.DeleteInstanceStorage = true\n\t\t\t\t\tif err := apiclient.DeleteAppInstance(apiClient, instance, instance.CurrentVersion); err != nil {\n\t\t\t\t\t\terrors = append(errors, err)\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// If need to remove metadata\n\t\t\t\t\t\tif purge {\n\t\t\t\t\t\t\t// Set path to the application root directory\n\t\t\t\t\t\t\troot := filepath.Join(repoPath, appName)\n\t\t\t\t\t\t\t// Set path to the chart\n\t\t\t\t\t\t\tchartPath := filepath.Join(root, instance.InstanceName)\n\t\t\t\t\t\t\tif instance.RequestedVersion != \"\" {\n\t\t\t\t\t\t\t\tchartPath = filepath.Join(chartPath, instance.RequestedVersion)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// Delete the chart\n\t\t\t\t\t\t\tif err := chartutils.DeleteChart(chartPath, instance.InstanceName, instance.RequestedVersion); err != nil {\n\t\t\t\t\t\t\t\terrors = append(errors, err)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// Add to the list\n\t\t\t\t\t\t\tdoneList = append(doneList, generateProtoData(instance, catalogId))\n\t\t\t\t\t\t\tif len(doneList) == len(appInstances) {\n\t\t\t\t\t\t\t\t_ = os.RemoveAll(root)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tdoneList = append(doneList, generateProtoData(instance, \"\"))\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}(instance)\n\n\t\t\ttime.Sleep(time.Second * 1)\n\t\t}\n\t}\n\n\twg.Wait()\n\n\tif len(errors) > 0 {\n\t\treturn nil, errors[0]\n\t}\n\n\treturn doneList, nil\n}", "title": "" }, { "docid": "6ff939e3d100a839fafeb16f652f021e", "score": "0.5523928", "text": "func DeleteApplication(ctx context.Context, db sqlx.Ext, id int64) error {\n\terr := DeleteAllDevicesForApplicationID(ctx, db, id)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"delete all nodes error\")\n\t}\n\n\tres, err := db.Exec(\"delete from application where id = $1\", id)\n\tif err != nil {\n\t\treturn handlePSQLError(Delete, err, \"delete error\")\n\t}\n\tra, err := res.RowsAffected()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"get rows affected error\")\n\t}\n\tif ra == 0 {\n\t\treturn ErrDoesNotExist\n\t}\n\n\tlog.WithFields(log.Fields{\n\t\t\"id\": id,\n\t\t\"ctx_id\": ctx.Value(logging.ContextIDKey),\n\t}).Info(\"application deleted\")\n\n\treturn nil\n}", "title": "" }, { "docid": "216a5a7a188e4a0a6bee6b275ee6d2f3", "score": "0.5516711", "text": "func Delete(c *client.Client, appID string, domain string) error {\n\tu := fmt.Sprintf(\"/v1/apps/%s/domains/%s\", appID, domain)\n\t_, err := c.BasicRequest(\"DELETE\", u, nil)\n\treturn err\n}", "title": "" }, { "docid": "a6f664fb3780803d797294b5d41b4277", "score": "0.550164", "text": "func (app *identity) Delete() error {\n\tins, err := app.Retrieve()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn app.identityService.Delete(ins, app.password)\n}", "title": "" }, { "docid": "feb15806d0db5dfcb0acd829ac7ea468", "score": "0.5501277", "text": "func (r *TeamsAppDefinitionRequest) Delete(ctx context.Context) error {\n\treturn r.JSONRequest(ctx, \"DELETE\", \"\", nil, nil)\n}", "title": "" }, { "docid": "e25275d92867625b880576eb90a452a2", "score": "0.54785854", "text": "func (k Keeper) deleteUnstakingApplication(ctx sdk.Context, val types.Application) {\n\tapplications := k.getUnstakingApplications(ctx, val.UnstakingCompletionTime)\n\tvar newApplications []sdk.Address\n\tfor _, addr := range applications {\n\t\tif !bytes.Equal(addr, val.Address) {\n\t\t\tnewApplications = append(newApplications, addr)\n\t\t}\n\t}\n\tif len(newApplications) == 0 {\n\t\tk.deleteUnstakingApplications(ctx, val.UnstakingCompletionTime)\n\t} else {\n\t\tk.setUnstakingApplications(ctx, val.UnstakingCompletionTime, newApplications)\n\t}\n}", "title": "" }, { "docid": "bfd5cf0ac47090afcc8d6c7aec719726", "score": "0.54677546", "text": "func deleteOSBAApp(ctx context.Context) (err error) {\n\t// the OSBA clusterservicebroker is not namespaced, remove it\n\tsanity.Checker.Log.Debugf(\"deleting azure cluster service broker\")\n\terr = sanity.Checker.Client.CustomerAdmin.ServicecatalogV1beta1.ClusterServiceBrokers().Delete(\"osba\", &metav1.DeleteOptions{})\n\tif err != nil {\n\t\tsanity.Checker.Log.Error(err)\n\t\treturn\n\t}\n\n\tsanity.Checker.Log.Debugf(\"deleting openshift project for broker apps\")\n\terr = sanity.Checker.Client.CustomerAdmin.CleanupProject(\"osba\")\n\tif err != nil {\n\t\tsanity.Checker.Log.Error(err)\n\t}\n\treturn\n}", "title": "" }, { "docid": "6cde44cfe28a5d7ec19c71d59cdaadd3", "score": "0.5466086", "text": "func deleteDB(db gorp.SqlExecutor, g *sdk.Group) error {\n\treturn sdk.WrapError(gorpmapping.Delete(db, g), \"unable to delete group %s\", g.Name)\n}", "title": "" }, { "docid": "5fe76f1b2ed464f7608eee6da936aa07", "score": "0.5463995", "text": "func DeleteApplication(serviceID string, appID string) error {\n\turl := InternalURL + \"/services/\" + serviceID + \"/applications/\" + appID\n\tres, err := executeHTTPRequest(http.MethodDelete, url, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif res.StatusCode != 200 {\n\t\treturn fmt.Errorf(\"Failed to delete the application(service_id: %s, app_id: %s)\", serviceID, appID)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bf602fc59575a0a387e5b666cd46ee33", "score": "0.5463876", "text": "func (s *InstanceServer) DeleteDatafusionAlphaInstance(ctx context.Context, request *alphapb.DeleteDatafusionAlphaInstanceRequest) (*emptypb.Empty, error) {\n\n\tcl, err := createConfigInstance(ctx, request.GetServiceAccountFile())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &emptypb.Empty{}, cl.DeleteInstance(ctx, ProtoToInstance(request.GetResource()))\n\n}", "title": "" }, { "docid": "664a16c30ffc46dbd1a84c2fb2e218c1", "score": "0.54629654", "text": "func (sess *EstablishedSession) DeleteInstance(d *DeleteComputeInput) (*ec2.TerminateInstancesOutput, error) {\n\n\tif sess.Ec2 != nil {\n\t\tif d.InstanceIds != nil {\n\t\t\tterminateInstanceInput := &ec2.TerminateInstancesInput{\n\t\t\t\tInstanceIds: aws.StringSlice(d.InstanceIds),\n\t\t\t}\n\t\t\t_, err := (sess.Ec2).TerminateInstances(terminateInstanceInput)\n\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn nil, nil\n\t\t}\n\t\treturn nil, fmt.Errorf(\"You provided empty struct to DeleteInstance, this is not acceptable\")\n\t}\n\treturn nil, fmt.Errorf(\"Did not get session to perform action, cannot proceed further\")\n}", "title": "" }, { "docid": "c582787cdc6cde7ea36f3f994b81f4e5", "score": "0.54462016", "text": "func (r *ApplicationRequest) Delete(ctx context.Context) error {\n\treturn r.JSONRequest(ctx, \"DELETE\", \"\", nil, nil)\n}", "title": "" }, { "docid": "a06f5989c96559899c74dad4785f4f44", "score": "0.54320633", "text": "func (app *App) Destroy() {\n\tmodel.Clean()\n}", "title": "" }, { "docid": "7d5c92f6e545b83b95208789e7389864", "score": "0.5421308", "text": "func (client ApplicationClient) deleteApplication(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {\n\thttpRequest, err := request.HTTPRequest(http.MethodDelete, \"/applications/{applicationId}\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar response DeleteApplicationResponse\n\tvar httpResponse *http.Response\n\thttpResponse, err = client.Call(ctx, &httpRequest)\n\tdefer common.CloseBodyIfValid(httpResponse)\n\tresponse.RawResponse = httpResponse\n\tif err != nil {\n\t\treturn response, err\n\t}\n\n\terr = common.UnmarshalResponse(httpResponse, &response)\n\treturn response, err\n}", "title": "" }, { "docid": "d0da7c1b9ef1eee11f00bc47a7ae6d9b", "score": "0.5417477", "text": "func (c *ecsClient) DeleteInstances(id string, force bool) error {\n\trequest := ecs.CreateDeleteInstanceRequest()\n\trequest.SetScheme(\"HTTPS\")\n\trequest.InstanceId = id\n\trequest.Force = requests.NewBoolean(force)\n\t_, err := c.DeleteInstance(request)\n\treturn err\n}", "title": "" }, { "docid": "7c74676b37a0bbe8360312c29a47efe2", "score": "0.54167163", "text": "func (af *AppointmentForm) Delete(db XODB) error {\n\tvar err error\n\n\t// if doesn't exist, bail\n\tif !af._exists {\n\t\treturn nil\n\t}\n\n\t// if deleted, bail\n\tif af._deleted {\n\t\treturn nil\n\t}\n\n\t// sql query\n\tconst sqlstr = `DELETE FROM public.appointment_form WHERE id = $1`\n\n\t// run query\n\tXOLog(sqlstr, af.ID)\n\t_, err = db.Exec(sqlstr, af.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// set deleted\n\taf._deleted = true\n\n\treturn nil\n}", "title": "" }, { "docid": "61179c724f9c3fe22b10cbe0cc5ea3aa", "score": "0.54164124", "text": "func (iaw *InstancesAPIWrapper) RemoveInstance(project, zone, name string) error {\n\n\t_, err := iaw.Service.Delete(project, zone, name).Context(iaw.Context).Do()\n\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d26b28609b1656404c324dd7747fa987", "score": "0.5412653", "text": "func SettingsDeleteApplication(ctx *context.Context) {\n\tif err := models.DeleteAccessTokenByID(ctx.QueryInt64(\"id\")); err != nil {\n\t\tctx.Flash.Error(\"DeleteAccessTokenByID: \" + err.Error())\n\t} else {\n\t\tctx.Flash.Success(ctx.Tr(\"settings.delete_token_success\"))\n\t}\n\n\tctx.JSON(200, map[string]interface{}{\n\t\t\"redirect\": setting.AppSubURL + \"/user/settings/applications\",\n\t})\n}", "title": "" }, { "docid": "85ef48e72ed24fd2f3e95b7123bec498", "score": "0.53575623", "text": "func DeleteDB(ctx context.Context, serverName, dbName string) (autorest.Response, error) {\n\tdbClient := getDbClient()\n\treturn dbClient.Delete(\n\t\tctx,\n\t\tconfig.GroupName(),\n\t\tserverName,\n\t\tdbName,\n\t)\n}", "title": "" }, { "docid": "222ef1efcf587751472a099ff184e2b1", "score": "0.53512114", "text": "func (r *marathonClient) DeletePodInstance(name, instance string) (*PodInstance, error) {\n\turi := fmt.Sprintf(\"%s/%s\", buildPodInstancesURI(name), instance)\n\tresult := new(PodInstance)\n\tif err := r.apiDelete(uri, nil, result); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn result, nil\n}", "title": "" }, { "docid": "69908e3662c7756f7ecaf44bd9d344c4", "score": "0.53411764", "text": "func ApplicationDelete(accountID, appID int) (r ApplicationDeleteResponse, err error) {\n\tu := BaseURL()\n\tu.Path += fmt.Sprintf(\"/account/%d/application/%d\", accountID, appID)\n\n\tctx, cancel := context.WithTimeout(context.Background(), Timeout)\n\tdefer cancel()\n\n\tresp, err := request(ctx, http.MethodDelete, u, nil)\n\tif err != nil {\n\t\treturn r, fmt.Errorf(\"unable to perform request: %w\", err)\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != http.StatusNoContent {\n\t\tbody, err := ioutil.ReadAll(resp.Body)\n\t\tif err != nil {\n\t\t\treturn r, fmt.Errorf(\"unable to read response body: %w\", err)\n\t\t}\n\n\t\terr = json.Unmarshal(body, &r)\n\t\tif err != nil {\n\t\t\treturn r, fmt.Errorf(\"unable to unmarshal JSON: %w\", err)\n\t\t}\n\n\t\tswitch resp.StatusCode {\n\t\tcase http.StatusBadRequest:\n\t\t\treturn r, fmt.Errorf(\"%s: %w\", r.Message, ErrStatusBadRequest)\n\t\tcase http.StatusUnauthorized:\n\t\t\treturn r, ErrStatusUnauthorized\n\t\tcase http.StatusForbidden:\n\t\t\treturn r, ErrStatusForbidden\n\t\tcase http.StatusNotFound:\n\t\t\treturn r, ErrStatusNotFound\n\t\tcase http.StatusInternalServerError:\n\t\t\treturn r, fmt.Errorf(\"error occurred during deletion: %s: %w\", r.Message, ErrStatusInternalServerError)\n\t\tdefault:\n\t\t\treturn r, prettyTxIDError(resp)\n\t\t}\n\t}\n\n\treturn r, err\n}", "title": "" }, { "docid": "cadeb5e3af9e0db33946fc126b3339d7", "score": "0.53329694", "text": "func (g *GCP) ComputeInstanceDelete(zone, instance string) error {\n\tctx := context.Background()\n\n\tcomputeService, err := compute.NewService(ctx, option.WithCredentials(g.creds))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to get Compute Engine client: %v\", err)\n\t}\n\n\t_, err = computeService.Instances.Delete(g.creds.ProjectID, zone, instance).Context(ctx).Do()\n\n\treturn err\n}", "title": "" }, { "docid": "59ce5bf2b0abf3155c497e2316a35697", "score": "0.5331943", "text": "func (c *Client) DeleteApp(ctx context.Context, params *DeleteAppInput, optFns ...func(*Options)) (*DeleteAppOutput, error) {\n\tif params == nil {\n\t\tparams = &DeleteAppInput{}\n\t}\n\n\tresult, metadata, err := c.invokeOperation(ctx, \"DeleteApp\", params, optFns, addOperationDeleteAppMiddlewares)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tout := result.(*DeleteAppOutput)\n\tout.ResultMetadata = metadata\n\treturn out, nil\n}", "title": "" }, { "docid": "d561e94a9eecc6b8cba065ab53d752e3", "score": "0.53242177", "text": "func Delete(ctx context.Context, uid int, db *sql.DB) error {\n\tdlock.Lock().Lock()\n\tdefer dlock.Lock().Unlock()\n\n\ttx, err := db.Begin()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = tx.Exec(`\n\t\tDELETE FROM\n\t\t\tcompute_instances\n\t\tWHERE rowid = ?;\n\t`, uid)\n\tif err != nil {\n\t\ttx.Rollback()\n\t\treturn err\n\t}\n\treturn tx.Commit()\n}", "title": "" }, { "docid": "0bef3c494f6c8389c44489207b91093e", "score": "0.5309925", "text": "func DeleteRecycledInstance(cli bce.Client, instanceId string) error {\n\t// Build the request\n\treq := &bce.BceRequest{}\n\treq.SetUri(getDeleteRecycledInstanceUri(instanceId))\n\treq.SetMethod(http.DELETE)\n\n\t// Send request and get response\n\tresp := &bce.BceResponse{}\n\tif err := cli.SendRequest(req, resp); err != nil {\n\t\treturn err\n\t}\n\tif resp.IsFail() {\n\t\treturn resp.ServiceError()\n\t}\n\n\tdefer func() { resp.Body().Close() }()\n\treturn nil\n}", "title": "" }, { "docid": "0eb4563d470c148a2854737183ef0867", "score": "0.53042483", "text": "func (c *NotebookClient) DeleteInstance(ctx context.Context, req *notebookspb.DeleteInstanceRequest, opts ...gax.CallOption) (*DeleteInstanceOperation, error) {\n\tmd := metadata.Pairs(\"x-goog-request-params\", fmt.Sprintf(\"%s=%v\", \"name\", url.QueryEscape(req.GetName())))\n\tctx = insertMetadata(ctx, c.xGoogMetadata, md)\n\topts = append(c.CallOptions.DeleteInstance[0:len(c.CallOptions.DeleteInstance):len(c.CallOptions.DeleteInstance)], opts...)\n\tvar resp *longrunningpb.Operation\n\terr := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {\n\t\tvar err error\n\t\tresp, err = c.notebookClient.DeleteInstance(ctx, req, settings.GRPC...)\n\t\treturn err\n\t}, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &DeleteInstanceOperation{\n\t\tlro: longrunning.InternalNewOperation(c.LROClient, resp),\n\t}, nil\n}", "title": "" }, { "docid": "9b1ef2445e7abab4a283602628c9c7fd", "score": "0.52965766", "text": "func (o *AppInventory) Delete(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no AppInventory provided for delete\")\n\t}\n\n\tif err := o.doBeforeDeleteHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\targs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), appInventoryPrimaryKeyMapping)\n\tsql := \"DELETE FROM `app_inventory` WHERE `id`=?\"\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args...)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to delete from app_inventory\")\n\t}\n\n\tif err := o.doAfterDeleteHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "7177f511b970e3dd9e5e766ae79b94ae", "score": "0.5294495", "text": "func (o *AppInventory) DeleteG() error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no AppInventory provided for deletion\")\n\t}\n\n\treturn o.Delete(boil.GetDB())\n}", "title": "" }, { "docid": "c1817b485302b2d5612f30c34d69f3f2", "score": "0.5285897", "text": "func (manager *Manager) DeleteApplication(application *model.Application) []error {\n\tif !manager.HasApplication(application) {\n\t\treturn []error{fmt.Errorf(\"cannot find application %s\", application.Name)}\n\t}\n\n\terr := manager.delete(application)\n\n\t// Remove app from the deployments list\n\tfor i, dep := range manager.deployments {\n\t\tif dep.Application.ID == application.ID {\n\t\t\tmanager.deployments = append(manager.deployments[:i], manager.deployments[i+1:]...)\n\t\t}\n\t}\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "1487bd2940c1d377ad6a8b7e5c672238", "score": "0.527877", "text": "func mustAppDelete(t testing.TB, c *heroku.Client, appName string) {\n\tif err := c.AppDelete(appName); err != nil {\n\t\tt.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "f246378dcb2135cd813a55ec17f50d0f", "score": "0.5265369", "text": "func DeleteForApplication(db gorp.SqlExecutor, app *sdk.Application) error {\n\tquery := `UPDATE application SET vcs_server = '', repo_fullname = '' WHERE id = $1`\n\tif _, err := db.Exec(query, app.ID); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bdedddcb8253e423d0975f18b8a297a8", "score": "0.52628", "text": "func Delete(key string) {\n\tinstance.Delete(key)\n}", "title": "" }, { "docid": "8dd04d84184197e854b262dee5705ff3", "score": "0.52588385", "text": "func (m *ManifestList) RemoveInstance(d digest.Digest) error {\n\tif err := m.list.Remove(d); err != nil {\n\t\treturn err\n\t}\n\n\t// Write the changes to disk.\n\treturn m.saveAndReload()\n}", "title": "" }, { "docid": "484bd1a7eb5feb0f55357e8b23d26318", "score": "0.52492857", "text": "func AppsDestroyTest(t *testing.T, params *DeisTestConfig) {\n\tfmt.Printf(\"destroying app %s...\\n\", params.ExampleApp)\n\tcmd := \"apps:destroy --app={{.AppName}} --confirm={{.AppName}}\"\n\tif err := Chdir(params.ExampleApp); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tExecute(t, cmd, params, false, \"\")\n\tif err := Chdir(\"..\"); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif err := Rmdir(params.ExampleApp); err != nil {\n\t\tt.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "69be1176b1a205b2908826c6c7d975b1", "score": "0.5244961", "text": "func appRuleDelete(d *schema.ResourceData, m interface{}) error {\n\tid, _ := strconv.Atoi(d.Id())\n\tappID, _ := strconv.Atoi(d.Get(\"app_id\").(string))\n\tclient := m.(*client.APIClient)\n\n\terr := client.Services.AppRulesV2.Destroy(int32(appID), int32(id))\n\tif err != nil {\n\t\tlog.Printf(\"[ERROR] There was a problem deleting the app rule!\")\n\t\tlog.Println(err)\n\t} else {\n\t\tlog.Printf(\"[DELETED] Deleted app rule with %d\", id)\n\t\td.SetId(\"\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9384233db778630301f8e3a9c549e7dc", "score": "0.52417904", "text": "func (c *Client) DeleteAllInstance(ctx context.Context, project, zone string, filter func(*Instance) bool) error {\n\tctx, cancel := context.WithTimeout(ctx, c.Config.Timeout)\n\tdefer cancel()\n\n\tlistObj, err := c.ListInstance(ctx, project, zone)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = c.deleteAllInstance(ctx, filter, listObj.Items)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor listObj.HasNext() {\n\t\terr = listObj.Next(ctx, c)\n\t\tif err != nil {\n\t\t\treturn nil\n\t\t}\n\t\terr = c.deleteAllInstance(ctx, filter, listObj.Items)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ca721fdbebbb41c2677f7955af96c793", "score": "0.5237471", "text": "func (s *InstanceServer) DeleteApigeeBetaInstance(ctx context.Context, request *betapb.DeleteApigeeBetaInstanceRequest) (*emptypb.Empty, error) {\n\n\tcl, err := createConfigInstance(ctx, request.GetServiceAccountFile())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &emptypb.Empty{}, cl.DeleteInstance(ctx, ProtoToInstance(request.GetResource()))\n\n}", "title": "" }, { "docid": "37b942ae9150260d0a817fed0bc8aea1", "score": "0.5224264", "text": "func DeleteOAuth2Application(id, userid int64) error {\n\tctx, committer, err := db.TxContext(db.DefaultContext)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer committer.Close()\n\tapp, err := GetOAuth2ApplicationByID(ctx, id)\n\tif err != nil {\n\t\treturn err\n\t}\n\tbuiltinApps := BuiltinApplications()\n\tif _, builtin := builtinApps[app.ClientID]; builtin {\n\t\treturn fmt.Errorf(\"failed to delete OAuth2 application: application is locked: %s\", app.ClientID)\n\t}\n\tif err := deleteOAuth2Application(ctx, id, userid); err != nil {\n\t\treturn err\n\t}\n\treturn committer.Commit()\n}", "title": "" }, { "docid": "6bf03dced6e258460586cf8a3a328b26", "score": "0.52045137", "text": "func (a *BetaAppLocalizationsApiService) BetaAppLocalizationsDeleteInstance(ctx _context.Context, id string) (*_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)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/v1/betaAppLocalizations/{id}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"id\"+\"}\", _neturl.PathEscape(parameterToString(id, \"\")), -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\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn 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 == 400 {\n\t\t\tvar v ErrorResponse\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 localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v ErrorResponse\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 localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v ErrorResponse\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 localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 409 {\n\t\t\tvar v ErrorResponse\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 localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarHTTPResponse, newErr\n\t\t}\n\t\treturn localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "344e46df9fed5c0c1472d5104cb969f7", "score": "0.5202709", "text": "func DeleteAppByUIDSoft(uid string, db *gorm.DB) error {\n\tapp, err := FindAppByUID(uid, db)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn deleteApp(app, true, db)\n}", "title": "" }, { "docid": "24214ba626c7be5b88cfdc633c6f6871", "score": "0.51981115", "text": "func (c *Controller) RemoveInstance() http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tinstanceRef := entity.InstanceReference(chi.URLParam(r, \"ref\"))\n\n\t\tvar options types.InstanceRemoveOptions\n\n\t\tif err := json.NewDecoder(r.Body).Decode(&options); err != nil {\n\t\t\trespondError(w, r, http.StatusUnprocessableEntity, err)\n\t\t\treturn\n\t\t}\n\n\t\tif err := c.backend.RemoveInstance(instanceRef, options); err != nil {\n\t\t\trespondError(w, r, http.StatusUnprocessableEntity, err)\n\t\t}\n\n\t\trespond(w, r, http.StatusOK, types.Response{Success: true})\n\t}\n}", "title": "" } ]
66a1ae426f19000a536963d6395f49be
/ Parse the production: stream ::= STREAMSTART implicit_document? explicit_document STREAMEND
[ { "docid": "039c09052bcebadebca54b444706b4cc", "score": "0.6082347", "text": "func yaml_parser_parse_stream_start(parser *yaml_parser_t, event *yaml_event_t) bool {\n\ttoken := peek_token(parser)\n\tif token == nil {\n\t\treturn false\n\t}\n\n\tif token.token_type != yaml_STREAM_START_TOKEN {\n\t\treturn yaml_parser_set_parser_error(parser,\n\t\t\t\"did not find expected <stream-start>\", token.start_mark)\n\t}\n\n\tparser.state = yaml_PARSE_IMPLICIT_DOCUMENT_START_STATE\n\t*event = yaml_event_t{\n\t\tevent_type: yaml_STREAM_START_EVENT,\n\t\tstart_mark: token.start_mark,\n\t\tend_mark: token.end_mark,\n\t\tencoding: token.encoding,\n\t}\n\tskip_token(parser)\n\n\treturn true\n}", "title": "" } ]
[ { "docid": "0f1eb3ebabb48abc1e33104f4cf1c3e6", "score": "0.60081744", "text": "func NewStreamParser(in io.Reader, ts dcm.TransferSyntax) Parser {\n\tbasein := positionReader{position: 0, in: in}\n\n\treturn &SimpleParser{\n\t\tbasein: &basein,\n\t\tin: &basein,\n\t\tts: ts,\n\t}\n}", "title": "" }, { "docid": "15a5977e7718da54f16479b8843d89c4", "score": "0.54772526", "text": "func ParseStream(in io.Reader) (*Data, error) {\n\tvar obj interface{}\n\tdecoder := json.NewDecoder(in)\n\tdecoder.UseNumber()\n\tif err := decoder.Decode(&obj); err != nil {\n\t\treturn &Data{}, err\n\t}\n\treturn &Data{obj: obj}, nil\n}", "title": "" }, { "docid": "2f7c00d0770b897038a6d88a522647d1", "score": "0.54761523", "text": "func (r *Resolver) Stream() generated.StreamResolver { return &streamResolver{r} }", "title": "" }, { "docid": "0c50a97039e8d3f24e4ec542b8fa0c77", "score": "0.5429557", "text": "func parse(tokStream chan token) (n AstNode, err error) {\n\tdefer func() {\n\t\tif p := recover(); p != nil {\n\t\t\tif err2, ok := p.(error); ok {\n\t\t\t\terr = NewParseError(err2.Error())\n\t\t\t} else {\n\t\t\t\tpanic(p)\n\t\t\t}\n\t\t}\n\t}()\n\tts := &tokenStream{tokStream, make([]token, 0)}\n\tn = parseStatements(ts, true)\n\treturn\n}", "title": "" }, { "docid": "ff22b2110a02d67f5b063fc32c2a91ca", "score": "0.5425296", "text": "func Parse(r io.Reader) (stream *Stream, err error) {\n\t// Verify FLAC signature and parse the StreamInfo metadata block.\n\tbr := bufio.NewReader(r)\n\tstream = &Stream{r: br}\n\tblock, err := stream.parseStreamInfo()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Parse the remaining metadata blocks.\n\tfor !block.IsLast {\n\t\tblock, err = meta.Parse(br)\n\t\tif err != nil {\n\t\t\tif err != meta.ErrReservedType {\n\t\t\t\treturn stream, err\n\t\t\t}\n\t\t\t// Skip the body of unknown (reserved) metadata blocks, as stated by\n\t\t\t// the specification.\n\t\t\t//\n\t\t\t// ref: https://www.xiph.org/flac/format.html#format_overview\n\t\t\tif err = block.Skip(); err != nil {\n\t\t\t\treturn stream, err\n\t\t\t}\n\t\t}\n\t\tstream.Blocks = append(stream.Blocks, block)\n\t}\n\n\treturn stream, nil\n}", "title": "" }, { "docid": "37f2711ad2775b10c1466a738f4ba444", "score": "0.5410788", "text": "func Stream(w http.ResponseWriter, r *http.Request) {\n\n\tvar path = strings.Replace(r.RequestURI, \"/stream/\", \"\", 1)\n\t//var stream = strings.SplitN(path, \"-\", 2)\n\n\tstreamInfo, err := getStreamInfo(path)\n\tif err != nil {\n\t\tShowError(err, 1203)\n\t\thttpStatusError(w, r, 404)\n\t\treturn\n\t}\n\n\t// If an UDPxy host is set, and the stream URL is multicast (i.e. starts with 'udp://@'),\n\t// then streamInfo.URL needs to be rewritten to point to UDPxy.\n\tif Settings.UDPxy != \"\" && strings.HasPrefix(streamInfo.URL, \"udp://@\") {\n\t\tstreamInfo.URL = fmt.Sprintf(\"http://%s/udp/%s/\", Settings.UDPxy, strings.TrimPrefix(streamInfo.URL, \"udp://@\"))\n\t}\n\n\tswitch Settings.Buffer {\n\n\tcase \"-\":\n\t\tshowInfo(fmt.Sprintf(\"Buffer:false [%s]\", Settings.Buffer))\n\n\tcase \"xteve\":\n\t\tif strings.Index(streamInfo.URL, \"rtsp://\") != -1 || strings.Index(streamInfo.URL, \"rtp://\") != -1 {\n\t\t\terr = errors.New(\"RTSP and RTP streams are not supported\")\n\t\t\tShowError(err, 2004)\n\n\t\t\tshowInfo(\"Streaming URL:\" + streamInfo.URL)\n\t\t\thttp.Redirect(w, r, streamInfo.URL, 302)\n\n\t\t\tshowInfo(\"Streaming Info:URL was passed to the client\")\n\t\t\treturn\n\t\t}\n\n\t\tshowInfo(fmt.Sprintf(\"Buffer:true [%s]\", Settings.Buffer))\n\n\tdefault:\n\t\tshowInfo(fmt.Sprintf(\"Buffer:true [%s]\", Settings.Buffer))\n\n\t}\n\n\tif Settings.Buffer != \"-\" {\n\t\tshowInfo(fmt.Sprintf(\"Buffer Size:%d KB\", Settings.BufferSize))\n\t}\n\n\tshowInfo(fmt.Sprintf(\"Channel Name:%s\", streamInfo.Name))\n\tshowInfo(fmt.Sprintf(\"Client User-Agent:%s\", r.Header.Get(\"User-Agent\")))\n\n\t// Prüfen ob der Buffer verwendet werden soll\n\tswitch Settings.Buffer {\n\n\tcase \"-\":\n\t\tshowInfo(\"Streaming URL:\" + streamInfo.URL)\n\t\thttp.Redirect(w, r, streamInfo.URL, 302)\n\n\t\tshowInfo(\"Streaming Info:URL was passed to the client.\")\n\t\tshowInfo(\"Streaming Info:xTeVe is no longer involved, the client connects directly to the streaming server.\")\n\n\tdefault:\n\t\tbufferingStream(streamInfo.PlaylistID, streamInfo.URL, streamInfo.Name, w, r)\n\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "97a5439d0497c2b7d4c4e2bad70343cf", "score": "0.52762777", "text": "func NewStream(preAuth RequestStream, processor Processor, postAuth ResultStream) Stream {\n\tif processor == nil {\n\t\tprocessor = newMemoryProcessor()\n\t}\n\n\tif preAuth != nil {\n\t\tlinkRequest(preAuth, processor)\n\t}\n\n\tif postAuth != nil {\n\t\tlinkResult(processor, postAuth)\n\t\tlinkResult(postAuth, terminator{})\n\t} else {\n\t\tlinkResult(processor, terminator{})\n\t}\n\n\tif preAuth != nil {\n\t\treturn newStreamHead(preAuth)\n\t}\n\n\treturn newStreamHead(processor)\n}", "title": "" }, { "docid": "52ecc9531aa23ee76ec1e25261b8c29b", "score": "0.5251652", "text": "func yaml_parser_parse_document_start(parser *yaml_parser_t, event *yaml_event_t,\n\timplicit bool) bool {\n\n\ttoken := peek_token(parser)\n\tif token == nil {\n\t\treturn false\n\t}\n\n\t/* Parse extra document end indicators. */\n\n\tif !implicit {\n\t\tfor token.token_type == yaml_DOCUMENT_END_TOKEN {\n\t\t\tskip_token(parser)\n\t\t\ttoken = peek_token(parser)\n\t\t\tif token == nil {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t}\n\n\t/* Parse an implicit document. */\n\n\tif implicit && token.token_type != yaml_VERSION_DIRECTIVE_TOKEN &&\n\t\ttoken.token_type != yaml_TAG_DIRECTIVE_TOKEN &&\n\t\ttoken.token_type != yaml_DOCUMENT_START_TOKEN &&\n\t\ttoken.token_type != yaml_STREAM_END_TOKEN {\n\t\tif !yaml_parser_process_directives(parser, nil, nil) {\n\t\t\treturn false\n\t\t}\n\n\t\tparser.states = append(parser.states, yaml_PARSE_DOCUMENT_END_STATE)\n\t\tparser.state = yaml_PARSE_BLOCK_NODE_STATE\n\n\t\t*event = yaml_event_t{\n\t\t\tevent_type: yaml_DOCUMENT_START_EVENT,\n\t\t\timplicit: true,\n\t\t\tstart_mark: token.start_mark,\n\t\t\tend_mark: token.end_mark,\n\t\t}\n\t} else if token.token_type != yaml_STREAM_END_TOKEN {\n\t\t/* Parse an explicit document. */\n\t\tvar version_directive *yaml_version_directive_t\n\t\tvar tag_directives []yaml_tag_directive_t\n\n\t\tstart_mark := token.start_mark\n\t\tif !yaml_parser_process_directives(parser, &version_directive,\n\t\t\t&tag_directives) {\n\t\t\treturn false\n\t\t}\n\t\ttoken = peek_token(parser)\n\t\tif token == nil {\n\t\t\treturn false\n\t\t}\n\t\tif token.token_type != yaml_DOCUMENT_START_TOKEN {\n\t\t\tyaml_parser_set_parser_error(parser,\n\t\t\t\t\"did not find expected <document start>\", token.start_mark)\n\t\t\treturn false\n\t\t}\n\n\t\tparser.states = append(parser.states, yaml_PARSE_DOCUMENT_END_STATE)\n\t\tparser.state = yaml_PARSE_DOCUMENT_CONTENT_STATE\n\n\t\tend_mark := token.end_mark\n\n\t\t*event = yaml_event_t{\n\t\t\tevent_type: yaml_DOCUMENT_START_EVENT,\n\t\t\tstart_mark: start_mark,\n\t\t\tend_mark: end_mark,\n\t\t\tversion_directive: version_directive,\n\t\t\ttag_directives: tag_directives,\n\t\t\timplicit: false,\n\t\t}\n\t\tskip_token(parser)\n\t} else {\n\t\t/* Parse the stream end. */\n\t\tparser.state = yaml_PARSE_END_STATE\n\n\t\t*event = yaml_event_t{\n\t\t\tevent_type: yaml_STREAM_END_EVENT,\n\t\t\tstart_mark: token.start_mark,\n\t\t\tend_mark: token.end_mark,\n\t\t}\n\t\tskip_token(parser)\n\t}\n\treturn true\n}", "title": "" }, { "docid": "81d83b258e187458f0e6df53df6ff5d5", "score": "0.5237791", "text": "func OpenStream(j int, session *quic.Session) {\n\tbuf2 := make([]byte, 1024) //allocating memory\n\tstream, err := (*session).OpenStream()\n\tCheckError(err)\n\t// TODO parse data from JSON files\n\t//id, iderr = jsonparser.GetString(data, \"id\")\n\tfor i := 0; i < 10000; i++ {\n\t\tSendPacket(j*1000+i, &stream, buf2)\n\t}\n}", "title": "" }, { "docid": "b632f5e51153b133cc3fa8d746cbc6ad", "score": "0.5220188", "text": "func (ssr *stringStreamReader) Stream(s string) {\n\n\tssr.stream <- s\n}", "title": "" }, { "docid": "a17a88592b98c0411f2c6813ffe82e02", "score": "0.5208536", "text": "func ParseStream(req *http.Request, callback func(rows []Row) error) error {\n\treadCalls.Inc()\n\tr := req.Body\n\tif req.Header.Get(\"Content-Encoding\") == \"gzip\" {\n\t\tzr, err := common.GetGzipReader(r)\n\t\tif err != nil {\n\t\t\treadErrors.Inc()\n\t\t\treturn fmt.Errorf(\"cannot read gzipped http protocol data: %w\", err)\n\t\t}\n\t\tdefer common.PutGzipReader(zr)\n\t\tr = zr\n\t}\n\n\tctx := getStreamContext()\n\tdefer putStreamContext(ctx)\n\n\t// Read the request in ctx.reqBuf\n\tlr := io.LimitReader(r, int64(*maxInsertRequestSize)+1)\n\treqLen, err := ctx.reqBuf.ReadFrom(lr)\n\tif err != nil {\n\t\treadErrors.Inc()\n\t\treturn fmt.Errorf(\"cannot read HTTP OpenTSDB request: %w\", err)\n\t}\n\tif reqLen > int64(*maxInsertRequestSize) {\n\t\treadErrors.Inc()\n\t\treturn fmt.Errorf(\"too big HTTP OpenTSDB request; mustn't exceed `-opentsdbhttp.maxInsertRequestSize=%d` bytes\", *maxInsertRequestSize)\n\t}\n\n\t// Unmarshal the request to ctx.Rows\n\tp := GetParser()\n\tdefer PutParser(p)\n\tv, err := p.ParseBytes(ctx.reqBuf.B)\n\tif err != nil {\n\t\tunmarshalErrors.Inc()\n\t\treturn fmt.Errorf(\"cannot parse HTTP OpenTSDB json: %w\", err)\n\t}\n\tctx.Rows.Unmarshal(v)\n\trowsRead.Add(len(ctx.Rows.Rows))\n\n\trows := ctx.Rows.Rows\n\n\t// Fill in missing timestamps\n\tcurrentTimestamp := int64(fasttime.UnixTimestamp())\n\tfor i := range rows {\n\t\tr := &rows[i]\n\t\tif r.Timestamp == 0 {\n\t\t\tr.Timestamp = currentTimestamp\n\t\t}\n\t}\n\n\t// Convert timestamps in seconds to milliseconds if needed.\n\t// See http://opentsdb.net/docs/javadoc/net/opentsdb/core/Const.html#SECOND_MASK\n\tfor i := range rows {\n\t\tr := &rows[i]\n\t\tif r.Timestamp&secondMask == 0 {\n\t\t\tr.Timestamp *= 1e3\n\t\t}\n\t}\n\n\t// Trim timestamps if required.\n\tif tsTrim := trimTimestamp.Milliseconds(); tsTrim > 1 {\n\t\tfor i := range rows {\n\t\t\trow := &rows[i]\n\t\t\trow.Timestamp -= row.Timestamp % tsTrim\n\t\t}\n\t}\n\n\t// Insert ctx.Rows to db.\n\treturn callback(rows)\n}", "title": "" }, { "docid": "9c08ec77fafec692772086cb8164f5b2", "score": "0.51422226", "text": "func stream(reply interface{}, err error) (string, []byte, error) {\n\tif err != nil {\n\t\treturn \"\", nil, err\n\t}\n\tif reply == nil {\n\t\treturn \"\", nil, fmt.Errorf(\"no data returned\")\n\t}\n\tstreams, ok := reply.([]interface{})\n\tif !ok {\n\t\treturn \"\", nil, fmt.Errorf(\"invalid input. Data has to be a list, not %T\", reply)\n\t}\n\tif len(streams) == 0 {\n\t\treturn \"\", nil, fmt.Errorf(\"invalid input. No stream in data\")\n\t}\n\tstream1, ok := streams[0].([]interface{})\n\tif !ok {\n\t\treturn \"\", nil, fmt.Errorf(\"invalid input. Stream has to be a two-tuple, not %T\", streams[0])\n\t}\n\tif len(stream1) != 2 {\n\t\treturn \"\", nil, fmt.Errorf(\"invalid input. Stream has to be a two-tuple, got %d elements\", len(stream1))\n\t}\n\tdata, ok := stream1[1].([]interface{})\n\tif !ok {\n\t\treturn \"\", nil, fmt.Errorf(\"invalid input. Stream data has to be a list, got %T\", stream1[1])\n\t}\n\n\tif len(data) != 1 {\n\t\treturn \"\", nil, fmt.Errorf(\"invalid input. Expected got %d stream data, expected 1\", len(data))\n\t}\n\n\tv := data[0]\n\telement, ok := v.([]interface{})\n\tif !ok {\n\t\treturn \"\", nil, fmt.Errorf(\"invalid input. Stream element has to be a two-tuple, got %T\", v)\n\t}\n\tif len(element) != 2 {\n\t\treturn \"\", nil, fmt.Errorf(\"invalid input. Stream element has to be a two-tuple, got %d elements\", len(element))\n\t}\n\tid, ok := element[0].([]byte)\n\tif !ok {\n\t\treturn \"\", nil, fmt.Errorf(\"invalid input. Stream ID has to be a string, got %T\", element[0])\n\t}\n\tkv, ok := element[1].([]interface{})\n\tif !ok {\n\t\treturn \"\", nil, fmt.Errorf(\"invalid input. Key values has to be a list of strings, got %T\", element[1])\n\t}\n\tif len(kv)%2 != 0 {\n\t\treturn \"\", nil, fmt.Errorf(\"invalid input. Odd number of key value pairs\")\n\t}\n\n\tfor i := 0; i < len(kv)-1; i += 2 {\n\t\tkey, ok := kv[i].([]byte)\n\t\tif !ok {\n\t\t\treturn \"\", nil, fmt.Errorf(\"invalid input. Key has to be a string, got %T\", kv[i])\n\t\t}\n\t\tvalue, ok := kv[i+1].([]byte)\n\t\tif !ok {\n\t\t\treturn \"\", nil, fmt.Errorf(\"invalid input. Values has to be a []byte, got %T\", kv[i+1])\n\t\t}\n\t\tswitch string(key) {\n\t\tcase \"content\":\n\t\t\treturn string(id), value, nil\n\t\tdefault:\n\t\t\treturn \"\", nil, fmt.Errorf(\"invalid input. Unknown key \\\"%s\\\"\", key)\n\t\t}\n\t}\n\treturn \"\", nil, fmt.Errorf(\"invalid input. `content` not in response\")\n}", "title": "" }, { "docid": "7a0c55b75a709a10f8a66e5b230685d8", "score": "0.5108428", "text": "func parseStream(user User, cursor string) (User, error) {\r\n\tmyLog := log.WithField(\"username\", user.Username)\r\n\r\n\troot, _ := getNextPage(user.ID, cursor)\r\n\tmediaRoot := root.Get(\"data.user.edge_owner_to_timeline_media\")\r\n\r\n\thasNext := mediaRoot.Get(\"page_info.has_next_page\").Bool()\r\n\tnewCursor := mediaRoot.Get(\"page_info.end_cursor\").Str\r\n\r\n\tpageMedia := mediaRoot.Get(\"edges\")\r\n\r\n\tnodes := parseEdges(pageMedia)\r\n\r\n\tuser.Nodes = append(user.Nodes, nodes...)\r\n\r\n\t// recurse downwards if there are more pages\r\n\tif hasNext {\r\n\t\tmyLog.Infof(\"Parsing next page (%4d nodes parsed)\", len(user.Nodes))\r\n\r\n\t\tvar err error\r\n\t\tuser, err = parseStream(user, newCursor)\r\n\t\tif err != nil {\r\n\t\t\tmyLog.Errorf(\"Error parsing stream: %v\", err)\r\n\t\t\treturn user, err\r\n\t\t}\r\n\t}\r\n\treturn user, nil\r\n}", "title": "" }, { "docid": "3806b0b8e5fd27695e0218cf6a56ca70", "score": "0.51054734", "text": "func (engine *Engine) StreamBeginData(\n\tvbno uint16, vbuuid, seqno uint64) interface{} {\n\n\treturn engine.evaluator.StreamBeginData(vbno, vbuuid, seqno)\n}", "title": "" }, { "docid": "e6e11db090fe30a72a242912f283a5e8", "score": "0.50328964", "text": "func cmdstream(ns *g9pc.Ns, s []string) {\n\tfor _, fname := range s {\n\t\tr := ns.ReadStream(fname, 20, 10)\n\t\t_, err := io.Copy(os.Stdout, r)\n\t\tif err != nil {\n\t\t\tfmt.Fprintf(os.Stderr, \"error reading %s: %v\\n\", fname, err)\n\t\t}\n\t\tr.Close()\n\t}\n}", "title": "" }, { "docid": "8cbbf6dd602ed96bea9e35ee7a578586", "score": "0.5001446", "text": "func NewStream(it Iterator) Stream {\n\treturn Stream{it: it}\n}", "title": "" }, { "docid": "42ad16f510d6594f4b25dc754b6647bc", "score": "0.49897498", "text": "func NewParser(r io.Reader) (Parser, error) {\n\td := bufio.NewReader(r)\n\n\treturn &streamParser{\n\t\tx: d,\n\t}, nil\n}", "title": "" }, { "docid": "806397d64af4c186ab1a8fc46c525c9e", "score": "0.49848953", "text": "func (p *parser) parse(done chan<- struct{}) {\n\tdefer close(done)\n\tp.Log().Debug(\"start parsing\")\n\tdefer p.Log().Debug(\"stop parsing\")\n\n\tvar skipStreamedErr bool\n\n\tfor {\n\t\tvar bodyLen, msgLen int\n\t\tif !p.streamed {\n\t\t\t// extract body/msg len\n\t\t\tline, err := p.input.NextLine()\n\t\t\tif err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tstrs := strings.Split(line, \"|\")\n\t\t\tif len(strs) != 2 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tbodyLen, err = strconv.Atoi(strs[0])\n\t\t\tif err != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tmsgLen, err = strconv.Atoi(strs[1])\n\t\t\tif err != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\t// Parse the StartLine.\n\t\tstartLine, err := p.input.NextLine()\n\t\tif err != nil {\n\t\t\tbreak\n\t\t}\n\n\t\tp.Log().Tracef(\"start reading start line: %s\", startLine)\n\t\tmsg, termErr := p.parseStartLine(startLine)\n\t\tif termErr != nil {\n\t\t\tp.Log().Tracef(\"%s failed to read start line '%s'\", p, startLine)\n\t\t\ttermErr = InvalidStartLineError(fmt.Sprintf(\"%s failed to parse first line of message: %s\", p, termErr))\n\n\t\t\tif p.streamed {\n\t\t\t\tif !skipStreamedErr {\n\t\t\t\t\tskipStreamedErr = true\n\t\t\t\t\tp.errs <- termErr\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tskip := msgLen - len(startLine) - 2\n\t\t\t\tp.Log().Tracef(\"skip %d - %d - 2 = %d bytes\", p, msgLen, len(startLine), skip)\n\t\t\t\tif _, err := p.input.NextChunk(skip); err != nil {\n\t\t\t\t\tp.Log().Errorf(\"skip failed: %s\", err)\n\t\t\t\t}\n\n\t\t\t\tp.errs <- termErr\n\t\t\t}\n\t\t\tcontinue\n\t\t} else {\n\t\t\tskipStreamedErr = false\n\t\t}\n\n\t\tp.Log().Tracef(\"%s starts reading headers\", p)\n\t\tlines := make([]string, 0)\n\t\tfor {\n\t\t\tline, err := p.input.NextLine()\n\t\t\tif err != nil || len(line) == 0 {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tlines = append(lines, line)\n\t\t}\n\t\tp.fillHeaders(msg, lines)\n\n\t\tvar contentLength int\n\t\t// Determine the length of the body, so we know when to stop parsing this message.\n\t\tif p.streamed {\n\t\t\t// Use the content-length header to identify the end of the message.\n\t\t\tcontentLengthHeaders := msg.GetHeaders(\"Content-Length\")\n\t\t\tif len(contentLengthHeaders) == 0 {\n\t\t\t\tskipStreamedErr = true\n\n\t\t\t\ttermErr := &sip.MalformedMessageError{\n\t\t\t\t\tErr: fmt.Errorf(\"missing required 'Content-Length' header\"),\n\t\t\t\t\tMsg: msg.String(),\n\t\t\t\t}\n\t\t\t\tp.errs <- termErr\n\n\t\t\t\tcontinue\n\t\t\t} else if len(contentLengthHeaders) > 1 {\n\t\t\t\tskipStreamedErr = true\n\n\t\t\t\tvar errbuf bytes.Buffer\n\t\t\t\terrbuf.WriteString(\"multiple 'Content-Length' headers on message '\")\n\t\t\t\terrbuf.WriteString(msg.Short())\n\t\t\t\terrbuf.WriteString(fmt.Sprintf(\"'; parser: %s:\\n\", p))\n\t\t\t\tfor _, header := range contentLengthHeaders {\n\t\t\t\t\terrbuf.WriteString(\"\\t\")\n\t\t\t\t\terrbuf.WriteString(header.String())\n\t\t\t\t}\n\t\t\t\ttermErr := &sip.MalformedMessageError{\n\t\t\t\t\tErr: errors.New(errbuf.String()),\n\t\t\t\t\tMsg: msg.String(),\n\t\t\t\t}\n\t\t\t\tp.errs <- termErr\n\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tcontentLength = int(*(contentLengthHeaders[0].(*sip.ContentLength)))\n\t\t} else {\n\t\t\tcontentLength = bodyLen\n\t\t}\n\n\t\t// Extract the message body.\n\t\tp.Log().Tracef(\"%s reads body with length = %d bytes\", p, contentLength)\n\t\tbody, err := p.input.NextChunk(contentLength)\n\t\tif err != nil {\n\t\t\ttermErr := &sip.BrokenMessageError{\n\t\t\t\tErr: fmt.Errorf(\"read message body failed: %w\", err),\n\t\t\t\tMsg: msg.String(),\n\t\t\t}\n\t\t\tp.errs <- termErr\n\t\t\tcontinue\n\t\t}\n\t\tif err = p.fillBody(msg, body, contentLength); err != nil {\n\t\t\tp.errs <- err\n\t\t\tcontinue\n\t\t}\n\t\tp.output <- msg\n\t}\n\treturn\n}", "title": "" }, { "docid": "57549b9083ae57c5c88b89627e3a5bd3", "score": "0.49836144", "text": "func NewStream(id string, retriever Retriever, options ...*Option) Stream {\n\topt := defaultOptions.merge(options...)\n\n\tvar edge Edge\n\n\tx := &builder{\n\t\terrorChannel: make(chan error, 10000),\n\t\toption: opt,\n\t\tvertex: vertex{\n\t\t\tid: id,\n\t\t\tvertexType: \"stream\",\n\t\t\thandler: func(p []*Packet) {\n\t\t\t\tedge.Next(p...)\n\t\t\t},\n\t\t},\n\t\tedges: map[string]Edge{},\n\t}\n\n\tx.connector = func(ctx context.Context, b *builder) error {\n\t\tedge = opt.Provider.New(ctx, id, opt)\n\n\t\ti := retriever(ctx)\n\n\t\tgo func() {\n\t\tLoop:\n\t\t\tfor {\n\t\t\t\tselect {\n\t\t\t\tcase <-ctx.Done():\n\t\t\t\t\tbreak Loop\n\t\t\t\tcase data := <-i:\n\t\t\t\t\tif len(data) < 1 {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\tpayload := make([]*Packet, len(data))\n\t\t\t\t\tfor i, item := range data {\n\t\t\t\t\t\tpacket := &Packet{\n\t\t\t\t\t\t\tID: uuid.NewString(),\n\t\t\t\t\t\t\tData: item,\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tpayload[i] = packet\n\t\t\t\t\t}\n\n\t\t\t\t\tif errList := opt.validate(data...); len(errList) > 0 {\n\t\t\t\t\t\tx.errorHandler(&Error{\n\t\t\t\t\t\t\tErr: fmt.Errorf(\"validation errors %v\", errList),\n\t\t\t\t\t\t\tVertexID: id,\n\t\t\t\t\t\t\tVertexType: \"stream\",\n\t\t\t\t\t\t\tPackets: payload,\n\t\t\t\t\t\t\tTime: time.Now(),\n\t\t\t\t\t\t})\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\tx.input <- payload\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\t\treturn x.next.cascade(ctx, x, edge)\n\t}\n\n\treturn x\n}", "title": "" }, { "docid": "3592fcf16775c1070a0e6138aac4374c", "score": "0.49453142", "text": "func parseQuery(request *graphql.Request) (*Document, error) {\n var document *Document\n var query string\n var err error\n\n query = request.GetAvaliableQuery()\n\n // parse\n lexer := NewLexer(query)\n if document, err = parseDocument(lexer); err != nil {\n return nil, err\n }\n\n // document end\n lexer.NextTokenIs(TOKEN_EOF) \n\n return document, nil\n}", "title": "" }, { "docid": "92d955207498dd40375930cbe45f4759", "score": "0.49448758", "text": "func ParseStream(scheme *runtime.Scheme, r io.Reader) ([]runtime.Object, error) {\n\tdecoder := yaml.NewYAMLOrJSONDecoder(r, 4096)\n\tresult := []runtime.Object{}\n\tfor {\n\t\tmsg := json.RawMessage{} // First convert into json bytes\n\t\tif err := decoder.Decode(&msg); err != nil {\n\t\t\tif err == io.EOF {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// Then decode into the type.\n\t\ttm := metav1.TypeMeta{}\n\t\terr := json.Unmarshal([]byte(msg), &tm)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// Turn the type name into a native go object.\n\t\tobj, err := scheme.New(tm.GroupVersionKind())\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// Then decode the object into its native go object\n\t\tobjDecoder := json.NewDecoder(bytes.NewBuffer([]byte(msg)))\n\t\tobjDecoder.DisallowUnknownFields()\n\t\tif err := objDecoder.Decode(&obj); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"decoding %s: %v\\nOriginal object:\\n%s\", tm, err, string([]byte(msg)))\n\t\t}\n\n\t\tresult = append(result, obj)\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "65f2ff6046d3e904d0fd225c8575e6dd", "score": "0.49410483", "text": "func MustParseStream(in io.Reader) *Data {\n\tresult, err := ParseStream(in)\n\tif err != nil {\n\t\tresult = &Data{}\n\t}\n\treturn result\n}", "title": "" }, { "docid": "040e6371fb0bd68349eafacf4ea45f14", "score": "0.4934478", "text": "func TestParseStream(t *testing.T) {\n\n\tr := strings.NewReader(tests.GetSampleCsvAsStream())\n\tp := tests.GetTpp()\n\n\ttopic, err := ParseTopic(r, p)\n\tif err != nil {\n\t\tt.Fatalf(\"parsing of topic should not raise an error. Get %v\", err)\n\t}\n\tcount := topic.GetVocabularySubsectionsCount()\n\tif count != 3 {\n\t\tt.Errorf(\"After parsing the stream should result in 3 subtopics. We have counted %d\\n\", count)\n\t}\n\n\tqa := topic.BuildVocabularyQuestionsSet()\n\tcount = qa.GetCount()\n\tif count != 6 {\n\t\tt.Errorf(\"We should have a list of 6 questions for the global but we found %d\\n\", count)\n\t}\n\n\tfor i := 1; i <= 3; i++ {\n\t\tqa = topic.BuildVocabularyQuestionsSet(strconv.Itoa(i))\n\t\tcount = qa.GetCount()\n\t\tif count != i {\n\t\t\tfmt.Printf(\"QuestionsAnswers set: %v\\n\", qa)\n\t\t\tfmt.Printf(\"Topic: %v\\n\", topic)\n\t\t\tt.Errorf(\"We should have a list of %d questions for the global but we found %d\\n\", i, count)\n\t\t}\n\t}\n\n}", "title": "" }, { "docid": "5d3875ff649af35ee1032790b0453937", "score": "0.4905959", "text": "func TestParseStream(t *testing.T) {\n\n\tr := strings.NewReader(getSampleCsvAsStream())\n\tp := getTpp()\n\n\ttopic := ParseTopic(r, p)\n\tcount := topic.GetSubsectionsCount()\n\tif count != 3 {\n\t\tt.Errorf(\"After parsing the stream should result in 3 subtopics. We have counted %d\\n\", count)\n\t}\n\n\tqa := topic.BuildQuestionsSet()\n\tcount = qa.GetCount()\n\tif count != 6 {\n\t\tt.Errorf(\"We should have a list of 6 questions for the global but we found %d\\n\", count)\n\t}\n\n\tfor i := 1; i <= 3; i++ {\n\t\tqa = topic.BuildQuestionsSet(strconv.Itoa(i))\n\t\tcount = qa.GetCount()\n\t\tif count != i {\n\t\t\tt.Errorf(\"We should have a list of %d questions for the global but we found %d\\n\", i, count)\n\t\t}\n\t}\n\n}", "title": "" }, { "docid": "1fd665792add69a3e1698d2a3b54fd74", "score": "0.48839867", "text": "func ExpectNewStream(ctx context.Context, d xml.TokenReader, recv bool) (streamData StreamInfo, err error) {\n\tvar foundHeader bool\n\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn streamData, ctx.Err()\n\t\tdefault:\n\t\t}\n\t\tt, err := d.Token()\n\t\tif err != nil {\n\t\t\treturn streamData, err\n\t\t}\n\t\tswitch tok := t.(type) {\n\t\tcase xml.StartElement:\n\t\t\tswitch {\n\t\t\tcase tok.Name.Local == \"error\" && tok.Name.Space == ns.Stream:\n\t\t\t\tse := stream.Error{}\n\t\t\t\tif err := xml.NewTokenDecoder(d).DecodeElement(&se, &tok); err != nil {\n\t\t\t\t\treturn streamData, err\n\t\t\t\t}\n\t\t\t\treturn streamData, se\n\t\t\tcase tok.Name.Local != \"stream\":\n\t\t\t\treturn streamData, stream.BadFormat\n\t\t\tcase tok.Name.Space != ns.Stream:\n\t\t\t\treturn streamData, stream.InvalidNamespace\n\t\t\t}\n\n\t\t\tstreamData, err = streamFromStartElement(tok)\n\t\t\tswitch {\n\t\t\tcase err != nil:\n\t\t\t\treturn streamData, err\n\t\t\tcase streamData.version != DefaultVersion:\n\t\t\t\treturn streamData, stream.UnsupportedVersion\n\t\t\t}\n\n\t\t\tif !recv && streamData.id == \"\" {\n\t\t\t\t// if we are the initiating entity and there is no stream ID…\n\t\t\t\treturn streamData, stream.BadFormat\n\t\t\t}\n\t\t\treturn streamData, nil\n\t\tcase xml.ProcInst:\n\t\t\t// TODO: If version or encoding are declared, validate XML 1.0 and UTF-8\n\t\t\tif !foundHeader && tok.Target == \"xml\" {\n\t\t\t\tfoundHeader = true\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn streamData, stream.RestrictedXML\n\t\tcase xml.EndElement:\n\t\t\treturn streamData, stream.NotWellFormed\n\t\tdefault:\n\t\t\treturn streamData, stream.RestrictedXML\n\t\t}\n\t}\n}", "title": "" }, { "docid": "804006367376a14e4557f08b3748f69a", "score": "0.48758936", "text": "func (m *module) Stream(sink bar.Sink) {\n\tgo m.start()\n\tfor {\n\t\tnext := m.Next()\n\t\ts, _ := m.Get().(bar.Segments)\n\t\tindex := m.index\n\t\tif index > len(s) {\n\t\t\tindex = len(s)\n\t\t}\n\t\tvar out bar.Segments\n\t\tif m.first {\n\t\t\tout = s[:index]\n\t\t} else {\n\t\t\tout = s[index:]\n\t\t}\n\t\tsink.Output(out)\n\t\t<-next\n\t}\n}", "title": "" }, { "docid": "6efcf5a684a4a1e21aecf8741e11f2d9", "score": "0.48602074", "text": "func GetStream(httpRes http.ResponseWriter, r render.Render, params martini.Params) {\n\t// Output struct for stream errors\n\tres := ErrorResponse{render: r}\n\n\t// Check API version\n\tif version, ok := params[\"version\"]; ok {\n\t\t// Check if this API call is supported in the advertised version\n\t\tif !apiVersionSet.Has(version) {\n\t\t\tres.RenderError(400, \"unsupported API version: \"+version)\n\t\t\treturn\n\t\t}\n\t}\n\n\t// Check for an ID parameter\n\tpID, ok := params[\"id\"]\n\tif !ok {\n\t\tres.RenderError(400, \"no integer stream ID provided\")\n\t\treturn\n\t}\n\n\t// Verify valid integer ID\n\tid, err := strconv.Atoi(pID)\n\tif err != nil {\n\t\tres.RenderError(400, \"invalid integer stream ID\")\n\t\treturn\n\t}\n\n\t// Attempt to load the song with matching ID\n\tsong := new(data.Song)\n\tsong.ID = id\n\tif err := song.Load(); err != nil {\n\t\t// Check for invalid ID\n\t\tif err == sql.ErrNoRows {\n\t\t\tres.RenderError(404, \"song ID not found\")\n\t\t\treturn\n\t\t}\n\n\t\t// All other errors\n\t\tlog.Println(err)\n\t\tres.ServerError()\n\t\treturn\n\t}\n\n\t// Attempt to access data stream\n\tstream, err := song.Stream()\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tres.ServerError()\n\t\treturn\n\t}\n\tdefer stream.Close()\n\n\t// Generate a string used for logging this operation\n\topStr := fmt.Sprintf(\"[#%05d] %s - %s [%s %dkbps]\", song.ID, song.Artist, song.Title,\n\t\tdata.CodecMap[song.FileTypeID], song.Bitrate)\n\n\t// Attempt to send file stream over HTTP\n\tlog.Println(\"stream: starting:\", opStr)\n\n\t// Pass stream using song's file size, auto-detect MIME type\n\tif err := httpStream(song, \"\", song.FileSize, stream, httpRes); err != nil {\n\t\t// Check for client reset\n\t\tif strings.Contains(err.Error(), \"connection reset by peer\") || strings.Contains(err.Error(), \"broken pipe\") {\n\t\t\treturn\n\t\t}\n\n\t\tlog.Println(\"stream: error:\", err)\n\t\treturn\n\t}\n\n\tlog.Println(\"stream: completed:\", opStr)\n\treturn\n}", "title": "" }, { "docid": "c96ca9033182d758840132a0734aacf2", "score": "0.48557577", "text": "func Parse(document string, processor Processor) {\n\tp := &parser{\n\t\tinput: document,\n\t\tprocessor: processor,\n\t\tfrag: document,\n\t\ttextStyle: TextStyleRegular,\n\t}\n\n\tp.parseDocument()\n}", "title": "" }, { "docid": "e37ae3aadcdb397bc449bc78526e93bb", "score": "0.4843744", "text": "func (sHandler *StreamingHandler) StreamStart(msg *MP.Message) {\n\t//Notify all the supernodes\n\t//Including itself (Since one supernode may have multipy children)\n\tsHandler.broadcast(\"stream_program_start\", msg.Data)\n\n\t//Update DHT table\n\tvar controlData SDataType.StreamControlMsg\n\tMP.DecodeData(&controlData, msg.Data)\n\tsHandler.dht.Create(controlData.RootStreamer,\n\t\tDHT.MemberShipInfo{\n\t\t\tStreamerName:controlData.SrcName,\n\t\t\tStreamerIp: controlData.SrcIp,\n\t\t\tStreamProgramName: controlData.Title,\n\t\t})\n\n}", "title": "" }, { "docid": "90a0bfa8fb3523756a4bae74d61c8901", "score": "0.48365507", "text": "func streamHandler(stream network.Stream) {\n\t// Remember to close the stream when we are done.\n\tdefer stream.Close()\n\n\t// Create a new buffered reader, as ReadRequest needs one.\n\t// The buffered reader reads from our stream, on which we\n\t// have sent the HTTP request (see ServeHTTP())\n\tbuf := bufio.NewReader(stream)\n\t// Read the HTTP request from the buffer\n\treq, err := http.ReadRequest(buf)\n\tif err != nil {\n\t\tstream.Reset()\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\tdefer req.Body.Close()\n\n\t// We need to reset these fields in the request\n\t// URL as they are not maintained.\n\treq.URL.Scheme = \"http\"\n\thp := strings.Split(req.Host, \":\")\n\tif len(hp) > 1 && hp[1] == \"443\" {\n\t\treq.URL.Scheme = \"https\"\n\t} else {\n\t\treq.URL.Scheme = \"http\"\n\t}\n\treq.URL.Host = req.Host\n\n\toutreq := new(http.Request)\n\t*outreq = *req\n\n\t// We now make the request\n\tfmt.Printf(\"Making request to %s\\n\", req.URL)\n\tresp, err := http.DefaultTransport.RoundTrip(outreq)\n\tif err != nil {\n\t\tstream.Reset()\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\n\t// resp.Write writes whatever response we obtained for our\n\t// request back to the stream.\n\tresp.Write(stream)\n}", "title": "" }, { "docid": "4b2845e33569899584fbc4be9247e1a1", "score": "0.48179647", "text": "func decodeStream(values url.Values, streams *RawVideoStream, rawstream []stream) error {\n\tstreams.Author = values.Get(\"author\")\n\tstreams.Title = values.Get(\"title\")\n\tstreamMap := values.Get(\"url_encoded_fmt_stream_map\")\n\n\t// read and decode streams\n\tstreamsList := strings.Split(string(streamMap), \",\")\n\tfor streamPos, streamRaw := range streamsList {\n\t\tstreamQry, err := url.ParseQuery(streamRaw)\n\t\tif err != nil {\n\t\t\tlogrus.Infof(\"Error occured during stream decoding %d: %s\\n\", streamPos, err)\n\t\t\tcontinue\n\t\t}\n\t\tvar sig string\n\t\tsig = streamQry.Get(\"sig\")\n\t\trawstream = append(rawstream, stream{\n\t\t\t\"quality\": streamQry.Get(\"quality\"),\n\t\t\t\"type\": streamQry.Get(\"type\"),\n\t\t\t\"url\": streamQry.Get(\"url\"),\n\t\t\t\"sig\": sig,\n\t\t\t\"title\": values.Get(\"title\"),\n\t\t\t\"author\": values.Get(\"author\"),\n\t\t})\n\t\tlogrus.Infof(\"Stream found: quality '%s', format '%s'\", streamQry.Get(\"quality\"), streamQry.Get(\"type\"))\n\t}\n\n\tstreams.URLEncodedFmtStreamMap = rawstream\n\treturn nil\n}", "title": "" }, { "docid": "5dee9c502a439970f61078c3fbbd86ee", "score": "0.48153353", "text": "func beginParsing(tokens []Token, state ParseFn) *Parser {\n\tp := &Parser{\n\t\tTokens: tokens,\n\t\tState: state,\n\t\t//\t\tOutput: make([]interface{}, 0),\n\t\tStack: lane.NewStack(),\n\t\tPos: 0,\n\t}\n\n\t//\tp.CurrentContainer = p.Output\n\treturn p\n}", "title": "" }, { "docid": "4e2b4d3e1821b5ec8df2cced61650145", "score": "0.48111048", "text": "func NewStream(rw io.ReadWriter) *Stream { return &Stream{raw: rw} }", "title": "" }, { "docid": "0473941bf76ccd2147e9799b1a574045", "score": "0.48009264", "text": "func IsStreamURI(uri string) bool {\n\treturn strings.HasPrefix(uri, \"http://\") || strings.HasPrefix(uri, \"https://\")\n}", "title": "" }, { "docid": "5e984dd3f878204e7e1ee1daac916048", "score": "0.47998735", "text": "func (td *TunerDebug) parseTransportStream(kvs [][2]string) error {\n\tts := new(TransportStreamStatus)\n\n\tfor _, kv := range kvs {\n\t\tv, err := strconv.Atoi(kv[1])\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tswitch kv[0] {\n\t\tcase \"bps\":\n\t\t\tts.BitsPerSecond = v\n\t\tcase \"te\":\n\t\t\tts.TransportErrors = v\n\t\tcase \"crc\":\n\t\t\tts.CRCErrors = v\n\t\t}\n\t}\n\n\ttd.TransportStream = ts\n\treturn nil\n}", "title": "" }, { "docid": "275e9d98a44b97a3898f53205ea6a474", "score": "0.47860816", "text": "func (_DSToken *DSTokenFilterer) ParseStart(log types.Log) (*DSTokenStart, error) {\n\tevent := new(DSTokenStart)\n\tif err := _DSToken.contract.UnpackLog(event, \"Start\", log); err != nil {\n\t\treturn nil, err\n\t}\n\tevent.Raw = log\n\treturn event, nil\n}", "title": "" }, { "docid": "d34600a2afcb02ee24a2137460012ee6", "score": "0.47783837", "text": "func (i *Input) Stream(conn net.Conn) {\n\n\t// Stream format is a length field (4-byte network byte order plus\n\t// a payload in protobuf format.\n\n\tdefer conn.Close()\n\n\tmaxlen := uint64(128 * 1024 * 1024)\n\n\tvar (\n\t\tlenb = make([]byte, 4)\n\t\tr = bufio.NewReader(conn)\n\t)\n\n\tfor {\n\t\tn, err := io.ReadFull(r, lenb)\n\n\t\tif err != nil {\n\t\t\tif err != io.EOF {\n\t\t\t\tlog.Print(err)\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\n\t\tif n != 4 {\n\t\t\tlog.Print(\"Truncation?!\")\n\t\t\tbreak\n\t\t}\n\n\t\tl := uint64(binary.BigEndian.Uint32(lenb))\n\n\t\tif l == 0 {\n\t\t\tlog.Print(\"len == 0?!\")\n\t\t\tbreak\n\t\t}\n\n\t\tif l > maxlen {\n\t\t\tlog.Print(\"PDU too long\")\n\t\t\tbreak\n\t\t}\n\n\t\tbuf := make([]byte, l)\n\t\tn, err = io.ReadFull(r, buf)\n\n\t\tif err != nil {\n\t\t\tlog.Print(err)\n\t\t\tif err != io.EOF {\n\t\t\t\tlog.Print(err)\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\n\t\tif uint64(n) != l {\n\t\t\tlog.Print(\"Truncation?!\")\n\t\t\tbreak\n\t\t}\n\n\t\ti.received.Inc()\n\n\t\ti.ch <- buf\n\n\t}\n\n}", "title": "" }, { "docid": "d07fa43cd2d54648a7a79febbf019c65", "score": "0.47676492", "text": "func InitStream() Data {\n\treturn &Stream{}\n}", "title": "" }, { "docid": "d995aea5ca9a5dd2277eb12520876e32", "score": "0.47676215", "text": "func convertStreamOutput(output output) template.HTML {\n\tif output.Text == nil {\n\t\tfmt.Printf(\"missing `text` key in output of type `stream`\\n\")\n\t\treturn \"\"\n\t}\n\n\tescapedHTML := escapeHTML(strings.Join(output.Text, \"\"))\n\treturn \"<pre>\" + escapedHTML + \"</pre>\"\n}", "title": "" }, { "docid": "c148ea6a080ee6cf7983ba1d9d26ce83", "score": "0.4724673", "text": "func ReadStream(o *authoperator.AuthOperator, writer http.ResponseWriter, request *http.Request, logger *log.Entry) (int, string) {\n\t_, _, _, streampath := restcore.GetStreamPath(request)\n\n\tif err := restcore.BadQ(o, writer, request, logger); err != nil {\n\t\treturn restcore.WriteError(writer, logger, http.StatusBadRequest, err, false)\n\t}\n\n\ts, err := o.ReadStream(streampath)\n\n\treturn restcore.JSONWriter(writer, s, logger, err)\n}", "title": "" }, { "docid": "ac14fa674722b24aacba8ec2cd64ea3b", "score": "0.4722323", "text": "func newStream(id string, buffSize int, replay, isAutoStream bool, onSubscribe, onUnsubscribe func(string, *Subscriber)) *Stream {\n\treturn &Stream{\n\t\tID: id,\n\t\tAutoReplay: replay,\n\t\tsubscribers: make([]*Subscriber, 0),\n\t\tisAutoStream: isAutoStream,\n\t\tregister: make(chan *Subscriber),\n\t\tderegister: make(chan *Subscriber),\n\t\tevent: make(chan *Event, buffSize),\n\t\tquit: make(chan struct{}),\n\t\tEventlog: make(EventLog, 0),\n\t\tOnSubscribe: onSubscribe,\n\t\tOnUnsubscribe: onUnsubscribe,\n\t}\n}", "title": "" }, { "docid": "317183668646298d8b0d243c501c742d", "score": "0.47160852", "text": "func New(r io.Reader) (stream *Stream, err error) {\n\t// Verify FLAC signature and parse the StreamInfo metadata block.\n\tbr := bufio.NewReader(r)\n\tstream = &Stream{r: br}\n\tblock, err := stream.parseStreamInfo()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Skip the remaining metadata blocks.\n\tfor !block.IsLast {\n\t\tblock, err = meta.New(br)\n\t\tif err != nil && err != meta.ErrReservedType {\n\t\t\treturn stream, err\n\t\t}\n\t\tif err = block.Skip(); err != nil {\n\t\t\treturn stream, err\n\t\t}\n\t}\n\n\treturn stream, nil\n}", "title": "" }, { "docid": "b91dfc6bb364b2cdc00acc47d5df7753", "score": "0.47157654", "text": "func (d *Dictionary) IsStream() (bool, error) {\n\treturn false, nil\n}", "title": "" }, { "docid": "b3178883b425636bd14f9d4483de9e90", "score": "0.47104195", "text": "func StreamXML(in *XMLReader, tokens func(Token)) {\n\n\tif in == nil || tokens == nil {\n\t\treturn\n\t}\n\n\t// token parser variables\n\tText := \"\"\n\tTxtlen := len(Text)\n\tIdx := 0\n\n\t// line tracking variables\n\tLine := 1\n\tLag := 0\n\n\t// variables to track COMMENT or CDATA sections that span reader blocks\n\tWhich := NOTAG\n\tSkipTo := \"\"\n\n\t// get next XML token\n\tnextToken := func(idx int) (TagType, ContentType, string, string, int, int) {\n\n\t\tif Text == \"\" {\n\t\t\t// buffer is empty, read next block if available\n\t\t\tif in != nil {\n\t\t\t\tText = in.NextBlock()\n\t\t\t\tTxtlen = len(Text)\n\t\t\t\tIdx = 0\n\t\t\t\tidx = 0\n\t\t\t\tLag = 0\n\t\t\t}\n\n\t\t\tif Text == \"\" {\n\t\t\t\t// signal end of XML data\n\t\t\t\treturn ISCLOSED, NONE, \"\", \"\", 0, Line\n\t\t\t}\n\t\t}\n\n\t\ttext := Text[:]\n\t\ttxtlen := Txtlen\n\n\t\tupdateLineCount := func(max int) {\n\t\t\t// count lines\n\t\t\tfor i := Lag; i < max; i++ {\n\t\t\t\tif text[i] == '\\n' {\n\t\t\t\t\tLine++\n\t\t\t\t}\n\t\t\t}\n\t\t\tLag = idx\n\t\t}\n\n\t\tif Which != NOTAG && SkipTo != \"\" {\n\t\t\twhich := Which\n\t\t\t// previous block ended inside CDATA object or COMMENT\n\t\t\tstart := idx\n\t\t\tfound := strings.Index(text[:], SkipTo)\n\t\t\tif found < 0 {\n\t\t\t\t// no stop signal found in next block\n\t\t\t\tstr := text[:]\n\t\t\t\tif HasFlankingSpace(str) {\n\t\t\t\t\tstr = strings.TrimSpace(str)\n\t\t\t\t}\n\t\t\t\t// signal end of current block\n\t\t\t\tText = \"\"\n\n\t\t\t\tif CountLines {\n\t\t\t\t\tupdateLineCount(txtlen)\n\t\t\t\t}\n\n\t\t\t\t// leave Which and SkipTo values unchanged as another continuation signal\n\t\t\t\t// send CDATA or COMMENT contents\n\t\t\t\treturn which, NONE, str[:], \"\", 0, Line\n\t\t\t}\n\t\t\t// otherwise adjust position past end of skipTo string and return to normal processing\n\t\t\tidx += found\n\t\t\tstr := text[start:idx]\n\t\t\tif HasFlankingSpace(str) {\n\t\t\t\tstr = strings.TrimSpace(str)\n\t\t\t}\n\t\t\tidx += len(SkipTo)\n\t\t\t// clear tracking variables\n\t\t\tWhich = NOTAG\n\t\t\tSkipTo = \"\"\n\t\t\t// send CDATA or COMMENT contents\n\t\t\treturn which, NONE, str[:], \"\", idx, Line\n\t\t}\n\n\t\t// XML string, and all blocks, end with > character, acts as sentinel to check if past end of text\n\t\tif idx >= txtlen {\n\t\t\t// signal end of XML string or current block, will read next block on next call\n\t\t\tText = \"\"\n\n\t\t\tif CountLines {\n\t\t\t\tupdateLineCount(txtlen)\n\t\t\t}\n\n\t\t\treturn NOTAG, NONE, \"\", \"\", 0, Line\n\t\t}\n\n\t\t// skip past leading blanks\n\t\tch := text[idx]\n\t\tfor InBlank[ch] {\n\t\t\tidx++\n\t\t\tch = text[idx]\n\t\t}\n\n\t\tstart := idx\n\n\t\tplainContent := true\n\n\t\tif AllowEmbed && ch == '<' {\n\t\t\t// check to see if an HTML or MathML element is at the beginning of a content string\n\t\t\tif HTMLAhead(text, idx) != 0 {\n\t\t\t\tplainContent = false\n\t\t\t}\n\t\t}\n\n\t\tif plainContent && ch == '<' {\n\n\t\t\t// at start of element\n\t\t\tidx++\n\t\t\tch = text[idx]\n\n\t\t\t// check for legal first character of element\n\t\t\tif InFirst[ch] {\n\n\t\t\t\t// read element name\n\t\t\t\tstart = idx\n\t\t\t\tidx++\n\n\t\t\t\tch = text[idx]\n\t\t\t\tfor InElement[ch] {\n\t\t\t\t\tidx++\n\t\t\t\t\tch = text[idx]\n\t\t\t\t}\n\n\t\t\t\tstr := text[start:idx]\n\n\t\t\t\tswitch ch {\n\t\t\t\tcase '>':\n\t\t\t\t\t// end of element\n\t\t\t\t\tidx++\n\n\t\t\t\t\tif CountLines {\n\t\t\t\t\t\tupdateLineCount(idx)\n\t\t\t\t\t}\n\n\t\t\t\t\treturn STARTTAG, NONE, str[:], \"\", idx, Line\n\t\t\t\tcase '/':\n\t\t\t\t\t// self-closing element without attributes\n\t\t\t\t\tidx++\n\t\t\t\t\tch = text[idx]\n\t\t\t\t\tif ch != '>' {\n\t\t\t\t\t\tfmt.Fprintf(os.Stderr, \"\\nSelf-closing element missing right angle bracket\\n\")\n\t\t\t\t\t}\n\t\t\t\t\tidx++\n\n\t\t\t\t\tif CountLines {\n\t\t\t\t\t\tupdateLineCount(idx)\n\t\t\t\t\t}\n\n\t\t\t\t\treturn SELFTAG, NONE, str[:], \"\", idx, Line\n\t\t\t\tcase ' ', '\\t', '\\n', '\\r', '\\f':\n\t\t\t\t\t// attributes\n\t\t\t\t\tidx++\n\t\t\t\t\tstart = idx\n\t\t\t\t\tch = text[idx]\n\t\t\t\t\tfor ch != '<' && ch != '>' {\n\t\t\t\t\t\tidx++\n\t\t\t\t\t\tch = text[idx]\n\t\t\t\t\t}\n\t\t\t\t\tif ch != '>' {\n\t\t\t\t\t\tfmt.Fprintf(os.Stderr, \"\\nAttributes not followed by right angle bracket\\n\")\n\t\t\t\t\t}\n\t\t\t\t\tif text[idx-1] == '/' {\n\t\t\t\t\t\t// self-closing\n\t\t\t\t\t\tatr := text[start : idx-1]\n\t\t\t\t\t\tidx++\n\n\t\t\t\t\t\tif CountLines {\n\t\t\t\t\t\t\tupdateLineCount(idx)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn SELFTAG, NONE, str[:], atr[:], idx, Line\n\t\t\t\t\t}\n\t\t\t\t\tatr := text[start:idx]\n\t\t\t\t\tidx++\n\n\t\t\t\t\tif CountLines {\n\t\t\t\t\t\tupdateLineCount(idx)\n\t\t\t\t\t}\n\n\t\t\t\t\treturn STARTTAG, NONE, str[:], atr[:], idx, Line\n\t\t\t\tdefault:\n\t\t\t\t\tif CountLines {\n\t\t\t\t\t\tfmt.Fprintf(os.Stderr, \"\\nUnexpected punctuation '%c' in XML element, line %d\\n\", ch, Line)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tfmt.Fprintf(os.Stderr, \"\\nUnexpected punctuation '%c' in XML element\\n\", ch)\n\t\t\t\t\t}\n\n\t\t\t\t\tif CountLines {\n\t\t\t\t\t\tupdateLineCount(idx)\n\t\t\t\t\t}\n\n\t\t\t\t\treturn STARTTAG, NONE, str[:], \"\", idx, Line\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t// punctuation character immediately after first angle bracket\n\t\t\t\tswitch ch {\n\t\t\t\tcase '/':\n\t\t\t\t\t// at start of end tag\n\t\t\t\t\tidx++\n\t\t\t\t\tstart = idx\n\t\t\t\t\tch = text[idx]\n\t\t\t\t\t// expect legal first character of element\n\t\t\t\t\tif InFirst[ch] {\n\t\t\t\t\t\tidx++\n\t\t\t\t\t\tch = text[idx]\n\t\t\t\t\t\tfor InElement[ch] {\n\t\t\t\t\t\t\tidx++\n\t\t\t\t\t\t\tch = text[idx]\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstr := text[start:idx]\n\t\t\t\t\t\tif ch != '>' {\n\t\t\t\t\t\t\tfmt.Fprintf(os.Stderr, \"\\nUnexpected characters after end element name\\n\")\n\t\t\t\t\t\t}\n\t\t\t\t\t\tidx++\n\n\t\t\t\t\t\tif CountLines {\n\t\t\t\t\t\t\tupdateLineCount(idx)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn STOPTAG, NONE, str[:], \"\", idx, Line\n\t\t\t\t\t}\n\t\t\t\t\tif CountLines {\n\t\t\t\t\t\tfmt.Fprintf(os.Stderr, \"\\nUnexpected punctuation '%c' in XML element, line %d\\n\", ch, Line)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tfmt.Fprintf(os.Stderr, \"\\nUnexpected punctuation '%c' in XML element\\n\", ch)\n\t\t\t\t\t}\n\t\t\t\tcase '?':\n\t\t\t\t\t// skip ?xml and ?processing instructions\n\t\t\t\t\tidx++\n\t\t\t\t\tch = text[idx]\n\t\t\t\t\tfor ch != '>' {\n\t\t\t\t\t\tidx++\n\t\t\t\t\t\tch = text[idx]\n\t\t\t\t\t}\n\t\t\t\t\tidx++\n\t\t\t\t\treturn NOTAG, NONE, \"\", \"\", idx, Line\n\t\t\t\tcase '!':\n\t\t\t\t\t// skip !DOCTYPE, !COMMENT, and ![CDATA[\n\t\t\t\t\tidx++\n\t\t\t\t\tstart = idx\n\t\t\t\t\tch = text[idx]\n\t\t\t\t\tWhich = NOTAG\n\t\t\t\t\tSkipTo = \"\"\n\t\t\t\t\tif ch == '[' && strings.HasPrefix(text[idx:], \"[CDATA[\") {\n\t\t\t\t\t\tWhich = CDATATAG\n\t\t\t\t\t\tSkipTo = \"]]>\"\n\t\t\t\t\t\tstart += 7\n\t\t\t\t\t} else if ch == '-' && strings.HasPrefix(text[idx:], \"--\") {\n\t\t\t\t\t\tWhich = COMMENTTAG\n\t\t\t\t\t\tSkipTo = \"-->\"\n\t\t\t\t\t\tstart += 2\n\t\t\t\t\t} else if ch == 'D' && strings.HasPrefix(text[idx:], \"DOCTYPE\") {\n\t\t\t\t\t\tWhich = DOCTYPETAG\n\t\t\t\t\t\tSkipTo = \">\"\n\t\t\t\t\t}\n\t\t\t\t\tif Which != NOTAG && SkipTo != \"\" {\n\t\t\t\t\t\twhich := Which\n\t\t\t\t\t\t// CDATA or COMMENT block may contain internal angle brackets\n\t\t\t\t\t\tfound := strings.Index(text[idx:], SkipTo)\n\t\t\t\t\t\tif found < 0 {\n\t\t\t\t\t\t\t// string stops in middle of CDATA or COMMENT\n\t\t\t\t\t\t\tstr := text[start:]\n\t\t\t\t\t\t\tif HasFlankingSpace(str) {\n\t\t\t\t\t\t\t\tstr = strings.TrimSpace(str)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// signal end of current block\n\t\t\t\t\t\t\tText = \"\"\n\n\t\t\t\t\t\t\tif CountLines {\n\t\t\t\t\t\t\t\tupdateLineCount(txtlen)\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// leave Which and SkipTo values unchanged as another continuation signal\n\t\t\t\t\t\t\t// send CDATA or COMMENT contents\n\t\t\t\t\t\t\treturn which, NONE, str[:], \"\", 0, Line\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// adjust position past end of CDATA or COMMENT\n\t\t\t\t\t\tidx += found\n\t\t\t\t\t\tstr := text[start:idx]\n\t\t\t\t\t\tif HasFlankingSpace(str) {\n\t\t\t\t\t\t\tstr = strings.TrimSpace(str)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tidx += len(SkipTo)\n\t\t\t\t\t\t// clear tracking variables\n\t\t\t\t\t\tWhich = NOTAG\n\t\t\t\t\t\tSkipTo = \"\"\n\t\t\t\t\t\t// send CDATA or COMMENT contents\n\t\t\t\t\t\treturn which, NONE, str[:], \"\", idx, Line\n\t\t\t\t\t}\n\t\t\t\t\t// otherwise just skip to next right angle bracket\n\t\t\t\t\tfor ch != '>' {\n\t\t\t\t\t\tidx++\n\t\t\t\t\t\tch = text[idx]\n\t\t\t\t\t}\n\t\t\t\t\tidx++\n\t\t\t\t\treturn NOTAG, NONE, \"\", \"\", idx, Line\n\t\t\t\tdefault:\n\t\t\t\t\tif CountLines {\n\t\t\t\t\t\tfmt.Fprintf(os.Stderr, \"\\nUnexpected punctuation '%c' in XML element, line %d\\n\", ch, Line)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tfmt.Fprintf(os.Stderr, \"\\nUnexpected punctuation '%c' in XML element\\n\", ch)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t} else if ch != '>' {\n\n\t\t\t// at start of contents\n\t\t\tstart = idx\n\n\t\t\thasMarkup := false\n\t\t\thasNonASCII := false\n\n\t\t\t// find end of contents\n\t\t\tif AllowEmbed {\n\n\t\t\t\tfor {\n\t\t\t\t\tfor InContent[ch] {\n\t\t\t\t\t\tidx++\n\t\t\t\t\t\tch = text[idx]\n\t\t\t\t\t}\n\t\t\t\t\t// set flags to speed up conditional content processing\n\t\t\t\t\tif ch == '&' {\n\t\t\t\t\t\tidx++\n\t\t\t\t\t\tch = text[idx]\n\t\t\t\t\t\tif ch == 'a' {\n\t\t\t\t\t\t\tif strings.HasPrefix(text[idx:], \"amp;\") {\n\t\t\t\t\t\t\t\thasMarkup = true\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else if ch == 'g' {\n\t\t\t\t\t\t\tif strings.HasPrefix(text[idx:], \"gt;\") {\n\t\t\t\t\t\t\t\thasMarkup = true\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else if ch == 'l' {\n\t\t\t\t\t\t\tif strings.HasPrefix(text[idx:], \"lt;\") {\n\t\t\t\t\t\t\t\thasMarkup = true\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tif ch > 127 {\n\t\t\t\t\t\thasNonASCII = true\n\t\t\t\t\t\tidx++\n\t\t\t\t\t\tch = text[idx]\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tif ch == '<' {\n\t\t\t\t\t\t// optionally allow HTML text formatting elements and super/subscripts\n\t\t\t\t\t\tadvance := HTMLAhead(text, idx)\n\t\t\t\t\t\tif advance > 0 {\n\t\t\t\t\t\t\tidx += advance\n\t\t\t\t\t\t\tch = text[idx]\n\t\t\t\t\t\t\tplainContent = false\n\t\t\t\t\t\t\tcontinue\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} else {\n\t\t\t\tfor ch != '<' && ch != '>' {\n\t\t\t\t\tidx++\n\t\t\t\t\tch = text[idx]\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// trim back past trailing blanks\n\t\t\tlst := idx - 1\n\t\t\tch = text[lst]\n\t\t\tfor InBlank[ch] && lst > start {\n\t\t\t\tlst--\n\t\t\t\tch = text[lst]\n\t\t\t}\n\n\t\t\tstr := text[start : lst+1]\n\n\t\t\tctype := PLAIN\n\n\t\t\tif AllowEmbed {\n\t\t\t\tif !plainContent {\n\t\t\t\t\tctype |= MIXED\n\t\t\t\t}\n\t\t\t\tif hasMarkup {\n\t\t\t\t\tctype |= AMPER\n\t\t\t\t}\n\t\t\t\tif hasNonASCII {\n\t\t\t\t\tctype |= ASCII\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif CountLines {\n\t\t\t\tupdateLineCount(idx)\n\t\t\t}\n\n\t\t\treturn CONTENTTAG, ctype, str[:], \"\", idx, Line\n\t\t}\n\n\t\treturn BADTAG, NONE, \"\", \"\", idx, Line\n\t}\n\n\t// StreamXML\n\n\t// stream all tokens through callback\n\n\tfor {\n\t\ttag, ctype, name, attr, idx, line := nextToken(Idx)\n\t\tIdx = idx\n\n\t\tif tag == BADTAG {\n\t\t\tif CountLines {\n\t\t\t\tfmt.Fprintf(os.Stderr, \"\\nERROR: Unparsable XML element, line %d\\n\", line)\n\t\t\t} else {\n\t\t\t\tfmt.Fprintf(os.Stderr, \"\\nERROR: Unparsable XML element\\n\")\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\n\t\ttkn := Token{tag, ctype, name, attr, idx, line}\n\n\t\ttokens(tkn)\n\n\t\tif tag == ISCLOSED {\n\t\t\tbreak\n\t\t}\n\t}\n}", "title": "" }, { "docid": "43d6753ad5cd8f01e80241f88d54ccbc", "score": "0.4696095", "text": "func (stream *Stream) parseStreamInfo() (block *meta.Block, err error) {\n\t// Verify FLAC signature.\n\tr := stream.r\n\tvar buf [4]byte\n\tif _, err = io.ReadFull(r, buf[:]); err != nil {\n\t\treturn block, err\n\t}\n\n\t// Skip prepended ID3v2 data.\n\tif bytes.Equal(buf[:3], id3Signature) {\n\t\tif err := stream.skipID3v2(); err != nil {\n\t\t\treturn block, err\n\t\t}\n\n\t\t// Second attempt at verifying signature.\n\t\tif _, err = io.ReadFull(r, buf[:]); err != nil {\n\t\t\treturn block, err\n\t\t}\n\t}\n\n\tif !bytes.Equal(buf[:], flacSignature) {\n\t\treturn block, fmt.Errorf(\"flac.parseStreamInfo: invalid FLAC signature; expected %q, got %q\", flacSignature, buf)\n\t}\n\n\t// Parse StreamInfo metadata block.\n\tblock, err = meta.Parse(r)\n\tif err != nil {\n\t\treturn block, err\n\t}\n\tsi, ok := block.Body.(*meta.StreamInfo)\n\tif !ok {\n\t\treturn block, fmt.Errorf(\"flac.parseStreamInfo: incorrect type of first metadata block; expected *meta.StreamInfo, got %T\", block.Body)\n\t}\n\tstream.Info = si\n\treturn block, nil\n}", "title": "" }, { "docid": "89e8f6cfca52ab7088a30d224484c21d", "score": "0.4695622", "text": "func newStream(bufsize int, replay bool) *Stream {\n\treturn &Stream{\n\t\tAutoReplay: replay,\n\t\tsubscribers: make([]*Subscriber, 0),\n\t\tregister: make(chan *Subscriber),\n\t\tderegister: make(chan *Subscriber),\n\t\tevent: make(chan *Event, bufsize),\n\t\tquit: make(chan bool),\n\t\tEventlog: make(EventLog, 0),\n\t}\n}", "title": "" }, { "docid": "212db7da5b6cdd5b6a837b93ec176184", "score": "0.4689327", "text": "func (p *Player) PlayStream(message *rtmp.Message) {\n\tswitch message.Type {\n\tcase rtmp.VIDEO_TYPE:\n\t\tif p.stat.VideoBytes == 0 {\n\t\t\tp.stat.VideoStartUpTime = time.Now().Unix() - p.start_command_time\n\t\t}\n\t\tif p.startedAt == 0 && p.stat.VideoBytes > 0 {\n\t\t\tp.startedAt = time.Now().Unix()\n\t\t}\n\t\tp.stat.VideoBytes += int64(message.Buf.Len())\n\t\tp.stat.TotalFrames++\n\tcase rtmp.AUDIO_TYPE:\n\t\tif p.stat.AudioBytes == 0 {\n\t\t\tp.stat.AudioStartUpTime = time.Now().Unix() - p.start_command_time\n\t\t}\n\t\tp.stat.AudioBytes += int64(message.Buf.Len())\n\t}\n}", "title": "" }, { "docid": "d6af7a2af2124cff0c5f028e01dfadc5", "score": "0.46867028", "text": "func UpdateStream(o *authoperator.AuthOperator, writer http.ResponseWriter, request *http.Request, logger *log.Entry) (int, string) {\n\t_, _, _, streampath := restcore.GetStreamPath(request)\n\n\tvar supdate map[string]interface{}\n\terr := restcore.UnmarshalRequest(request, &supdate)\n\n\tif err = o.UpdateStream(streampath, supdate); err != nil {\n\t\treturn restcore.WriteError(writer, logger, http.StatusForbidden, err, false)\n\t}\n\ts, err := o.ReadStream(streampath)\n\treturn restcore.JSONWriter(writer, s, logger, err)\n}", "title": "" }, { "docid": "bc435682661851e21cf896327b6f3bce", "score": "0.46864408", "text": "func newStream(name, subject string, config *proto.StreamConfig, creationTime time.Time,\n\tsrvConfig *Config) *stream {\n\n\ts := &stream{\n\t\tname: name,\n\t\tsubject: subject,\n\t\tconfig: config,\n\t\tpartitions: make(map[int32]*partition),\n\t\tcreationTime: creationTime,\n\t}\n\tif isReservedStream(name) {\n\t\tapplyReservedStreamOverrides(s, srvConfig)\n\t}\n\treturn s\n}", "title": "" }, { "docid": "edf6ec95d270c438fd67566cce0f2ece", "score": "0.4685338", "text": "func (dht *DHT) OpenedStream(s p2p.Stream) {\n\n}", "title": "" }, { "docid": "e62d9bfd64d08ca3dc2441acc51173da", "score": "0.46721408", "text": "func Stream(name string, src io.Reader) (tokens <-chan token.Value) {\n\tL := &lexer{\n\t\tstream: newStream(name, bufio.NewReader(src), &bytes.Buffer{}),\n\t\ttokens: make(chan token.Value),\n\t}\n\tgo run(L)\n\treturn L.tokens\n}", "title": "" }, { "docid": "0a14502723360e7bcfa8dcfde311872c", "score": "0.46686977", "text": "func (t* Textile) RequestStream(pid string, config *pb.StreamRequest) (*pb.Envelope, error){\n\treturn t.stream.SendStreamRequest(pid, config)\n}", "title": "" }, { "docid": "520983a5297b01213e996a3ca9b82970", "score": "0.4659189", "text": "func (t *Type) parse(ts *tokenStream) *Type {\n\tswitch ts.token {\n\tcase \"*\":\n\t\tts.next()\n\t\tt.parsePtr(ts)\n\tcase \"[\":\n\t\tts.next()\n\t\tt.parseArray(ts)\n\tcase \"map\":\n\t\tts.next()\n\t\tt.parseMap(ts)\n\tcase \"func\":\n\t\tts.next()\n\t\tt.parseFunc(ts)\n\tcase \"chan\", \"<-chan\", \"chan<-\":\n\t\t// note that we want to see what kind of channel\n\t\tt.parseChan(ts)\n\tcase \"struct\":\n\t\tts.next()\n\t\tt.parseStruct(ts)\n\tcase \"interface\":\n\t\tts.next()\n\t\tt.parseInterface(ts)\n\tdefault:\n\t\tt.parseOther(ts)\n\t}\n\treturn t\n}", "title": "" }, { "docid": "064983d69b7df8f8ce312bf92a2228a8", "score": "0.46583796", "text": "func OpenStream(store *Store, model Model, token []byte, receiver Receiver) *Stream {\n\t// create stream\n\ts := &Stream{\n\t\tstore: store,\n\t\tmodel: model,\n\t\ttoken: token,\n\t\treceiver: receiver,\n\t}\n\n\t// open stream\n\ts.tomb.Go(s.open)\n\n\treturn s\n}", "title": "" }, { "docid": "05dab717c3055b6095cbf76aa16cc467", "score": "0.46496746", "text": "func Stream(out chan Process) error {\n\thandle, err := Open(0)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer handle.Close()\n\n\thandle.SetBufSize(\"4m\")\n\n\t// prog, err := handle.Compile(\"syscall:::entry { printf(\\\"PID: %d Execname: %s Probefunc: %s\\\\n\\\", pid, execname, probefunc)}\", ProbeSpecName, C_PSPEC, nil)\n\n\t// dtrace command prints fake xml\n\tprog, err := handle.Compile(\"syscall:::entry { printf(\\\"<Process><PID>%d</PID><Execname>%s</Execname><Probefunc>%s</Probefunc></Process>\\\\n\\\", pid, execname, probefunc)}\", ProbeSpecName, C_PSPEC, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = handle.Exec(prog)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tpr, err := handle.ConsumePipe()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer pr.Close()\n\n\tvar p Process\n\terrChan := make(chan error)\n\n\tgo func() {\n\t\tscanner := bufio.NewScanner(pr)\n\t\tfor scanner.Scan() {\n\t\t\terr := xml.Unmarshal([]byte(scanner.Text()), &p)\n\t\t\tif err != nil {\n\t\t\t\terrChan <- err\n\t\t\t}\n\t\t\tout <- p\n\t\t}\n\t}()\n\n\tif err := handle.Go(); err != nil {\n\t\treturn err\n\t}\n\n\tfor {\n\t\tstatus, err := handle.Run()\n\t\tif err != nil {\n\t\t\t// return fmt.Errorf(\"run error: %v\", err) // TODO - occassional errors - should we send on errchan?\n\t\t\tfmt.Errorf(\"run error: %v\", err)\n\t\t\tcontinue\n\t\t}\n\t\tif !status.IsOK() {\n\t\t\tbreak\n\t\t}\n\n\t\t// Errors from scan/marshalling\n\t\t// TODO - Not return on error?\n\t\terr = <-errChan\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "29d4d1149e09d060592cc70a1ed55d71", "score": "0.46438852", "text": "func UnmarshalFromStream(reader io.Reader, out interface{}) (err error) {\n\tlenbuf := make([]byte, 4)\n\tvar n int\n\tn, err = io.ReadFull(reader, lenbuf)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif n != 4 {\n\t\treturn io.ErrUnexpectedEOF\n\t}\n\tlength := Pack.Uint32(lenbuf)\n\tb := make([]byte, length)\n\tPack.PutUint32(b, length)\n\tn, err = io.ReadFull(reader, b[4:])\n\tif err != nil {\n\t\tif err == io.EOF {\n\t\t\treturn io.ErrUnexpectedEOF\n\t\t}\n\t\treturn err\n\t}\n\tif n != int(length-4) {\n\t\treturn io.ErrUnexpectedEOF\n\t}\n\tif out == nil {\n\t\treturn nil\n\t}\n\treturn bson.Unmarshal(b, out)\n}", "title": "" }, { "docid": "8a05238be1ff0b47089ef0d55462a24b", "score": "0.46386212", "text": "func New(data []byte) (*Stream, error) {\n\ts := &Stream{}\n\tst := stateInit\n\tb := &bytes.Buffer{}\n\n\tfor o := 0; o < len(data); o++ {\n\t\tch := data[o]\n\t\tswitch st {\n\t\t// Init state: Not currently reading any token.\n\t\tcase stateInit:\n\t\t\tswitch {\n\t\t\tcase isSpace(ch):\n\t\t\t\t// pass\n\t\t\tcase ch == '-':\n\t\t\t\tb.WriteByte(ch)\n\t\t\t\tst = stateSign\n\t\t\tcase isDigit(ch):\n\t\t\t\tb.WriteByte(ch)\n\t\t\t\tst = stateNum\n\t\t\tcase ch == '\"':\n\t\t\t\tst = stateQuote\n\t\t\tdefault:\n\t\t\t\treturn nil, fmt.Errorf(\"Unexpected character '%c' at offset %d (state Init)\", ch, o)\n\t\t\t}\n\n\t\t// Sign state: Read the initial '-' of a negative integer.\n\t\tcase stateSign:\n\t\t\tswitch {\n\t\t\tcase isDigit(ch):\n\t\t\t\tb.WriteByte(ch)\n\t\t\t\tst = stateNum\n\t\t\tdefault:\n\t\t\t\treturn nil, fmt.Errorf(\"Unexpected character '%c' at offset %d (state Sign)\", ch, o)\n\t\t\t}\n\n\t\t// Num state: Now reading an integer.\n\t\tcase stateNum:\n\t\t\tswitch {\n\t\t\tcase isSpace(ch):\n\t\t\t\tval, err := strconv.Atoi(b.String())\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\"Internal error converting '%s' to int at offset %d (state Num)\", b.String(), o)\n\t\t\t\t}\n\t\t\t\ts.tokens = append(s.tokens, token{typeInt, val})\n\t\t\t\tb.Reset()\n\t\t\t\tst = stateInit\n\t\t\tcase isDigit(ch):\n\t\t\t\tb.WriteByte(ch)\n\t\t\tdefault:\n\t\t\t\treturn nil, fmt.Errorf(\"Unexpected character '%c' at offset %d (state Num)\", ch, o)\n\t\t\t}\n\n\t\t// Quote state: Read the initial '\"' of a string.\n\t\tcase stateQuote:\n\t\t\tswitch {\n\t\t\tcase ch == '\\\\':\n\t\t\t\tst = stateEscape\n\t\t\tcase ch == '\"':\n\t\t\t\ts.tokens = append(s.tokens, token{typeStr, b.String()})\n\t\t\t\tb.Reset()\n\t\t\t\tst = stateInit\n\t\t\tdefault:\n\t\t\t\tb.WriteByte(ch)\n\t\t\t}\n\n\t\t// Escape state: Read the next character in a string unconditionally.\n\t\tcase stateEscape:\n\t\t\tb.WriteByte(ch)\n\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"Internal error: unknown state %d\", st)\n\t\t}\n\t}\n\n\treturn s, nil\n}", "title": "" }, { "docid": "332f75d5d2f35db28d7064f2a2d8a79a", "score": "0.4638534", "text": "func NewStream(buf []byte) Stream {\n\tif len(buf) == 0 {\n\t\tif cap(buf) > 0 {\n\t\t\treturn Stream{buf: buf}\n\t\t}\n\t\t// max MTU size seems like a good default\n\t\treturn NewWritingStream(1500)\n\t}\n\treturn Stream {\n\t\tbuf: buf,\n\t\tpos: 0,\n\t\treading: true,\n\t}\n}", "title": "" }, { "docid": "56c635fe20f550ed54159fd20e9623f0", "score": "0.4632032", "text": "func (t testConn) NewStream() (network.Stream, error) { return nil, nil }", "title": "" }, { "docid": "3919c9e504fee3f60f5c8a8812ae51fb", "score": "0.4631397", "text": "func newStream(id uint32, niceness uint8, frameSize int, writeTokenBucketSize int32, sess *Session) *Stream {\n\ts := new(Stream)\n\ts.niceness = niceness\n\ts.id = id\n\ts.chReadEvent = make(chan struct{}, 1)\n\ts.frameSize = frameSize\n\ts.sess = sess\n\ts.die = make(chan struct{})\n\ts.writeTokenBucket = writeTokenBucketSize\n\ts.writeTokenBucketNotify = make(chan struct{}, 1)\n\treturn s\n}", "title": "" }, { "docid": "4172e66d875f669247200ff56c2bb3be", "score": "0.4631278", "text": "func (m *Last) StreamFeature(_ context.Context, _ string) (stravaganza.Element, error) {\n\treturn nil, nil\n}", "title": "" }, { "docid": "7ed6318ff93bedc19ea418a043be16bd", "score": "0.46307832", "text": "func (sHandler *StreamingHandler) StreamProgramStart(msg *MP.Message) {\n\t// Store the program in the supernodes\n\tvar controlData SDataType.StreamControlMsg\n\tMP.DecodeData(&controlData, msg.Data)\n\tsHandler.ProgramList[controlData.SrcName] = msg.Data\n\n\t//Notify the children the new program\n\tfmt.Println(\"New programs detected! Sending to all children\")\n\tfor _, child := range(sHandler.superNodeContext.Nodes){\n\t\tsHandler.mp.Send(MP.NewMessage(child.IP, \"\", \"streaming_new_program\", msg.Data))\n\t}\n\n}", "title": "" }, { "docid": "53fe7ac640a9468a0994638d0f1d9a1d", "score": "0.4630012", "text": "func (v *VTerm) ProcessStream() {\n\tfor {\n\t\tnext, ok := v.pullRune()\n\t\tif !ok {\n\t\t\treturn\n\t\t}\n\n\t\tif next > 127 {\n\t\t\tvalue := []byte{byte(next)}\n\n\t\t\tleadingHex := next >> 4\n\t\t\tswitch leadingHex {\n\t\t\tcase 12: // 1100\n\t\t\t\tvalue = append(value, byte(v.pullRuneNoErr()))\n\t\t\tcase 14: // 1110\n\t\t\t\tvalue = append(value, byte(v.pullRuneNoErr()))\n\t\t\t\tvalue = append(value, byte(v.pullRuneNoErr()))\n\t\t\tcase 15: // 1111\n\t\t\t\tvalue = append(value, byte(v.pullRuneNoErr()))\n\t\t\t\tvalue = append(value, byte(v.pullRuneNoErr()))\n\t\t\t\tvalue = append(value, byte(v.pullRuneNoErr()))\n\t\t\t}\n\n\t\t\tnext, _ = utf8.DecodeRune(value)\n\t\t}\n\n\t\tswitch next {\n\t\tcase 0:\n\t\tcase '\\x1b':\n\t\t\tv.handleEscapeCode()\n\t\tcase 8:\n\t\t\tif v.Cursor.X > 0 {\n\t\t\t\tv.shiftCursorX(-1)\n\t\t\t}\n\t\tcase '\\n':\n\t\t\tif v.Cursor.Y == v.scrollingRegion.bottom {\n\t\t\t\tv.scrollUp(1)\n\t\t\t} else {\n\t\t\t\tv.shiftCursorY(1)\n\t\t\t}\n\t\tcase '\\r':\n\t\t\tv.setCursorX(0)\n\t\tcase '\\t':\n\t\t\ttabWidth := 8\n\t\t\tv.Cursor.X += tabWidth - (v.Cursor.X % tabWidth)\n\t\tdefault:\n\t\t\tif unicode.IsPrint(next) {\n\t\t\t\tif v.Cursor.X < 0 {\n\t\t\t\t\tv.setCursorX(0)\n\t\t\t\t}\n\t\t\t\tif v.Cursor.Y < 0 {\n\t\t\t\t\tv.setCursorY(0)\n\t\t\t\t}\n\n\t\t\t\tif v.Cursor.X > v.w-1 {\n\t\t\t\t\tv.setCursorX(0)\n\t\t\t\t\tif v.Cursor.Y == v.scrollingRegion.bottom {\n\t\t\t\t\t\tv.scrollUp(1)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tv.shiftCursorY(1)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tv.putChar(next)\n\t\t\t} else {\n\t\t\t\tlog.Printf(\"Unrecognized unprintable rune: %x\", next)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "80ba252169e08918d6057f9a5edb87dc", "score": "0.4628309", "text": "func GetStream() {\n\tclient := GetClient()\n\trequest := GetRequest()\n\tlog.Printf(\"Request: %v\", request)\n\tresponse, err := client.Do(request)\n\tif err != nil {\n\t\tlog.Fatal(err, response)\n\t}\n\tdefer response.Body.Close()\n\tlog.Println(\"Response:\", response.StatusCode, response.Status)\n\treader := bufio.NewReader(response.Body)\n\tvar body message\n\tTreatResponse(reader, &body)\n}", "title": "" }, { "docid": "6ec36270285fe6af080b001b6edbb529", "score": "0.46160904", "text": "func ParseFile(path string) (stream *Stream, err error) {\n\tf, err := os.Open(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tstream, err = Parse(f)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tstream.c = f\n\treturn stream, err\n}", "title": "" }, { "docid": "e3024acf4f24c16cb41f3ee0c38aa516", "score": "0.46115488", "text": "func (c *Context) Stream(code int, contentType string, r io.Reader) (err error) {\n\tc.setContentTypeAndCode(code, contentType)\n\t_, err = io.CopyBuffer(c.res, r, make([]byte, 2048))\n\treturn\n}", "title": "" }, { "docid": "a86febb1ab62624cdd3a6d128836459c", "score": "0.46095103", "text": "func (stage *WAVEMQFrontendStage) SetUpstream(upstream Stage) {\n\t//has no upstream\n}", "title": "" }, { "docid": "551781e650242b1709bafdd5e93692af", "score": "0.46036986", "text": "func NewStream(name string, grouping StreamGrouping) *Stream {\n\treturn &Stream{\n\t\tName: name,\n\t\tGrouping: grouping,\n\t}\n}", "title": "" }, { "docid": "5281829743c8706a060d35ba3ed02855", "score": "0.45959446", "text": "func (s *grpcServer) ProduceStream(\n\tstream api.Log_ProduceStreamServer,\n) error {\n\tfor {\n\t\treq, err := stream.Recv()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tres, err := s.Produce(stream.Context(), req)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err = stream.Send(res); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c5a1d33bd229538b0f280df3c9a5bf2b", "score": "0.4585718", "text": "func streamLoop(segmentNumber int, currentURL string,\n\tinitBuffer int, maxBuffer int, codecName string, codec string, urlString string, urlInput []string,\n\tmpdList []http.MPD, adapt string, maxHeight int, isByteRangeMPD bool, startTime time.Time,\n\tnextRunTime time.Time, arrivalTime int, oldMPDIndex int, nextSegmentNumber int, hls string,\n\thlsBool bool, mapSegmentLogPrintout map[int]logging.SegPrintLogInformation, streamDuration int, extendPrintLog bool,\n\thlsUsed bool, bufferLevel int, segmentDurationTotal int, quic string, quicBool bool, baseURL string,\n\tdebugLog bool, Noden P2Pconsul.NodeUrl) (int, map[int]logging.SegPrintLogInformation) {\n\t// Collaborative Code - End\n\tlogging.DebugPrint(glob.DebugFile, debugLog, \"\\nDEBUG: \", \"In stream loop\")\n\t// variable for rtt for this segment\n\tvar rtt time.Duration\n\t// has this chunk been replaced by hls\n\tvar hlsReplaced = \"no\"\n\t// if we undertake HLS, we need to revise the buffer values\n\t//var bufferDifference int\n\t// if we set this chunk to HLS used\n\tif hlsUsed {\n\t\thlsReplaced = \"yes\"\n\t}\n\tvar segURL string\n\n\t// save point for the HTTP protocol used\n\tvar protocol string\n\n\t//\n\tvar segmentFileName string\n\t/*\n\t * Function :\n\t * let's think about HLS - chunk replacement\n\t * before we decide what chunks to change, lets create a file for HLS\n\t * then add functions to switch out an old chunk\n\t */\n\t// only use HLS if we have at least one segment to replacement\n\t/*if hlsBool && segmentNumber > 1 {\n\t\tswitch hls {\n\t\t// passive - least amount of replacement\n\t\tcase glob.HlsOn:\n\t\t\tif segmentNumber == 6 {\n\t\t\t\t// hlsUsed is set to true\n\t\t\t\tchunkReplace := 5\n\t\t\t\tvar thisRunTimeVal int\n\t\t\t\t// replace a previously downloaded segment with this call\n\t\t\t\tnextSegmentNumber, mapSegmentLogPrintout, bufferDifference, thisRunTimeVal, nextRunTime =\n\t\t\t\t\thlsFunc.GetHlsSegment(streamLoop, chunkReplace, mapSegmentLogPrintout, maxHeight, urlInput,\n\t\t\t\t\t\tinitBuffer, maxBuffer, codecName, codec, urlString, mpdList, nextSegmentNumber, extendPrintLog,\n\t\t\t\t\t\tstartTime, nextRunTime, arrivalTime, true, quic, quicBool, baseURL, glob.DebugFile, debugLog,\n\t\t\t\t\t\tglob.RepRateBaseURL)\n\n\t\t\t\t// change the current buffer to reflect the time taken to get this HLS segment\n\t\t\t\tbufferLevel -= (thisRunTimeVal + bufferDifference)\n\n\t\t\t\t// change the buffer levels of the previous chunks, so the printout reflects this value\n\t\t\t\tmapSegmentLogPrintout = hlsFunc.ChangeBufferLevels(mapSegmentLogPrintout, segmentNumber, chunkReplace, bufferDifference)\n\t\t\t}\n\t\t}\n\t}\n\n\t*/\n\n\t// if we have changed the MPD, we need to update some variables\n\tif oldMPDIndex != mpdListIndex {\n\n\t\t// set the new mpdListIndex\n\t\tmpdListIndex = oldMPDIndex\n\t\t// get the current url - trim any white space\n\t\tcurrentURL = strings.TrimSpace(urlInput[mpdListIndex])\n\t\tlogging.DebugPrint(glob.DebugFile, debugLog, \"\\nDEBUG: \", \"current URL header: \"+currentURL)\n\n\t\t// get the relavent values from this MPD\n\t\tstreamDuration, maxBufferLevel, highestMPDrepRateIndex, lowestMPDrepRateIndex, segmentDurationArray, bandwithList, baseURL = http.GetMPDValues(mpdList, mpdListIndex, maxHeight, streamDuration, maxBuffer, currentMPDRepAdaptSet, isByteRangeMPD, debugLog)\n\n\t\t// current segment duration\n\t\tsegmentDuration = segmentDurationArray[mpdListIndex]\n\n\t\t// ONLY CHANGE THE NUMBER OF SEGMENTS HERE\n\t\t//\tnumSegments := streamDuration / segmentDuration\n\n\t\t//\tfmt.Println(segmentNumber)\n\t\t//\tfmt.Println(segmentDuration)\n\t\t//\tfmt.Println(numSegments)\n\n\t\t// determine if the passed in codec is one of the codecs we use (checking the current MPD)\n\t\tusedCodec, codecIndex = utils.FindInStringArray(codecList[mpdListIndex], codec)\n\t\t// check the codec and print error is false\n\t\tif !usedCodec {\n\t\t\t// print error message\n\t\t\tfmt.Printf(\"*** -\" + codecName + \" \" + codec + \" is not in the provided MPD, please check \" + urlString + \" ***\\n\")\n\t\t\t// stop the app\n\t\t\tutils.StopApp()\n\t\t}\n\t\t// save the current MPD Rep_rate Adaptation Set\n\t\tcurrentMPDRepAdaptSet = codecIndexList[mpdListIndex][codecIndex]\n\t}\n\n\t// break out if we have downloaded all of our segments\n\t// which is current segment duration total plus the next segment to be downloaded\n\t// if segmentDurationTotal+(segmentDuration*glob.Conversion1000) > streamDuration {\n\tif segmentDurationTotal >= streamDuration {\n\t\tlogging.DebugPrint(glob.DebugFile, debugLog, \"\\nDEBUG: \", \"We have downloaded all segments at the end of the streamLoop \"+strconv.Itoa(segmentDurationTotal+(segmentDuration*glob.Conversion1000)))\n\t\treturn segmentNumber, mapSegmentLogPrintout\n\t}\n\n\t// keep rep_rate within the index boundaries\n\t// MISL - might cause problems\n\tif repRate < highestMPDrepRateIndex {\n\t\tlogging.DebugPrint(glob.DebugFile, debugLog, \"DEBUG: \", \"Changing rep_rate index: from \"+strconv.Itoa(repRate)+\" to \"+strconv.Itoa(highestMPDrepRateIndex))\n\t\trepRate = highestMPDrepRateIndex\n\t}\n\n\t// get the segment\n\tif isByteRangeMPD {\n\t\tsegURL, startRange, endRange = http.GetNextByteRangeURL(mpdList[mpdListIndex], segmentNumber, repRate, currentMPDRepAdaptSet)\n\t\tlogging.DebugPrint(glob.DebugFile, debugLog, \"DEBUG: \", \"byte start range: \"+strconv.Itoa(startRange))\n\t\tlogging.DebugPrint(glob.DebugFile, debugLog, \"DEBUG: \", \"byte end range: \"+strconv.Itoa(endRange))\n\t} else {\n\t\tsegURL = http.GetNextSegment(mpdList[mpdListIndex], segmentNumber, repRate, currentMPDRepAdaptSet)\n\t}\n\tlogging.DebugPrint(glob.DebugFile, debugLog, \"DEBUG: \", \"current segment baseURL+segURL: \"+baseURL+segURL)\n\t// Start Time of this segment\n\n\t// Collaborative Code - Start\n\tOriginalUrl := currentURL\n\tOriginalBaseUrl := baseURL\n\n\turlHeaderString := http.JoinURL(currentURL, baseURL+segURL, debugLog)\n\t//search local network for url content if in collaborative mode\n\tif Noden.ClientName != \"off\" {\n\t\tcurrentURL = Noden.Search(urlHeaderString)\n\t\t//process returned url\n\t\tlogging.DebugPrint(glob.DebugFile, debugLog, \"\\nDEBUG: \", \"current URL joined: \"+currentURL)\n\t\tcurrentURL = strings.Split(currentURL, \"::\")[0]\n\t\tlogging.DebugPrint(glob.DebugFile, debugLog, \"\\nDEBUG: \", \"current URL joined: \"+currentURL)\n\t\turlSplit := strings.Split(currentURL, \"/\")\n\t\tlogging.DebugPrint(glob.DebugFile, debugLog, \"\\nDEBUG: \", \"current URL joined: \"+urlSplit[len(urlSplit)-1])\n\t}\n\tcurrentTime := time.Now()\n\t// Collaborative Code - End\n\t// Download the segment - add the segment duration to the file name\n\tswitch adapt {\n\tcase glob.ConventionalAlg:\n\t\trtt, segSize, protocol, segmentFileName = http.GetFile(currentURL, baseURL+segURL, fileDownloadLocation, isByteRangeMPD, startRange, endRange, segmentNumber, segmentDuration, true, quicBool, glob.DebugFile, debugLog, useTestbedBool, repRate)\n\tcase glob.ElasticAlg:\n\t\trtt, segSize, protocol, segmentFileName = http.GetFile(currentURL, baseURL+segURL, fileDownloadLocation, isByteRangeMPD, startRange, endRange, segmentNumber, segmentDuration, true, quicBool, glob.DebugFile, debugLog, useTestbedBool, repRate)\n\tcase glob.ProgressiveAlg:\n\t\trtt, segSize = http.GetFileProgressively(currentURL, baseURL+segURL, fileDownloadLocation, isByteRangeMPD, startRange, endRange, segmentNumber, segmentDuration, true, debugLog)\n\tcase glob.LogisticAlg:\n\t\trtt, segSize, protocol, segmentFileName = http.GetFile(currentURL, baseURL+segURL, fileDownloadLocation, isByteRangeMPD, startRange, endRange, segmentNumber, segmentDuration, true, quicBool, glob.DebugFile, debugLog, useTestbedBool, repRate)\n\tcase glob.MeanAverageAlg:\n\t\trtt, segSize, protocol, segmentFileName = http.GetFile(currentURL, baseURL+segURL, fileDownloadLocation, isByteRangeMPD, startRange, endRange, segmentNumber, segmentDuration, true, quicBool, glob.DebugFile, debugLog, useTestbedBool, repRate)\n\tcase glob.GeomAverageAlg:\n\t\trtt, segSize, protocol, segmentFileName = http.GetFile(currentURL, baseURL+segURL, fileDownloadLocation, isByteRangeMPD, startRange, endRange, segmentNumber, segmentDuration, true, quicBool, glob.DebugFile, debugLog, useTestbedBool, repRate)\n\tcase glob.EMWAAverageAlg:\n\t\trtt, segSize, protocol, segmentFileName = http.GetFile(currentURL, baseURL+segURL, fileDownloadLocation, isByteRangeMPD, startRange, endRange, segmentNumber, segmentDuration, true, quicBool, glob.DebugFile, debugLog, useTestbedBool, repRate)\n\tcase glob.TestAlg:\n\t\trtt, segSize, protocol, segmentFileName = http.GetFile(currentURL, baseURL+segURL, fileDownloadLocation, isByteRangeMPD, startRange, endRange, segmentNumber, segmentDuration, true, quicBool, glob.DebugFile, debugLog, useTestbedBool, repRate)\n\tcase glob.ArbiterAlg:\n\t\trtt, segSize, protocol, segmentFileName = http.GetFile(currentURL, baseURL+segURL, fileDownloadLocation, isByteRangeMPD, startRange, endRange, segmentNumber, segmentDuration, true, quicBool, glob.DebugFile, debugLog, useTestbedBool, repRate)\n\tcase glob.BBAAlg:\n\t\trtt, segSize, protocol, segmentFileName = http.GetFile(currentURL, baseURL+segURL, fileDownloadLocation, isByteRangeMPD, startRange, endRange, segmentNumber, segmentDuration, true, quicBool, glob.DebugFile, debugLog, useTestbedBool, repRate)\n\t}\n\n\t// arrival and delivery times for this segment\n\tarrivalTime = int(time.Since(startTime).Nanoseconds() / (glob.Conversion1000 * glob.Conversion1000))\n\tdeliveryTime := int(time.Since(currentTime).Nanoseconds() / (glob.Conversion1000 * glob.Conversion1000)) //Time in milliseconds\n\tthisRunTimeVal := int(time.Since(nextRunTime).Nanoseconds() / (glob.Conversion1000 * glob.Conversion1000))\n\n\tnextRunTime = time.Now()\n\n\t// some times we want to wait for an initial number of segments before stream begins\n\t// no need to do asny printouts when we are replacing this chunk\n\t// && !hlsReplaced\n\tif initBuffer <= waitToPlayCounter {\n\n\t\t// get the segment less the initial buffer\n\t\t// this needs to be based on running time and not based on number segments\n\t\t// I'll need a function for this\n\t\t//playoutSegmentNumber := segmentNumber - initBuffer\n\n\t\t// only print this out if we are not hls replaced\n\t\tif !hlsUsed {\n\t\t\t// print out the content of the segment that is currently passed to the player\n\t\t\tlogging.PrintPlayOutLog(arrivalTime, initBuffer, mapSegmentLogPrintout, glob.LogDownload, printLog, printHeadersData)\n\t\t}\n\n\t\t// get the current buffer (excluding the current segment)\n\t\tcurrentBuffer := (bufferLevel - thisRunTimeVal)\n\n\t\t// if we have a buffer level then we have no stalls\n\t\tif currentBuffer >= 0 {\n\t\t\tstallTime = 0\n\n\t\t\t// if the buffer is empty, then we need to calculate\n\t\t} else {\n\t\t\tstallTime = currentBuffer\n\t\t}\n\n\t\t// To have the bufferLevel we take the max between the remaining buffer and 0, we add the duration of the segment we downloaded\n\t\tbufferLevel = utils.Max(bufferLevel-thisRunTimeVal, 0) + (segmentDuration * glob.Conversion1000)\n\n\t\t// increment the waitToPlayCounter\n\t\twaitToPlayCounter++\n\n\t} else {\n\t\t// add to the current buffer before we start to play\n\t\tbufferLevel += (segmentDuration * glob.Conversion1000)\n\t\t// increment the waitToPlayCounter\n\t\twaitToPlayCounter++\n\t}\n\n\t// check if the buffer level is higher than the max buffer\n\tif bufferLevel > maxBuffer*glob.Conversion1000 {\n\t\t// retrieve the time it is going to sleep from the buffer level\n\t\t// sleep until the max buffer level is reached\n\t\tsleepTime := bufferLevel - (maxBuffer * glob.Conversion1000)\n\t\t// sleep\n\t\ttime.Sleep(time.Duration(sleepTime) * time.Millisecond)\n\n\t\t// reset the buffer to the new value less sleep time - should equal maxBuffer\n\t\tbufferLevel -= sleepTime\n\t}\n\n\t// some times we want to wait for an initial number of segments before stream begins\n\t// if we are going to print out some additonal log headers, then get these values\n\tif extendPrintLog && initBuffer < waitToPlayCounter {\n\t\t// base the play out position on the buffer level\n\t\tplayPosition = segmentDurationTotal + (segmentDuration * glob.Conversion1000) - bufferLevel\n\t\t// we need to keep a tab on the different size segments - use this for now\n\t\tsegmentDurationTotal += (segmentDuration * glob.Conversion1000)\n\t} else {\n\t\tsegmentDurationTotal += (segmentDuration * glob.Conversion1000)\n\t}\n\n\t// if we are going to print out some additonal log headers, then get these values\n\tif extendPrintLog {\n\n\t\t// get the current codec\n\t\trepCodec = mpdList[mpdListIndex].Periods[0].AdaptationSet[currentMPDRepAdaptSet].Representation[repRate].Codecs\n\n\t\t// change the codec into something we can understand\n\t\tswitch {\n\t\tcase strings.Contains(repCodec, \"avc\"):\n\t\t\t// set the inital rep_rate to the lowest value\n\t\t\trepCodec = glob.RepRateCodecAVC\n\t\tcase strings.Contains(repCodec, \"hev\"):\n\t\t\trepCodec = glob.RepRateCodecHEVC\n\t\tcase strings.Contains(repCodec, \"vp\"):\n\t\t\trepCodec = glob.RepRateCodecVP9\n\t\tcase strings.Contains(repCodec, \"av1\"):\n\t\t\trepCodec = glob.RepRateCodecAV1\n\t\t}\n\n\t\t// get rep_rate height, width and frames per second\n\t\trepHeight = mpdList[mpdListIndex].Periods[0].AdaptationSet[currentMPDRepAdaptSet].Representation[repRate].Height\n\t\trepWidth = mpdList[mpdListIndex].Periods[0].AdaptationSet[currentMPDRepAdaptSet].Representation[repRate].Width\n\t\trepFps = mpdList[mpdListIndex].Periods[0].AdaptationSet[currentMPDRepAdaptSet].Representation[repRate].FrameRate\n\t}\n\n\t// calculate the throughtput (we get the segSize while downloading the file)\n\t// multiple segSize by 8 to get bits and not bytes\n\tthr := algo.CalculateThroughtput(segSize*8, deliveryTime)\n\n\t// save the bitrate from the input segment (less the header info)\n\tvar kbps float64\n\tif getQoEBool {\n\t\tkbps = qoe.GetKBPS(segmentFileName, int64(segmentDuration), debugLog, isByteRangeMPD, segSize)\n\n\t\t// lets move the logic setup for the QoE values from the algorithms to player\n\t\t// we don't need to save the segRate as this is also called 'Bandwidth'\n\t\t// segRate := float64(log[j].Bandwidth)\n\n\t\t// add this to the seg rate slice\n\t\tif segmentNumber > 1 {\n\t\t\t// append to the segRates list\n\t\t\tsegRates = append(mapSegmentLogPrintout[segmentNumber-1].SegmentRates, float64(bandwithList[repRate]))\n\t\t\t// sum the seg rates\n\t\t\tsumSegRate = mapSegmentLogPrintout[segmentNumber-1].SumSegRate + float64(bandwithList[repRate])\n\t\t\t// sum the total stall duration\n\t\t\ttotalStallDur = float64(mapSegmentLogPrintout[segmentNumber-1].StallTime) + float64(stallTime)\n\t\t\t// get the number of stalls\n\t\t\tif stallTime > 0 {\n\t\t\t\t// increment the number of stalls\n\t\t\t\tnStalls = mapSegmentLogPrintout[segmentNumber-1].NumStalls + 1\n\t\t\t} else {\n\t\t\t\t// otherwise save the number of stalls from the previous log\n\t\t\t\tnStalls = mapSegmentLogPrintout[segmentNumber-1].NumStalls\n\t\t\t}\n\t\t\t// get the number of switches\n\t\t\tif bandwithList[repRate] == mapSegmentLogPrintout[segmentNumber-1].Bandwidth {\n\t\t\t\t// store the previous value of switches\n\t\t\t\tnSwitches = mapSegmentLogPrintout[segmentNumber-1].NumSwitches\n\t\t\t} else {\n\t\t\t\t// increment the number of switches\n\t\t\t\tnSwitches = mapSegmentLogPrintout[segmentNumber-1].NumSwitches + 1\n\t\t\t}\n\t\t\trateDifference = math.Abs(float64(bandwithList[repRate]) - float64(mapSegmentLogPrintout[segmentNumber-1].Bandwidth))\n\t\t\tsumRateChange = mapSegmentLogPrintout[segmentNumber-1].SumRateChange + rateDifference\n\t\t\trateChange = append(mapSegmentLogPrintout[segmentNumber-1].RateChange, rateDifference)\n\n\t\t} else {\n\t\t\t// otherwise create the list\n\t\t\tsegRates = append(segRates, float64(bandwithList[repRate]))\n\t\t\t// sum the seg rates\n\t\t\tsumSegRate = float64(bandwithList[repRate])\n\t\t\t// sum the total stall duration\n\t\t\ttotalStallDur = float64(stallTime)\n\t\t\t// get the number of stalls\n\t\t\tif stallTime > 0 {\n\t\t\t\t// increment the number of stalls\n\t\t\t\tnStalls = 1\n\t\t\t} else {\n\t\t\t\t// otherwise set to zero (may not be needed, go might default to zero)\n\t\t\t\tnStalls = 0\n\t\t\t}\n\t\t\t// get the number of switches\n\t\t\tnSwitches = 0\n\t\t}\n\t}\n\n\t// Print to output log\n\t//printLog(strconv.Itoa(segmentNumber), strconv.Itoa(arrivalTime), strconv.Itoa(deliveryTime), strconv.Itoa(Abs(stallTime)), strconv.Itoa(bandwithList[repRate]/1000), strconv.Itoa((segSize*8)/deliveryTime), strconv.Itoa((segSize*8)/(segmentDuration*1000)), strconv.Itoa(segSize), strconv.Itoa(bufferLevel), adapt, strconv.Itoa(segmentDuration*1000), extendPrintLog, repCodec, strconv.Itoa(repWidth), strconv.Itoa(repHeight), strconv.Itoa(repFps), strconv.Itoa(playPosition), strconv.FormatFloat(float64(rtt.Nanoseconds())/1000000, 'f', 3, 64), fileDownloadLocation)\n\n\t// store the current segment log output information in a map\n\tprintInformation := logging.SegPrintLogInformation{\n\t\tArrivalTime: arrivalTime,\n\t\tDeliveryTime: deliveryTime,\n\t\tStallTime: stallTime,\n\t\tBandwidth: bandwithList[repRate],\n\t\tDelRate: thr,\n\t\tActRate: (segSize * 8) / (segmentDuration * glob.Conversion1000),\n\t\tSegSize: segSize,\n\t\tBufferLevel: bufferLevel,\n\t\tAdapt: adapt,\n\t\tSegmentDuration: segmentDuration,\n\t\tExtendPrintLog: extendPrintLog,\n\t\tRepCodec: repCodec,\n\t\tRepWidth: repWidth,\n\t\tRepHeight: repHeight,\n\t\tRepFps: repFps,\n\t\tPlayStartPosition: segmentDurationTotal,\n\t\tPlaybackTime: playPosition,\n\t\tRtt: float64(rtt.Nanoseconds()) / (glob.Conversion1000 * glob.Conversion1000),\n\t\tFileDownloadLocation: fileDownloadLocation,\n\t\tRepIndex: repRate,\n\t\tMpdIndex: mpdListIndex,\n\t\tAdaptIndex: currentMPDRepAdaptSet,\n\t\tSegmentIndex: nextSegmentNumber,\n\t\tSegReplace: hlsReplaced,\n\t\tPlayed: false,\n\t\tHTTPprotocol: protocol,\n\t\tP1203Kbps: kbps,\n\t\tSegmentFileName: segmentFileName,\n\t\tSegmentRates: segRates,\n\t\tSumSegRate: sumSegRate,\n\t\tTotalStallDur: totalStallDur,\n\t\tNumStalls: nStalls,\n\t\tNumSwitches: nSwitches,\n\t\tRateDifference: rateDifference,\n\t\tSumRateChange: sumRateChange,\n\t\tRateChange: rateChange,\n\t}\n\n\t// this saves per segment number so from 1 on, and not 0 on\n\t// remember this :)\n\tmapSegmentLogPrintout[segmentNumber] = printInformation\n\n\t// if we want to create QoE, then pass in the printInformation and save the QoE values to log\n\tif getQoEBool {\n\t\tqoe.CreateQoE(&mapSegmentLogPrintout, debugLog, initBuffer, bandwithList[highestMPDrepRateIndex])\n\t}\n\n\t// to calculate throughtput and select the repRate from it (in algorithm.go)\n\tswitch adapt {\n\t//Conventional Algo\n\tcase glob.ConventionalAlg:\n\t\t//fmt.Println(\"old: \", repRate)\n\t\talgo.Conventional(&thrList, thr, &repRate, bandwithList, lowestMPDrepRateIndex)\n\t\t//fmt.Println(\"new: \", repRate)\n\t\t//Harmonic Mean Algo\n\tcase glob.ElasticAlg:\n\t\t//fmt.Println(\"old repRate index: \", repRate)\n\t\t//fmt.Println(\"old bandwithList[repRate]\", bandwithList[repRate])\n\t\talgo.ElasticAlgo(&thrList, thr, deliveryTime, maxBuffer, &repRate, bandwithList, &staticAlgParameter, bufferLevel, kP, kI, lowestMPDrepRateIndex)\n\t\t//fmt.Println(\"new repRate index: \", repRate)\n\t\t//fmt.Println(\"new bandwithList[repRate]\", bandwithList[repRate])\n\t\t//fmt.Println(\"elastic segmentNumber: \", segmentNumber)\n\t\t//fmt.Println(\"segURL: \", segURL)\n\t//Progressive Algo\n\tcase glob.ProgressiveAlg:\n\t\tfmt.Println(\"old: \", repRate)\n\t\talgo.Conventional(&thrList, thr, &repRate, bandwithList, lowestMPDrepRateIndex)\n\t\tfmt.Println(\"new: \", repRate)\n\t//Logistic Algo\n\tcase glob.LogisticAlg:\n\t\tfmt.Println(\"old: \", repRate)\n\t\talgo.Logistic(&thrList, thr, &repRate, bandwithList, bufferLevel,\n\t\t\thighestMPDrepRateIndex, lowestMPDrepRateIndex, glob.DebugFile, debugLog,\n\t\t\tmaxBufferLevel)\n\t\tfmt.Println(\"new: \", repRate)\n\t\tlogging.DebugPrint(glob.DebugFile, debugLog, \"\\nDEBUG: \", \"reprate returned: \"+strconv.Itoa(repRate))\n\t//Mean Average Algo\n\tcase glob.MeanAverageAlg:\n\t\t//fmt.Println(\"old: \", repRate)\n\t\talgo.MeanAverageAlgo(&thrList, thr, &repRate, bandwithList, lowestMPDrepRateIndex)\n\t\t//fmt.Println(\"new: \", repRate)\n\t//Geometric Average Algo\n\tcase glob.GeomAverageAlg:\n\t\t//fmt.Println(\"old: \", repRate)\n\t\talgo.GeomAverageAlgo(&thrList, thr, &repRate, bandwithList, lowestMPDrepRateIndex)\n\t\t//fmt.Println(\"new: \", repRate)\n\t//Exponential Average Algo\n\tcase glob.EMWAAverageAlg:\n\t\t//fmt.Println(\"old: \", repRate)\n\t\talgo.EMWAAverageAlgo(&thrList, &repRate, exponentialRatio, 3, thr, bandwithList, lowestMPDrepRateIndex)\n\n\tcase glob.ArbiterAlg:\n\n\t\trepRate = algo.CalculateSelectedIndexArbiter(thr, segmentDuration*1000, segmentNumber, maxBufferLevel,\n\t\t\trepRate, &thrList, streamDuration, mpdList[mpdListIndex], currentURL,\n\t\t\tcurrentMPDRepAdaptSet, segmentNumber, baseURL, debugLog, deliveryTime, bufferLevel,\n\t\t\thighestMPDrepRateIndex, lowestMPDrepRateIndex, bandwithList,\n\t\t\tsegSize)\n\t\t//fmt.Println(\"new: \", repRate)\n\tcase glob.BBAAlg:\n\t\t//fmt.Println(\"segDur: \", segmentDuration*1000)\n\t\t//fmt.Println(\"index rate: \", repRate)\n\t\t//fmt.Println(\"baseURL: \", baseURL)\n\t\t//fmt.Println(\"downloadDurationLastSegment: \", deliveryTime)\n\t\t//fmt.Println(\"maxStreamDuration: \", streamDuration)\n\t\t//fmt.Println(\"bufferLevel: \", bufferLevel)\n\t\t//fmt.Println(\"\")\n\n\t\trepRate = algo.CalculateSelectedIndexBba(thr, segmentDuration*1000, segmentNumber, maxBufferLevel,\n\t\t\trepRate, &thrList, streamDuration, mpdList[mpdListIndex], currentURL,\n\t\t\tcurrentMPDRepAdaptSet, segmentNumber, baseURL, debugLog, deliveryTime, bufferLevel,\n\t\t\thighestMPDrepRateIndex, lowestMPDrepRateIndex, bandwithList)\n\n\tcase glob.TestAlg:\n\t\t//fmt.Println(\"\")\n\t}\n\tlogging.DebugPrint(glob.DebugFile, debugLog, \"\\nDEBUG: \", adapt+\" has choosen rep_Rate \"+strconv.Itoa(repRate)+\" @ a rate of \"+strconv.Itoa(bandwithList[repRate]/glob.Conversion1000))\n\n\t//Increase the segment number\n\tsegmentNumber++\n\n\t// break out if we have downloaded all of our segments\n\t// if segmentDurationTotal+(segmentDuration*glob.Conversion1000) > streamDuration {\n\tif segmentDurationTotal >= streamDuration {\n\t\tlogging.DebugPrint(glob.DebugFile, debugLog, \"\\nDEBUG: \", \"We have downloaded all segments at the end of the streamLoop - segment total: \"+strconv.Itoa(segmentDurationTotal)+\" current segment duration: \"+strconv.Itoa(segmentDuration*glob.Conversion1000)+\" gives a total of: \"+strconv.Itoa(segmentDurationTotal+(segmentDuration*glob.Conversion1000)))\n\t\treturn segmentNumber, mapSegmentLogPrintout\n\t}\n\n\t// this gets the index for the next MPD and the segment number for the next chunk\n\tstopPlayer := false\n\tstopPlayer, oldMPDIndex, nextSegmentNumber = http.GetNextSegmentDuration(segmentDurationArray, segmentDuration*glob.Conversion1000, segmentDurationTotal, glob.DebugFile, debugLog, segmentDurationArray[mpdListIndex], streamDuration)\n\n\t//fmt.Println(\"streamLoop oldMPDIndex: \", stopPlayer)\n\n\t// stream the next chunk\n\t// Collaborative Code - Start\n\tif !stopPlayer {\n\t\tsegmentNumber, mapSegmentLogPrintout = streamLoop(segmentNumber, OriginalUrl, initBuffer, maxBuffer, codecName, codec, urlString, urlInput,\n\t\t\tmpdList, adapt, maxHeight, isByteRangeMPD, startTime, nextRunTime, arrivalTime, oldMPDIndex, nextSegmentNumber, hls, hlsBool,\n\t\t\tmapSegmentLogPrintout, streamDuration, extendPrintLog, hlsUsed, bufferLevel, segmentDurationTotal, quic, quicBool, OriginalBaseUrl, debugLog, Noden)\n\t}\n\treturn segmentNumber, mapSegmentLogPrintout\n\t// Collaborative Code - End\n\n}", "title": "" }, { "docid": "0d26cba34da5b65931a656d0a590503e", "score": "0.45774484", "text": "func Stream(c *gin.Context) {\n\tid, err := strconv.ParseInt(c.Param(\"id\"), 10, 64)\n\tif err != nil {\n\t\tc.String(500, \"Invalid input. %s\", err)\n\t\treturn\n\t}\n\n\tkey := c.Param(\"id\")\n\tlogrus.Infof(\"Agent %s creating stream %s.\", c.ClientIP(), key)\n\n\twc, err := stream.Writer(c, key)\n\tif err != nil {\n\t\tc.String(500, \"Failed to create stream writer. %s\", err)\n\t\treturn\n\t}\n\n\tdefer func() {\n\t\twc.Close()\n\t\tstream.Delete(c, key)\n\t}()\n\n\tio.Copy(wc, c.Request.Body)\n\n\trc, err := stream.Reader(c, key)\n\tif err != nil {\n\t\tc.String(500, \"Failed to create stream reader. %s\", err)\n\t\treturn\n\t}\n\n\twg := sync.WaitGroup{}\n\twg.Add(1)\n\n\tgo func() {\n\t\tdefer recover()\n\t\tstore.WriteLog(c, &model.Job{ID: id}, rc)\n\t\twg.Done()\n\t}()\n\n\twc.Close()\n\twg.Wait()\n\tc.String(200, \"\")\n\n\tlogrus.Debugf(\"Agent %s wrote stream to database\", c.ClientIP())\n}", "title": "" }, { "docid": "8b7453c57f15a0038e9ab0909252cfa9", "score": "0.4569448", "text": "func (e *Example) Stream(ctx context.Context, req *proto.StreamingRequest, stream proto.Example_StreamStream) error {\n\tlog.Infof(\"Received Example.Stream request with count: %d\", req.Count)\n\n\tfor i := 0; i < int(req.Count); i++ {\n\t\tlog.Infof(\"Responding: %d\", i)\n\t\tif err := stream.Send(&proto.StreamingResponse{\n\t\t\tCount: int64(i),\n\t\t}); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3e907f33451a8291512c4c9556fea6ed", "score": "0.45659533", "text": "func createStream(nc *nats.Conn, name string) nats.JetStreamContext {\n\tjs, err := nc.JetStream()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tif _, err := js.AddStream(&nats.StreamConfig{Name: \"foo\",\n\t\tSubjects: []string{\"foo.>\"}, MaxBytes: 1000,\n\t\tRetention: nats.LimitsPolicy}); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\treturn js\n}", "title": "" }, { "docid": "2c15c7f030d68fa9c8e74df09a90ee0d", "score": "0.4560126", "text": "func (c *Client) CallStream(uri *url.URL, post *postRequest) (<-chan *StreamReply, error) {\n\tvar streamToken struct {\n\t\tStream Value\n\t}\n\tvar version struct {\n\t\tVersion Value\n\t}\n\n\tvar res *http.Response\n\tvar err error\n\n\tif post == nil {\n\t\tres, err = http.Get(uri.String())\n\t} else {\n\t\tj, err := json.Marshal(post)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tres, err = http.Post(uri.String(), \"application/json\", bytes.NewBuffer(j))\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\twg := sync.WaitGroup{}\n\twg.Add(1)\n\tdefer wg.Done()\n\tgo func() {\n\t\twg.Wait() // close when all readers are done\n\t\tres.Body.Close()\n\t}()\n\n\tdec := json.NewDecoder(res.Body)\n\tvar t interface{}\n\tif t, err = dec.Token(); err != nil { // read [ token\n\t\treturn nil, err\n\t}\n\tswitch t.(type) {\n\tcase json.Delim:\n\t\td := t.(json.Delim).String()\n\t\tif d != \"[\" {\n\t\t\tdescr := fmt.Errorf(\"expected [, got %s\", d) // If we are unable to unmarshal error msg, return this error\n\t\t\t// Invalid format. Try to unmarshal error value, in case it was returned outside the stream\n\t\t\trest, err := ioutil.ReadAll(res.Body)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tbuf, err := ioutil.ReadAll(dec.Buffered())\n\t\t\tall := append([]byte(d), append(buf, rest...)...)\n\t\t\tvar errormsg ErrorVersion\n\t\t\terr = json.Unmarshal(all, &errormsg)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, descr\n\t\t\t}\n\t\t\tif errormsg.Error != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"Server returned an error: %s\", errormsg.Error.String())\n\t\t\t}\n\t\t\treturn nil, descr\n\t\t}\n\tdefault:\n\t\terr = fmt.Errorf(\"expected delimiter\")\n\t\treturn nil, err\n\t}\n\n\terr = dec.Decode(&streamToken)\n\tif err != nil || !bytes.Equal(streamToken.Stream, []byte(\"start\")) { // look for stream start\n\t\treturn nil, err\n\t}\n\n\terr = dec.Decode(&version)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tch := make(chan *StreamReply, 100)\n\twg.Add(1)\n\tgo func() {\n\t\tdefer func() {\n\t\t\tclose(ch)\n\t\t\twg.Done()\n\t\t}()\n\n\t\tfor dec.More() {\n\t\t\ts := new(StreamReply)\n\t\t\tif err = dec.Decode(s); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif len(s.Result) == 0 { // If result is empty, look for stream end\n\t\t\t\tif err = dec.Decode(&streamToken); err != nil || bytes.Equal(streamToken.Stream, []byte(\"end\")) { // look for stream end\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t\tch <- s\n\t\t}\n\t}()\n\treturn ch, nil\n}", "title": "" }, { "docid": "60865eeb678baf201550dfeac51f2dc1", "score": "0.45544413", "text": "func (m *Mux) DialStream() (*Stream, error) {\n\tm.mu.Lock()\n\tdefer m.mu.Unlock()\n\tif m.err != nil {\n\t\treturn nil, m.err\n\t}\n\ts := &Stream{\n\t\tm: m,\n\t\taccepted: true,\n\t\tcond: sync.Cond{L: new(sync.Mutex)},\n\t}\n\t// loop until we find an unused ID\n\t//\n\t// NOTE: this implementation uses alternating IDs for the Dialer and\n\t// Accepter to avoid collisions, but other implementations simply choose the\n\t// ID at random; thus, we always have to check for collisions.\n\tfor m.streams[m.nextID] != nil {\n\t\tm.nextID += 2\n\t}\n\ts.id = m.nextID\n\tm.nextID += 2\n\tm.streams[s.id] = s\n\treturn s, nil\n}", "title": "" }, { "docid": "1dba5228eda3dbc057e890fa23f3eef0", "score": "0.45524332", "text": "func NewStream(net, transport gopacket.Flow) *Stream {\n\treturn &Stream{\n\t\tNet: net,\n\t\tTransport: transport,\n\t\tconversation: make(chan Utterance, 100),\n\t}\n}", "title": "" }, { "docid": "45d7cda91d69467edec7ac0ac3a685d5", "score": "0.45452505", "text": "func (c *conn) OpenStream() (smux.Stream, error) {\n\ts, err := c.spdyConn().CreateStream(http.Header{\n\t\t\":method\": []string{\"POST\"}, // this is here for HTTP/SPDY interop\n\t\t\":path\": []string{\"/\"}, // this is here for HTTP/SPDY interop\n\t}, nil, false)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// wait for a response before writing. for some reason\n\t// spdystream does not make forward progress unless you do this.\n\ts.Wait()\n\treturn (*stream)(s), nil\n}", "title": "" }, { "docid": "2d6c798ee8c8cdfe89dac26c1b2de427", "score": "0.4544934", "text": "func CreateStream(o *authoperator.AuthOperator, writer http.ResponseWriter, request *http.Request, logger *log.Entry) (int, string) {\n\t_, _, streamname, streampath := restcore.GetStreamPath(request)\n\n\terr := restcore.ValidName(streamname, nil)\n\tif err != nil {\n\t\treturn restcore.WriteError(writer, logger, http.StatusBadRequest, err, false)\n\t}\n\n\tsm, err := o.StreamMaker()\n\tif err != nil {\n\t\treturn restcore.WriteError(writer, logger, http.StatusBadRequest, err, false)\n\t}\n\terr = restcore.UnmarshalRequest(request, sm)\n\tif err != nil {\n\t\treturn restcore.WriteError(writer, logger, http.StatusBadRequest, err, false)\n\t}\n\n\tsm.Name = streamname\n\tif err = o.CreateStream(streampath, sm); err != nil {\n\t\treturn restcore.WriteError(writer, logger, http.StatusForbidden, err, false)\n\t}\n\n\treturn ReadStream(o, writer, request, logger)\n\n}", "title": "" }, { "docid": "d3ace0d984a83d3f9b5f8864e8503819", "score": "0.45413122", "text": "func read(stream quic.Stream) {\n\tdefer stream.Close()\n\tbuff := make([]byte, 1000)\n\tfor {\n\t\tlen, err := stream.Read(buff)\n\t\tif err != nil {\n\t\t\tlog.Println(\"Error: \" + err.Error())\n\t\t}\n\t\tfmt.Print(friend.Name + \": \" + string(buff[:len]))\n\t}\n}", "title": "" }, { "docid": "959f136c0b140c2859d2c8712e5a6b1d", "score": "0.45389363", "text": "func RequestStream(fn func(msg payload.Payload) rx.Flux) OptAbstractSocket {\n\treturn func(opts *socket.AbstractRSocket) {\n\t\topts.RS = fn\n\t}\n}", "title": "" }, { "docid": "fb3fef7ca5034c194eca314c338547e4", "score": "0.45323265", "text": "func createStream(js nats.JetStreamContext) error {\n\t// Check if the ORDERS stream already exists; if not, create it.\n\tstream, err := js.StreamInfo(streamName)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\tif stream == nil {\n\t\tlog.Printf(\"creating stream %q and subjects %q\", streamName, streamSubjects)\n\t\t_, err = js.AddStream(&nats.StreamConfig{\n\t\t\tName: streamName,\n\t\t\tSubjects: []string{streamSubjects},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "70b3c5282ec21d7baf941c89219ad329", "score": "0.45270923", "text": "func (ndt *NamedDataType) stream(flag bool) {\n\tndt.supportsStreaming = flag\n}", "title": "" }, { "docid": "14fba512ec64077df2734c783c91f3c0", "score": "0.452309", "text": "func (sdk mfSDK) KuiperStream(streamName string, token string) (string, error) {\n\tendpoint := fmt.Sprintf(\"streams/%s\", streamName)\n\turl := createURL(sdk.baseURL, sdk.kuiperPrefix, endpoint)\n\treq, err := http.NewRequest(http.MethodGet, url, nil)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tresp, err := sdk.sendRequest(req, token, string(CTJSON))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif resp.StatusCode != http.StatusCreated {\n\t\tswitch resp.StatusCode {\n\t\tcase http.StatusBadRequest:\n\t\t\treturn string(body), ErrInvalidArgs\n\t\tcase http.StatusForbidden:\n\t\t\treturn string(body), ErrUnauthorized\n\t\tdefault:\n\t\t\treturn string(body), ErrFailedCreation\n\t\t}\n\t}\n\treturn string(body), nil\n}", "title": "" }, { "docid": "73aeba3a1c491861165786870e072e0f", "score": "0.45151484", "text": "func (stream *Stream) ParseNext() (f *frame.Frame, err error) {\n\treturn frame.Parse(stream.r)\n}", "title": "" }, { "docid": "0eb70a5bbf13fc8d21852f77d3c45df8", "score": "0.45114198", "text": "func NewStream(partSize, size int) *Stream {\n\treturn &Stream{\n\t\tPartSize: partSize,\n\t\tSize: size,\n\t}\n}", "title": "" }, { "docid": "d0f4decacb7ed97d3f925e878030dacb", "score": "0.45064092", "text": "func newStream(StreamID protocol.StreamID,\n\tonData func(),\n\tonReset func(protocol.StreamID, protocol.ByteCount),\n\tflowControlManager flowcontrol.FlowControlManager) *stream {\n\ts := &stream{\n\t\tonData: onData,\n\t\tonReset: onReset,\n\t\tstreamID: StreamID,\n\t\tflowControlManager: flowControlManager,\n\t\tframeQueue: newStreamFrameSorter(),\n\t\treadChan: make(chan struct{}, 1),\n\t\twriteChan: make(chan struct{}, 1),\n\t}\n\ts.ctx, s.ctxCancel = context.WithCancel(context.Background())\n\treturn s\n}", "title": "" }, { "docid": "19c5862bc2c7aac9056a9f008245fc3b", "score": "0.44994447", "text": "func (p *Parser) Document(r io.Reader) (*Word, error) {\n\tp.reset()\n\tp.f = &File{}\n\tp.src = r\n\tp.rune()\n\tp.quote = hdocBody\n\tp.hdocStops = [][]byte{[]byte(\"MVDAN_CC_SH_SYNTAX_EOF\")}\n\tp.parsingDoc = true\n\tp.next()\n\tw := p.getWord()\n\treturn w, p.err\n}", "title": "" }, { "docid": "0d15e90345f2c633fd5075600e25588e", "score": "0.44979984", "text": "func (s *Stream) Start() startResponse {\n\turi := \"rtmp://\" + s.Host + \"/\" + s.Application + \"/\" + s.Name\n\tresp := startResponse{\n\t\tURL: uri,\n\t}\n\targs := []string{}\n\targs = append(args, \"-hide_banner\")\n\tif !s.AudioDisabled {\n\t\tcardId := s.Camera.CardId()\n\t\targs = append(args, \"-f\", s.AudioInput)\n\t\targs = append(args, \"-i\", fmt.Sprintf(\"hw:%d\", cardId))\n\t\targs = append(args, \"-ac\", strconv.Itoa(s.Camera.NAudioChannels(cardId)))\n\t}\n\targs = append(args, \"-f\", s.VideoInputFormat)\n\targs = append(args, \"-r\", \"60\")\n\targs = append(args, \"-i\", s.Camera.Device)\n\tif s.VideoResolution != \"\" {\n\t\targs = append(args, \"-vf\", \"scale=\"+s.VideoResolution)\n\t}\n\targs = append(args, \"-c:v\", s.VideoEncoding)\n\tif !s.AudioDisabled {\n\t\targs = append(args, \"-c:a\", s.AudioEncoding)\n\t\targs = append(args, \"-ar\", strconv.Itoa(s.AudioRate))\n\t\targs = append(args, \"-ab\", strconv.Itoa(s.AverageBitRate))\n\t}\n\targs = append(args, \"-f\", s.OutputEncoding, uri)\n\tresp.Cmd = strings.Join(append([]string{\"ffmpeg\"}, args...), \" \")\n\tresp.Status = \"on\"\n\tcmd := exec.Command(\"ffmpeg\", args...)\n\tcmd.Stderr = new(bytes.Buffer)\n\ts.cmd = cmd\n\tgo func() {\n\t\tdefer func() { s.Live = false }()\n\t\ts.Live = true\n\t\terr := cmd.Run()\n\t\tif err != nil && !strings.Contains(err.Error(), \"signal: killed\") {\n\t\t\tlog.Printf(\"Failed to start stream: %s\\n%s\\n\", strings.Join(append([]string{\"ffmpeg\"}, args...), \" \"), cmd.Stderr)\n\t\t}\n\t}()\n\treturn resp\n}", "title": "" }, { "docid": "a1aeb5795d3ea80bfed95a2e338841cf", "score": "0.44935873", "text": "func parseLegacyStreamFrame(r *bytes.Reader, _ protocol.VersionNumber) (*StreamFrame, error) {\n\tframe := &StreamFrame{}\n\n\ttypeByte, err := r.ReadByte()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tframe.FinBit = typeByte&0x40 > 0\n\tframe.DataLenPresent = typeByte&0x20 > 0\n\toffsetLen := typeByte & 0x1c >> 2\n\tif offsetLen != 0 {\n\t\toffsetLen++\n\t}\n\tstreamIDLen := typeByte&0x3 + 1\n\n\tsid, err := utils.BigEndian.ReadUintN(r, streamIDLen)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tframe.StreamID = protocol.StreamID(sid)\n\n\toffset, err := utils.BigEndian.ReadUintN(r, offsetLen)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tframe.Offset = protocol.ByteCount(offset)\n\n\tvar dataLen uint16\n\tif frame.DataLenPresent {\n\t\tdataLen, err = utils.BigEndian.ReadUint16(r)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// shortcut to prevent the unnecessary allocation of dataLen bytes\n\t// if the dataLen is larger than the remaining length of the packet\n\t// reading the packet contents would result in EOF when attempting to READ\n\tif int(dataLen) > r.Len() {\n\t\treturn nil, io.EOF\n\t}\n\n\tif !frame.DataLenPresent {\n\t\t// The rest of the packet is data\n\t\tdataLen = uint16(r.Len())\n\t}\n\tif dataLen != 0 {\n\t\tframe.Data = make([]byte, dataLen)\n\t\tif _, err := io.ReadFull(r, frame.Data); err != nil {\n\t\t\t// this should never happen, since we already checked the dataLen earlier\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// MaxByteCount is the highest value that can be encoded with the IETF QUIC variable integer encoding (2^62-1).\n\t// Note that this value is smaller than the maximum value that could be encoded in the gQUIC STREAM frame (2^64-1).\n\tif frame.Offset+frame.DataLen() > protocol.MaxByteCount {\n\t\treturn nil, qerr.Error(qerr.InvalidStreamData, \"data overflows maximum offset\")\n\t}\n\tif !frame.FinBit && frame.DataLen() == 0 {\n\t\treturn nil, qerr.EmptyStreamFrameNoFin\n\t}\n\treturn frame, nil\n}", "title": "" }, { "docid": "e1e299021f1c1d8c02803917f030adce", "score": "0.4481992", "text": "func NewNodeStreamInRPN(ts *NodeStream) *NodeStream {\n\tfuncArgCounts := make(map[int]int, 0)\n\tcurrFuncID := -1\n\tops, output := NewNodeStream(), NewNodeStream()\n\n\tfor ts.HasNext() {\n\t\tnode := ts.Next()\n\t\tswitch node.GetType() {\n\t\tcase nodeTypeNumber, nodeTypeBoolean,\n\t\t\tnodeTypeVariable, nodeTypeString:\n\t\t\toutput.Push(node)\n\t\tcase nodeTypeFuncCall:\n\t\t\tcurrFuncID++\n\t\t\tfuncArgCounts[currFuncID] = 1\n\t\t\tops.Push(node)\n\t\tcase nodeTypeComma:\n\t\t\tfuncArgCounts[currFuncID]++\n\t\t\tfor top := ops.Top(); !isLeftParen(top); top = ops.Top() {\n\t\t\t\toutput.Push(ops.Pop())\n\t\t\t}\n\t\tcase nodeTypeOperator:\n\t\t\tfor top := ops.Top(); top.GetType() == nodeTypeOperator; top = ops.Top() {\n\t\t\t\tif shouldPopOperator(top, node) {\n\t\t\t\t\toutput.Push(ops.Pop())\n\t\t\t\t} else {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tops.Push(node)\n\t\t}\n\n\t\tswitch pType := getParenType(node); pType {\n\t\tcase parenTypeOpen:\n\t\t\tops.Push(node)\n\t\t\tif getParenType(ts.Peek()) == parenTypeClose {\n\t\t\t\tfuncArgCounts[currFuncID] = 0\n\t\t\t}\n\t\tcase parenTypeClose:\n\t\t\tfor top := ops.Top(); !isLeftParen(top); top = ops.Top() {\n\t\t\t\toutput.Push(ops.Pop())\n\t\t\t}\n\n\t\t\tops.Pop()\n\t\t\tif ops.Top().GetType() == nodeTypeFuncCall {\n\t\t\t\toutput.Push(ops.Pop())\n\t\t\t\toutput.Push(NewArgCount(funcArgCounts[currFuncID]))\n\t\t\t\tcurrFuncID--\n\t\t\t}\n\t\t}\n\t}\n\n\tfor ops.Length() > 0 {\n\t\toutput.Push(ops.Pop())\n\t}\n\n\treturn output\n}", "title": "" }, { "docid": "0d87047f6071dc3d4d90ffac20369b5c", "score": "0.44699967", "text": "func Parse(document string) (*Document, error) {\n\n\tif strings.TrimSpace(document) == \"\" {\n\t\treturn nil, errors.New(\"document cannot be empty\")\n\t}\n\n\tresult := &Document{\n\t\tRawDocument: document,\n\t\tRoot: &Block{},\n\t}\n\n\t// TODO parse *AST and convert it to Document\n\t_, err := ast.Parser(document)\n\n\treturn result, err\n}", "title": "" }, { "docid": "1a9b189b381497e369f57ac85604167d", "score": "0.44626993", "text": "func Of(args ...interface{}) (*Stream, error) {\n\treturn New(args)\n}", "title": "" }, { "docid": "3f4466b2a97f76f15e0e2b0281c90cab", "score": "0.44592196", "text": "func NewStream() *Stream {\n\treturn &Stream{\n\t\tchs: make(map[chan []byte]struct{}),\n\t}\n}", "title": "" }, { "docid": "646efbf97cd599c7f45b560a5240b9fe", "score": "0.44583005", "text": "func (n *notifee) OpenedStream(network p2pnet.Network, stream p2pnet.Stream) {}", "title": "" }, { "docid": "766a2229f2308772eb219f39af5cf7c9", "score": "0.44567415", "text": "func (c *Client) ScanStream(input []byte) (result ScanResult, err error) {\n\t_, err = fmt.Fprintln(c.Socket, fmt.Sprintf(\"%s SCANDATA %d\", c.Version, len(input)))\n\tif err != nil {\n\t\treturn result, err\n\t}\n\n\tscanner := bufio.NewScanner(c.Socket)\n\n\tscanner.Scan()\n\tline := scanner.Text()\n\n\tif line == \"\" {\n\t\treturn result, ErrServerClosedConnection\n\t}\n\n\tr := scanResponsePattern.FindStringSubmatch(line)\n\n\tif len(r) < 3 {\n\t\treturn result, errors.New(\"erroring\")\n\t}\n\n\tif r[2] == \"REJ\" {\n\t\tswitch r[3] {\n\t\tcase \"1\":\n\t\t\treturn result, ErrNotRecognised\n\t\tcase \"2\":\n\t\t\treturn result, ErrIncorrectVersion\n\t\tcase \"3\":\n\t\t\treturn result, ErrOptionsError\n\t\tcase \"4\":\n\t\t\treturn result, ErrTooMuchData\n\t\tcase \"5\":\n\t\t\treturn result, ErrNotPermitted\n\t\t}\n\t}\n\n\tvar chunkSize = 4096\n\tfor i := 0; i < len(input); i += chunkSize {\n\t\tfmt.Fprintf(c.Socket, \"%s\", input[i:min(i+chunkSize, len(input))])\n\t}\n\n\tfor scanner.Scan() {\n\t\tline := scanner.Text()\n\n\t\tif line == \"\" {\n\t\t\tbreak\n\t\t}\n\n\t\tr := scanResponsePattern.FindStringSubmatch(line)\n\n\t\tif r[1] == \"DONE\" {\n\t\t\tresult.Pass = r[3] == \"0000\"\n\t\t\tresult.Status = r[4]\n\t\t\tcontinue\n\t\t}\n\n\t\tswitch r[2] {\n\t\tcase \"VIRUS\":\n\t\t\tresult.Pass = false\n\t\t\tresult.Detected = append(result.Detected, &Threat{\n\t\t\t\tName: r[3],\n\t\t\t\tPath: r[4],\n\t\t\t})\n\n\t\tcase \"FAIL\":\n\t\t\tresult.Pass = false\n\t\t}\n\t}\n\n\treturn result, nil\n}", "title": "" }, { "docid": "ec3e48bb7562e5f3566573e14cf0ec89", "score": "0.44540945", "text": "func (s *gRPCBrokerServer) StartStream(stream plugin.GRPCBroker_StartStreamServer) error {\n\tdoneCh := stream.Context().Done()\n\tdefer s.Close()\n\n\t// Proccess send stream\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-doneCh:\n\t\t\t\treturn\n\t\t\tcase <-s.quit:\n\t\t\t\treturn\n\t\t\tcase se := <-s.send:\n\t\t\t\terr := stream.Send(se.i)\n\t\t\t\tse.ch <- err\n\t\t\t}\n\t\t}\n\t}()\n\n\t// Process receive stream\n\tfor {\n\t\ti, err := stream.Recv()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tselect {\n\t\tcase <-doneCh:\n\t\t\treturn nil\n\t\tcase <-s.quit:\n\t\t\treturn nil\n\t\tcase s.recv <- i:\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "1e6f410422bbf3f5b8f6c1c4875e5d09", "score": "0.445034", "text": "func (r *Response) IsStream() bool {\n\tif err := r.parseMediaType(); err != nil {\n\t\treturn false\n\t}\n\n\tif !strings.Contains(r.mimeType, \"multipart\") {\n\t\treturn false\n\t}\n\treturn r.mimeParams[\"boundary\"] != \"\"\n}", "title": "" }, { "docid": "577489efee7259ecb1ca5641ee800584", "score": "0.4448485", "text": "func handleStream(createOrDrop bool, names []string, t *testing.T) {\n\tp := NewStreamProcessor(path.Join(DbDir, \"stream\"))\n\tfor _, name := range names {\n\t\tvar sql string\n\t\tif createOrDrop {\n\t\t\tswitch name {\n\t\t\tcase \"demo\":\n\t\t\t\tsql = `CREATE STREAM demo (\n\t\t\t\t\tcolor STRING,\n\t\t\t\t\tsize BIGINT,\n\t\t\t\t\tts BIGINT\n\t\t\t\t) WITH (DATASOURCE=\"demo\", FORMAT=\"json\", KEY=\"ts\");`\n\t\t\tcase \"demoError\":\n\t\t\t\tsql = `CREATE STREAM demoError (\n\t\t\t\t\tcolor STRING,\n\t\t\t\t\tsize BIGINT,\n\t\t\t\t\tts BIGINT\n\t\t\t\t) WITH (DATASOURCE=\"demoError\", FORMAT=\"json\", KEY=\"ts\");`\n\t\t\tcase \"demo1\":\n\t\t\t\tsql = `CREATE STREAM demo1 (\n\t\t\t\t\ttemp FLOAT,\n\t\t\t\t\thum BIGINT,` +\n\t\t\t\t\t\"`from`\" + ` STRING,\n\t\t\t\t\tts BIGINT\n\t\t\t\t) WITH (DATASOURCE=\"demo1\", FORMAT=\"json\", KEY=\"ts\");`\n\t\t\tcase \"sessionDemo\":\n\t\t\t\tsql = `CREATE STREAM sessionDemo (\n\t\t\t\t\ttemp FLOAT,\n\t\t\t\t\thum BIGINT,\n\t\t\t\t\tts BIGINT\n\t\t\t\t) WITH (DATASOURCE=\"sessionDemo\", FORMAT=\"json\", KEY=\"ts\");`\n\t\t\tcase \"demoE\":\n\t\t\t\tsql = `CREATE STREAM demoE (\n\t\t\t\t\tcolor STRING,\n\t\t\t\t\tsize BIGINT,\n\t\t\t\t\tts BIGINT\n\t\t\t\t) WITH (DATASOURCE=\"demoE\", FORMAT=\"json\", KEY=\"ts\", TIMESTAMP=\"ts\");`\n\t\t\tcase \"demo1E\":\n\t\t\t\tsql = `CREATE STREAM demo1E (\n\t\t\t\t\ttemp FLOAT,\n\t\t\t\t\thum BIGINT,\n\t\t\t\t\tts BIGINT\n\t\t\t\t) WITH (DATASOURCE=\"demo1E\", FORMAT=\"json\", KEY=\"ts\", TIMESTAMP=\"ts\");`\n\t\t\tcase \"sessionDemoE\":\n\t\t\t\tsql = `CREATE STREAM sessionDemoE (\n\t\t\t\t\ttemp FLOAT,\n\t\t\t\t\thum BIGINT,\n\t\t\t\t\tts BIGINT\n\t\t\t\t) WITH (DATASOURCE=\"sessionDemoE\", FORMAT=\"json\", KEY=\"ts\", TIMESTAMP=\"ts\");`\n\t\t\tcase \"demoErr\":\n\t\t\t\tsql = `CREATE STREAM demoErr (\n\t\t\t\t\tcolor STRING,\n\t\t\t\t\tsize BIGINT,\n\t\t\t\t\tts BIGINT\n\t\t\t\t) WITH (DATASOURCE=\"demoErr\", FORMAT=\"json\", KEY=\"ts\", TIMESTAMP=\"ts\");`\n\t\t\tcase \"ldemo\":\n\t\t\t\tsql = `CREATE STREAM ldemo (\t\t\t\t\t\n\t\t\t\t) WITH (DATASOURCE=\"ldemo\", FORMAT=\"json\");`\n\t\t\tcase \"ldemo1\":\n\t\t\t\tsql = `CREATE STREAM ldemo1 (\n\t\t\t\t) WITH (DATASOURCE=\"ldemo1\", FORMAT=\"json\");`\n\t\t\tcase \"lsessionDemo\":\n\t\t\t\tsql = `CREATE STREAM lsessionDemo (\n\t\t\t\t) WITH (DATASOURCE=\"lsessionDemo\", FORMAT=\"json\");`\n\t\t\tcase \"ext\":\n\t\t\t\tsql = \"CREATE STREAM ext (count bigint) WITH (DATASOURCE=\\\"users\\\", FORMAT=\\\"JSON\\\", TYPE=\\\"random\\\", CONF_KEY=\\\"ext\\\")\"\n\t\t\tcase \"ext2\":\n\t\t\t\tsql = \"CREATE STREAM ext2 (count bigint) WITH (DATASOURCE=\\\"users\\\", FORMAT=\\\"JSON\\\", TYPE=\\\"random\\\", CONF_KEY=\\\"dedup\\\")\"\n\t\t\tcase \"text\":\n\t\t\t\tsql = \"CREATE STREAM text (slogan string, brand string) WITH (DATASOURCE=\\\"users\\\", FORMAT=\\\"JSON\\\")\"\n\t\t\tdefault:\n\t\t\t\tt.Errorf(\"create stream %s fail\", name)\n\t\t\t}\n\t\t} else {\n\t\t\tsql = `DROP STREAM ` + name\n\t\t}\n\n\t\t_, err := p.ExecStmt(sql)\n\t\tif err != nil {\n\t\t\tt.Log(err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "21264b1c2ff594fa8ba72882fda961bc", "score": "0.44431752", "text": "func (ctx *Context) Stream(code int, contentType string, r io.Reader) (err error) {\n\tif ctx.Res.ended.swapTrue() {\n\t\tctx.Status(code)\n\t\tctx.Type(contentType)\n\t\t_, err = io.Copy(ctx.Res, r)\n\t} else {\n\t\terr = ErrInternalServerError.WithMsg(\"request ended before ctx.Stream\")\n\t}\n\treturn\n}", "title": "" }, { "docid": "6ed041e767b7c5fc8ff9a9bfb1da5445", "score": "0.4435641", "text": "func newServerStream(conn net.Conn, version string) streamSession {\n\treturn newSmuxServer(conn)\n}", "title": "" } ]
2efa37482817a7b3ec60846bdeaa9c64
IsTracked returns true if the file is tracked by git
[ { "docid": "002dce4a64cdfcf573926aad037fa547", "score": "0.8146525", "text": "func (f fileStatus) IsTracked() bool {\n\treturn f.Status != git.StatusIgnored &&\n\t\tf.Status != git.StatusWtNew\n}", "title": "" } ]
[ { "docid": "98543886158773f668c26d060164a60d", "score": "0.75666124", "text": "func (s *Status) IsTracked(path string) bool {\n\tpath = filepath.ToSlash(path)\n\tfor _, f := range s.Files {\n\t\tif path == f.Path {\n\t\t\treturn f.IsTracked()\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "70fdac12380174e330694dd68c66a6d2", "score": "0.62839323", "text": "func (tracker *Tracker) IsTracked(id uint64) bool {\n\t// It is already tracked\n\tif id < tracker.nextLowcontig {\n\t\treturn true\n\t}\n\n\tindex := id - tracker.startIndex\n\tif index > tracker.size {\n\t\treturn false\n\t}\n\n\tindex = index / 8\n\tif tracker.bitmap[index]&(1<<(id%8)) != 0 {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "f39d08100146f6de746a6d3e3c772b9d", "score": "0.60690016", "text": "func (s GStatus) IsUntracked(path string) bool {\n\tstat, ok := (s)[filepath.ToSlash(path)]\n\treturn ok && stat.Worktree == GitUntracked\n}", "title": "" }, { "docid": "fd09076770c526fe7b24207004a9bc2c", "score": "0.59332395", "text": "func (r *Reporter) IsTracking() bool {\n\tr.stateMutex.RLock()\n\tdefer r.stateMutex.RUnlock()\n\treturn r.isTracking\n}", "title": "" }, { "docid": "9d0ef21110377c4d2b9b91d3256368a4", "score": "0.5886141", "text": "func isClean(ctx context.Context, git *gittool.Tool) (bool, error) {\n\tst, err := gittool.Status(ctx, git, nil)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tstClose := singleclose.For(st)\n\tdefer stClose.Close()\n\tfor st.Scan() {\n\t\tif !st.Entry().Code().IsUntracked() {\n\t\t\treturn false, nil\n\t\t}\n\t}\n\tif err := st.Err(); err != nil {\n\t\treturn false, err\n\t}\n\tif err := stClose.Close(); err != nil {\n\t\treturn false, err\n\t}\n\treturn true, nil\n}", "title": "" }, { "docid": "60775e44d758807240224639024b6b86", "score": "0.5781813", "text": "func (r *Ref) IsLocal() bool {\n\treturn strings.HasPrefix(r.Path, \"refs/heads/\")\n}", "title": "" }, { "docid": "8615bea3ed29bdcd1247d16d1b62eee9", "score": "0.5755323", "text": "func (ft FileTracker) Exist(file string) bool {\n\t// Get returns ErrItemNotFound if the repo does not contains the key.\n\titem, err := ft.repo.Get(file)\n\tif err != nil {\n\t\treturn false\n\t}\n\n\tfileInfo, err := os.Stat(file)\n\tif err != nil {\n\t\tft.logger.Debugf(\"Error retrieving file info for '%s' (%s).\", file, err)\n\t\treturn false\n\t}\n\n\tif item.ModTime.Equal(fileInfo.ModTime()) {\n\t\tft.logger.Debugf(\"File modification time has not changed for '%s'.\", file)\n\t\treturn true\n\t}\n\n\thash, err := ft.Hasher.Hash(file)\n\tif err != nil {\n\t\treturn false\n\t}\n\n\t// checks if the file is the same (equal value)\n\tif item.Hash == hash {\n\t\tft.logger.Debugf(\"File hash has not changed for '%s'.\", file)\n\n\t\t// updates file marker with mtime to speed up comparison on next run\n\t\titem.ModTime = fileInfo.ModTime()\n\t\tif err = ft.repo.Put(file, item); err != nil {\n\t\t\tft.logger.Debugf(\"Error updating marker for '%s' with modification time (%s).\", file, err)\n\t\t}\n\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "60ff8b7a3f6b42792a0bc27af0ac787e", "score": "0.57304525", "text": "func IsIgnored(path string) bool {\n\tc := exec.Command(\"git\", \"check-ignore\", \"--quiet\", path)\n\tc.Run()\n\n\ts := c.ProcessState.ExitCode()\n\n\treturn s == 0\n}", "title": "" }, { "docid": "aaf8a56031b948133dc4e2ec393e3ee3", "score": "0.5640179", "text": "func (c *Controller) isTrackedObject(objectMeta *meta.ObjectMeta) bool {\n\treturn c.chopConfig.IsWatchedNamespace(objectMeta.Namespace) && chopmodels.IsChopGeneratedObject(objectMeta)\n}", "title": "" }, { "docid": "3e4cbe06664d590fbb7883390c066e1d", "score": "0.55783015", "text": "func (f fileStatus) InWorking() bool {\n\treturn f.Status == git.StatusWtModified ||\n\t\tf.Status == git.StatusWtDeleted ||\n\t\tf.Status == git.StatusWtRenamed ||\n\t\tf.Status == git.StatusWtTypeChange\n}", "title": "" }, { "docid": "13b0350e176ebeb285cc91d630b3efe6", "score": "0.55253285", "text": "func (doc *GHDoc) IsRemoteFile() bool {\n\tu, err := url.Parse(doc.Path)\n\tif err != nil || u.Scheme == \"\" {\n\t\tdoc.d(\"IsRemoteFile: false\")\n\t\treturn false\n\t}\n\tdoc.d(\"IsRemoteFile: true\")\n\treturn true\n}", "title": "" }, { "docid": "f23fc12181716cf88bd93456fa5365b7", "score": "0.54067445", "text": "func (s *Status) HasStaged() bool {\n\tfor _, f := range s.Files {\n\t\tif f.InStaging() {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "bbf7a890a9f73b939a2932c7f837a7a9", "score": "0.53857505", "text": "func IsRelated(fullFilePath string, fileInLog string) bool {\n\tfilePathExt := strings.TrimPrefix(filepath.Ext(fullFilePath), \".\")\n\tfileInLogExt := strings.TrimPrefix(filepath.Ext(fileInLog), \".\")\n\tif !AreRelelatedExtensions(filePathExt, fileInLogExt) {\n\t\treturn false\n\t}\n\n\tif strings.HasSuffix(fileInLog, \".o\") || strings.HasSuffix(fileInLog, \".obj\") {\n\t\tfileInLog = NormalizeObjectFilePath(fileInLog)\n\t}\n\n\tif IsSameFile(util.StripExtensionAndCommonSuffixFromFilePath(fullFilePath), util.StripExtensionAndCommonSuffixFromFilePath(fileInLog)) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "4a35720569b72c25aac38c0d10e340fc", "score": "0.5329527", "text": "func (f fileStatus) IsModified() bool {\n\treturn f.InStaging() || f.InWorking()\n}", "title": "" }, { "docid": "39b67c823d8eb47ba36e97f63deddcf7", "score": "0.5325159", "text": "func (c Command) HasUncommitted() (bool, error) {\n\tout, err := c.Run(\"diff-index\", \"HEAD\")\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\treturn strings.TrimSpace(out) != \"\", nil\n}", "title": "" }, { "docid": "1673b98e51001f9412032e7d96e3446e", "score": "0.52449214", "text": "func (p *Profile) HasFileLines() bool", "title": "" }, { "docid": "1673b98e51001f9412032e7d96e3446e", "score": "0.52449214", "text": "func (p *Profile) HasFileLines() bool", "title": "" }, { "docid": "c166a270c5805adf64ff3415e706659e", "score": "0.5241897", "text": "func (session *Session) IsStaged(imageRef reference.ImageRef) (bool, error) {\n\t_, err := session.imageStore.Get(imageRef)\n\tif err == nil {\n\t\t// We got a valid id for this image, which means it's already staged.\n\t\treturn true, nil\n\t}\n\tif err == reference.ErrDoesNotExist {\n\t\treturn false, nil\n\t}\n\treturn false, err\n}", "title": "" }, { "docid": "aa814079853332b94fb8d19a4a41826a", "score": "0.52417064", "text": "func Status(c *cli.Context) error {\n\tbroRoot, err := getRootBro()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\twd, err := os.Getwd()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// check for config\n\tconfig, err := getBroConfig()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif config.Bro != \"\" {\n\t\tfmt.Printf(\"Tracked against %q:\\n\", config.Bro)\n\t} else {\n\t\tfmt.Println(\"Currently untracked:\")\n\t}\n\tfmt.Printf(\" use \\\"bro track <project>\\\" to track against another project\\n\")\n\tfmt.Println()\n\n\t// get staged files\n\tfiles := sync.Map{}\n\tstagePath := filepath.Join(broRoot, \".bro\", \"_stage\")\n\n\t// check if there is anything to stage\n\tif _, err = os.Stat(stagePath); os.IsNotExist(err) {\n\t\tfmt.Println(\"No files to be commited.\")\n\t\treturn nil\n\t}\n\n\t// walk the stage\n\twalker := concurrent.NewCWalker(c.GlobalInt(\"threads\"))\n\twalker.WalkAndCollect(stagePath, &files)\n\n\t// Print path\n\tfmt.Println(\"Files to commit to template:\")\n\tfmt.Println(\" (use \\\"bro reset\\\" to remove all files from staging)\")\n\tfmt.Println()\n\tfiles.Range(func(_, v interface{}) bool {\n\t\tif sv, ok := v.(string); ok {\n\t\t\tp := filepath.Join(broRoot, strings.TrimPrefix(sv, stagePath))\n\t\t\trel, err := filepath.Rel(wd, p)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err)\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tif !strings.HasPrefix(rel, \".\") {\n\t\t\t\trel = \".\" + string(filepath.Separator) + rel\n\t\t\t}\n\t\t\tfmt.Printf(\" %s\\n\", rel)\n\t\t}\n\t\treturn true\n\t})\n\treturn nil\n}", "title": "" }, { "docid": "bc7ebdd5ab90c93b85deacecce4f5b99", "score": "0.52051836", "text": "func isModified() bool {\n\tcmd := exec.Command(\"git\", \"diff\", \"--no-ext-diff\", \"--quiet\", \"--exit-code\")\n\tif err := cmd.Run(); err != nil {\n\t\t// ExitError indicates there is a change\n\t\tif _, ok := err.(*exec.ExitError); ok {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "79028ca0ffb0af7bc5b3bf4ac966c65c", "score": "0.5193757", "text": "func (t *Track) IsLocal() bool {\n\tlocal := C.sp_track_is_local(\n\t\tt.session.sp_session,\n\t\tt.sp_track,\n\t)\n\treturn local == 1\n}", "title": "" }, { "docid": "87a423876463f30a2552970ac8cf98af", "score": "0.51689", "text": "func (fs *FS) HasFile(filePath string) (bool, error) {\n\tpath := fs.Dir + filePath\n\to := fs.bkt.Object(path)\n\tctx := context.Background()\n\t_, err := o.Attrs(ctx)\n\tif err != nil {\n\t\tif err == storage.ErrObjectNotExist {\n\t\t\treturn false, nil\n\t\t}\n\t\treturn false, fmt.Errorf(\"unexpected error when obtaining attributes for %q at %s (remote path %q): %w\", filePath, fs, o.ObjectName(), err)\n\t}\n\treturn true, nil\n}", "title": "" }, { "docid": "3b36a5868e8b2692e2ec6512daa0bd3c", "score": "0.5145135", "text": "func (r *Ref) TrackRemote(remote string) (err error) {\n\tif !r.IsLocal() {\n\t\treturn fmt.Errorf(\"%s is not a branch, we cannot track it.\", r.Path)\n\t}\n\tsection := \"branch.\" + r.Name()\n\tbranch_remote, branch_remote_exists := r.r.Get(section + \".remote\")\n\tbranch_merge, branch_merge_exists := r.r.Get(section + \".merge\")\n\tif branch_remote_exists &&\n\t\tbranch_merge_exists &&\n\t\tbranch_remote == remote &&\n\t\tbranch_merge == r.Path {\n\t\t// We already have the right config. Nothing to do.\n\t\treturn nil\n\t}\n\tif branch_remote_exists || branch_merge_exists {\n\t\tr.r.maybeKillSection(section)\n\t}\n\tr.r.Set(section+\".remote\", remote)\n\tr.r.Set(section+\".merge\", r.Path)\n\treturn nil\n}", "title": "" }, { "docid": "18bd675fd56ee20f0d3aefa7718cea31", "score": "0.51402205", "text": "func (tc *TxnCoordSender) IsTracking() bool {\n\ttc.mu.Lock()\n\tdefer tc.mu.Unlock()\n\treturn tc.interceptorAlloc.txnHeartbeater.heartbeatLoopRunningLocked()\n}", "title": "" }, { "docid": "b7cf64ccfe2b5c7eb28c74cd718d567c", "score": "0.5134761", "text": "func (h Handle) IsLocalConflict() bool {\n\treturn h.conflictInfo != nil &&\n\t\th.conflictInfo.Type == tlf.HandleExtensionLocalConflict\n}", "title": "" }, { "docid": "86a17785495e9c5af9b0b97ad2798bb5", "score": "0.5115321", "text": "func (g *Generator) IsFileWrap(depfile *fdep.DepFile) bool {\n\tif depfile.DepType != fdep.DepType_Own {\n\t\treturn false\n\t}\n\n\tif o := depfile.ProtoFile.FindOption(\"fproto_wrap.wrap\"); o != nil {\n\t\tif o.Value.String() != \"true\" {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "a0ae73e6f3b592b331d22fe8436e50e1", "score": "0.5105789", "text": "func isProjectFile(finfo os.FileInfo) bool {\n\tif !finfo.IsDir() {\n\t\tif ext := filepath.Ext(finfo.Name()); ext == \".project\" {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "8f6cd50f71b42e363ff31bc73ef0c96f", "score": "0.5093376", "text": "func IsRepo(dir string) bool {\n\t// TODO: Check for symlink?\n\thead, err := ioutil.ReadFile(dir + \"/HEAD\")\n\tif err != nil {\n\t\treturn false\n\t}\n\t// We'll just assume that anything starting with \"ref: \" is good enough\n\tif string(head[:5]) != \"ref: \" {\n\t\tfor _, c := range head {\n\t\t\tif c < '0' || c > 'f' || (c > '9' && c < 'a') {\n\t\t\t\t// Not a valid SHA-1\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t}\n\tstat, err := os.Lstat(dir + \"/objects\")\n\tif err != nil || !stat.IsDir() {\n\t\treturn false\n\t}\n\tstat, err = os.Lstat(dir + \"/refs\")\n\tif err != nil || !stat.IsDir() {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "2710a772beb151b4a04cd8257eae8b16", "score": "0.50901216", "text": "func trackGerritRef(ref string) bool {\n\tif strings.HasPrefix(ref, \"refs/users/\") {\n\t\treturn false\n\t}\n\tif strings.HasPrefix(ref, \"refs/meta/\") {\n\t\treturn false\n\t}\n\tif strings.HasPrefix(ref, \"refs/cache-automerge/\") {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "d05e386305e81921f8c8b22908439edb", "score": "0.50875276", "text": "func (c Command) IsStaged(path string) bool {\n\t_, err := c.Run(\"ls-files\", \"--error-unmatch\", path)\n\treturn err == nil\n}", "title": "" }, { "docid": "16d720accf5fc52989e9c5e72b37dc13", "score": "0.50830936", "text": "func (r *Ref) IsRemote() bool {\n\treturn strings.HasPrefix(r.Path, \"refs/remotes/\")\n}", "title": "" }, { "docid": "26efd80f7f66c6e1f8a9cbcf9d4cf277", "score": "0.5077243", "text": "func (t Track) IsDataTrack() bool {\n\treturn t.Type == TypeData\n}", "title": "" }, { "docid": "b1c96d15b4068cc80d53aa8613255431", "score": "0.5072398", "text": "func (gs *Status) Tracked() (files []string) {\n\tfiles = make([]string, gs.CountTracked())\n\n\tfiles = append(files, gs.Ready.Tracked()...)\n\tfiles = append(files, gs.NotReady.Tracked()...)\n\treturn\n}", "title": "" }, { "docid": "bdfed25fd54ae674dfb4b2b201a0f425", "score": "0.5069699", "text": "func (f fileStatus) InStaging() bool {\n\treturn f.Status == git.StatusIndexNew ||\n\t\tf.Status == git.StatusIndexModified ||\n\t\tf.Status == git.StatusIndexDeleted ||\n\t\tf.Status == git.StatusIndexRenamed ||\n\t\tf.Status == git.StatusIndexTypeChange\n}", "title": "" }, { "docid": "d5b68023f38de1c317ea51d7e2948491", "score": "0.5060993", "text": "func FileStatus(path string) string {\n\tvar status string = \" \"\n\to, err := exec.Command(\"git\", \"status\", \"--porcelain\", \"--ignored\", \"--untracked-files=normal\", path).Output()\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tlines := strings.Split(string(o), \"\\n\")\n\n\tif len(lines) > 0 {\n\n\t\tout := strings.Trim(lines[0], \"\\n\\r\\t\\v\\f\")\n\n\t\tif len(out) >= 2 {\n\t\t\tstatus = out[0:2]\n\t\t}\n\t}\n\n\treturn status\n}", "title": "" }, { "docid": "23e93b1aabafee2f77517f841f87d2c3", "score": "0.50410247", "text": "func GitUntracked(path string) ([]string, error) {\n\tuntracked := make([]string, 0)\n\tgit, exists := Which(\"git\")\n\tif !exists {\n\t\treturn untracked, fmt.Errorf(\"Couldn't find git command\")\n\t}\n\n\tcmd := exec.Command(git, \"status\", \"--porcelain=v2\")\n\tcmd.Dir = path\n\toutput, err := cmd.Output()\n\tif err != nil {\n\t\treturn untracked, fmt.Errorf(\"%s\\n%s\", output, err)\n\t}\n\n\tscanner := bufio.NewScanner(bytes.NewReader(output))\n\tfor scanner.Scan() {\n\t\tparts := strings.SplitN(scanner.Text(), \" \", 2)\n\t\tif parts[0] == \"?\" {\n\t\t\t// This is an untracked file\n\t\t\tuntracked = append(untracked, parts[1])\n\t\t}\n\t}\n\n\treturn untracked, nil\n}", "title": "" }, { "docid": "e7f3c283531be349da766d6a45e08820", "score": "0.50389767", "text": "func (d *DragData) IsFile() int32 {\n\treturn int32(C.gocef_drag_data_is_file(d.toNative(), d.is_file))\n}", "title": "" }, { "docid": "41eb60bbccdff644285582137ca910d9", "score": "0.5023934", "text": "func (o *ViewProjectFile) HasFileSource() bool {\n\tif o != nil && o.FileSource != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "ed79281a2791eca99acc337ceadd180b", "score": "0.50018686", "text": "func hasGitUncommittedChanges(dir string) (bool, error) {\n\tstdout := &bytes.Buffer{}\n\tcmd := exec.Command(\"git\", \"status\", \"--porcelain\")\n\tcmd.Dir = dir\n\tcmd.Stdout = stdout\n\tif err := cmd.Run(); err != nil {\n\t\treturn false, cleanCmdError(err)\n\t}\n\treturn stdout.Len() != 0, nil\n}", "title": "" }, { "docid": "f8e0615f157aad520b5b24cff1e74580", "score": "0.49945423", "text": "func (m *Meta) IsFile() bool {\n\tif m.Type == \"file\" {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "96fd115ba8effe031dcd5173dedf86d6", "score": "0.49878928", "text": "func (this *Repo) haveAnyFilesChanged() (bool, error) {\n\t//Send out task to check for difference in each file in tracked directory\n\tfiles, err := ioutil.ReadDir(this.GetTrackedDir())\n\tvar numTracked int = len(files)\n\tdiffChannels := make([]chan bool, numTracked)\n\terrChannels := make([]chan error, numTracked)\n\tfor i := 0; i < numTracked; i++ {\n\t\tdiffChannels[i] = make(chan bool)\n\t\terrChannels[i] = make(chan error)\n\t\tif files[i].IsDir() {\n\t\t\tdiffChannels[i] <- false\n\t\t\tcontinue\n\t\t}\n\t\tgo this.fileWasChanged(diffChannels[i], errChannels[i], files[i].Name())\n\t}\n\n\t//Receive the results\n\tfor i := 0; i < numTracked; i++ {\n\t\twasChanged := <-diffChannels[i]\n\n\t\tnewErr := <-errChannels[i]\n\t\tif newErr != nil && err == nil {\n\t\t\terr = newErr\n\t\t}\n\n\t\tif wasChanged {\n\t\t\treturn true, err\n\t\t}\n\t}\n\n\treturn false, err\n}", "title": "" }, { "docid": "773bd603d2eaa8480bad6ca26cc3e775", "score": "0.4967093", "text": "func (f *CommitFileStats) Resolved() bool {\n\treturn f.Repository.Resolved() &&\n\t\tf.To.Resolved() &&\n\t\t(f.From == nil || f.From.Resolved())\n}", "title": "" }, { "docid": "7e9083639cdf7cb353c499e75202e65f", "score": "0.49474162", "text": "func (this *Repo) fileWasChanged(result chan bool, errChan chan error, fileName string) {\n\tfileTracked, err := tt.GetFileObjFromFile(path.Join(this.GetTrackedDir(), fileName))\n\tif err != nil {\n\t\tresult <- false\n\t\terrChan <- err\n\t\treturn\n\t}\n\tfileBackup, err := tt.GetFileObjFromFile(path.Join(this.GetBackupDir(), fileName))\n\tif err != nil {\n\t\tresult <- false\n\t\terrChan <- err\n\t\treturn\n\t}\n\n\tresult <- diff.WasModified(*fileBackup, *fileTracked)\n\terrChan <- err\n}", "title": "" }, { "docid": "1540c9a430a135bdc93ea26020ecc36b", "score": "0.49467757", "text": "func (o *SoftwarerepositoryCifsServer) HasRemoteFile() bool {\n\tif o != nil && o.RemoteFile != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "9d1cda84d75030340339ecf03f597ac2", "score": "0.49208146", "text": "func (o *OCIContentID) Local() bool {\n\treturn len(o.repoName) == 0\n}", "title": "" }, { "docid": "f97ee942adcef00b4856374f54010237", "score": "0.49191692", "text": "func isGoFile(fi os.FileInfo) bool {\n\tif fi.IsDir() {\n\t\treturn false\n\t}\n\n\tname := fi.Name()\n\tif strings.HasPrefix(name, \".\") {\n\t\treturn false\n\t}\n\n\treturn strings.HasSuffix(name, \".go\") && !strings.HasSuffix(name, \"_test.go\")\n}", "title": "" }, { "docid": "df060ae782dd555278000978b2b11af6", "score": "0.49109593", "text": "func (param *Param) IsFile() bool {\n\treturn param.isFile\n}", "title": "" }, { "docid": "9a43ec086790e8b5cd3fa7e5e6cd8a76", "score": "0.49108368", "text": "func (entity *RepoEntity) isClean() bool {\n\tstatus := entity.StatusWithGit()\n\tstatus = helpers.TrimTrailingNewline(status)\n\tif status != \"?\" {\n\t\tverbose := strings.Split(status, \"\\n\")\n\t\tlastLine := verbose[len(verbose)-1]\n\t\t// earlier versions of git returns \"working directory clean\" instead of\n\t\t//\"working tree clean\" message\n\t\tif strings.Contains(lastLine, \"working tree clean\") ||\n\t\t\tstrings.Contains(lastLine, \"working directory clean\") {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "123e48f974d8d0e15523759ed4dc7495", "score": "0.4892976", "text": "func (r *RepoFile) Has(name string) bool {\n\t_, ok := r.Get(name)\n\treturn ok\n}", "title": "" }, { "docid": "56ccde90320054fb4d8945b848965afb", "score": "0.4887536", "text": "func (o *IssueAddFileCreated) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "76815338804d2c25ee46dda61e1d4799", "score": "0.48828477", "text": "func IsFileInHistory(path string) bool {\n\tfor _, file := range history {\n\t\tif file[\"path\"] == path {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "5f1e13eb44e021166e19e5d82cc7210b", "score": "0.48791128", "text": "func IsLocal() bool {\n\treturn local\n}", "title": "" }, { "docid": "be12ce0376070f715fd91e17b377ea5b", "score": "0.4861318", "text": "func (r *Ref) IsRaw() bool {\n\treturn r.SHA == r.Path\n}", "title": "" }, { "docid": "961a59f150e94be887e7aae116fabcab", "score": "0.4858917", "text": "func (lg *LocalGit) Exists() (string, error) {\n\tvar err error\n\tlg.gitPath, err = lg.exec.LookPath(\"git\")\n\treturn lg.gitPath, err\n}", "title": "" }, { "docid": "24f7186cbb43158e259a2f4792cd35f7", "score": "0.48473245", "text": "func (w *FSWatcher) isModified(filepath string, previousHash string) (bool, string) {\n\thash, err := hashFile(filepath)\n\tif err != nil {\n\t\tw.logger.Warn(\"Unable to read the file\", zap.String(\"file\", filepath), zap.Error(err))\n\t\treturn true, \"\"\n\t}\n\treturn previousHash != hash, hash\n}", "title": "" }, { "docid": "7f7025aa5aaeb6d61512273079187f8f", "score": "0.48450533", "text": "func hasGit() bool {\n\thasGitCache.once.Do(func() {\n\t\tif _, err := exec.LookPath(\"git\"); err != nil {\n\t\t\treturn\n\t\t}\n\t\thasGitCache.found = true\n\t})\n\treturn hasGitCache.found\n}", "title": "" }, { "docid": "b9ab6e50539bf3841bf389461503a8ab", "score": "0.48309615", "text": "func IsGoFile(fileName string) bool {\n\treturn strings.HasSuffix(fileName, \".go\")\n}", "title": "" }, { "docid": "5ba765059e4b262500a7af0bec3f1bee", "score": "0.48160854", "text": "func (proj Project) IsOpened() bool {\n\treturn proj.Status == \"opened\"\n}", "title": "" }, { "docid": "5a83ce746143342d3a0a40fc602018f1", "score": "0.4814546", "text": "func (git git) hasChanges() (bool, error) {\n\t_, err := git.system.exec(\"git\", \"diff\", \"--quiet\")\n\tif exitError, ok := err.(*exec.ExitError); ok {\n\t\tif exitError.ExitCode() == 1 {\n\t\t\treturn true, nil\n\t\t}\n\t}\n\treturn false, err\n}", "title": "" }, { "docid": "7bd342820af7d57381a57ff8b2e06251", "score": "0.4808621", "text": "func (c *FileConfig) IsSet() bool {\n\treturn len(c.Path) > 0\n}", "title": "" }, { "docid": "b01b2a9939c50935593c8940f4b4cfab", "score": "0.4792694", "text": "func detectCvs() (string) {\n git, err := isFolderPresent(path + \"/.git\")\n if err != nil { panic(err) }\n\n var cvs string\n if git == true {\n fmt.Printf(\"detected git cvs in %v\\n\", path)\n cvs = \"git\"\n }\n\n return cvs\n}", "title": "" }, { "docid": "29473c14fe2f5e67a1da79cb7e3d263c", "score": "0.4782226", "text": "func (path PathImpl) IsFile() bool {\n\treturn path.Exists() && !path.IsDir()\n}", "title": "" }, { "docid": "18b6b0e4ca18f428d9378e2627cf12cb", "score": "0.47791982", "text": "func isIgnoredForWatch(path string) bool {\n\tbasename := filepath.Base(path)\n\treturn basename == \".git\" ||\n\t\tbasename == \".hg\" ||\n\t\tbasename == \".svn\" ||\n\t\tbasename == \".DS_Store\"\n}", "title": "" }, { "docid": "b7b22f77cdcf221726312d500352262e", "score": "0.4775486", "text": "func isHiddenFile(filePath string) bool {\n\tbasename := path.Base(filePath)\n\treturn string(basename[0]) == \".\"\n}", "title": "" }, { "docid": "defc7ea3f1df4c0acdb4dab3a0dc45e8", "score": "0.47706679", "text": "func isGoFile(f os.FileInfo) bool {\n\t// ignore non-Go files\n\tname := f.Name()\n\treturn !f.IsDir() && !strings.HasPrefix(name, \".\") && strings.HasSuffix(name, \".go\")\n}", "title": "" }, { "docid": "445b896c00d4138b6d4a6901a3239962", "score": "0.4746792", "text": "func (f *File) IsTemporary() bool {\n\treturn f.info.Mode()&os.ModeTemporary != 0\n}", "title": "" }, { "docid": "af24535ea2e0ddda07e509ba7ee8592e", "score": "0.4740468", "text": "func IsCommitted(srv *PBServer, index int) (committed bool) {\n\tsrv.mu.Lock()\n\tdefer srv.mu.Unlock()\n\tif srv.commitIndex >= index {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "8f02187c0294f44aaf327abe58ae2ae6", "score": "0.47372404", "text": "func IsLocalImage(image types.ImageInspect) bool {\n\treturn len(image.RepoDigests) == 0\n}", "title": "" }, { "docid": "248e40d3a990888931d28cab57ad55f9", "score": "0.47318727", "text": "func (o *ViewProjectFile) HasUploadedBy() bool {\n\tif o != nil && o.UploadedBy != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "b88733e04f2ed2571117b0f5c4031f7f", "score": "0.47278872", "text": "func (g *Git) Exists(ctx context.Context, name string) bool {\n\treturn g.fs.Exists(ctx, name)\n}", "title": "" }, { "docid": "1e812121ccbd0f7562d21322b8d6bf4f", "score": "0.47254097", "text": "func IsLocal() bool {\n\targs := os.Args[1:]\n\tfor _, arg := range args {\n\t\tif arg == \"testLocal=true\" {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "8862c3254cd85d507904cb1b31b97ab3", "score": "0.47161794", "text": "func (o *ProjectFeatureOrder) HasFiles() bool {\n\tif o != nil && o.Files != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "32323933cf729d6db75ecd9955125798", "score": "0.47104627", "text": "func (o *ViewProjectFile) HasOriginalName() bool {\n\tif o != nil && o.OriginalName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "82e89c44325ae515668de4ed2c595d1f", "score": "0.47083962", "text": "func (g Git) Untracked(path string) (int, error) {\n\targs := []string{\"ls-files\", \"--others\", \"--exclude-standard\"}\n\toutput, err := g.Exec(path, args)\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(\"Unable to find untracked: %w\", err)\n\t}\n\treturn len(strings.Split(string(output), \"\\n\")) - 1, nil\n}", "title": "" }, { "docid": "265fefa0896929097a37ffa4ba1a263c", "score": "0.47075543", "text": "func (*CommitFileStats) IsNullable() bool {\n\treturn true\n}", "title": "" }, { "docid": "d419148b7996963515667e1bec0b1af7", "score": "0.4704952", "text": "func (o *CloudSyncStatus) HasLastUploadFile() bool {\n\tif o != nil && o.LastUploadFile != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "4a83ceff49d700baf9f96eea11030fb0", "score": "0.46964315", "text": "func (r *Ref) TrackedRef() (res *Ref, err error) {\n\tremote, err := r.Tracks()\n\tif err != nil {\n\t\treturn nil,err\n\t}\n\tres, err = r.RemoteBranch(remote)\n\treturn res,err\n}", "title": "" }, { "docid": "c3582a02e3323c215b9b3fa1961d8386", "score": "0.4687334", "text": "func workingSetContainsOnlyUntrackedTables(ctx context.Context, roots doltdb.Roots) (bool, error) {\n\t_, unstaged, err := diff.GetStagedUnstagedTableDeltas(ctx, roots)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\t// All ignored files are also untracked files\n\tfor _, tableDelta := range unstaged {\n\t\tif !tableDelta.IsAdd() {\n\t\t\treturn false, nil\n\t\t}\n\t}\n\n\treturn true, nil\n}", "title": "" }, { "docid": "791f1de6a1d8285f6e6d3efa99905405", "score": "0.46870956", "text": "func (j *Job) Track() (bool, error) {\n return Bool(j.cli.Do(\"track\", 0, \"track\", j.Jid, timestamp(), \"\"))\n}", "title": "" }, { "docid": "57a4eb67a7baf90b8b854a65f652914f", "score": "0.46840373", "text": "func IsLocal() bool {\n\targs := os.Args[1:]\n\tfor _,arg := range args {\n\t\tif arg == \"testLocal=true\"{\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "d241e6e112b0da9b23a27dc709fe62e4", "score": "0.46819893", "text": "func (o *ViewProjectFile) HasUploadedByUserID() bool {\n\tif o != nil && o.UploadedByUserID != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "b274b6143d8193207689bceda0194854", "score": "0.46718657", "text": "func (g *GPS) Track() bool {\n\treturn len(g.AreaCodes) == 0 || g.AreaCodes[0] >= 0\n}", "title": "" }, { "docid": "ba6fa55978e88fe3fd1cf0db3f33e4d8", "score": "0.46668917", "text": "func (s *Status) IsModified(path string, staging bool) bool {\n\tpath = filepath.ToSlash(path)\n\tfor _, f := range s.Files {\n\t\tif path == f.Path && f.InStaging() == staging {\n\t\t\treturn f.IsModified()\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "01c12f888852609e60ad8039f414fe85", "score": "0.46605748", "text": "func (f GlusterFile) hasEntity() bool {\n\treturn f.glf != nil\n}", "title": "" }, { "docid": "c1f64fcf32ad8a6ea49f38830e57f8e2", "score": "0.46531296", "text": "func (se *SnapshotEnv) HasFlagFile() bool {\n\tfp := filepath.Join(se.finalDir, fileutil.SnapshotFlagFilename)\n\tif _, err := os.Stat(fp); os.IsNotExist(err) {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "309aa374e099e3013413a102e15772fd", "score": "0.4651376", "text": "func IsRepo(ctx context.Context) bool {\n\tout, err := Run(ctx, \"rev-parse\", \"--is-inside-work-tree\")\n\treturn err == nil && strings.TrimSpace(out) == \"true\"\n}", "title": "" }, { "docid": "2448088416ce19df6db331d97ada216e", "score": "0.46429494", "text": "func IsInsideGitDir(g *types.Cmd) {\n\tg.AddOptions(\"--is-inside-git-dir\")\n}", "title": "" }, { "docid": "bcae4ccf4eac3cbd5fd2268e6cedc773", "score": "0.46414334", "text": "func (o *FileProjectFile) HasPrivacy() bool {\n\tif o != nil && o.Privacy != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "3fdccbbfb309be22b32526586096699b", "score": "0.46374512", "text": "func (g *Git) Changes() (bool, error) {\n\tcmd := exec.Command(\"git\", \"status\", \"-s\")\n\tstdOut, err := g.run(cmd)\n\treturn len(stdOut) > 0, err\n}", "title": "" }, { "docid": "ad87333625e3c19d3b7f47bb8f9ca77e", "score": "0.46373063", "text": "func (i File) CanBeEdited() bool {\n\treturn i.Type == cnst.TEXT\n}", "title": "" }, { "docid": "2ed6d0470cf95320b896a13dd5601b0f", "score": "0.46323594", "text": "func IsHttpRepo(url *url.URL) bool {\n\trefs := gitRefs(*url)\n\n\tresp, err := http.Head(refs.String())\n\tif err == nil {\n\t\treturn resp.StatusCode >= 200 && resp.StatusCode <= 299\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "2c622a275e52e5de6fe03bbd2988e267", "score": "0.46180883", "text": "func FileHasChanged() {\n\tcfg.changed = true\n}", "title": "" }, { "docid": "da4d5b70be922bb2a9fe1b7dcdfe9167", "score": "0.46140087", "text": "func IsOnGitpod() bool {\n\treturn os.Getenv(\"GITPOD_WORKSPACE_ID\") != \"\"\n}", "title": "" }, { "docid": "cc62a6d96b4e683976f88eb48ef96c9f", "score": "0.4612582", "text": "func (o *File) IsOpen() gdnative.Bool {\n\t//log.Println(\"Calling _File.IsOpen()\")\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(\"_File\", \"is_open\")\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": "2ff87f14c1efac6291ae42e99f570edb", "score": "0.46120122", "text": "func (p *Player) IsScoped() bool {\n\treturn getBool(p.Entity, \"m_bIsScoped\")\n}", "title": "" }, { "docid": "2374307653f135cf766754ebc40367af", "score": "0.4610259", "text": "func (o *FileProjectFile) HasNotify() bool {\n\tif o != nil && o.Notify != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "81bed9214efa75f81e41d41ffd770f7b", "score": "0.46057412", "text": "func IsAnnexFile(path string) bool {\n\treturn strings.HasPrefix(path, \".git/annex\")\n}", "title": "" }, { "docid": "1324e02b80f2b6ac75b76c7cd9033932", "score": "0.46036863", "text": "func (o *ViewProjectFile) HasUploadedDate() bool {\n\tif o != nil && o.UploadedDate != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "decdeaa88ee5dea800f19e83583d32ba", "score": "0.4603334", "text": "func isSoftPackage(filename string) bool {\n\treturn filepath.Dir(filename) == filepath.Join(gopath, \"src\", \"github.com\", \"YuriyNasretdinov\", \"hotreload\")\n}", "title": "" }, { "docid": "ea94fdd57add53abeac22454ba6218e1", "score": "0.45995513", "text": "func Track(c *cli.Context) error {\n\tif c.NArg() < 1 {\n\t\treturn fmt.Errorf(\"Track error: name required\")\n\t}\n\n\tbroConfigDir, err := getBroConfigDir()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// make sure it exists\n\tname := strings.Trim(c.Args().First(), \" \")\n\t_, err = os.Stat(filepath.Join(broConfigDir, name))\n\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\treturn fmt.Errorf(\"Track error: project does not exist\")\n\t\t}\n\t\treturn err\n\t}\n\n\t// make sure the .bro directory is created\n\tdir, err := initializeBroDir()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// marshal the json\n\tbrofiguration := Brofiguration{name}\n\tmarshalled, err := json.Marshal(brofiguration)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err = ioutil.WriteFile(filepath.Join(dir, \"bro.json\"), marshalled, os.ModePerm); err != nil {\n\t\treturn err\n\t}\n\n\tfmt.Printf(\"Tracking against %q:\\n\", name)\n\treturn nil\n}", "title": "" } ]
4fbd51d6a219339f1a1fa78b14beca15
Filesystems returns a slice of ZFS filesystems. A filter argument may be passed to select a filesystem with the matching name, or empty string ("") may be used to select all filesystems.
[ { "docid": "5429a431b9b84c6229ff28ad5a608b01", "score": "0.760576", "text": "func Filesystems(filter string) ([]zfsiface.Dataset, error) {\n\treturn listByType(DatasetFilesystem, filter)\n}", "title": "" } ]
[ { "docid": "3660851a8b91c372d05949a8f6b86d8d", "score": "0.5647313", "text": "func zfs(arg ...string) ([][]string, error) {\n\tc := command{Command: \"zfs\"}\n\treturn c.Run(arg...)\n}", "title": "" }, { "docid": "938bbbc86a1d0d0c6a35f1a5b3d1cd18", "score": "0.5642113", "text": "func (r *Registry) Filesystems() []VolumeName {\n\tr.TopLevelFilesystemsLock.Lock()\n\tdefer r.TopLevelFilesystemsLock.Unlock()\n\tfilesystemNames := []VolumeName{}\n\tfor name, _ := range r.TopLevelFilesystems {\n\t\tfilesystemNames = append(filesystemNames, name)\n\t}\n\tsort.Sort(ByNames(filesystemNames))\n\treturn filesystemNames\n}", "title": "" }, { "docid": "13dec0c64e9ce1b05c248c989ce3d5f2", "score": "0.5557225", "text": "func (a *Agent) DiscoverFilesystems(timeout time.Duration) ([]*Filesystem, error) {\n\tfs := []*Filesystem{}\n\n\tdata, err := a.queryJSON(\"vfs.fs.discovery\", timeout)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, f := range data[\"data\"] {\n\t\tfilesystem := &Filesystem{\n\t\t\tName: f[\"{#FSNAME}\"].(string),\n\t\t\tType: f[\"{#FSTYPE}\"].(string),\n\t\t}\n\n\t\tfs = append(fs, filesystem)\n\t}\n\n\treturn fs, err\n}", "title": "" }, { "docid": "3a4ecc89ce4f8fdc0707bf26c2e0ddb7", "score": "0.51970494", "text": "func FilterEFISystemPartitions(devices []BlockDev) ([]BlockDev, error) {\n\treturn PartitionsByGUID(devices, SystemPartitionGUID.String())\n}", "title": "" }, { "docid": "0296cb08f709f87673c828e623f31c8c", "score": "0.51783687", "text": "func list() []Dataset {\n\n\toutput, err := exec.Command(\"zfs\", \"list\", \"-H\").Output()\n\tcrash(err)\n\tlines := strings.Split(string(output), \"\\n\")\n\tvar datasets []Dataset\n\tfor i := 0; i < len(lines)-1; i++ {\n\t\tlineSplit := strings.Split(lines[i], \"\\t\")\n\t\tmountPoint := lineSplit[4]\n\t\tif mountPoint != \"/\" && mountPoint != \"none\" && mountPoint != \"-\" && mountPoint != \"/\" {\n\t\t\tdatasets = append(datasets, Dataset{Name: lineSplit[0], Mountpoint: lineSplit[4]})\n\t\t}\n\t}\n\n\treturn datasets\n}", "title": "" }, { "docid": "c69d74831d595704340bd08cdae986f4", "score": "0.499706", "text": "func Volumes(filter string) ([]zfsiface.Dataset, error) {\n\treturn listByType(DatasetVolume, filter)\n}", "title": "" }, { "docid": "d1bfac2abceb3260712677edb2b9bb16", "score": "0.49545407", "text": "func getFs() []string {\n\tf, err := os.Open(\"/etc/mtab\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer f.Close()\n\tscanner := bufio.NewScanner(f)\n\tstopwords := []string{\"/proc\", \"/sys\", \"/dev/pts\", \"nfs\"}\n\tvar fs []string\n\tfor scanner.Scan() {\n\t\t// Get the second word in s.Text()\n\t\tdisk := strings.Fields(scanner.Text())[1]\n\t\tvar virtualDevice bool\n\t\tfor _, v := range stopwords {\n\t\t\tif strings.Contains(disk, v) {\n\t\t\t\tvirtualDevice = true\n\t\t\t}\n\t\t}\n\t\tif !virtualDevice {\n\t\t\tfs = append(fs, disk)\n\t\t}\n\t\tif err := scanner.Err(); err != nil {\n\t\t\tlog.Println(\"scanner:\", err)\n\t\t}\n\t}\n\treturn fs\n}", "title": "" }, { "docid": "1f627efb703db7ba76d519dc1602eaf5", "score": "0.4953488", "text": "func getSupportedFilesystem() ([]string, error) {\n\tvar err error\n\tfs, err := ioutil.ReadFile(\"/proc/filesystems\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar returnValue []string\n\tfor _, f := range strings.Split(string(fs), \"\\n\") {\n\t\tn := strings.Fields(f)\n\t\tif len(n) != 1 {\n\t\t\tcontinue\n\t\t}\n\t\treturnValue = append(returnValue, n[0])\n\t}\n\treturn returnValue, err\n\n}", "title": "" }, { "docid": "0240a98176599182d87308c61735413d", "score": "0.49142617", "text": "func getFilesSlice(root *os.File) (SortableFiles, error) {\n\tif root == nil {\n\t\treturn nil, nil\n\t}\n\tfileInfo, err := root.Stat()\n\tif err != nil {\n\t\tif Debug {\n\t\t\tLogger.Printf(\"Cannot stat File %s\", root.Name())\n\t\t}\n\t\treturn nil, err\n\t}\n\tif !fileInfo.IsDir() {\n\t\treturn SortableFiles{SortableFile{File: root}}, nil\n\t} else {\n\t\tvar fl SortableFiles\n\t\terr := filepath.Walk(root.Name(), func(path string, info os.FileInfo, err error) error {\n\t\t\tif info.IsDir() {\n\t\t\t\tif strings.HasPrefix(info.Name(), \".\") {\n\t\t\t\t\treturn filepath.SkipDir\n\t\t\t\t}\n\t\t\t}\n\t\t\tif strings.HasSuffix(path, \".tf\") {\n\t\t\t\tf, err := os.Open(path)\n\t\t\t\tif err != nil {\n\t\t\t\t\tif Debug {\n\t\t\t\t\t\tLogger.Printf(\"Cannot open File %s\", path)\n\t\t\t\t\t}\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tfl = append(fl, SortableFile{File: f})\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\t\tif err != nil {\n\t\t\tif Debug {\n\t\t\t\tLogger.Printf(\"Cannot walk the directory \"+\n\t\t\t\t\t\"%s tree. Error: %s\", root.Name(), err)\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t\tsort.Sort(fl)\n\t\treturn fl, nil\n\t}\n}", "title": "" }, { "docid": "7c705277dc5da1b9718637e9d0417dcb", "score": "0.49038744", "text": "func GetAllVolumesWithIO(contexts []*scheduler.Context) ([]*volume.Volume, error) {\n\n\tallVolsWithIO := []*volume.Volume{}\n\tfor _, eachContext := range contexts {\n\t\tvols, err := Inst().S.GetVolumes(eachContext)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Failed to get app %s's volumes\", eachContext.App.Key)\n\t\t}\n\t\tlog.Infof(\"list of all volumes present in the cluster [%v]\", vols)\n\t\tfor _, eachVol := range vols {\n\t\t\tisIOsInProgress, err := Inst().V.IsIOsInProgressForTheVolume(&node.GetStorageNodes()[0], eachVol.ID)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tif isIOsInProgress {\n\t\t\t\tallVolsWithIO = append(allVolsWithIO, eachVol)\n\t\t\t}\n\t\t}\n\t}\n\treturn allVolsWithIO, nil\n}", "title": "" }, { "docid": "83264cd4276bdc27ea86c0b07aacc898", "score": "0.48772028", "text": "func (v *Volume) FileSystem() []string {\n\treturn strings.Split(v.Spec.FileSystem, \" \")\n}", "title": "" }, { "docid": "bb0f0e43a6c5754a5c6d3f4a1aafd6ce", "score": "0.47964656", "text": "func Datasets(filter string) ([]zfsiface.Dataset, error) {\n\treturn listByType(\"all\", filter)\n}", "title": "" }, { "docid": "4998bc4af23b5d561810c76913bcf1b2", "score": "0.47455502", "text": "func WalkFileSystem(fs http.FileSystem, filterFn func(path string) bool, walkFn func(path string) error) error {\n\tpath := \"/\"\n\troot, err := fs.Open(path)\n\tif err != nil {\n\t\treturn errors.WithMessage(err, fmt.Sprintf(\"open walk root %s\", path))\n\t}\n\tdefer func() { _ = root.Close() }()\n\tfi, err := root.Stat()\n\tif err != nil {\n\t\treturn errors.WithMessage(err, fmt.Sprintf(\"stat walk root %s\", path))\n\t}\n\n\ttype queueItem struct {\n\t\tpath string\n\t\tfi os.FileInfo\n\t}\n\tqueue := []queueItem{{path: path, fi: fi}}\n\tfor len(queue) > 0 {\n\t\titem := queue[0]\n\t\tqueue = queue[1:]\n\t\tif item.fi.Mode().IsDir() {\n\t\t\tif strings.HasPrefix(item.fi.Name(), \".\") && item.fi.Name() != \".\" {\n\t\t\t\tcontinue // skip dot-dirs\n\t\t\t}\n\t\t\tdir, err := fs.Open(item.path)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.WithMessage(err, fmt.Sprintf(\"open %s\", item.path))\n\t\t\t}\n\t\t\tentries, err := dir.Readdir(-1)\n\t\t\t_ = dir.Close()\n\t\t\tif err != nil {\n\t\t\t\treturn errors.WithMessage(err, fmt.Sprintf(\"readdir %s\", item.path))\n\t\t\t}\n\t\t\tsort.Slice(entries, func(i, j int) bool { return entries[i].Name() < entries[j].Name() })\n\t\t\tfor _, e := range entries {\n\t\t\t\tqueue = append(queue, queueItem{path: filepath.Join(item.path, e.Name()), fi: e})\n\t\t\t}\n\t\t} else if filterFn(item.path) {\n\t\t\tif err := walkFn(strings.TrimPrefix(item.path, \"/\")); err != nil {\n\t\t\t\treturn errors.WithMessage(err, fmt.Sprintf(\"walk %s\", item.path))\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a5682d96283f6a2208d24e8d7e3c6e5a", "score": "0.47241163", "text": "func NewFilters(flags *pflag.FlagSet, includeAllFilters bool) func() (Filters, error) {\n\tvar includes, excludes, kindIncludes, kindExcludes, nsIncludes, nsExcludes []string\n\tvar includeClusterScopedObjects bool\n\n\tflags.StringArrayVarP(&includes, \"component\", \"c\", nil, \"include just this component\")\n\tflags.StringArrayVarP(&excludes, \"exclude-component\", \"C\", nil, \"exclude this component\")\n\tif includeAllFilters {\n\t\tflags.StringArrayVarP(&kindIncludes, \"kind\", \"k\", nil, \"include objects with this kind\")\n\t\tflags.StringArrayVarP(&kindExcludes, \"exclude-kind\", \"K\", nil, \"exclude objects with this kind\")\n\t\tflags.StringArrayVarP(&nsIncludes, \"include-namespace\", \"p\", nil, \"include objects with this namespace\")\n\t\tflags.StringArrayVarP(&nsExcludes, \"exclude-namespace\", \"P\", nil, \"exclude objects with this namespace\")\n\t\tflags.BoolVar(&includeClusterScopedObjects, \"include-cluster-objects\", true, \"include cluster scoped objects, false by default when namespace filters present\")\n\t}\n\treturn func() (Filters, error) {\n\t\tof, err := newKindFilter(kindIncludes, kindExcludes)\n\t\tif err != nil {\n\t\t\treturn Filters{}, err\n\t\t}\n\t\tcf, err := NewComponentFilter(includes, excludes)\n\t\tif err != nil {\n\t\t\treturn Filters{}, err\n\t\t}\n\t\tnf, err := newStringFilter(\"namespaces\", nsIncludes, nsExcludes)\n\t\tif err != nil {\n\t\t\treturn Filters{}, err\n\t\t}\n\t\tif nf.HasFilters() {\n\t\t\tif !flags.Changed(\"include-cluster-objects\") {\n\t\t\t\tincludeClusterScopedObjects = false\n\t\t\t}\n\t\t}\n\t\treturn Filters{\n\t\t\tincludes: includes,\n\t\t\texcludes: excludes,\n\t\t\tkindFilter: of,\n\t\t\tcomponentFilter: cf,\n\t\t\tnamespaceFilter: nf,\n\t\t\texcludeClusterObjects: !includeClusterScopedObjects,\n\t\t}, nil\n\t}\n}", "title": "" }, { "docid": "cadebdad41b46302c2d74e8c477c317c", "score": "0.46791115", "text": "func GetMounts(f FilterFunc) ([]*Info, error) {\n\treturn parseMountTable(f)\n}", "title": "" }, { "docid": "5f6ed54ac306b4c374c55f8f3616ab6c", "score": "0.4647797", "text": "func (self *FileSystemList) Get() error {\n\tcapacity := len(self.List)\n\tif capacity == 0 {\n\t\tcapacity = 4\n\t}\n\tself.List = make([]FileSystem, capacity)\n\n\titer, err := NewWindowsVolumeIterator()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor iter.Next() {\n\t\tvolume := iter.Volume()\n\t\tself.List = append(self.List, volume)\n\t}\n\titer.Close()\n\n\treturn iter.Error()\n}", "title": "" }, { "docid": "b52b184048acca5a8f55253771ef4a30", "score": "0.46181387", "text": "func listFilter(ctx *build.Context, cwd, path string, omitChild, omitStd bool) func(i string) bool {\n\treturn func(i string) bool {\n\t\tswitch {\n\t\tcase omitChild && isChildPackage(path, i):\n\t\t\treturn false\n\t\tcase omitStd && isStandardPackage(ctx, cwd, i):\n\t\t\treturn false\n\t\t}\n\t\treturn true\n\t}\n}", "title": "" }, { "docid": "ef2a7526cf6ba5e0f6512c7d388e25d0", "score": "0.46172076", "text": "func GetDisks() ([]Disk, error) {\n\tcontent, err := runner.run(\"df\")\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn parseDf(content)\n}", "title": "" }, { "docid": "3478b0a8c8ebb8a0ae249b53c6b3be52", "score": "0.4603255", "text": "func AvailableFilters() []string {\n\tctx := context.Background()\n\treturn filters.Drivers(ctx)\n}", "title": "" }, { "docid": "13f1cf573be4e1b22e7f0269e4d478e1", "score": "0.45944598", "text": "func New(filesystems ...fs.FS) *FS {\n\treturn &FS{fallbackFilesystems: filesystems}\n}", "title": "" }, { "docid": "742cf0abdfc0b8eafa9ed823f2c1dd63", "score": "0.45767954", "text": "func readFS(path string) ([]string) { \n\tm := make([]string,0)\n\tdirname := \"./\"+path\n d, err := os.Open(dirname) // Open directory\n if err != nil {\n fmt.Println(err)\n os.Exit(1)\n }\n defer d.Close() // Make sure directory is closed\n fi, err := d.Readdir(-1) // Read directory\n if err != nil {\n fmt.Println(err)\n os.Exit(1)\n }\n for _, fi := range fi {\n if fi.Mode().IsRegular() {\n \tm = append(m,fi.Name()) // Add file name to list\n }\n }\n return m\n}", "title": "" }, { "docid": "0682356a0c7631d1c127057d4eb23cb4", "score": "0.45497063", "text": "func InitFilter(home string, options []string, _ idtools.IdentityMapping) (graphdriver.Driver, error) {\n\tlog.G(context.TODO()).Debugf(\"WindowsGraphDriver InitFilter at %s\", home)\n\n\tfsType, err := winiofs.GetFileSystemType(home)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif strings.EqualFold(fsType, \"refs\") {\n\t\treturn nil, fmt.Errorf(\"%s is on an ReFS volume - ReFS volumes are not supported\", home)\n\t}\n\n\t// Setting file-mode is a no-op on Windows, so passing \"0\" to make it more\n\t// transparent that the filemode passed has no effect.\n\tif err = system.MkdirAll(home, 0); err != nil {\n\t\treturn nil, errors.Wrapf(err, \"windowsfilter failed to create '%s'\", home)\n\t}\n\n\tstorageOpt := map[string]string{\n\t\t\"size\": defaultSandboxSize,\n\t}\n\n\tfor _, o := range options {\n\t\tk, v, _ := strings.Cut(o, \"=\")\n\t\tstorageOpt[strings.ToLower(k)] = v\n\t}\n\n\topts, err := parseStorageOpt(storageOpt)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"windowsfilter failed to parse default storage options\")\n\t}\n\n\td := &Driver{\n\t\tinfo: hcsshim.DriverInfo{\n\t\t\tHomeDir: home,\n\t\t\tFlavour: filterDriver,\n\t\t},\n\t\tcache: make(map[string]string),\n\t\tctr: graphdriver.NewRefCounter(&checker{}),\n\t\tdefaultStorageOpts: opts,\n\t}\n\treturn d, nil\n}", "title": "" }, { "docid": "3b1ac97dfe9297c3bac33a64c53d7543", "score": "0.45191774", "text": "func (p *FsBlockstoreProvider) List() ([]string, error) {\r\n\treturn util.ListSubdirs(p.conf.getChainsDir())\r\n}", "title": "" }, { "docid": "7784ff3db5cf9e6509fbbe56127558e4", "score": "0.45121747", "text": "func New(filesystems ...fslib.FS) *FS {\n\treturn &FS{fallbackFilesystems: filesystems}\n}", "title": "" }, { "docid": "224812950df7f483739568386a871cd4", "score": "0.4486702", "text": "func Disks() ([]Disk, error) {\n\tcmd := exec.Command(\"lsblk\", \"-bdnp\", \"-o\", \"name,size,tran\")\n\tpipe, _ := cmd.StdoutPipe()\n\tcmd.Start()\n\tinput := bufio.NewScanner(pipe)\n\tvar disks []Disk\n\tfor input.Scan() {\n\t\tfields := strings.Fields(input.Text())\n\t\tsize, _ := strconv.ParseInt(fields[1], 0, 64)\n\t\tdisk := Disk{Name: fields[0], Size: size, Type: fields[2]}\n\t\tdisks = append(disks, disk)\n\t}\n\tcmdErr := cmd.Wait()\n\tif cmdErr != nil {\n\t\treturn make([]Disk, 0), fmt.Errorf(\"waiting lsblk: %v\", cmdErr)\n\t}\n\treturn disks, nil\n}", "title": "" }, { "docid": "dc4553cce1e13e14f7f34224194f0315", "score": "0.44728214", "text": "func FileSelection(prompt string, filtersMap map[string][]string) (files []string, err error) {\n\targs := []string{`--file-selection`, `--multiple`}\n\tfilters := buildFileFilter(filtersMap)\n\targs = append(args, filters...)\n\n\tg := New(prompt, args...)\n\tresult, err := g.execute()\n\tfiles = strings.Split(result, `|`)\n\treturn\n}", "title": "" }, { "docid": "1e4c15a0f5442d0de5c6b6b6779df22e", "score": "0.44718727", "text": "func filtersToReadOptions(filters []bigtable.Filter) []bigtable.ReadOption {\n\tif len(filters) == 0 {\n\t\treturn []bigtable.ReadOption{}\n\t}\n\n\t// If there is more than one filter then chain them.\n\tif len(filters) > 1 {\n\t\tfilters = []bigtable.Filter{bigtable.ChainFilters(filters...)}\n\t}\n\n\treturn []bigtable.ReadOption{bigtable.RowFilter(filters[0])}\n}", "title": "" }, { "docid": "f1ab0d8953c1dd0891f32f38d672cf16", "score": "0.44603798", "text": "func (z *ZarManager) constructFilter() {\n\tfmt.Println(\"Constructing Filter\")\n\n\tvar path = \"\"\n\n\tfor i:=0; i < len(z.Metadata); i++ {\n\t\tname:=z.Metadata[i].Name\n\t\tswitch MetaType := z.Metadata[i].Type; MetaType {\n\t\tcase (RegularFile):\n\t\t\t// Add to filter\n\t\t\tz.Filter.AddElement([]byte(path + \"/\" + name))\n\t\tcase (Directory):\n\t\t\t// Name = \"..\" means end of directory\n\t\t\tif (name == \"..\") {\n\t\t\t\t// Remove dir name at end\n\t\t\t\tintPath := strings.Split(path, \"/\")\n\t\t\t\tintPath = intPath[:len(intPath)-1]\n\t\t\t\tpath = strings.Join(intPath, \"/\")\n\t\t\t} else {\n\t\t\t\tpath += \"/\" + name\n\t\t\t}\n\t\tcase (Symlink):\n\t\t\t// Treat like a file, add and hash\n\t\t\tz.Filter.AddElement([]byte(path + \"/\" + name))\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c2742c35cd3e590a1ea0ba5036b45216", "score": "0.44600704", "text": "func (b *cartonFS) Files() []string {\n\tf := make([]string, len(*b))\n\ti := 0\n\tfor k := range *b {\n\t\tf[i] = k\n\t\ti++\n\t}\n\treturn f\n}", "title": "" }, { "docid": "386f6b5208a15a948cf1c8df6c29bca3", "score": "0.44433373", "text": "func readFilters(r io.Reader, count int) (filters []filter, err error) {\n\tif count != 1 {\n\t\treturn nil, errors.New(\"xz: unsupported filter count\")\n\t}\n\tf, err := readFilter(r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn []filter{f}, err\n}", "title": "" }, { "docid": "dfeddcfdae33f74eb1e414f6b707a7c0", "score": "0.44107407", "text": "func (o *Storage) Files(exec boil.Executor, mods ...qm.QueryMod) fileQuery {\n\tvar queryMods []qm.QueryMod\n\tif len(mods) != 0 {\n\t\tqueryMods = append(queryMods, mods...)\n\t}\n\n\tqueryMods = append(queryMods,\n\t\tqm.InnerJoin(\"\\\"files_storages\\\" on \\\"files\\\".\\\"id\\\" = \\\"files_storages\\\".\\\"file_id\\\"\"),\n\t\tqm.Where(\"\\\"files_storages\\\".\\\"storage_id\\\"=?\", o.ID),\n\t)\n\n\tquery := Files(exec, queryMods...)\n\tqueries.SetFrom(query.Query, \"\\\"files\\\"\")\n\n\tif len(queries.GetSelect(query.Query)) == 0 {\n\t\tqueries.SetSelect(query.Query, []string{\"\\\"files\\\".*\"})\n\t}\n\n\treturn query\n}", "title": "" }, { "docid": "ef957716d951a26ac07e250cd61ef212", "score": "0.44008788", "text": "func Filter(seq string, paths []snet.Path) ([]snet.Path, error) {\n\ts, err := pathpol.NewSequence(seq)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn s.Eval(paths), nil\n}", "title": "" }, { "docid": "c8bea3130799ac1cedeb08e42bba83a6", "score": "0.4381039", "text": "func BuildFilter(ff *pb.FlowFilter) (FilterFuncs, error) {\n\tvar fs []FilterFunc\n\n\t// Always prioritize the type filter first. If used it will save a lot of\n\t// decoding time.\n\ttypes := ff.GetEventType()\n\tif len(types) > 0 {\n\t\tfs = append(fs, filterByEventType(types))\n\t}\n\n\tif ff.GetSourceIp() != nil {\n\t\tipf, err := filterByIPs(ff.GetSourceIp(), sourceIP)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfs = append(fs, ipf)\n\t}\n\n\tif ff.GetDestinationIp() != nil {\n\t\tipf, err := filterByIPs(ff.GetDestinationIp(), destinationIP)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfs = append(fs, ipf)\n\t}\n\n\tif ff.GetSourcePod() != nil {\n\t\tpf, err := filterByNamespacedName(ff.GetSourcePod(), sourcePod)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfs = append(fs, pf)\n\t}\n\n\tif ff.GetDestinationPod() != nil {\n\t\tpf, err := filterByNamespacedName(ff.GetDestinationPod(), destinationPod)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfs = append(fs, pf)\n\t}\n\n\tif ff.GetSourceFqdn() != nil {\n\t\tff, err := filterByFQDNs(ff.GetSourceFqdn(), sourceFQDN)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfs = append(fs, ff)\n\t}\n\n\tif ff.GetDestinationFqdn() != nil {\n\t\tff, err := filterByFQDNs(ff.GetDestinationFqdn(), destinationFQDN)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfs = append(fs, ff)\n\t}\n\n\tif ff.GetVerdict() != nil {\n\t\tfs = append(fs, filterByVerdicts(ff.GetVerdict()))\n\t}\n\n\tif ff.GetHttpStatusCode() != nil {\n\t\tif !httpMatchCompatibleEventFilter(types) {\n\t\t\treturn nil, errors.New(\"filtering by http status code requires \" +\n\t\t\t\t\"the event type filter to only match 'l7' events\")\n\t\t}\n\n\t\thsf, err := filterByHTTPStatusCode(ff.GetHttpStatusCode())\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid http status code filter: %v\", err)\n\t\t}\n\t\tfs = append(fs, hsf)\n\t}\n\n\tif ff.GetSourceLabel() != nil {\n\t\tslf, err := filterByLabelSelectors(ff.GetSourceLabel(), sourceLabels)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid source label filter: %v\", err)\n\t\t}\n\t\tfs = append(fs, slf)\n\t}\n\n\tif ff.GetDestinationLabel() != nil {\n\t\tdlf, err := filterByLabelSelectors(ff.GetDestinationLabel(), destinationLabels)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid destination label filter: %v\", err)\n\t\t}\n\t\tfs = append(fs, dlf)\n\t}\n\n\tif ff.GetSourceService() != nil {\n\t\tssf, err := filterByNamespacedName(ff.GetSourceService(), sourceService)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid source service filter: %v\", err)\n\t\t}\n\t\tfs = append(fs, ssf)\n\t}\n\n\tif ff.GetDestinationService() != nil {\n\t\tdsf, err := filterByNamespacedName(ff.GetDestinationService(), destinationService)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid destination service filter: %v\", err)\n\t\t}\n\t\tfs = append(fs, dsf)\n\t}\n\n\tif ff.GetProtocol() != nil {\n\t\tpf, err := filterByProtocol(ff.GetProtocol())\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid protocol filter: %v\", err)\n\t\t}\n\t\tfs = append(fs, pf)\n\t}\n\n\tif ff.GetSourcePort() != nil {\n\t\tspf, err := filterByPort(ff.GetSourcePort(), sourcePort)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid source port filter: %v\", err)\n\t\t}\n\t\tfs = append(fs, spf)\n\t}\n\n\tif ff.GetDestinationPort() != nil {\n\t\tdpf, err := filterByPort(ff.GetDestinationPort(), destinationPort)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid destination port filter: %v\", err)\n\t\t}\n\t\tfs = append(fs, dpf)\n\t}\n\n\tif ff.GetReply() != nil {\n\t\tfs = append(fs, filterByReplyField(ff.GetReply()))\n\t}\n\n\tif ff.GetDnsQuery() != nil {\n\t\tdnsFilters, err := filterByDNSQueries(ff.GetDnsQuery())\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid DNS query filter: %v\", err)\n\t\t}\n\t\tfs = append(fs, dnsFilters)\n\t}\n\n\tif ff.GetSourceIdentity() != nil {\n\t\tfs = append(fs, filterByIdentity(ff.GetSourceIdentity(), sourceEndpoint))\n\t}\n\n\tif ff.GetDestinationIdentity() != nil {\n\t\tfs = append(fs, filterByIdentity(ff.GetDestinationIdentity(), destinationEndpoint))\n\t}\n\n\treturn fs, nil\n}", "title": "" }, { "docid": "943bd2ff4dd0f7c2df052c2742cdfdbf", "score": "0.43802065", "text": "func (l *DefaultLocalProvider) GetMesheryFilters(req *http.Request, page, pageSize, search, order string) ([]byte, error) {\n\tif page == \"\" {\n\t\tpage = \"0\"\n\t}\n\tif pageSize == \"\" {\n\t\tpageSize = \"10\"\n\t}\n\n\tpg, err := strconv.ParseUint(page, 10, 32)\n\tif err != nil {\n\t\treturn nil, ErrPageNumber(err)\n\t}\n\n\tpgs, err := strconv.ParseUint(pageSize, 10, 32)\n\tif err != nil {\n\t\treturn nil, ErrPageSize(err)\n\t}\n\n\treturn l.MesheryFilterPersister.GetMesheryFilters(search, order, pg, pgs)\n}", "title": "" }, { "docid": "7b42065fb4aa46b44789031bba119947", "score": "0.43670142", "text": "func (as *AppStorage) FetchApps(filterString string) ([]model.AppData, error) {\n\tapps := []model.AppData{}\n\n\terr := as.db.View(func(tx *bolt.Tx) error {\n\t\tab := tx.Bucket([]byte(AppBucket))\n\n\t\tif iterErr := ab.ForEach(func(k, v []byte) error {\n\t\t\tif strings.Contains(strings.ToLower(string(k)), strings.ToLower(filterString)) {\n\t\t\t\tapp, err := model.AppDataFromJSON(v)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tapps = append(apps, app)\n\t\t\t}\n\t\t\treturn nil\n\t\t}); iterErr != nil {\n\t\t\treturn iterErr\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn []model.AppData{}, err\n\t}\n\treturn apps, nil\n}", "title": "" }, { "docid": "ed7e4197e324fba68896e5422075248f", "score": "0.43490496", "text": "func (store *MockFlavorStore) Search(criteria *models.FlavorVerificationFC) ([]hvs.SignedFlavor, error) {\n\tvar sfs []hvs.SignedFlavor\n\t// flavor filter empty\n\tif criteria == nil {\n\t\treturn store.flavorStore, nil\n\t}\n\n\t// return all entries\n\tif reflect.DeepEqual(*criteria, models.FlavorFilterCriteria{}) {\n\t\treturn store.flavorStore, nil\n\t}\n\n\tvar sfFiltered []hvs.SignedFlavor\n\t// Flavor ID filter\n\tif len(criteria.FlavorFC.Ids) > 0 {\n\t\tfor _, f := range store.flavorStore {\n\t\t\tfor _, id := range criteria.FlavorFC.Ids {\n\t\t\t\tif f.Flavor.Meta.ID == id {\n\t\t\t\t\tsfFiltered = append(sfFiltered, f)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tsfs = sfFiltered\n\t} else if criteria.FlavorFC.FlavorgroupID != uuid.Nil ||\n\t\tlen(criteria.FlavorFC.FlavorParts) >= 1 || len(criteria.FlavorPartsWithLatest) >= 1 {\n\t\tflavorPartsWithLatestMap := getFlavorPartsWithLatestMap(criteria.FlavorFC.FlavorParts, criteria.FlavorPartsWithLatest)\n\t\t// Find flavors for given flavor group Id\n\t\tvar fIds = store.FlavorFlavorGroupStore[criteria.FlavorFC.FlavorgroupID]\n\n\t\t// for each flavors check the flavor part in flavorPartsWithLatestMap is present\n\t\tfor _, fId := range fIds {\n\t\t\tf, _ := store.Retrieve(fId)\n\t\t\tif f != nil {\n\t\t\t\tvar flvrPart cf.FlavorPart\n\t\t\t\t(&flvrPart).Parse(f.Flavor.Meta.Description.FlavorPart)\n\t\t\t\tif f, _ := store.Retrieve(fId); flavorPartsWithLatestMap[flvrPart] == true {\n\t\t\t\t\tsfs = append(sfs, *f)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn sfs, nil\n}", "title": "" }, { "docid": "a8422127412435dc362413dd69603631", "score": "0.43390933", "text": "func Snapshots(filter string) ([]zfsiface.Dataset, error) {\n\treturn listByType(DatasetSnapshot, filter)\n}", "title": "" }, { "docid": "14e070ce9a3e237775ed559c7a54234f", "score": "0.43377185", "text": "func (s *Action) List(c *cli.Context) error {\n\tfilter := c.Args().First()\n\n\tl, err := s.Store.Tree()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif filter == \"\" {\n\t\tfmt.Println(l.Format())\n\t\treturn nil\n\t}\n\n\tif subtree := l.FindFolder(filter); subtree != nil {\n\t\tsubtree.Root = true\n\t\tsubtree.Name = filter\n\t\tfmt.Println(subtree.Format())\n\t\treturn nil\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f8833cd8e6152e2d52e318b4bf26aaea", "score": "0.43228376", "text": "func filterList(directory string, filter func(os.FileInfo) bool) fileList {\n\tvar list fileList\n\n\tfp, err := os.Open(directory)\n\tdefer fp.Close()\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tls, err := fp.Readdir(-1)\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfor _, file := range ls {\n\t\tfmt.Printf(\"Considering >>[%s]\\n\", file.Name())\n\n\t\tif filter(file) == true {\n\t\t\tlist = append(list, file)\n\t\t}\n\t}\n\n\tsort.Sort(byName{list})\n\n\treturn list\n}", "title": "" }, { "docid": "0e06d625f32e80ad15657a9934f34867", "score": "0.4319879", "text": "func GetSystems(db *sqlx.DB) ([]System, error) {\n\tsystems := []System{}\n\tconst q = `SELECT * FROM systems;`\n\n\tif err := db.Select(&systems, q); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn systems, nil\n}", "title": "" }, { "docid": "19f16920afa541294bbbf8388db63b8f", "score": "0.43159103", "text": "func GetDiskFacts(f Facter) error {\n\tpartitions, err := d.Partitions(false)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO - probably read from /proc/filesystems\n\tfstypes := make(map[string]struct{})\n\tfor _, v := range partitions {\n\t\tfstypes[v.Fstype] = struct{}{}\n\t}\n\tfstypesStr := []string{}\n\tfor k := range fstypes {\n\t\tfstypesStr = append(fstypesStr, k)\n\t}\n\tif len(fstypesStr) > 0 {\n\t\tsort.Strings(fstypesStr)\n\t\tf.Add(\"filesystems\", strings.Join(fstypesStr, \",\"))\n\t}\n\n\tblockDevs, err := getBlockDevices(false)\n\tif err == nil {\n\t\tsort.Strings(blockDevs)\n\t\tf.Add(\"blockdevices\", strings.Join(blockDevs, \",\"))\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ac98a955bd8c4e529dae1b1161955ec4", "score": "0.43113443", "text": "func (client *Client) DescribeFileSystemsWithChan(request *DescribeFileSystemsRequest) (<-chan *DescribeFileSystemsResponse, <-chan error) {\n\tresponseChan := make(chan *DescribeFileSystemsResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.DescribeFileSystems(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "title": "" }, { "docid": "6d52ae574f69377f1790e8a1307d0fc7", "score": "0.43032792", "text": "func getVFS(in rc.Params) (vfs *VFS, err error) {\n\tfsString, err := in.GetString(\"fs\")\n\tif rc.IsErrParamNotFound(err) {\n\t\tvar count int\n\t\tvfs, count = activeCacheEntries()\n\t\tif count == 1 {\n\t\t\treturn vfs, nil\n\t\t} else if count == 0 {\n\t\t\treturn nil, errors.New(`no VFS active and \"fs\" parameter not supplied`)\n\t\t}\n\t\treturn nil, errors.New(`more than one VFS active - need \"fs\" parameter`)\n\t} else if err != nil {\n\t\treturn nil, err\n\t}\n\tactiveMu.Lock()\n\tdefer activeMu.Unlock()\n\tfsString = cache.Canonicalize(fsString)\n\tactiveVFS := active[fsString]\n\tif len(activeVFS) == 0 {\n\t\treturn nil, fmt.Errorf(\"no VFS found with name %q\", fsString)\n\t} else if len(activeVFS) > 1 {\n\t\treturn nil, fmt.Errorf(\"more than one VFS active with name %q\", fsString)\n\t}\n\tdelete(in, \"fs\") // delete the fs parameter\n\treturn activeVFS[0], nil\n}", "title": "" }, { "docid": "297a40fa73234b3ceabfef6ee94093c7", "score": "0.4298824", "text": "func (md *Memdb) GetWatchFilter(kind string, opts *api.ListWatchOptions) []FilterFn {\n\tvar filters []FilterFn\n\n\tif opts.ResourceVersion != \"\" {\n\t\tver, err := strconv.ParseUint(opts.ResourceVersion, 10, 64)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"unable to parse version string [%s](%s)\", opts.ResourceVersion, err)\n\t\t}\n\t\tfilters = append(filters, fromVersionFilterFn(ver))\n\t}\n\n\tif opts.Name != \"\" {\n\t\tfilters = append(filters, nameFilterFn(opts.Name))\n\t}\n\n\tif opts.Tenant != \"\" {\n\t\tfilters = append(filters, tenantFilterFn(opts.Tenant))\n\t}\n\n\tif opts.Namespace != \"\" {\n\t\tfilters = append(filters, namespaceFilterFn(opts.Namespace))\n\t}\n\n\tif opts.LabelSelector != \"\" {\n\t\tselector, err := labels.Parse(opts.LabelSelector)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"invalid label selector specification(%s)\", err)\n\t\t\treturn nil\n\t\t}\n\t\tfilters = append(filters, labelSelectorFilterFn(selector))\n\t}\n\n\tif opts.FieldSelector != \"\" {\n\t\tvar selector *fields.Selector\n\t\tvar err error\n\t\tif kind != \"\" {\n\t\t\tselector, err = fields.ParseWithValidation(kind, opts.FieldSelector)\n\t\t\tif err != nil {\n\t\t\t\tlog.Errorf(\"invalid field selector specification(%s)\", err)\n\t\t\t\treturn nil\n\t\t\t}\n\t\t} else {\n\t\t\tselector, err = fields.Parse(opts.FieldSelector)\n\t\t\tif err != nil {\n\t\t\t\tlog.Errorf(\"invalid field selector specification(%s)\", err)\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfilters = append(filters, fieldSelectorFilterFn(selector))\n\t}\n\tif len(opts.FieldChangeSelector) != 0 {\n\t\tfilters = append(filters, fieldChangeSelectorFilterFn(opts.FieldChangeSelector))\n\t}\n\n\treturn filters\n}", "title": "" }, { "docid": "aef5c2886b2f7e5b7c961d59c385003b", "score": "0.42965418", "text": "func FilterSpecs(nsId string, filter TbSpecInfo) ([]TbSpecInfo, error) {\n\n\terr := common.CheckString(nsId)\n\tif err != nil {\n\t\tcommon.CBLog.Error(err)\n\t\treturn nil, err\n\t}\n\n\ttempList := []TbSpecInfo{}\n\n\t//sqlQuery := \"SELECT * FROM `spec` WHERE `namespace`='\" + nsId + \"'\"\n\tsqlQuery := common.ORM.Where(\"Namespace = ?\", nsId)\n\n\tif filter.Id != \"\" {\n\t\t//sqlQuery += \" AND `id` LIKE '%\" + filter.Id + \"%'\"\n\t\tfilter.Id = RefineSpecName(filter.Id)\n\t\tsqlQuery = sqlQuery.And(\"Id LIKE ?\", \"%\"+filter.Id+\"%\")\n\t}\n\tif filter.Name != \"\" {\n\t\t//sqlQuery += \" AND `name` LIKE '%\" + filter.Name + \"%'\"\n\t\tfilter.Name = RefineSpecName(filter.Name)\n\t\tsqlQuery = sqlQuery.And(\"Name LIKE ?\", \"%\"+filter.Name+\"%\")\n\t}\n\tif filter.ConnectionName != \"\" {\n\t\t//sqlQuery += \" AND `connectionName` LIKE '%\" + filter.ConnectionName + \"%'\"\n\t\tfilter.ConnectionName = RefineSpecName(filter.ConnectionName)\n\t\tsqlQuery = sqlQuery.And(\"ConnectionName LIKE ?\", \"%\"+filter.ConnectionName+\"%\")\n\t}\n\tif filter.CspSpecName != \"\" {\n\t\t//sqlQuery += \" AND `cspSpecName` LIKE '%\" + filter.CspSpecName + \"%'\"\n\t\tfilter.CspSpecName = RefineSpecName(filter.CspSpecName)\n\t\tsqlQuery = sqlQuery.And(\"CspSpecName LIKE ?\", \"%\"+filter.CspSpecName+\"%\")\n\t}\n\tif filter.Os_type != \"\" {\n\t\t//sqlQuery += \" AND `os_type` LIKE '%\" + filter.Os_type + \"%'\"\n\t\tfilter.Os_type = RefineSpecName(filter.Os_type)\n\t\tsqlQuery = sqlQuery.And(\"Os_type LIKE ?\", \"%\"+filter.Os_type+\"%\")\n\t}\n\n\tif filter.Num_vCPU > 0 {\n\t\t//sqlQuery += \" AND `num_vCPU`=\" + strconv.Itoa(int(filter.Num_vCPU))\n\t\tsqlQuery = sqlQuery.And(\"Num_vCPU = ?\", filter.Num_vCPU)\n\t}\n\tif filter.Num_core > 0 {\n\t\t//sqlQuery += \" AND `num_core`=\" + strconv.Itoa(int(filter.Num_core))\n\t\tsqlQuery = sqlQuery.And(\"Num_core = ?\", filter.Num_core)\n\t}\n\tif filter.Mem_GiB > 0 {\n\t\t//sqlQuery += \" AND `mem_GiB`=\" + strconv.Itoa(int(filter.Mem_GiB))\n\t\tsqlQuery = sqlQuery.And(\"Mem_GiB = ?\", filter.Mem_GiB)\n\t}\n\tif filter.Storage_GiB > 0 {\n\t\t//sqlQuery += \" AND `storage_GiB`=\" + strconv.Itoa(int(filter.Storage_GiB))\n\t\tsqlQuery = sqlQuery.And(\"Storage_GiB = ?\", filter.Storage_GiB)\n\t}\n\tif filter.Description != \"\" {\n\t\t//sqlQuery += \" AND `description` LIKE '%\" + filter.Description + \"%'\"\n\t\tfilter.Description = RefineSpecName(filter.Description)\n\t\tsqlQuery = sqlQuery.And(\"Description LIKE ?\", \"%\"+filter.Description+\"%\")\n\t}\n\tif filter.Cost_per_hour > 0 {\n\t\t//sqlQuery += \" AND `cost_per_hour`=\" + fmt.Sprintf(\"%.6f\", filter.Cost_per_hour)\n\t\tsqlQuery = sqlQuery.And(\"Cost_per_hour = ?\", filter.Cost_per_hour)\n\t}\n\tif filter.Num_storage > 0 {\n\t\t//sqlQuery += \" AND `num_storage`=\" + strconv.Itoa(int(filter.Num_storage))\n\t\tsqlQuery = sqlQuery.And(\"Num_storage = ?\", filter.Num_storage)\n\t}\n\tif filter.Max_num_storage > 0 {\n\t\t//sqlQuery += \" AND `max_num_storage`=\" + strconv.Itoa(int(filter.Max_num_storage))\n\t\tsqlQuery = sqlQuery.And(\"Max_num_storage = ?\", filter.Max_num_storage)\n\t}\n\tif filter.Max_total_storage_TiB > 0 {\n\t\t//sqlQuery += \" AND `max_total_storage_TiB`=\" + strconv.Itoa(int(filter.Max_total_storage_TiB))\n\t\tsqlQuery = sqlQuery.And(\"Max_total_storage_TiB = ?\", filter.Max_total_storage_TiB)\n\t}\n\tif filter.Net_bw_Gbps > 0 {\n\t\t//sqlQuery += \" AND `net_bw_Gbps`=\" + strconv.Itoa(int(filter.Net_bw_Gbps))\n\t\tsqlQuery = sqlQuery.And(\"Net_bw_Gbps = ?\", filter.Net_bw_Gbps)\n\t}\n\tif filter.Ebs_bw_Mbps > 0 {\n\t\t//sqlQuery += \" AND `ebs_bw_Mbps`=\" + strconv.Itoa(int(filter.Ebs_bw_Mbps))\n\t\tsqlQuery = sqlQuery.And(\"Ebs_bw_Mbps = ?\", filter.Ebs_bw_Mbps)\n\t}\n\tif filter.Gpu_model != \"\" {\n\t\t//sqlQuery += \" AND `gpu_model` LIKE '%\" + filter.Gpu_model + \"%'\"\n\t\tfilter.Gpu_model = RefineSpecName(filter.Gpu_model)\n\t\tsqlQuery = sqlQuery.And(\"Gpu_model LIKE ?\", \"%\"+filter.Gpu_model+\"%\")\n\t}\n\tif filter.Num_gpu > 0 {\n\t\t//sqlQuery += \" AND `num_gpu`=\" + strconv.Itoa(int(filter.Num_gpu))\n\t\tsqlQuery = sqlQuery.And(\"Num_gpu = ?\", filter.Num_gpu)\n\t}\n\tif filter.Gpumem_GiB > 0 {\n\t\t//sqlQuery += \" AND `gpumem_GiB`=\" + strconv.Itoa(int(filter.Gpumem_GiB))\n\t\tsqlQuery = sqlQuery.And(\"Gpumem_GiB = ?\", filter.Gpumem_GiB)\n\t}\n\tif filter.Gpu_p2p != \"\" {\n\t\t//sqlQuery += \" AND `gpu_p2p` LIKE '%\" + filter.Gpu_p2p + \"%'\"\n\t\tfilter.Gpu_p2p = RefineSpecName(filter.Gpu_p2p)\n\t\tsqlQuery = sqlQuery.And(\"Gpu_p2p LIKE ?\", \"%\"+filter.Gpu_p2p+\"%\")\n\t}\n\tif filter.EvaluationStatus != \"\" {\n\t\t//sqlQuery += \" AND `evaluationStatus` LIKE '%\" + filter.EvaluationStatus + \"%'\"\n\t\tfilter.EvaluationStatus = RefineSpecName(filter.EvaluationStatus)\n\t\tsqlQuery = sqlQuery.And(\"EvaluationStatus LIKE ?\", \"%\"+filter.EvaluationStatus+\"%\")\n\t}\n\tif filter.EvaluationScore_01 > 0 {\n\t\t//sqlQuery += \" AND `evaluationScore_01`=\" + fmt.Sprintf(\"%.6f\", filter.EvaluationScore_01)\n\t\tsqlQuery = sqlQuery.And(\"EvaluationScore_01 = ?\", filter.EvaluationScore_01)\n\t}\n\tif filter.EvaluationScore_02 > 0 {\n\t\t//sqlQuery += \" AND `evaluationScore_02`=\" + fmt.Sprintf(\"%.6f\", filter.EvaluationScore_02)\n\t\tsqlQuery = sqlQuery.And(\"EvaluationScore_02 = ?\", filter.EvaluationScore_02)\n\t}\n\tif filter.EvaluationScore_03 > 0 {\n\t\t//sqlQuery += \" AND `evaluationScore_03`=\" + fmt.Sprintf(\"%.6f\", filter.EvaluationScore_03)\n\t\tsqlQuery = sqlQuery.And(\"EvaluationScore_03 = ?\", filter.EvaluationScore_03)\n\t}\n\tif filter.EvaluationScore_04 > 0 {\n\t\t//sqlQuery += \" AND `evaluationScore_04`=\" + fmt.Sprintf(\"%.6f\", filter.EvaluationScore_04)\n\t\tsqlQuery = sqlQuery.And(\"EvaluationScore_04 = ?\", filter.EvaluationScore_04)\n\t}\n\tif filter.EvaluationScore_05 > 0 {\n\t\t//sqlQuery += \" AND `evaluationScore_05`=\" + fmt.Sprintf(\"%.6f\", filter.EvaluationScore_05)\n\t\tsqlQuery = sqlQuery.And(\"EvaluationScore_05 = ?\", filter.EvaluationScore_05)\n\t}\n\tif filter.EvaluationScore_06 > 0 {\n\t\t//sqlQuery += \" AND `evaluationScore_06`=\" + fmt.Sprintf(\"%.6f\", filter.EvaluationScore_06)\n\t\tsqlQuery = sqlQuery.And(\"EvaluationScore_06 = ?\", filter.EvaluationScore_06)\n\t}\n\tif filter.EvaluationScore_07 > 0 {\n\t\t//sqlQuery += \" AND `evaluationScore_07`=\" + fmt.Sprintf(\"%.6f\", filter.EvaluationScore_07)\n\t\tsqlQuery = sqlQuery.And(\"EvaluationScore_07 = ?\", filter.EvaluationScore_07)\n\t}\n\tif filter.EvaluationScore_08 > 0 {\n\t\t//sqlQuery += \" AND `evaluationScore_08`=\" + fmt.Sprintf(\"%.6f\", filter.EvaluationScore_08)\n\t\tsqlQuery = sqlQuery.And(\"EvaluationScore_08 = ?\", filter.EvaluationScore_08)\n\t}\n\tif filter.EvaluationScore_09 > 0 {\n\t\t//sqlQuery += \" AND `evaluationScore_09`=\" + fmt.Sprintf(\"%.6f\", filter.EvaluationScore_09)\n\t\tsqlQuery = sqlQuery.And(\"EvaluationScore_09 = ?\", filter.EvaluationScore_09)\n\t}\n\tif filter.EvaluationScore_10 > 0 {\n\t\t//sqlQuery += \" AND `evaluationScore_10`=\" + fmt.Sprintf(\"%.6f\", filter.EvaluationScore_10)\n\t\tsqlQuery = sqlQuery.And(\"EvaluationScore_10 = ?\", filter.EvaluationScore_10)\n\t}\n\n\terr = sqlQuery.Find(&tempList)\n\tif err != nil {\n\t\tcommon.CBLog.Error(err)\n\t\treturn tempList, err\n\t}\n\treturn tempList, nil\n}", "title": "" }, { "docid": "b5d67f5ba3818a1c5dcf26bde0210d95", "score": "0.42936614", "text": "func Files(unsetEnv bool) []*os.File {\n\tif unsetEnv {\n\t\tdefer os.Unsetenv(\"LISTEN_PID\")\n\t\tdefer os.Unsetenv(\"LISTEN_FDS\")\n\t\tdefer os.Unsetenv(\"LISTEN_FDNAMES\")\n\t}\n\n\tpid, err := strconv.Atoi(os.Getenv(\"LISTEN_PID\"))\n\tif err != nil || pid != os.Getpid() {\n\t\treturn nil\n\t}\n\n\tnfds, err := strconv.Atoi(os.Getenv(\"LISTEN_FDS\"))\n\tif err != nil || nfds == 0 {\n\t\treturn nil\n\t}\n\n\tnames := strings.Split(os.Getenv(\"LISTEN_FDNAMES\"), \":\")\n\n\tfiles := make([]*os.File, 0, nfds)\n\tfor fd := listenFdsStart; fd < listenFdsStart+nfds; fd++ {\n\t\tsyscall.CloseOnExec(fd)\n\t\tname := \"LISTEN_FD_\" + strconv.Itoa(fd)\n\t\toffset := fd - listenFdsStart\n\t\tif offset < len(names) && len(names[offset]) > 0 {\n\t\t\tname = names[offset]\n\t\t}\n\t\tfiles = append(files, os.NewFile(uintptr(fd), name))\n\t}\n\n\treturn files\n}", "title": "" }, { "docid": "9f78c830d1e02f52700f5e9ec5840ea3", "score": "0.42929286", "text": "func (c *compacter) selectFilesForCompaction() []string {\n\tfiles, _ := listFilesWithSuffix(c.storagePath, closedSegmentSuffix, false)\n\n\tfileGroup := []string{}\n\tvar groupSize int64 = 0\n\tfor i := range files {\n\t\tfs := files[i].info\n\t\tif groupSize+fs.Size() < int64(c.compactionThreshold) {\n\t\t\tgroupSize += fs.Size()\n\t\t\tfileGroup = append(fileGroup, files[i].filepath)\n\t\t} else {\n\t\t\tif len(fileGroup) > 1 {\n\t\t\t\tbreak\n\t\t\t} else {\n\t\t\t\tfileGroup = []string{files[i].filepath}\n\t\t\t\tgroupSize = fs.Size()\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(fileGroup) >= 2 {\n\t\tsort.Sort(sort.Reverse(sort.StringSlice(fileGroup)))\n\t\treturn fileGroup\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "cf3d373f1f2007d87917e134ea1845ce", "score": "0.42822528", "text": "func (c *client) GetDisks(ctx context.Context, rgname string, logger log.Logger) (result []compute.Disk, err error) {\n\tmetricfn := collectRequestMetrics(\"compute\", \"disks\")\n\tdefer metricfn()\n\n\tif tracing.IsEnabled() {\n\t\tvar span *trace.Span\n\n\t\tctx, span = trace.StartSpan(ctx, \"metris/provider/azure/GetDisks\")\n\t\tdefer span.End()\n\n\t\tlogger = logger.With(\"traceID\", span.SpanContext().TraceID).With(\"spanID\", span.SpanContext().SpanID)\n\t}\n\n\tvar diskList compute.DiskListIterator\n\n\tbaseclient := *c.computeBaseClient\n\tbaseclient.RequestInspector = LogRequest(logger)\n\tbaseclient.ResponseInspector = LogResponse(logger)\n\tdiskClient := compute.DisksClient{BaseClient: baseclient}\n\n\tfor diskList, err = diskClient.ListByResourceGroupComplete(ctx, rgname); diskList.NotDone(); err = diskList.NextWithContext(ctx) {\n\t\tif err != nil {\n\t\t\treturn result, err\n\t\t}\n\n\t\tdisk := diskList.Value()\n\t\tif len(disk.DiskProperties.OsType) == 0 {\n\t\t\tresult = append(result, disk)\n\t\t}\n\t}\n\n\treturn result, err\n}", "title": "" }, { "docid": "47415708693a6a50dca135d7b2c3ffc6", "score": "0.42800665", "text": "func InitFilesystem(fsType FileSystemType) (FileSystem, error) {\n\tvar fs FileSystem\n\tswitch fsType {\n\t\tcase Local:\n\t\t\tlog.Debug(\"using local fs\")\n\t\t\tfs = &LocalFileSystem{}\n\t\tcase S3:\n\t\t\tlog.Debug(\"using s3 fs\")\n\t\t\tfs = &S3FileSystem{}\n\t\tcase MINIO:\n\t\t\tlog.Debug(\"using minio fs\")\n\t\t\tfs = &MinioFileSystem{}\n\n\t}\n\n\terr := fs.Init()\n\tif err != nil{\n\t\tlog.Errorf(\"failed to init filesystem, %+v\",err)\n\t\treturn nil, err\n\t}\n\treturn fs, nil\n}", "title": "" }, { "docid": "01d9cee878261c757415fdf45c3764a6", "score": "0.42658696", "text": "func quick() []string {\n\treturn findMedia([]string{\"/Volumes/\"})\n}", "title": "" }, { "docid": "cf76c39b784708301a391409665cc70b", "score": "0.4265141", "text": "func filters(t framework.TestContext, ns string, skipVM bool) []echotest.Filter {\n\trt := []echotest.Filter{\n\t\techotest.SingleSimplePodServiceAndAllSpecial(),\n\t\techotest.Not(func(instances echo.Instances) echo.Instances { return instances.Match(echo.IsHeadless()) }),\n\t\techotest.Not(func(instances echo.Instances) echo.Instances { return instances.Match(echo.IsNaked()) }),\n\t\techotest.Not(func(instances echo.Instances) echo.Instances { return instances.Match(echo.IsExternal()) }),\n\t\techotest.Not(func(instances echo.Instances) echo.Instances { return instances.Match(util.IsMultiversion()) }),\n\t\tfunc(instances echo.Instances) echo.Instances { return instances.Match(echo.Namespace(ns)) },\n\t\t// TODO(JimmyCYJ): extend clusters to cover cross-cluster traffic.\n\t\tfunc(instances echo.Instances) echo.Instances {\n\t\t\treturn instances.Match(echo.InCluster(t.Clusters().Default()))\n\t\t},\n\t}\n\tif skipVM {\n\t\trt = append(rt, echotest.Not(func(instances echo.Instances) echo.Instances { return instances.Match(echo.IsVirtualMachine()) }))\n\t}\n\treturn rt\n}", "title": "" }, { "docid": "8323103346f93f316b9a606f28f1183f", "score": "0.42645746", "text": "func Files(fs []File) []*resultstore.File {\n\tvar rsfs []*resultstore.File\n\tfor _, f := range fs {\n\t\trsfs = append(rsfs, f.To())\n\t}\n\treturn rsfs\n}", "title": "" }, { "docid": "6d462059642524f15673c808e81577aa", "score": "0.4263473", "text": "func ExampleAmlFilesystemsClient_NewListByResourceGroupPager() {\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 := armstoragecache.NewClientFactory(\"<subscription-id>\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpager := clientFactory.NewAmlFilesystemsClient().NewListByResourceGroupPager(\"scgroup\", nil)\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.AmlFilesystemsListResult = armstoragecache.AmlFilesystemsListResult{\n\t\t// \tValue: []*armstoragecache.AmlFilesystem{\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"fs1\"),\n\t\t// \t\t\tType: to.Ptr(\"Microsoft.StorageCache/amlFilesystem\"),\n\t\t// \t\t\tID: to.Ptr(\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.StorageCache/amlFilesystems/fs1\"),\n\t\t// \t\t\tLocation: to.Ptr(\"eastus\"),\n\t\t// \t\t\tTags: map[string]*string{\n\t\t// \t\t\t\t\"Dept\": to.Ptr(\"ContosoAds\"),\n\t\t// \t\t\t},\n\t\t// \t\t\tIdentity: &armstoragecache.AmlFilesystemIdentity{\n\t\t// \t\t\t\tType: to.Ptr(armstoragecache.AmlFilesystemIdentityTypeUserAssigned),\n\t\t// \t\t\t\tUserAssignedIdentities: map[string]*armstoragecache.UserAssignedIdentitiesValue{\n\t\t// \t\t\t\t\t\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1\": &armstoragecache.UserAssignedIdentitiesValue{\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\tProperties: &armstoragecache.AmlFilesystemProperties{\n\t\t// \t\t\t\tClientInfo: &armstoragecache.AmlFilesystemClientInfo{\n\t\t// \t\t\t\t\tContainerStorageInterface: &armstoragecache.AmlFilesystemContainerStorageInterface{\n\t\t// \t\t\t\t\t\tPersistentVolume: to.Ptr(\"<Base64 encoded YAML>\"),\n\t\t// \t\t\t\t\t\tPersistentVolumeClaim: to.Ptr(\"<Base64 encoded YAML>\"),\n\t\t// \t\t\t\t\t\tStorageClass: to.Ptr(\"<Base64 encoded YAML>\"),\n\t\t// \t\t\t\t\t},\n\t\t// \t\t\t\t\tLustreVersion: to.Ptr(\"2.15.0\"),\n\t\t// \t\t\t\t\tMgsAddress: to.Ptr(\"10.0.0.4\"),\n\t\t// \t\t\t\t\tMountCommand: to.Ptr(\"mount -t lustre 10.0.0.4@tcp:/lustrefs /lustre/lustrefs\"),\n\t\t// \t\t\t\t},\n\t\t// \t\t\t\tEncryptionSettings: &armstoragecache.AmlFilesystemEncryptionSettings{\n\t\t// \t\t\t\t\tKeyEncryptionKey: &armstoragecache.KeyVaultKeyReference{\n\t\t// \t\t\t\t\t\tKeyURL: to.Ptr(\"https://examplekv.vault.azure.net/keys/kvk/3540a47df75541378d3518c6a4bdf5af\"),\n\t\t// \t\t\t\t\t\tSourceVault: &armstoragecache.KeyVaultKeyReferenceSourceVault{\n\t\t// \t\t\t\t\t\t\tID: to.Ptr(\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.KeyVault/vaults/keyvault-cmk\"),\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\tFilesystemSubnet: to.Ptr(\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.Network/virtualNetworks/scvnet/subnets/fsSub1\"),\n\t\t// \t\t\t\tHealth: &armstoragecache.AmlFilesystemHealth{\n\t\t// \t\t\t\t\tState: to.Ptr(armstoragecache.AmlFilesystemHealthStateTypeAvailable),\n\t\t// \t\t\t\t\tStatusDescription: to.Ptr(\"amlFilesystem is ok.\"),\n\t\t// \t\t\t\t},\n\t\t// \t\t\t\tHsm: &armstoragecache.AmlFilesystemPropertiesHsm{\n\t\t// \t\t\t\t\tArchiveStatus: []*armstoragecache.AmlFilesystemArchive{\n\t\t// \t\t\t\t\t\t{\n\t\t// \t\t\t\t\t\t\tFilesystemPath: to.Ptr(\"/\"),\n\t\t// \t\t\t\t\t\t\tStatus: &armstoragecache.AmlFilesystemArchiveStatus{\n\t\t// \t\t\t\t\t\t\t\tLastCompletionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"2019-04-21T18:25:43.511Z\"); return t}()),\n\t\t// \t\t\t\t\t\t\t\tLastStartedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"2019-04-21T17:25:43.511Z\"); return t}()),\n\t\t// \t\t\t\t\t\t\t\tState: to.Ptr(armstoragecache.ArchiveStatusTypeCompleted),\n\t\t// \t\t\t\t\t\t\t},\n\t\t// \t\t\t\t\t}},\n\t\t// \t\t\t\t\tSettings: &armstoragecache.AmlFilesystemHsmSettings{\n\t\t// \t\t\t\t\t\tContainer: to.Ptr(\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.Storage/storageAccounts/storageaccountname/blobServices/default/containers/containername\"),\n\t\t// \t\t\t\t\t\tImportPrefix: to.Ptr(\"/\"),\n\t\t// \t\t\t\t\t\tLoggingContainer: to.Ptr(\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.Storage/storageAccounts/storageaccountname/blobServices/default/containers/loggingcontainername\"),\n\t\t// \t\t\t\t\t},\n\t\t// \t\t\t\t},\n\t\t// \t\t\t\tMaintenanceWindow: &armstoragecache.AmlFilesystemPropertiesMaintenanceWindow{\n\t\t// \t\t\t\t\tDayOfWeek: to.Ptr(armstoragecache.MaintenanceDayOfWeekTypeFriday),\n\t\t// \t\t\t\t\tTimeOfDayUTC: to.Ptr(\"22:00\"),\n\t\t// \t\t\t\t},\n\t\t// \t\t\t\tProvisioningState: to.Ptr(armstoragecache.AmlFilesystemProvisioningStateTypeSucceeded),\n\t\t// \t\t\t\tStorageCapacityTiB: to.Ptr[float32](16),\n\t\t// \t\t\t\tThroughputProvisionedMBps: to.Ptr[int32](500),\n\t\t// \t\t\t},\n\t\t// \t\t\tSKU: &armstoragecache.SKUName{\n\t\t// \t\t\t\tName: to.Ptr(\"AMLFS-Durable-Premium-250\"),\n\t\t// \t\t\t},\n\t\t// \t\t\tZones: []*string{\n\t\t// \t\t\t\tto.Ptr(\"1\")},\n\t\t// \t\t\t},\n\t\t// \t\t\t{\n\t\t// \t\t\t\tName: to.Ptr(\"fs2\"),\n\t\t// \t\t\t\tType: to.Ptr(\"Microsoft.StorageCache/amlFilesystem\"),\n\t\t// \t\t\t\tID: to.Ptr(\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.StorageCache/amlFilesystems/fs2\"),\n\t\t// \t\t\t\tLocation: to.Ptr(\"eastus\"),\n\t\t// \t\t\t\tTags: map[string]*string{\n\t\t// \t\t\t\t\t\"Dept\": to.Ptr(\"ContosoAds\"),\n\t\t// \t\t\t\t},\n\t\t// \t\t\t\tIdentity: &armstoragecache.AmlFilesystemIdentity{\n\t\t// \t\t\t\t\tType: to.Ptr(armstoragecache.AmlFilesystemIdentityTypeUserAssigned),\n\t\t// \t\t\t\t\tUserAssignedIdentities: map[string]*armstoragecache.UserAssignedIdentitiesValue{\n\t\t// \t\t\t\t\t\t\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1\": &armstoragecache.UserAssignedIdentitiesValue{\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\tProperties: &armstoragecache.AmlFilesystemProperties{\n\t\t// \t\t\t\t\tClientInfo: &armstoragecache.AmlFilesystemClientInfo{\n\t\t// \t\t\t\t\t\tContainerStorageInterface: &armstoragecache.AmlFilesystemContainerStorageInterface{\n\t\t// \t\t\t\t\t\t\tPersistentVolume: to.Ptr(\"<Base64 encoded YAML>\"),\n\t\t// \t\t\t\t\t\t\tPersistentVolumeClaim: to.Ptr(\"<Base64 encoded YAML>\"),\n\t\t// \t\t\t\t\t\t\tStorageClass: to.Ptr(\"<Base64 encoded YAML>\"),\n\t\t// \t\t\t\t\t\t},\n\t\t// \t\t\t\t\t\tLustreVersion: to.Ptr(\"2.15.0\"),\n\t\t// \t\t\t\t\t\tMgsAddress: to.Ptr(\"10.0.0.4\"),\n\t\t// \t\t\t\t\t\tMountCommand: to.Ptr(\"mount -t lustre 10.0.0.4@tcp:/lustrefs /lustre/lustrefs\"),\n\t\t// \t\t\t\t\t},\n\t\t// \t\t\t\t\tEncryptionSettings: &armstoragecache.AmlFilesystemEncryptionSettings{\n\t\t// \t\t\t\t\t\tKeyEncryptionKey: &armstoragecache.KeyVaultKeyReference{\n\t\t// \t\t\t\t\t\t\tKeyURL: to.Ptr(\"https://examplekv.vault.azure.net/keys/kvk/3540a47df75541378d3518c6a4bdf5af\"),\n\t\t// \t\t\t\t\t\t\tSourceVault: &armstoragecache.KeyVaultKeyReferenceSourceVault{\n\t\t// \t\t\t\t\t\t\t\tID: to.Ptr(\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.KeyVault/vaults/keyvault-cmk\"),\n\t\t// \t\t\t\t\t\t\t},\n\t\t// \t\t\t\t\t\t},\n\t\t// \t\t\t\t\t},\n\t\t// \t\t\t\t\tFilesystemSubnet: to.Ptr(\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.Network/virtualNetworks/scvnet/subnets/fsSub2\"),\n\t\t// \t\t\t\t\tHealth: &armstoragecache.AmlFilesystemHealth{\n\t\t// \t\t\t\t\t\tState: to.Ptr(armstoragecache.AmlFilesystemHealthStateTypeAvailable),\n\t\t// \t\t\t\t\t\tStatusDescription: to.Ptr(\"amlFilesystem is ok.\"),\n\t\t// \t\t\t\t\t},\n\t\t// \t\t\t\t\tHsm: &armstoragecache.AmlFilesystemPropertiesHsm{\n\t\t// \t\t\t\t\t\tArchiveStatus: []*armstoragecache.AmlFilesystemArchive{\n\t\t// \t\t\t\t\t\t\t{\n\t\t// \t\t\t\t\t\t\t\tFilesystemPath: to.Ptr(\"/\"),\n\t\t// \t\t\t\t\t\t\t\tStatus: &armstoragecache.AmlFilesystemArchiveStatus{\n\t\t// \t\t\t\t\t\t\t\t\tLastCompletionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"2019-04-21T18:25:43.511Z\"); return t}()),\n\t\t// \t\t\t\t\t\t\t\t\tLastStartedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"2019-04-21T17:25:43.511Z\"); return t}()),\n\t\t// \t\t\t\t\t\t\t\t\tState: to.Ptr(armstoragecache.ArchiveStatusTypeCompleted),\n\t\t// \t\t\t\t\t\t\t\t},\n\t\t// \t\t\t\t\t\t}},\n\t\t// \t\t\t\t\t\tSettings: &armstoragecache.AmlFilesystemHsmSettings{\n\t\t// \t\t\t\t\t\t\tContainer: to.Ptr(\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.Storage/storageAccounts/storageaccountname/blobServices/default/containers/containername\"),\n\t\t// \t\t\t\t\t\t\tImportPrefix: to.Ptr(\"/\"),\n\t\t// \t\t\t\t\t\t\tLoggingContainer: to.Ptr(\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.Storage/storageAccounts/storageaccountname/blobServices/default/containers/loggingcontainername\"),\n\t\t// \t\t\t\t\t\t},\n\t\t// \t\t\t\t\t},\n\t\t// \t\t\t\t\tMaintenanceWindow: &armstoragecache.AmlFilesystemPropertiesMaintenanceWindow{\n\t\t// \t\t\t\t\t\tDayOfWeek: to.Ptr(armstoragecache.MaintenanceDayOfWeekTypeFriday),\n\t\t// \t\t\t\t\t\tTimeOfDayUTC: to.Ptr(\"22:00\"),\n\t\t// \t\t\t\t\t},\n\t\t// \t\t\t\t\tProvisioningState: to.Ptr(armstoragecache.AmlFilesystemProvisioningStateTypeSucceeded),\n\t\t// \t\t\t\t\tStorageCapacityTiB: to.Ptr[float32](16),\n\t\t// \t\t\t\t\tThroughputProvisionedMBps: to.Ptr[int32](500),\n\t\t// \t\t\t\t},\n\t\t// \t\t\t\tSKU: &armstoragecache.SKUName{\n\t\t// \t\t\t\t\tName: to.Ptr(\"AMLFS-Durable-Premium-250\"),\n\t\t// \t\t\t\t},\n\t\t// \t\t\t\tZones: []*string{\n\t\t// \t\t\t\t\tto.Ptr(\"1\")},\n\t\t// \t\t\t}},\n\t\t// \t\t}\n\t}\n}", "title": "" }, { "docid": "e8e4f9abdd325fa922319fadccc26048", "score": "0.42618737", "text": "func New(adapters ...adapter.Adapter) *Flysystem {\n\treturn &Flysystem{\n\t\tadapters: adapters,\n\t\twg: &sync.WaitGroup{},\n\t}\n}", "title": "" }, { "docid": "be43f37bd26fe3f7fc778bfde98bd6f1", "score": "0.42591485", "text": "func getregistryFiles(obj *registry.IntellectualObject) []*registry.GenericFile {\n\tparams := url.Values{}\n\tparams.Set(\"intellectual_object_id\", strconv.FormatInt(obj.ID, 10))\n\tparams.Set(\"page\", \"1\")\n\tparams.Set(\"per_page\", \"200\")\n\tresp := ctx.Context.RegistryClient.GenericFileList(params)\n\trequire.Nil(ctx.T, resp.Error, obj.Identifier)\n\trequire.NotEmpty(ctx.T, resp.GenericFiles())\n\treturn resp.GenericFiles()\n}", "title": "" }, { "docid": "0c7b09a32a4caec74c10b5007c283467", "score": "0.42354473", "text": "func FDsFromSystemd(unsetEnv bool) []*os.File {\n\tif unsetEnv {\n\t\tdefer func() {\n\t\t\tif err := os.Unsetenv(\"LISTEN_PID\"); err != nil {\n\t\t\t\tfmt.Println(\"os.unsetEnv LISTEN_PID failed, \", err)\n\t\t\t}\n\t\t\tif err := os.Unsetenv(\"LISTEN_FDS\"); err != nil {\n\t\t\t\tfmt.Println(\"os.unsetEnv LISTEN_FDS failed, \", err)\n\t\t\t}\n\t\t}()\n\t}\n\n\tpid, err := strconv.Atoi(os.Getenv(\"LISTEN_PID\"))\n\tif err != nil || pid != os.Getpid() {\n\t\treturn nil\n\t}\n\n\tnfds, err := strconv.Atoi(os.Getenv(\"LISTEN_FDS\"))\n\tif err != nil || nfds == 0 {\n\t\treturn nil\n\t}\n\n\tfiles := make([]*os.File, 0, nfds)\n\tfor fd := listenFdsStart; fd < listenFdsStart+nfds; fd++ {\n\t\tsyscall.CloseOnExec(fd)\n\t\tfiles = append(files, os.NewFile(uintptr(fd), \"LISTEN_FD_\"+strconv.Itoa(fd)))\n\t}\n\n\treturn files\n}", "title": "" }, { "docid": "399f2b286fe99bc44c8db69ab3324661", "score": "0.4231166", "text": "func GameFinderVFSList(vfsPath string) []GameLocation {\n\tvfsEntries := []GameLocation{}\n\n\tif vfsPath == GameFinderVFSPathDefault {\n\t\t// Determine drives (OS-dependent)\n\t\tif runtime.GOOS == \"windows\" {\n\t\t\t// we can get away with this, right?\n\t\t\tfor i := 0; i < 26; i++ {\n\t\t\t\tdrive := string(rune('A' + i)) + \":\\\\\"\n\t\t\t\t_, err := ioutil.ReadDir(drive)\n\t\t\t\tif err == nil {\n\t\t\t\t\tvfsEntries = append(vfsEntries, GameLocation{\n\t\t\t\t\t\tDrive: drive,\n\t\t\t\t\t\tLocation: drive,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn vfsEntries\n\t\t}\n\t\thome := os.Getenv(\"HOME\")\n\t\treturn []GameLocation{\n\t\t\tGameLocation{\n\t\t\t\tDrive: \"Home\",\n\t\t\t\tLocation: home,\n\t\t\t},\n\t\t\tGameLocation{\n\t\t\t\tDrive: \"Root\",\n\t\t\t\tLocation: \"/\",\n\t\t\t},\n\t\t\tGameLocation{\n\t\t\t\tDrive: \"PWD\",\n\t\t\t\tLocation: \".\",\n\t\t\t},\n\t\t}\n\t}\n\t\n\tfileInfos, err := ioutil.ReadDir(vfsPath)\n\tif err == nil {\n\t\tfor _, fi := range fileInfos {\n\t\t\tif fi.IsDir() {\n\t\t\t\tvfsEntries = append(vfsEntries, CheckGameLocation(filepath.Join(vfsPath, fi.Name())))\n\t\t\t}\n\t\t}\n\t}\n\t\n\t// List\n\treturn vfsEntries\n}", "title": "" }, { "docid": "066a381a4819cef1fddbc69d35a28d0e", "score": "0.4229398", "text": "func (c *Client) SystemFactions(systemName string, showHistory bool) (*SystemFactionsStruct, error) {\n\treq, err := c.newGetRequest(\"/api-system-v1/factions\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tq := req.URL.Query()\n\tq.Set(\"systemName\", systemName)\n\tq.Set(\"showHistory\", boolToQuery(showHistory))\n\treq.URL.RawQuery = q.Encode()\n\n\tbody := &SystemFactionsStruct{}\n\t_, err = c.do(req, body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn body, nil\n}", "title": "" }, { "docid": "e730caa122ce26d171c897f2adcb3b29", "score": "0.4219597", "text": "func (z *Zookeeper) Volumes() (lines []string, err error) {\n\tvar (\n\t\td []byte\n\t\tpaths []string\n\t\tdpath string\n\t)\n\tif paths, _, err = z.c.Children(z.fpath); err != nil {\n\t\tlog.Errorf(\"zk.Children(\\\"%s\\\") error(%v)\", z.fpath, err)\n\t\treturn\n\t}\n\tfor _, dpath = range paths {\n\t\tif d, _, err = z.c.Get(path.Join(z.fpath, dpath)); err != nil {\n\t\t\tlog.Errorf(\"zk.Get(\\\"%s\\\") error(%v)\", path.Join(z.fpath, dpath), err)\n\t\t\treturn\n\t\t}\n\t\tlines = append(lines, string(d))\n\t}\n\treturn\n}", "title": "" }, { "docid": "7c896219c60a0e79f959aef12aa9e756", "score": "0.42137602", "text": "func GetMounts(ctx context.Context, mountOpts ...MountOpts) ([]specs.Mount, error) {\n\tmounts := []specs.Mount{\n\t\t{\n\t\t\tDestination: \"/proc\",\n\t\t\tType: \"proc\",\n\t\t\tSource: \"proc\",\n\t\t},\n\t\t{\n\t\t\tDestination: \"/dev\",\n\t\t\tType: \"tmpfs\",\n\t\t\tSource: \"tmpfs\",\n\t\t\tOptions: []string{\"nosuid\", \"strictatime\", \"mode=755\", \"size=65536k\"},\n\t\t},\n\t\t{\n\t\t\tDestination: \"/dev/pts\",\n\t\t\tType: \"devpts\",\n\t\t\tSource: \"devpts\",\n\t\t\tOptions: []string{\"nosuid\", \"noexec\", \"newinstance\", \"ptmxmode=0666\", \"mode=0620\", \"gid=5\"},\n\t\t},\n\t\t{\n\t\t\tDestination: \"/dev/shm\",\n\t\t\tType: \"tmpfs\",\n\t\t\tSource: \"shm\",\n\t\t\tOptions: []string{\"nosuid\", \"noexec\", \"nodev\", \"mode=1777\", \"size=65536k\"},\n\t\t},\n\t\t{\n\t\t\tDestination: \"/dev/mqueue\",\n\t\t\tType: \"mqueue\",\n\t\t\tSource: \"mqueue\",\n\t\t\tOptions: []string{\"nosuid\", \"noexec\", \"nodev\"},\n\t\t},\n\t\t{\n\t\t\tDestination: \"/sys\",\n\t\t\tType: \"sysfs\",\n\t\t\tSource: \"sysfs\",\n\t\t\tOptions: []string{\"nosuid\", \"noexec\", \"nodev\", \"ro\"},\n\t\t},\n\t}\n\tvar err error\n\tfor _, o := range mountOpts {\n\t\tmounts, err = o(mounts)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn mounts, nil\n}", "title": "" }, { "docid": "db40386abb5ab07fb6914175b9532597", "score": "0.42103058", "text": "func (db *TriplineDb) ListFilesets() ([]string, error) {\n\tif db.boltTx == nil {\n\t\treturn nil, fmt.Errorf(err080)\n\t}\n\tresult := make([]string, 0)\n\terr := db.boltTx.ForEach(func(name []byte, _ *bolt.Bucket) error {\n\t\tbucketName := string(name)\n\t\t// Bucket names starting with underscores are reserved names for internal use.\n\t\t// Example _signatures bucket to store the fileset signatures.\n\t\tif !strings.HasPrefix(bucketName, \"_\") {\n\t\t\tresult = append(result, bucketName)\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "3a48af5012452217db665bb83ddf9fed", "score": "0.42076525", "text": "func NewFS(name string, metadataPool *model.Pool, dataPools []*model.Pool, activeMDSCount int32) *Filesystem {\n\n\tmetadataPool.Name = fmt.Sprintf(\"%s-%s\", name, metadataPoolSuffix)\n\tfor i, pool := range dataPools {\n\t\tpool.Name = fmt.Sprintf(\"%s-%s%d\", name, dataPoolSuffix, i)\n\t}\n\n\treturn &Filesystem{\n\t\tName: name,\n\t\tmetadataPool: metadataPool,\n\t\tdataPools: dataPools,\n\t\tactiveMDSCount: activeMDSCount,\n\t}\n}", "title": "" }, { "docid": "2458dc23e9ca628850fbdff66183ac29", "score": "0.4205603", "text": "func GetFileList(basePath string, exts []string) ([]string, error) {\n\t// validate\n\tif _, err := ioutil.ReadDir(basePath); err != nil {\n\t\treturn nil, err\n\t}\n\tif len(exts) == 0 {\n\t\treturn nil, errors.New(\"no extensions in parameter\")\n\t}\n\n\tfiles := []string{}\n\tpool := 20\n\tch := make(chan string, pool)\n\tchSmp := make(chan bool, pool)\n\twg := &sync.WaitGroup{}\n\n\tgo checkDir(basePath, exts, ch, chSmp, wg, true)\n\tfor {\n\t\tv, ok := <-ch\n\t\tif !ok {\n\t\t\tbreak\n\t\t}\n\t\tfiles = append(files, v)\n\t}\n\treturn files, nil\n}", "title": "" }, { "docid": "469a20cdd5d081385ee451c366d16687", "score": "0.42043743", "text": "func filter(regexString string, fc FileCollection) FileCollection {\n\tvar fCollection = new(FileCollection)\n\n\tr, err := regexp.Compile(regexString)\n\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to compile regex: %s. Err: %e\", regexString, err)\n\t}\n\n\tfor _, file := range fc.Files {\n\t\tif r.MatchString(file.Name()) {\n\t\t\tfCollection.Files = append(fCollection.Files, file)\n\t\t}\n\t}\n\n\treturn *fCollection\n}", "title": "" }, { "docid": "cc78d2b24059b8b2d9e276b9324618c1", "score": "0.41985416", "text": "func GetFilesWithDateTime(fm FolderMeta, timestamp int64) FolderMeta {\r\n\tstart := DateTimeFindFirst(fm, timestamp)\r\n\tend := DateTimeFindLast(fm, timestamp)\r\n\r\n\tif start > -1 {\r\n\t\treturn fm[start : end+1]\r\n\t} else {\r\n\t\treturn FolderMeta{}\r\n\t}\r\n}", "title": "" }, { "docid": "b7c9055d7814f0e621261c4539a6697b", "score": "0.41893095", "text": "func (e *EKS) Filters(version string) (Filters, error) {\n\tif e.AMIRepoURL == \"\" {\n\t\te.AMIRepoURL = eksAMIRepoURL\n\t}\n\tvar filters Filters\n\n\tif version == \"\" {\n\t\tvar err error\n\t\tversion, err = e.getLatestAMIVersion()\n\t\tif err != nil {\n\t\t\tlog.Printf(\"There was a problem fetching the latest EKS AMI version, using hardcoded fallback version %s\\n\", eksFallbackLatestAMIVersion)\n\t\t\tversion = eksFallbackLatestAMIVersion\n\t\t}\n\t}\n\tsupportedInstanceTypes, err := e.getSupportedInstanceTypes(version)\n\tif err != nil {\n\t\tlog.Printf(\"Unable to retrieve EKS supported instance types for version %s: %v\", version, err)\n\t\treturn filters, err\n\t}\n\tfilters.InstanceTypes = &supportedInstanceTypes\n\tfilters.VirtualizationType = aws.String(\"hvm\")\n\treturn filters, nil\n}", "title": "" }, { "docid": "6f1d590c785adb06f0a804124e9e643c", "score": "0.41863608", "text": "func SelectDisks(l object.VirtualDeviceList, scsiCount, sataCount, ideCount int) object.VirtualDeviceList {\n\tdevices := l.Select(func(device types.BaseVirtualDevice) bool {\n\t\tif disk, ok := device.(*types.VirtualDisk); ok {\n\t\t\tctlr, err := findControllerForDevice(l, disk)\n\t\t\tvar count int\n\t\t\tswitch ctlr.(type) {\n\t\t\tcase types.BaseVirtualSCSIController:\n\t\t\t\tcount = scsiCount\n\t\t\tcase types.BaseVirtualSATAController:\n\t\t\t\tcount = sataCount\n\t\t\tcase *types.VirtualIDEController:\n\t\t\t\tcount = ideCount\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"[DEBUG] DiskRefreshOperation: Error looking for controller for device %q: %s\", l.Name(disk), err)\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tif ctlr.GetVirtualController().BusNumber < int32(count) {\n\t\t\t\tlog.Printf(\"[DEBUG] DiskRefreshOperation: Found controller %q for device %q\", l.Name(ctlr.GetVirtualController()), l.Name(disk))\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t\treturn false\n\t})\n\treturn devices\n}", "title": "" }, { "docid": "bc08cb3689f986396508057c10fc523e", "score": "0.41843635", "text": "func fsOption() *Option {\n\to := &Option{\n\t\tName: \"Storage\",\n\t\tHelp: \"Type of storage to configure.\",\n\t}\n\tfor _, item := range fsRegistry {\n\t\texample := OptionExample{\n\t\t\tValue: item.Name,\n\t\t\tHelp: item.Description,\n\t\t}\n\t\to.Examples = append(o.Examples, example)\n\t}\n\to.Examples.Sort()\n\treturn o\n}", "title": "" }, { "docid": "21b1b2ba1f37e04ff08eb03f3f61605d", "score": "0.41820058", "text": "func getVMs(xefilter string) []string {\n\t// validate xe filter expression\n\tif !validateXeFilter(xefilter) {\n\t\tlog.Fatal(\"Wrong filter specified. Exiting...\")\n\t}\n\n\t// run xe vm-list --minimal to get all uuids of vms in a comma separated list\n\tcmd := exec.Command(xeBinary, \"vm-list\", \"--minimal\")\n\t// buffer to read cmd output\n\tvar out bytes.Buffer\n\t//assign cmd stdout to buffer\n\tcmd.Stdout = &out\n\n\t// check command for errors\n\terr := cmd.Run()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t//return array of uuids of all vms\n\treturn strings.Split(string(out.Bytes()), \",\")\n}", "title": "" }, { "docid": "17bcb56e36bf0034edcd5b56d7e23665", "score": "0.4175849", "text": "func KnownFSTypes() []string {\n\treturn []string{\n\t\thttpfs.FilestoreType,\n\t\tqipfs.FilestoreType,\n\t\tlocalfs.FilestoreType,\n\t\tqfs.MemFilestoreType,\n\t}\n}", "title": "" }, { "docid": "6759889a2ef7b3daf00cddf1c40833f2", "score": "0.41750568", "text": "func (client *Client) DescribeFileSystemsWithCallback(request *DescribeFileSystemsRequest, callback func(response *DescribeFileSystemsResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *DescribeFileSystemsResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.DescribeFileSystems(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "title": "" }, { "docid": "65d727abc1fbaf73ea10fb664b02efc4", "score": "0.41734225", "text": "func (c *ProjectsLocationsFeaturestoresEntityTypesFeaturesOperationsListCall) Filter(filter string) *ProjectsLocationsFeaturestoresEntityTypesFeaturesOperationsListCall {\n\tc.urlParams_.Set(\"filter\", filter)\n\treturn c\n}", "title": "" }, { "docid": "27a8977f316a74b117a5b854129fa216", "score": "0.41686556", "text": "func (r *RealIsolationResult) Mounts(filter mount.FilterFunc) ([]*mount.Info, error) {\n\tin, err := os.Open(fmt.Sprintf(\"/proc/%d/mountinfo\", r.pid))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not open file mountinfo for %d: %v\", r.pid, err)\n\t}\n\tdefer util.CloseIOAndCheckErr(in, nil)\n\treturn mount.GetMountsFromReader(in, filter)\n}", "title": "" }, { "docid": "bd2a58b083ff950c0bf8a9d4b5da7957", "score": "0.4166932", "text": "func getGlobMounts(args []string) ([]spec.Mount, error) {\n\tmounts := []spec.Mount{}\n\n\tmnt, err := parseMountOptions(\"glob\", args)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tglobs, err := filepath.Glob(mnt.Source)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(globs) == 0 {\n\t\treturn nil, fmt.Errorf(\"no file paths matching glob %q\", mnt.Source)\n\t}\n\n\toptions, err := parse.ValidateVolumeOpts(mnt.Options)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, src := range globs {\n\t\tvar newMount spec.Mount\n\t\tnewMount.Type = define.TypeBind\n\t\tnewMount.Options = options\n\t\tnewMount.Source = src\n\t\tif len(mnt.Destination) == 0 {\n\t\t\tnewMount.Destination = src\n\t\t} else {\n\t\t\tnewMount.Destination = filepath.Join(mnt.Destination, filepath.Base(src))\n\t\t}\n\t\tmounts = append(mounts, newMount)\n\t}\n\n\treturn mounts, nil\n}", "title": "" }, { "docid": "55b994437ff79bb87ddf1194e369498e", "score": "0.4153181", "text": "func (a *Client) GetFwSystems(params *GetFwSystemsParams) (*GetFwSystemsOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetFwSystemsParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"get_fw_systems\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/fw/systems/\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &GetFwSystemsReader{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.(*GetFwSystemsOK), nil\n\n}", "title": "" }, { "docid": "813a6a482f86072c41065da78f3eb26d", "score": "0.41525543", "text": "func List(ctx context.Context, impl Interface, path string) ([]plugin.Entry, error) {\n\tresult, err := plugin.CachedOp(ctx, \"VolumeListCB\", impl, 30*time.Second, func() (interface{}, error) {\n\t\treturn impl.VolumeList(ctx)\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\troot := result.(DirMap)[path]\n\tentries := make([]plugin.Entry, 0, len(root))\n\tfor name, attr := range root {\n\t\tif attr.Mode().IsDir() {\n\t\t\tentries = append(entries, newDir(name, attr, impl, path+\"/\"+name))\n\t\t} else {\n\t\t\tentries = append(entries, newFile(name, attr, impl, path+\"/\"+name))\n\t\t}\n\t}\n\t// Sort entries so they have a deterministic order.\n\tsort.Slice(entries, func(i, j int) bool { return plugin.Name(entries[i]) < plugin.Name(entries[j]) })\n\treturn entries, nil\n}", "title": "" }, { "docid": "13fd0bd3b33ada84ec31ea9d325410b1", "score": "0.41512212", "text": "func (a SysApi) GetDiskList() (*SysDiskList, error) {\n\n\tvar httpMethod = \"Get\"\n\t// create path and map variables\n\tpath := a.configuration.BasePath + \"/tm/sys/disk\"\n\n\theaderParams := make(map[string]string)\n\tqueryParams := url.Values{}\n\tformParams := make(map[string]string)\n\tvar postBody interface{}\n\tvar fileName string\n\tvar fileBytes []byte\n\t// authentication '(token)' required\n\t// set key with prefix in header\n\theaderParams[\"X-F5-Auth-Token\"] = a.configuration.getAPIKeyWithPrefix(\"X-F5-Auth-Token\")\n\t// add default headers if any\n\tfor key := range a.configuration.DefaultHeader {\n\t\theaderParams[key] = a.configuration.DefaultHeader[key]\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\n\t\t\"application/json\",\n\t}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.configuration.restClient.selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\theaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"aplication/json\",\n\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.configuration.restClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\theaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\thttpResponse, err := a.configuration.restClient.callAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)\n\tvar successPayload = new(SysDiskList)\n\tif err == nil && httpResponse.StatusCode() == 200 {\n\t\terr = json.Unmarshal(httpResponse.Body(), &successPayload)\n\t}\n\terr = NewAPIResponse(httpResponse, err)\n\tif err != nil {\n\t\treturn nil, err\n\t} else {\n\t\treturn successPayload, err\n\t}\n\n}", "title": "" }, { "docid": "c0046b02ae2d86e490609f07ebd23639", "score": "0.41494086", "text": "func (db *DB) Files() (a Array, err error) {\n\tif err = db.enter(); err != nil {\n\t\treturn\n\t}\n\n\tdefer func() {\n\t\tif e := recover(); e != nil {\n\t\t\terr = fmt.Errorf(\"%v\", e)\n\t\t}\n\t\tdb.leave(&err)\n\t}()\n\n\tp, err := db.root()\n\tif err != nil {\n\t\treturn a, err\n\t}\n\n\treturn p.array(filesPrefix)\n}", "title": "" }, { "docid": "cfc9309aa30dc8d0614e648510453141", "score": "0.41482356", "text": "func newFilesystem(vid *utils.VolumeId) *zFilesystem {\n\tfs := new(zFilesystem)\n\tfs.id = vid\n\tfs.bolt = utils.NewBolt()\n\tfs.state = stateCreating\n\treturn fs\n}", "title": "" }, { "docid": "ddb3f3819aa4a547f4f4c934877ffd1f", "score": "0.41467685", "text": "func (taskStore eventTaskStore) FilterTasks(filterMap map[string]string) ([]storetypes.VersionedTask, error) {\n\tif len(filterMap) == 0 {\n\t\treturn nil, errors.New(\"There has to be at least one filter\")\n\t}\n\n\tfilters := make([]string, 0, len(filterMap))\n\tfor k, v := range filterMap {\n\t\tif v != \"\" {\n\t\t\tfilters = append(filters, k)\n\t\t}\n\t}\n\tif len(filters) == 0 {\n\t\treturn nil, errors.New(\"There has to be at least one filter with a filter value set\")\n\t}\n\n\tif !taskStore.areFiltersValid(filters) {\n\t\treturn nil, errors.Errorf(\"At least one of the provided filters '%v' is not supported.\", filters)\n\t}\n\n\tvar result []storetypes.VersionedTask\n\tvar err error\n\t// filterTasksByCluster does an etcd list by cluster prefix\n\t// so it can't be combined with other task filters.\n\tif cluster := filterMap[taskClusterFilter]; cluster != \"\" {\n\t\tresult, err = taskStore.filterTasksByCluster(cluster)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t} else {\n\t\tresult, err = taskStore.ListTasks()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tfor k, v := range filterMap {\n\t\tif k == taskClusterFilter || v == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\ttaskFilter, err := taskStore.getTaskFilter(k)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresult = taskStore.filterTasks(result, taskFilter, v)\n\t}\n\n\treturn result, nil\n}", "title": "" }, { "docid": "733816cc590c1c5d995eee26ba7d0e00", "score": "0.41436967", "text": "func (d *driver) List(ctx context.Context, path string) ([]string, error) {\n\t//NOTE: should I use Tx?\n\tif !isRoot(path) {\n\t\tvar ph interface{}\n\t\tswitch err := d.cluster.DB(pgcluster.MASTER).QueryRow(\"SELECT 1 FROM mfs WHERE path=$1\", path).Scan(&ph); err {\n\t\tcase sql.ErrNoRows:\n\t\t\treturn nil, storagedriver.PathNotFoundError{Path: path, DriverName: driverName}\n\t\tcase nil:\n\t\t\t// pass\n\t\tdefault:\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\trows, err := d.cluster.DB(pgcluster.MASTER).Query(\"SELECT path FROM mfs WHERE parent=$1\", path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\n\tvar listing []string\n\tfor rows.Next() {\n\t\tvar item string\n\t\tif err := rows.Scan(&item); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tlisting = append(listing, item)\n\t}\n\treturn listing, nil\n}", "title": "" }, { "docid": "4cb394a5bc6079b56bbe3e7850343bd1", "score": "0.41350254", "text": "func (c *ProjectsLocationsFeaturestoresEntityTypesOperationsListCall) Filter(filter string) *ProjectsLocationsFeaturestoresEntityTypesOperationsListCall {\n\tc.urlParams_.Set(\"filter\", filter)\n\treturn c\n}", "title": "" }, { "docid": "a847c916fddb0b49a1308c191cea16c7", "score": "0.41321847", "text": "func (r *marathonRunner) makeFilter() (marathonFilter, error) {\n\tvar filters []marathonFilter\n\n\tif r.selector != \"\" {\n\t\tfilter, err := makeLabelFilter(r.selector)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfilters = append(filters, filter)\n\t}\n\n\treturn makeFilterStack(filters), nil\n}", "title": "" }, { "docid": "9cc117cb4a4dd2d85d6f09dd96f632ff", "score": "0.41238135", "text": "func Xsqlite3_vfs_find(tls crt.TLS, _zVfs uintptr /* *int8 */) (r uintptr /* *Tsqlite3_vfs = Ssqlite3_vfs */) {\n\tvar (\n\t\t_pVfs uintptr // *Tsqlite3_vfs = Ssqlite3_vfs\n\t\t_mutex uintptr // *Tsqlite3_mutex = Ssqlite3_mutex\n\t\t_rc int32\n\t)\n\t_pVfs = 0\n\t_rc = Xsqlite3_initialize(tls)\n\tif _rc == 0 {\n\t\tgoto _1\n\t}\n\n\treturn null\n\n_1:\n\t_mutex = _35sqlite3MutexAlloc(tls, int32(2))\n\tXsqlite3_mutex_enter(tls, _mutex)\n\t_pVfs = _36vfsList\n_2:\n\tif _pVfs == 0 {\n\t\tgoto _4\n\t}\n\n\tif _zVfs != 0 {\n\t\tgoto _5\n\t}\n\n\tgoto _4\n\n_5:\n\tif crt.Xstrcmp(tls, _zVfs, *(*uintptr)(unsafe.Pointer(_pVfs + 24))) != int32(0) {\n\t\tgoto _6\n\t}\n\n\tgoto _4\n\n_6:\n\t_pVfs = *(*uintptr)(unsafe.Pointer(_pVfs + 16))\n\tgoto _2\n\n_4:\n\tXsqlite3_mutex_leave(tls, _mutex)\n\treturn _pVfs\n}", "title": "" }, { "docid": "58892efde01c8c18567badc68925dd18", "score": "0.4116067", "text": "func search(root string, testFilter *regexp.Regexp) ([]string, error) {\n\tvar testSlice []string\n\n\terr := filepath.Walk(root, func(path string, info os.FileInfo, err error) error {\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tname := filepath.Base(path)\n\n\t\tif info.IsDir() || !testFilter.MatchString(name) {\n\t\t\treturn nil\n\t\t}\n\n\t\trelPath, err := filepath.Rel(root, path)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\ttestSlice = append(testSlice, relPath)\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"walking %q: %v\", root, err)\n\t}\n\n\treturn testSlice, nil\n}", "title": "" }, { "docid": "4defefde4f67c24408d021f83f419a51", "score": "0.4113947", "text": "func ExampleAmlFilesystemsClient_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 := armstoragecache.NewClientFactory(\"<subscription-id>\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpager := clientFactory.NewAmlFilesystemsClient().NewListPager(nil)\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.AmlFilesystemsListResult = armstoragecache.AmlFilesystemsListResult{\n\t\t// \tValue: []*armstoragecache.AmlFilesystem{\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"fs1\"),\n\t\t// \t\t\tType: to.Ptr(\"Microsoft.StorageCache/amlFilesystem\"),\n\t\t// \t\t\tID: to.Ptr(\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.StorageCache/amlFilesystems/fs1\"),\n\t\t// \t\t\tLocation: to.Ptr(\"eastus\"),\n\t\t// \t\t\tTags: map[string]*string{\n\t\t// \t\t\t\t\"Dept\": to.Ptr(\"ContosoAds\"),\n\t\t// \t\t\t},\n\t\t// \t\t\tIdentity: &armstoragecache.AmlFilesystemIdentity{\n\t\t// \t\t\t\tType: to.Ptr(armstoragecache.AmlFilesystemIdentityTypeUserAssigned),\n\t\t// \t\t\t\tUserAssignedIdentities: map[string]*armstoragecache.UserAssignedIdentitiesValue{\n\t\t// \t\t\t\t\t\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1\": &armstoragecache.UserAssignedIdentitiesValue{\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\tProperties: &armstoragecache.AmlFilesystemProperties{\n\t\t// \t\t\t\tClientInfo: &armstoragecache.AmlFilesystemClientInfo{\n\t\t// \t\t\t\t\tContainerStorageInterface: &armstoragecache.AmlFilesystemContainerStorageInterface{\n\t\t// \t\t\t\t\t\tPersistentVolume: to.Ptr(\"<Base64 encoded YAML>\"),\n\t\t// \t\t\t\t\t\tPersistentVolumeClaim: to.Ptr(\"<Base64 encoded YAML>\"),\n\t\t// \t\t\t\t\t\tStorageClass: to.Ptr(\"<Base64 encoded YAML>\"),\n\t\t// \t\t\t\t\t},\n\t\t// \t\t\t\t\tLustreVersion: to.Ptr(\"2.15.0\"),\n\t\t// \t\t\t\t\tMgsAddress: to.Ptr(\"10.0.0.4\"),\n\t\t// \t\t\t\t\tMountCommand: to.Ptr(\"mount -t lustre 10.0.0.4@tcp:/lustrefs /lustre/lustrefs\"),\n\t\t// \t\t\t\t},\n\t\t// \t\t\t\tEncryptionSettings: &armstoragecache.AmlFilesystemEncryptionSettings{\n\t\t// \t\t\t\t\tKeyEncryptionKey: &armstoragecache.KeyVaultKeyReference{\n\t\t// \t\t\t\t\t\tKeyURL: to.Ptr(\"https://examplekv.vault.azure.net/keys/kvk/3540a47df75541378d3518c6a4bdf5af\"),\n\t\t// \t\t\t\t\t\tSourceVault: &armstoragecache.KeyVaultKeyReferenceSourceVault{\n\t\t// \t\t\t\t\t\t\tID: to.Ptr(\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.KeyVault/vaults/keyvault-cmk\"),\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\tFilesystemSubnet: to.Ptr(\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.Network/virtualNetworks/scvnet/subnets/fsSub1\"),\n\t\t// \t\t\t\tHealth: &armstoragecache.AmlFilesystemHealth{\n\t\t// \t\t\t\t\tState: to.Ptr(armstoragecache.AmlFilesystemHealthStateTypeAvailable),\n\t\t// \t\t\t\t\tStatusDescription: to.Ptr(\"amlFilesystem is ok.\"),\n\t\t// \t\t\t\t},\n\t\t// \t\t\t\tHsm: &armstoragecache.AmlFilesystemPropertiesHsm{\n\t\t// \t\t\t\t\tArchiveStatus: []*armstoragecache.AmlFilesystemArchive{\n\t\t// \t\t\t\t\t\t{\n\t\t// \t\t\t\t\t\t\tFilesystemPath: to.Ptr(\"/\"),\n\t\t// \t\t\t\t\t\t\tStatus: &armstoragecache.AmlFilesystemArchiveStatus{\n\t\t// \t\t\t\t\t\t\t\tLastCompletionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"2019-04-21T18:25:43.511Z\"); return t}()),\n\t\t// \t\t\t\t\t\t\t\tLastStartedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"2019-04-21T17:25:43.511Z\"); return t}()),\n\t\t// \t\t\t\t\t\t\t\tState: to.Ptr(armstoragecache.ArchiveStatusTypeCompleted),\n\t\t// \t\t\t\t\t\t\t},\n\t\t// \t\t\t\t\t}},\n\t\t// \t\t\t\t\tSettings: &armstoragecache.AmlFilesystemHsmSettings{\n\t\t// \t\t\t\t\t\tContainer: to.Ptr(\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.Storage/storageAccounts/storageaccountname/blobServices/default/containers/containername\"),\n\t\t// \t\t\t\t\t\tImportPrefix: to.Ptr(\"/\"),\n\t\t// \t\t\t\t\t\tLoggingContainer: to.Ptr(\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.Storage/storageAccounts/storageaccountname/blobServices/default/containers/loggingcontainername\"),\n\t\t// \t\t\t\t\t},\n\t\t// \t\t\t\t},\n\t\t// \t\t\t\tMaintenanceWindow: &armstoragecache.AmlFilesystemPropertiesMaintenanceWindow{\n\t\t// \t\t\t\t\tDayOfWeek: to.Ptr(armstoragecache.MaintenanceDayOfWeekTypeFriday),\n\t\t// \t\t\t\t\tTimeOfDayUTC: to.Ptr(\"22:00\"),\n\t\t// \t\t\t\t},\n\t\t// \t\t\t\tProvisioningState: to.Ptr(armstoragecache.AmlFilesystemProvisioningStateTypeSucceeded),\n\t\t// \t\t\t\tStorageCapacityTiB: to.Ptr[float32](16),\n\t\t// \t\t\t\tThroughputProvisionedMBps: to.Ptr[int32](500),\n\t\t// \t\t\t},\n\t\t// \t\t\tSKU: &armstoragecache.SKUName{\n\t\t// \t\t\t\tName: to.Ptr(\"AMLFS-Durable-Premium-250\"),\n\t\t// \t\t\t},\n\t\t// \t\t\tZones: []*string{\n\t\t// \t\t\t\tto.Ptr(\"1\")},\n\t\t// \t\t\t},\n\t\t// \t\t\t{\n\t\t// \t\t\t\tName: to.Ptr(\"fs2\"),\n\t\t// \t\t\t\tType: to.Ptr(\"Microsoft.StorageCache/amlFilesystem\"),\n\t\t// \t\t\t\tID: to.Ptr(\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.StorageCache/amlFilesystems/fs2\"),\n\t\t// \t\t\t\tLocation: to.Ptr(\"eastus\"),\n\t\t// \t\t\t\tTags: map[string]*string{\n\t\t// \t\t\t\t\t\"Dept\": to.Ptr(\"ContosoAds\"),\n\t\t// \t\t\t\t},\n\t\t// \t\t\t\tIdentity: &armstoragecache.AmlFilesystemIdentity{\n\t\t// \t\t\t\t\tType: to.Ptr(armstoragecache.AmlFilesystemIdentityTypeUserAssigned),\n\t\t// \t\t\t\t\tUserAssignedIdentities: map[string]*armstoragecache.UserAssignedIdentitiesValue{\n\t\t// \t\t\t\t\t\t\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1\": &armstoragecache.UserAssignedIdentitiesValue{\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\tProperties: &armstoragecache.AmlFilesystemProperties{\n\t\t// \t\t\t\t\tClientInfo: &armstoragecache.AmlFilesystemClientInfo{\n\t\t// \t\t\t\t\t\tContainerStorageInterface: &armstoragecache.AmlFilesystemContainerStorageInterface{\n\t\t// \t\t\t\t\t\t\tPersistentVolume: to.Ptr(\"<Base64 encoded YAML>\"),\n\t\t// \t\t\t\t\t\t\tPersistentVolumeClaim: to.Ptr(\"<Base64 encoded YAML>\"),\n\t\t// \t\t\t\t\t\t\tStorageClass: to.Ptr(\"<Base64 encoded YAML>\"),\n\t\t// \t\t\t\t\t\t},\n\t\t// \t\t\t\t\t\tLustreVersion: to.Ptr(\"2.15.0\"),\n\t\t// \t\t\t\t\t\tMgsAddress: to.Ptr(\"10.0.0.4\"),\n\t\t// \t\t\t\t\t\tMountCommand: to.Ptr(\"mount -t lustre 10.0.0.4@tcp:/lustrefs /lustre/lustrefs\"),\n\t\t// \t\t\t\t\t},\n\t\t// \t\t\t\t\tEncryptionSettings: &armstoragecache.AmlFilesystemEncryptionSettings{\n\t\t// \t\t\t\t\t\tKeyEncryptionKey: &armstoragecache.KeyVaultKeyReference{\n\t\t// \t\t\t\t\t\t\tKeyURL: to.Ptr(\"https://examplekv.vault.azure.net/keys/kvk/3540a47df75541378d3518c6a4bdf5af\"),\n\t\t// \t\t\t\t\t\t\tSourceVault: &armstoragecache.KeyVaultKeyReferenceSourceVault{\n\t\t// \t\t\t\t\t\t\t\tID: to.Ptr(\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.KeyVault/vaults/keyvault-cmk\"),\n\t\t// \t\t\t\t\t\t\t},\n\t\t// \t\t\t\t\t\t},\n\t\t// \t\t\t\t\t},\n\t\t// \t\t\t\t\tFilesystemSubnet: to.Ptr(\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.Network/virtualNetworks/scvnet/subnets/fsSub2\"),\n\t\t// \t\t\t\t\tHealth: &armstoragecache.AmlFilesystemHealth{\n\t\t// \t\t\t\t\t\tState: to.Ptr(armstoragecache.AmlFilesystemHealthStateTypeAvailable),\n\t\t// \t\t\t\t\t\tStatusDescription: to.Ptr(\"amlFilesystem is ok.\"),\n\t\t// \t\t\t\t\t},\n\t\t// \t\t\t\t\tHsm: &armstoragecache.AmlFilesystemPropertiesHsm{\n\t\t// \t\t\t\t\t\tArchiveStatus: []*armstoragecache.AmlFilesystemArchive{\n\t\t// \t\t\t\t\t\t\t{\n\t\t// \t\t\t\t\t\t\t\tFilesystemPath: to.Ptr(\"/\"),\n\t\t// \t\t\t\t\t\t\t\tStatus: &armstoragecache.AmlFilesystemArchiveStatus{\n\t\t// \t\t\t\t\t\t\t\t\tLastCompletionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"2019-04-21T18:25:43.511Z\"); return t}()),\n\t\t// \t\t\t\t\t\t\t\t\tLastStartedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"2019-04-21T17:25:43.511Z\"); return t}()),\n\t\t// \t\t\t\t\t\t\t\t\tState: to.Ptr(armstoragecache.ArchiveStatusTypeCompleted),\n\t\t// \t\t\t\t\t\t\t\t},\n\t\t// \t\t\t\t\t\t}},\n\t\t// \t\t\t\t\t\tSettings: &armstoragecache.AmlFilesystemHsmSettings{\n\t\t// \t\t\t\t\t\t\tContainer: to.Ptr(\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.Storage/storageAccounts/storageaccountname/blobServices/default/containers/containername\"),\n\t\t// \t\t\t\t\t\t\tImportPrefix: to.Ptr(\"/\"),\n\t\t// \t\t\t\t\t\t\tLoggingContainer: to.Ptr(\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.Storage/storageAccounts/storageaccountname/blobServices/default/containers/loggingcontainername\"),\n\t\t// \t\t\t\t\t\t},\n\t\t// \t\t\t\t\t},\n\t\t// \t\t\t\t\tMaintenanceWindow: &armstoragecache.AmlFilesystemPropertiesMaintenanceWindow{\n\t\t// \t\t\t\t\t\tDayOfWeek: to.Ptr(armstoragecache.MaintenanceDayOfWeekTypeFriday),\n\t\t// \t\t\t\t\t\tTimeOfDayUTC: to.Ptr(\"22:00\"),\n\t\t// \t\t\t\t\t},\n\t\t// \t\t\t\t\tProvisioningState: to.Ptr(armstoragecache.AmlFilesystemProvisioningStateTypeSucceeded),\n\t\t// \t\t\t\t\tStorageCapacityTiB: to.Ptr[float32](16),\n\t\t// \t\t\t\t\tThroughputProvisionedMBps: to.Ptr[int32](500),\n\t\t// \t\t\t\t},\n\t\t// \t\t\t\tSKU: &armstoragecache.SKUName{\n\t\t// \t\t\t\t\tName: to.Ptr(\"AMLFS-Durable-Premium-250\"),\n\t\t// \t\t\t\t},\n\t\t// \t\t\t\tZones: []*string{\n\t\t// \t\t\t\t\tto.Ptr(\"1\")},\n\t\t// \t\t\t}},\n\t\t// \t\t}\n\t}\n}", "title": "" }, { "docid": "97b91b847c458cc3e63cbe59a44787c3", "score": "0.41043428", "text": "func (client FilesystemClient) List(ctx context.Context, prefix string, continuation string, maxResults *int32, xMsClientRequestID string, timeout *int32, xMsDate string) (result FilesystemList, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/FilesystemClient.List\")\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: maxResults,\n\t\t\tConstraints: []validation.Constraint{{Target: \"maxResults\", Name: validation.Null, Rule: false,\n\t\t\t\tChain: []validation.Constraint{{Target: \"maxResults\", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}},\n\t\t{TargetValue: xMsClientRequestID,\n\t\t\tConstraints: []validation.Constraint{{Target: \"xMsClientRequestID\", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}},\n\t\t{TargetValue: timeout,\n\t\t\tConstraints: []validation.Constraint{{Target: \"timeout\", Name: validation.Null, Rule: false,\n\t\t\t\tChain: []validation.Constraint{{Target: \"timeout\", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}}); err != nil {\n\t\treturn result, validation.NewError(\"storagedatalake.FilesystemClient\", \"List\", err.Error())\n\t}\n\n\treq, err := client.ListPreparer(ctx, prefix, continuation, maxResults, xMsClientRequestID, timeout, xMsDate)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"storagedatalake.FilesystemClient\", \"List\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.ListSender(req)\n\tif err != nil {\n\t\tresult.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"storagedatalake.FilesystemClient\", \"List\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult, err = client.ListResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"storagedatalake.FilesystemClient\", \"List\", resp, \"Failure responding to request\")\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "16723e7a96db2d0fafd1d852142061a0", "score": "0.41008213", "text": "func fetchFiles(provider string) []string {\n\tdir := fmt.Sprintf(\"%s/%s\", config.DataDir, provider)\n\tfis, err := ioutil.ReadDir(dir)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn []string{}\n\t}\n\tfiles := make([]string, len(fis))\n\tfor i, fi := range fis {\n\t\tif fi.IsDir() {\n\t\t\t// TODO - merge by os.sep\n\t\t\tfiles[i] = dir + \"/\" + fi.Name() + \"/\" + config.SettingsFile\n\t\t}\n\t}\n\treturn files\n}", "title": "" }, { "docid": "8e9340383ffb435bac183dd9bdcf24bb", "score": "0.4095636", "text": "func AllMounts() ([]string, error) {\n\treturn nil, nil\n}", "title": "" }, { "docid": "9deb1eaf2499f6c8ddbc1cb5d7074191", "score": "0.4090315", "text": "func getFiles(id string, extensions []string, method searchMethod) ([]string, error) {\n\tpwd, err := os.Getwd()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar result []string\n\terr = filepath.Walk(filepath.Join(pwd, \"cache\", \"repo\"),\n\t\tfunc(path string, f os.FileInfo, err error) error {\n\t\t\t// get extension\n\t\t\text := filepath.Ext(path)\n\t\t\tif !f.IsDir() && contains(extensions, strings.TrimPrefix(ext, \".\")) {\n\t\t\t\tif method == Simple {\n\t\t\t\t\tif strings.Contains(strings.ToLower(f.Name()), strings.ToLower(id)) {\n\t\t\t\t\t\tresult = append(result, path)\n\t\t\t\t\t}\n\t\t\t\t} else if method == Glob {\n\t\t\t\t\tif matched, _ := filepath.Match(id, strings.TrimSuffix(f.Name(), ext)); matched {\n\t\t\t\t\t\tresult = append(result, path)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\treturn result, err\n}", "title": "" }, { "docid": "371a7f5a27df559388f28d67ea7cc034", "score": "0.4090009", "text": "func ExampleAmlFilesystemsClient_Get() {\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 := armstoragecache.NewClientFactory(\"<subscription-id>\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tres, err := clientFactory.NewAmlFilesystemsClient().Get(ctx, \"scgroup\", \"fs1\", nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to finish the request: %v\", err)\n\t}\n\t// You could use response here. We use blank identifier for just demo purposes.\n\t_ = res\n\t// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.\n\t// res.AmlFilesystem = armstoragecache.AmlFilesystem{\n\t// \tName: to.Ptr(\"fs1\"),\n\t// \tType: to.Ptr(\"Microsoft.StorageCache/amlFilesystem\"),\n\t// \tID: to.Ptr(\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.StorageCache/amlFilesystems/fs1\"),\n\t// \tLocation: to.Ptr(\"eastus\"),\n\t// \tTags: map[string]*string{\n\t// \t\t\"Dept\": to.Ptr(\"ContosoAds\"),\n\t// \t},\n\t// \tIdentity: &armstoragecache.AmlFilesystemIdentity{\n\t// \t\tType: to.Ptr(armstoragecache.AmlFilesystemIdentityTypeUserAssigned),\n\t// \t\tUserAssignedIdentities: map[string]*armstoragecache.UserAssignedIdentitiesValue{\n\t// \t\t\t\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1\": &armstoragecache.UserAssignedIdentitiesValue{\n\t// \t\t\t},\n\t// \t\t},\n\t// \t},\n\t// \tProperties: &armstoragecache.AmlFilesystemProperties{\n\t// \t\tClientInfo: &armstoragecache.AmlFilesystemClientInfo{\n\t// \t\t\tContainerStorageInterface: &armstoragecache.AmlFilesystemContainerStorageInterface{\n\t// \t\t\t\tPersistentVolume: to.Ptr(\"<Base64 encoded YAML>\"),\n\t// \t\t\t\tPersistentVolumeClaim: to.Ptr(\"<Base64 encoded YAML>\"),\n\t// \t\t\t\tStorageClass: to.Ptr(\"<Base64 encoded YAML>\"),\n\t// \t\t\t},\n\t// \t\t\tLustreVersion: to.Ptr(\"2.15.0\"),\n\t// \t\t\tMgsAddress: to.Ptr(\"10.0.0.4\"),\n\t// \t\t\tMountCommand: to.Ptr(\"mount -t lustre 10.0.0.4@tcp:/lustrefs /lustre/lustrefs\"),\n\t// \t\t},\n\t// \t\tEncryptionSettings: &armstoragecache.AmlFilesystemEncryptionSettings{\n\t// \t\t\tKeyEncryptionKey: &armstoragecache.KeyVaultKeyReference{\n\t// \t\t\t\tKeyURL: to.Ptr(\"https://keyvault-cmk.vault.azure.net/keys/key2048/test\"),\n\t// \t\t\t\tSourceVault: &armstoragecache.KeyVaultKeyReferenceSourceVault{\n\t// \t\t\t\t\tID: to.Ptr(\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.KeyVault/vaults/keyvault-cmk\"),\n\t// \t\t\t\t},\n\t// \t\t\t},\n\t// \t\t},\n\t// \t\tFilesystemSubnet: to.Ptr(\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.Network/virtualNetworks/scvnet/subnets/fsSub\"),\n\t// \t\tHealth: &armstoragecache.AmlFilesystemHealth{\n\t// \t\t\tState: to.Ptr(armstoragecache.AmlFilesystemHealthStateTypeAvailable),\n\t// \t\t\tStatusDescription: to.Ptr(\"amlFilesystem is ok.\"),\n\t// \t\t},\n\t// \t\tHsm: &armstoragecache.AmlFilesystemPropertiesHsm{\n\t// \t\t\tArchiveStatus: []*armstoragecache.AmlFilesystemArchive{\n\t// \t\t\t\t{\n\t// \t\t\t\t\tFilesystemPath: to.Ptr(\"/\"),\n\t// \t\t\t\t\tStatus: &armstoragecache.AmlFilesystemArchiveStatus{\n\t// \t\t\t\t\t\tLastCompletionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"2019-04-21T18:25:43.511Z\"); return t}()),\n\t// \t\t\t\t\t\tLastStartedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"2019-04-21T17:25:43.511Z\"); return t}()),\n\t// \t\t\t\t\t\tState: to.Ptr(armstoragecache.ArchiveStatusTypeCompleted),\n\t// \t\t\t\t\t},\n\t// \t\t\t}},\n\t// \t\t\tSettings: &armstoragecache.AmlFilesystemHsmSettings{\n\t// \t\t\t\tContainer: to.Ptr(\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.Storage/storageAccounts/storageaccountname/blobServices/default/containers/containername\"),\n\t// \t\t\t\tImportPrefix: to.Ptr(\"/\"),\n\t// \t\t\t\tLoggingContainer: to.Ptr(\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.Storage/storageAccounts/storageaccountname/blobServices/default/containers/loggingcontainername\"),\n\t// \t\t\t},\n\t// \t\t},\n\t// \t\tMaintenanceWindow: &armstoragecache.AmlFilesystemPropertiesMaintenanceWindow{\n\t// \t\t\tDayOfWeek: to.Ptr(armstoragecache.MaintenanceDayOfWeekTypeFriday),\n\t// \t\t\tTimeOfDayUTC: to.Ptr(\"22:00\"),\n\t// \t\t},\n\t// \t\tProvisioningState: to.Ptr(armstoragecache.AmlFilesystemProvisioningStateTypeSucceeded),\n\t// \t\tStorageCapacityTiB: to.Ptr[float32](16),\n\t// \t\tThroughputProvisionedMBps: to.Ptr[int32](500),\n\t// \t},\n\t// \tSKU: &armstoragecache.SKUName{\n\t// \t\tName: to.Ptr(\"AMLFS-Durable-Premium-250\"),\n\t// \t},\n\t// \tZones: []*string{\n\t// \t\tto.Ptr(\"1\")},\n\t// \t}\n}", "title": "" }, { "docid": "79396b4b8d4a2fd13fdaacccba8fe441", "score": "0.40895247", "text": "func AllBenchmarks(filter *regexp.Regexp, props FactoryProps) []*Benchmark {\n\t//Sorting map keys to get a deterministic order\n\ttypes := make([]string, 0)\n\tfor typename := range storageTypes {\n\t\ttypes = append(types, typename)\n\t}\n\tsort.Strings(types)\n\n\ttags := make(Tags) //empty tags\n\n\tvar label string\n\tbenchmarks := make([]*Benchmark, 0)\n\tfor _, typename := range types {\n\t\tnewStorage, ok := storageTypes[typename]\n\t\tif !ok {\n\t\t\t//If we're here, some *really* weird stuff has happend\n\t\t\tpanic(fmt.Sprintf(\"type %v not found\", typename))\n\t\t}\n\n\t\tlabel = typename\n\t\tif filter.MatchString(label) {\n\t\t\tbenchmarks = append(benchmarks, &Benchmark{label, tags, NewBaseSieve, newStorage})\n\t\t}\n\n\t\tlabel = typename + \"-Blk\"\n\t\tif filter.MatchString(label) {\n\t\t\tbenchmarks = append(benchmarks, &Benchmark{label, tags, NewBaseSieve, NewBlockStorageFactory(newStorage, props)})\n\t\t}\n\n\t\tlabel = typename + \"-Rlk\"\n\t\tif filter.MatchString(label) {\n\t\t\tbenchmarks = append(benchmarks, &Benchmark{label, tags, NewBaseSieve, NewReverseBlockStorageFactory(newStorage, props)})\n\t\t}\n\n\t\tlabel = typename + \"-Seg\"\n\t\tif filter.MatchString(label) {\n\t\t\tbenchmarks = append(benchmarks, &Benchmark{label, tags, NewSegmentedSieveFactory(props), newStorage})\n\t\t}\n\t}\n\n\treturn benchmarks\n}", "title": "" }, { "docid": "dac407c885a20970bc27892bccab9dfc", "score": "0.40874383", "text": "func platformRootfs(ctx context.Context, store content.Store, desc ocispec.Descriptor, platform ocispec.Platform) (ocispec.RootFS, error) {\n\tempty := ocispec.RootFS{}\n\n\tconfigDesc, err := containerdimages.Config(ctx, store, desc, platforms.OnlyStrict(platform))\n\tif err != nil {\n\t\treturn empty, errors.Wrapf(err, \"failed to get config for platform %s\", platforms.Format(platform))\n\t}\n\n\tdiffs, err := containerdimages.RootFS(ctx, store, configDesc)\n\tif err != nil {\n\t\treturn empty, errors.Wrapf(err, \"failed to obtain rootfs\")\n\t}\n\n\treturn ocispec.RootFS{\n\t\tType: \"layers\",\n\t\tDiffIDs: diffs,\n\t}, nil\n}", "title": "" }, { "docid": "46f77bf1e84f04865196bc980d120028", "score": "0.40828186", "text": "func (c *ProjectsLocationsFeaturestoresEntityTypesListCall) Filter(filter string) *ProjectsLocationsFeaturestoresEntityTypesListCall {\n\tc.urlParams_.Set(\"filter\", filter)\n\treturn c\n}", "title": "" }, { "docid": "1b83900919e5ab403aa7d591aa659e13", "score": "0.4079088", "text": "func Files(mods ...qm.QueryMod) fileQuery {\n\tmods = append(mods, qm.From(\"\\\"files\\\"\"), qmhelper.WhereIsNull(\"\\\"files\\\".\\\"deletedat\\\"\"))\n\tq := NewQuery(mods...)\n\tif len(queries.GetSelect(q)) == 0 {\n\t\tqueries.SetSelect(q, []string{\"\\\"files\\\".*\"})\n\t}\n\n\treturn fileQuery{q}\n}", "title": "" }, { "docid": "326444c124cbf2041cc3664f0426e746", "score": "0.40757555", "text": "func createFilesystem(datasetName string) (*zfs.Dataset, error) {\n\treturn zfs.CreateFilesystem(datasetName, zfsCreateProperties)\n}", "title": "" }, { "docid": "fa12ba1c39026d1e6412882d3d4d119a", "score": "0.4072261", "text": "func (c *DisksListCall) Filter(filter string) *DisksListCall {\n\tc.opt_[\"filter\"] = filter\n\treturn c\n}", "title": "" }, { "docid": "f718e045b194b55e63a1c2d7915a49af", "score": "0.40670186", "text": "func (c *Client) RenterFilesFilteredGet(filter string) (rf api.RenterFiles, err error) {\n\tquery := fmt.Sprintf(\"?filter=%s\", url.PathEscape(filter))\n\terr = c.get(\"/renter/files\"+query, &rf)\n\treturn\n}", "title": "" }, { "docid": "2ad57bae364245b4b6aa74982b2bbcd0", "score": "0.4065536", "text": "func (a SysApi) GetFileList() (*SysFileList, error) {\n\n\tvar httpMethod = \"Get\"\n\t// create path and map variables\n\tpath := a.configuration.BasePath + \"/tm/sys/file\"\n\n\theaderParams := make(map[string]string)\n\tqueryParams := url.Values{}\n\tformParams := make(map[string]string)\n\tvar postBody interface{}\n\tvar fileName string\n\tvar fileBytes []byte\n\t// authentication '(token)' required\n\t// set key with prefix in header\n\theaderParams[\"X-F5-Auth-Token\"] = a.configuration.getAPIKeyWithPrefix(\"X-F5-Auth-Token\")\n\t// add default headers if any\n\tfor key := range a.configuration.DefaultHeader {\n\t\theaderParams[key] = a.configuration.DefaultHeader[key]\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\n\t\t\"application/json\",\n\t}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.configuration.restClient.selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\theaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"aplication/json\",\n\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.configuration.restClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\theaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\thttpResponse, err := a.configuration.restClient.callAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)\n\tvar successPayload = new(SysFileList)\n\tif err == nil && httpResponse.StatusCode() == 200 {\n\t\terr = json.Unmarshal(httpResponse.Body(), &successPayload)\n\t}\n\terr = NewAPIResponse(httpResponse, err)\n\tif err != nil {\n\t\treturn nil, err\n\t} else {\n\t\treturn successPayload, err\n\t}\n\n}", "title": "" }, { "docid": "1a86844d50f07d9e7cc111b7183a1bb5", "score": "0.40614706", "text": "func (opt *OperationTracker) filterOps(ctx context.Context, filters ...interface{}) []*Operation {\n\tvar fltops []*Operation\n\topt.mu.RLock()\n\tdefer opt.mu.RUnlock()\n\tfor _, op := range filterOpsMap(ctx, opt.operations, filters) {\n\t\tfltops = append(fltops, op)\n\t}\n\treturn fltops\n}", "title": "" } ]
49bf7b785799dfb6ba37ebef14a68bda
VideoCanvasPaletteSet function as declared in vice\video.h:234
[ { "docid": "dbd62dddc5cd31a7409a65e5124c8661", "score": "0.78938675", "text": "func VideoCanvasPaletteSet(canvas []VideoCanvasS, palette []PaletteS) int32 {\n\tccanvas, _ := (*C.struct_video_canvas_s)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&canvas)).Data)), cgoAllocsUnknown\n\tcpalette, _ := (*C.struct_palette_s)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&palette)).Data)), cgoAllocsUnknown\n\t__ret := C.video_canvas_palette_set(ccanvas, cpalette)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" } ]
[ { "docid": "95bb4dae401413cfe9020f50102418b3", "score": "0.7939196", "text": "func VideoCanvasSetPalette(canvas []VideoCanvasS, palette []PaletteS) int32 {\n\tccanvas, _ := (*C.struct_video_canvas_s)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&canvas)).Data)), cgoAllocsUnknown\n\tcpalette, _ := (*C.struct_palette_s)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&palette)).Data)), cgoAllocsUnknown\n\t__ret := C.video_canvas_set_palette(ccanvas, cpalette)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "c5ffdab7fffbd7f0a3ad911053c6c8d7", "score": "0.6754619", "text": "func VideoColorUpdatePalette(canvas []VideoCanvasS) int32 {\n\tccanvas, _ := (*C.struct_video_canvas_s)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&canvas)).Data)), cgoAllocsUnknown\n\t__ret := C.video_color_update_palette(ccanvas)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "7b652194a462c075c561fcc04c903df9", "score": "0.664652", "text": "func (cons *VesaFbConsole) setPaletteColor(index uint8, rgba color.RGBA, replace bool) {\n\toldColor := cons.palette[index]\n\tcons.palette[index] = rgba\n\n\tswitch cons.bpp {\n\tcase 8:\n\t\t// Load palette entry to the DAC. Each DAC entry is a 6-bit value so\n\t\t// we need to scale the RGB values in the [0-63] range.\n\t\tportWriteByteFn(0x3c8, index)\n\t\tportWriteByteFn(0x3c9, rgba.R>>2)\n\t\tportWriteByteFn(0x3c9, rgba.G>>2)\n\t\tportWriteByteFn(0x3c9, rgba.B>>2)\n\tcase 15, 16:\n\t\tif oldColor == nil || !replace {\n\t\t\treturn\n\t\t}\n\n\t\tcons.replace16(oldColor.(color.RGBA), rgba)\n\tcase 24, 32:\n\t\tif oldColor == nil || !replace {\n\t\t\treturn\n\t\t}\n\n\t\tcons.replace24(oldColor.(color.RGBA), rgba)\n\t}\n}", "title": "" }, { "docid": "0da2c43db5b248939a0f41eddecb986b", "score": "0.65576255", "text": "func VideoColorPaletteInternal(canvas []VideoCanvasS, cbmPalette []VideoCbmPaletteS) {\n\tccanvas, _ := (*C.struct_video_canvas_s)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&canvas)).Data)), cgoAllocsUnknown\n\tccbmPalette, _ := unpackArgSVideoCbmPaletteS(cbmPalette)\n\tC.video_color_palette_internal(ccanvas, ccbmPalette)\n\tpackSVideoCbmPaletteS(cbmPalette, ccbmPalette)\n}", "title": "" }, { "docid": "5dfe7762b3b8c311ec4bff15d230524c", "score": "0.6330825", "text": "func (self *Bus) Debug_SetDebugPalette() {\n for i:=0 ; i<32; i++ {\n self.ppu.DebugSetPalette( i, i )\n }\n}", "title": "" }, { "docid": "e44f89b5850795153bb5e09e5ea987d4", "score": "0.59872365", "text": "func VideoColorPaletteFree(palette []PaletteS) {\n\tcpalette, _ := (*C.struct_palette_s)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&palette)).Data)), cgoAllocsUnknown\n\tC.video_color_palette_free(cpalette)\n}", "title": "" }, { "docid": "37bf959eead17cff25952651131a9bcc", "score": "0.58108854", "text": "func execmRGBASet(_ int, p *gop.Context) {\n\targs := p.GetArgs(4)\n\targs[0].(*image.RGBA).Set(args[1].(int), args[2].(int), args[3].(color.Color))\n}", "title": "" }, { "docid": "ce9d009cc6d34935d03dbf170dcb222e", "score": "0.5797684", "text": "func VideoCanvasCreateSet(canvas []VideoCanvasS) {\n\tccanvas, _ := (*C.struct_video_canvas_s)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&canvas)).Data)), cgoAllocsUnknown\n\tC.video_canvas_create_set(ccanvas)\n}", "title": "" }, { "docid": "ef926db48546013ef8c8d8650a1360ec", "score": "0.5728035", "text": "func (m *PrinterCapabilities) SetMediaColors(value []string)() {\n m.mediaColors = value\n}", "title": "" }, { "docid": "cc515c8a5ad94a7f68c6ed17ee315e43", "score": "0.57059747", "text": "func execmAlpha16Set(_ int, p *gop.Context) {\n\targs := p.GetArgs(4)\n\targs[0].(*image.Alpha16).Set(args[1].(int), args[2].(int), args[3].(color.Color))\n}", "title": "" }, { "docid": "0e1c558199307b8fcc14732a6bc47ceb", "score": "0.57049423", "text": "func execmPalettedSet(_ int, p *gop.Context) {\n\targs := p.GetArgs(4)\n\targs[0].(*image.Paletted).Set(args[1].(int), args[2].(int), args[3].(color.Color))\n}", "title": "" }, { "docid": "e98b9e47ccaecfbc522728d1b87cb6f4", "score": "0.5664041", "text": "func setPixel(x, y int, c rgba, pixels []byte) error {\n\tindex := (y*int(winWidth) + x) * 4\n\n\tif index < len(pixels) && index >= 0 {\n\t\tpixels[index] = c.r\n\t\tpixels[index+1] = c.g\n\t\tpixels[index+2] = c.b\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2305a433a8f3c1dcc24f7cf5a168dae6", "score": "0.56534", "text": "func (format *PixelFormat) SetPalette(palette *Palette) error {\n\tr := C.SDL_SetPixelFormatPalette((*C.SDL_PixelFormat)(unsafe.Pointer(format)),\n\t\t(*C.SDL_Palette)(unsafe.Pointer(palette)))\n\tif r != 0 {\n\t\treturn GetError()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "926acdba55e0bc876da71f7bedc177e3", "score": "0.5625335", "text": "func execmPalettedSetColorIndex(_ int, p *gop.Context) {\n\targs := p.GetArgs(4)\n\targs[0].(*image.Paletted).SetColorIndex(args[1].(int), args[2].(int), args[3].(uint8))\n}", "title": "" }, { "docid": "37dfaca3bdaa8dcda791d1776c4abdd5", "score": "0.5594662", "text": "func (surface *Surface) Set(x, y int, c color.Color) {\n\tpix := surface.Pixels()\n\ti := int32(y)*surface.Pitch + int32(x)*int32(surface.Format.BytesPerPixel)\n\tswitch surface.Format.Format {\n\tcase PIXELFORMAT_ARGB8888:\n\t\tcol := surface.ColorModel().Convert(c).(color.RGBA)\n\t\tpix[i+0] = col.B\n\t\tpix[i+1] = col.G\n\t\tpix[i+2] = col.R\n\t\tpix[i+3] = col.A\n\tcase PIXELFORMAT_ABGR8888:\n\t\tcol := surface.ColorModel().Convert(c).(color.RGBA)\n\t\tpix[i+3] = col.R\n\t\tpix[i+2] = col.G\n\t\tpix[i+1] = col.B\n\t\tpix[i+0] = col.A\n\tcase PIXELFORMAT_RGB24, PIXELFORMAT_RGB888:\n\t\tcol := surface.ColorModel().Convert(c).(color.RGBA)\n\t\tpix[i+0] = col.B\n\t\tpix[i+1] = col.G\n\t\tpix[i+2] = col.R\n\tcase PIXELFORMAT_BGR24, PIXELFORMAT_BGR888:\n\t\tcol := surface.ColorModel().Convert(c).(color.RGBA)\n\t\tpix[i+2] = col.R\n\t\tpix[i+1] = col.G\n\t\tpix[i+0] = col.B\n\tcase PIXELFORMAT_RGB444:\n\t\tcol := surface.ColorModel().Convert(c).(RGB444)\n\t\tbuf := (*uint32)(unsafe.Pointer(&pix[i]))\n\t\tr := uint32(col.R) >> 4 & 0x0F\n\t\tg := uint32(col.G) >> 4 & 0x0F\n\t\tb := uint32(col.B) >> 4 & 0x0F\n\t\t*buf = r<<8 | g<<4 | b\n\tcase PIXELFORMAT_RGB332:\n\t\tcol := surface.ColorModel().Convert(c).(RGB332)\n\t\tbuf := (*uint32)(unsafe.Pointer(&pix[i]))\n\t\tr := uint32(col.R) >> 5 & 0x0F\n\t\tg := uint32(col.G) >> 5 & 0x0F\n\t\tb := uint32(col.B) >> 6 & 0x0F\n\t\t*buf = r<<5 | g<<2 | b\n\tcase PIXELFORMAT_RGB565:\n\t\tcol := surface.ColorModel().Convert(c).(RGB565)\n\t\tbuf := (*uint32)(unsafe.Pointer(&pix[i]))\n\t\tr := uint32(col.R) >> 3 & 0xFF\n\t\tg := uint32(col.G) >> 2 & 0xFF\n\t\tb := uint32(col.B) >> 3 & 0xFF\n\t\t*buf = r<<11 | g<<5 | b\n\tcase PIXELFORMAT_RGB555:\n\t\tcol := surface.ColorModel().Convert(c).(RGB555)\n\t\tbuf := (*uint32)(unsafe.Pointer(&pix[i]))\n\t\tr := uint32(col.R) >> 3 & 0xFF\n\t\tg := uint32(col.G) >> 3 & 0xFF\n\t\tb := uint32(col.B) >> 3 & 0xFF\n\t\t*buf = r<<10 | g<<5 | b\n\tcase PIXELFORMAT_BGR565:\n\t\tcol := surface.ColorModel().Convert(c).(BGR565)\n\t\tbuf := (*uint32)(unsafe.Pointer(&pix[i]))\n\t\tr := uint32(col.R) >> 3 & 0xFF\n\t\tg := uint32(col.G) >> 2 & 0xFF\n\t\tb := uint32(col.B) >> 3 & 0xFF\n\t\t*buf = b<<11 | g<<5 | r\n\tcase PIXELFORMAT_BGR555:\n\t\tcol := surface.ColorModel().Convert(c).(BGR555)\n\t\tbuf := (*uint32)(unsafe.Pointer(&pix[i]))\n\t\tr := uint32(col.R) >> 3 & 0xFF\n\t\tg := uint32(col.G) >> 3 & 0xFF\n\t\tb := uint32(col.B) >> 3 & 0xFF\n\t\t*buf = b<<10 | g<<5 | r\n\tcase PIXELFORMAT_ARGB4444:\n\t\tcol := surface.ColorModel().Convert(c).(ARGB4444)\n\t\tbuf := (*uint32)(unsafe.Pointer(&pix[i]))\n\t\ta := uint32(col.A) >> 4 & 0x0F\n\t\tr := uint32(col.R) >> 4 & 0x0F\n\t\tg := uint32(col.G) >> 4 & 0x0F\n\t\tb := uint32(col.B) >> 4 & 0x0F\n\t\t*buf = a<<12 | r<<8 | g<<4 | b\n\tcase PIXELFORMAT_ABGR4444:\n\t\tcol := surface.ColorModel().Convert(c).(ABGR4444)\n\t\tbuf := (*uint32)(unsafe.Pointer(&pix[i]))\n\t\ta := uint32(col.A) >> 4 & 0x0F\n\t\tr := uint32(col.R) >> 4 & 0x0F\n\t\tg := uint32(col.G) >> 4 & 0x0F\n\t\tb := uint32(col.B) >> 4 & 0x0F\n\t\t*buf = a<<12 | b<<8 | g<<4 | r\n\tcase PIXELFORMAT_RGBA4444:\n\t\tcol := surface.ColorModel().Convert(c).(RGBA4444)\n\t\tbuf := (*uint32)(unsafe.Pointer(&pix[i]))\n\t\tr := uint32(col.R) >> 4 & 0x0F\n\t\tg := uint32(col.G) >> 4 & 0x0F\n\t\tb := uint32(col.B) >> 4 & 0x0F\n\t\ta := uint32(col.A) >> 4 & 0x0F\n\t\t*buf = r<<12 | g<<8 | b<<4 | a\n\tcase PIXELFORMAT_BGRA4444:\n\t\tcol := surface.ColorModel().Convert(c).(BGRA4444)\n\t\tbuf := (*uint32)(unsafe.Pointer(&pix[i]))\n\t\tr := uint32(col.R) >> 4 & 0x0F\n\t\tg := uint32(col.G) >> 4 & 0x0F\n\t\tb := uint32(col.B) >> 4 & 0x0F\n\t\ta := uint32(col.A) >> 4 & 0x0F\n\t\t*buf = b<<12 | g<<8 | r<<4 | a\n\tcase PIXELFORMAT_ARGB1555:\n\t\tcol := surface.ColorModel().Convert(c).(ARGB1555)\n\t\tbuf := (*uint32)(unsafe.Pointer(&pix[i]))\n\t\tr := uint32(col.R) >> 3 & 0xFF\n\t\tg := uint32(col.G) >> 3 & 0xFF\n\t\tb := uint32(col.B) >> 3 & 0xFF\n\t\ta := uint32(0)\n\t\tif col.A > 0 {\n\t\t\ta = 1\n\t\t}\n\t\t*buf = a<<15 | r<<10 | g<<5 | b\n\tcase PIXELFORMAT_RGBA5551:\n\t\tcol := surface.ColorModel().Convert(c).(RGBA5551)\n\t\tbuf := (*uint32)(unsafe.Pointer(&pix[i]))\n\t\tr := uint32(col.R) >> 3 & 0xFF\n\t\tg := uint32(col.G) >> 3 & 0xFF\n\t\tb := uint32(col.B) >> 3 & 0xFF\n\t\ta := uint32(0)\n\t\tif col.A > 0 {\n\t\t\ta = 1\n\t\t}\n\t\t*buf = r<<11 | g<<6 | b<<1 | a\n\tcase PIXELFORMAT_ABGR1555:\n\t\tcol := surface.ColorModel().Convert(c).(ABGR1555)\n\t\tbuf := (*uint32)(unsafe.Pointer(&pix[i]))\n\t\tr := uint32(col.R) >> 3 & 0xFF\n\t\tg := uint32(col.G) >> 3 & 0xFF\n\t\tb := uint32(col.B) >> 3 & 0xFF\n\t\ta := uint32(0)\n\t\tif col.A > 0 {\n\t\t\ta = 1\n\t\t}\n\t\t*buf = a<<15 | b<<10 | g<<5 | r\n\tcase PIXELFORMAT_BGRA5551:\n\t\tcol := surface.ColorModel().Convert(c).(BGRA5551)\n\t\tbuf := (*uint32)(unsafe.Pointer(&pix[i]))\n\t\tr := uint32(col.R) >> 3 & 0xFF\n\t\tg := uint32(col.G) >> 3 & 0xFF\n\t\tb := uint32(col.B) >> 3 & 0xFF\n\t\ta := uint32(0)\n\t\tif col.A > 0 {\n\t\t\ta = 1\n\t\t}\n\t\t*buf = b<<11 | g<<6 | r<<1 | a\n\tcase PIXELFORMAT_RGBA8888:\n\t\tcol := surface.ColorModel().Convert(c).(RGBA8888)\n\t\tpix[i+3] = col.R\n\t\tpix[i+2] = col.G\n\t\tpix[i+1] = col.B\n\t\tpix[i+0] = col.A\n\tcase PIXELFORMAT_BGRA8888:\n\t\tcol := surface.ColorModel().Convert(c).(color.RGBA)\n\t\tpix[i+3] = col.B\n\t\tpix[i+2] = col.G\n\t\tpix[i+1] = col.R\n\t\tpix[i+0] = col.A\n\tdefault:\n\t\tpanic(\"Unknown pixel format!\")\n\t}\n}", "title": "" }, { "docid": "6e5befa32be10f339f20f8db2982d182", "score": "0.5535381", "text": "func (surface *Surface) SetPalette(palette *Palette) error {\n\tif C.SDL_SetSurfacePalette(surface.cptr(), palette.cptr()) != 0 {\n\t\treturn GetError()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b5b4648f37608bdc96d238e5eed88662", "score": "0.5510745", "text": "func (palette *Palette) SetColors(colors []Color) error {\n\tif colors == nil {\n\t\treturn nil\n\t}\n\tvar ptr *C.SDL_Color\n\tif len(colors) > 0 {\n\t\tptr = (*C.SDL_Color)(unsafe.Pointer(&colors[0]))\n\t}\n\n\tr := C.SDL_SetPaletteColors((*C.SDL_Palette)(unsafe.Pointer(palette)),\n\t\tptr, 0, C.int(len(colors)))\n\tif r != 0 {\n\t\treturn GetError()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f61a1df4d33c8249cc0e6a9d38543eca", "score": "0.5484552", "text": "func VideoRenderSetphysicalcolor(config []VideoRenderConfig, index int32, color uint32, depth int32) {\n\tcconfig, _ := unpackArgSVideoRenderConfig(config)\n\tcindex, _ := (C.int)(index), cgoAllocsUnknown\n\tccolor, _ := (C.DWORD)(color), cgoAllocsUnknown\n\tcdepth, _ := (C.int)(depth), cgoAllocsUnknown\n\tC.video_render_setphysicalcolor(cconfig, cindex, ccolor, cdepth)\n\tpackSVideoRenderConfig(config, cconfig)\n}", "title": "" }, { "docid": "febf76daef2bf59b1878cc951376665a", "score": "0.5479431", "text": "func (cons *VesaFbConsole) SetPaletteColor(index uint8, rgba color.RGBA) {\n\toldColor := cons.palette[index]\n\n\tif oldColor != nil && oldColor.(color.RGBA) == rgba {\n\t\treturn\n\t}\n\n\tcons.setPaletteColor(index, rgba, true)\n}", "title": "" }, { "docid": "a42732f83afc4b99aee37cb0fa4b6e0f", "score": "0.53572327", "text": "func (d *rgbDraw) Set(x, y int, c color.Color) {\n\tw := d.Rect.Max.X // width\n\n\ti := 3 * (y*w + x) // array index from (x,y)\n\n\tr, g, b, _ := c.RGBA() // alpha-scaled, need to reduce by 255\n\n\td.Pix[i] = byte(r >> 8)\n\td.Pix[i+1] = byte(g >> 8)\n\td.Pix[i+2] = byte(b >> 8)\n}", "title": "" }, { "docid": "ecc4801667ff5b85bb0933b18824eb9d", "score": "0.5337649", "text": "func execmRGBASetRGBA(_ int, p *gop.Context) {\n\targs := p.GetArgs(4)\n\targs[0].(*image.RGBA).SetRGBA(args[1].(int), args[2].(int), args[3].(color.RGBA))\n}", "title": "" }, { "docid": "a93ab38bfee0f224c4d7923c33507812", "score": "0.5316088", "text": "func SetPalette(palette color.Palette) {\n\tColorPalette = palette\n\tSetScreenFilter(mod.ConformToPallete(ColorPalette))\n}", "title": "" }, { "docid": "e5dd47a72128ab0498cf8d068b48bad4", "score": "0.5297183", "text": "func VideoRenderSetrawrgb(index uint32, r uint32, g uint32, b uint32) {\n\tcindex, _ := (C.uint)(index), cgoAllocsUnknown\n\tcr, _ := (C.DWORD)(r), cgoAllocsUnknown\n\tcg, _ := (C.DWORD)(g), cgoAllocsUnknown\n\tcb, _ := (C.DWORD)(b), cgoAllocsUnknown\n\tC.video_render_setrawrgb(cindex, cr, cg, cb)\n}", "title": "" }, { "docid": "1649406e19b34d9f4f605e06d0e34ea1", "score": "0.5295954", "text": "func setColorGamma(gammar, gammag, gammab float64) {\n\tdpy := C.XOpenDisplay(nil)\n\tscreenCount := C.screenCount(dpy)\n\tfor screen := C.int(0); screen < screenCount; screen++ {\n\t\troot := C.RootWindowMacro(dpy, screen)\n\n\t\tres := C.XRRGetScreenResourcesCurrent(dpy, root)\n\n\t\tfor c := C.int(0); c < res.ncrtc; c++ {\n\t\t\tcrtcxid := C.crtcxid(res.crtcs, c)\n\n\t\t\tsize := C.XRRGetCrtcGammaSize(dpy, crtcxid)\n\t\t\tcrtc_gamma := C.XRRAllocGamma(size)\n\t\t\tfor i := C.int(0); i < size; i++ {\n\t\t\t\tg := 65535.0 * float64(i) / float64(size)\n\t\t\t\tC.ushortSet(C.ushortCast(unsafe.Pointer(crtc_gamma.red)), i, C.double(g*gammar))\n\t\t\t\tC.ushortSet(C.ushortCast(unsafe.Pointer(crtc_gamma.green)), i, C.double(g*gammag))\n\t\t\t\tC.ushortSet(C.ushortCast(unsafe.Pointer(crtc_gamma.blue)), i, C.double(g*gammab))\n\t\t\t}\n\t\t\tC.XRRSetCrtcGamma(dpy, crtcxid, crtc_gamma)\n\t\t\tC.XFree(unsafe.Pointer(crtc_gamma))\n\t\t}\n\n\t\tC.XFree(unsafe.Pointer(res))\n\t}\n\tC.XCloseDisplay(dpy)\n}", "title": "" }, { "docid": "5bd2917bc96b14936eee284dae170e3c", "score": "0.5293436", "text": "func Palette(num int, a ...interface{}) {\n\tPrintEmo(num, \"🎨\", a...)\n}", "title": "" }, { "docid": "cf2e6e1e5d6ab03c0fba64ddb516750e", "score": "0.52781767", "text": "func (h *JHD1313M1Driver) SetRGB(r, g, b int) error {\n\tif err := h.setReg(REG_RED, r); err != nil {\n\t\treturn err\n\t}\n\tif err := h.setReg(REG_GREEN, g); err != nil {\n\t\treturn err\n\t}\n\treturn h.setReg(REG_BLUE, b)\n}", "title": "" }, { "docid": "946a6aeaf5dbac551adf96c7f0fc1102", "score": "0.52270263", "text": "func execmNRGBASet(_ int, p *gop.Context) {\n\targs := p.GetArgs(4)\n\targs[0].(*image.NRGBA).Set(args[1].(int), args[2].(int), args[3].(color.Color))\n}", "title": "" }, { "docid": "3af702b3644950169b0e19b0b5de7611", "score": "0.5191431", "text": "func (p *pixelBuffer) pSetWithColor(x0, y0 int, colorID ColorID) {\n\tp.setFGColor(colorID)\n\tp.pixelSurface.Set(x0, y0, p.palette.GetColor(colorID))\n}", "title": "" }, { "docid": "f7a2e1cf206d8d79a7d38c095b5b0aa0", "score": "0.5182694", "text": "func (client *RenderingControl1) SetRedVideoBlackLevel(InstanceID uint32, DesiredRedVideoBlackLevel uint16) (err error) {\n\treturn client.SetRedVideoBlackLevelCtx(context.Background(),\n\t\tInstanceID,\n\t\tDesiredRedVideoBlackLevel,\n\t)\n}", "title": "" }, { "docid": "0aff833c650bd8525bc571f1abb42f5a", "score": "0.5170641", "text": "func Set(dst draw.Image, x, y int, c color.Color) {\n\tdst.Set(x, y, c)\n}", "title": "" }, { "docid": "785fe7b61331c71a4b50f20256009611", "score": "0.5168263", "text": "func (m *PrinterDefaults) SetMediaColor(value *string)() {\n m.mediaColor = value\n}", "title": "" }, { "docid": "90612c82274efac69daaf32a6922186b", "score": "0.5165161", "text": "func (client *RenderingControl2) SetRedVideoBlackLevel(InstanceID uint32, DesiredRedVideoBlackLevel uint16) (err error) {\n\treturn client.SetRedVideoBlackLevelCtx(context.Background(),\n\t\tInstanceID,\n\t\tDesiredRedVideoBlackLevel,\n\t)\n}", "title": "" }, { "docid": "b37eafecac8ba70aaaa3d7095197b64b", "score": "0.5164479", "text": "func (q *QPalette) SetColorGroup(cr QPalette_ColorGroup, windowText *QBrush, button *QBrush, light *QBrush, dark *QBrush, mid *QBrush, text *QBrush, bright_text *QBrush, base *QBrush, window *QBrush) {\r\n\tq.Drv(92000, 92140, unsafe.Pointer(&cr), Native(windowText), Native(button), Native(light), Native(dark), Native(mid), Native(text), Native(bright_text), Native(base), Native(window), nil, nil)\r\n}", "title": "" }, { "docid": "1f0df12bea4b6697b5e0c38c51242677", "score": "0.51494634", "text": "func execmCMYKSet(_ int, p *gop.Context) {\n\targs := p.GetArgs(4)\n\targs[0].(*image.CMYK).Set(args[1].(int), args[2].(int), args[3].(color.Color))\n}", "title": "" }, { "docid": "44820fb6088da842d9916fada62c3ed5", "score": "0.51425797", "text": "func execmRGBA64Set(_ int, p *gop.Context) {\n\targs := p.GetArgs(4)\n\targs[0].(*image.RGBA64).Set(args[1].(int), args[2].(int), args[3].(color.Color))\n}", "title": "" }, { "docid": "bc7e18a29bb666c15dc85a33f9d7ba6e", "score": "0.5134835", "text": "func (surface *Surface) SetColorMod(r, g, b uint8) error {\n\tif C.SDL_SetSurfaceColorMod(surface.cptr(), C.Uint8(r), C.Uint8(g), C.Uint8(b)) != 0 {\n\t\treturn GetError()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6144c568c0159ea9e8aad6a7a5a504a8", "score": "0.5134771", "text": "func (cons *VesaFbConsole) Palette() color.Palette {\n\treturn cons.palette\n}", "title": "" }, { "docid": "dd7309060841e6c919303aa8eb8d74c8", "score": "0.51040936", "text": "func (client *RenderingControl2) SetRedVideoGain(InstanceID uint32, DesiredRedVideoGain uint16) (err error) {\n\treturn client.SetRedVideoGainCtx(context.Background(),\n\t\tInstanceID,\n\t\tDesiredRedVideoGain,\n\t)\n}", "title": "" }, { "docid": "fa4d730cedbe5e13c97d457631f0a6fe", "score": "0.5089539", "text": "func (p *pixelBuffer) PSet(x, y int, colorID ...ColorID) {\n\tif len(colorID) == 0 {\n\t\tp.pSetWithColor(x, y, p.fgColor)\n\t} else {\n\t\tp.pSetWithColor(x, y, colorID[0])\n\t}\n}", "title": "" }, { "docid": "67e8c384f01491bb6cc7ff220467d67c", "score": "0.5088875", "text": "func (m *IntuneBrand) SetThemeColor(value RgbColorable)() {\n m.themeColor = value\n}", "title": "" }, { "docid": "520a79e4adfce5f72d5168cdefdcf2f1", "score": "0.5047791", "text": "func (client *RenderingControl1) SetRedVideoGain(InstanceID uint32, DesiredRedVideoGain uint16) (err error) {\n\treturn client.SetRedVideoGainCtx(context.Background(),\n\t\tInstanceID,\n\t\tDesiredRedVideoGain,\n\t)\n}", "title": "" }, { "docid": "5996ac30810dbafea9fc556e16b5ad9d", "score": "0.5046002", "text": "func execmAlpha16SetAlpha16(_ int, p *gop.Context) {\n\targs := p.GetArgs(4)\n\targs[0].(*image.Alpha16).SetAlpha16(args[1].(int), args[2].(int), args[3].(color.Alpha16))\n}", "title": "" }, { "docid": "fdb934857c2e4d0e41f08a7027ae631d", "score": "0.5022811", "text": "func (m *PrinterCapabilities) SetColorModes(value []PrintColorMode)() {\n m.colorModes = value\n}", "title": "" }, { "docid": "fe996a401ec047f318b8d2c4589a9df4", "score": "0.5000263", "text": "func (p *pixelBuffer) PSet(x, y int) {\n\tp.PSetWithColor(x, y, p.fgColor)\n}", "title": "" }, { "docid": "8076b323c7c8b296fc5b7e26b767352d", "score": "0.49798244", "text": "func (surface *Surface) SetColorKey(flag bool, key uint32) error {\n\tif C.SDL_SetColorKey(surface.cptr(), C.int(Btoi(flag)), C.Uint32(key)) != 0 {\n\t\treturn GetError()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "cb4b7df43e6bc751ab158166253cf267", "score": "0.49770787", "text": "func (c *Color) Set(r, g, b, a float32) {\n\tc[0] = r\n\tc[1] = g\n\tc[2] = b\n\tc[3] = a\n}", "title": "" }, { "docid": "637faecf2d596e44d017b6e646db389f", "score": "0.49273735", "text": "func SetColor(foreground int8, background int8) {\n\tstdout := GetStdOut()\n\twSetConsoleTextAttribute.Call(stdout, uintptr(foreground|(background<<4)))\n}", "title": "" }, { "docid": "9ee19aa535cfa1645fcff9a5b5ad0b6b", "score": "0.49009752", "text": "func (recv *ColorSelection) SetHasPalette(hasPalette bool) {\n\tc_has_palette :=\n\t\tboolToGboolean(hasPalette)\n\n\tC.gtk_color_selection_set_has_palette((*C.GtkColorSelection)(recv.native), c_has_palette)\n\n\treturn\n}", "title": "" }, { "docid": "13a129843e1136e5131a773f0a4b2f6c", "score": "0.4890223", "text": "func (client *RenderingControl2) SetBlueVideoGain(InstanceID uint32, DesiredBlueVideoGain uint16) (err error) {\n\treturn client.SetBlueVideoGainCtx(context.Background(),\n\t\tInstanceID,\n\t\tDesiredBlueVideoGain,\n\t)\n}", "title": "" }, { "docid": "b1436948ba08660aa5b782b97c280c29", "score": "0.4889904", "text": "func shareSetColor() {\n\t// Additional command speific theme customization.\n\tconsole.SetColor(\"URL\", color.New(color.Bold))\n\tconsole.SetColor(\"Expire\", color.New(color.FgCyan))\n\tconsole.SetColor(\"Content-type\", color.New(color.FgBlue))\n\tconsole.SetColor(\"Share\", color.New(color.FgGreen))\n\tconsole.SetColor(\"File\", color.New(color.FgRed, color.Bold))\n}", "title": "" }, { "docid": "f6598421c0ec77922507afcf6973cd84", "score": "0.488791", "text": "func (b *Tiled) addTileColoursToPalette(tile *imageTile) {\n\tfor k, v := range tile.palette {\n\t\tif _, found := b.palette[k]; !found {\n\t\t\tb.palette[k] = v\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f7755ef7ac05364cce536916741b1b47", "score": "0.4887653", "text": "func (cv Canvas) SetHue(factor float64) (bool) {\n\n factor = math.Max(-1, factor)\n factor = math.Min(1, factor)\n\n status := C.MagickModulateImage(cv.wand, C.double(100), C.double(100), C.double(100 + factor*100.0))\n \n if status == C.MagickFalse {\n return false\n }\n\n return true\n}", "title": "" }, { "docid": "021f7752e9628bb5523b776346714b78", "score": "0.4886107", "text": "func execmGray16Set(_ int, p *gop.Context) {\n\targs := p.GetArgs(4)\n\targs[0].(*image.Gray16).Set(args[1].(int), args[2].(int), args[3].(color.Color))\n}", "title": "" }, { "docid": "b7e4519e1e598c682e8198d2175cf703", "score": "0.48822573", "text": "func Palette(p Params) []HexColor {\n\ti := imt.UnpackImage(p.Img)\n\tpixel_count := i.Width * i.Height\n\tvar validPixels []imt.Color\n\n\tfor x := 0; x < pixel_count; x += p.Quality {\n\t\tr, g, b, a := i.Pixels[x].RGBA()\n\t\t// If pixel is mostly opaque and not white\n\t\tif a > 125 {\n\t\t\tif !(r > 250 && g > 250 && b > 250) {\n\t\t\t\tvalidPixels = append(validPixels, imt.Color{R: r, G: g, B: b, A: a})\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "7c298d77df1f7ab44861afe700ef2f0f", "score": "0.48821694", "text": "func execmAlphaSet(_ int, p *gop.Context) {\n\targs := p.GetArgs(4)\n\targs[0].(*image.Alpha).Set(args[1].(int), args[2].(int), args[3].(color.Color))\n}", "title": "" }, { "docid": "c7e6e7b64501aedde5e8655244ee378e", "score": "0.488126", "text": "func (led *LED) SetRGB(r, g, b byte) (int, []byte, error) {\n\tframe := Frame{\n\t\tAddr: led.Addr,\n\t\tCmd: SET_RGB_LEVELS,\n\t\tCmdArgs: []byte{r, g, b},\n\t}\n\treturn led.write(frame)\n}", "title": "" }, { "docid": "c3c12e16fa60e5b79c989f34084ea08f", "score": "0.48792276", "text": "func (client *RenderingControl1) SetBlueVideoGain(InstanceID uint32, DesiredBlueVideoGain uint16) (err error) {\n\treturn client.SetBlueVideoGainCtx(context.Background(),\n\t\tInstanceID,\n\t\tDesiredBlueVideoGain,\n\t)\n}", "title": "" }, { "docid": "6104a912fce0d7d909e976e8bb163ea1", "score": "0.48735377", "text": "func (client *RenderingControl1) SetRedVideoBlackLevelCtx(\n\tctx context.Context,\n\tInstanceID uint32,\n\tDesiredRedVideoBlackLevel uint16,\n) (err error) {\n\t// Request structure.\n\trequest := &struct {\n\t\tInstanceID string\n\t\tDesiredRedVideoBlackLevel string\n\t}{}\n\t// BEGIN Marshal arguments into request.\n\n\tif request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil {\n\t\treturn\n\t}\n\tif request.DesiredRedVideoBlackLevel, err = soap.MarshalUi2(DesiredRedVideoBlackLevel); err != nil {\n\t\treturn\n\t}\n\t// END Marshal arguments into request.\n\n\t// Response structure.\n\tresponse := interface{}(nil)\n\n\t// Perform the SOAP call.\n\tif err = client.SOAPClient.PerformActionCtx(ctx, URN_RenderingControl_1, \"SetRedVideoBlackLevel\", request, response); err != nil {\n\t\treturn\n\t}\n\n\t// BEGIN Unmarshal arguments from response.\n\n\t// END Unmarshal arguments from response.\n\treturn\n}", "title": "" }, { "docid": "def32d304ef51dc6891bcc6a590c6d84", "score": "0.48728538", "text": "func VideoRenderPalInit() {\n\tC.video_render_pal_init()\n}", "title": "" }, { "docid": "54baaa7f3e5b25eb64e443228a082187", "score": "0.48593047", "text": "func (client *RenderingControl2) SetRedVideoBlackLevelCtx(\n\tctx context.Context,\n\tInstanceID uint32,\n\tDesiredRedVideoBlackLevel uint16,\n) (err error) {\n\t// Request structure.\n\trequest := &struct {\n\t\tInstanceID string\n\t\tDesiredRedVideoBlackLevel string\n\t}{}\n\t// BEGIN Marshal arguments into request.\n\n\tif request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil {\n\t\treturn\n\t}\n\tif request.DesiredRedVideoBlackLevel, err = soap.MarshalUi2(DesiredRedVideoBlackLevel); err != nil {\n\t\treturn\n\t}\n\t// END Marshal arguments into request.\n\n\t// Response structure.\n\tresponse := interface{}(nil)\n\n\t// Perform the SOAP call.\n\tif err = client.SOAPClient.PerformActionCtx(ctx, URN_RenderingControl_2, \"SetRedVideoBlackLevel\", request, response); err != nil {\n\t\treturn\n\t}\n\n\t// BEGIN Unmarshal arguments from response.\n\n\t// END Unmarshal arguments from response.\n\treturn\n}", "title": "" }, { "docid": "448345974aa6589dc4a00023cbfdcc02", "score": "0.4859102", "text": "func (self *WindowController) SetR(x, y, w, h int, fg, bg Blender, data string, rest ...interface{}) {\n self.console.SetR(x, y, w, h, fg, bg, data, rest...)\n}", "title": "" }, { "docid": "32694e4628429136b3dc8333a29422ff", "score": "0.48537603", "text": "func (m *PrinterCapabilities) SetIsColorPrintingSupported(value *bool)() {\n m.isColorPrintingSupported = value\n}", "title": "" }, { "docid": "f95ca1974aa480e40803726eef5121b5", "score": "0.48376638", "text": "func (hub *hub75) SetRgb(r1, g1, b1, r2, g2, b2 bool) {\n\tvar data uint32\n\tif r1 {\n\t\tdata |= hub.maskR1\n\t}\n\tif g1 {\n\t\tdata |= hub.maskG1\n\t}\n\tif b1 {\n\t\tdata |= hub.maskB1\n\t}\n\tif r2 {\n\t\tdata |= hub.maskR2\n\t}\n\tif g2 {\n\t\tdata |= hub.maskG2\n\t}\n\tif b2 {\n\t\tdata |= hub.maskB2\n\t}\n\thub.SetRgbMask(data)\n}", "title": "" }, { "docid": "9f4067d66f7a58e764cb4148f26818db", "score": "0.48305705", "text": "func (client *RenderingControl1) SetBlueVideoBlackLevel(InstanceID uint32, DesiredBlueVideoBlackLevel uint16) (err error) {\n\treturn client.SetBlueVideoBlackLevelCtx(context.Background(),\n\t\tInstanceID,\n\t\tDesiredBlueVideoBlackLevel,\n\t)\n}", "title": "" }, { "docid": "8be5daef0932f0ddd2242581d4ce9051", "score": "0.48237878", "text": "func PaletteColor(index int) Color {\n\treturn Color(index) | ColorValid\n}", "title": "" }, { "docid": "538b20b7687120c167db20368797dbc7", "score": "0.48234594", "text": "func VideoCanvasShutdown(canvas []VideoCanvasS) {\n\tccanvas, _ := (*C.struct_video_canvas_s)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&canvas)).Data)), cgoAllocsUnknown\n\tC.video_canvas_shutdown(ccanvas)\n}", "title": "" }, { "docid": "e91afaa7f0bbc1458ab6e24e65d2217f", "score": "0.48169926", "text": "func VideoCanvasMap(canvas []VideoCanvasS) {\n\tccanvas, _ := (*C.struct_video_canvas_s)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&canvas)).Data)), cgoAllocsUnknown\n\tC.video_canvas_map(ccanvas)\n}", "title": "" }, { "docid": "2ec92c012ff098c0ab96acfae31fbbfe", "score": "0.4814957", "text": "func (gdt *PoolColorArray) Set(\n\tp_idx int32 /* else case */, p_data Color, /* godot_color */\n) {\n\n\t/* go_godot_pool_color_array_set(API_STRUCT,godot_int, *godot_color) ->void */\n\n\tapi := CoreApi\n\trcv := (*C.godot_pool_color_array)(unsafe.Pointer(gdt))\n\tin0 := *(*C.godot_int)(unsafe.Pointer(&p_idx))\n\tin1 := (*C.godot_color)(unsafe.Pointer(&p_data))\n\n\tC.go_godot_pool_color_array_set(\n\t\tapi,\n\t\trcv,\n\t\tin0,\n\t\tin1,\n\t)\n\truntime.KeepAlive(in0)\n\truntime.KeepAlive(in1)\n}", "title": "" }, { "docid": "42cf401841675d6bae3afb0c012dc80f", "score": "0.48108774", "text": "func (client *RenderingControl2) SetBlueVideoBlackLevel(InstanceID uint32, DesiredBlueVideoBlackLevel uint16) (err error) {\n\treturn client.SetBlueVideoBlackLevelCtx(context.Background(),\n\t\tInstanceID,\n\t\tDesiredBlueVideoBlackLevel,\n\t)\n}", "title": "" }, { "docid": "51e5fc1772b0ba3c118ab6a3b1f1e231", "score": "0.48104212", "text": "func (self *CanvasTinter) TintPerPixel(texture *Texture, color int, canvas *dom.HTMLCanvasElement) {\n self.Object.Call(\"tintPerPixel\", texture, color, canvas)\n}", "title": "" }, { "docid": "824c68bba475044e2e0fdff1d41f50a8", "score": "0.48074937", "text": "func VideoCanvasInit() *VideoCanvasS {\n\t__ret := C.video_canvas_init()\n\t__v := *(**VideoCanvasS)(unsafe.Pointer(&__ret))\n\treturn __v\n}", "title": "" }, { "docid": "97293fc007d86b009b866a652e5b3998", "score": "0.4806318", "text": "func (e Emulator) SetPixel(x, y, r, g, b int) error {\n\tints := []int{x, y, r, g, b}\n\n\tconn, err := e.dial()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer conn.Close()\n\n\tbuff := new(bytes.Buffer)\n\n\terr = buff.WriteByte(2)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, i := range ints {\n\t\terr = binary.Write(buff, binary.BigEndian, int32(i))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t_, err = conn.Write(buff.Bytes())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "0404906e5c83bf03908c967d7c48b084", "score": "0.48041832", "text": "func VideoCanvasRender(canvas []VideoCanvasS, trg []byte, width int32, height int32, xs int32, ys int32, xt int32, yt int32, pitcht int32, depth int32) {\n\tccanvas, _ := (*C.struct_video_canvas_s)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&canvas)).Data)), cgoAllocsUnknown\n\tctrg, _ := (*C.uchar)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&trg)).Data)), cgoAllocsUnknown\n\tcwidth, _ := (C.int)(width), cgoAllocsUnknown\n\tcheight, _ := (C.int)(height), cgoAllocsUnknown\n\tcxs, _ := (C.int)(xs), cgoAllocsUnknown\n\tcys, _ := (C.int)(ys), cgoAllocsUnknown\n\tcxt, _ := (C.int)(xt), cgoAllocsUnknown\n\tcyt, _ := (C.int)(yt), cgoAllocsUnknown\n\tcpitcht, _ := (C.int)(pitcht), cgoAllocsUnknown\n\tcdepth, _ := (C.int)(depth), cgoAllocsUnknown\n\tC.video_canvas_render(ccanvas, ctrg, cwidth, cheight, cxs, cys, cxt, cyt, cpitcht, cdepth)\n}", "title": "" }, { "docid": "e17a0e719aacd711c7ced9e939485e7f", "score": "0.47926658", "text": "func TestSets(t *testing.T) {\n\tfor idx, sp := range color.Prototypes {\n\t\tr := sp.Handler(sp.ANSIStyles)\n\t\ttp := reflect.TypeOf(r).String()\n\t\texpected := \"[]string\"\n\t\tif tp != expected {\n\t\t\tt.Errorf(\"returned incorrect type for idx %v, expected: %v, given: %v\", idx, expected, tp)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "abd6ab769d3a77c9d6eaf9055da5b78c", "score": "0.47902724", "text": "func InitColors(num int) bool {\n\t// Primary 3 bit colors\n\tfor i := 0; i <= 6; i++ {\n\t\tColors[i] = newColorFromBitmap(uint8(i), 128)\n\t}\n\tColors[7] = newColor(192, 192, 192)\n\tif num == 8 {\n\t\treturn true\n\t}\n\n\t// Bright version of primary colors\n\tColors[8] = newColor(128, 128, 128)\n\tfor i := 9; i <= 15; i++ {\n\t\tColors[i] = newColorFromBitmap(uint8(i-8), 255)\n\t}\n\tif num == 16 {\n\t\treturn true\n\t}\n\n\t// Other colors\n\tpattern := []uint8{0, 95, 135, 175, 215, 255}\n\ti := 16\n\tfor r := 0; r < len(pattern); r++ {\n\t\tfor g := 0; g < len(pattern); g++ {\n\t\t\tfor b := 0; b < len(pattern); b++ {\n\t\t\t\tColors[i] = newColor(pattern[r], pattern[g], pattern[b])\n\t\t\t\ti++\n\t\t\t}\n\t\t}\n\t}\n\n\t// Remaining grays\n\tfor i := 232; i <= 255; i++ {\n\t\tc := uint8((i-232)*10 + 8)\n\t\tColors[i] = newColor(c, c, c)\n\t}\n\n\treturn num == 256\n}", "title": "" }, { "docid": "674a2df887bb8527ea6cf967c4b07e6f", "score": "0.4776585", "text": "func ChromeAlternateVideoDecoder() testing.Precondition { return chromeAlternateVideoDecoderPre }", "title": "" }, { "docid": "906ec12c62d30ad0017e59d4bdc063ea", "score": "0.47751847", "text": "func (c *Debugger) SetBlackboxPatterns(patterns []string) (*gcdmessage.ChromeResponse, error) {\n\tparamRequest := make(map[string]interface{}, 1)\n\tparamRequest[\"patterns\"] = patterns\n\treturn gcdmessage.SendDefaultRequest(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: \"Debugger.setBlackboxPatterns\", Params: paramRequest})\n}", "title": "" }, { "docid": "e461d74bef5f73c66b8abfe4c84e9e92", "score": "0.47720963", "text": "func (cons *VesaFbConsole) replace24(src, dst color.RGBA) {\n\ttmp := cons.palette[0]\n\tcons.palette[0] = src\n\tsrcComp := cons.packColor24(0)\n\tcons.palette[0] = dst\n\tdstComp := cons.packColor24(0)\n\tcons.palette[0] = tmp\n\tfor fbOffset := cons.fbOffset(0, 0); fbOffset < uint32(len(cons.fb)); fbOffset += cons.bytesPerPixel {\n\t\tif cons.fb[fbOffset] == srcComp[0] &&\n\t\t\tcons.fb[fbOffset+1] == srcComp[1] &&\n\t\t\tcons.fb[fbOffset+2] == srcComp[2] {\n\t\t\tcons.fb[fbOffset] = dstComp[0]\n\t\t\tcons.fb[fbOffset+1] = dstComp[1]\n\t\t\tcons.fb[fbOffset+2] = dstComp[2]\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f2458b32c6a09ba38d5da923d0d064d5", "score": "0.47595835", "text": "func (client *RenderingControl1) SetBlueVideoBlackLevelCtx(\n\tctx context.Context,\n\tInstanceID uint32,\n\tDesiredBlueVideoBlackLevel uint16,\n) (err error) {\n\t// Request structure.\n\trequest := &struct {\n\t\tInstanceID string\n\t\tDesiredBlueVideoBlackLevel string\n\t}{}\n\t// BEGIN Marshal arguments into request.\n\n\tif request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil {\n\t\treturn\n\t}\n\tif request.DesiredBlueVideoBlackLevel, err = soap.MarshalUi2(DesiredBlueVideoBlackLevel); err != nil {\n\t\treturn\n\t}\n\t// END Marshal arguments into request.\n\n\t// Response structure.\n\tresponse := interface{}(nil)\n\n\t// Perform the SOAP call.\n\tif err = client.SOAPClient.PerformActionCtx(ctx, URN_RenderingControl_1, \"SetBlueVideoBlackLevel\", request, response); err != nil {\n\t\treturn\n\t}\n\n\t// BEGIN Unmarshal arguments from response.\n\n\t// END Unmarshal arguments from response.\n\treturn\n}", "title": "" }, { "docid": "aaf1c65c9d30b3e997d12e6e2d6b33c9", "score": "0.47583327", "text": "func (m *PrinterDefaults) SetColorMode(value *PrintColorMode)() {\n m.colorMode = value\n}", "title": "" }, { "docid": "234845dcca4e1b73970049cc213b447e", "score": "0.4755952", "text": "func (p *pixelBuffer) PSetWithColor(x0, y0 int, colorID Color) {\n\tp.fgColor = colorID\n\trgba, _ := p.palette.GetRGBA(p.fgColor)\n\tp.renderer.SetDrawColor(rgba.R, rgba.G, rgba.B, rgba.A)\n\tp.renderer.DrawPoint(x0, y0)\n}", "title": "" }, { "docid": "83a9ff7fb55d542270ac36cb0d1ab9db", "score": "0.47502205", "text": "func (pix PixelData) Set(x, y int, c color.Color) {\n\tformat := pix.s.format\n\tswitch format.BytesPerPixel {\n\tcase 4:\n\t\tcol := pix.ColorModel().Convert(c).(color.NRGBA)\n\n\t\tp := (*uint32)(pix.pixel(x, y))\n\t\t*p = collapseColor(col.R, format.Rshift, format.Rloss)\n\t\t*p |= collapseColor(col.G, format.Gshift, format.Gloss)\n\t\t*p |= collapseColor(col.B, format.Bshift, format.Bloss)\n\t\tif format.Amask == 0 {\n\t\t\t// If the alpha mask is 0, there's no alpha component, so set it opaque.\n\t\t\tcol.A = ^uint8(0)\n\t\t}\n\t\t*p |= collapseColor(col.A, format.Ashift, format.Aloss)\n\tdefault:\n\t\t// TODO(#22): handle all pixel formats\n\t\tpanic(\"pixel format not handled\")\n\t}\n}", "title": "" }, { "docid": "a7930d9f3fe6a0a1037bf5dfc6aee911", "score": "0.4739726", "text": "func (cons *VesaFbConsole) loadDefaultPalette() {\n\tcons.palette = make(color.Palette, 256)\n\n\tegaPalette := []color.RGBA{\n\t\tcolor.RGBA{R: 0, G: 0, B: 0}, /* black */\n\t\tcolor.RGBA{R: 0, G: 0, B: 128}, /* blue */\n\t\tcolor.RGBA{R: 0, G: 128, B: 1}, /* green */\n\t\tcolor.RGBA{R: 0, G: 128, B: 128}, /* cyan */\n\t\tcolor.RGBA{R: 128, G: 0, B: 1}, /* red */\n\t\tcolor.RGBA{R: 128, G: 0, B: 128}, /* magenta */\n\t\tcolor.RGBA{R: 64, G: 64, B: 1}, /* brown */\n\t\tcolor.RGBA{R: 128, G: 128, B: 128}, /* light gray */\n\t\tcolor.RGBA{R: 64, G: 64, B: 64}, /* dark gray */\n\t\tcolor.RGBA{R: 0, G: 0, B: 255}, /* light blue */\n\t\tcolor.RGBA{R: 0, G: 255, B: 1}, /* light green */\n\t\tcolor.RGBA{R: 0, G: 255, B: 255}, /* light cyan */\n\t\tcolor.RGBA{R: 255, G: 0, B: 1}, /* light red */\n\t\tcolor.RGBA{R: 255, G: 0, B: 255}, /* light magenta */\n\t\tcolor.RGBA{R: 255, G: 255, B: 1}, /* yellow */\n\t\tcolor.RGBA{R: 255, G: 255, B: 255}, /* white */\n\t}\n\n\t// Load default EGA palette for colors 0-16\n\tvar index int\n\tfor ; index < len(egaPalette); index++ {\n\t\tcons.SetPaletteColor(uint8(index), egaPalette[index])\n\t}\n\n\t// Set all other colors to black\n\tfor ; index < len(cons.palette); index++ {\n\t\tcons.SetPaletteColor(uint8(index), egaPalette[0])\n\t}\n}", "title": "" }, { "docid": "f81fd9b4ddb5598fbbc96e336db959e7", "score": "0.47337496", "text": "func (cons *VesaFbConsole) replace16(src, dst color.RGBA) {\n\ttmp := cons.palette[0]\n\tcons.palette[0] = src\n\tsrcComp := cons.packColor16(0)\n\tcons.palette[0] = dst\n\tdstComp := cons.packColor16(0)\n\tcons.palette[0] = tmp\n\tfor fbOffset := cons.fbOffset(0, 0); fbOffset < uint32(len(cons.fb)); fbOffset += cons.bytesPerPixel {\n\t\tif cons.fb[fbOffset] == srcComp[0] &&\n\t\t\tcons.fb[fbOffset+1] == srcComp[1] {\n\t\t\tcons.fb[fbOffset] = dstComp[0]\n\t\t\tcons.fb[fbOffset+1] = dstComp[1]\n\t\t}\n\t}\n}", "title": "" }, { "docid": "862c701e01f3b9173fc2f879c6d56137", "score": "0.47322592", "text": "func (client *RenderingControl2) SetBlueVideoBlackLevelCtx(\n\tctx context.Context,\n\tInstanceID uint32,\n\tDesiredBlueVideoBlackLevel uint16,\n) (err error) {\n\t// Request structure.\n\trequest := &struct {\n\t\tInstanceID string\n\t\tDesiredBlueVideoBlackLevel string\n\t}{}\n\t// BEGIN Marshal arguments into request.\n\n\tif request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil {\n\t\treturn\n\t}\n\tif request.DesiredBlueVideoBlackLevel, err = soap.MarshalUi2(DesiredBlueVideoBlackLevel); err != nil {\n\t\treturn\n\t}\n\t// END Marshal arguments into request.\n\n\t// Response structure.\n\tresponse := interface{}(nil)\n\n\t// Perform the SOAP call.\n\tif err = client.SOAPClient.PerformActionCtx(ctx, URN_RenderingControl_2, \"SetBlueVideoBlackLevel\", request, response); err != nil {\n\t\treturn\n\t}\n\n\t// BEGIN Unmarshal arguments from response.\n\n\t// END Unmarshal arguments from response.\n\treturn\n}", "title": "" }, { "docid": "aa277685beb25618ba1337cf56355e3b", "score": "0.47152802", "text": "func init() {\n\tmapType(\"wxPalette\", reflect.TypeOf(palette{}))\n}", "title": "" }, { "docid": "45ed72aa7f649a15b80e9c0161928903", "score": "0.47100818", "text": "func (gdt *Color) SetR(\n\tr float32, /* else case */\n) {\n\n\t/* go_godot_color_set_r(API_STRUCT,godot_real) ->void */\n\n\tapi := CoreApi\n\trcv := (*C.godot_color)(unsafe.Pointer(gdt))\n\tin0 := *(*C.godot_real)(unsafe.Pointer(&r))\n\n\tC.go_godot_color_set_r(\n\t\tapi,\n\t\trcv,\n\t\tin0,\n\t)\n\truntime.KeepAlive(in0)\n}", "title": "" }, { "docid": "ead377203f2908fb510fbeca0b6ca931", "score": "0.47084618", "text": "func (t *Tile) SetPaletteIdAt(row, col int, pid PaletteId) error {\n\tif row >= t.Size() || col >= t.Size() {\n\t\treturn fmt.Errorf(\"tile indexing out of bounds, requested (%d,%d), tile size is %d\", row, col, t.Size())\n\t}\n\tt.pixels[row][col] = pid\n\treturn nil\n}", "title": "" }, { "docid": "79948872eaaac64ed054e436b8c03693", "score": "0.47053957", "text": "func (client *RenderingControl2) SetRedVideoGainCtx(\n\tctx context.Context,\n\tInstanceID uint32,\n\tDesiredRedVideoGain uint16,\n) (err error) {\n\t// Request structure.\n\trequest := &struct {\n\t\tInstanceID string\n\t\tDesiredRedVideoGain string\n\t}{}\n\t// BEGIN Marshal arguments into request.\n\n\tif request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil {\n\t\treturn\n\t}\n\tif request.DesiredRedVideoGain, err = soap.MarshalUi2(DesiredRedVideoGain); err != nil {\n\t\treturn\n\t}\n\t// END Marshal arguments into request.\n\n\t// Response structure.\n\tresponse := interface{}(nil)\n\n\t// Perform the SOAP call.\n\tif err = client.SOAPClient.PerformActionCtx(ctx, URN_RenderingControl_2, \"SetRedVideoGain\", request, response); err != nil {\n\t\treturn\n\t}\n\n\t// BEGIN Unmarshal arguments from response.\n\n\t// END Unmarshal arguments from response.\n\treturn\n}", "title": "" }, { "docid": "87ca3966b35e8eb74e1bb918506b0fe4", "score": "0.47014073", "text": "func (w *DL) PaletteSource(addr int) {\n\tw.wr32(PALETTE_SOURCE | uint32(addr)&0x3FFFFF)\n}", "title": "" }, { "docid": "10c9b9e2c5cb0080a9b7e448d88550d0", "score": "0.46990854", "text": "func (c *Color4) Set(r, g, b, a float32) *Color4 {\n\n\tc.R = r\n\tc.G = g\n\tc.B = b\n\tc.A = a\n\treturn c\n}", "title": "" }, { "docid": "3b4888786ac5b18ecf685b2b82eee1cb", "score": "0.4689986", "text": "func ToPalette(palette []colorful.Color) color.Palette {\n\tcolorPalette := make(color.Palette, len(palette)+1)\n\tcolorPalette[0] = color.Alpha{}\n\tfor i := range palette {\n\n\t\tr, g, b := palette[i].RGB255()\n\n\t\t_, _, _, a := palette[i].RGBA()\n\t\tcolorPalette[i+1] = color.RGBA{\n\t\t\tR: r,\n\t\t\tG: g,\n\t\t\tB: b,\n\t\t\tA: uint8(math.Sqrt(float64(a))),\n\t\t}\n\t}\n\treturn colorPalette\n}", "title": "" }, { "docid": "39d37a0277300b03025a8447d80d8f12", "score": "0.46878508", "text": "func SetConsoleColor(color string) {\n\tfor key, value := range colormap {\n\t\tif key == color {\n\t\t\tfmt.Printf(\"%s\", value)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "605400ffc41a9b7838dd172d4b249823", "score": "0.46878064", "text": "func (d *Device) Set(x, y int, c color.Color) {\n\tif x < 0 || y < 0 || x >= int(d.VarScreenInfo.XRes) || y >= int(d.VarScreenInfo.YRes) {\n\t\t// Out of bounds\n\t\treturn\n\t}\n\n\tc = d.ColorModel().Convert(c)\n\tr, _, _, _ := c.RGBA()\n\td.data[x+y*int(d.VarScreenInfo.XRes)] = ^byte(r >> 8)\n}", "title": "" }, { "docid": "cc425665f81733275287431e692c315c", "score": "0.46795717", "text": "func SetVideoCodec(w http.ResponseWriter, r *http.Request) {\n\tif !requirePOST(w, r) {\n\t\treturn\n\t}\n\n\tconfigValue, success := getValueFromRequest(w, r)\n\tif !success {\n\t\tcontrollers.WriteSimpleResponse(w, false, \"unable to change video codec\")\n\t\treturn\n\t}\n\n\tif err := data.SetVideoCodec(configValue.Value.(string)); err != nil {\n\t\tcontrollers.WriteSimpleResponse(w, false, \"unable to update codec\")\n\t\treturn\n\t}\n\n\tcontrollers.WriteSimpleResponse(w, true, \"video codec updated\")\n}", "title": "" }, { "docid": "759b540ec278771e5e04b79b367128f7", "score": "0.46736905", "text": "func (this *Context) SetSourceRGB(r, g, b float64) {\n\tC.cairo_set_source_rgb(this.c(), C.double(r), C.double(g), C.double(b))\n}", "title": "" }, { "docid": "d28735a90472db8897606ed3bb4519cf", "score": "0.46731868", "text": "func (s *Surface) SetPixelv(v Vec2, c Color) {\n\ts.SetPixel(v.X, v.Y, c)\n}", "title": "" }, { "docid": "0a1f20a60194c2a5141d2719c2d78f60", "score": "0.46699867", "text": "func execmNRGBA64Set(_ int, p *gop.Context) {\n\targs := p.GetArgs(4)\n\targs[0].(*image.NRGBA64).Set(args[1].(int), args[2].(int), args[3].(color.Color))\n}", "title": "" }, { "docid": "c113878949903dcae8d41e011a7a5310", "score": "0.4667571", "text": "func (Black) uniqueColorMethod() {}", "title": "" }, { "docid": "f47cb33a8e0d17c4b9e2e6b57ee85f31", "score": "0.46624756", "text": "func VideoCanvasRefresh(canvas []VideoCanvasS, xs uint32, ys uint32, xi uint32, yi uint32, w uint32, h uint32) {\n\tccanvas, _ := (*C.struct_video_canvas_s)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&canvas)).Data)), cgoAllocsUnknown\n\tcxs, _ := (C.uint)(xs), cgoAllocsUnknown\n\tcys, _ := (C.uint)(ys), cgoAllocsUnknown\n\tcxi, _ := (C.uint)(xi), cgoAllocsUnknown\n\tcyi, _ := (C.uint)(yi), cgoAllocsUnknown\n\tcw, _ := (C.uint)(w), cgoAllocsUnknown\n\tch, _ := (C.uint)(h), cgoAllocsUnknown\n\tC.video_canvas_refresh(ccanvas, cxs, cys, cxi, cyi, cw, ch)\n}", "title": "" } ]
724c41ead80404137acd4d0c4ff9917f
TestEc2APIHelper_DeleteNetworkInterface tests delete network interface returns correct response in case of valid request
[ { "docid": "5a39c210331a55cb4d8c2867a20993d0", "score": "0.81968343", "text": "func TestEc2APIHelper_DeleteNetworkInterface(t *testing.T) {\n\tctrl := gomock.NewController(t)\n\tdefer ctrl.Finish()\n\n\tec2ApiHelper, mockWrapper := getMockWrapper(ctrl)\n\n\tmockWrapper.EXPECT().DeleteNetworkInterface(deleteNetworkInterfaceInput).Return(nil, nil)\n\n\terr := ec2ApiHelper.DeleteNetworkInterface(&branchInterfaceId)\n\tassert.NoError(t, err)\n}", "title": "" } ]
[ { "docid": "7bf66f2c4d85921841c6799db2c6abea", "score": "0.8228291", "text": "func TestDeleteNetworkInterface(t *testing.T) {\n\trequest := DeleteNetworkInterfaceRequest{ServerUUID: \"test\", Index: 1}\n\n\tassert.Equal(t, \"/server/test/networking/interface/1\", request.RequestURL())\n}", "title": "" }, { "docid": "59f72b47b542349b68d18827e583f7b8", "score": "0.7571635", "text": "func TestEc2APIHelper_DetachAndDeleteNetworkInterface(t *testing.T) {\n\tctrl := gomock.NewController(t)\n\tdefer ctrl.Finish()\n\n\tec2ApiHelper, mockWrapper := getMockWrapper(ctrl)\n\n\toldStatus := describeNetworkInterfaceOutputUsingOneInterfaceId.NetworkInterfaces[0].Attachment.Status\n\tdescribeNetworkInterfaceOutputUsingOneInterfaceId.NetworkInterfaces[0].Attachment.Status =\n\t\taws.String(ec2.NetworkInterfaceStatusAvailable)\n\n\tmockWrapper.EXPECT().DetachNetworkInterface(detachNetworkInterfaceInput).Return(nil, nil)\n\tmockWrapper.EXPECT().DescribeNetworkInterfaces(describeNetworkInterfaceInputUsingOneInterfaceId).\n\t\tReturn(describeNetworkInterfaceOutputUsingOneInterfaceId, nil)\n\tmockWrapper.EXPECT().DeleteNetworkInterface(deleteNetworkInterfaceInput).Return(nil, nil)\n\n\terr := ec2ApiHelper.DetachAndDeleteNetworkInterface(&attachmentId, &branchInterfaceId)\n\tassert.NoError(t, err)\n\n\t// clean up\n\tdescribeNetworkInterfaceOutputUsingOneInterfaceId.NetworkInterfaces[0].Attachment.Status = oldStatus\n}", "title": "" }, { "docid": "6663ebb8eb6dded95ea17d96e61111e0", "score": "0.757086", "text": "func (a *OpenAPI) DeleteNetworkInterface(ctx context.Context, eniID string) error {\n\treq := ecs.CreateDeleteNetworkInterfaceRequest()\n\treq.NetworkInterfaceId = eniID\n\n\tl := log.WithFields(map[string]interface{}{\n\t\tLogFieldAPI: \"DeleteNetworkInterface\",\n\t\tLogFieldENIID: eniID,\n\t})\n\ta.MutatingRateLimiter.Accept()\n\tstart := time.Now()\n\tresp, err := a.ClientSet.ECS().DeleteNetworkInterface(req)\n\tmetric.OpenAPILatency.WithLabelValues(\"DeleteNetworkInterface\", fmt.Sprint(err != nil)).Observe(metric.MsSince(start))\n\tif err != nil {\n\t\tl.WithField(LogFieldRequestID, apiErr.ErrRequestID(err)).Errorf(\"delete eni failed, %v\", err)\n\t\treturn err\n\t}\n\tl.WithField(LogFieldRequestID, resp.RequestId).Infof(\"delete eni\")\n\treturn nil\n}", "title": "" }, { "docid": "d141db7dccba0ba77cde7f873fd6588d", "score": "0.7075066", "text": "func TestEc2APIHelper_CreateAndAttachNetworkInterface_DeleteOnSetTerminationFail(t *testing.T) {\n\tctrl := gomock.NewController(t)\n\tdefer ctrl.Finish()\n\n\tec2ApiHelper, mockWrapper := getMockWrapper(ctrl)\n\n\tmockWrapper.EXPECT().CreateNetworkInterface(createNetworkInterfaceInput).Return(createNetworkInterfaceOutput, nil)\n\tmockWrapper.EXPECT().AttachNetworkInterface(attachNetworkInterfaceInput).Return(attachNetworkInterfaceOutput, nil)\n\tmockWrapper.EXPECT().ModifyNetworkInterfaceAttribute(modifyNetworkInterfaceAttributeInput).Return(nil, mockError)\n\n\t// Test detach and delete is called\n\tmockWrapper.EXPECT().DetachNetworkInterface(detachNetworkInterfaceInput).Return(nil, nil)\n\tmockWrapper.EXPECT().DescribeNetworkInterfaces(describeNetworkInterfaceInputUsingOneInterfaceId).\n\t\tReturn(describeNetworkInterfaceOutputUsingOneInterfaceId, nil)\n\tmockWrapper.EXPECT().DeleteNetworkInterface(deleteNetworkInterfaceInput).Return(nil, nil)\n\n\tnwInterface, err := ec2ApiHelper.CreateAndAttachNetworkInterface(&instanceId, &subnetId, securityGroups, tags,\n\t\t&deviceIndex, &eniDescription, nil, 0)\n\n\tassert.NotNil(t, err)\n\tassert.Nil(t, nwInterface)\n}", "title": "" }, { "docid": "9bf8ae147790a8ad8ac4288daa2ebdfa", "score": "0.7031", "text": "func TestEc2APIHelper_CreateAndAttachNetworkInterface_DeleteOnAttachFailed(t *testing.T) {\n\tctrl := gomock.NewController(t)\n\tdefer ctrl.Finish()\n\n\tec2ApiHelper, mockWrapper := getMockWrapper(ctrl)\n\n\tmockWrapper.EXPECT().CreateNetworkInterface(createNetworkInterfaceInput).Return(createNetworkInterfaceOutput, nil)\n\tmockWrapper.EXPECT().AttachNetworkInterface(attachNetworkInterfaceInput).Return(attachNetworkInterfaceOutput, mockError)\n\n\t// Test delete is called\n\tmockWrapper.EXPECT().DeleteNetworkInterface(deleteNetworkInterfaceInput).Return(nil, nil)\n\n\tnwInterface, err := ec2ApiHelper.CreateAndAttachNetworkInterface(&instanceId, &subnetId, securityGroups, tags,\n\t\t&deviceIndex, &eniDescription, nil, 0)\n\n\tassert.NotNil(t, err)\n\tassert.Nil(t, nwInterface)\n}", "title": "" }, { "docid": "62756e3d3b0c7fa261621e99d3de2cf9", "score": "0.6975267", "text": "func (m *MockAzureNetworkClient) DeleteNetworkInterface(resourceGroup string, networkInterfaceName string) (network.InterfacesDeleteFuture, error) {\n\tif m.MockDeleteNetworkInterface == nil {\n\t\treturn network.InterfacesDeleteFuture{}, nil\n\t}\n\treturn m.MockDeleteNetworkInterface(resourceGroup, networkInterfaceName)\n}", "title": "" }, { "docid": "a82be4f0921a0ee402bac72dad6e82b6", "score": "0.6913364", "text": "func TestEc2APIHelper_CreateNetworkInterface_EmptyResponse(t *testing.T) {\n\tctrl := gomock.NewController(t)\n\tdefer ctrl.Finish()\n\n\tec2ApiHelper, mockWrapper := getMockWrapper(ctrl)\n\n\tmockWrapper.EXPECT().CreateNetworkInterface(createNetworkInterfaceInput).Return(nil, nil)\n\n\t_, err := ec2ApiHelper.CreateNetworkInterface(&eniDescription, &subnetId, securityGroups, tags, 0, nil)\n\n\tassert.NotNil(t, err)\n}", "title": "" }, { "docid": "ed39812ee6b9e14c5b9432f7f74d2723", "score": "0.6912409", "text": "func TestEc2APIHelper_DetachNetworkInterfaceFromInstance(t *testing.T) {\n\tctrl := gomock.NewController(t)\n\tdefer ctrl.Finish()\n\n\tec2ApiHelper, mockWrapper := getMockWrapper(ctrl)\n\n\tmockWrapper.EXPECT().DetachNetworkInterface(detachNetworkInterfaceInput).Return(nil, nil)\n\n\terr := ec2ApiHelper.DetachNetworkInterfaceFromInstance(&attachmentId)\n\tassert.NoError(t, err)\n}", "title": "" }, { "docid": "fdafec4a21f28532d36d4afe3f1769b1", "score": "0.6907656", "text": "func (m *MockNetworkV1NetworkInterfaceInterface) Delete(ctx context.Context, objMeta *api.ObjectMeta) (*network.NetworkInterface, error) {\n\tret := m.ctrl.Call(m, \"Delete\", ctx, objMeta)\n\tret0, _ := ret[0].(*network.NetworkInterface)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "ee9c77e6d53a5f6a11076b4f1e26c2b3", "score": "0.689647", "text": "func (s *S) TestCreateNetworkInterfaceExample(c *C) {\n\ttestServer.Response(200, nil, CreateNetworkInterfaceExample)\n\n\tresp, err := s.ec2.CreateNetworkInterface(ec2.CreateNetworkInterface{\n\t\tSubnetId: \"subnet-b2a249da\",\n\t\tPrivateIPs: []ec2.PrivateIP{\n\t\t\t{Address: \"10.0.2.157\", IsPrimary: true},\n\t\t},\n\t\tSecurityGroupIds: []string{\"sg-1a2b3c4d\"},\n\t})\n\treq := testServer.WaitRequest()\n\n\tc.Assert(req.Form[\"Action\"], DeepEquals, []string{\"CreateNetworkInterface\"})\n\tc.Assert(req.Form[\"SubnetId\"], DeepEquals, []string{\"subnet-b2a249da\"})\n\tc.Assert(req.Form[\"PrivateIpAddress\"], HasLen, 0)\n\tc.Assert(\n\t\treq.Form[\"PrivateIpAddresses.1.PrivateIpAddress\"],\n\t\tDeepEquals,\n\t\t[]string{\"10.0.2.157\"},\n\t)\n\tc.Assert(\n\t\treq.Form[\"PrivateIpAddresses.1.Primary\"],\n\t\tDeepEquals,\n\t\t[]string{\"true\"},\n\t)\n\tc.Assert(req.Form[\"Description\"], HasLen, 0)\n\tc.Assert(req.Form[\"SecurityGroupId.1\"], DeepEquals, []string{\"sg-1a2b3c4d\"})\n\n\tc.Assert(err, IsNil)\n\tc.Assert(resp.RequestId, Equals, \"8dbe591e-5a22-48cb-b948-dd0aadd55adf\")\n\tiface := resp.NetworkInterface\n\tc.Check(iface.Id, Equals, \"eni-cfca76a6\")\n\tc.Check(iface.SubnetId, Equals, \"subnet-b2a249da\")\n\tc.Check(iface.VPCId, Equals, \"vpc-c31dafaa\")\n\tc.Check(iface.AvailZone, Equals, \"ap-southeast-1b\")\n\tc.Check(iface.Description, Equals, \"\")\n\tc.Check(iface.OwnerId, Equals, \"251839141158\")\n\tc.Check(iface.RequesterManaged, Equals, false)\n\tc.Check(iface.Status, Equals, \"available\")\n\tc.Check(iface.MACAddress, Equals, \"02:74:b0:72:79:61\")\n\tc.Check(iface.PrivateIPAddress, Equals, \"10.0.2.157\")\n\tc.Check(iface.SourceDestCheck, Equals, true)\n\tc.Check(iface.Groups, DeepEquals, []ec2.SecurityGroup{\n\t\t{Id: \"sg-1a2b3c4d\", Name: \"default\"},\n\t})\n\tc.Check(iface.Tags, HasLen, 0)\n\tc.Check(iface.PrivateIPs, DeepEquals, []ec2.PrivateIP{\n\t\t{Address: \"10.0.2.157\", IsPrimary: true},\n\t})\n}", "title": "" }, { "docid": "1686fafff22a036a2d82e5f20ff1dd41", "score": "0.6888166", "text": "func (m *MockEC2Client) DeleteNetworkInterface(arg0 *ec2.DeleteNetworkInterfaceInput) (*ec2.DeleteNetworkInterfaceOutput, error) {\n\tret := m.ctrl.Call(m, \"DeleteNetworkInterface\", arg0)\n\tret0, _ := ret[0].(*ec2.DeleteNetworkInterfaceOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "fa224f8946de63aa13b52411b41f2523", "score": "0.6786093", "text": "func (m *MockEC2Client) DeleteNetworkInterfaceRequest(arg0 *ec2.DeleteNetworkInterfaceInput) (*request.Request, *ec2.DeleteNetworkInterfaceOutput) {\n\tret := m.ctrl.Call(m, \"DeleteNetworkInterfaceRequest\", arg0)\n\tret0, _ := ret[0].(*request.Request)\n\tret1, _ := ret[1].(*ec2.DeleteNetworkInterfaceOutput)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "402a68298d056d451aa3faf808a69876", "score": "0.66834456", "text": "func (m *MockNetworkV1NetworkInterface) Delete(ctx context.Context, objMeta *api.ObjectMeta) (*network.Network, error) {\n\tret := m.ctrl.Call(m, \"Delete\", ctx, objMeta)\n\tret0, _ := ret[0].(*network.Network)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "595cf6ba4dfd00e34978d3f126c77ebc", "score": "0.6568167", "text": "func (s *ServerTests) TestNetworkInterfaces(c *C) {\n\tvpcResp, err := s.ec2.CreateVPC(\"10.3.0.0/16\", \"\")\n\tc.Assert(err, IsNil)\n\tvpcId := vpcResp.VPC.Id\n\tdefer s.deleteVPCs(c, []string{vpcId})\n\n\tsubResp := s.createSubnet(c, vpcId, \"10.3.1.0/24\", \"\")\n\tsubId := subResp.Subnet.Id\n\tdefer s.deleteSubnets(c, []string{subId})\n\n\tsg := s.makeTestGroupVPC(c, vpcId, \"vpc-sg-1\", \"vpc test group1\")\n\tdefer s.deleteGroups(c, []ec2.SecurityGroup{sg})\n\n\tinstList, err := s.ec2.RunInstances(&ec2.RunInstances{\n\t\tImageId: imageId,\n\t\tInstanceType: \"t1.micro\",\n\t\tSubnetId: subId,\n\t})\n\tc.Assert(err, IsNil)\n\tinst := instList.Instances[0]\n\tc.Assert(inst, NotNil)\n\tinstId := inst.InstanceId\n\tdefer terminateInstances(c, s.ec2, []string{instId})\n\n\tips1 := []ec2.PrivateIP{{Address: \"10.3.1.10\", IsPrimary: true}}\n\tresp1, err := s.ec2.CreateNetworkInterface(ec2.CreateNetworkInterface{\n\t\tSubnetId: subId,\n\t\tPrivateIPs: ips1,\n\t\tDescription: \"My first iface\",\n\t})\n\tc.Assert(err, IsNil)\n\tassertNetworkInterface(c, resp1.NetworkInterface, \"\", subId, ips1)\n\tc.Check(resp1.NetworkInterface.Description, Equals, \"My first iface\")\n\tid1 := resp1.NetworkInterface.Id\n\n\tips2 := []ec2.PrivateIP{\n\t\t{Address: \"10.3.1.20\", IsPrimary: true},\n\t\t{Address: \"10.3.1.22\", IsPrimary: false},\n\t}\n\tresp2, err := s.ec2.CreateNetworkInterface(ec2.CreateNetworkInterface{\n\t\tSubnetId: subId,\n\t\tPrivateIPs: ips2,\n\t\tSecurityGroupIds: []string{sg.Id},\n\t})\n\tc.Assert(err, IsNil)\n\tassertNetworkInterface(c, resp2.NetworkInterface, \"\", subId, ips2)\n\tc.Assert(resp2.NetworkInterface.Groups, DeepEquals, []ec2.SecurityGroup{sg})\n\tid2 := resp2.NetworkInterface.Id\n\n\t// We only check for the network interfaces we just created,\n\t// because the user might have others in his account (when testing\n\t// against the EC2 servers). In some cases it takes a short while\n\t// until both interfaces are created, so we need to retry a few\n\t// times to make sure.\n\ttestAttempt := aws.AttemptStrategy{\n\t\tTotal: 5 * time.Minute,\n\t\tDelay: 5 * time.Second,\n\t}\n\tvar list *ec2.NetworkInterfacesResp\n\tdone := false\n\tfor a := testAttempt.Start(); a.Next(); {\n\t\tc.Logf(\"waiting for %v to be created\", []string{id1, id2})\n\t\tlist, err = s.ec2.NetworkInterfaces(nil, nil)\n\t\tif err != nil {\n\t\t\tc.Logf(\"retrying; NetworkInterfaces returned: %v\", err)\n\t\t\tcontinue\n\t\t}\n\t\tfound := 0\n\t\tfor _, iface := range list.Interfaces {\n\t\t\tc.Logf(\"found NIC %v\", iface)\n\t\t\tswitch iface.Id {\n\t\t\tcase id1:\n\t\t\t\tassertNetworkInterface(c, iface, id1, subId, ips1)\n\t\t\t\tfound++\n\t\t\tcase id2:\n\t\t\t\tassertNetworkInterface(c, iface, id2, subId, ips2)\n\t\t\t\tfound++\n\t\t\t}\n\t\t\tif found == 2 {\n\t\t\t\tdone = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif done {\n\t\t\tc.Logf(\"all NICs were created\")\n\t\t\tbreak\n\t\t}\n\t}\n\tif !done {\n\t\tc.Fatalf(\"timeout while waiting for NICs %v\", []string{id1, id2})\n\t}\n\n\tlist, err = s.ec2.NetworkInterfaces([]string{id1}, nil)\n\tc.Assert(err, IsNil)\n\tc.Assert(list.Interfaces, HasLen, 1)\n\tassertNetworkInterface(c, list.Interfaces[0], id1, subId, ips1)\n\n\tf := ec2.NewFilter()\n\tf.Add(\"network-interface-id\", id2)\n\tlist, err = s.ec2.NetworkInterfaces(nil, f)\n\tc.Assert(err, IsNil)\n\tc.Assert(list.Interfaces, HasLen, 1)\n\tassertNetworkInterface(c, list.Interfaces[0], id2, subId, ips2)\n\n\t// Attachment might fail if the instance is not running yet,\n\t// so we retry for a while until it succeeds.\n\tvar attResp *ec2.AttachNetworkInterfaceResp\n\tfor a := testAttempt.Start(); a.Next(); {\n\t\tattResp, err = s.ec2.AttachNetworkInterface(id2, instId, 1)\n\t\tif err != nil {\n\t\t\tc.Logf(\"AttachNetworkInterface returned: %v; retrying...\", err)\n\t\t\tattResp = nil\n\t\t\tcontinue\n\t\t}\n\t\tc.Logf(\"AttachNetworkInterface succeeded\")\n\t\tc.Check(attResp.AttachmentId, Not(Equals), \"\")\n\t\tbreak\n\t}\n\tif attResp == nil {\n\t\tc.Fatalf(\"timeout while waiting for AttachNetworkInterface to succeed\")\n\t}\n\n\tlist, err = s.ec2.NetworkInterfaces([]string{id2}, nil)\n\tc.Assert(err, IsNil)\n\tatt := list.Interfaces[0].Attachment\n\tc.Check(att.Id, Equals, attResp.AttachmentId)\n\tc.Check(att.InstanceId, Equals, instId)\n\tc.Check(att.DeviceIndex, Equals, 1)\n\tc.Check(att.Status, Matches, \"(attaching|in-use)\")\n\n\t_, err = s.ec2.DetachNetworkInterface(att.Id, true)\n\tc.Check(err, IsNil)\n\n\t_, err = s.ec2.DeleteNetworkInterface(id1)\n\tc.Assert(err, IsNil)\n\n\t// We might not be able to delete the interface until the\n\t// detachment is completed, so we need to retry here as well.\n\tfor a := testAttempt.Start(); a.Next(); {\n\t\t_, err = s.ec2.DeleteNetworkInterface(id2)\n\t\tif err != nil {\n\t\t\tc.Logf(\"DeleteNetworkInterface returned: %v; retrying...\", err)\n\t\t\tcontinue\n\t\t}\n\t\tc.Logf(\"DeleteNetworkInterface succeeded\")\n\t\treturn\n\t}\n\tc.Fatalf(\"timeout while waiting for DeleteNetworkInterface to succeed\")\n}", "title": "" }, { "docid": "4030af4adc4da3d9f5e521319784a376", "score": "0.64601994", "text": "func (s *Service) Delete(ctx context.Context) error {\n\tctx, _, done := tele.StartSpanWithLogger(ctx, \"networkinterfaces.Service.Delete\")\n\tdefer done()\n\n\tctx, cancel := context.WithTimeout(ctx, reconciler.DefaultAzureServiceReconcileTimeout)\n\tdefer cancel()\n\n\tspecs := s.Scope.NICSpecs()\n\tif len(specs) == 0 {\n\t\treturn nil\n\t}\n\n\t// We go through the list of NICSpecs to delete each one, independently of the result of the previous one.\n\t// If multiple errors occur, we return the most pressing one.\n\t// Order of precedence (highest -> lowest) is: error that is not an operationNotDoneError (i.e. error deleting) -> operationNotDoneError (i.e. deleting in progress) -> no error (i.e. deleted)\n\tvar result error\n\tfor _, nicSpec := range specs {\n\t\tif err := s.DeleteResource(ctx, nicSpec, serviceName); err != nil {\n\t\t\tif !azure.IsOperationNotDoneError(err) || result == nil {\n\t\t\t\tresult = err\n\t\t\t}\n\t\t}\n\t}\n\n\ts.Scope.UpdateDeleteStatus(infrav1.NetworkInterfaceReadyCondition, serviceName, result)\n\treturn result\n}", "title": "" }, { "docid": "85fdd1beee5edea6d3baa4473af9e2b4", "score": "0.6425869", "text": "func (a *DevicesApiService) DevicesDeviceIdInterfacesInterfaceNameDelete(ctx context.Context, xAuthToken string, deviceId string, interfaceName string) (Status, *http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tsuccessPayload Status\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/devices/{deviceId}/interfaces/{interfaceName}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"deviceId\"+\"}\", fmt.Sprintf(\"%v\", deviceId), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"interfaceName\"+\"}\", fmt.Sprintf(\"%v\", interfaceName), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.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\tlocalVarHeaderParams[\"x-auth-token\"] = parameterToString(xAuthToken, \"\")\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-auth-token\"] = key\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 successPayload, nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn successPayload, localVarHttpResponse, err\n\t}\n\tdefer localVarHttpResponse.Body.Close()\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tbodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)\n\t\treturn successPayload, localVarHttpResponse, reportError(\"Status: %v, Body: %s\", localVarHttpResponse.Status, bodyBytes)\n\t}\n\n\tif err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {\n\t\treturn successPayload, localVarHttpResponse, err\n\t}\n\n\treturn successPayload, localVarHttpResponse, err\n}", "title": "" }, { "docid": "f06a3fdbdc157f79cd9fe1704be29c9a", "score": "0.64112794", "text": "func TestEc2APIHelper_CreateNetworkInterface_NoSecondaryIP(t *testing.T) {\n\tctrl := gomock.NewController(t)\n\tdefer ctrl.Finish()\n\n\tec2ApiHelper, mockWrapper := getMockWrapper(ctrl)\n\n\tmockWrapper.EXPECT().CreateNetworkInterface(createNetworkInterfaceInput).Return(createNetworkInterfaceOutput, nil)\n\n\toutput, err := ec2ApiHelper.CreateNetworkInterface(&eniDescription, &subnetId, securityGroups, tags, 0, nil)\n\n\tassert.NoError(t, err)\n\tassert.Equal(t, branchInterfaceId, *output.NetworkInterfaceId)\n}", "title": "" }, { "docid": "64e11ede0815094e3c1813e09b547ef1", "score": "0.6377951", "text": "func TestEc2APIHelper_GetNetworkInterfaceOfInstance(t *testing.T) {\n\tctrl := gomock.NewController(t)\n\tdefer ctrl.Finish()\n\n\tec2ApiHelper, mockWrapper := getMockWrapper(ctrl)\n\n\tmockWrapper.EXPECT().DescribeInstances(describeNetworkInterfaceInputUsingInstanceId).\n\t\tReturn(describeNetworkInterfaceOutputUsingInstanceId, nil)\n\n\tnwInterfaces, err := ec2ApiHelper.GetInstanceNetworkInterface(&instanceId)\n\tassert.NoError(t, err)\n\tassert.Equal(t, branchInterfaceId, *nwInterfaces[0].NetworkInterfaceId)\n}", "title": "" }, { "docid": "86fa3c6eaab43cb17c66efb7559192ef", "score": "0.6325352", "text": "func TestCreateNetworkInterface(t *testing.T) {\n\trequest := CreateNetworkInterfaceRequest{ServerUUID: \"test\"}\n\n\tassert.Equal(t, \"/server/test/networking/interface\", request.RequestURL())\n}", "title": "" }, { "docid": "e2a5b3e4853f391617364add9c427fad", "score": "0.6309278", "text": "func TestEc2APIHelper_DescribeNetworkInterfaces(t *testing.T) {\n\tctrl := gomock.NewController(t)\n\tdefer ctrl.Finish()\n\n\tec2ApiHelper, mockWrapper := getMockWrapper(ctrl)\n\n\tmockWrapper.EXPECT().DescribeNetworkInterfaces(describeNetworkInterfaceInputUsingInterfaceId).\n\t\tReturn(describeNetworkInterfaceOutputUsingInterfaceId, nil)\n\n\tnwInterfaces, err := ec2ApiHelper.DescribeNetworkInterfaces([]*string{&branchInterfaceId, &branchInterfaceId2})\n\tassert.NoError(t, err)\n\tassert.Equal(t, 2, len(nwInterfaces))\n}", "title": "" }, { "docid": "4918bfff438b5d050dfea8af3b19c831", "score": "0.6181484", "text": "func (a *PlatformApiService) PlatformNetworkDestroy(ctx context.Context, networkId int32) (InlineResponse204, *http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue InlineResponse204\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/api/platform/networks/{network_id}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"network_id\"+\"}\", fmt.Sprintf(\"%v\", networkId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.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, 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 == 204 {\n\t\t\tvar v InlineResponse204\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"));\n\t\t\t\tif err != nil {\n\t\t\t\t\tnewErr.error = err.Error()\n\t\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t\t}\n\t\t\t\tnewErr.model = v\n\t\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": "94f878cbfaa7a37d0ee1541e26165fc7", "score": "0.6170191", "text": "func dockerNetDelete(t *testing.T, subnetID string) error {\n\tout, err := exec.Command(\"docker\", \"network\", \"rm\", subnetID).CombinedOutput()\n\tif err != nil {\n\t\tt.Error(\"docker network delete failed\", err)\n\t} else {\n\t\tdebugPrint(t, \"docker network delete=\", string(out))\n\t}\n\treturn err\n}", "title": "" }, { "docid": "8af10f766fbb62549a3adb2a59486a70", "score": "0.61693007", "text": "func (r *RenderedNetwork) DeleteInterface(name string) error {\n\terr := callBin(\"ip\", \"link\", \"del\", name)\n\tif err == nil {\n\t\tdelete(r.Interfaces, name)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "c2529b7e8ab0b462ac5c59cd90c8489e", "score": "0.6138699", "text": "func TestModifyNetworkInterface(t *testing.T) {\n\trequest := ModifyNetworkInterfaceRequest{ServerUUID: \"test\", Index: 1}\n\n\tassert.Equal(t, \"/server/test/networking/interface/1\", request.RequestURL())\n}", "title": "" }, { "docid": "e8d530d7edb5285664bfc0e6657f6647", "score": "0.6098803", "text": "func TestDeleteNetworkRequest(t *testing.T) {\n\trequest := DeleteNetworkRequest{UUID: \"test\"}\n\n\tassert.Equal(t, \"/network/test\", request.RequestURL())\n}", "title": "" }, { "docid": "d6cdb029662ccbf5296c4938d89426cb", "score": "0.60750884", "text": "func (m *MockEC2Client) DeleteNetworkInterfacePermission(arg0 *ec2.DeleteNetworkInterfacePermissionInput) (*ec2.DeleteNetworkInterfacePermissionOutput, error) {\n\tret := m.ctrl.Call(m, \"DeleteNetworkInterfacePermission\", arg0)\n\tret0, _ := ret[0].(*ec2.DeleteNetworkInterfacePermissionOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "6d074328af8d5f417ef9be8abf203b22", "score": "0.6062183", "text": "func (c *FakeClient) DeleteNetwork(id string) (*SimpleResponse, error) {\n\tfor i, network := range c.Networks {\n\t\tif network.ID == id {\n\t\t\tc.Networks[len(c.Networks)-1], c.Networks[i] = c.Networks[i], c.Networks[len(c.Networks)-1]\n\t\t\tc.Networks = c.Networks[:len(c.Networks)-1]\n\t\t\treturn &SimpleResponse{Result: \"success\"}, nil\n\t\t}\n\t}\n\n\treturn &SimpleResponse{Result: \"failed\"}, nil\n}", "title": "" }, { "docid": "619f12ee78e88d10559c669acb66b1bd", "score": "0.5983109", "text": "func TestEniManager_DeleteIPV4Address(t *testing.T) {\n\tctrl := gomock.NewController(t)\n\tdefer ctrl.Finish()\n\n\tmanager, mockInstance, mockEc2APIHelper := getMockManager(ctrl)\n\n\teniDetails1 := createENIDetails(eniID1, 1)\n\teniDetails2 := createENIDetails(eniID2, 1)\n\n\tmanager.ipToENIMap = map[string]*eni{ip1: eniDetails1, ip2: eniDetails1, ip3: eniDetails2, ip4: eniDetails2}\n\tmanager.attachedENIs = []*eni{eniDetails1, eniDetails2}\n\n\tmockInstance.EXPECT().Type().Return(instanceType)\n\tmockInstance.EXPECT().PrimaryNetworkInterfaceID().Return(eniID1)\n\t// Unassign the IPs from interface 1 and 2\n\tmockEc2APIHelper.EXPECT().UnassignPrivateIpAddresses(eniID1, []string{ip1}).Return(nil)\n\tmockEc2APIHelper.EXPECT().UnassignPrivateIpAddresses(eniID2, []string{ip3, ip4}).Return(nil)\n\t// Delete the network interface 2 as it has no more secondary IP left\n\tmockEc2APIHelper.EXPECT().DeleteNetworkInterface(&eniID2).Return(nil)\n\n\tfailedToDelete, err := manager.DeleteIPV4Address([]string{ip3, ip1, ip4}, mockEc2APIHelper, log)\n\n\tassert.NoError(t, err)\n\tassert.Empty(t, failedToDelete)\n\tassert.Equal(t, []*eni{eniDetails1}, manager.attachedENIs)\n\tassert.NotContains(t, manager.ipToENIMap, ip1)\n\tassert.NotContains(t, manager.ipToENIMap, ip3)\n}", "title": "" }, { "docid": "d78efe389572a03eef71888cca21b988", "score": "0.59685236", "text": "func (c *FakeClient) DeleteIP(id string) (*SimpleResponse, error) {\n\treturn &SimpleResponse{\n\t\tResult: \"success\",\n\t}, nil\n}", "title": "" }, { "docid": "1ce205bb2f4e7ced144d195b5f7ec668", "score": "0.59387785", "text": "func (ac *AzureClient) Delete(ctx context.Context, resourceGroupName, bastionName string) error {\n\tfuture, err := ac.interfaces.Delete(ctx, resourceGroupName, bastionName)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = future.WaitForCompletionRef(ctx, ac.interfaces.Client)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = future.Result(ac.interfaces)\n\treturn err\n}", "title": "" }, { "docid": "34c6d361dbd7264db6ef489967825af3", "score": "0.59384716", "text": "func (m *MockNetworkInterface) DeleteNetwork() error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"DeleteNetwork\")\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "fcfcd7d7e282408934f76c33c1a0e5d6", "score": "0.5918457", "text": "func TestEniManager_DeleteIPV4Address_SomeFail(t *testing.T) {\n\tctrl := gomock.NewController(t)\n\tdefer ctrl.Finish()\n\n\tmanager, mockInstance, mockEc2APIHelper := getMockManager(ctrl)\n\n\teniDetails1 := createENIDetails(eniID1, 1)\n\teniDetails2 := createENIDetails(eniID2, 2)\n\n\tmanager.ipToENIMap = map[string]*eni{ip1: eniDetails1, ip2: eniDetails1, ip3: eniDetails2}\n\tmanager.attachedENIs = []*eni{eniDetails1, eniDetails2}\n\n\tmockInstance.EXPECT().Type().Return(instanceType)\n\tmockInstance.EXPECT().PrimaryNetworkInterfaceID().Return(eniID1)\n\t// Unassign the IPs from interface 1 and 2\n\tmockEc2APIHelper.EXPECT().UnassignPrivateIpAddresses(eniID1, []string{ip1}).Return(mockError)\n\tmockEc2APIHelper.EXPECT().UnassignPrivateIpAddresses(eniID2, []string{ip3}).Return(nil)\n\t// Delete the network interface 2 as it has no more secondary IP left\n\tmockEc2APIHelper.EXPECT().DeleteNetworkInterface(&eniID2).Return(nil)\n\n\tfailedToDelete, err := manager.DeleteIPV4Address([]string{ip1, ip3}, mockEc2APIHelper, log)\n\n\tassert.NotNil(t, err)\n\tassert.Equal(t, []string{ip1}, failedToDelete)\n\tassert.Equal(t, []*eni{eniDetails1}, manager.attachedENIs)\n\tassert.Contains(t, manager.ipToENIMap, ip1)\n\tassert.NotContains(t, manager.ipToENIMap, ip3)\n}", "title": "" }, { "docid": "cbb64f28f7c10950b7b255fbddd07dde", "score": "0.5891413", "text": "func (mr *MockEC2ClientMockRecorder) DeleteNetworkInterface(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DeleteNetworkInterface\", reflect.TypeOf((*MockEC2Client)(nil).DeleteNetworkInterface), arg0)\n}", "title": "" }, { "docid": "3e1d9b411c1626e6774d2ee5005e8881", "score": "0.58375335", "text": "func (a *PlatformApiService) PlatformNetworkNetworkAgentDestroyDeprecated(ctx context.Context, body []float64, networkId int32) (InlineResponse204, *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 InlineResponse204\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/api/platform/network/{network_id}/agents/delete\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"network_id\"+\"}\", fmt.Sprintf(\"%v\", networkId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\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\t// body params\n\tlocalVarPostBody = &body\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 == 204 {\n\t\t\tvar v InlineResponse204\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"));\n\t\t\t\tif err != nil {\n\t\t\t\t\tnewErr.error = err.Error()\n\t\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t\t}\n\t\t\t\tnewErr.model = v\n\t\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": "0aeb058143b9114410d979ab80fb443d", "score": "0.5825892", "text": "func TestNetworkAddDeleteACIMode(t *testing.T) {\n\n\t// set aci mode\n\tcheckGlobalSet(t, false, \"aci\", \"1-4094\", \"1-10000\", \"bridge\")\n\n\t// Create Network and Delete it\n\tcheckCreateNetwork(t, false, \"default\", \"contiv\", \"\", \"vlan\", \"10.1.1.1/24\", \"10.1.1.254\", 1, \"\", \"\")\n\tcheckInspectNetwork(t, false, \"default\", \"contiv\", \"10.1.1.254\", 1, 0)\n\tcheckInspectGlobal(t, false, \"1\", \"\")\n\tverifyNetworkState(t, \"default\", \"contiv\", \"data\", \"vlan\", \"10.1.1.1\", \"10.1.1.254\", 24, 1, 0, \"\", \"\", 0)\n\tcheckDeleteNetwork(t, false, \"default\", \"contiv\")\n\n\t// Create network without gateway\n\tcheckCreateNetwork(t, false, \"default\", \"contiv-gw\", \"\", \"vxlan\", \"10.1.1.1/16\", \"\", 1, \"\", \"\")\n\tcheckInspectNetwork(t, false, \"default\", \"contiv-gw\", \"\", 1, 0)\n\tcheckInspectGlobal(t, false, \"\", \"1\")\n\tverifyNetworkState(t, \"default\", \"contiv-gw\", \"data\", \"vxlan\", \"10.1.1.1\", \"\", 16, 1, 1, \"\", \"\", 0)\n\tcheckDeleteNetwork(t, false, \"default\", \"contiv-gw\")\n\n\t// Create network with ipv6\n\tcheckCreateNetwork(t, false, \"default\", \"contiv-ipv6\", \"\", \"vxlan\", \"10.1.1.1/16\", \"\", 1, \"2016:0617::/120\", \"\")\n\tverifyNetworkState(t, \"default\", \"contiv-ipv6\", \"data\", \"vxlan\", \"10.1.1.1\", \"\", 16, 1, 1, \"2016:0617::\", \"\", 120)\n\tcheckDeleteNetwork(t, false, \"default\", \"contiv-ipv6\")\n\n}", "title": "" }, { "docid": "dbed3ec7a02c9a704bf93fcbe339bfb6", "score": "0.58051455", "text": "func DeleteInterface(name string) error {\n\tcmd := exec.Command(\"ip\", \"link\", \"del\", name)\n\n\tout, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"ip link add: %s\", utils.OneLine(out))\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "dfb7aa8253137052f672e67111b24553", "score": "0.5801341", "text": "func (m *MockEC2Client) DeleteNetworkInterfacePermissionRequest(arg0 *ec2.DeleteNetworkInterfacePermissionInput) (*request.Request, *ec2.DeleteNetworkInterfacePermissionOutput) {\n\tret := m.ctrl.Call(m, \"DeleteNetworkInterfacePermissionRequest\", arg0)\n\tret0, _ := ret[0].(*request.Request)\n\tret1, _ := ret[1].(*ec2.DeleteNetworkInterfacePermissionOutput)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "52c66b1241c9992da21df11f0033eda1", "score": "0.5795185", "text": "func TestEc2APIHelper_CreateNetworkInterface_TypeTrunk(t *testing.T) {\n\tctrl := gomock.NewController(t)\n\tdefer ctrl.Finish()\n\n\tec2ApiHelper, mockWrapper := getMockWrapper(ctrl)\n\tinterfaceTypeTrunk := \"trunk\"\n\n\tcreateNetworkInterfaceInput.InterfaceType = &interfaceTypeTrunk\n\tmockWrapper.EXPECT().CreateNetworkInterface(createNetworkInterfaceInput).Return(\n\t\t&ec2.CreateNetworkInterfaceOutput{\n\t\t\tNetworkInterface: &ec2.NetworkInterface{NetworkInterfaceId: &trunkInterfaceId}}, nil)\n\tmockWrapper.EXPECT().CreateNetworkInterfacePermission(createNetworkInterfacePermissionInputTrunk).\n\t\tReturn(nil, nil)\n\n\toutput, err := ec2ApiHelper.CreateNetworkInterface(&eniDescription, &subnetId, securityGroups, tags, 0, &interfaceTypeTrunk)\n\n\tcreateNetworkInterfaceInput.InterfaceType = nil\n\n\tassert.NoError(t, err)\n\tassert.Equal(t, trunkInterfaceId, *output.NetworkInterfaceId)\n}", "title": "" }, { "docid": "4ac8a83ee3493f8562270d434ed92a9a", "score": "0.577813", "text": "func (a *PlatformApiService) PlatformNetworkAgentDestroy(ctx context.Context, networkId int32, agentId int32) (InlineResponse204, *http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue InlineResponse204\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/api/platform/networks/{network_id}/agents/{agent_id}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"network_id\"+\"}\", fmt.Sprintf(\"%v\", networkId), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"agent_id\"+\"}\", fmt.Sprintf(\"%v\", agentId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.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, 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 == 204 {\n\t\t\tvar v InlineResponse204\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"));\n\t\t\t\tif err != nil {\n\t\t\t\t\tnewErr.error = err.Error()\n\t\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t\t}\n\t\t\t\tnewErr.model = v\n\t\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": "e6c5970098b5f39b57be2e1a73470a6a", "score": "0.5770055", "text": "func TestNetworkCreateDelete(t *testing.T) {\n\tskip.If(t, testEnv.DaemonInfo.OSType != \"linux\")\n\tdefer setupTest(t)()\n\tclient := testEnv.APIClient()\n\tctx := context.Background()\n\n\tnetName := \"testnetwork_\" + t.Name()\n\tnetwork.CreateNoError(ctx, t, client, netName,\n\t\tnetwork.WithCheckDuplicate(),\n\t)\n\tassert.Check(t, IsNetworkAvailable(client, netName))\n\n\t// delete the network and make sure it is deleted\n\terr := client.NetworkRemove(ctx, netName)\n\tassert.NilError(t, err)\n\tassert.Check(t, IsNetworkNotAvailable(client, netName))\n}", "title": "" }, { "docid": "c290de853cdd08a096c9c5ccae36e7bb", "score": "0.57667077", "text": "func (c *ContivClient) NetworkDelete(tenantName string, networkName string) error {\n\t// build key and URL\n\tkeyStr := tenantName + \":\" + networkName\n\turl := c.baseURL + \"/api/v1/networks/\" + keyStr + \"/\"\n\n\t// http get the object\n\terr := httpDelete(url)\n\tif err != nil {\n\t\tlog.Debugf(\"Error deleting network %s. Err: %v\", keyStr, err)\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "01ad5902efd2bb573aa94fb415c1ce50", "score": "0.5757422", "text": "func (s *stack) DeleteNetwork(ref string) fail.Error {\n\tif s == nil {\n\t\treturn fail.InvalidInstanceError()\n\t}\n\n\t// TODO: use concurrency.Tracer\n\tlogrus.Debug(\"vclouddirector.Client.DeleteSubnet() called\")\n\tdefer logrus.Debug(\"vclouddirector.Client.DeleteSubnet() done\")\n\n\t_, vdc, xerr := s.getOrgVdc()\n\tif xerr != nil {\n\t\treturn xerr\n\t}\n\n\tnett2, err := vdc.FindVDCNetwork(ref)\n\tif err != nil {\n\t\treturn normalizeError(err)\n\t}\n\n\ttask, err := nett2.Delete()\n\tif err != nil {\n\t\treturn normalizeError(err)\n\t}\n\terr = task.WaitTaskCompletion()\n\tif err != nil {\n\t\treturn normalizeError(err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6d949d43c79ab398cbf35f0b0a8e7890", "score": "0.5747799", "text": "func (os *FakeOSClient) DeleteNetwork(networkName string) error {\n\treturn nil\n}", "title": "" }, { "docid": "3f0ebc9821204b17ff87f4dbaa13436b", "score": "0.5691918", "text": "func TestEc2APIHelper_CreateNetworkInterface_WithSecondaryIP(t *testing.T) {\n\tctrl := gomock.NewController(t)\n\tdefer ctrl.Finish()\n\n\tec2ApiHelper, mockWrapper := getMockWrapper(ctrl)\n\n\tipCount := int64(5)\n\n\tcreateNetworkInterfaceInput.SecondaryPrivateIpAddressCount = &ipCount\n\n\tmockWrapper.EXPECT().CreateNetworkInterface(createNetworkInterfaceInput).\n\t\tReturn(createNetworkInterfaceOutput, nil)\n\n\toutput, err := ec2ApiHelper.CreateNetworkInterface(&eniDescription, &subnetId, securityGroups, tags, 5, nil)\n\n\tcreateNetworkInterfaceInput.SecondaryPrivateIpAddressCount = nil\n\n\tassert.NoError(t, err)\n\tassert.Equal(t, branchInterfaceId, *output.NetworkInterfaceId)\n}", "title": "" }, { "docid": "e21b1d5305d8685996d5e7e0c462dfff", "score": "0.56887585", "text": "func (m *MockEC2Client) DetachNetworkInterface(arg0 *ec2.DetachNetworkInterfaceInput) (*ec2.DetachNetworkInterfaceOutput, error) {\n\tret := m.ctrl.Call(m, \"DetachNetworkInterface\", arg0)\n\tret0, _ := ret[0].(*ec2.DetachNetworkInterfaceOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "1e6f59bb2ecbb188ab39c82f72a029ef", "score": "0.5686279", "text": "func (a NetApi) DeleteIpsecIkeSa(id string) error {\n\n\tvar httpMethod = \"Delete\"\n\t// create path and map variables\n\tpath := a.configuration.BasePath + \"/tm/net/ipsec/ikeSa/{id}\"\n\tpath = strings.Replace(path, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\n\theaderParams := make(map[string]string)\n\tqueryParams := url.Values{}\n\tformParams := make(map[string]string)\n\tvar postBody interface{}\n\tvar fileName string\n\tvar fileBytes []byte\n\t// authentication '(token)' required\n\t// set key with prefix in header\n\theaderParams[\"X-F5-Auth-Token\"] = a.configuration.getAPIKeyWithPrefix(\"X-F5-Auth-Token\")\n\t// add default headers if any\n\tfor key := range a.configuration.DefaultHeader {\n\t\theaderParams[key] = a.configuration.DefaultHeader[key]\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\n\t\t\"application/json\",\n\t}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.configuration.restClient.selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\theaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"aplication/json\",\n\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.configuration.restClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\theaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\thttpResponse, err := a.configuration.restClient.callAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)\n\n\treturn NewAPIResponse(httpResponse, err)\n\n}", "title": "" }, { "docid": "23ffb186df043b04561aeecf7351110b", "score": "0.5685474", "text": "func (a *DevicesApiService) DevicesDeviceIdInterfacesInterfaceNameOspfDelete(ctx context.Context, xAuthToken string, deviceId string, interfaceName string) (Status, *http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tsuccessPayload Status\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/devices/{deviceId}/interfaces/{interfaceName}/ospf\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"deviceId\"+\"}\", fmt.Sprintf(\"%v\", deviceId), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"interfaceName\"+\"}\", fmt.Sprintf(\"%v\", interfaceName), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.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\tlocalVarHeaderParams[\"x-auth-token\"] = parameterToString(xAuthToken, \"\")\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-auth-token\"] = key\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 successPayload, nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn successPayload, localVarHttpResponse, err\n\t}\n\tdefer localVarHttpResponse.Body.Close()\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tbodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)\n\t\treturn successPayload, localVarHttpResponse, reportError(\"Status: %v, Body: %s\", localVarHttpResponse.Status, bodyBytes)\n\t}\n\n\tif err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {\n\t\treturn successPayload, localVarHttpResponse, err\n\t}\n\n\treturn successPayload, localVarHttpResponse, err\n}", "title": "" }, { "docid": "d80e7873fe05beb4dba1d0aa6f83ec6c", "score": "0.5664642", "text": "func checkDeleteNetwork(t *testing.T, expError bool, tenant, network string) {\n\terr := contivClient.NetworkDelete(tenant, network)\n\tif err != nil && !expError {\n\t\tt.Fatalf(\"Error deleting network %s/%s. Err: %v\", tenant, network, err)\n\t} else if err == nil && expError {\n\t\tt.Fatalf(\"Delete network %s/%s succeeded while expecting error\", tenant, network)\n\t} else if err == nil {\n\t\t// verify network is gone\n\t\t_, err := contivClient.NetworkGet(tenant, network)\n\t\tif err == nil {\n\t\t\tt.Fatalf(\"Network %s/%s not deleted\", tenant, network)\n\t\t}\n\n\t\t// verify network state is gone too\n\t\tnetworkID := network + \".\" + tenant\n\t\tnwCfg := &mastercfg.CfgNetworkState{}\n\t\tnwCfg.StateDriver = stateStore\n\t\terr = nwCfg.Read(networkID)\n\t\tif err == nil {\n\t\t\tt.Fatalf(\"Network state %s not deleted\", networkID)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f64a818c5208fcfa1a667c57caf2c5e6", "score": "0.5656634", "text": "func (a NetApi) DeleteVlanInterfaces(id string) error {\n\n\tvar httpMethod = \"Delete\"\n\t// create path and map variables\n\tpath := a.configuration.BasePath + \"/tm/net/vlan/interfaces/{id}\"\n\tpath = strings.Replace(path, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\n\theaderParams := make(map[string]string)\n\tqueryParams := url.Values{}\n\tformParams := make(map[string]string)\n\tvar postBody interface{}\n\tvar fileName string\n\tvar fileBytes []byte\n\t// authentication '(token)' required\n\t// set key with prefix in header\n\theaderParams[\"X-F5-Auth-Token\"] = a.configuration.getAPIKeyWithPrefix(\"X-F5-Auth-Token\")\n\t// add default headers if any\n\tfor key := range a.configuration.DefaultHeader {\n\t\theaderParams[key] = a.configuration.DefaultHeader[key]\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\n\t\t\"application/json\",\n\t}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.configuration.restClient.selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\theaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"aplication/json\",\n\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.configuration.restClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\theaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\thttpResponse, err := a.configuration.restClient.callAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)\n\n\treturn NewAPIResponse(httpResponse, err)\n\n}", "title": "" }, { "docid": "e3a980c7d28d3b42d1c83dd55954a52d", "score": "0.5654264", "text": "func (a *PlatformApiService) PlatformNetworkAgentRemove(ctx context.Context, body []float64, networkId int32) (InlineResponse204, *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 InlineResponse204\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/api/platform/networks/{network_id}/agents/remove\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"network_id\"+\"}\", fmt.Sprintf(\"%v\", networkId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\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\t// body params\n\tlocalVarPostBody = &body\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 == 204 {\n\t\t\tvar v InlineResponse204\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"));\n\t\t\t\tif err != nil {\n\t\t\t\t\tnewErr.error = err.Error()\n\t\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t\t}\n\t\t\t\tnewErr.model = v\n\t\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": "0ed25d1a4f2f760182c400a877cb8077", "score": "0.565158", "text": "func TestDockerNetworkDeletePreferID(t *testing.T) {\n\tskip.If(t, versions.LessThan(testEnv.DaemonAPIVersion(), \"1.34\"), \"broken in earlier versions\")\n\tskip.If(t, testEnv.DaemonInfo.OSType == \"windows\",\n\t\t\"FIXME. Windows doesn't run DinD and uses networks shared between control daemon and daemon under test\")\n\tdefer setupTest(t)()\n\tclient := testEnv.APIClient()\n\tctx := context.Background()\n\ttestNet, idPrefixNet, fullIDNet := createAmbiguousNetworks(ctx, t, client)\n\n\t// Delete the network using a prefix of the first network's ID as name.\n\t// This should the network name with the id-prefix, not the original network.\n\terr := client.NetworkRemove(ctx, testNet[:12])\n\tassert.NilError(t, err)\n\n\t// Delete the network using networkID. This should remove the original\n\t// network, not the network with the name equal to the networkID\n\terr = client.NetworkRemove(ctx, testNet)\n\tassert.NilError(t, err)\n\n\t// networks \"testNet\" and \"idPrefixNet\" should be removed, but \"fullIDNet\" should still exist\n\tnws, err := client.NetworkList(ctx, types.NetworkListOptions{})\n\tassert.NilError(t, err)\n\tassert.Check(t, is.Equal(false, containsNetwork(nws, testNet)), \"Network testNet not removed\")\n\tassert.Check(t, is.Equal(false, containsNetwork(nws, idPrefixNet)), \"Network idPrefixNet not removed\")\n\tassert.Check(t, is.Equal(true, containsNetwork(nws, fullIDNet)), \"Network fullIDNet not found\")\n}", "title": "" }, { "docid": "33eec445fea3c223850497299e7d6e64", "score": "0.5647989", "text": "func (c *CNIService) deleteSubnetNetworkInterfaces(ec2Client *ec2.EC2, subnetID string) error {\n\ti := &ec2.DescribeNetworkInterfacesInput{\n\t\tFilters: []*ec2.Filter{\n\t\t\t{\n\t\t\t\tName: aws.String(\"subnet-id\"),\n\t\t\t\tValues: aws.StringSlice([]string{subnetID}),\n\t\t\t},\n\t\t},\n\t}\n\n\to, err := ec2Client.DescribeNetworkInterfaces(i)\n\tif err != nil {\n\t\tc.log.Error(err, \"failed to describe network interfaces\")\n\t\treturn err\n\t}\n\n\t//detach ENIs\n\tfor _, eni := range o.NetworkInterfaces {\n\t\tif eni.Attachment != nil {\n\t\t\tdetachInput := &ec2.DetachNetworkInterfaceInput{\n\t\t\t\tForce: aws.Bool(true),\n\t\t\t\tAttachmentId: eni.Attachment.AttachmentId,\n\t\t\t}\n\t\t\t// we ignore errors on detach in case the ENI was already detached or is detaching\n\t\t\t_, _ = ec2Client.DetachNetworkInterface(detachInput)\n\t\t}\n\n\t}\n\n\t//delete ENIs\n\tfor _, eni := range o.NetworkInterfaces {\n\t\tdelInput := &ec2.DeleteNetworkInterfaceInput{\n\t\t\tNetworkInterfaceId: eni.NetworkInterfaceId,\n\t\t}\n\n\t\t_, err := ec2Client.DeleteNetworkInterface(delInput)\n\t\tif err != nil {\n\t\t\tc.log.Error(err, fmt.Sprintf(\"failed to delete network interface %s\", *eni.NetworkInterfaceId))\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "52ced882a83880f36d9397b570b3b2a4", "score": "0.5633594", "text": "func (a *PlatformApiService) PlatformNetworkAgentRemoveDeprecated(ctx context.Context, networkId int32) (InlineResponse204, *http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue InlineResponse204\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/api/platform/networks/{network_id}/agents\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"network_id\"+\"}\", fmt.Sprintf(\"%v\", networkId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.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, 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 == 204 {\n\t\t\tvar v InlineResponse204\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"));\n\t\t\t\tif err != nil {\n\t\t\t\t\tnewErr.error = err.Error()\n\t\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t\t}\n\t\t\t\tnewErr.model = v\n\t\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": "f336e65c011eca153f91639414596aa5", "score": "0.56277335", "text": "func (*FakeNetsh) DeleteIPAddress(args []string) error {\n\t// Do Nothing\n\treturn nil\n}", "title": "" }, { "docid": "0c7df11f732ece6e01316417bb9751ae", "score": "0.56025434", "text": "func TestKicExistingNetwork(t *testing.T) {\n\tif !KicDriver() {\n\t\tt.Skip(\"only runs with docker driver\")\n\t}\n\t// create custom network\n\tnetworkName := \"existing-network\"\n\tif _, err := oci.CreateNetwork(oci.Docker, networkName, \"\", \"\"); err != nil {\n\t\tt.Fatalf(\"error creating network: %v\", err)\n\t}\n\tdefer func() {\n\t\tif err := oci.DeleteKICNetworksByLabel(oci.Docker, networkName); err != nil {\n\t\t\tt.Logf(\"error deleting kic network, may need to delete manually: %v\", err)\n\t\t}\n\t}()\n\tprofile := UniqueProfileName(\"existing-network\")\n\tctx, cancel := context.WithTimeout(context.Background(), Minutes(5))\n\tdefer Cleanup(t, profile, cancel)\n\n\tverifyNetworkExists(ctx, t, networkName)\n\n\tstartArgs := []string{\"start\", \"-p\", profile, fmt.Sprintf(\"--network=%s\", networkName)}\n\tc := exec.CommandContext(ctx, Target(), startArgs...)\n\trr, err := Run(t, c)\n\tif err != nil {\n\t\tt.Fatalf(\"%v failed: %v\\n%v\", rr.Command(), err, rr.Output())\n\t}\n}", "title": "" }, { "docid": "c6fde698d03320c64b03c2feb18c54b5", "score": "0.5580446", "text": "func (a *FrinxOpenconfigAclApiService) DeleteFrinxOpenconfigAclAclInterfacesInterface(ctx context.Context, id string, nodeId string) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-acl:acl/frinx-openconfig-acl:interfaces/frinx-openconfig-acl:interface/{id}/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\", \"application/xml\"}\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/xml\"}\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, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\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\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "title": "" }, { "docid": "2eee3b4df5070bc517de85ceadf06627", "score": "0.55715185", "text": "func (m *MockEC2Client) DetachNetworkInterfaceRequest(arg0 *ec2.DetachNetworkInterfaceInput) (*request.Request, *ec2.DetachNetworkInterfaceOutput) {\n\tret := m.ctrl.Call(m, \"DetachNetworkInterfaceRequest\", arg0)\n\tret0, _ := ret[0].(*request.Request)\n\tret1, _ := ret[1].(*ec2.DetachNetworkInterfaceOutput)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "cedc5037838c5c74f88cc39a75bf7250", "score": "0.5564641", "text": "func DeleteMCIRApiTest() {\n\n\tfmt.Print(\"\\n\\n============= DeleteMCIRApiTest() =============\\n\")\n\n\tlogger := logger.NewLogger()\n\n\tmcir := tb_api.NewMCIRManager()\n\n\terr := mcir.SetConfigPath(\"../../cbadm/grpc_conf.yaml\")\n\tif err != nil {\n\t\tlogger.Fatal(err)\n\t}\n\n\terr = mcir.Open()\n\tif err != nil {\n\t\tlogger.Fatal(err)\n\t}\n\n\tresult, err := mcir.DeleteSpecByParam(\"ns-test\", \"openstack-config01-test\", \"false\")\n\tif err != nil {\n\t\tlogger.Fatal(err)\n\t}\n\n\tfmt.Printf(\"\\nresult :\\n%s\\n\", result)\n\n\tresult, err = mcir.DeleteImageByParam(\"ns-test\", \"openstack-config01-test\", \"false\")\n\tif err != nil {\n\t\tlogger.Fatal(err)\n\t}\n\n\tfmt.Printf(\"\\nresult :\\n%s\\n\", result)\n\n\tresult, err = mcir.DeleteSshKeyByParam(\"ns-test\", \"openstack-config01-test\", \"false\")\n\tif err != nil {\n\t\tlogger.Fatal(err)\n\t}\n\n\tfmt.Printf(\"\\nresult :\\n%s\\n\", result)\n\n\tresult, err = mcir.DeleteSecurityGroupByParam(\"ns-test\", \"openstack-config01-test\", \"false\")\n\tif err != nil {\n\t\tlogger.Fatal(err)\n\t}\n\n\tfmt.Printf(\"\\nresult :\\n%s\\n\", result)\n\n\tresult, err = mcir.DeleteVNetByParam(\"ns-test\", \"openstack-config01-test\", \"false\")\n\tif err != nil {\n\t\tlogger.Fatal(err)\n\t}\n\n\tfmt.Printf(\"\\nresult :\\n%s\\n\", result)\n\n\tmcir.Close()\n}", "title": "" }, { "docid": "e94763632a4a0eff29a15fadb2c9fd05", "score": "0.5537726", "text": "func (m *MockEC2Client) DeleteInternetGatewayRequest(arg0 *ec2.DeleteInternetGatewayInput) (*request.Request, *ec2.DeleteInternetGatewayOutput) {\n\tret := m.ctrl.Call(m, \"DeleteInternetGatewayRequest\", arg0)\n\tret0, _ := ret[0].(*request.Request)\n\tret1, _ := ret[1].(*ec2.DeleteInternetGatewayOutput)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "4f29493c97bdcea784bc4f20a90b9c2c", "score": "0.5535912", "text": "func TestEc2APIHelper_SetDeleteOnTermination_Error(t *testing.T) {\n\tctrl := gomock.NewController(t)\n\tdefer ctrl.Finish()\n\n\tec2ApiHelper, mockWrapper := getMockWrapper(ctrl)\n\n\tmockWrapper.EXPECT().ModifyNetworkInterfaceAttribute(modifyNetworkInterfaceAttributeInput).\n\t\tReturn(nil, mockError)\n\n\terr := ec2ApiHelper.SetDeleteOnTermination(&attachmentId, &branchInterfaceId)\n\tassert.Error(t, mockError, err)\n}", "title": "" }, { "docid": "076d0c46a114dc04223c9b3f74847034", "score": "0.5521195", "text": "func (a *DevicesApiService) DevicesDeviceIdInterfacesInterfaceNameUnblockPost(ctx context.Context, xAuthToken string, deviceId string, interfaceName string) (Status, *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\tsuccessPayload Status\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/devices/{deviceId}/interfaces/{interfaceName}/unblock\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"deviceId\"+\"}\", fmt.Sprintf(\"%v\", deviceId), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"interfaceName\"+\"}\", fmt.Sprintf(\"%v\", interfaceName), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.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\tlocalVarHeaderParams[\"x-auth-token\"] = parameterToString(xAuthToken, \"\")\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-auth-token\"] = key\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 successPayload, nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn successPayload, localVarHttpResponse, err\n\t}\n\tdefer localVarHttpResponse.Body.Close()\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tbodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)\n\t\treturn successPayload, localVarHttpResponse, reportError(\"Status: %v, Body: %s\", localVarHttpResponse.Status, bodyBytes)\n\t}\n\n\tif err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {\n\t\treturn successPayload, localVarHttpResponse, err\n\t}\n\n\treturn successPayload, localVarHttpResponse, err\n}", "title": "" }, { "docid": "92c640519551d00c0517af95ac7fab6f", "score": "0.5517411", "text": "func TestNetworkAddDelete(t *testing.T) {\n\t// Basic vlan network\n\tcheckCreateNetwork(t, false, \"default\", \"contiv\", \"\", \"vlan\", \"10.1.1.1/24\", \"10.1.1.254\", 1, \"\", \"\")\n\tcheckInspectNetwork(t, false, \"default\", \"contiv\", \"10.1.1.254\", 1, 0)\n\tcheckInspectGlobal(t, false, \"1\", \"\")\n\tverifyNetworkState(t, \"default\", \"contiv\", \"data\", \"vlan\", \"10.1.1.1\", \"10.1.1.254\", 24, 1, 0, \"\", \"\", 0)\n\tcheckDeleteNetwork(t, false, \"default\", \"contiv\")\n\n\t// Basic Vxlan network\n\tcheckCreateNetwork(t, false, \"default\", \"contiv\", \"\", \"vxlan\", \"10.1.1.1/16\", \"10.1.1.254\", 1, \"\", \"\")\n\tcheckInspectNetwork(t, false, \"default\", \"contiv\", \"10.1.1.254\", 1, 0)\n\tcheckInspectGlobal(t, false, \"\", \"1\")\n\tverifyNetworkState(t, \"default\", \"contiv\", \"data\", \"vxlan\", \"10.1.1.1\", \"10.1.1.254\", 16, 1, 1, \"\", \"\", 0)\n\tcheckDeleteNetwork(t, false, \"default\", \"contiv\")\n\n\t// Basic network with '-' in the name\n\tcheckCreateNetwork(t, false, \"default\", \"contiv-valid\", \"\", \"vxlan\", \"10.1.1.1/16\", \"10.1.1.254\", 1, \"\", \"\")\n\tverifyNetworkState(t, \"default\", \"contiv-valid\", \"data\", \"vxlan\", \"10.1.1.1\", \"10.1.1.254\", 16, 1, 1, \"\", \"\", 0)\n\tcheckDeleteNetwork(t, false, \"default\", \"contiv-valid\")\n\n\t// Basic network without gateway\n\tcheckCreateNetwork(t, false, \"default\", \"contiv-gw\", \"\", \"vxlan\", \"10.1.1.1/16\", \"\", 1, \"\", \"\")\n\tcheckInspectNetwork(t, false, \"default\", \"contiv-gw\", \"\", 1, 0)\n\tcheckInspectGlobal(t, false, \"\", \"1\")\n\tverifyNetworkState(t, \"default\", \"contiv-gw\", \"data\", \"vxlan\", \"10.1.1.1\", \"\", 16, 1, 1, \"\", \"\", 0)\n\tcheckDeleteNetwork(t, false, \"default\", \"contiv-gw\")\n\n\t// Basic network with ipv6\n\tcheckCreateNetwork(t, false, \"default\", \"contiv-ipv6\", \"\", \"vxlan\", \"10.1.1.1/16\", \"\", 1, \"2016:0617::/120\", \"\")\n\tverifyNetworkState(t, \"default\", \"contiv-ipv6\", \"data\", \"vxlan\", \"10.1.1.1\", \"\", 16, 1, 1, \"2016:0617::\", \"\", 120)\n\tcheckDeleteNetwork(t, false, \"default\", \"contiv-ipv6\")\n\n\t// Infra vlan network create and delete\n\tcheckCreateNetwork(t, false, \"default\", \"infraNw\", \"infra\", \"vlan\", \"10.1.1.1/24\", \"10.1.1.254\", 1, \"\", \"\")\n\tcheckInspectNetwork(t, false, \"default\", \"infraNw\", \"10.1.1.254\", 1, 0)\n\tcheckInspectGlobal(t, false, \"1\", \"\")\n\ttime.Sleep(time.Second)\n\tverifyNetworkState(t, \"default\", \"infraNw\", \"infra\", \"vlan\", \"10.1.1.1\", \"10.1.1.254\", 24, 1, 0, \"\", \"\", 0)\n\tcheckDeleteNetwork(t, false, \"default\", \"infraNw\")\n\ttime.Sleep(time.Second)\n\n\t// Try creating network with invalid names\n\tcheckCreateNetwork(t, true, \"default\", \"contiv:invalid\", \"infra\", \"vlan\", \"10.1.1.1/24\", \"10.1.1.254\", 1, \"\", \"\")\n\tcheckCreateNetwork(t, true, \"default\", \"contiv|invalid\", \"infra\", \"vlan\", \"10.1.1.1/24\", \"10.1.1.254\", 1, \"\", \"\")\n\tcheckCreateNetwork(t, true, \"default\", \"-invalid\", \"infra\", \"vlan\", \"10.1.1.1/24\", \"10.1.1.254\", 1, \"\", \"\")\n\n\t// Try creating network with invalid network type\n\tcheckCreateNetwork(t, true, \"default\", \"infraNw\", \"infratest\", \"vlan\", \"10.1.1.1/24\", \"10.1.1.254\", 1, \"\", \"\")\n\tcheckCreateNetwork(t, true, \"default\", \"infraNw\", \"testinfra\", \"vlan\", \"10.1.1.1/24\", \"10.1.1.254\", 1, \"\", \"\")\n\tcheckCreateNetwork(t, true, \"default\", \"infraNw\", \"testdata\", \"vlan\", \"10.1.1.1/24\", \"10.1.1.254\", 1, \"\", \"\")\n\tcheckCreateNetwork(t, true, \"default\", \"infraNw\", \"datatest\", \"vlan\", \"10.1.1.1/24\", \"10.1.1.254\", 1, \"\", \"\")\n\n\t// Basic IP range network checks\n\tcheckCreateNetwork(t, false, \"default\", \"contiv\", \"data\", \"vxlan\", \"10.1.1.10-10.1.1.20/24\", \"10.1.1.254\", 1, \"\", \"\")\n\tverifyNetworkState(t, \"default\", \"contiv\", \"data\", \"vxlan\", \"10.1.1.10\", \"10.1.1.254\", 24, 1, 1, \"\", \"\", 0)\n\tcheckDeleteNetwork(t, false, \"default\", \"contiv\")\n\tcheckCreateNetwork(t, false, \"default\", \"contiv\", \"data\", \"vxlan\", \"10.1.1.10-10.1.5.254/16\", \"10.1.254.254\", 1, \"\", \"\")\n\tverifyNetworkState(t, \"default\", \"contiv\", \"data\", \"vxlan\", \"10.1.1.10\", \"10.1.254.254\", 16, 1, 1, \"\", \"\", 0)\n\tcheckDeleteNetwork(t, false, \"default\", \"contiv\")\n\n\t// Try invalid values for ip addr range\n\tcheckCreateNetwork(t, true, \"default\", \"contiv\", \"data\", \"vxlan\", \"10.1.1.10-20/24\", \"10.1.1.254\", 1, \"\", \"\")\n\tcheckCreateNetwork(t, true, \"default\", \"contiv\", \"data\", \"vxlan\", \"10.1.1.10-10.1.20/24\", \"10.1.1.254\", 1, \"\", \"\")\n\tcheckCreateNetwork(t, true, \"default\", \"contiv\", \"data\", \"vxlan\", \"10.1.1.10-10.1.1.1/24\", \"10.1.1.254\", 1, \"\", \"\")\n\tcheckCreateNetwork(t, true, \"default\", \"contiv\", \"data\", \"vxlan\", \"10.1.1.10-10.1.2.30/24\", \"10.1.1.254\", 1, \"\", \"\")\n\tcheckCreateNetwork(t, true, \"default\", \"contiv\", \"data\", \"vxlan\", \"10.1.1.10-10.2.1.30/16\", \"10.1.1.254\", 1, \"\", \"\")\n\tcheckCreateNetwork(t, true, \"default\", \"contiv\", \"data\", \"vxlan\", \"10.1.1.10-10.1.1.1.30/24\", \"10.1.1.254\", 1, \"\", \"\")\n\tcheckCreateNetwork(t, true, \"default\", \"contiv\", \"data\", \"vxlan\", \"10.1.1/24\", \"10.1.1.254\", 1, \"\", \"\")\n\tcheckCreateNetwork(t, true, \"default\", \"contiv\", \"data\", \"vxlan\", \"10.1.1.256/24\", \"10.1.1.254\", 1, \"\", \"\")\n\n\t// Try network create with invalid network range\n\tcheckCreateNetwork(t, true, \"default\", \"contiv\", \"data\", \"vxlan\", \"10.1.1.1-70/26\", \"10.1.1.63\", 1, \"\", \"\")\n\n\t// Try network create with invalid subnet length\n\tcheckCreateNetwork(t, true, \"default\", \"contiv\", \"data\", \"vxlan\", \"10.1.1.1/32\", \"10.1.1.1\", 1, \"\", \"\")\n\tcheckCreateNetwork(t, true, \"default\", \"contiv\", \"data\", \"vxlan\", \"10.1.1.1/24\", \"10.1.1.1\", 1, \"2016:0617::/128\", \"\")\n\n\t// try creating network without tenant\n\tcheckCreateNetwork(t, true, \"tenant1\", \"contiv\", \"data\", \"vxlan\", \"10.1.1.1/24\", \"10.1.1.254\", 1, \"\", \"\")\n\n\t// try invalid encap\n\tcheckCreateNetwork(t, true, \"default\", \"contiv\", \"data\", \"vvvv\", \"10.1.1.1/24\", \"10.1.1.254\", 1, \"\", \"\")\n\n\t// try invalid pkt tags\n\tcheckCreateNetwork(t, true, \"default\", \"contiv\", \"data\", \"vlan\", \"10.1.1.1/24\", \"10.1.1.254\", 5000, \"\", \"\")\n\tcheckCreateNetwork(t, true, \"default\", \"contiv\", \"data\", \"vxlan\", \"10.1.1.1/24\", \"10.1.1.254\", 20000, \"\", \"\")\n\n\t// Try gateway outside the network\n\tcheckCreateNetwork(t, true, \"default\", \"contiv\", \"data\", \"vxlan\", \"10.1.1.1/24\", \"10.1.2.254\", 1, \"\", \"\")\n\tcheckCreateNetwork(t, true, \"default\", \"contiv\", \"data\", \"vxlan\", \"10.1.1.65-70/26\", \"10.1.1.1\", 2, \"\", \"\")\n\n\t// Try deleting a non-existing network\n\tcheckDeleteNetwork(t, true, \"default\", \"contiv\")\n}", "title": "" }, { "docid": "4e44cce6fdbccf7ea085fd15bcebdb33", "score": "0.5485003", "text": "func (a *OCIInterfacesApiService) InstancesDeleteIp(ctx context.Context, id int32) (Object, *http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tsuccessPayload Object\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/instances/ip_addresses/{id}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.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{\n\t\t\"application/json\",\n\t\t\"text/json\",\n\t\t\"application/xml\",\n\t\t\"text/xml\",\n\t}\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, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn successPayload, nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn successPayload, localVarHttpResponse, err\n\t}\n\tdefer localVarHttpResponse.Body.Close()\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tbodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)\n\t\treturn successPayload, localVarHttpResponse, reportError(\"Status: %v, Body: %s\", localVarHttpResponse.Status, bodyBytes)\n\t}\n\n\tif err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {\n\t\treturn successPayload, localVarHttpResponse, err\n\t}\n\n\treturn successPayload, localVarHttpResponse, err\n}", "title": "" }, { "docid": "eb2a8c552e7765293870a6a43bd5ced0", "score": "0.5479347", "text": "func (p *PaloAlto) DeleteL3Interface(ifname string) error {\n\tvar reqError requestError\n\tvar xpath string\n\n\tif p.DeviceType == \"panorama\" {\n\t\treturn errors.New(\"you cannot delete interfaces on a Panorama device\")\n\t}\n\n\tifDetails := strings.Split(ifname, \".\")\n\tsubIntName := fmt.Sprintf(\"%s.%s\", ifDetails[0], ifDetails[1])\n\n\tif len(ifDetails[1]) > 0 {\n\t\txpath = fmt.Sprintf(\"/config/devices/entry[@name='localhost.localdomain']/network/interface/ethernet/entry[@name='%s']/layer3/units/entry[@name='%s']\", ifDetails[0], subIntName)\n\t} else {\n\t\txpath = fmt.Sprintf(\"/config/devices/entry[@name='localhost.localdomain']/network/interface/ethernet/entry[@name='%s']\", ifDetails[0])\n\t}\n\n\t_, resp, errs := r.Get(p.URI).Query(fmt.Sprintf(\"type=config&action=delete&xpath=%s&key=%s\", xpath, p.Key)).End()\n\tif errs != nil {\n\t\treturn errs[0]\n\t}\n\n\tif err := xml.Unmarshal([]byte(resp), &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": "f4ac744a9be7bcbd2497adae42089df8", "score": "0.5467379", "text": "func DeleteMCISApiTest() {\n\n\tfmt.Print(\"\\n\\n============= DeleteMCISApiTest() =============\\n\")\n\n\tlogger := logger.NewLogger()\n\n\tmcis := tb_api.NewMCISManager()\n\n\terr := mcis.SetConfigPath(\"../../cbadm/grpc_conf.yaml\")\n\tif err != nil {\n\t\tlogger.Fatal(err)\n\t}\n\n\terr = mcis.Open()\n\tif err != nil {\n\t\tlogger.Fatal(err)\n\t}\n\n\tresult, err := mcis.ControlMcisByParam(\"ns-test\", \"mcis-01\", \"terminate\")\n\tif err != nil {\n\t\tlogger.Fatal(err)\n\t}\n\n\tresult, err = mcis.DeleteMcisByParam(\"ns-test\", \"mcis-01\")\n\tif err != nil {\n\t\tlogger.Fatal(err)\n\t}\n\n\tfmt.Printf(\"\\nresult :\\n%s\\n\", result)\n\n\tmcis.Close()\n}", "title": "" }, { "docid": "25cf8b705e2c822a9dc9d3010b5bb86c", "score": "0.54663664", "text": "func (cnsClient *CNSClient) DeleteHostNCApipaEndpoint(networkContainerID string) error {\n\tvar body bytes.Buffer\n\n\thttpc := &http.Client{}\n\turl := cnsClient.connectionURL + cns.DeleteHostNCApipaEndpointPath\n\tlog.Printf(\"DeleteHostNCApipaEndpoint url: %v for NC: %s\", url, networkContainerID)\n\n\tpayload := &cns.DeleteHostNCApipaEndpointRequest{\n\t\tNetworkContainerID: networkContainerID,\n\t}\n\n\terr := json.NewEncoder(&body).Encode(payload)\n\tif err != nil {\n\t\tlog.Errorf(\"encoding json failed with %v\", err)\n\t\treturn err\n\t}\n\n\tres, err := httpc.Post(url, contentTypeJSON, &body)\n\tif err != nil {\n\t\tlog.Errorf(\"[Azure CNSClient] HTTP Post returned error %v\", err.Error())\n\t\treturn err\n\t}\n\n\tdefer res.Body.Close()\n\n\tif res.StatusCode != http.StatusOK {\n\t\terrMsg := fmt.Sprintf(\"[Azure CNSClient] DeleteHostNCApipaEndpoint: Invalid http status code: %v\",\n\t\t\tres.StatusCode)\n\t\tlog.Errorf(errMsg)\n\t\treturn fmt.Errorf(errMsg)\n\t}\n\n\tvar resp cns.DeleteHostNCApipaEndpointResponse\n\n\terr = json.NewDecoder(res.Body).Decode(&resp)\n\tif err != nil {\n\t\tlog.Errorf(\"[Azure CNSClient] Error parsing DeleteHostNCApipaEndpoint response resp: %v err: %v\",\n\t\t\tres.Body, err.Error())\n\t\treturn err\n\t}\n\n\tif resp.Response.ReturnCode != 0 {\n\t\tlog.Errorf(\"[Azure CNSClient] DeleteHostNCApipaEndpoint received error response :%v\", resp.Response.Message)\n\t\treturn fmt.Errorf(resp.Response.Message)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9a14fcba87a315af09058336c737ba17", "score": "0.546167", "text": "func ExampleNetworkClient_Delete() {\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 := armservicefabricmesh.NewClientFactory(\"<subscription-id>\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\t_, err = clientFactory.NewNetworkClient().Delete(ctx, \"sbz_demo\", \"sampleNetwork\", nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to finish the request: %v\", err)\n\t}\n}", "title": "" }, { "docid": "855da740ba469846da76593d394e0fea", "score": "0.54580903", "text": "func (net VnetIn) DeleteVirtualNetwork() (ar autorest.Response, err error) {\n\tvnetClient := getVnetClient()\n\tfuture, err := vnetClient.Delete(\n\t\tctx,\n\t\tnet.ResourceGroup,\n\t\tnet.VnetName,\n\t)\n\n\tif err != nil {\n\t\treturn ar, fmt.Errorf(\"cannot delete virtual network: %v\", err)\n\t}\n\n\terr = future.WaitForCompletion(ctx, vnetClient.Client)\n\tif err != nil {\n\t\treturn ar, fmt.Errorf(\"cannot get the vnet create or update future response: %v\", err)\n\t}\n\n\treturn future.Result(vnetClient)\n}", "title": "" }, { "docid": "fd5f33537e79a2d315da8cc22b74b4ff", "score": "0.5457958", "text": "func (a NetApi) DeleteIpsecIkePeer(id string) error {\n\n\tvar httpMethod = \"Delete\"\n\t// create path and map variables\n\tpath := a.configuration.BasePath + \"/tm/net/ipsec/ikePeer/{id}\"\n\tpath = strings.Replace(path, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\n\theaderParams := make(map[string]string)\n\tqueryParams := url.Values{}\n\tformParams := make(map[string]string)\n\tvar postBody interface{}\n\tvar fileName string\n\tvar fileBytes []byte\n\t// authentication '(token)' required\n\t// set key with prefix in header\n\theaderParams[\"X-F5-Auth-Token\"] = a.configuration.getAPIKeyWithPrefix(\"X-F5-Auth-Token\")\n\t// add default headers if any\n\tfor key := range a.configuration.DefaultHeader {\n\t\theaderParams[key] = a.configuration.DefaultHeader[key]\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\n\t\t\"application/json\",\n\t}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.configuration.restClient.selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\theaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"aplication/json\",\n\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.configuration.restClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\theaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\thttpResponse, err := a.configuration.restClient.callAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)\n\n\treturn NewAPIResponse(httpResponse, err)\n\n}", "title": "" }, { "docid": "5783fdcc0d8484819cf91af7764df464", "score": "0.54551446", "text": "func (s *Stack) DeleteNetwork(id string) error {\n\t// Reads NIS that belong to the subnet\n\treadNicsRequest := osc.ReadNicsRequest{\n\t\tFilters: osc.FiltersNic{\n\t\t\tSubnetIds: []string{id},\n\t\t},\n\t}\n\tres, _, err := s.client.NicApi.ReadNics(\n\t\ts.auth, &osc.ReadNicsOpts{\n\t\t\tReadNicsRequest: optional.NewInterface(readNicsRequest),\n\t\t},\n\t)\n\tif err != nil {\n\t\tlogrus.Debugf(\"Error reading NICS: %v\", normalizeError(err))\n\t}\n\n\tif len(res.Nics) > 0 {\n\t\t// Delete should succeed only when something goes wrong when deleting VMs\n\t\terr = s.deleteNics(res.Nics)\n\t\tif err == nil {\n\t\t\tlogrus.Debugf(\"Check if nothing goes wrong deleting a VM\")\n\t\t}\n\t}\n\n\treturn s.deleteSubnet(id)\n}", "title": "" }, { "docid": "b4f8c0411526fd24ac62abc0460b1f2f", "score": "0.54230237", "text": "func TestEC2APIHelper_AttachNetworkInterfaceToInstance(t *testing.T) {\n\tctrl := gomock.NewController(t)\n\tdefer ctrl.Finish()\n\n\tec2ApiHelper, mockWrapper := getMockWrapper(ctrl)\n\n\tmockWrapper.EXPECT().AttachNetworkInterface(attachNetworkInterfaceInput).\n\t\tReturn(attachNetworkInterfaceOutput, nil)\n\n\tid, err := ec2ApiHelper.AttachNetworkInterfaceToInstance(&instanceId, &branchInterfaceId, &deviceIndex)\n\tassert.NoError(t, err)\n\tassert.Equal(t, attachmentId, *id)\n}", "title": "" }, { "docid": "e187f8bfd12fd4854bbdb9c80f4ab98e", "score": "0.5398943", "text": "func (s *Service) Delete(ctx context.Context, spec azure.Spec) error {\n\tsubnetSpec, ok := spec.(*Spec)\n\tif !ok {\n\t\treturn errors.New(\"Invalid Subnet Specification\")\n\t}\n\tklog.V(2).Infof(\"deleting subnet %s in vnet %s\", subnetSpec.Name, subnetSpec.VnetName)\n\tf, err := s.Client.Delete(ctx, s.Scope.ClusterConfig.ResourceGroup, subnetSpec.VnetName, subnetSpec.Name)\n\tif err != nil && azure.ResourceNotFound(err) {\n\t\t// already deleted\n\t\treturn nil\n\t}\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"failed to delete route table %s in resource group %s\", subnetSpec.Name, s.Scope.ClusterConfig.ResourceGroup)\n\t}\n\n\terr = f.WaitForCompletionRef(ctx, s.Client.Client)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"cannot create, future response\")\n\t}\n\n\t_, err = f.Result(s.Client)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"result error\")\n\t}\n\tklog.V(2).Infof(\"successfully deleted subnet %s in vnet %s\", subnetSpec.Name, subnetSpec.VnetName)\n\treturn err\n}", "title": "" }, { "docid": "972f9f1f7a1531dfcfceceb952f34ff6", "score": "0.53945893", "text": "func (a *Client) PortsetInterfaceDelete(params *PortsetInterfaceDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PortsetInterfaceDeleteOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewPortsetInterfaceDeleteParams()\n\t}\n\top := &runtime.ClientOperation{\n\t\tID: \"portset_interface_delete\",\n\t\tMethod: \"DELETE\",\n\t\tPathPattern: \"/protocols/san/portsets/{portset.uuid}/interfaces/{uuid}\",\n\t\tProducesMediaTypes: []string{\"application/hal+json\", \"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/hal+json\", \"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &PortsetInterfaceDeleteReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t}\n\tfor _, opt := range opts {\n\t\topt(op)\n\t}\n\n\tresult, err := a.transport.Submit(op)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*PortsetInterfaceDeleteOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\tunexpectedSuccess := result.(*PortsetInterfaceDeleteDefault)\n\treturn nil, runtime.NewAPIError(\"unexpected success response: content available as default response in error\", unexpectedSuccess, unexpectedSuccess.Code())\n}", "title": "" }, { "docid": "dd8f77102ff11ff53137fad236ac34e6", "score": "0.53903705", "text": "func (img *DeleteImageInput) DeleteImage() (DeleteImageResponse, error) {\n\n\tif status := support.DoesCloudSupports(strings.ToLower(img.Cloud.Name)); status != true {\n\t\treturn DeleteImageResponse{}, fmt.Errorf(common.DefaultCloudResponse + \"DeleteImage\")\n\t}\n\n\tswitch strings.ToLower(img.Cloud.Name) {\n\tcase \"aws\":\n\n\t\tcreds, crderr := common.GetCredentials(&common.GetCredentialsInput{Profile: img.Cloud.Profile, Cloud: img.Cloud.Name})\n\t\tif crderr != nil {\n\t\t\treturn DeleteImageResponse{}, crderr\n\t\t}\n\t\t// I will establish session so that we can carry out the process in cloud\n\t\tsession_input := awssess.CreateSessionInput{Region: img.Cloud.Region, KeyId: creds.KeyId, AcessKey: creds.SecretAccess}\n\t\tsess := session_input.CreateAwsSession()\n\n\t\t//authorizing to request further\n\t\tauthinpt := auth.EstablishConnectionInput{Region: img.Cloud.Region, Resource: \"ec2\", Session: sess}\n\n\t\tdelimages := new(image.DeleteImageInput)\n\t\tdelimages.ImageIds = img.ImageIds\n\t\tresult, err := delimages.DeleteImage(authinpt)\n\t\tif err != nil {\n\t\t\treturn DeleteImageResponse{}, err\n\t\t}\n\t\tresponse := make([]image.ImageResponse, 0)\n\t\tresponse = append(response, result)\n\t\treturn DeleteImageResponse{AwsResponse: response}, nil\n\n\tcase \"azure\":\n\t\treturn DeleteImageResponse{}, fmt.Errorf(common.DefaultAzResponse)\n\tcase \"gcp\":\n\t\treturn DeleteImageResponse{}, fmt.Errorf(common.DefaultGcpResponse)\n\tcase \"openstack\":\n\t\treturn DeleteImageResponse{}, fmt.Errorf(common.DefaultOpResponse)\n\tdefault:\n\n\t\tlog.Info(\"\")\n\t\tlog.Error(common.DefaultCloudResponse + \"DeleteImage\")\n\t\tlog.Info(\"\")\n\t\treturn DeleteImageResponse{}, fmt.Errorf(common.DefaultCloudResponse + \"GetImage\")\n\t}\n}", "title": "" }, { "docid": "d175012176136f8568c9c257d0b830ae", "score": "0.5387117", "text": "func cmdDel(args *skel.CmdArgs) error {\n\tconf, err := parseConfig(args.StdinData)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif args.Netns == \"\" {\n\t\treturn nil\n\t}\n\n\t// There is a netns so try to clean up. Delete can be called multiple times\n\t// so don't return an error if the device is already removed.\n\t// If the device isn't there then don't try to clean up IP masq either.\n\tvar ipnets []netlink.Addr\n\terr = ns.WithNetNSPath(args.Netns, func(_ ns.NetNS) error {\n\t\tvar err error\n\n\t\t// lookup pod IPs from the args.IfName device (usually eth0)\n\t\tif conf.IPMasq {\n\t\t\tiface, err := netlink.LinkByName(args.IfName)\n\t\t\tif err != nil {\n\t\t\t\tif err.Error() == \"Link not found\" {\n\t\t\t\t\treturn ip.ErrLinkNotFound\n\t\t\t\t}\n\t\t\t\treturn fmt.Errorf(\"failed to lookup %q: %v\", args.IfName, err)\n\t\t\t}\n\n\t\t\tipnets, err = netlink.AddrList(iface, netlink.FAMILY_ALL)\n\t\t\tif err != nil || len(ipnets) == 0 {\n\t\t\t\treturn fmt.Errorf(\"failed to get IP addresses for %q: %v\", args.IfName, err)\n\t\t\t}\n\t\t}\n\n\t\t// rm the veth device\n\t\terr = ip.DelLinkByName(conf.ContainerInterface)\n\t\tif err != nil && err != ip.ErrLinkNotFound {\n\t\t\treturn err\n\t\t}\n\n\t\treturn nil\n\t})\n\n\tif err != nil {\n\t\tfmt.Fprintln(os.Stderr, \"ptp container interface teardown error: %v\", err)\n\t}\n\n\tif conf.IPMasq {\n\t\tchain := utils.FormatChainName(conf.Name, args.ContainerID)\n\t\tcomment := utils.FormatComment(conf.Name, args.ContainerID)\n\t\tfor _, ipn := range ipnets {\n\t\t\taddrBits := 128\n\t\t\tif ipn.IP.To4() != nil {\n\t\t\t\taddrBits = 32\n\t\t\t}\n\n\t\t\terr = ip.TeardownIPMasq(&net.IPNet{IP: ipn.IP, Mask: net.CIDRMask(addrBits, addrBits)}, chain, comment)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c6ac5aa5fcad94d2a55f003f95e12c40", "score": "0.5376664", "text": "func (az *AzureProvider) destroyNIC(ctx context.Context, nicName string) (err error) {\n\t_, err = az.nicClient.Delete(ctx, az.resourceGroupName, nicName)\n\tif errorCheck(err) {\n\t\tlog.Printf(\"failed to delete nic %s: %s\", nicName, err)\n\t\treturn\n\t}\n\treturn\n}", "title": "" }, { "docid": "799cb4a21484a4fb70bfb2e3b578e0b9", "score": "0.5365358", "text": "func (n *ovn) Delete(clientType request.ClientType) error {\n\tn.logger.Debug(\"Delete\", logger.Ctx{\"clientType\": clientType})\n\n\terr := n.Stop()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif clientType == request.ClientTypeNormal {\n\t\tclient, err := openvswitch.NewOVN(n.state)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Failed to get OVN client: %w\", err)\n\t\t}\n\n\t\terr = client.LogicalRouterDelete(n.getRouterName())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\terr = client.LogicalSwitchDelete(n.getExtSwitchName())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\terr = client.LogicalSwitchDelete(n.getIntSwitchName())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\terr = client.AddressSetDelete(acl.OVNIntSwitchPortGroupAddressSetPrefix(n.ID()))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\terr = client.LogicalRouterPortDelete(n.getRouterExtPortName())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\terr = client.LogicalRouterPortDelete(n.getRouterIntPortName())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\terr = client.LogicalSwitchPortDelete(n.getExtSwitchRouterPortName())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\terr = client.LogicalSwitchPortDelete(n.getExtSwitchProviderPortName())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\terr = client.LogicalSwitchPortDelete(n.getIntSwitchRouterPortName())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Must be done after logical router removal.\n\t\terr = client.ChassisGroupDelete(n.getChassisGroupName())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Check for port groups that will become unused (and need deleting) as this network is deleted.\n\t\tsecurityACLs := shared.SplitNTrimSpace(n.config[\"security.acls\"], \",\", -1, true)\n\t\tif len(securityACLs) > 0 {\n\t\t\terr = acl.OVNPortGroupDeleteIfUnused(n.state, n.logger, client, n.project, &api.Network{Name: n.name}, \"\")\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"Failed removing unused OVN port groups: %w\", err)\n\t\t\t}\n\t\t}\n\n\t\t// Delete any network forwards and load balancers.\n\t\tmemberSpecific := false // OVN doesn't support per-member forwards.\n\t\tforwardListenAddresses, err := n.state.DB.Cluster.GetNetworkForwardListenAddresses(n.ID(), memberSpecific)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Failed loading network forwards: %w\", err)\n\t\t}\n\n\t\tloadBalancerListenAddresses, err := n.state.DB.Cluster.GetNetworkLoadBalancerListenAddresses(n.ID(), memberSpecific)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Failed loading network forwards: %w\", err)\n\t\t}\n\n\t\tloadBalancers := make([]openvswitch.OVNLoadBalancer, 0, len(forwardListenAddresses)+len(loadBalancerListenAddresses))\n\t\tfor _, listenAddress := range forwardListenAddresses {\n\t\t\tloadBalancers = append(loadBalancers, n.getLoadBalancerName(listenAddress))\n\t\t}\n\n\t\tfor _, listenAddress := range loadBalancerListenAddresses {\n\t\t\tloadBalancers = append(loadBalancers, n.getLoadBalancerName(listenAddress))\n\t\t}\n\n\t\terr = client.LoadBalancerDelete(loadBalancers...)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Failed deleting network forwards and load balancers: %w\", err)\n\t\t}\n\t}\n\n\treturn n.common.delete(clientType)\n}", "title": "" }, { "docid": "a462fb953fed178eaf311e780795d789", "score": "0.5360983", "text": "func (wintun *Interface) DeleteInterface() (rebootRequired bool, err error) {\n\tdevInfo, devInfoData, err := wintun.devInfoData()\n\tif err == windows.ERROR_OBJECT_NOT_FOUND {\n\t\treturn false, nil\n\t}\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tdefer devInfo.Close()\n\n\t// Remove the device.\n\tremoveDeviceParams := setupapi.RemoveDeviceParams{\n\t\tClassInstallHeader: *setupapi.MakeClassInstallHeader(setupapi.DIF_REMOVE),\n\t\tScope: setupapi.DI_REMOVEDEVICE_GLOBAL,\n\t}\n\n\t// Set class installer parameters for DIF_REMOVE.\n\terr = devInfo.SetClassInstallParams(devInfoData, &removeDeviceParams.ClassInstallHeader, uint32(unsafe.Sizeof(removeDeviceParams)))\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"SetupDiSetClassInstallParams failed: %v\", err)\n\t}\n\n\t// Call appropriate class installer.\n\terr = devInfo.CallClassInstaller(setupapi.DIF_REMOVE, devInfoData)\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"SetupDiCallClassInstaller failed: %v\", err)\n\t}\n\n\treturn checkReboot(devInfo, devInfoData), nil\n}", "title": "" }, { "docid": "5ccac4b9432319f4b7b4a55b9bfb28c0", "score": "0.53471696", "text": "func testNetworkOfVM(t *testing.T, terraformOptions *terraform.Options, subscriptionID string) {\n\t// Run `terraform output` to get the values of output variables.\n\tresourceGroupName := terraform.Output(t, terraformOptions, \"resource_group_name\")\n\tvirtualMachineName := terraform.Output(t, terraformOptions, \"vm_name\")\n\texpectedVNetName := terraform.Output(t, terraformOptions, \"virtual_network_name\")\n\texpectedSubnetName := terraform.Output(t, terraformOptions, \"subnet_name\")\n\texpectedPublicAddressName := terraform.Output(t, terraformOptions, \"public_ip_name\")\n\texpectedNicName := terraform.Output(t, terraformOptions, \"network_interface_name\")\n\texpectedPrivateIPAddress := terraform.Output(t, terraformOptions, \"private_ip\")\n\n\t// VirtualNetwork and Subnet tests\n\t// Check the Subnet exists in the Virtual Network.\n\tactualVnetSubnets := azure.GetVirtualNetworkSubnets(t, expectedVNetName, resourceGroupName, subscriptionID)\n\tassert.NotNil(t, actualVnetSubnets[expectedVNetName])\n\n\t// Check the Private IP is in the Subnet Range.\n\tactualVMNicIPInSubnet := azure.CheckSubnetContainsIP(t, expectedPrivateIPAddress, expectedSubnetName, expectedVNetName, resourceGroupName, subscriptionID)\n\tassert.True(t, actualVMNicIPInSubnet)\n\n\t// Network Interface Card tests\n\t// Check the VM Network Interface exists in the list of all VM Network Interfaces.\n\tactualNics := azure.GetVirtualMachineNics(t, virtualMachineName, resourceGroupName, subscriptionID)\n\tassert.Contains(t, actualNics, expectedNicName)\n\n\t// Check the Network Interface count of the VM.\n\texpectedNICCount := 1\n\tassert.Equal(t, expectedNICCount, len(actualNics))\n\n\t// Check for the Private IP in the NICs IP list.\n\tactualPrivateIPAddress := azure.GetNetworkInterfacePrivateIPs(t, expectedNicName, resourceGroupName, subscriptionID)\n\tassert.Contains(t, actualPrivateIPAddress, expectedPrivateIPAddress)\n\n\t// Public IP Address test\n\t// Check for the Public IP for the NIC. No expected value since it is assigned runtime.\n\tactualPublicIP := azure.GetIPOfPublicIPAddressByName(t, expectedPublicAddressName, resourceGroupName, subscriptionID)\n\tassert.NotNil(t, actualPublicIP)\n\n}", "title": "" }, { "docid": "03bb9fe306a61e24018fa2be615c0799", "score": "0.5342986", "text": "func (c *Client) DeleteNetwork(ctx context.Context, dnr DeleteNetworkRequest) error {\n\treq, err := c.buildRequest(ctx, dnr)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"building request\")\n\t}\n\n\tresp, err := c.httpClient.Do(req) // nolint:govet // the shadow is intentional\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"submitting request\")\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn die(resp.StatusCode, resp.Header, resp.Body, req.URL.Path)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e128df0ea12b8c3c887047e3671d6530", "score": "0.5339069", "text": "func TestEc2APIHelper_SetDeleteOnTermination(t *testing.T) {\n\tctrl := gomock.NewController(t)\n\tdefer ctrl.Finish()\n\n\tec2ApiHelper, mockWrapper := getMockWrapper(ctrl)\n\n\tmockWrapper.EXPECT().ModifyNetworkInterfaceAttribute(modifyNetworkInterfaceAttributeInput).\n\t\tReturn(nil, nil)\n\n\terr := ec2ApiHelper.SetDeleteOnTermination(&attachmentId, &branchInterfaceId)\n\tassert.NoError(t, err)\n}", "title": "" }, { "docid": "68817a1eea6b5fbccab176b1655fa117", "score": "0.53384274", "text": "func (a *Client) IgroupDelete(params *IgroupDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*IgroupDeleteOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewIgroupDeleteParams()\n\t}\n\top := &runtime.ClientOperation{\n\t\tID: \"igroup_delete\",\n\t\tMethod: \"DELETE\",\n\t\tPathPattern: \"/protocols/san/igroups/{uuid}\",\n\t\tProducesMediaTypes: []string{\"application/hal+json\", \"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/hal+json\", \"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &IgroupDeleteReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t}\n\tfor _, opt := range opts {\n\t\topt(op)\n\t}\n\n\tresult, err := a.transport.Submit(op)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*IgroupDeleteOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\tunexpectedSuccess := result.(*IgroupDeleteDefault)\n\treturn nil, runtime.NewAPIError(\"unexpected success response: content available as default response in error\", unexpectedSuccess, unexpectedSuccess.Code())\n}", "title": "" }, { "docid": "bf14e42dfa5e4d2256db685ead5aa8cb", "score": "0.5337578", "text": "func DeleteNetworkIpam(t *testing.T, s services.WriteService, id string) {\n\tresp, err := s.DeleteNetworkIpam(context.Background(), &services.DeleteNetworkIpamRequest{ID: id})\n\trequire.NoError(\n\t\tt,\n\t\terr,\n\t\tfmt.Sprintf(\"deleting NetworkIpam failed\\n UUID: %+v\\n \"+\n\t\t\t\"response: %+v\\n\", id, resp),\n\t)\n}", "title": "" }, { "docid": "01c57fe46c38ba3c97e5482fdf95aa20", "score": "0.5335533", "text": "func (f *FakeOSClient) DeleteNetwork(networkName string) error {\n\tf.appendCalled(\"DeleteNetwork\", networkName)\n\tif err := f.getError(\"DeleteNetwork\"); err != nil {\n\t\treturn err\n\t}\n\n\tf.deleteRouter(networkName)\n\tf.deleteSubnet(networkName + \"-subnet\")\n\tf.deleteNetwork(networkName)\n\treturn nil\n}", "title": "" }, { "docid": "f6437a195405a6eaabe8c97bfa820db1", "score": "0.5324329", "text": "func (s *TestSuite) TestUpdateDelete(t *testing.T) {\n\tctx, cancel := gnmiutils.MakeContext()\n\tdefer cancel()\n\n\t// Get the first configured simulator from the environment.\n\tsimulator := gnmiutils.CreateSimulator(ctx, t)\n\tdefer gnmiutils.DeleteSimulator(t, simulator)\n\n\t// Make a GNMI client to use for requests\n\tgnmiClient := gnmiutils.NewOnosConfigGNMIClientOrFail(ctx, t, gnmiutils.NoRetry)\n\n\t// Create interface tree using gNMI client\n\tsetNamePath := []proto.TargetPath{\n\t\t{TargetName: simulator.Name(), Path: udtestNamePath, PathDataValue: udtestNameValue, PathDataType: proto.StringVal},\n\t}\n\tvar setReq = &gnmiutils.SetRequest{\n\t\tCtx: ctx,\n\t\tClient: gnmiClient,\n\t\tExtensions: gnmiutils.SyncExtension(t),\n\t\tEncoding: gnmiapi.Encoding_PROTO,\n\t\tUpdatePaths: setNamePath,\n\t}\n\tsetReq.SetOrFail(t)\n\n\tvar getConfigReq = &gnmiutils.GetRequest{\n\t\tCtx: ctx,\n\t\tClient: gnmiClient,\n\t\tEncoding: gnmiapi.Encoding_PROTO,\n\t}\n\tgetConfigReq.Paths = setNamePath\n\tgetConfigReq.CheckValue(t, udtestNameValue)\n\n\t// Set initial values for Enabled and Description using gNMI client\n\tsetInitialValuesPath := []proto.TargetPath{\n\t\t{TargetName: simulator.Name(), Path: udtestEnabledPath, PathDataValue: \"true\", PathDataType: proto.BoolVal},\n\t\t{TargetName: simulator.Name(), Path: udtestDescriptionPath, PathDataValue: udtestDescriptionValue, PathDataType: proto.StringVal},\n\t}\n\tsetReq.UpdatePaths = setInitialValuesPath\n\tsetReq.SetOrFail(t)\n\n\t// Update Enabled, delete Description using gNMI client\n\tupdateEnabledPath := []proto.TargetPath{\n\t\t{TargetName: simulator.Name(), Path: udtestEnabledPath, PathDataValue: \"false\", PathDataType: proto.BoolVal},\n\t}\n\tdeleteDescriptionPath := []proto.TargetPath{\n\t\t{TargetName: simulator.Name(), Path: udtestDescriptionPath},\n\t}\n\tsetReq.UpdatePaths = updateEnabledPath\n\tsetReq.DeletePaths = deleteDescriptionPath\n\tsetReq.SetOrFail(t)\n\n\t// Check that the Enabled value is set correctly\n\tgetConfigReq.Paths = updateEnabledPath\n\tgetConfigReq.CheckValue(t, \"false\")\n\n\t// Make sure Description got removed\n\tgetConfigReq.Paths = gnmiutils.GetTargetPath(simulator.Name(), udtestDescriptionPath)\n\tgetConfigReq.CheckValue(t, \"\")\n}", "title": "" }, { "docid": "68091195c073f51dd75e41c5da655519", "score": "0.53229946", "text": "func Test_Networking_PrivateEndpoint_WithoutAutoApproval_CRUD(t *testing.T) {\n\tt.Parallel()\n\n\ttc := globalTestContext.ForTest(t)\n\n\trg := tc.CreateTestResourceGroupAndWait()\n\n\tsaKind := storage.StorageAccount_Kind_Spec_BlobStorage\n\tsa := newStorageAccount(tc, rg)\n\tsa.Spec.Kind = &saKind\n\n\tvnet := newVMVirtualNetwork(tc, testcommon.AsOwner(rg))\n\tsubnet := newVMSubnet(tc, testcommon.AsOwner(vnet))\n\tendpoint := &network.PrivateEndpoint{\n\t\tObjectMeta: tc.MakeObjectMeta(\"endpoint\"),\n\t\tSpec: network.PrivateEndpoint_Spec{\n\t\t\tLocation: tc.AzureRegion,\n\t\t\tOwner: testcommon.AsOwner(rg),\n\t\t\tManualPrivateLinkServiceConnections: []network.PrivateLinkServiceConnection{\n\t\t\t\t{\n\t\t\t\t\tName: to.Ptr(\"testEndpoint\"),\n\t\t\t\t\tPrivateLinkServiceReference: tc.MakeReferenceFromResource(sa),\n\t\t\t\t\tGroupIds: []string{\"blob\"},\n\t\t\t\t},\n\t\t\t},\n\t\t\tSubnet: &network.Subnet_PrivateEndpoint_SubResourceEmbedded{\n\t\t\t\tReference: tc.MakeReferenceFromResource(subnet),\n\t\t\t},\n\t\t},\n\t}\n\n\ttc.CreateResourcesAndWait(sa, vnet, subnet)\n\ttc.Expect(sa.Status.Id).ToNot(BeNil())\n\n\ttc.CreateResourceAndWaitForState(endpoint, metav1.ConditionFalse, conditions.ConditionSeverityWarning)\n\ttc.Expect(endpoint.Status.Id).ToNot(BeNil())\n\tarmId := *endpoint.Status.Id\n\n\ttc.DeleteResourceAndWait(endpoint)\n\n\t// Ensure delete\n\texists, retryAfter, err := tc.AzureClient.HeadByID(tc.Ctx, armId, string(network.APIVersion_Value))\n\ttc.Expect(err).ToNot(HaveOccurred())\n\ttc.Expect(retryAfter).To(BeZero())\n\ttc.Expect(exists).To(BeFalse())\n}", "title": "" }, { "docid": "fd766a15ea2b6fdbedaab92e1cbe3b23", "score": "0.5315055", "text": "func (a *Client) DestroyNetwork(params *DestroyNetworkParams) (*DestroyNetworkOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewDestroyNetworkParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"destroyNetwork\",\n\t\tMethod: \"DELETE\",\n\t\tPathPattern: \"/networking/{networkID}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &DestroyNetworkReader{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.(*DestroyNetworkOK)\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 destroyNetwork: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "6810d8cf15a6c3a13ed7cd79078e2016", "score": "0.5310506", "text": "func HandleDisassociateSuccessfully(t *testing.T) {\n\tth.Mux.HandleFunc(\"/servers/4d8c3732-a248-40ed-bebc-539a6ffd25c0/action\", func(w http.ResponseWriter, r *http.Request) {\n\t\tth.TestMethod(t, r, \"POST\")\n\t\tth.TestHeader(t, r, \"X-Auth-Token\", client.TokenID)\n\t\tth.TestJSONRequest(t, r, `\n{\n\t\"removeFloatingIp\": {\n\t\t\"address\": \"10.10.10.2\"\n\t}\n}\n`)\n\n\t\tw.WriteHeader(http.StatusAccepted)\n\t})\n}", "title": "" }, { "docid": "a99f09cafe1c7d5c7c3ea4326c23e2b7", "score": "0.529147", "text": "func TestDeleteRemote(t *testing.T) {\n\ts := newScaffold(t)\n\tdefer s.reset()\n\td := &dg{cmValue: \"baz\", secretValue: \"baz\"}\n\ts.client.getFunc = d.get\n\ts.client.listFunc = stdLister\n\ts.client.deleteFunc = func(ctx context.Context, obj model.K8sMeta, opts remote.DeleteOptions) (*remote.SyncResult, error) {\n\t\treturn &remote.SyncResult{Type: remote.SyncDeleted}, nil\n\t}\n\terr := s.executeCommand(\"delete\", \"dev\")\n\trequire.NoError(t, err)\n\tstats := s.outputStats()\n\ta := assert.New(t)\n\ta.EqualValues([]interface{}{\"Deployment:bar-system:svc2-previous-deploy\", \"Deployment:bar-system:svc2-deploy\"}, stats[\"deleted\"])\n}", "title": "" }, { "docid": "8b23d8073aad7674d2c0779e384b9961", "score": "0.5289751", "text": "func TestEC2APIHelper_AttachNetworkInterfaceToInstance_NoAttachmentId(t *testing.T) {\n\tctrl := gomock.NewController(t)\n\tdefer ctrl.Finish()\n\n\tec2ApiHelper, mockWrapper := getMockWrapper(ctrl)\n\n\tmockWrapper.EXPECT().AttachNetworkInterface(attachNetworkInterfaceInput).\n\t\tReturn(&ec2.AttachNetworkInterfaceOutput{AttachmentId: nil}, nil)\n\n\t_, err := ec2ApiHelper.AttachNetworkInterfaceToInstance(&instanceId, &branchInterfaceId, &deviceIndex)\n\tassert.NotNil(t, err)\n}", "title": "" }, { "docid": "71dccef232d2127ef9ae931542bc0783", "score": "0.528825", "text": "func TestLifecycleDeleteIntegration(t *testing.T) {\n\tkubeconfig := getKubeConfig()\n\tconfig, err := clientcmd.BuildConfigFromFlags(\"\", kubeconfig)\n\tif err != nil {\n\t\tt.Fatal(\"Could not get configuration file\")\n\t}\n\t// Create BitcoinNetwork client set\n\tc, err := clientset.NewForConfig(config)\n\tif err != nil {\n\t\tt.Fatal(\"Could not create BitcoinNetwork clientset\")\n\t}\n\tclient := c.BitcoincontrollerV1()\n\t// Delete network again that we created in the previous test case\n\terr = client.BitcoinNetworks(\"default\").Delete(\"my-test-network\", &metav1.DeleteOptions{})\n\tif err != nil {\n\t\tt.Errorf(\"Could not delete test network\")\n\t}\n\t// wait a few seconds\n\ttime.Sleep(5 * time.Second)\n\t// make sure that the stateful set has been deleted and that the\n\t// service has been deleted\n\tkubeclient, err := kubernetes.NewForConfig(config)\n\tif err != nil {\n\t\tt.Fatal(\"Could not create kubernetes clientset\")\n\t}\n\tsvcName := testNetworkName + \"-svc\"\n\t_, err = kubeclient.CoreV1().Services(\"default\").Get(svcName, metav1.GetOptions{})\n\tif err == nil {\n\t\tt.Error(\"Did not expect this call to succeed, service should have been deleted\")\n\t}\n\tstsName := testNetworkName + \"-sts\"\n\t_, err = kubeclient.AppsV1().StatefulSets(\"default\").Get(stsName, metav1.GetOptions{})\n\tif err == nil {\n\t\tt.Error(\"Did not expect this call to succeed, service should have been deleted\")\n\t}\n\t// To leave a clean state behind, wait until the last pod has been removed\n\tcount := 0\n\tfor {\n\t\t_, err = kubeclient.CoreV1().Pods(\"default\").Get(stsName+\"-0\", metav1.GetOptions{})\n\t\tif err != nil {\n\t\t\tbreak\n\t\t}\n\t\ttime.Sleep(1 * time.Second)\n\t\tcount = count + 1\n\t\tif count > 60 {\n\t\t\tt.Error(\"Timeout while waiting for last pod to go down\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c4a7887e2dc4ed66fa96be4a715ae7ea", "score": "0.5287988", "text": "func (a *DevicesApiService) DevicesDeviceIdInterfacesInterfaceNameBlockPost(ctx context.Context, xAuthToken string, deviceId string, interfaceName string) (Status, *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\tsuccessPayload Status\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/devices/{deviceId}/interfaces/{interfaceName}/block\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"deviceId\"+\"}\", fmt.Sprintf(\"%v\", deviceId), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"interfaceName\"+\"}\", fmt.Sprintf(\"%v\", interfaceName), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.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\tlocalVarHeaderParams[\"x-auth-token\"] = parameterToString(xAuthToken, \"\")\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-auth-token\"] = key\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 successPayload, nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn successPayload, localVarHttpResponse, err\n\t}\n\tdefer localVarHttpResponse.Body.Close()\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tbodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)\n\t\treturn successPayload, localVarHttpResponse, reportError(\"Status: %v, Body: %s\", localVarHttpResponse.Status, bodyBytes)\n\t}\n\n\tif err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {\n\t\treturn successPayload, localVarHttpResponse, err\n\t}\n\n\treturn successPayload, localVarHttpResponse, err\n}", "title": "" }, { "docid": "3b3eeca60f36afee4e5c4da3afa9c3b8", "score": "0.52796805", "text": "func TestInterfacesListResponse(t *testing.T) {\n\th := handler.NewHandler()\n\n\treq := httptest.NewRequest(\"GET\", ifacesURL, newEmptyReader())\n\tresp := httptest.NewRecorder()\n\n\th.ServeHTTP(resp, req)\n\n\t_, err := net.Interfaces()\n\tif err == nil {\n\t\tif resp.Code != http.StatusOK {\n\t\t\tt.Error(\"GET request on\", ifacesURL, \"failed\")\n\t\t}\n\t} else {\n\t\tif resp.Code == http.StatusOK {\n\t\t\tt.Error(\"GET request on\", ifacesURL, \": server has not reported a error:\", err.Error())\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ea2c00330dd4083b44fe782e1355bfec", "score": "0.52791387", "text": "func (s *TestSuite) TestUpdateDelete(t *testing.T) {\n\tctx, cancel := gnmiutils.MakeContext()\n\tdefer cancel()\n\n\t// Get the first configured simulator from the environment.\n\tsimulator := gnmiutils.CreateSimulator(ctx, t)\n\tdefer gnmiutils.DeleteSimulator(t, simulator)\n\n\t// Wait for config to connect to the target\n\tready := gnmiutils.WaitForTargetAvailable(ctx, t, topoapi.ID(simulator.Name()), 1*time.Minute)\n\tassert.True(t, ready)\n\n\t// Make a GNMI client to use for requests\n\tgnmiClient := gnmiutils.NewOnosConfigGNMIClientOrFail(ctx, t, gnmiutils.NoRetry)\n\n\t// Create interface tree using gNMI client\n\tsetNamePath := []proto.GNMIPath{\n\t\t{TargetName: simulator.Name(), Path: udtestNamePath, PathDataValue: udtestNameValue, PathDataType: proto.StringVal},\n\t}\n\tvar setReq = &gnmiutils.SetRequest{\n\t\tCtx: ctx,\n\t\tClient: gnmiClient,\n\t\tExtensions: gnmiutils.SyncExtension(t),\n\t\tEncoding: gnmiapi.Encoding_PROTO,\n\t\tUpdatePaths: setNamePath,\n\t}\n\tsetReq.SetOrFail(t)\n\n\tvar getConfigReq = &gnmiutils.GetRequest{\n\t\tCtx: ctx,\n\t\tClient: gnmiClient,\n\t\tEncoding: gnmiapi.Encoding_PROTO,\n\t}\n\tgetConfigReq.Paths = setNamePath\n\tgetConfigReq.CheckValues(t, udtestNameValue)\n\n\t// Set initial values for Enabled and Description using gNMI client\n\tsetInitialValuesPath := []proto.GNMIPath{\n\t\t{TargetName: simulator.Name(), Path: udtestEnabledPath, PathDataValue: \"true\", PathDataType: proto.BoolVal},\n\t\t{TargetName: simulator.Name(), Path: udtestDescriptionPath, PathDataValue: udtestDescriptionValue, PathDataType: proto.StringVal},\n\t}\n\tsetReq.UpdatePaths = setInitialValuesPath\n\tsetReq.SetOrFail(t)\n\n\t// Update Enabled, delete Description using gNMI client\n\tupdateEnabledPath := []proto.GNMIPath{\n\t\t{TargetName: simulator.Name(), Path: udtestEnabledPath, PathDataValue: \"false\", PathDataType: proto.BoolVal},\n\t}\n\tdeleteDescriptionPath := []proto.GNMIPath{\n\t\t{TargetName: simulator.Name(), Path: udtestDescriptionPath},\n\t}\n\tsetReq.UpdatePaths = updateEnabledPath\n\tsetReq.DeletePaths = deleteDescriptionPath\n\tsetReq.SetOrFail(t)\n\n\t// Check that the Enabled value is set correctly\n\tgetConfigReq.Paths = updateEnabledPath\n\tgetConfigReq.CheckValues(t, \"false\")\n\n\t// Make sure Description got removed\n\tgetConfigReq.Paths = gnmiutils.GetTargetPath(simulator.Name(), udtestDescriptionPath)\n\tgetConfigReq.CheckValues(t, \"\")\n}", "title": "" }, { "docid": "a135f6b94670ee2febbcadcf977e5024", "score": "0.5271605", "text": "func (c *InstancesClient) RemoveNIC(ctx context.Context, input *RemoveNICInput) error {\n\tmac := strings.Replace(input.MAC, \":\", \"\", -1)\n\tfullPath := path.Join(\"/\", c.client.AccountName, \"machines\", input.InstanceID, \"nics\", mac)\n\treqInputs := client.RequestInput{\n\t\tMethod: http.MethodDelete,\n\t\tPath: fullPath,\n\t}\n\tresponse, err := c.client.ExecuteRequestRaw(ctx, reqInputs)\n\tif err != nil {\n\t\treturn pkgerrors.Wrap(err, \"unable to remove NIC from machine\")\n\t}\n\tif response == nil {\n\t\treturn pkgerrors.Wrap(err, \"unable to remove NIC from machine\")\n\t}\n\tif response.Body != nil {\n\t\tdefer response.Body.Close()\n\t}\n\tswitch response.StatusCode {\n\tcase http.StatusNotFound:\n\t\treturn &errors.APIError{\n\t\t\tStatusCode: response.StatusCode,\n\t\t\tCode: \"ResourceNotFound\",\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "7af7ef295b258dc36c5f4ec7cae8f759", "score": "0.5264963", "text": "func (a *FrinxOpenconfigAclApiService) DeleteFrinxOpenconfigAclAclInterfacesInterfaceInterfaceRef(ctx context.Context, id string, nodeId string) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-acl:acl/frinx-openconfig-acl:interfaces/frinx-openconfig-acl:interface/{id}/frinx-openconfig-acl:interface-ref/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\", \"application/xml\"}\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/xml\"}\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, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\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\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "title": "" }, { "docid": "9cc7b7f2acabb95414e83b781ef0add4", "score": "0.5256049", "text": "func (a *OpenAPI) CreateNetworkInterface(ctx context.Context, instanceType ENIType, vSwitch string, securityGroups []string, ipCount, ipv6Count int, eniTags map[string]string) (*ecs.CreateNetworkInterfaceResponse, error) {\n\treq := ecs.CreateCreateNetworkInterfaceRequest()\n\treq.VSwitchId = vSwitch\n\treq.InstanceType = string(instanceType)\n\treq.SecurityGroupIds = &securityGroups\n\treq.NetworkInterfaceName = generateEniName()\n\treq.Description = eniDescription\n\tif ipCount > 1 {\n\t\treq.SecondaryPrivateIpAddressCount = requests.NewInteger(ipCount - 1)\n\t}\n\tif ipv6Count > 0 {\n\t\treq.Ipv6AddressCount = requests.NewInteger(ipv6Count)\n\t}\n\n\tvar tags []ecs.CreateNetworkInterfaceTag\n\tfor k, v := range eniTags {\n\t\ttags = append(tags, ecs.CreateNetworkInterfaceTag{\n\t\t\tKey: k,\n\t\t\tValue: v,\n\t\t})\n\t}\n\treq.Tag = &tags\n\n\tl := log.WithFields(map[string]interface{}{\n\t\tLogFieldAPI: \"CreateNetworkInterface\",\n\t\tLogFieldVSwitchID: vSwitch,\n\t})\n\ta.MutatingRateLimiter.Accept()\n\tstart := time.Now()\n\tresp, err := a.ClientSet.ECS().CreateNetworkInterface(req)\n\tmetric.OpenAPILatency.WithLabelValues(\"CreateNetworkInterface\", fmt.Sprint(err != nil)).Observe(metric.MsSince(start))\n\tif err != nil {\n\t\tl.WithField(LogFieldRequestID, apiErr.ErrRequestID(err)).Errorf(\"error create ENI, %s\", err.Error())\n\t\treturn nil, err\n\t}\n\n\tl.WithFields(map[string]interface{}{\n\t\tLogFieldENIID: resp.NetworkInterfaceId,\n\t\tLogFieldRequestID: resp.RequestId,\n\t}).Info(\"create ENI\")\n\treturn resp, err\n}", "title": "" }, { "docid": "5ba7ba66450e979ee347def0dbda0cc8", "score": "0.52525365", "text": "func (a *FrinxOpenconfigAclApiService) DeleteFrinxOpenconfigAclAclInterfacesInterfaceConfig(ctx context.Context, id string, nodeId string) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-acl:acl/frinx-openconfig-acl:interfaces/frinx-openconfig-acl:interface/{id}/frinx-openconfig-acl:config/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\", \"application/xml\"}\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/xml\"}\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, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\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\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "title": "" }, { "docid": "8fd53a637e56d8f3af2b0459a65d9faa", "score": "0.5245815", "text": "func DeleteCIMApiTest() {\n\n\tfmt.Print(\"\\n\\n============= DeleteCIMApiTest() =============\\n\")\n\n\tlogger := logger.NewLogger()\n\n\tcim := sp_api.NewCloudInfoManager()\n\n\terr := cim.SetConfigPath(\"../../cbadm/grpc_conf.yaml\")\n\tif err != nil {\n\t\tlogger.Fatal(err)\n\t}\n\n\terr = cim.Open()\n\tif err != nil {\n\t\tlogger.Fatal(err)\n\t}\n\n\tresult, err := cim.DeleteCloudDriverByParam(\"openstack-driver01\")\n\tif err != nil {\n\t\tlogger.Fatal(err)\n\t}\n\n\tfmt.Printf(\"\\nresult :\\n%s\\n\", result)\n\n\tresult, err = cim.DeleteCredentialByParam(\"openstack-credential01\")\n\tif err != nil {\n\t\tlogger.Fatal(err)\n\t}\n\n\tfmt.Printf(\"\\nresult :\\n%s\\n\", result)\n\n\tresult, err = cim.DeleteRegionByParam(\"openstack-region01\")\n\tif err != nil {\n\t\tlogger.Fatal(err)\n\t}\n\n\tfmt.Printf(\"\\nresult :\\n%s\\n\", result)\n\n\tresult, err = cim.DeleteConnectionConfigByParam(\"openstack-config01\")\n\tif err != nil {\n\t\tlogger.Fatal(err)\n\t}\n\n\tfmt.Printf(\"\\nresult :\\n%s\\n\", result)\n\n\tcim.Close()\n}", "title": "" }, { "docid": "e49d6bfefc0ee4549647124601a69ba3", "score": "0.524431", "text": "func (network *HNSNetwork) Delete() (*HNSNetwork, error) {\n\toperation := \"Delete\"\n\ttitle := \"hcsshim::HNSNetwork::\" + operation\n\tlogrus.Debugf(title+\" id=%s\", network.Id)\n\n\treturn HNSNetworkRequest(\"DELETE\", network.Id, \"\")\n}", "title": "" } ]
a6fe607581169117f7efbc00fcf74b25
DeleteAttachment removes an attachment
[ { "docid": "636fe9776861a5423d84cbb89c5202b1", "score": "0.70405537", "text": "func (c *Client) DeleteAttachment(attachmentID string, owner *BusinessObjectInfo) error {\n\treqPath := fmt.Sprintf(\n\t\tattachmentDeletePath,\n\t\tattachmentID,\n\t\towner.ID,\n\t\towner.RecordID,\n\t)\n\tresp := &ErrorData{}\n\terr := c.performRequest(http.MethodDelete, reqPath, nil, resp)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif resp.HasError {\n\t\treturn resp.GetErrorObject()\n\t}\n\n\treturn nil\n}", "title": "" } ]
[ { "docid": "1cf4327b89f5a51e3a1115f532a899fe", "score": "0.8081476", "text": "func (c *CouchCandy) DeleteAttachment(id, rev, name string) (*OperationResponse, error) {\n\n\t// DELETE /db/doc/attachmentname?rev=...\n\turl := fmt.Sprintf(\"%s/%s/%s?rev=%s\", createDatabaseURL(c.Session), id, name, rev)\n\n\tpage, err := readJSON(url, c.Delete)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn toOperationResponse(page)\n\n}", "title": "" }, { "docid": "e702be9db2899336e6720d4891f73fae", "score": "0.7621243", "text": "func (v *VolumeAttachmentServiceOp) Delete(attachmentID string) (*Response, error) {\n\tpath := fmt.Sprintf(\"%s%s/%s\", volumeBasePath, attachmentsBasePath, attachmentID)\n\n\treturn v.client.DoRequest(\"DELETE\", path, nil, nil)\n}", "title": "" }, { "docid": "474bd5c9d963219ef0093aa5e70dc405", "score": "0.72655696", "text": "func (s stack) DeleteVolumeAttachment(ctx context.Context, serverID, vaID string) fail.Error {\n\tif valid.IsNil(s) {\n\t\treturn fail.InvalidInstanceError()\n\t}\n\tif serverID = strings.TrimSpace(serverID); serverID == \"\" {\n\t\treturn fail.InvalidParameterCannotBeEmptyStringError(\"serverID\")\n\t}\n\tif vaID = strings.TrimSpace(vaID); vaID == \"\" {\n\t\treturn fail.InvalidParameterCannotBeEmptyStringError(\"vaID\")\n\t}\n\n\treturn stacks.RetryableRemoteCall(ctx,\n\t\tfunc() error {\n\t\t\treturn volumeattach.Delete(s.ComputeClient, serverID, vaID).ExtractErr()\n\t\t},\n\t\tNormalizeError,\n\t)\n}", "title": "" }, { "docid": "876f62de85bc833e188f5eb9459fff3f", "score": "0.70359176", "text": "func (kubernetesServiceApi *KubernetesServiceApiV1) DeleteAttachment(deleteAttachmentOptions *DeleteAttachmentOptions) (response *core.DetailedResponse, err error) {\n\treturn kubernetesServiceApi.DeleteAttachmentWithContext(context.Background(), deleteAttachmentOptions)\n}", "title": "" }, { "docid": "34c2fa4760191bd9f3a1de9094d094dd", "score": "0.6947224", "text": "func Delete(client *gophercloud.ServiceClient, serverID, attachmentID string) (r DeleteResult) {\n\tresp, err := client.Delete(deleteURL(client, serverID, attachmentID), nil)\n\t_, r.Header, r.Err = gophercloud.ParseResponse(resp, err)\n\treturn\n}", "title": "" }, { "docid": "b829173ac352cef1fc55ebbfd9f041bb", "score": "0.6841571", "text": "func (a StorageAttachmentsApi) DeleteStorageAttachment(name string, cookie string) (*APIResponse, error) {\n\n\tvar localVarHttpMethod = strings.ToUpper(\"Delete\")\n\t// create path and map variables\n\tlocalVarPath := a.Configuration.BasePath + \"/storage/attachment/{name}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := make(map[string]string)\n\tvar localVarPostBody interface{}\n\tvar localVarFileName string\n\tvar localVarFileBytes []byte\n\t// add default headers if any\n\tfor key := range a.Configuration.DefaultHeader {\n\t\tlocalVarHeaderParams[key] = a.Configuration.DefaultHeader[key]\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{ \"application/oracle-compute-v3+json\", }\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"application/oracle-compute-v3+json\",\n\t\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// header params \"Cookie\"\n\tlocalVarHeaderParams[\"Cookie\"] = a.Configuration.APIClient.ParameterToString(cookie, \"\")\n\tlocalVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\n\tvar localVarURL, _ = url.Parse(localVarPath)\n\tlocalVarURL.RawQuery = localVarQueryParams.Encode()\n\tvar localVarAPIResponse = &APIResponse{Operation: \"DeleteStorageAttachment\", Method: localVarHttpMethod, RequestURL: localVarURL.String()}\n\tif localVarHttpResponse != nil {\n\t\tlocalVarAPIResponse.Response = localVarHttpResponse.RawResponse\n\t\tlocalVarAPIResponse.Payload = localVarHttpResponse.Body()\n\t}\n\n\tif err != nil {\n\t\treturn localVarAPIResponse, err\n\t}\n\treturn localVarAPIResponse, err\n}", "title": "" }, { "docid": "45dcd7bfb19ed19616fa9597aff8b450", "score": "0.6703037", "text": "func (service *ContrailService) DeleteProviderAttachment(ctx context.Context, request *models.DeleteProviderAttachmentRequest) (*models.DeleteProviderAttachmentResponse, error) {\n\tif err := common.DoInTransaction(\n\t\tservice.DB,\n\t\tfunc(tx *sql.Tx) error {\n\t\t\treturn db.DeleteProviderAttachment(ctx, tx, request)\n\t\t}); err != nil {\n\t\tlog.WithField(\"err\", err).Debug(\"error deleting a resource\")\n\t\treturn nil, common.ErrorInternal\n\t}\n\treturn &models.DeleteProviderAttachmentResponse{\n\t\tID: request.ID,\n\t}, nil\n}", "title": "" }, { "docid": "b01b01784a14b028edbe946f1766f556", "score": "0.6571771", "text": "func AttachmentActionDelete(props ...*attachmentActionProps) *attachmentAction {\n\ta := &attachmentAction{\n\t\ttimestamp: time.Now(),\n\t\tresource: \"compose:attachment\",\n\t\taction: \"delete\",\n\t\tlog: \"deleted {attachment}\",\n\t\tseverity: actionlog.Notice,\n\t}\n\n\tif len(props) > 0 {\n\t\ta.props = props[0]\n\t}\n\n\treturn a\n}", "title": "" }, { "docid": "052bc042ce7e432489d4f84dabe42825", "score": "0.65209544", "text": "func (configurationGovernance *ConfigurationGovernanceV1) DeleteAttachment(deleteAttachmentOptions *DeleteAttachmentOptions) (response *core.DetailedResponse, err error) {\n\treturn configurationGovernance.DeleteAttachmentWithContext(context.Background(), deleteAttachmentOptions)\n}", "title": "" }, { "docid": "ee4cc5882f7846d3d1191954d84de9f8", "score": "0.6404411", "text": "func (a VolumeAttachmentsApi) DeleteVolumeAttachment(id string) (*APIResponse, error) {\n\n\tvar localVarHttpMethod = strings.ToUpper(\"Delete\")\n\t// create path and map variables\n\tlocalVarPath := a.Configuration.BasePath + \"/storage/attachments/{id}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := make(map[string]string)\n\tvar localVarPostBody interface{}\n\tvar localVarFileName string\n\tvar localVarFileBytes []byte\n\t// authentication '(x_auth_token)' required\n\t// set key with prefix in header\n\tlocalVarHeaderParams[\"X-Auth-Token\"] = a.Configuration.GetAPIKeyWithPrefix(\"X-Auth-Token\")\n\t// add default headers if any\n\tfor key := range a.Configuration.DefaultHeader {\n\t\tlocalVarHeaderParams[key] = a.Configuration.DefaultHeader[key]\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 := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"application/json\",\n\t\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tlocalVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\n\tvar localVarURL, _ = url.Parse(localVarPath)\n\tlocalVarURL.RawQuery = localVarQueryParams.Encode()\n\tvar localVarAPIResponse = &APIResponse{Operation: \"DeleteVolumeAttachment\", Method: localVarHttpMethod, RequestURL: localVarURL.String()}\n\tif localVarHttpResponse != nil {\n\t\tlocalVarAPIResponse.Response = localVarHttpResponse.RawResponse\n\t\tlocalVarAPIResponse.Payload = localVarHttpResponse.Body()\n\t}\n\n\tif err != nil {\n\t\treturn localVarAPIResponse, err\n\t}\n\treturn localVarAPIResponse, err\n}", "title": "" }, { "docid": "570efde64f2f8ea6b9525d90f6e4d2b0", "score": "0.63381183", "text": "func (s *StorageServiceOP) Detach(attachmentID string) (*Response, error) {\n\tpath := fmt.Sprintf(\"%s/attachments/%s\", storageBasePath, attachmentID)\n\n\treq, err := s.client.NewRequest(\"DELETE\", path, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp, err := s.client.Do(req, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn resp, err\n}", "title": "" }, { "docid": "af6ec6312e93069d4fcbd2441cbdb1f9", "score": "0.6298464", "text": "func (mf *MessageFile) Delete(db XODB) error {\n\tvar err error\n\n\t// if doesn't exist, bail\n\tif !mf._exists {\n\t\treturn nil\n\t}\n\n\t// if deleted, bail\n\tif mf._deleted {\n\t\treturn nil\n\t}\n\n\t// sql query\n\tconst sqlstr = `DELETE FROM ms.message_file WHERE MessageFileId = ?`\n\n\t// run query\n\tXOLog(sqlstr, mf.MessageFileId)\n\t_, err = db.Exec(sqlstr, mf.MessageFileId)\n\tif err != nil {\n\t\tXOLogErr(err)\n\t\treturn err\n\t}\n\n\t// set deleted\n\tmf._deleted = true\n\n\tOnMessageFile_AfterDelete(mf)\n\n\treturn nil\n}", "title": "" }, { "docid": "02645f8892850990e068df2c420606a6", "score": "0.6231119", "text": "func (s *Service) DeleteReplyAttachment(replyID string, attachmentName string) error {\n\t_, err := s.deleteReplyAttachmentResponseBody(replyID, attachmentName)\n\n\treturn err\n}", "title": "" }, { "docid": "6421beec9a6ed82dc91f071d6a9d9679", "score": "0.6187618", "text": "func (service *Service) RemoveAttachedFile(pid string, fileName string) error {\n\n\terr := service.conn.RemoveAttachedFile(pid, fileName)\n\treturn err\n}", "title": "" }, { "docid": "0e47ab2bda11cc59dfb16199e2cda913", "score": "0.6184209", "text": "func (r *Receiver) Delete(ctx context.Context, req *FileRequest) (*EmptyResponse, error) {\n\terr := os.RemoveAll(req.Path)\n\treturn &EmptyResponse{}, err\n}", "title": "" }, { "docid": "8a347965764b17ba016d88fbfd68d19d", "score": "0.6020972", "text": "func DELETE(ctx *web.Context) {\n\tfilePath := ctx.PS.ByName(\"filepath\")\n\n\t// Delete file.\n\tif err := model.File.Delete(filePath); nil != err {\n\t\tctx.Respond().Status(http.StatusNotFound).With(err).Do()\n\t}\n\n\t// Reply with success.\n\tresp := &DeleteResponse{}\n\tctx.Respond().With(resp).Do()\n}", "title": "" }, { "docid": "d577252d1a547d1a7780a0a9e977a971", "score": "0.6004867", "text": "func (kubernetesServiceApi *KubernetesServiceApiV1) DeleteAttachmentWithContext(ctx context.Context, deleteAttachmentOptions *DeleteAttachmentOptions) (response *core.DetailedResponse, err error) {\n\terr = core.ValidateNotNil(deleteAttachmentOptions, \"deleteAttachmentOptions cannot be nil\")\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.ValidateStruct(deleteAttachmentOptions, \"deleteAttachmentOptions\")\n\tif err != nil {\n\t\treturn\n\t}\n\n\tbuilder := core.NewRequestBuilder(core.POST)\n\tbuilder = builder.WithContext(ctx)\n\tbuilder.EnableGzipCompression = kubernetesServiceApi.GetEnableGzipCompression()\n\t_, err = builder.ResolveRequestURL(kubernetesServiceApi.Service.Options.URL, `/v2/storage/deleteAttachment`, nil)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor headerName, headerValue := range deleteAttachmentOptions.Headers {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\n\tsdkHeaders := common.GetSdkHeaders(\"kubernetes_service_api\", \"V1\", \"DeleteAttachment\")\n\tfor headerName, headerValue := range sdkHeaders {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\tbuilder.AddHeader(\"Content-Type\", \"application/json\")\n\tif deleteAttachmentOptions.XAuthResourceGroupID != nil {\n\t\tbuilder.AddHeader(\"X-Auth-Resource-Group-ID\", fmt.Sprint(*deleteAttachmentOptions.XAuthResourceGroupID))\n\t}\n\n\tbody := make(map[string]interface{})\n\tif deleteAttachmentOptions.Cluster != nil {\n\t\tbody[\"cluster\"] = deleteAttachmentOptions.Cluster\n\t}\n\tif deleteAttachmentOptions.VolumeAttachmentID != nil {\n\t\tbody[\"volumeAttachmentID\"] = deleteAttachmentOptions.VolumeAttachmentID\n\t}\n\tif deleteAttachmentOptions.VolumeID != nil {\n\t\tbody[\"volumeID\"] = deleteAttachmentOptions.VolumeID\n\t}\n\tif deleteAttachmentOptions.Worker != nil {\n\t\tbody[\"worker\"] = deleteAttachmentOptions.Worker\n\t}\n\t_, err = builder.SetBodyContentJSON(body)\n\tif err != nil {\n\t\treturn\n\t}\n\n\trequest, err := builder.Build()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tresponse, err = kubernetesServiceApi.Service.Request(request, nil)\n\n\treturn\n}", "title": "" }, { "docid": "5ac51738419e1620f60830cf871bd996", "score": "0.5971593", "text": "func (service *ContrailService) RESTDeleteProviderAttachment(c echo.Context) error {\n\tid := c.Param(\"id\")\n\trequest := &models.DeleteProviderAttachmentRequest{\n\t\tID: id,\n\t}\n\tctx := c.Request().Context()\n\t_, err := service.DeleteProviderAttachment(ctx, request)\n\tif err != nil {\n\t\treturn common.ToHTTPError(err)\n\t}\n\treturn c.JSON(http.StatusNoContent, nil)\n}", "title": "" }, { "docid": "36ad7ceb72a2bc85efeb2759bab7ab90", "score": "0.59714335", "text": "func DeleteAttachmentVersion(attachments AttachmentsMeta) {\n\tfor _, value := range attachments {\n\t\tmeta := value.(map[string]interface{})\n\t\tdelete(meta, \"ver\")\n\t}\n}", "title": "" }, { "docid": "6dd2647e95bef9b77fd4dc7059d6cc83", "score": "0.59573185", "text": "func (client *ClientImpl) DeleteTestRunLogStoreAttachment(ctx context.Context, args DeleteTestRunLogStoreAttachmentArgs) 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.RunId == nil {\n\t\treturn &azuredevops.ArgumentNilError{ArgumentName: \"args.RunId\"}\n\t}\n\trouteValues[\"runId\"] = strconv.Itoa(*args.RunId)\n\n\tqueryParams := url.Values{}\n\tif args.Filename == nil {\n\t\treturn &azuredevops.ArgumentNilError{ArgumentName: \"filename\"}\n\t}\n\tqueryParams.Add(\"filename\", *args.Filename)\n\tlocationId, _ := uuid.Parse(\"1026d5de-4b0b-46ae-a31f-7c59b6af51ef\")\n\t_, err := client.Client.Send(ctx, http.MethodDelete, locationId, \"7.1-preview.1\", routeValues, queryParams, nil, \"\", \"application/json\", nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6180ebd70076db54c66e471ba5d69d75", "score": "0.59358984", "text": "func Delete(client client.Client, fileName string) (err error) {\n\tclient.Logger.Debugf(\"Deleting file %s\", fileName)\n\n\terr = os.Remove(fileName)\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "91783aaef0203f89d280476f62f1c7ed", "score": "0.59000736", "text": "func (m *AttachmentSessionItemRequestBuilder) Delete(ctx context.Context, requestConfiguration *AttachmentSessionItemRequestBuilderDeleteRequestConfiguration)(error) {\n requestInfo, err := m.CreateDeleteRequestInformation(ctx, requestConfiguration);\n if err != nil {\n return err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n err = m.requestAdapter.SendNoContentAsync(ctx, requestInfo, errorMapping)\n if err != nil {\n return err\n }\n return nil\n}", "title": "" }, { "docid": "335f8aa5a39444f693970fe4cf4dacdb", "score": "0.58849317", "text": "func (e *AttachmentResourcesExecutor) Delete() error {\n\tvar errs []error\n\n\t// check if controller has rights to delete any attachments\n\tdeleteAny := false\n\tif e.DeleteAny != nil {\n\t\tdeleteAny = *e.DeleteAny\n\t}\n\n\tfor name, obj := range e.Observed {\n\t\tif obj.GetDeletionTimestamp() != nil {\n\t\t\t// Skip objects that are already pending deletion.\n\t\t\tglog.V(6).Infof(\n\t\t\t\t\"Can't delete %s: Pending deletion: %s\",\n\t\t\t\te,\n\t\t\t\tDescObjectAsKey(obj),\n\t\t\t)\n\t\t\tcontinue\n\t\t}\n\t\tif e.Desired == nil || e.Desired[name] == nil {\n\t\t\t// check which watch created this resource in the first place\n\t\t\tann := obj.GetAnnotations()\n\t\t\twantWatch := string(e.Watch.GetUID())\n\t\t\tgotWatch := \"\"\n\t\t\tif ann != nil {\n\t\t\t\tgotWatch = ann[attachmentCreateAnnotationKey]\n\t\t\t}\n\n\t\t\tif gotWatch != wantWatch && !deleteAny {\n\t\t\t\t// Skip objects that was not created due to this watch\n\t\t\t\tglog.V(6).Infof(\n\t\t\t\t\t\"Won't delete %s: Annotation %s = %q want %q: DeleteAny = %t: %s\",\n\t\t\t\t\tDescObjectAsKey(obj),\n\t\t\t\t\tattachmentCreateAnnotationKey,\n\t\t\t\t\tgotWatch,\n\t\t\t\t\twantWatch,\n\t\t\t\t\tdeleteAny,\n\t\t\t\t\te,\n\t\t\t\t)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// This observed object wasn't listed as desired.\n\t\t\t// Hence, this is the right candidate to be deleted.\n\t\t\tglog.V(4).Infof(\n\t\t\t\t\"Deleting %s: %s\",\n\t\t\t\tDescObjectAsKey(obj),\n\t\t\t\te,\n\t\t\t)\n\t\t\tuid := obj.GetUID()\n\t\t\t// Explicitly request deletion propagation, which is what\n\t\t\t// users expect, since some objects default to orphaning\n\t\t\t// for backwards compatibility.\n\t\t\tpropagation := metav1.DeletePropagationBackground\n\t\t\terr := e.DynamicResourceClient.Namespace(obj.GetNamespace()).Delete(\n\t\t\t\tobj.GetName(),\n\t\t\t\t&metav1.DeleteOptions{\n\t\t\t\t\tPreconditions: &metav1.Preconditions{UID: &uid},\n\t\t\t\t\tPropagationPolicy: &propagation,\n\t\t\t\t},\n\t\t\t)\n\t\t\tif err != nil {\n\t\t\t\tif apierrors.IsNotFound(err) {\n\t\t\t\t\tglog.V(4).Infof(\n\t\t\t\t\t\t\"Can't delete %s: IsNotFound: %s: %v\",\n\t\t\t\t\t\tDescObjectAsKey(obj),\n\t\t\t\t\t\te,\n\t\t\t\t\t\terr,\n\t\t\t\t\t)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\terrs = append(\n\t\t\t\t\terrs,\n\t\t\t\t\terrors.Wrapf(\n\t\t\t\t\t\terr,\n\t\t\t\t\t\t\"Failed to delete %s: %s\",\n\t\t\t\t\t\tDescObjectAsKey(obj),\n\t\t\t\t\t\te,\n\t\t\t\t\t),\n\t\t\t\t)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tglog.Infof(\n\t\t\t\t\"Deleted %s: %s\",\n\t\t\t\tDescObjectAsKey(obj),\n\t\t\t\te,\n\t\t\t)\n\t\t}\n\t}\n\treturn utilerrors.NewAggregate(errs)\n}", "title": "" }, { "docid": "502d81d023559b79d878e89f2bdbb6d5", "score": "0.58240736", "text": "func (*DeleteAttachmentRequest) Descriptor() ([]byte, []int) {\n\treturn file_entpb_entpb_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "43aab4d7cf5181c83e2eed6837127612", "score": "0.5823282", "text": "func (p *Parser) parseDeleteAttachmentCmd(db, ctx string) {\n\t_token := p.expect(itemPath, ctx)\n\t_path := _token.val\n\t_filter := p.parseEndofCommand(ctx)\n\tcmd := bytengine.Command{\n\t\tName: ctx,\n\t\tIsAdmin: false,\n\t\tArgs: make(map[string]interface{}),\n\t\tOptions: make(map[string]interface{}),\n\t}\n\tcmd.Database = db\n\tcmd.Args[\"path\"] = _path\n\tcmd.Filter = _filter\n\tp.commands = append(p.commands, cmd)\n}", "title": "" }, { "docid": "ae83a7f44d29e07480dac9ff8680d8d3", "score": "0.5823112", "text": "func (adp *fileStorage) Delete(ctx context.Context, filename string) error {\n\tpath := adp.dsn.Join(filename)\n\treturn os.Remove(path)\n}", "title": "" }, { "docid": "bce84e70ae2c7d148ed67f622dd117d9", "score": "0.5770954", "text": "func (c *FtpClient) Delete(filename string) (string, error) {\n\tcommand := fmt.Sprintf(\"DELE %s\", filename)\n\t_, message, err := c.expectResponse(command, statusDeleteSuccess)\n\treturn message, err\n}", "title": "" }, { "docid": "091d8d408cdce7f00078dc4160f5cc9d", "score": "0.5730682", "text": "func (a *Client) RepoDeleteReleaseAttachment(params *RepoDeleteReleaseAttachmentParams, authInfo runtime.ClientAuthInfoWriter) (*RepoDeleteReleaseAttachmentNoContent, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewRepoDeleteReleaseAttachmentParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"repoDeleteReleaseAttachment\",\n\t\tMethod: \"DELETE\",\n\t\tPathPattern: \"/repos/{owner}/{repo}/releases/{id}/assets/{attachment_id}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\", \"text/plain\"},\n\t\tSchemes: []string{\"http\", \"https\"},\n\t\tParams: params,\n\t\tReader: &RepoDeleteReleaseAttachmentReader{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.(*RepoDeleteReleaseAttachmentNoContent)\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 repoDeleteReleaseAttachment: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "6a3f5dafeb1f4c77e0e9a26ba7a08a96", "score": "0.5723343", "text": "func (bc *BackupController) handleAttachmentTicketDeletion(backup *longhorn.Backup, volumeName string) (err error) {\n\tdefer func() {\n\t\terr = errors.Wrap(err, \"handleAttachmentTicketDeletion: failed to clean up attachment\")\n\t}()\n\n\tva, err := bc.ds.GetLHVolumeAttachmentByVolumeName(volumeName)\n\tif err != nil {\n\t\tif apierrors.IsNotFound(err) {\n\t\t\treturn nil\n\t\t}\n\t\treturn err\n\t}\n\n\tattachmentTicketID := longhorn.GetAttachmentTicketID(longhorn.AttacherTypeBackupController, backup.Name)\n\n\tif _, ok := va.Spec.AttachmentTickets[attachmentTicketID]; ok {\n\t\tdelete(va.Spec.AttachmentTickets, attachmentTicketID)\n\t\tif _, err = bc.ds.UpdateLHVolumeAttachment(va); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "61a621858dbd221e7ff6a017a08dd13e", "score": "0.56807315", "text": "func (e *AttachmentResourcesExecutor) Delete() error {\n\tvar errs []error\n\tfor name, obj := range e.Observed {\n\t\tif obj.GetDeletionTimestamp() != nil {\n\t\t\t// Skip objects that are already pending deletion.\n\t\t\tcontinue\n\t\t}\n\t\tif e.Desired == nil || e.Desired[name] == nil {\n\t\t\t// This observed object wasn't listed as desired.\n\t\t\t// Hence, this is the right candidate to be deleted.\n\t\t\tglog.Infof(\"%v: deleting %v\", describeObject(e.Watch), describeObject(obj))\n\t\t\tuid := obj.GetUID()\n\t\t\t// Explicitly request deletion propagation, which is what\n\t\t\t// users expect, since some objects default to orphaning\n\t\t\t// for backwards compatibility.\n\t\t\tpropagation := metav1.DeletePropagationBackground\n\t\t\terr := e.DynamicResourceClient.Namespace(obj.GetNamespace()).Delete(\n\t\t\t\tobj.GetName(),\n\t\t\t\t&metav1.DeleteOptions{\n\t\t\t\t\tPreconditions: &metav1.Preconditions{UID: &uid},\n\t\t\t\t\tPropagationPolicy: &propagation,\n\t\t\t\t},\n\t\t\t)\n\t\t\tif err != nil {\n\t\t\t\terrs = append(\n\t\t\t\t\terrs,\n\t\t\t\t\terrors.Wrapf(err, \"can't delete %v\", describeObject(obj)),\n\t\t\t\t)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t}\n\treturn utilerrors.NewAggregate(errs)\n}", "title": "" }, { "docid": "89a473b23ee5a3a1cad12037c5935df7", "score": "0.56677014", "text": "func AttachRemove(xRefTable *XRefTable, files StringSet) (ok bool, err error) {\n\n\tlog.Debug.Println(\"Remove begin\")\n\n\tif !xRefTable.Valid {\n\t\terr = xRefTable.LocateNameTree(\"EmbeddedFiles\", false)\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\t}\n\n\tif xRefTable.Names[\"EmbeddedFiles\"] == nil {\n\t\treturn false, errors.Errorf(\"no attachments available.\")\n\t}\n\n\tok, err = removeAttachedFiles(xRefTable, files)\n\n\tlog.Debug.Println(\"Remove end\")\n\n\treturn ok, err\n}", "title": "" }, { "docid": "c4f36cfcc82461f0faeef1ed94cc6882", "score": "0.5647037", "text": "func FileDelete(filename string) error {\r\n\treturn os.Remove(filename)\r\n}", "title": "" }, { "docid": "ac56af654722aa974d590c793f6bbd08", "score": "0.56420165", "text": "func (c *StorageAttachmentsClient) DeleteStorageAttachment(input *DeleteStorageAttachmentInput) error {\n\tif err := c.deleteResource(input.Name); err != nil {\n\t\treturn err\n\t}\n\n\tif input.Timeout == 0 {\n\t\tinput.Timeout = WaitForVolumeAttachmentDeleteTimeout\n\t}\n\n\treturn c.waitForStorageAttachmentToBeDeleted(input.Name, input.Timeout)\n}", "title": "" }, { "docid": "494be32d799474e1f33d65427a6d75ae", "score": "0.5639726", "text": "func Delete(manual *model.Manual) error {\n\tif manual == nil || manual.ID == nil {\n\t\treturn errors.New(\"invalid manual\")\n\t}\n\n\treturn deleteLocalFile(manual)\n}", "title": "" }, { "docid": "72e05cc7f0c0f19c28959f4cb6244f15", "score": "0.5639071", "text": "func (client *Client) DeleteAsset(filename string) error {\n\treturn client.Iaas.DeleteFile(\n\t\tclient.configBucket(),\n\t\tfilename,\n\t)\n}", "title": "" }, { "docid": "d0057c4ea4bd4a6b9afb0459ee3a4e66", "score": "0.56317294", "text": "func (fss *FilesystemStore) DeleteArtifact(art sdk.Artifact) error {\n\treturn os.Remove(fss.path(art))\n}", "title": "" }, { "docid": "f120ae11a68b2a99763d85fe1fa921be", "score": "0.5631684", "text": "func (f FileService) Delete(ctx context.Context, request model.DeleteFileRequest) (string, error) {\n\tid, err := f.File.Delete(ctx, request.ID)\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"couldn't delete file\")\n\t}\n\n\treturn id, nil\n}", "title": "" }, { "docid": "39e9c1669f1ae407ae4db8300513f072", "score": "0.56302005", "text": "func DeleteBlob(c *Context) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tvars := strings.Split(r.RequestURI, \"/\")\n\t\tdir := vars[1]\n\t\tname := vars[2]\n\t\tpath := filepath.Join(c.path, dir, name)\n\t\terr := os.Remove(path)\n\t\tif err != nil {\n\t\t\thttp.Error(w, \"500 internal server error\", 500)\n\t\t\treturn\n\t\t}\n\t\tw.Write([]byte(\"200 ok\"))\n\t}\n}", "title": "" }, { "docid": "d986e3ef8c841bb3b73f18da4583b5e9", "score": "0.5611394", "text": "func Delete(id interface{}) (file *File, err error) {\n\treturn uploader.Delete(id)\n}", "title": "" }, { "docid": "dcc64c8fd6e5da4d62a168f4c72d4d92", "score": "0.5602169", "text": "func (list AnyAttachmentsDeleter) Delete() error {\n\tvar errs []error\n\tfor _, exec := range list {\n\t\terrs = appendErrIfNotNil(errs, exec.Delete())\n\t}\n\treturn utilerrors.NewAggregate(errs)\n}", "title": "" }, { "docid": "dbe8e1de7034c1a020b8edfa75657a80", "score": "0.5586822", "text": "func (clnt *WebDavClient) Delete(uri string) error {\n\n\treq, err := clnt.buildRequest(\"DELETE\", uri, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tresp, err := (&http.Client{}).Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\treturn nil\n}", "title": "" }, { "docid": "9e171653df585740c46f202ca9f67ba6", "score": "0.55808854", "text": "func (list AnyAttachmentsDeleter) Delete() error {\n\tvar errs []error\n\tfor _, deleter := range list {\n\t\terrs = appendErrIfNotNil(errs, deleter.Delete())\n\t}\n\treturn utilerrors.NewAggregate(errs)\n}", "title": "" }, { "docid": "4e80043068ad4832b18b3745a4114230", "score": "0.5559973", "text": "func DeleteBlob(id string) (*models.Blob, error) {\n\tblob, err := GetBlob(id)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tselector := database.QuerySelector{\n\t\t\"id\": id,\n\t}\n\n\terr = db.RemoveOne(\"blobstore\", selector, nil)\n\n\treturn blob, err\n}", "title": "" }, { "docid": "78db4b491417627c221b93494036c26c", "score": "0.555562", "text": "func RemoveAttachments(fileIn string, files []string, config *pdfcpu.Configuration) error {\n\n\tfromStart := time.Now()\n\n\tctx, durRead, durVal, durOpt, err := readValidateAndOptimize(fileIn, config, fromStart)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(files) > 0 {\n\t\tfmt.Printf(\"removing %d attachments from %s ...\\n\", len(files), fileIn)\n\t} else {\n\t\tfmt.Printf(\"removing all attachments from %s ...\\n\", fileIn)\n\t}\n\n\tfrom := time.Now()\n\n\tvar ok bool\n\tok, err = pdfcpu.AttachRemove(ctx.XRefTable, stringSet(files))\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !ok {\n\t\tfmt.Println(\"no attachment removed.\")\n\t\treturn nil\n\t}\n\n\tdurAdd := time.Since(from).Seconds()\n\n\tfromWrite := time.Now()\n\n\tfileOut := fileIn\n\tdirName, fileName := filepath.Split(fileOut)\n\tctx.Write.DirName = dirName\n\tctx.Write.FileName = fileName\n\n\terr = Write(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdurWrite := time.Since(fromWrite).Seconds()\n\tdurTotal := time.Since(fromStart).Seconds()\n\n\tlog.Stats.Printf(\"XRefTable:\\n%s\\n\", ctx)\n\tlog.Stats.Println(\"Timing:\")\n\tlog.Stats.Printf(\"read : %6.3fs %4.1f%%\\n\", durRead, durRead/durTotal*100)\n\tlog.Stats.Printf(\"validate : %6.3fs %4.1f%%\\n\", durVal, durVal/durTotal*100)\n\tlog.Stats.Printf(\"optimize : %6.3fs %4.1f%%\\n\", durOpt, durOpt/durTotal*100)\n\tlog.Stats.Printf(\"add attachment : %6.3fs %4.1f%%\\n\", durAdd, durAdd/durTotal*100)\n\tlog.Stats.Printf(\"write : %6.3fs %4.1f%%\\n\", durWrite, durWrite/durTotal*100)\n\tlog.Stats.Printf(\"total processing time: %6.3fs\\n\\n\", durTotal)\n\tctx.Read.LogStats(ctx.Optimized)\n\tctx.Write.LogStats()\n\n\treturn nil\n}", "title": "" }, { "docid": "fc91d1769d5c414a0cf203da512acd3d", "score": "0.5554797", "text": "func (r DeleteTransitGatewayPeeringAttachmentRequest) Send(ctx context.Context) (*DeleteTransitGatewayPeeringAttachmentResponse, error) {\n\tr.Request.SetContext(ctx)\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp := &DeleteTransitGatewayPeeringAttachmentResponse{\n\t\tDeleteTransitGatewayPeeringAttachmentOutput: r.Request.Data.(*DeleteTransitGatewayPeeringAttachmentOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "d62c063c51f82b83c6434af308ca051a", "score": "0.55391717", "text": "func DeleteFile(file *entity.File, id string, client *statsd.Client) (err error) {\n\tt := client.NewTiming()\n\tif config.DB.Where(\"id = ?\", id).First(&file); file.ID == \"\" {\n\t\treturn errors.New(\"the file doesn't exist!!!\")\n\t}\n\tconfig.DB.Where(\"id = ?\", id).Delete(&file)\n\tt.Send(\"delete_file.query_time\")\n\treturn nil\n}", "title": "" }, { "docid": "f3234c4d6d8e875dd268ec4617216be3", "score": "0.5535365", "text": "func (c *Client) Delete(id types.FileContractID) (err error) {\n\terr = c.post(\"/delete/\"+id.String(), nil, nil)\n\treturn\n}", "title": "" }, { "docid": "fbbdbecf71699d57004141d0c30ebdd4", "score": "0.5531868", "text": "func (imh *manifestHandler) DeleteManifest(w http.ResponseWriter, r *http.Request) {\n\tdcontext.GetLogger(imh).Debug(\"DeleteImageManifest\")\n\n\tif imh.writeFSMetadata {\n\t\tmanifests, err := imh.Repository.Manifests(imh)\n\t\tif err != nil {\n\t\t\timh.Errors = append(imh.Errors, err)\n\t\t\treturn\n\t\t}\n\n\t\terr = manifests.Delete(imh, imh.Digest)\n\t\tif err != nil {\n\t\t\timh.appendManifestDeleteError(err)\n\t\t\treturn\n\t\t}\n\n\t\ttagService := imh.Repository.Tags(imh)\n\t\treferencedTags, err := tagService.Lookup(imh, distribution.Descriptor{Digest: imh.Digest})\n\t\tif err != nil {\n\t\t\timh.Errors = append(imh.Errors, err)\n\t\t\treturn\n\t\t}\n\n\t\tfor _, tag := range referencedTags {\n\t\t\tif err = tagService.Untag(imh, tag); err != nil {\n\t\t\t\timh.Errors = append(imh.Errors, err)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\n\tif imh.useDatabase {\n\t\tif !deleteEnabled(imh.App.Config) {\n\t\t\timh.Errors = append(imh.Errors, errcode.ErrorCodeUnsupported)\n\t\t\treturn\n\t\t}\n\n\t\tif err := dbDeleteManifest(imh.Context, imh.db, imh.Repository.Named().String(), imh.Digest); err != nil {\n\t\t\timh.appendManifestDeleteError(err)\n\t\t\treturn\n\t\t}\n\t}\n\n\tw.WriteHeader(http.StatusAccepted)\n}", "title": "" }, { "docid": "2a602ad7450552ded57417589dec1fde", "score": "0.552557", "text": "func (dao *templateSetDao) Delete(kit *kit.Kit, g *table.TemplateSet) error {\n\t// 参数校验\n\tif err := g.ValidateDelete(); err != nil {\n\t\treturn err\n\t}\n\n\t// 删除操作, 获取当前记录做审计\n\tm := dao.genQ.TemplateSet\n\tq := dao.genQ.TemplateSet.WithContext(kit.Ctx)\n\toldOne, err := q.Where(m.ID.Eq(g.ID), m.BizID.Eq(g.Attachment.BizID)).Take()\n\tif err != nil {\n\t\treturn err\n\t}\n\tad := dao.auditDao.DecoratorV2(kit, g.Attachment.BizID).PrepareDelete(oldOne)\n\n\t// 多个使用事务处理\n\tdeleteTx := func(tx *gen.Query) error {\n\t\tq = tx.TemplateSet.WithContext(kit.Ctx)\n\t\tif _, err := q.Where(m.BizID.Eq(g.Attachment.BizID)).Delete(g); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := ad.Do(tx); err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t}\n\tif err := dao.genQ.Transaction(deleteTx); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "0536645048cfa645507942aaa3363c38", "score": "0.55253226", "text": "func DecryptAttachment(keyPacket []byte, dataPacket []byte, keyRing *crypto.KeyRing) (*crypto.PlainMessage, error) {\n\tsplitMessage := crypto.NewPGPSplitMessage(keyPacket, dataPacket)\n\n\tdecrypted, err := keyRing.DecryptAttachment(splitMessage)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"gopenpgp: unable to decrypt attachment\")\n\t}\n\treturn decrypted, nil\n}", "title": "" }, { "docid": "37c0af3749c88b2b635579c56821c996", "score": "0.552434", "text": "func (sf *Source) Delete(client *http.Client) error {\n\t// if the fileID is nil, then upload function hasn't been called yet\n\tif sf.fileID == \"\" {\n\t\treturn errNothingToDelete\n\t}\n\tsrv, err := drive.New(client)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif err := srv.Files.Delete(sf.fileID).Do(); err != nil {\n\t\treturn err\n\t}\n\t// clearing the file ID so that consequent calls would now that the file\n\t// does not exist\n\tsf.fileID = \"\"\n\treturn nil\n}", "title": "" }, { "docid": "d71518c895d19927c7a7cb6ea2748850", "score": "0.5523674", "text": "func (db Database) DeleteBlob(digest string) {\n\t*db.DeletedBlobs = append(*db.DeletedBlobs, digest)\n}", "title": "" }, { "docid": "6e91d57b0c646723df406ce9c625c19b", "score": "0.5512725", "text": "func (server *ServerConn) Delete(path string) error {\n\t_, _, err := server.cmd(StatusRequestedFileActionOK, \"DELE %s\", path)\n\treturn err\n}", "title": "" }, { "docid": "3c2b8283c8d78cf930bbf777e3667528", "score": "0.5496828", "text": "func deleteFile(t *testing.T, host string, key string, apiKey string) int {\n\n\tendpoint := \"http://\" + host + \"/api/v1/object/\" + key\n\n\tstatusCode, _ := httpCall(t, http.MethodDelete, endpoint, \"\", apiKey, -1, nil, \"\")\n\n\treturn statusCode\n}", "title": "" }, { "docid": "10d5e85195320d48d5609ce3d0ba67aa", "score": "0.5495194", "text": "func (subC *ServerSubConn) Delete(path string) error {\n\t_, _, err := subC.cmd(StatusRequestedFileActionOK, \"DELE %s\", path)\n\treturn err\n}", "title": "" }, { "docid": "6c92c661d86e5fad4e0048e9e0f0ee35", "score": "0.54678917", "text": "func (repository *Repository) Delete(id string) {\n\tcondition := &entity.File{Model: entity.Model{ID: id}}\n\terr := repository.database.Delete(condition).Error\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "b707b71c7855ac8f10b05beeece48c97", "score": "0.54646605", "text": "func (h VideoUploadHandler) deleteFile(path string) {\n\tif path != \"\" {\n\t\tabsPath := filepath.Join(h.webroot, \"videos\", path)\n\t\t_, err := os.Stat(absPath)\n\t\tif err == nil {\n\t\t\terr = os.Remove(absPath)\n\t\t}\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Unable to cleanup file %v. %v\\n\", absPath, err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3ede63593d27f376f57947a56861e041", "score": "0.54631084", "text": "func (app *service) Delete(identity Identity, password string) error {\n\t_, err := app.repository.Retrieve(identity.Name(), identity.Seed(), password)\n\tif err != nil {\n\t\tstr := fmt.Sprintf(\"the identity (name: %s) does not exists and therefore cannot be deleted\", identity.Name())\n\t\treturn errors.New(str)\n\t}\n\n\tpass, err := makePassword(app.hashAdapter, identity.Seed(), password)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfileService, err := app.fileServiceBuilder.Create().WithBasePath(app.basePath).WithPassword(pass).Now()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfilePath := makeFileName(identity.Name(), app.extension)\n\treturn fileService.Delete(filePath)\n}", "title": "" }, { "docid": "9377d233f5c1932274d60db95141bbe3", "score": "0.5457348", "text": "func Delete(c *messagebird.Client, id string) error {\n\treturn c.Request(nil, http.MethodDelete, path+\"/\"+id, nil)\n}", "title": "" }, { "docid": "941e2ca5a39ce9938276ef0be583b7ec", "score": "0.5455131", "text": "func (m *Manager) Delete(ctx context.Context, webhookID string) error {\n\tuserID := ctx.Value(hub.UserIDKey).(string)\n\n\t// Validate input\n\tif _, err := uuid.FromString(webhookID); err != nil {\n\t\treturn fmt.Errorf(\"%w: %s\", hub.ErrInvalidInput, \"invalid webhook id\")\n\t}\n\n\t// Delete webhook from database\n\t_, err := m.db.Exec(ctx, deleteWebhookDBQ, userID, webhookID)\n\tif err != nil && err.Error() == util.ErrDBInsufficientPrivilege.Error() {\n\t\treturn hub.ErrInsufficientPrivilege\n\t}\n\treturn err\n}", "title": "" }, { "docid": "4aa52588061928312018dcc50d6f6579", "score": "0.54498684", "text": "func (c *StorageAttachmentsClient) waitForStorageAttachmentToBeDeleted(name string, timeout time.Duration) error {\n\treturn c.client.WaitFor(\"storage attachment to be deleted\", timeout, func() (bool, error) {\n\t\tinput := &GetStorageAttachmentInput{\n\t\t\tName: name,\n\t\t}\n\t\t_, err := c.GetStorageAttachment(input)\n\t\tif err != nil {\n\t\t\tif client.WasNotFoundError(err) {\n\t\t\t\treturn true, nil\n\t\t\t}\n\t\t\treturn false, err\n\t\t}\n\t\treturn false, nil\n\t})\n}", "title": "" }, { "docid": "d72e69ec9a5295704a5657bdaa9df634", "score": "0.542097", "text": "func (cl *MediaDbClient) Delete(id string, media schema.Media) error {\n\tobjKey := strings.Join([]string{schema.GetBaseKeyFromMediaType(media), id}, \"/\")\n\n\t_, err := cl.s3Client.DeleteObject(context.TODO(), &s3.DeleteObjectInput{\n\t\tBucket: &cl.s3Bucket,\n\t\tKey: &objKey,\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "8fed83437b90b7f4823381907af1a274", "score": "0.54120034", "text": "func (c *MedicalfileClient) DeleteOne(m *Medicalfile) *MedicalfileDeleteOne {\n\treturn c.DeleteOneID(m.ID)\n}", "title": "" }, { "docid": "bfefecfdbcd721ed547a75143e48cfd7", "score": "0.54078275", "text": "func Delete(filename string) error {\n\treturn os.Remove(getFilePath(filename))\n}", "title": "" }, { "docid": "88b9c017c5fbf20e19976156d7b29f62", "score": "0.5404774", "text": "func delete(w http.ResponseWriter, r *http.Request) {\n\tboxType := mux.Vars(r)[\"box\"]\n\tparams := mux.Vars(r)\n\turl := fmt.Sprintf(\"http://%s%s:8000/mail/%s\", boxType, serverIndex, params[\"email\"])\n\n\treq, err := http.NewRequest(\"DELETE\", url, nil)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\tres, err := client.Do(req)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\tdefer res.Body.Close()\n\n}", "title": "" }, { "docid": "f5208ce90499de5d9f63948b22ba3bb2", "score": "0.54039973", "text": "func (s *Service) DeleteCaptiveRecipient(recipientPart string, captiveRecipientInformation *model.CaptiveRecipientInformation) *DeleteCaptiveRecipientOp {\n\treturn &DeleteCaptiveRecipientOp{\n\t\tCredential: s.credential,\n\t\tMethod: \"DELETE\",\n\t\tPath: strings.Join([]string{\"captive_recipients\", recipientPart}, \"/\"),\n\t\tPayload: captiveRecipientInformation,\n\t\tAccept: \"application/json\",\n\t\tQueryOpts: make(url.Values),\n\t\tVersion: esign.APIv21,\n\t}\n}", "title": "" }, { "docid": "f26e461c5c460f4375c3fd8d4533278b", "score": "0.5397258", "text": "func (c *Client) Delete(path string) error {\n\t_, err := c.sendWebDavRequest(\"DELETE\", path, nil)\n\treturn err\n}", "title": "" }, { "docid": "0fa644c527373f45ff09f7e5efb5a4bf", "score": "0.5383412", "text": "func (m *Media) Delete(db XODB) error {\n\tvar err error\n\n\t// if doesn't exist, bail\n\tif !m._exists {\n\t\treturn nil\n\t}\n\n\t// if deleted, bail\n\tif m._deleted {\n\t\treturn nil\n\t}\n\n\t// sql query\n\tconst sqlstr = `DELETE FROM ms.media WHERE Id = ?`\n\n\t// run query\n\tXOLog(sqlstr, m.Id)\n\t_, err = db.Exec(sqlstr, m.Id)\n\tif err != nil {\n\t\tXOLogErr(err)\n\t\treturn err\n\t}\n\n\t// set deleted\n\tm._deleted = true\n\n\tOnMedia_AfterDelete(m)\n\n\treturn nil\n}", "title": "" }, { "docid": "725212112a7edb813b1777d9b2711907", "score": "0.537192", "text": "func (fn DeleteStorageV1alpha1VolumeAttachmentHandlerFunc) Handle(params DeleteStorageV1alpha1VolumeAttachmentParams) middleware.Responder {\n\treturn fn(params)\n}", "title": "" }, { "docid": "6f0809faaa11841e739ec2dc1c3a3296", "score": "0.53619015", "text": "func (c *StreetViewPublishClient) DeletePhoto(ctx context.Context, req *publishpb.DeletePhotoRequest, opts ...gax.CallOption) error {\n\tctx = insertXGoog(ctx, c.xGoogHeader)\n\topts = append(c.CallOptions.DeletePhoto[0:len(c.CallOptions.DeletePhoto):len(c.CallOptions.DeletePhoto)], opts...)\n\terr := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {\n\t\tvar err error\n\t\t_, err = c.streetViewPublishClient.DeletePhoto(ctx, req, settings.GRPC...)\n\t\treturn err\n\t}, opts...)\n\treturn err\n}", "title": "" }, { "docid": "4a41da197d85681ad8a0bd39fc1e49ea", "score": "0.5360875", "text": "func (w *Watcher) delete(ctx context.Context, filePath string) error {\n\t// ignore the error - we can't remember whether is was a dir or a file\n\t_ = w.notifier.RemoveWatch(filePath)\n\n\tdeleteRequest := pb.DeleteRequest{FullPath: strings.TrimPrefix(filePath, w.rootDir)}\n\t_, err := w.replicaClient.Delete(ctx, &deleteRequest)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"server error while deleting %s on remote: %w\", filePath, err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "59d1c36743083a29bd95201aa663941c", "score": "0.5357665", "text": "func (s *ActionsService) DeleteArtifact(ctx context.Context, owner, repo string, artifactID int64) (*Response, error) {\n\tu := fmt.Sprintf(\"repos/%v/%v/actions/artifacts/%v\", owner, repo, artifactID)\n\n\treq, err := s.client.NewRequest(\"DELETE\", u, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn s.client.Do(ctx, req, nil)\n}", "title": "" }, { "docid": "e829433b290642f1351019f838da004b", "score": "0.53512466", "text": "func (r *MonitorSMTPResource) Delete(id string) error {\n\tif err := r.c.ModQuery(\"DELETE\", BasePath+MonitorSMTPEndpoint+\"/\"+id, nil); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5129645b830ace51afdba62f5195e37b", "score": "0.53414625", "text": "func (client fileClient) deleteResponder(resp pipeline.Response) (pipeline.Response, error) {\n\terr := validateResponse(resp, http.StatusOK, http.StatusAccepted)\n\tif resp == nil {\n\t\treturn nil, err\n\t}\n\tio.Copy(ioutil.Discard, resp.Response().Body)\n\tresp.Response().Body.Close()\n\treturn &FileDeleteResponse{rawResponse: resp.Response()}, err\n}", "title": "" }, { "docid": "6e8a16d3b30a588295142cd8a209c9ef", "score": "0.5331454", "text": "func (m *FileMessage) Delete() error {\n\tmessages := m.mailbox.messages\n\tfor i, mm := range messages {\n\t\tif m == mm {\n\t\t\t// Slice around message we are deleting\n\t\t\tm.mailbox.messages = append(messages[:i], messages[i+1:]...)\n\t\t\tbreak\n\t\t}\n\t}\n\tm.mailbox.writeIndex()\n\n\tif len(m.mailbox.messages) == 0 {\n\t\t// This was the last message, writeIndex() has removed the entire\n\t\t// directory\n\t\treturn nil\n\t}\n\n\t// There are still messages in the index\n\tlog.LogTrace(\"Deleting %v\", m.rawPath())\n\treturn os.Remove(m.rawPath())\n}", "title": "" }, { "docid": "dec0e12286ece9b4cbf3a8c630baa64b", "score": "0.53293276", "text": "func Delete(db *gorm.DB, fileName string) error {\n\tlog.Infof(\"Deleting file(name=%s)\", fileName)\n\tvar fm FileMetaData\n\tif db.Where(\"name = ?\", fileName).First(&fm).RecordNotFound() {\n\t\tlog.Debug(\"Meta file doesn't exist, file is counted as deleted\")\n\t\treturn nil\n\t}\n\tvar fragments []Fragment\n\tdb.Where(\"hash_id = ?\", fm.Hash).Find(&fragments)\n\ttx := db.Begin()\n\tfor _, f := range fragments {\n\t\tlog.Debugf(\"Deleted Fragment hash=%s id=%d\", f.HashID, f.FragmentID)\n\t\tif err := tx.Delete(&f).Error; err != nil {\n\t\t\ttx.Rollback()\n\t\t\treturn err\n\t\t}\n\t}\n\t// Delete file\n\tif err := tx.Delete(&fm).Error; err != nil {\n\t\ttx.Rollback()\n\t\treturn err\n\t}\n\ttx.Commit()\n\treturn nil\n}", "title": "" }, { "docid": "7367f40b3bc6d0a016d92d5f56bdc7bd", "score": "0.53250736", "text": "func (a *api) DeleteFile(fileID int64) error {\n\tparams := url.Values{}\n\tvar out interface{}\n\tif err := a.Request(\"DELETE\", \"/api/v3/files/\"+fmt.Sprint(fileID)+\"\", params, nil, &out); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "171a3c894fdc1ef9f5f4c0a4ba906ee9", "score": "0.5305308", "text": "func DeleteAnnouncement(db *gorm.DB, w http.ResponseWriter, r *http.Request) {\n\tif !Authorize(db, w, r) {\n\t\treturn\n\t}\n\tvars := mux.Vars(r)\n\n\tid := vars[\"aid\"]\n\n\tann := getAnnOr404(db, id, w, r)\n\tif ann == nil {\n\t\treturn\n\t}\n\tif err := db.Delete(&ann).Error; err != nil {\n\t\tRespondError(w, http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\tRespondJSON(w, http.StatusNoContent, nil)\n}", "title": "" }, { "docid": "78a437cd9242dcd01b2dc95703673b50", "score": "0.53011554", "text": "func (a *adapter) DeleteManifest(repository, reference string) error {\n\tparts := strings.Split(repository, \"/\")\n\tif len(parts) != 2 {\n\t\treturn fmt.Errorf(\"dockerhub only support repo in format <namespace>/<name>, but got: %s\", repository)\n\t}\n\n\tresp, err := a.client.Do(http.MethodDelete, deleteTagPath(parts[0], parts[1], reference), nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\tbody, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif resp.StatusCode/100 != 2 {\n\t\tlog.Errorf(\"Delete tag error: %d -- %s\", resp.StatusCode, string(body))\n\t\treturn fmt.Errorf(\"%d -- %s\", resp.StatusCode, string(body))\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a318f13a023b0363e4124007bd4fad36", "score": "0.5294501", "text": "func (r *GroupPolicyDefinitionFileRequest) Delete(ctx context.Context) error {\n\treturn r.JSONRequest(ctx, \"DELETE\", \"\", nil, nil)\n}", "title": "" }, { "docid": "3991004c02b1ae53826fbc8955a5cdba", "score": "0.5291158", "text": "func (m *Methods) DeleteRecording(params *AssetParams, reply *GenericReply) error {\n\t// Stop and delete a scheduled task (timer)\n\tif _, ok := m.tasks[params.AssetUid]; ok {\n\t\ts := m.tasks[params.AssetUid].StartTimer.Stop()\n\t\tif s == true {\n\t\t\tlog.Println(\"Start timer for task \" + params.AssetUid + \" stopped and removed\")\n\t\t} else {\n\t\t\tlog.Println(\"Start timer for task \" + params.AssetUid + \" already expired\")\n\t\t}\n\n\t\t// Stop recording\n\t\t// TODO: also check by asset Status\n\t\tif time.Now().Unix() > m.tasks[params.AssetUid].Start && time.Now().Unix() < m.tasks[params.AssetUid].End {\n\t\t\tm.tasks[params.AssetUid].Channel <- \"stop\"\n\t\t}\n\n\t\t// Delete a task (timer) from pool\n\t\tdelete(m.tasks, params.AssetUid)\n\t}\n\n\t// Delete asset from db\n\tif err := m.db.inst.Delete([]byte(params.AssetUid), nil); err != nil {\n\t\tlog.Println(\"DeleteRecording m.db.inst.Delete error:\", err)\n\t\treturn err\n\t}\n\tlog.Println(\"Asset \" + params.AssetUid + \" removed\")\n\n\tabsf := m.cfg.opts[\"mediadir\"] + \"/\" + params.AssetFilename\n\tabsfi := m.cfg.opts[\"mediadir\"] + \"/\" + params.AssetFilename + \".idx\"\n\n\t// Delete file from fs (if it exists)\n\tif _, err := os.Stat(absf); err == nil {\n\t\tlog.Println(\"Deleting asset:\", absf)\n\t\tif err := os.Remove(absf); err != nil {\n\t\t\tlog.Println(\"DeleteRecording os.Remove error:\", err)\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Delete index file from fs (if it exists)\n\tif _, err := os.Stat(absfi); err == nil {\n\t\tlog.Println(\"Deleting asset index:\", absfi)\n\t\tif err := os.Remove(absfi); err != nil {\n\t\t\tlog.Println(\"DeleteRecording index os.Remove error:\", err)\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif reply != nil {\n\t\t*reply = GenericReply{Status: \"OK\"}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "218eac46eacecfce35da281f2557c3d1", "score": "0.52910274", "text": "func (*FileOperation) Delete(fs533FileName string) {\n\tvar err = os.Remove(fs533FileName)\n\n\tif err != nil {\n\t\tlog.Printf(\"Error: it is unable to remove file %s due to error %s\\n\", fs533FileName, err.Error())\n\t\treturn\n\t}\n\n\tlog.Printf(\"File %s is removed\\n\", fs533FileName)\n}", "title": "" }, { "docid": "4a57ed79699bd933215c26089327a101", "score": "0.5284724", "text": "func (backend *Backend) DeleteBlob(blob *media.Blob) error {\n\tpanic(\"not implemented\")\n}", "title": "" }, { "docid": "bf88c108ee65358b87f4ecac48c19ed2", "score": "0.5276941", "text": "func (mg *MailgunImpl) DeleteCredential(ctx context.Context, login string) error {\n\tif login == \"\" {\n\t\treturn ErrEmptyParam\n\t}\n\tr := newHTTPRequest(generateCredentialsUrl(mg, login))\n\tr.setClient(mg.Client())\n\tr.setBasicAuth(basicAuthUser, mg.APIKey())\n\t_, err := makeDeleteRequest(ctx, r)\n\treturn err\n}", "title": "" }, { "docid": "1be2bef60d31882f7bcf97c159dac013", "score": "0.5270613", "text": "func (a *Analyzer) delete(ec echo.Context) error {\n\tlog.Debug(\"delete report\")\n\n\tuser := ec.Param(\"user\")\n\tendpoint := ec.Param(\"endpoint\")\n\tid := ec.Param(\"id\")\n\tfolder := filepath.Join(a.reportsDir, user, endpoint, id)\n\tif err := os.RemoveAll(folder); err != nil {\n\t\tlog.Warnf(\"Could not delete Analysis report folder: %s\", folder)\n\t\treturn echo.NewHTTPError(http.StatusInternalServerError, \"Could not delete report\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b0d76364f8cb3f726779366e0347a037", "score": "0.5265907", "text": "func DeleteEmail(cfg *model.Config, email string, id int) {\n\tif err := SetFlag(cfg, email, id, imap.DeletedFlag); err != nil {\n\t\tlog.Println(\"set flag error:\", err)\n\t\treturn\n\t}\n\n\t// delete from memory\n\tdeleteMessage(email, id)\n}", "title": "" }, { "docid": "49c246db856d25de420acd454bbc4ac2", "score": "0.52648556", "text": "func (h *vaultMountHandler) Delete(evt *cloudformation.Event, ctx *lambdaruntime.Context) error {\n\t_, res, err := h.resource(evt)\n\n\tif err == nil {\n\t\tres.client.SetMaxRetries(1)\n\t\tres.client.SetClientTimeout(30 * time.Second)\n\t\terr = res.doUnmount()\n\t}\n\n\tif err != nil {\n\t\tlog.Printf(\"Vault Mount - skipping delete: %v\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "8a3e4018e2d80cc290478792e72910b0", "score": "0.5257747", "text": "func (cloud *CloudClient) deleteFile(path string) error {\n\terr := cloud.conn.ObjectDelete(cloud.container, filepath.Base(path))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"delete file error: 'BackupClient:deleteFile' %s to storage: %q\\nHeaders\", path, err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d249f80b49018549a8ae33ac037cbd63", "score": "0.525726", "text": "func UnmarshalAttachment(m map[string]json.RawMessage, result interface{}) (err error) {\n\tobj := new(Attachment)\n\terr = core.UnmarshalPrimitive(m, \"attachment_id\", &obj.AttachmentID)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"rule_id\", &obj.RuleID)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"account_id\", &obj.AccountID)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"included_scope\", &obj.IncludedScope, UnmarshalRuleScope)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"excluded_scopes\", &obj.ExcludedScopes, UnmarshalRuleScope)\n\tif err != nil {\n\t\treturn\n\t}\n\treflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))\n\treturn\n}", "title": "" }, { "docid": "89ac26c21da42574444e69cf9d860e22", "score": "0.5252734", "text": "func (daf *DdgAdminFile) Delete(ctx context.Context, key ...interface{}) error {\n\tvar err error\n\tvar dbConn *sql.DB\n\n\t// if deleted, bail\n\tif daf._deleted {\n\t\treturn nil\n\t}\n\n\ttx, err := components.M.GetConnFromCtx(ctx)\n\tif err != nil {\n\t\tdbConn, err = components.M.GetMasterConn()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\ttableName, err := GetDdgAdminFileTableName(key...)\n\tif err != nil {\n\t\treturn err\n\t}\n\t//1\n\n\t// sql query with composite primary key\n\tsqlstr := `UPDATE ` + tableName + ` SET is_del = 1 WHERE file_id = ?`\n\n\t// run query\n\tutils.GetTraceLog(ctx).Debug(\"DB\", zap.String(\"SQL\", fmt.Sprint(sqlstr, daf.FileID)))\n\tif tx != nil {\n\t\t_, err = tx.Exec(sqlstr, daf.FileID)\n\t} else {\n\t\t_, err = dbConn.Exec(sqlstr, daf.FileID)\n\t}\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// set deleted\n\tdaf._deleted = true\n\n\treturn nil\n}", "title": "" }, { "docid": "c98a9fc08ffd1295599610a8723d4038", "score": "0.52521884", "text": "func (s *EmailServiceOp) Delete(emailID string) (*Response, error) {\n\tif validateErr := ValidateUUID(emailID); validateErr != nil {\n\t\treturn nil, validateErr\n\t}\n\tapiPath := path.Join(emailBasePath, emailID)\n\n\tresp, err := s.client.DoRequest(\"DELETE\", apiPath, nil, nil)\n\tif err != nil {\n\t\treturn resp, err\n\t}\n\n\treturn resp, err\n}", "title": "" }, { "docid": "d9b82eac589a50dcf8018e816c66a1fb", "score": "0.52503306", "text": "func (f *Fs) deleteObject(ctx context.Context, id string) (err error) {\n\tvar resp *http.Response\n\topts := rest.Opts{\n\t\tMethod: \"PATCH\",\n\t\tPath: \"/files\",\n\t\tExtraHeaders: map[string]string{\"Accept\": \"application/vnd.api+json\"},\n\t}\n\tdelete := api.WriteMultiMetadataRequest{\n\t\tMeta: []api.WriteMetadata{\n\t\t\t{\n\t\t\t\tAttributes: api.WriteAttributes{\n\t\t\t\t\tStatus: \"51\", // Status \"51\" is deleted\n\t\t\t\t},\n\t\t\t\tID: id,\n\t\t\t\tType: \"files\",\n\t\t\t},\n\t\t},\n\t}\n\terr = f.pacer.Call(func() (bool, error) {\n\t\tresp, err = f.srv.CallJSON(ctx, &opts, &delete, nil)\n\t\treturn shouldRetry(ctx, resp, err)\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"delete object failed: %w\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "82bb39bb11ba3e76b3172fff5802497f", "score": "0.5249002", "text": "func (s *Store) DeleteBlob(digest string) error {\n\tdigest, err := s.ResolveDigest(digest)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error resolving digest: %v\", err)\n\t}\n\tblobLock, err := lock.ExclusiveKeyLock(s.blobLockDir, digest)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error locking blob: %v\", err)\n\t}\n\tdefer blobLock.Close()\n\n\terr = s.db.Do(func(tx *sql.Tx) error {\n\t\tif err := removeBlob(tx, digest); err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"cannot remove blob with digest %s from db: %v\", digest, err)\n\t}\n\n\t// Then remove non transactional data (diskv store)\n\tif err := s.blobStore.Erase(digest); err != nil {\n\t\treturn ErrRemovingBlobContents\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "cd356f2046f2fa99b1dbc3fedbd2fb43", "score": "0.5247549", "text": "func (ph *ProjectHandler) RemoveAsset(pid string, filename string) error {\n\n\tif err := ph.PService.RemoveAttachedFile(pid, filename); err != nil {\n\t\treturn err\n\t}\n\tif err := ph.PService.RemoveFile(filename); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n\n}", "title": "" }, { "docid": "8e4ce237f249bdde5244d194acaa5ce9", "score": "0.52467537", "text": "func (o *AbnormalClaim) Delete(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"model: no AbnormalClaim provided for delete\")\n\t}\n\n\targs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), abnormalClaimPrimaryKeyMapping)\n\tsql := \"DELETE FROM `abnormal_claim` WHERE `id`=?\"\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args...)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"model: unable to delete from abnormal_claim\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "01e189a8918c25b9b5fe7648295fa824", "score": "0.52456146", "text": "func DeleteBlob(ctx *context.Context, repo string, digest string, proto string, protoVersion string) error {\n\tstoragePath := ComposeBlobPath(repo, digest, proto, protoVersion)\n\tlogs.Debug(\"Delete '%s'.\", storagePath)\n\n\treturn Driver().Delete(*ctx, storagePath)\n}", "title": "" }, { "docid": "349b992f774c4810e548e16aa7bc3a25", "score": "0.5245386", "text": "func (driver *MainDriver) DeleteFile(cc server.ClientContext, path string) error {\n\treturn nil\n}", "title": "" }, { "docid": "0d854a2b30c5ab3514195e83fe115700", "score": "0.52369696", "text": "func (d *Db) Delete(file string) error {\n\tsession, err := mgo.Dial(d.Address)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer session.Close()\n\tg := session.DB(d.Database).GridFS(PREFIX)\n\terr = g.Remove(file)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a530d99c3a7a4662ceecfa718fa51fe3", "score": "0.5236388", "text": "func (storage *HubicStorage) DeleteFile(threadIndex int, filePath string) (err error) {\n err = storage.client.DeleteFile(storage.storageDir + \"/\" + filePath)\n if e, ok := err.(HubicError); ok && e.Status == 404 {\n LOG_DEBUG(\"HUBIC_DELETE\", \"Ignore 404 error\")\n return nil\n }\n return err\n}", "title": "" }, { "docid": "6163c84d65047f83dcbd698d929cd4a9", "score": "0.52354324", "text": "func (a *Asset) Delete(stub *sw.StubWrapper) ([]byte, errors.ICCError) {\n\t// Check if asset is referenced in other assets to avoid data inconsistency\n\tisReferenced, err := a.IsReferenced(stub)\n\tif err != nil {\n\t\treturn nil, errors.WrapError(err, \"failed to check if asset if being referenced\")\n\t}\n\tif isReferenced {\n\t\treturn nil, errors.NewCCError(\"another asset holds a reference to this one\", 400)\n\t}\n\n\treturn a.delete(stub)\n}", "title": "" } ]
c34ceae05f3b910cda25ca49d9e548f6
WithHTTPClient adds the HTTPClient to the get regions by credential Id params
[ { "docid": "b9c863c7fb19145643b38931c2a93216", "score": "0.7847658", "text": "func (o *GetRegionsByCredentialIDParams) WithHTTPClient(client *http.Client) *GetRegionsByCredentialIDParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "title": "" } ]
[ { "docid": "b59897b80963c2fe9ef7a75420032730", "score": "0.7288664", "text": "func (o *GetRegionsByCredentialIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "22fb90c08cafd167da83c7fe053a279e", "score": "0.68370676", "text": "func NewGetRegionsByCredentialIDParamsWithHTTPClient(client *http.Client) *GetRegionsByCredentialIDParams {\n\tvar ()\n\treturn &GetRegionsByCredentialIDParams{\n\t\tHTTPClient: client,\n\t}\n}", "title": "" }, { "docid": "f5bbc1fcd2506fedc25f807106b072bd", "score": "0.6451904", "text": "func (o *GetRegionParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "5cbb0f62ea3d7f2d6668da8922c10a7c", "score": "0.64328533", "text": "func (o *GetRegionParams) WithHTTPClient(client *http.Client) *GetRegionParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "title": "" }, { "docid": "4a27012e3725804ee3d8053a98b23ddf", "score": "0.6051046", "text": "func (o *GetSubaccountByIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "b9ec872fd7cd56459136dd993d204bb5", "score": "0.57855564", "text": "func (o *GetGerritProjectsByIDUsingGETParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "5ccc6ef502b7b664d54e998f525f8b5d", "score": "0.5782301", "text": "func (o *GetLicenseUsingGETParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "78d5fc8d137bbbac8732b85a8719846a", "score": "0.57781786", "text": "func NewGetRegionParamsWithHTTPClient(client *http.Client) *GetRegionParams {\n\treturn &GetRegionParams{\n\t\tHTTPClient: client,\n\t}\n}", "title": "" }, { "docid": "eb70ee46afdb074d562d5e864680449a", "score": "0.5757203", "text": "func (o *GetLogRequestsEcdnByIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "f648bf3e941bc3b187792848ff5a8532", "score": "0.572438", "text": "func (o *GetRegionsByCredentialIDParams) WithBody(body *model.PlatformResourceRequestJSON) *GetRegionsByCredentialIDParams {\n\to.SetBody(body)\n\treturn o\n}", "title": "" }, { "docid": "5810d292784c41025cedf754291db73f", "score": "0.5717501", "text": "func (o *GetRegionsByCredentialIDParams) WithContext(ctx context.Context) *GetRegionsByCredentialIDParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "85a0dd3e562f3f36c907042767b06525", "score": "0.5677583", "text": "func (o *CollectdByPluginidGetParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "bc18d56dc3fe53616a3507e607452b48", "score": "0.562611", "text": "func (o *GetIdentityIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "c71dece62a70f080260465d5b71c5bef", "score": "0.5589022", "text": "func (o *GetRegionsByCredentialIDParams) WithTimeout(timeout time.Duration) *GetRegionsByCredentialIDParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "title": "" }, { "docid": "60197cc8c7cf90789051240e8aa0a479", "score": "0.5578454", "text": "func (o *IntakeFindByClientIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "605f8cef01d2045c0f088c12debaa0f6", "score": "0.55467886", "text": "func (o *HooksGetByIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "b535fa7c3150728649b1de228ccc3ea5", "score": "0.5543424", "text": "func (o *GetGlobalPreferencesPreferenceGroupsByIDByIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "51fbb8e840122e8a4f38b9691275eaff", "score": "0.5542032", "text": "func (o *GetEscalationChainByIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "31c4ee16573a19ed643b62225a88e073", "score": "0.55211467", "text": "func (o *GetCatalogsByIDSharedVariationAttributesByIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "8b1f0d3e1ea0ff3f12cbf8712a2e3300", "score": "0.5516865", "text": "func (o *GetRestByIDByIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "1ab699f70c15376218f90850ce53fab8", "score": "0.55077124", "text": "func (o *GetComponentByIDUsingGETParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "b24a099988ce3aec63817208e176c238", "score": "0.5505325", "text": "func (o *GetSitesByIDSlotsByIDByIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "e18f683928fdf5b39a95510a73cce1dc", "score": "0.5466138", "text": "func (o *GetSellerConnectionsUsingGETParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "d5ccc7f3abb45b57c80394476f47a3e3", "score": "0.54621226", "text": "func (o *GetCatalogsByIDSharedVariationAttributesByIDValuesParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "4a1eefa529f4495afd1dd01993de29a6", "score": "0.54617494", "text": "func (o *GetUserRoleMappingGivenUserIDUsingGETParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "081d561b1af8a94a5ea26ef675bdf520", "score": "0.54588026", "text": "func (o *GetPrivateCancelTransferByIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "262097111568bf1b6a6a5dc4649d076a", "score": "0.54565346", "text": "func (o *GetRoutesByAthleteIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "12c5f94744052ddede088cd195d354e6", "score": "0.54473376", "text": "func (o *GetBasketsByIDPaymentMethodsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "c36730a0e666a3ceee707b06e48397d7", "score": "0.5445203", "text": "func (o *GetProjectByIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "7706eb5cc2a184676d2f327e378ac320", "score": "0.54339147", "text": "func (o *GetSubaccountParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "7a4b5fea134d373dadc01173d7fd45f4", "score": "0.5432131", "text": "func (o *PutLolHighlightsV1HighlightsByIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "92c43772f009c1b432893f51afdac170", "score": "0.54309213", "text": "func (o *APIGetApikeyByIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "4e3a79db5692a609f5c1b3ce4dcb64f2", "score": "0.5424849", "text": "func (o *SecurityKeyManagerCollectionGetParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "586254f059c7bea1b1d1feecd4811b7b", "score": "0.5418381", "text": "func (o *GetAPIKeyByIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "d47323e6ec047c5430bbd843bea000a4", "score": "0.54178447", "text": "func NewGetRegionsByCredentialIDParamsWithTimeout(timeout time.Duration) *GetRegionsByCredentialIDParams {\n\tvar ()\n\treturn &GetRegionsByCredentialIDParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "title": "" }, { "docid": "8c4008ca1baee419781f9f400fec8858", "score": "0.5413775", "text": "func (o *ExistingTanzuClustersUsingGETParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "6d7f99c977a6e151c3b3be84e572882e", "score": "0.5413615", "text": "func (o *GetDeploymentsUsingGETParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "f1c7365154142b8b815f4e86c6e89f55", "score": "0.54069984", "text": "func (o *GetTenantsTenantIDMetricsQueryRangeParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "87141ff4f179c3ff1fe625e1abd4efc5", "score": "0.53976065", "text": "func (o *GetDeploymentExpenseHistoryByIDUsingGET2Params) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "900be7d4148450152c2d5461ca0a2ab0", "score": "0.5385005", "text": "func (o *GetV1IncidentsIncidentIDEventsEventIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "033fb71b5ad0dbf6057e322484bc7844", "score": "0.5368583", "text": "func (o *GetAuthorizedInfoParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "e33c7fe41f6c27f31f8bb523de8b0130", "score": "0.5364018", "text": "func (o *AccidentStatsGetParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "67ae381e8db190c36eb9814f24c3294e", "score": "0.5335544", "text": "func (o *GetLicenseUsingGETParams) WithHTTPClient(client *http.Client) *GetLicenseUsingGETParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "title": "" }, { "docid": "443b062900e5c8e691df41e8589876ff", "score": "0.5330791", "text": "func WithHTTPClient(client HTTPClient) ProviderOpt {\n\treturn remote.WithHTTPClient(client)\n}", "title": "" }, { "docid": "7f2dcacd47e41623edbf3ad23ad64441", "score": "0.532424", "text": "func (o *GetRegistriesIDNamespaceParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "9ce5ddfa4f2e53a89eeaa600ff2ebd7d", "score": "0.5320005", "text": "func (o *VaultGetAllVaultItemsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "9799f71910173e98ad05904923fd02ae", "score": "0.5319441", "text": "func (a *Client) GetRegions(params *GetRegionsParams, opts ...ClientOption) (*GetRegionsOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetRegionsParams()\n\t}\n\top := &runtime.ClientOperation{\n\t\tID: \"getRegions\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/iaas/api/regions\",\n\t\tProducesMediaTypes: []string{\"app/json\", \"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &GetRegionsReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t}\n\tfor _, opt := range opts {\n\t\topt(op)\n\t}\n\n\tresult, err := a.transport.Submit(op)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*GetRegionsOK)\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 getRegions: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "f42a71a021befdbdd401bb05066a3edd", "score": "0.531716", "text": "func NewGetRegionsByCredentialIDParams() *GetRegionsByCredentialIDParams {\n\tvar ()\n\treturn &GetRegionsByCredentialIDParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "4a515034c6163101244d024c1745b75d", "score": "0.53156215", "text": "func (o *GetAuthorizationV1APIResourcesParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "0a7f684b0b4951e064d8119ebc6a7395", "score": "0.5308972", "text": "func (o *GetClubAdminsByIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "028640f11ae855e11ef40528fddd13ce", "score": "0.52936107", "text": "func (o *QueryWalletsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "f17a784c5482ea26a65b55b093326687", "score": "0.5293279", "text": "func (o *GetLolLobbyV1CustomGamesByIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "997d3493ba63f3a69fa44b59bad187a5", "score": "0.52869195", "text": "func (o *DeleteIPAMsubnetsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "26b5cd6e8ca1c37a2adb4d4d0331ab4d", "score": "0.5284604", "text": "func (o *QueryPaymentProviderConfigParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "226c957a2dec25e663a1eba557ebd355", "score": "0.528412", "text": "func (o *GetRobotByIDV1Params) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "76b8974cef51be46c9cad3b87116b3e8", "score": "0.5283966", "text": "func (o *VaultGetVaultItemParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "733cfe2a6c8c2d4c72878d12b1b9f64a", "score": "0.52830595", "text": "func (o *GetSuitesByTestCaseIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "521caf58f3718a703ac7e6fba3244935", "score": "0.52819264", "text": "func (o *GetSnapshotRepstateParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "6fee1bc00baac4b3b1252901d9c2207a", "score": "0.5271957", "text": "func (o *GetLolInventoryV1WalletParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "5783c6a750b65df18a996dcde226d362", "score": "0.52716315", "text": "func WithHTTPClient(h *http.Client) Opts {\n\treturn func(a *auth) {\n\t\tif h != nil {\n\t\t\ta.httpClient = h\n\t\t}\n\t}\n}", "title": "" }, { "docid": "6f31ea11ee53d70607c696260325c518", "score": "0.5268102", "text": "func (o *ReadRegistryEntitiesParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "a54214930b7d138512b9aea7b2878463", "score": "0.526761", "text": "func (o *MapPointMeasurementsUsingGETParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "322fec006398de036a557216f54f8de6", "score": "0.5264553", "text": "func (o *RbacRolesGetParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "75651f7939d1c5e073d551e98ee13844", "score": "0.5259319", "text": "func (o *GetKubernetesCredentialsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "2bbd429da9ef3e3c5a529349fd310418", "score": "0.5255843", "text": "func (o *PublicGetMyEntitlementOwnershipByItemIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "1d63f2f1b808f0a81bdfdd59b5eff3ce", "score": "0.52530074", "text": "func (o *GetTenantsTenantIDMetricsAPIV1QueryParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "40647058906085041db7278b556ad9ed", "score": "0.52504754", "text": "func (o *CatalogGetParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "f146c1684c98fc3ded8a121c9643c99f", "score": "0.524862", "text": "func (o *PutAddressIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "cb970f2c09f79e277bb95b53d3815485", "score": "0.5247751", "text": "func (o *DeleteAuditCredentialByResourceCrnV1Params) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "b49572c926e193067bb8e0f3073de0ee", "score": "0.5245961", "text": "func WithHTTPClient(httpClient *http.Client) ClientOption {\n\treturn func(client *Client) {\n\t\tclient.client = httpClient\n\t}\n}", "title": "" }, { "docid": "175ff6f6b3856804f4edfd265f35381b", "score": "0.52451897", "text": "func WithHTTPClient(httpClient *http.Client) ClientOptionFunc {\n\treturn func(c *Client) {\n\t\tc.client = httpClient\n\t}\n}", "title": "" }, { "docid": "90c72995a3332199f51e7e53f7c59cc9", "score": "0.5241673", "text": "func (o *GetIngredientVersionParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "abea9600288efedf2c15e1935fd8b36e", "score": "0.5239927", "text": "func (o *KeyManagerKeysCollectionGetParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "4240973b1969a4912919544be5e076b4", "score": "0.5239826", "text": "func (o *DeleteCodeVersionsByIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "924862d64100b690b2aab603061d4734", "score": "0.5235339", "text": "func (o *ListAuthConfigsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "c80a63d55aac2e35044104cea312bbe0", "score": "0.5235221", "text": "func (o *PutProductsByIDVariationGroupsByIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "058a788f75da326483547685e3ce6e5d", "score": "0.5233896", "text": "func (o *MultiDeleteProjectVersionOfAuthEntityParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "9acadad8471dbebfda4a38a6181d3b30", "score": "0.5232497", "text": "func (o *GetLogRequestsEcdnByIDParams) WithHTTPClient(client *http.Client) *GetLogRequestsEcdnByIDParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "title": "" }, { "docid": "d3042bd6ba9fbeb142afaf613cdc81a5", "score": "0.52323556", "text": "func (o *GetCoursesForResourceParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "9f1938dd379a03e74b9550a53e1af3af", "score": "0.5231436", "text": "func (o *PrivateInteractiveLoginCredentialParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "5b23284609a2a948e94f6760754296c7", "score": "0.52294445", "text": "func (o *PatchOrdersByIDPaymentInstrumentsByIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "d4d565cddfa2a44d3e6c79b07ede0b24", "score": "0.52243567", "text": "func (o *GetComponentByIDUsingGETParams) WithHTTPClient(client *http.Client) *GetComponentByIDUsingGETParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "title": "" }, { "docid": "95c633233a3a35aecfd3c9779f17e59a", "score": "0.5216834", "text": "func (o *DeleteAccessgroupsSitesGroupidSiteidParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "148bde7a484417a530880d8bb292eb8d", "score": "0.5208537", "text": "func (o *NumbersSearchByCountryGetParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "59985c132c0f61e07e33ab8ce2fbbeb6", "score": "0.5203998", "text": "func (o *GetContentSelectorParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "6083de2ec2943d11cc506d0997df168d", "score": "0.5197372", "text": "func WithHTTPClient(httpClient *http.Client) ClientOption {\n\treturn func(client *Client) {\n\t\tclient.httpClient = httpClient\n\t}\n}", "title": "" }, { "docid": "4d81adab1616c5e9be618dd31a6314ff", "score": "0.519623", "text": "func (o *QueriesRolesV1Params) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "5287d73b9e5f405d66331a86d4d84daa", "score": "0.5192846", "text": "func (o *MiscellaneousGetTimezoneByIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "5c7fafb22618bfc46b7e98e6e418eb16", "score": "0.51892173", "text": "func WithHTTPClient(httpclient *http.Client) Option {\n\treturn func(client *Client) {\n\t\tclient.httpClient = httpclient\n\t}\n}", "title": "" }, { "docid": "1e1fa95a15c232d447536ac929219ec1", "score": "0.5184418", "text": "func WithHTTPClient(client *http.Client) Option { return withHTTPClient{client} }", "title": "" }, { "docid": "d06cbea5298c6129974b95e7e61701eb", "score": "0.5182325", "text": "func (o *PostDatabaseCredentialsDatabaseCredentialIDOperationsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "1b49e8e0e36bbe4721f2874a9f2b6771", "score": "0.5180358", "text": "func (o *SearchGroupsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "a3429e7a0663a6f02420fa08f81063f2", "score": "0.5177585", "text": "func (o *GetSearchTagItemsMoidParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "417724d16f1dbc2de47891ad24601b49", "score": "0.5176505", "text": "func (o *GetCatalogItemsUsingGET1Params) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "4b09d377d757830e3e14bfc8f8962537", "score": "0.5175599", "text": "func WithHTTPClient(httpclient HTTPClient) ClientOption {\n\treturn func(client *Client) {\n\t\tclient.httpClient = httpclient\n\t}\n}", "title": "" }, { "docid": "9053f2dca9ac28713dc6e9aa126e6795", "score": "0.51754874", "text": "func (o *IpamAggregatesListParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "dddc284ae870794a0f1f393fe86abe71", "score": "0.5165763", "text": "func (o *DeleteAPITokenByIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "47c7fad5b239a3ec27d2ac3482cd2e43", "score": "0.5163976", "text": "func (o *LdapCollectionGetParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "0f06084eadb2d52cb0424a6badeebfad", "score": "0.5162087", "text": "func (o *PutAccessgroupsSitesGroupidSiteidParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "19cb861af5453cd99e77e1746ad15082", "score": "0.5155795", "text": "func (o *DeleteBasketsByIDPriceAdjustmentsByIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" } ]
6bf47b6532da5f5c20d7909cb7ecc236
3 4 ,5 6,2 7, 1 9
[ { "docid": "f51d1792289445825d16e7b2fc9d8f1c", "score": "0.0", "text": "func Merge(leftArr, rightArr []int) []int {\n\tfmt.Println(\"leftArr, rightArr => \", leftArr, rightArr)\n\tmergeArr := make([]int, 0)\n\n\tfor len(leftArr) != 0 && len(rightArr) != 0 {\n\t\tif leftArr[0] >= rightArr[0] {\n\t\t\tmergeArr = append(mergeArr, rightArr[0])\n\t\t\trightArr = rightArr[1:]\n\t\t} else {\n\t\t\tmergeArr = append(mergeArr, leftArr[0])\n\t\t\tleftArr = leftArr[1:]\n\t\t}\n\t}\n\n\tif len(rightArr) != 0 {\n\t\tmergeArr = append(mergeArr, rightArr...)\n\t}\n\tif len(leftArr) != 0 {\n\t\tmergeArr = append(mergeArr, leftArr...)\n\t}\n\treturn mergeArr\n}", "title": "" } ]
[ { "docid": "818713ac071b923e7ab64d81ea2fa7da", "score": "0.5650057", "text": "func next(base []int) []int {\n\tx := []int{1, 2, 3, 4, 5, 6, 7, 8, 9}\n\tif n := len(base); n >= 9 {\n\t\treturn nil\n\t} else if n == 0 {\n\t\treturn x\n\t}\n\ttmp := []int{}\n\tfor _, i := range x {\n\t\tif !contains(i, base) {\n\t\t\tif mid := middle(i, base[len(base)-1]); mid == 0 || contains(mid, base) {\n\t\t\t\ttmp = append(tmp, i)\n\t\t\t}\n\t\t}\n\t}\n\treturn tmp\n}", "title": "" }, { "docid": "8eca4ee118cf67dd7380c34aa17bfbf4", "score": "0.5413707", "text": "func Quo(a []int, b []int, r []int) {\n\n}", "title": "" }, { "docid": "2f7059d7039f4894f63d1a8580a2d13f", "score": "0.53295964", "text": "func kaprekarNumbers(p int32, q int32) {\n\tinv := true\n\tfor i := p; i <= q; i++ {\n\t\tif kaprekar(i) {\n\t\t\tfmt.Print(i, \" \")\n\t\t\tinv = false\n\t\t}\n\t}\n\tif inv {\n\t\tfmt.Print(\"INVALID RANGE\")\n\t}\n}", "title": "" }, { "docid": "537164ff58b7282dde731646b8e11c55", "score": "0.523842", "text": "func atMostNGivenDigitSet(D []string, N int) int {\n \n}", "title": "" }, { "docid": "b062e8cf8799ca34a51324133cbdab0e", "score": "0.5215408", "text": "func five() {\n\tfmt.Println(\"//-------------------------------\")\n\tx := []int{42, 43, 44, 45, 46, 47, 48, 49, 50, 51}\n\ty := append(x[0:3], x[6:]...)\n\tfmt.Println(y)\n\n}", "title": "" }, { "docid": "595939bb68aeac48eb45fa6bbc00f34d", "score": "0.51994777", "text": "func split(sum int) (x,y int){\n\tx = sum *4/9\n\ty = sum - x \n\treturn \n}", "title": "" }, { "docid": "da643f7bc53c0e803f1ca75f4c8c91e2", "score": "0.5178702", "text": "func main() {\n\tvar numbers = make([]int,3,5)\n\tprintSlice(numbers)\n}", "title": "" }, { "docid": "804063c1360e0ab27ad8af3ec5cf533a", "score": "0.51745754", "text": "func minJumps(arr []int) int {\n\tl := len(arr)\n\tif l <= 1 {\n\t\treturn 0\n\t}\n\t// 记录每一个number对应的位置, unique记录数组是否有重复的数据。如果没有,直接返回l-1\n\tnumberMap, unique := make(map[int][]int), true\n\t// 这里使用倒序遍历主要是应对测试用例[7,7,7,7,7.......7,7,11]\n\tfor i := l - 1; i >= 0; i-- {\n\t\tnumberMap[arr[i]] = append(numberMap[arr[i]], i)\n\t\tif len(numberMap[arr[i]]) >= 2 {\n\t\t\tunique = false\n\t\t}\n\t}\n\tif unique {\n\t\treturn l - 1\n\t}\n\tqueue, step := make([]int, 0), 0\n\t// 记录哪些位置已经被遍历过\n\tarrivedMap := make(map[int]bool)\n\tqueue = append(queue, 0)\n\tarrivedMap[0] = true\n\tfor len(queue) > 0 {\n\t\tcurLen := len(queue)\n\t\tstep++\n\t\tfor i := 0; i < curLen; i++ {\n\t\t\tpos := queue[0]\n\t\t\tqueue = queue[1:]\n\t\t\t// 处理下一个元素\n\t\t\tif pos+1 < l {\n\t\t\t\tif pos+1 == l-1 {\n\t\t\t\t\treturn step\n\t\t\t\t} else {\n\t\t\t\t\tif !arrivedMap[pos+1] {\n\t\t\t\t\t\tqueue = append(queue, pos+1)\n\t\t\t\t\t\tarrivedMap[pos+1] = true\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t// 处理前一个元素\n\t\t\tif pos-1 >= 0 {\n\t\t\t\tif !arrivedMap[pos-1] {\n\t\t\t\t\tqueue = append(queue, pos-1)\n\t\t\t\t\tarrivedMap[pos-1] = true\n\t\t\t\t}\n\t\t\t}\n\t\t\t// 处理对应位置的\n\t\t\tfor _, num := range numberMap[arr[pos]] {\n\t\t\t\tif num == l-1 {\n\t\t\t\t\treturn step\n\t\t\t\t}\n\t\t\t\tif !arrivedMap[num] {\n\t\t\t\t\tqueue = append(queue, num)\n\t\t\t\t\tarrivedMap[num] = true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn step\n}", "title": "" }, { "docid": "5beacefca99c38bd65629a58a0e4443c", "score": "0.51672137", "text": "func split(sum int) (x, y int) {\n x = sum * 4 / 9\n y = sum - x\n return\n}", "title": "" }, { "docid": "92db5676dbcfa94218b0a0720d69e129", "score": "0.5150342", "text": "func Ex6() {\n\tagrData = append(agrData, \"zero\", \"one\")\n\n\targdata1 = append(argdata1, \"0\", \"1\", \"2\", \"3\")\n\t// fmt.Println(len(agrData))\n\t// fmt.Println(agrData[0])\n\t// fmt.Println(&agrData)\n\n\tagrData = append(agrData, argdata1...)\n\tfmt.Println(agrData)\n\tfor index, element := range agrData {\n\n\t\tif index%2 == 0 {\n\t\t\tfmt.Println(index, element)\n\t\t} else {\n\t\t\tlow := index\n\t\t\thigh := index\n\t\t\tif len(agrData) != index {\n\t\t\t\thigh = index + 1\n\t\t\t}\n\t\t\tagrData = append(agrData[:low], agrData[high:]...)\n\n\t\t}\n\t}\n\tfmt.Println(agrData)\n}", "title": "" }, { "docid": "91df7cd2c1cef100027d43abb44c3809", "score": "0.5129932", "text": "func next2Values(number int) (int,int) {\n\treturn number+1, number+2\n}", "title": "" }, { "docid": "45f302a2f8e2bf7d986fc23f47223220", "score": "0.5125337", "text": "func sln(nums []int) (ans []int) {\n\tfor newCard := 1; newCard <= 9; newCard += 1 {\n\t\ttemp := append(nums, newCard)\n\t\tif isAbcAbcAbcAbcDd(temp) || isAaaBbbCccDddEe(temp) {\n\t\t\tans = append(ans, newCard)\n\t\t}\n\t}\n\treturn ans\n}", "title": "" }, { "docid": "414bfb2b4701dabd032f622f9d9e7955", "score": "0.51250654", "text": "func main() {\n\tvar data = make([]int, 13)\n\tdata[0] = 0\n\tdata[1] = 1\n\tdata[2] = 2\n\tdata[3] = 3\n\tdata[4] = 4\n\tdata[5] = 5\n\tdata[6] = 6\n\tdata[7] = 7\n\tdata[8] = 8\n\tdata[9] = 9\n\tdata[10] = 10\n\tdata[11] = 11\n\tdata[12] = 12\n\n\tvar chunks [][]int\n\tchunkSize := 3\n\tfor len(data) > chunkSize {\n\t\tchunks = append(chunks, data[0:chunkSize])\n\t\tdata = data[chunkSize:len(data)]\n\t}\n\tchunks = append(chunks, data)\n\n\tfor i, chunk := range chunks {\n\t\tfmt.Printf(\"Round %d\\n\", i)\n\t\tfor _, val := range chunk {\n\t\t\tfmt.Printf(\"%d\\n\", val)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b9f37b859b439e9516a3e1cda2c854db", "score": "0.512313", "text": "func findDuplicates(nums []int) []int {\n \n}", "title": "" }, { "docid": "fbe6149813438b8395b8d3b4469c77ae", "score": "0.5102017", "text": "func four() {\n\tfmt.Println(\"//-------------------------------\")\n\tx := []int{42, 43, 44, 45, 46, 47, 48, 49, 50, 51}\n\tx = append(x, 52)\n\tfmt.Println(x)\n\tx = append(x, 55, 54, 55)\n\tfmt.Println(x)\n\ty := []int{56, 57, 58, 59, 60}\n\tx = append(x, y...)\n\tfmt.Println(x)\n}", "title": "" }, { "docid": "eb98410e51879be03f2e93eb5a56a9dd", "score": "0.50911885", "text": "func Multi(index int) (int, int) {\n test := 1\n for i := index; i < index + 13; i++ {\n a, _ := strconv.Atoi(string(num[i]))\n\n // If we get a 0, throw away the test, return 0, and report the index so we can skip the rest\n if a == 0 {\n return 0, i\n }\n test *= a\n }\n return test, index\n}", "title": "" }, { "docid": "5ef80ed99e05f6df01df8d396315cb9b", "score": "0.5073084", "text": "func findPairs(nums []int, k int) int {\n \n}", "title": "" }, { "docid": "ed1e200b89f64050332e17d95f4ad86f", "score": "0.50654453", "text": "func Solution(A []int) []int {\n var result []int\n top := A[0:len(A)/2]\n bottom := A[len(A)/2:]\n \n for i := 0; i < len(A)/2; i++ {\n result = append(result, bottom[i])\n result = append(result, top[i])\n }\n return result \n}", "title": "" }, { "docid": "e1acb20beda2bc6ccbce2c1922c09a99", "score": "0.5063259", "text": "func count(l int, v int) int {\n\tif l == 1 {\n\t\tif 0 <= v && v <= 9 {\n\t\t\treturn 1\n\t\t}\n\t\treturn 0\n\t}\n\tr := 0\n\tfor i := 0; i < 10; i++ {\n\t\tr += count(l-1, v-i)\n\t}\n\treturn r\n}", "title": "" }, { "docid": "8e45957615188ebc44fb9efaaa9ce9ad", "score": "0.505831", "text": "func example5_8(data []int, intrange int) {\n\tcount := make([]int, intrange)\n\t//for i := 0; i < size; i++ {\n\t//\tcount[i] = 0\n\t//}\n\tfor i, size := 0, len(data); i < size; i++ {\n\t\tval := data[i]\n\t\tif count[val] == 1 {\n\t\t\tfmt.Println(\" \", val)\n\t\t} else {\n\t\t\tcount[val]++\n\t\t}\n\t}\n\tfmt.Println()\n}", "title": "" }, { "docid": "719845e7c015a98aada15f1ff2d38ea8", "score": "0.50501317", "text": "func minimumBribes(q []int32) {\n\n\tbribes := 0\n\tfor i := int32(len(q) - 1); i >= 0; i-- {\n\t\tif (q[i] - (i + 1)) > 2 {\n\t\t\tfmt.Println(\"Too chaotic\")\n\t\t\treturn\n\t\t}\n\t\tfor j := int32(math.Max(0, float64(q[i]-2))); j < i; j++ {\n\t\t\t// fmt.Println(\"i\", i, \"j\", j, \"q[i]\", q[i], \"q[j]\", q[j], \"q[j] > q[i]\", q[j] > q[i])\n\t\t\tif q[j] > q[i] {\n\n\t\t\t\tbribes++\n\t\t\t}\n\t\t}\n\t}\n\n\tfmt.Println(bribes)\n}", "title": "" }, { "docid": "ddd5023c04fe2808c1342a64e00e0105", "score": "0.50467795", "text": "func main() {\n\ts := []int{2, 3, 5, 7, 11, 13}\n\ts1 := s[1:4]\n\tlog.P(s1)\n\n\ts2 := s[:2]\n\tlog.P(s2)\n\ts3 := s[1:]\n\tlog.P(s3)\n\n}", "title": "" }, { "docid": "63cb34d3eec9eeb495461db414301533", "score": "0.5039826", "text": "func main() {\n\t//var a = []int{4, 2, 0, 2, 3, 2, 0}\n\tvar a = []int{1, 3, 2}\n\tnextPermutation(a)\n\tfmt.Println(a)\n}", "title": "" }, { "docid": "53837d0c03cd3ab8a44df2a4604ba51a", "score": "0.50169665", "text": "func minimumBribes(q []int) {\n\tbribe := 0\n\tchaotic := false\n\tn := len(q)\n\tfor i := 0; i < n; i++ {\n\t\tif q[i]-(i+1) > 2 {\n\t\t\tchaotic = true\n\t\t\tbreak\n\t\t}\n\t\tmax := q[i] - 1 - 1\n\t\tif max <= 0 {\n\t\t\tmax = 0\n\t\t}\n\t\tfor j := max; j < i; j++ {\n\t\t\tif q[j] > q[i] {\n\t\t\t\tbribe++\n\t\t\t}\n\t\t}\n\t}\n\tif chaotic {\n\t\tfmt.Println(\"Too chaotic\")\n\t} else {\n\t\tfmt.Println(bribe)\n\t}\n}", "title": "" }, { "docid": "1dd6d5cd245bb7cd1bd7d818f17b8d66", "score": "0.50122124", "text": "func byMedianOfThree(a []int) int {\n\tif len(a) <= 2 {\n\t\treturn 0\n\t}\n\ti := []int{0, len(a) / 2, len(a) - 1}\n\ts := []int{a[0], a[len(a)/2], a[len(a)-1]}\n\tfor x := range s {\n\t\ty := x\n\t\tfor y > 0 && s[y-1] > s[y] {\n\t\t\ti[y], i[y-1] = i[y-1], i[y]\n\t\t\ts[y], s[y-1] = s[y-1], s[y]\n\t\t\ty--\n\t\t}\n\t}\n\treturn i[1]\n}", "title": "" }, { "docid": "a8e59e6dbce2e83292a722599d8ebe6f", "score": "0.50074494", "text": "func groupify(num []int, c int, start int, repeat int) []int {\n\tbuffer := make([]int, 0)\n\tfor i := start; i <= len(num)-c; i += (c - repeat) {\n\t\tbuffer = append(buffer, numFromDigits(num[i:i+c], 10))\n\t}\n\treturn buffer\n}", "title": "" }, { "docid": "411fa84adbae65a82297b98c8dba281b", "score": "0.4993498", "text": "func nextGreaterElements(nums []int) []int {\n\tstack := []int{}\n\tfor index := len(nums) - 1; index >= 0; index-- {\n\t\tfor len(stack) > 0 && stack[len(stack)-1] <= nums[index] {\n\t\t\tstack = stack[:len(stack)-1]\n\t\t}\n\t\tstack = append(stack, nums[index])\n\t}\n\tfor index := len(nums) - 1; index >= 0; index-- {\n\t\tv := nums[index]\n\t\tfor len(stack) > 0 && stack[len(stack)-1] <= v {\n\t\t\tstack = stack[:len(stack)-1]\n\t\t}\n\t\tif len(stack) == 0 {\n\t\t\tnums[index] = -1\n\t\t} else {\n\t\t\tnums[index] = stack[len(stack)-1]\n\t\t}\n\t\tstack = append(stack, v)\n\t}\n\treturn nums\n}", "title": "" }, { "docid": "4cbe602bc72ddcff027873f77e3e4b47", "score": "0.49775553", "text": "func pickingNumbers(a []int32) int32 {\nvar cur int32 \nvar res int32\nelements := make(map[int32]int32)\n for i := 0; i < len(a); i++ {\n _, temp := elements[a[i]]\n if !temp {\n elements[a[i]] = 1\n } else {\n elements[a[i]]++\n }\n }\n for key, val := range elements {\n val1, temp := elements[key+1]\n if temp {\n cur = val + val1\n } else {\n cur = val\n }\n if cur > res {\n res = cur\n }\n }\n return res\n}", "title": "" }, { "docid": "e852d7249b28d776e4bd017838e3f56b", "score": "0.49763465", "text": "func pickingNumbers(a []int) int {\n\t// Write your code here\n\tsort.Ints(a)\n\tvar totalMax int\n\t//sizeTotal := len(a)\n\tfor i, v1 := range a {\n\t\tvar total int\n\t\tfor _, v2 := range a[i+1:] {\n\t\t\tif v1-v2 == 0 || v1-v2 == -1 {\n\t\t\t\ttotal++\n\t\t\t} else {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif totalMax < total {\n\t\t\ttotalMax = total\n\t\t}\n\t}\n\treturn totalMax + 1\n}", "title": "" }, { "docid": "47d81a2945abd83d5b4af9c2bd9cdb57", "score": "0.4975801", "text": "func nextGreaterElements(nums []int) []int {\n\tnextMax := make([]int, len(nums)) // 单调递减栈(从栈底到栈顶)\n\tfor i := 0; i < len(nums); i++ {\n\t\tnextMax[i] = -1\n\t}\n\tstack, length := []int{}, len(nums)\n\tfor i := 0; i < length*2; i++ {\n\t\tindex := i % length\n\t\tfor len(stack) > 0 && nums[stack[len(stack)-1]] < nums[index] {\n\t\t\tnextMax[stack[len(stack)-1]] = nums[index]\n\t\t\tstack = stack[:len(stack)-1]\n\t\t}\n\t\t// 保留第一遍遍历数组时的入栈结果\n\t\tif i < length {\n\t\t\tstack = append(stack, index)\n\t\t}\n\t}\n\treturn nextMax\n}", "title": "" }, { "docid": "cc4a2bbb729c6da401b6d80b1bc5969b", "score": "0.49535516", "text": "func split(sum int) (x, y int) {\n\tx = sum * 4 / 9\n\ty = sum - x\n\treturn\n}", "title": "" }, { "docid": "cc4a2bbb729c6da401b6d80b1bc5969b", "score": "0.49535516", "text": "func split(sum int) (x, y int) {\n\tx = sum * 4 / 9\n\ty = sum - x\n\treturn\n}", "title": "" }, { "docid": "827a9c581b4c259b0852e72f372d95c2", "score": "0.4945822", "text": "func FindErrorNums(nums []int) []int {\n\tvar l int = len(nums)\n\tvar index int = 0\n\tfor index < l{\n\t\tfor nums[index] != (index + 1) && nums[nums[index] - 1] != nums[index]{\n\t\t//for nums[index] != (index + 1){\n\t\t\tnums[nums[index] - 1],nums[index] = nums[index],nums[nums[index] - 1]\n\t\t}\n\t\tindex++\n\t}\n\tvar res []int = make([]int,2)\n\tfor i := 0;i < l;i++{\n\t\tif nums[i] != i + 1{\n\t\t\tres[0] = nums[i]\n\t\t\tres[1] = i + 1\n\t\t\tbreak\n\t\t}\n\t}\n\treturn res\n}", "title": "" }, { "docid": "08b99a279519168724a9dc0ed88b5833", "score": "0.49371248", "text": "func MultiLineInt(s []int){\n\tsort.Ints(s)\n\tfor i := 0; i < len(s); i++{\n\t\tfmt.Println(s[i])\n\t}\n}", "title": "" }, { "docid": "2af937a9c99d743ecbae1244f803a0f8", "score": "0.49356794", "text": "func vals() (int, int) {\n\treturn 3, 7\n}", "title": "" }, { "docid": "2af937a9c99d743ecbae1244f803a0f8", "score": "0.49356794", "text": "func vals() (int, int) {\n\treturn 3, 7\n}", "title": "" }, { "docid": "2af937a9c99d743ecbae1244f803a0f8", "score": "0.49356794", "text": "func vals() (int, int) {\n\treturn 3, 7\n}", "title": "" }, { "docid": "2af937a9c99d743ecbae1244f803a0f8", "score": "0.49356794", "text": "func vals() (int, int) {\n\treturn 3, 7\n}", "title": "" }, { "docid": "2af937a9c99d743ecbae1244f803a0f8", "score": "0.49356794", "text": "func vals() (int, int) {\n\treturn 3, 7\n}", "title": "" }, { "docid": "2af937a9c99d743ecbae1244f803a0f8", "score": "0.49356794", "text": "func vals() (int, int) {\n\treturn 3, 7\n}", "title": "" }, { "docid": "f3e1e5e1e17fa048186c83f819632b8b", "score": "0.4934401", "text": "func sequentialDigits(low int, high int) []int {\n\tresult := []int{}\n\n\tlowStr := strconv.Itoa(low)\n\thead, _ := strconv.Atoi(string(lowStr[0]))\n\tcount := len(lowStr)\n\n\tfor {\n\t\tif count == 10 {\n\t\t\tbreak\n\t\t}\n\t\tnum := genNum(count, head)\n\t\thead++\n\t\tif head == 10 || !isValid(num) {\n\t\t\tcount++\n\t\t\thead = 1\n\t\t\tcontinue\n\t\t}\n\t\tif num < low {\n\t\t\tcontinue\n\t\t}\n\t\tif num > high {\n\t\t\tbreak\n\t\t}\n\t\tresult = append(result, num)\n\t}\n\treturn result\n}", "title": "" }, { "docid": "01ea50acf298876b9a980304e4116aba", "score": "0.4929199", "text": "func add(z []int) string {\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\t//fmt.Printf(\"Error is :%v\\n\", r)\n\t\t}\n\t}()\n\tfor i := 0; i < len(z); i++ {\n\t\t//logic to add\n\t\tone := z[i] + z[i+6]\n\t\tif i == 6 {\n\t\t\tbreak\n\t\t}\n\t\tfmt.Print(\"\\t\", one)\n\t}\n\treturn one\n}", "title": "" }, { "docid": "c758f0bc78baeba4963facb0d52f2928", "score": "0.492378", "text": "func Sliceprimi(nmax int) []int{\n var x []int\n for i:=2;i<=nmax;i++{\n if Isprimo(i){\n x=append(x,i)\n }\n }\n return x\n}", "title": "" }, { "docid": "17d96a1d028384f586107d4a48642f1a", "score": "0.49183613", "text": "func minimumBribes(q []int32) {\n\tswaps, index, lastSortedIndex := 0, int32(0), int32(-1)\n\ttoo_chaotic := false\n\tbribeMap := make(map[int32]int32)\n\n\tstop := int32(len(q) - 1)\n\tfor index < stop {\n\t\tcurrent := q[index]\n\t\tif current > q[index+1] {\n\t\t\tval, exists := bribeMap[current]\n\t\t\tif exists && val >= 2 {\n\t\t\t\tfmt.Println(\"Too chaotic\")\n\t\t\t\ttoo_chaotic = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif !exists {\n\t\t\t\tbribeMap[current] = 0\n\t\t\t}\n\t\t\tbribeMap[current]++\n\n\t\t\tq[index], q[index+1] = q[index+1], q[index]\n\n\t\t\tswaps++\n\t\t\tindex = lastSortedIndex\n\t\t} else if current == index+1 {\n\t\t\tlastSortedIndex++\n\t\t}\n\t\tindex++\n\t}\n\n\tif !too_chaotic {\n\t\tfmt.Println(swaps)\n\t}\n}", "title": "" }, { "docid": "4ebb2416f75fdae6228dabf2211f88d7", "score": "0.49074063", "text": "func main() {\n\ttabla := [10]int{5, 1, 2, 8, 7, 6, 4, 3, 0, 9}\n\n\tfor i := 0; i < len(tabla); i++ {\n\t\tfmt.Println(tabla[i])\n\t}\n\t/*\n\t\tForma de asignar valores a un arreglo\n\t\ttabla[0]=5\n\t\ttabla[1]=1\n\n\t*/\n\n}", "title": "" }, { "docid": "a1e26a7e11cc919cd5f1e7bf2d178047", "score": "0.48957053", "text": "func FindIndex(x []int) {\n\tvar resultList [][]int\n\tconst num = 8\n\n\tlength := len(x)\n\n\tfor i := 0; i < length-1; i++ {\n\t\tfor j := i + 1; j < length; j++ {\n\t\t\tif x[i]+x[j] == num {\n\t\t\t\tresultList = append(resultList, []int{i, j})\n\t\t\t}\n\t\t}\n\t}\n\tfmt.Println(resultList)\n}", "title": "" }, { "docid": "4cb8f9200908df9da43bea5272de037e", "score": "0.4887124", "text": "func main() {\n\ts := []int{22, 33, 44, 55, 66}\n\tres := 0\n\t//Range used for arrays\n\tfor i, num := range s {\n\t\tif i == 3 {\n\t\t\tfmt.Println(i)\n\t\t} else {\n\t\t\tres = res + num\n\t\t}\n\t}\n\tfmt.Println(res)\n\t//Range when used in maps\n\tabc := map[string]int{\"abc\": 1, \"def\": 2, \"ghi\": 3}\n\tfor x, y := range abc {\n\t\tfmt.Printf(\"%s : %d\\n\", x, y)\n\t}\n}", "title": "" }, { "docid": "1af4fd38797fee25f75b46a092e4f1e1", "score": "0.48869628", "text": "func main() {\n\n array:= [] int {2, 4, 6, 2, 5}\n sum:= nonAdjacent(array)\n fmt.Printf(\"%d\\n\", sum)\n}", "title": "" }, { "docid": "7b14520efd24e1fb93a974bb02cb02d2", "score": "0.48864284", "text": "func hs(n int, recycle []int) []int {\n\ts := append(recycle[:0], n)\n\tfor n > 1 {\n\t\tif n&1 == 0 {\n\t\t\tn = n / 2\n\t\t} else {\n\t\t\tn = 3*n + 1\n\t\t}\n\t\ts = append(s, n)\n\t}\n\treturn s\n}", "title": "" }, { "docid": "1deadea0b2d314498aaec0728f377a2f", "score": "0.4882078", "text": "func InsertionStortInt(list []int) {\n}", "title": "" }, { "docid": "9d263bdd6bf11521c71c66a754097ec9", "score": "0.486914", "text": "func main() {\n var r1 int\n fmt.Scan(&r1)\n\n var r2 int\n fmt.Scan(&r2)\n\n for r1 != r2 {\n if r1 < r2 {\n for _, v := range strings.Split(strconv.Itoa(r1), \"\") {\n i, _ := strconv.Atoi(v)\n r1 += i\n }\n } else {\n for _, v := range strings.Split(strconv.Itoa(r2), \"\") {\n i, _ := strconv.Atoi(v)\n r2 += i\n }\n }\n }\n\n // fmt.Fprintln(os.Stderr, \"Debug messages...\")\n // fmt.Println(\"42\")// Write answer to stdout\n fmt.Println(r1)\n}", "title": "" }, { "docid": "e33e3857be5902682b2378660e34951c", "score": "0.48686108", "text": "func main() {\n\tvar N int\n\tfmt.Scanf(\"%d\", &N)\n\ta := make([]int, N)\n\tmax := math.MinInt32\n\tmaxi := 0\n\tmin := math.MaxInt32\n\tmini := 0\n\tfor i := 0; i < N; i++ {\n\t\tfmt.Scanf(\"%d\", &a[i])\n\t\tif a[i] > max {\n\t\t\tmax = a[i]\n\t\t\tmaxi = i\n\t\t}\n\t\tif a[i] < min {\n\t\t\tmin = a[i]\n\t\t\tmini = i\n\t\t}\n\t}\n\tif min > 0 {\n\t\tfmt.Println(N - 1)\n\t\tfor i := 0; i < N-1; i++ {\n\t\t\tfmt.Println(i+1, i+2)\n\t\t}\n\t} else if max < 0 {\n\t\tfmt.Println(N - 1)\n\t\tfor i := N - 2; i >= 0; i-- {\n\t\t\tfmt.Println(i+2, i+1)\n\t\t}\n\t} else {\n\t\tif max > -min {\n\t\t\t// Set all to non-negative numbers.\n\t\t\tfmt.Println(2*N - 1)\n\t\t\tfor i := 0; i < N; i++ {\n\t\t\t\tfmt.Println(maxi+1, i+1)\n\t\t\t}\n\t\t\tfor i := 0; i < N-1; i++ {\n\t\t\t\tfmt.Println(i+1, i+2)\n\t\t\t}\n\t\t} else {\n\t\t\tfmt.Println(2*N - 1)\n\t\t\tfor i := 0; i < N; i++ {\n\t\t\t\tfmt.Println(mini+1, i+1)\n\t\t\t}\n\t\t\tfor i := N - 2; i >= 0; i-- {\n\t\t\t\tfmt.Println(i+2, i+1)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "7a7d338190948fdb6b56eae79b361868", "score": "0.4868162", "text": "func missingNumber(n []int) int {\n\tstart := 1\n\tfor i := 1; i < len(n) + 1; i++ {\n\t\tstart ^= i + 1\n\t}\n\tfor i := 0; i < len(n); i++ {\n\t\tstart ^= n[i]\n\t}\n\treturn start\n}", "title": "" }, { "docid": "00bd1ad9129e8fd0d45d62003597977a", "score": "0.48627087", "text": "func nextGreaterElement(data []int) {\n\n\tresult := make(map[int]int)\n\n\tst := stack{top: -1}\n\n\tif len(data) <= 1 {\n\t\tfmt.Println(data)\n\t\treturn\n\t}\n\n\tfor _, item := range data {\n\t\tif st.isEmpty() {\n\t\t\tst.push(item)\n\t\t\tcontinue\n\t\t}\n\n\t\tif topEl, _ := st.topElement(); item > topEl {\n\n\t\t\t// pop the elements from stack till item <= topEl\n\t\t\tfor {\n\t\t\t\tif st.isEmpty() || item <= topEl {\n\t\t\t\t\tbreak\n\t\t\t\t} else {\n\t\t\t\t\tresult[topEl] = item\n\t\t\t\t\tst.pop()\n\t\t\t\t\ttopEl, _ = st.topElement()\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t\tst.push(item)\n\n\t}\n\n\tfmt.Println(result)\n\n}", "title": "" }, { "docid": "e18a2e7615a69406ccbded6c7b9bfd2e", "score": "0.48618054", "text": "func OddNumbers() {\n\tfmt.Println(\"-- utilities : OddNumbers\")\n\tReverseRunes(\"srebmub olleH\")\n\tfor i := 0; i < 20; i++ {\n\t\tif i%2 == 1 {\n\t\t\tfmt.Print(i, \",\")\n\t\t}\n\t}\n\tfmt.Println()\n}", "title": "" }, { "docid": "3bedc58c9dc0aab988a40adedbbf1548", "score": "0.48518896", "text": "func main() {\n\tinput := []int{5, 1, 5, 2, 5, 3, 5, 4}\n\toutput := repeatedNTimes(input)\n\tlog.Println(output)\n}", "title": "" }, { "docid": "37400c67cf49a315d8e2c4e716271035", "score": "0.4851661", "text": "func nextPermutation(nums []int) {\n\tvar l = len(nums)\n\tvar r = 0\n\t//从找到最后一个升序点\n\tfor e := l - 1; e > 0; e-- {\n\t\tif nums[e] > nums[e-1] {\n\t\t\tr = e\n\t\t\tbreak\n\t\t}\n\t}\n\tif r > 0 {\n\t\t//从升序点(num[i]<num[j])将数组分割两部分,i属于左半部分,j属于右半部分\n\t\t//我们的思路是,左部分变为大于当前值的最小值,右部分变为最小值,合并后就是大于当前值的最小值\n\t\t//对于左半部分,将i位置替换为右半部分大于num[i]的最小值\n\t\t//对于右半部分,直接升序排列\n\t\tvar t = r\n\t\tfor i := r; i < l; i++ {\n\t\t\t//大于nums[r-1]的最小值\n\t\t\tif nums[i] > nums[r-1] && nums[i] < nums[t] {\n\t\t\t\tt = i\n\t\t\t}\n\t\t}\n\t\tminSwap(nums, r-1, t)\n\t} else { //如果不存在升序,则已经是最大值\n\t\tsort.Ints(nums)\n\t}\n}", "title": "" }, { "docid": "b0275fc24f9177ebfedfd980bf922e41", "score": "0.48512748", "text": "func main() {\n\tarr := []int{4, 6, 1, 12, 9, 10, 3, 2, 7, 13, 15, 8, 5, 11, 14}\n\n\tfor i := 1; i < len(arr); i++ {\n\t\tcmpIdx := i-1\n\t\tinsertVal := arr[i]\n\t\tfor ; cmpIdx >= 0 && arr[cmpIdx] > insertVal; cmpIdx-- {\n\t\t\tarr[cmpIdx+1] = arr[cmpIdx]\n\t\t}\n\t\tarr[cmpIdx+1] = insertVal\n\t}\n\tfmt.Println(arr)\n}", "title": "" }, { "docid": "5f5c460371f8814f5a0ee70a050baa3e", "score": "0.48450842", "text": "func subsetsWithDup(nums []int) [][]int {\n \n}", "title": "" }, { "docid": "b680272bad66cd5182564a5d654cc836", "score": "0.48447224", "text": "func _0763(S string) []int {\n\tvar ans []int\n\tvar lastOccurIndex [128]int\n\tfor index, char := range S {\n\t\tlastOccurIndex[char] = index\n\t}\n\tfor left := 0; left < len(S); {\n\t\tright := lastOccurIndex[S[left]]\n\t\tfor temp := left; temp <= right; temp++ {\n\t\t\tif right < lastOccurIndex[S[temp]] {\n\t\t\t\tright = lastOccurIndex[S[temp]]\n\t\t\t}\n\t\t}\n\t\tans = append(ans, right-left+1)\n\t\tleft = right + 1\n\t}\n\treturn ans\n}", "title": "" }, { "docid": "51f52df461232ea7040ded3d29dab0b5", "score": "0.48420456", "text": "func next2Values(number int)(int, int) {\n\treturn number+1, number+2\n}", "title": "" }, { "docid": "7980e470216f144af9e53024f5744018", "score": "0.4837513", "text": "func check(i, x, t int) {\n\tx = a[i]*t + x // concate a number at position 'i'\n\n\tif x%8 == 0 {\n\t\tc++\n\t\t//fmt.Println(x)\n\t}\n\n\tfor ii := i + 1; ii < n; ii++ {\n\t\tcheck(ii, x, t*10)\n\t}\n}", "title": "" }, { "docid": "58e9e422e6869e356c4f062466f8e300", "score": "0.48325872", "text": "func _1262(nums []int) int {\n\tvar remain1, remain2 []int\n\tans := 0\n\tfor _, num := range nums {\n\t\tremainder := num % 3\n\t\tans += num\n\t\tif remainder == 0 {\n\t\t} else if remainder == 1 {\n\t\t\tremain1 = append(remain1, num)\n\t\t} else {\n\t\t\tremain2 = append(remain2, num)\n\t\t}\n\t}\n\t// make remain1 longer than remain2\n\tif len(remain1) < len(remain2) {\n\t\tremain1, remain2 = remain2, remain1\n\t}\n\tsort.Ints(remain1)\n\tsort.Ints(remain2)\n\tdiff := len(remain1) - len(remain2)\n\tremainder := diff % 3\n\tif remainder == 0 {\n\t\treturn ans\n\t} else if remainder == 1 {\n\t\tif len(remain2) >= 2 && remain1[0] > remain2[0]+remain2[1] {\n\t\t\tans -= remain2[0] + remain2[1]\n\t\t} else {\n\t\t\tans -= remain1[0]\n\t\t}\n\t} else if remainder == 2 {\n\t\tif len(remain2) >= 1 && remain1[0]+remain1[1] > remain2[0] {\n\t\t\tans -= remain2[0]\n\t\t} else {\n\t\t\tans -= remain1[0] + remain1[1]\n\t\t}\n\t}\n\treturn ans\n}", "title": "" }, { "docid": "e8a4c2577253ebc29f33ebec15f16dab", "score": "0.48292607", "text": "func findSeries(upto int) {\n\tprimes := calcPrimes(upto)\n\tfor numFactors := 1; numFactors < upto; numFactors++ {\n\t\t_, _, expanded := calcFactors(primes, numFactors)\n\t\tminimum := findAlls(expanded, primes)\n\t\tfmt.Println(numFactors, minimum)\n\t\t// fmt.Println(minimum)\n\t}\n}", "title": "" }, { "docid": "7d015087a70d62f981de966ca69955a1", "score": "0.4828419", "text": "func clever(nums []int) int {\n\tcur := 0\n\n\tfor i, num := range nums {\n\t\tif i < 2 || num > nums[cur-2] {\n\t\t\tnums[cur] = num\n\t\t\tcur++\n\t\t}\n\t}\n\n\treturn cur\n}", "title": "" }, { "docid": "fb329278a492bdebce71680d42e72f83", "score": "0.48276484", "text": "func maximumGap(nums []int) int {\n \n}", "title": "" }, { "docid": "f652a73602ba04a74dac3573c132b68f", "score": "0.48192888", "text": "func euler1() (int, []int) {\n\tvar (\n\t\tsumme int\n\t\tliste []int\n\t)\n\tfor i := 1; i < 1000; i++ {\n\t\tif i%3 == 0 || i%5 == 0 {\n\t\t\tsumme += i\n\t\t\tliste = append(liste, i)\n\t\t}\n\t}\n\treturn summe, liste\n}", "title": "" }, { "docid": "4f4f6687ee56be239c9f927016b0abeb", "score": "0.48131645", "text": "func main(){\n\n\tfmt.Println(squaredSortedArray([]int{-4,-1,0,3,10}))\n\n}", "title": "" }, { "docid": "caa653dbf9e59c2c672c2f31e934d510", "score": "0.48106018", "text": "func spiralOrder(matrix [][]int) []int {\n\tif matrix == nil || len(matrix) == 0 {\n\t\treturn make([]int, 0)\n\t}\n\twidth := len(matrix[0])\n\theight := len(matrix)\n\t// resultLen := width * height\n\tvar result []int\n\n\tvar flag int\n\t// 层数\n\tfor n := 0; n < width && n < height; n++ {\n\t\t// x := n\n\t\t// y := n\n\t\tfmt.Println(n)\n\n\t\tflag = 0\n\t\t// 向右\n\t\tfor i := n; i < width-n; i++ {\n\t\t\tresult = append(result, matrix[n][i])\n\t\t\tflag++\n\t\t}\n\t\tif flag == 0 {\n\t\t\tbreak\n\t\t}\n\n\t\tflag = 0\n\t\t// 向下\n\t\tfor i := n + 1; i < height-n; i++ {\n\t\t\tresult = append(result, matrix[i][width-n-1])\n\t\t\tflag++\n\t\t}\n\t\tif flag == 0 {\n\t\t\tbreak\n\t\t}\n\n\t\tflag = 0\n\t\t// 向左\n\t\tfor i := width - n - 2; i >= n; i-- {\n\t\t\tresult = append(result, matrix[height-n-1][i])\n\t\t\tflag++\n\t\t}\n\t\tif flag == 0 {\n\t\t\tbreak\n\t\t}\n\n\t\tflag = 0\n\t\t// 向上\n\t\tfor i := height - n - 2; i > n; i-- {\n\t\t\tresult = append(result, matrix[i][n])\n\t\t\tflag++\n\t\t}\n\t\tif flag == 0 {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn result\n}", "title": "" }, { "docid": "4b1e2f2b9999aa3a9329adb558377a42", "score": "0.4808327", "text": "func loopRange(s, e, rs, re int) []int {\n\tr := createRange(rs, re)\n\tvar i int\n\tfor n := rs; n <= re; n++ {\n\t\tr = append(r, n)\n\t\tif n < s {\n\t\t\ti++\n\t\t}\n\t}\n\tr = append(r[i:], r[:i]...)\n\tret := make([]int, 0, len(r))\n\tfor _, v := range r {\n\t\tret = append(ret, v)\n\t\tif v == e {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "156146b80cf579f5b0413a373a79b1b6", "score": "0.48025173", "text": "func main() {\n\tvar n,k int\n\tio := bufio.NewReader(os.Stdin)\n\tfmt.Fscan(io, &n)\n\tfmt.Fscan(io, &k)\n\n\tarray := make([]int, n)\n\tfor i := 0; i < n; i++ {\n\t\tfmt.Fscan(io, &array[(i+n-k)%n])\n\t}\n\n\tfor i := 0; i < n; i++ {\n\t\tfmt.Print(strconv.Itoa(array[i])+\" \")\n\t}\n}", "title": "" }, { "docid": "3a744ec1f1b585c02bb9aab8decc2c53", "score": "0.47996178", "text": "func main() {\n\t// pp.Println(\"=========================================\")\n\t// fmt.Println(sequentialDigits(100, 300))\n\t// fmt.Println([]int{123, 234})\n\t// pp.Println(\"=========================================\")\n\t// fmt.Println(sequentialDigits(1000, 13000))\n\t// fmt.Println([]int{1234, 2345, 3456, 4567, 5678, 6789, 12345})\n\tpp.Println(\"=========================================\")\n\tfmt.Println(sequentialDigits(10, 1000000000))\n\t// fmt.Println([]int{})\n\tpp.Println(\"=========================================\")\n}", "title": "" }, { "docid": "5f7ff67f61ea5d2e7f1c82fcda8049e7", "score": "0.47970915", "text": "func findErrorNums(nums []int) []int {\n\tvar ans []int\n\tappear := make(map[int]bool)\n\tfor _, v := range nums {\n\t\tif _, ok := appear[v]; ok {\n\t\t\tans = append(ans, v)\n\t\t} else {\n\t\t\tappear[v] = true\n\t\t}\n\t}\n\tn := len(nums)\n\tfor n > 0 {\n\t\tif !appear[n] {\n\t\t\tans = append(ans, n)\n\t\t}\n\t\tn--\n\t}\n\treturn ans\n}", "title": "" }, { "docid": "a380d518a775036f027d4594cfa9942f", "score": "0.47884998", "text": "func getFactors(n int) [][]int {\n\n}", "title": "" }, { "docid": "bee623f6cd908c8772af45e2953f1933", "score": "0.477929", "text": "func N(start, end int) []int {\n\tvar result []int\n\tfor i := start; i <= end; i++ {\n\t\tresult = append(result, i)\n\t}\n\treturn result\n}", "title": "" }, { "docid": "cd7f8380c6bb0b48e893f9fab9bb83fb", "score": "0.47667336", "text": "func MidSearch(arr []int, data int) int {\n\tlow := 0\n\thigh := len(arr) - 1\n\ti := 0\n\tfor high >= low {\n\t\ti++\n\t\tfmt.Println(\"這是第幾次?\", i)\n\t\tResize := float64(data - arr[low]) //--- 3\n\t\tleftToRight := float64(arr[high] - arr[low]) //----- 5 比例就是3/5\n\t\tOriginlength := float64(high - low)\n\t\tmid := int(float64(low) + Originlength*Resize/leftToRight)\n\t\tif mid < 0 || mid > len(arr) { //找不到越界時\n\t\t\treturn -1\n\t\t}\n\t\tif arr[mid] > data {\n\t\t\thigh = mid - 1\n\t\t} else if arr[mid] < data {\n\t\t\tlow = mid + 1\n\t\t} else {\n\t\t\treturn mid\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "5b822e743983f4ee5673c6579b8a18c3", "score": "0.47636658", "text": "func loudAndRich(richer [][]int, quiet []int) []int {\n \n}", "title": "" }, { "docid": "1e6d5a9e714bc6db6bd5a46ba80fb844", "score": "0.4761005", "text": "func fourSum(nums []int, target int) [][]int {\n\tsort.Sort(sort.IntSlice(nums))\n\n\tres := make([][]int, 0)\n\tn := len(nums)\n\tif n < 4 {\n\t\treturn res\n\t}\n\n\tif nums[n - 1] * 4 < target {\n\t\treturn res\n\t}\n\n\tfor i := 0; i < n; i++ {\n\t\tif i > 0 && nums[i] == nums[i - 1] {\n\t\t\tcontinue\n\t\t}\n\n\t\tfor j := i + 1; j < n-1 ; j++ {\n\t\t\t//if nums[i] + nums[j] > target {\n\t\t\t//\tfmt.Println(i, j)\n\t\t\t//\treturn res\n\t\t\t//}\n\n\t\t\tif j > i + 1 && nums[j] == nums[j-1] {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tl := j + 1\n\t\t\tr := n - 1\n\n\t\t\t//if l + 1 <= r && nums[l+1] > 0 && nums[i] + nums[j] + nums[l] > target {\n\t\t\t//\tcontinue\n\t\t\t//}\n\t\t\t//\n\t\t\t//if l + 1 <= r && nums[l+1] < 0 && nums[i] + nums[j] + nums[l] < target {\n\t\t\t//\tcontinue\n\t\t\t//}\n\n\t\t\tfor l < r {\n\t\t\t\tv := nums[i] + nums[j] + nums[l] + nums[r]\n\t\t\t\t//fmt.Println(i, j, l, r, v)\n\t\t\t\tif v > target {\n\t\t\t\t\tr -= 1\n\t\t\t\t} else if v < target {\n\t\t\t\t\tl += 1\n\t\t\t\t} else {\n\t\t\t\t\tres = append(res, []int{nums[i], nums[j], nums[l], nums[r]})\n\n\t\t\t\t\tfor l < r && nums[l] == nums[l + 1] {l+=1}\n\t\t\t\t\tfor l < r && nums[r] == nums[r - 1] {r-=1}\n\t\t\t\t\tl += 1\n\t\t\t\t\tr -= 1\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn res\n}", "title": "" }, { "docid": "62e83802eb458a155d60b7509b5d233d", "score": "0.47557417", "text": "func RepeatingNumber(arr []int) (result []int) {\n\tvar beforeNum int\n\tfor index, num := range arr {\n\t\tif index == 0 {\n\t\t\tbeforeNum = num\n\t\t\tcontinue\n\t\t}\n\t\tif num == beforeNum && !isContain(result, num) {\n\t\t\tresult = append(result, num)\n\t\t}\n\t\tbeforeNum = num\n\t}\n\treturn\n}", "title": "" }, { "docid": "28df1ce7805e47f0cdf3e6d1324df698", "score": "0.4754046", "text": "func largeGroupPositions(s string) [][]int {\n\tvar l int = len(s)\n\tvar res [][]int\n\tvar left int = 0\n\tfor left < l{\n\t\tvar right int = left\n\t\tfor right < l && s[left] == s[right]{\n\t\t\tright++\n\t\t}\n\t\tdistance := right - left\n\t\tif distance >= 3{\n\t\t\tres = append(res,[]int{left,right - 1})\n\t\t}\n\t\tleft = right\n\t}\n\treturn res\n}", "title": "" }, { "docid": "8f84f9e978eac8e4f008bbff4aff2ac3", "score": "0.4721186", "text": "func merge(nums1 []int, m int, nums2 []int, n int) {\n\n}", "title": "" }, { "docid": "b1ba8472013ab94bb193d080260b9dd8", "score": "0.47184545", "text": "func sequentialDigits(low int, high int) []int {\n\tvar startingDigit int = leftmostDigit(low)\n\tvar startingE int = numDigits(low) - 1 // e.g. if low is in range 10 - 99, E is 1\n\tvar maxE int = numDigits(high) - 1\n\n\tvar result []int = make([]int, 0)\n\n\tE := startingE\n\tleftDigit := startingDigit\n\tfor E <= maxE {\n\t\tfor leftDigit < 10 {\n\n\t\t\tif validSequentialNumberConstraints(leftDigit, E) {\n\t\t\t\tvar sequentialNumber int = getSequentialNumber(leftDigit, E)\n\n\t\t\t\tif low <= sequentialNumber && sequentialNumber <= high {\n\t\t\t\t\tresult = append(result, sequentialNumber)\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tleftDigit = leftDigit + 1\n\t\t}\n\n\t\tE = E + 1\n\t\tleftDigit = 1\n\t}\n\n\treturn result\n}", "title": "" }, { "docid": "6247a69bc8a8a077049827deaff3c016", "score": "0.47179288", "text": "func pivotIndex(nums []int) int {\n\tif len(nums) == 0 {\n\t\treturn -1\n\t}\n\n\tif len(nums) == 1 && nums[0] == 0 {\n\t\treturn 0\n\t}\n\n\tif len(nums) == 1 {\n\t\treturn -1\n\t}\n\n\tl, r := 0, 0\n\n\tfor _, v := range nums {\n\t\tr += v\n\t}\n\n\t//fmt.Println(r)\n\n\t//if r == 0 {\n\t//\treturn 0\n\t//}\n\n\tfor i := 0; i < len(nums); i++ {\n\t\tr -= nums[i]\n\t\tif l == r {\n\t\t\treturn i\n\t\t}\n\n\t\tl += nums[i]\n\t}\n\n\treturn -1\n}", "title": "" }, { "docid": "2f58773527193ee1674add5ca18dd613", "score": "0.4714073", "text": "func migratoryBirds(arr []int32) (minIndex int32) {\n\tcounter := make(map[int32]int32)\n\tfor _, v := range arr {\n\t\tcounter[v]++\n\t}\n\n\tvar maxValue int32\n\t// Calculate the max values\n\tfor _, v := range counter {\n\t\tif maxValue < v {\n\t\t\tmaxValue = v\n\t\t}\n\t}\n\n\t// Calculate the max indexes\n\tvar maxIndexes []int32\n\tfor i, v := range counter {\n\t\tif maxValue == v {\n\t\t\tmaxIndexes = append(maxIndexes, i)\n\t\t}\n\t}\n\n\t// Calculate the max indexes\n\tminIndex = maxIndexes[0]\n\tfor _, v := range maxIndexes {\n\t\tif minIndex > v {\n\t\t\tminIndex = v\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "21df93e5d276321c8fc09c2b88242f74", "score": "0.4711248", "text": "func split(sum int) (x, y int) {\n\tx = sum * 4 / 9\n\ty = sum - x\n\treturn // \"Naked\" returns, should be used only in short functions\n}", "title": "" }, { "docid": "a43d9426b9e7ef8f3ab9b370961946d4", "score": "0.4709917", "text": "func main() {\n var n int\n fmt.Scan(&n)\n\n arr := make([]int, n)\n for i := 0; i < n; i++ {\n fmt.Scan(&arr[i])\n }\n fmt.Println(arr[len(arr)-2])\n}", "title": "" }, { "docid": "b2c7ffa175feacbc332c680f679fb5b3", "score": "0.4700532", "text": "func split(sum int) (x, y int) {\n\tx = sum * 4 / 9\n\ty = sum - x\n\treturn // <- naked return (can harm readability; use sparingly)\n}", "title": "" }, { "docid": "627c8ca7610d54a5b394befb207b8fda", "score": "0.46988615", "text": "func thirdRepeatingElement(n []int) []int {\n\t// Map 'repeated' keeps all distinct entries of the slice with their value set to\n\t// false if they are non-repeating and true if they are repeating.\n\trepeated := make(map[int]bool)\n\n\tcount := 0\n\tvar result []int\n\n\tfor _, v := range n {\n\t\tif _, ok := repeated[v]; !ok {\n\t\t\t// New entry\n\t\t\trepeated[v] = false\n\t\t} else {\n\t\t\t// Entry already present in map\n\t\t\tif !repeated[v] {\n\t\t\t\t// First repetition\n\t\t\t\tcount++\n\t\t\t\trepeated[v] = true\n\t\t\t}\n\t\t}\n\n\t\tif count == 3 {\n\t\t\tresult = append(result, v)\n\t\t\treturn result\n\t\t}\n\t}\n\treturn result\n}", "title": "" }, { "docid": "ba8ff95f4e5d1fdb5ef5a08c9479a45d", "score": "0.46986863", "text": "func returnMultipleValues(num int) (int, int, int) {\n\treturn num+1, num+2, num+3\n}", "title": "" }, { "docid": "0214cd14c1791c9146adbd814990823e", "score": "0.46980757", "text": "func findNumbers(nums []int) int {\n\tnum := 0\n\tfor _, v := range nums {\n\t\tif (v >= 10 && v <= 99) || (v >= 1000 && v <= 9999) || (v >= 100000 && v <= 999999) {\n\t\t\tnum += 1\n\t\t}\n\t}\n\treturn num\n}", "title": "" }, { "docid": "47d9d23aa91928318ac7c98d3af15c78", "score": "0.46979168", "text": "func main() {\n\tprocess(1, [][]int{})\n\tprocess(2, [][]int{{1, 2}})\n\tprocess(3, [][]int{{1, 3}, {2, 3}})\n\tprocess(3, [][]int{{1, 3}, {2, 3}, {3, 1}})\n\tprocess(3, [][]int{{1, 2}, {2, 3}})\n\tprocess(4, [][]int{{1, 3}, {1, 4}, {2, 3}, {2, 4}, {4, 3}})\n}", "title": "" }, { "docid": "6bd86653b7e5f52d5e80b7655ad02b1e", "score": "0.46931487", "text": "func maxChunksToSorted(arr []int) int {\n \n}", "title": "" }, { "docid": "48cbac283265792f10abafdffb8df178", "score": "0.46886367", "text": "func main() {\n\tmultiples := findMultiples(1000)\n\t//printSlice(multiples)\n\tsum := sumMultiples(multiples)\n\tfmt.Println(sum)\n}", "title": "" }, { "docid": "a54f05a6c753972a305539f4a6c964cb", "score": "0.46878397", "text": "func _0162(nums []int) int {\n // for if only one element in the array\n if len(nums) == 1 {\n return 0\n }\n // for if the result is the first or the last element\n if nums[0] > nums[1] {\n return 0\n }\n if nums[len(nums) - 2] < nums[len(nums) - 1] {\n return len(nums) - 1\n }\n // binary search\n left, right := 0, len(nums) - 1\n for left + 1 < right {\n mid := left + (right - left) / 2\n if nums[left] > nums[mid] {\n right = mid\n } else if nums[mid] < nums[right] {\n left = mid\n } else {\n if nums[mid - 1] < nums[mid] && nums[mid] > nums[mid + 1] {\n return mid\n } else if nums[mid - 1] > nums[mid]{\n right = mid - 1\n } else {\n left = mid + 1\n }\n }\n }\n if nums[left] < nums[right] {\n return right\n } else {\n return left\n }\n}", "title": "" }, { "docid": "23a3f761694da76eee736274c9a97760", "score": "0.46839073", "text": "func partition(slice []int) (int, int) {\n\t//declaring some important variables\n\t// defer fmt.Println(\"Orig -\", slice)\n\tvar (\n\t\tx int = slice[0]\n\t\tj int\n\t\tkeepTrack int = -1\n\t)\n\tfor i := 1; i < len(slice); i++ {\n\t\tif slice[i] == x {\n\t\t\tj++\n\t\t\tslice[i], slice[j] = slice[j], slice[i]\n\t\t\tif keepTrack < 0 {\n\t\t\t\tkeepTrack = j\n\t\t\t}\n\t\t} else if slice[i] < x {\n\t\t\tj++\n\t\t\tslice[i], slice[j] = slice[j], slice[i]\n\t\t\tif keepTrack > 0 {\n\t\t\t\tslice[keepTrack], slice[j] = slice[j], slice[keepTrack]\n\t\t\t\tkeepTrack++\n\t\t\t}\n\t\t}\n\t}\n\tif keepTrack > 0 {\n\tslice[0], slice[keepTrack-1] = slice[keepTrack-1], slice[0]\n\t// fmt.Println(\"partition -\", slice, keepTrack-1, j)\n\treturn keepTrack - 1, j\n\t}\n\tslice[0], slice[j] = slice[j], slice[0]\n\t// fmt.Println(\"partition -\", slice, j, j)\n\treturn j, j\n}", "title": "" }, { "docid": "96d08e8f3f6574a8d7b03ccff3b6712a", "score": "0.46828365", "text": "func twoNumberSum(input []int,val int)(val1 int ,val2 int){\n\tsumMap:=make(map[int]bool)\n\tfor _, num := range input {\n\t\tsum:=19-num\n\t\tif sumMap[sum] {\n\t\t\treturn num,sum\n\t\t}\n\t\tsumMap[num]=true\n\t}\n\treturn 0,0\n}", "title": "" }, { "docid": "559cf59a91c2e56d89dbcb758dde535a", "score": "0.46804318", "text": "func selfDividingNumbers(left int, right int) []int {\n var sl []int\n for left <= right {\n if divideNum(left) {\n sl = append(sl, left)\n }\n left++\n }\n return sl\n}", "title": "" }, { "docid": "7fdbfd992e82ac79189b0d898fe9513c", "score": "0.4678231", "text": "func rob(nums []int) int {\n\t// dp:\n\tmax := func(a, b int) int {\n\t\tif a > b {\n\t\t\treturn a\n\t\t}\n\t\treturn b\n\t}\n\tlast, pre := 0, 0\n\tfor i := 0; i < len(nums); i++ {\n\t\tlast, pre = pre, max(last+nums[i], pre)\n\t}\n\treturn pre\n}", "title": "" }, { "docid": "fe9b7a0976ce43ff55bf700eed630210", "score": "0.46774837", "text": "func find132pattern(nums []int) bool {\n\tif len(nums) < 3 {\n\t\treturn false\n\t}\n\n\t// preprocess\n\t// min[i] = min(nums[0...i])\n\tmin := make([]int, len(nums))\n\tmin[0] = nums[0]\n\tfor i := 1; i < len(nums); i++ {\n\t\tmin[i] = minInt(min[i-1], nums[i])\n\t}\n\n\ts := make([]int, 0) // s is a stack\n\t// scan from back to find possible nums[k]\n\t// 132: nums[i] < nums[k] < nums[j], i < j < k\n\t// using min[i] to represent 132:\n\t// min[j] < nums[k] < nums[j], j < k\n\tfor j := len(nums) - 1; j >= 0; j-- {\n\t\t// first check if min[j] < nums[j]\n\t\tif min[j] < nums[j] {\n\t\t\t// if so, check stack for possible nums[k]\n\t\t\t// we need min[j] < nums[k], so we keep popping if min[j] >= nums[k]\n\t\t\tfor len(s) > 0 && min[j] >= s[len(s)-1] {\n\t\t\t\ts = s[:len(s)-1]\n\t\t\t}\n\t\t\t// now if there's still possible nums[k] in the stack,\n\t\t\t// then we've detected a 132 pattern\n\t\t\tif len(s) > 0 && s[len(s)-1] < nums[j] {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\t// if not, it means that either stack is empty\n\t\t\t// or all possible nums[k] in the stack >= nums[j].\n\t\t\t// in either case, we've found a new possible nums[k]\n\t\t\t// which is current nums[j]. we then push it into stack.\n\t\t\ts = append(s, nums[j])\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "6783fb0f1f01b763c087038910feb498", "score": "0.46712226", "text": "func threeSum(nums []int) [][]int {\n\tsort(nums, 0, len(nums)-1)\n\tresult := [][]int{}\n\tif len(nums) < 3 {\n\t\treturn result\n\t}\n\tfor i:=0; i<len(nums)-2;i++ {\n\t\tif i>0 && nums[i] == nums[i-1] {\n\t\t\tcontinue\n\t\t}\n\t\ttarget:= nums[i]\n\t\tleft, right := i+1, len(nums)-1\n\t\tfor left < right {\n\t\t\tif nums[left] + nums[right] + target == 0 {\n\t\t\t\tresult = append(result, []int{nums[i], nums[left], nums[right]})\n\t\t\t\tleft++\n\t\t\t\tright--\n\t\t\t\tfor left < right && nums[left] == nums[left-1] {\n\t\t\t\t\tleft++\n\t\t\t\t}\n\t\t\t\tfor left < right && nums[right] == nums[right+1] {\n\t\t\t\t\tright--\n\t\t\t\t}\n\t\t\t} else if nums[left] + nums[right] + target > 0 {\n\t\t\t\tright--\n\t\t\t} else {\n\t\t\t\tleft++\n\t\t\t}\n\t\t}\n\t}\n\treturn result\n}", "title": "" }, { "docid": "43de5ea700e14d91a60ef7bb94b406c4", "score": "0.466879", "text": "func main() {\n\te1 := []int{2, 2, 1}\n\tsingle := singlenumber(e1)\n\tfmt.Println(single)\n\n\te2 := []int{4, 1, 2, 1, 2}\n\tsingle2 := singlenumber(e2)\n\tfmt.Println(single2)\n}", "title": "" } ]
e3bf9323be15d9069ec5b359d293caee
ResolveWorkspacePath tries to resolve the Kyma source folder if source=local is defined, otherwise the defined workspace path will be returned
[ { "docid": "71b07e108dce949cafa0c0885f5231ce", "score": "0.8058025", "text": "func (o *Options) ResolveLocalWorkspacePath() string {\n\t//resolve local Kyma source directory only if user has not defined a custom workspace directory\n\tif o.Source == localSource && o.WorkspacePath == defaultWorkspacePath {\n\t\t//use Kyma sources stored in GOPATH (if they exist)\n\t\tgoPath := os.Getenv(\"GOPATH\")\n\t\tif goPath != \"\" {\n\t\t\tkymaPath := filepath.Join(goPath, \"src\", \"github.com\", \"kyma-project\", \"kyma\")\n\t\t\tif o.pathExists(kymaPath, \"Local Kyma source directory\") == nil {\n\t\t\t\treturn kymaPath\n\t\t\t}\n\t\t}\n\t}\n\t//no Kyma sources found in GOPATH\n\treturn o.WorkspacePath\n}", "title": "" } ]
[ { "docid": "0f64c0a4f6b1549a31df6a652083a898", "score": "0.58008504", "text": "func GetGoWorkspacePath() string {\n\treturn path.Join(os.Getenv(\"GOPATH\"), \"src\")\n}", "title": "" }, { "docid": "73f07ab62f67044324e8a2cc2bcdbe1d", "score": "0.5765698", "text": "func (i *ts_auto_depsImport) resolvedPath() string {\n\tif strings.HasPrefix(i.importPath, \"./\") || strings.HasPrefix(i.importPath, \"../\") {\n\t\t// If the import is relative to the source location, use the source\n\t\t// location to form a \"canonical\" path from the root.\n\t\treturn platform.Normalize(filepath.Clean(filepath.Join(filepath.Dir(i.location.sourcePath), i.importPath)))\n\t} else if trim := strings.TrimPrefix(i.importPath, workspace.Name()+\"/\"); trim != i.importPath {\n\t\treturn trim\n\t}\n\t// The import is an absolute import and therefore does not have a definite\n\t// resolved path.\n\treturn i.importPath\n}", "title": "" }, { "docid": "dd1f8d93c7bd13469e416b2455b3797a", "score": "0.55341154", "text": "func getPath() (string, error) {\n\t// if pkg is set, resolve pkg path\n\tif *pkg != \"\" {\n\t\treturn resolvePath(os.Getenv(\"GOPATH\") + \"/src/\" + *pkg)\n\t} else if *src != \"\" { // if src is present parse from src\n\t\treturn resolvePath(*src)\n\t} else if len(os.Args) > 1 { // else if there is a command line arg, use it as path to a package $GOPATH/src/os.Args[1]\n\t\treturn resolvePath(os.Getenv(\"GOPATH\") + \"/src/\" + os.Args[1])\n\t}\n\treturn \"\", ErrNoPathProvided\n}", "title": "" }, { "docid": "e29c084f2ae97ac405dcb5b45156b4dc", "score": "0.52834123", "text": "func findWorkspaceRoot(ctx context.Context, folderURI span.URI, fs source.FileSource, excludePath func(string) bool, experimental bool) (span.URI, error) {\n\tpatterns := []string{\"go.work\", \"go.mod\"}\n\tif experimental {\n\t\tpatterns = []string{\"go.work\", \"gopls.mod\", \"go.mod\"}\n\t}\n\tfolder := folderURI.Filename()\n\tfor _, basename := range patterns {\n\t\tmatch, err := findRootPattern(ctx, folder, basename, fs)\n\t\tif err != nil {\n\t\t\tif ctxErr := ctx.Err(); ctxErr != nil {\n\t\t\t\treturn \"\", ctxErr\n\t\t\t}\n\t\t\treturn \"\", err\n\t\t}\n\t\tif match != \"\" {\n\t\t\tdir := span.URIFromPath(filepath.Dir(match))\n\t\t\treturn dir, nil\n\t\t}\n\t}\n\n\t// The experimental workspace can handle nested modules at this point...\n\tif experimental {\n\t\treturn folderURI, nil\n\t}\n\n\t// ...else we should check if there's exactly one nested module.\n\tall, err := findModules(folderURI, excludePath, 2)\n\tif err == errExhausted {\n\t\t// Fall-back behavior: if we don't find any modules after searching 10000\n\t\t// files, assume there are none.\n\t\tevent.Log(ctx, fmt.Sprintf(\"stopped searching for modules after %d files\", fileLimit))\n\t\treturn folderURI, nil\n\t}\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif len(all) == 1 {\n\t\t// range to access first element.\n\t\tfor uri := range all {\n\t\t\treturn dirURI(uri), nil\n\t\t}\n\t}\n\treturn folderURI, nil\n}", "title": "" }, { "docid": "058026c21363f916b4fef3a64668b3e9", "score": "0.5195932", "text": "func (s *Source) RuntimeSource() string {\n\tif s.Local {\n\t\treturn s.FullPath\n\t}\n\tif s.Repo == \"github.com/micro/services\" || s.Repo == \"\" {\n\t\treturn s.Folder\n\t}\n\treturn fmt.Sprintf(\"%v/%v\", s.Repo, s.Folder)\n}", "title": "" }, { "docid": "f53699ac0043e7836d9032e351305817", "score": "0.5098243", "text": "func initWorkspaceForProjectPath(projectPath string, isAllowReset bool) error {\n\tlog.Debug(\"[Init] Initializing Workspace & Config ...\")\n\n\tgowsWorspacesRootDirAbsPath, err := config.GOWSWorspacesRootDirAbsPath()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed to get absolute path for gows workspaces root dir, error: %s\", err)\n\t}\n\n\t// Create the Workspace\n\tgowsConfig, err := config.LoadGOWSConfigFromFile()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed to load gows config: %s\", err)\n\t}\n\n\tprojectWorkspaceAbsPath := \"\"\n\twsConfig, isFound := gowsConfig.WorkspaceForProjectLocation(projectPath)\n\tif isFound {\n\t\tif wsConfig.WorkspaceRootPath == \"\" {\n\t\t\treturn fmt.Errorf(\"A workspace is found for this project (path: %s), but the workspace root directory path is not defined\", projectPath)\n\t\t}\n\t\tprojectWorkspaceAbsPath = wsConfig.WorkspaceRootPath\n\n\t\tif isAllowReset {\n\t\t\tif err := os.RemoveAll(projectWorkspaceAbsPath); err != nil {\n\t\t\t\treturn fmt.Errorf(\"Failed to delete previous workspace at path: %s\", projectWorkspaceAbsPath)\n\t\t\t}\n\t\t\t// init a new one\n\t\t\tprojectWorkspaceAbsPath = \"\"\n\t\t} else {\n\t\t\tlog.Warning(colorstring.Yellow(\"A workspace already exists for this project\") + \" (\" + projectWorkspaceAbsPath + \"), will be reused.\")\n\t\t\tlog.Warning(\"If you want to delete the previous workspace of this project and generate a new one you should run: \" + colorstring.Green(\"gows clear\"))\n\t\t}\n\t}\n\n\tif projectWorkspaceAbsPath == \"\" {\n\t\t// generate one\n\t\tprojectBaseWorkspaceDirName := fmt.Sprintf(\"%s-%d\", filepath.Base(projectPath), time.Now().Unix())\n\t\tprojectWorkspaceAbsPath = filepath.Join(gowsWorspacesRootDirAbsPath, projectBaseWorkspaceDirName)\n\t}\n\n\tlog.Debugf(\" projectWorkspaceAbsPath: %s\", projectWorkspaceAbsPath)\n\tif err := initGoWorkspaceAtPath(projectWorkspaceAbsPath); err != nil {\n\t\treturn fmt.Errorf(\"Failed to initialize workspace at path: %s\", projectWorkspaceAbsPath)\n\t}\n\tlog.Debugf(\" Workspace successfully created\")\n\n\t// Save the location into Workspace config\n\t{\n\t\tworkspaceConf := config.WorkspaceConfigModel{\n\t\t\tWorkspaceRootPath: projectWorkspaceAbsPath,\n\t\t}\n\t\tgowsConfig.Workspaces[projectPath] = workspaceConf\n\n\t\tif err := config.SaveGOWSConfigToFile(gowsConfig); err != nil {\n\t\t\treturn fmt.Errorf(\"Failed to save gows config: %s\", err)\n\t\t}\n\t}\n\tlog.Debug(\"[Init] Workspace Config saved\")\n\n\treturn nil\n}", "title": "" }, { "docid": "6708f587cc5c825edb2706100300b0f2", "score": "0.50948733", "text": "func (r *Runner) resolvePath(templateName string) (string, error) {\n\tcurDirectory, err := os.Getwd()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\ttemplatePath := path.Join(curDirectory, templateName)\n\tif _, err := os.Stat(templatePath); !os.IsNotExist(err) {\n\t\tgologger.Debugf(\"Found template in current directory: %s\\n\", templatePath)\n\n\t\treturn templatePath, nil\n\t}\n\n\tif r.templatesConfig != nil {\n\t\ttemplatePath := path.Join(r.templatesConfig.TemplatesDirectory, templateName)\n\t\tif _, err := os.Stat(templatePath); !os.IsNotExist(err) {\n\t\t\tgologger.Debugf(\"Found template in nuclei-templates directory: %s\\n\", templatePath)\n\n\t\t\treturn templatePath, nil\n\t\t}\n\t}\n\n\treturn \"\", fmt.Errorf(\"no such path found: %s\", templateName)\n}", "title": "" }, { "docid": "d3254572fb267f47f1ef6a12f3507650", "score": "0.5074893", "text": "func TestLocalPath(t *testing.T) {\n\n\tequalPath(t,\n\t\t\"/tmp/compose/filename.md\",\n\t\tgetLocalFilePath(\"/tmp/compose\", \".\", \".\", \"filename.md\"),\n\t\t\"Simple setup, always first level\")\n\n\tequalPath(t,\n\t\t\"/tmp/compose/filename.md\",\n\t\tgetLocalFilePath(\"/tmp/compose\", \"docs\", \".\", \"docs/filename.md\"),\n\t\t\"With remote 'docs' folder\")\n\n\tequalPath(t,\n\t\t\"/tmp/compose/docs/filename.md\",\n\t\tgetLocalFilePath(\"/tmp/compose\", \".\", \".\", \"docs/filename.md\"),\n\t\t\"With remote 'docs' folder, but keep structure\")\n\n\tequalPath(t,\n\t\t\"compose/filename.md\",\n\t\tgetLocalFilePath(\"./compose\", \".\", \".\", \"filename.md\"),\n\t\t\"Path is relative\")\n\n\tequalPath(t,\n\t\t\"/tmp/compose/localTarget/filename.md\",\n\t\tgetLocalFilePath(\"/tmp/compose\", \".\", \"localTarget\", \"filename.md\"),\n\t\t\"Local Target folder\")\n\n\tequalPath(t,\n\t\t\"/tmp/compose/filename.md\",\n\t\tgetLocalFilePath(\"/tmp/compose\", \".\", \"\", \"filename.md\"),\n\t\t\"Empty local target folder\")\n}", "title": "" }, { "docid": "eeb751ae683ac66b4a95f82cfd99ff48", "score": "0.50035346", "text": "func getSingularitySrcDir() (string, error) {\n\tdir := buildcfg.SOURCEDIR\n\tpkgName := getPackageName()\n\n\t// get current file path\n\t_, filename, _, ok := runtime.Caller(0)\n\tif !ok {\n\t\treturn \"\", fmt.Errorf(\"could not determine source directory\")\n\t}\n\n\t// replace github.com/sylabs/singularity@v0.0.0\n\tpattern := fmt.Sprintf(\"%s@%s\", pkgName, version)\n\tfilename = strings.Replace(filename, pattern, \"\", 1)\n\n\t// look if source directory is present\n\tcanary := filepath.Join(dir, filename)\n\tsylog.Debugf(\"Searching source file %s\", canary)\n\n\tswitch _, err := os.Stat(canary); {\n\tcase os.IsNotExist(err):\n\t\treturn \"\", fmt.Errorf(\"cannot find %q\", canary)\n\n\tcase err != nil:\n\t\treturn \"\", fmt.Errorf(\"unexpected error while looking for %q: %s\", canary, err)\n\n\tdefault:\n\t\treturn dir, nil\n\t}\n}", "title": "" }, { "docid": "9e1f7f542b97a39d73827971557ffe40", "score": "0.49946645", "text": "func (t *TaskSpec) ResolveWorkDir() {\n\tagentUser := \"\"\n\tdetUser := \"\"\n\tif t.AgentUserGroup != nil {\n\t\tagentUser = t.AgentUserGroup.User\n\t}\n\tif t.Owner != nil {\n\t\tdetUser = t.Owner.Username\n\t}\n\tworkDir := strings.ReplaceAll(t.WorkDir, \"$AGENT_USER\", agentUser)\n\tt.WorkDir = strings.ReplaceAll(workDir, \"$DET_USER\", detUser)\n}", "title": "" }, { "docid": "1dc7eb361a1048fdd9007cdcc37a1897", "score": "0.4968841", "text": "func getFullPath(path string) string {\n\tgopath := os.Getenv(\"GOPATH\")\n\treturn gopath + \"/src/\" + path\n\n}", "title": "" }, { "docid": "5b803e33864ae6346fa83b1dded99c26", "score": "0.49304864", "text": "func GetResolvedSourcePathName() string {\n\tif IsDebugging {\n\t\treturn getThisFileDirectory() + \"/../\" + GetBuildSourcePath()\n\t}\n\n\treturn GetBuildSourcePath()\n}", "title": "" }, { "docid": "b48ba1c6f8d68286edb0e8c70be51dfc", "score": "0.489872", "text": "func (env *Environment) LocalPath(path ...string) string {\n\treturn env.profile.Path(filepath.Join(path...))\n}", "title": "" }, { "docid": "b34e115310fd58d430ef396835666d32", "score": "0.4890822", "text": "func (p *kubeconfigProvider) Local() (*clientcmdapi.Config, error) {\n\tconfig, err := p.pathOptions.GetStartingConfig()\n\tif err != nil {\n\t\tif a, ok := err.(kubeerrors.Aggregate); ok {\n\t\t\t_, isSnap := os.LookupEnv(\"SNAP\")\n\n\t\t\tfor _, err := range a.Errors() {\n\t\t\t\t// this should NOT be a contains check but they are formatting the\n\t\t\t\t// error without implementing an unwrap (so the original permission\n\t\t\t\t// error type is lost).\n\t\t\t\tif strings.Contains(err.Error(), \"permission denied\") && isSnap {\n\t\t\t\t\twarn(\"Using the doctl Snap? Grant access to the doctl:kube-config plug to use this command with: sudo snap connect doctl:kube-config\")\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\n\t\treturn nil, err\n\t}\n\n\treturn config, nil\n}", "title": "" }, { "docid": "257a5b232dec558d33857a052f45a096", "score": "0.48842674", "text": "func relativeSourcePath(p string) string {\n for _, e := range sourceRoots {\n if strings.HasPrefix(p, e) {\n if len(p) > len(e) {\n return p[len(e) + 1:]\n }else{\n return \"/\"\n }\n }\n }\n return p\n}", "title": "" }, { "docid": "05bc60c35ccb810a7ec2d331b226c2b0", "score": "0.48554546", "text": "func resolveTarget(gopath, target string) ([]string, error) {\n\tif strings.HasPrefix(target, \".\") {\n\t\treturn nil, errors.New(\"local package (.) is not supported yet\")\n\t}\n\tif filepath.Base(target) != \"...\" {\n\t\treturn []string{target}, nil\n\t}\n\tgopathSrc := filepath.Join(gopath, \"src\")\n\td := filepath.Join(gopathSrc, filepath.Dir(target))\n\tresolvedMap := make(map[string]struct{})\n\terr := filepath.Walk(d,\n\t\tfunc(path string, info os.FileInfo, err error) error {\n\t\t\tif strings.HasSuffix(path, \".go\") {\n\t\t\t\td := filepath.Dir(path)\n\t\t\t\t_, ok := resolvedMap[d]\n\t\t\t\tif !ok {\n\t\t\t\t\tresolvedMap[d] = struct{}{}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar resolved []string\n\tfor f, _ := range resolvedMap {\n\t\tresolved = append(resolved, strings.Replace(f, gopathSrc+\"/\", \"\", 1))\n\t}\n\tsort.Strings(resolved)\n\treturn resolved, nil\n}", "title": "" }, { "docid": "8b459f442e53a5157bd5e04adc387fe0", "score": "0.4839606", "text": "func ParseSourceLocal(workDir, source string, pathExistsFunc ...func(path string) (bool, error)) (*Source, error) {\n\tvar pexists func(string) (bool, error)\n\tif len(pathExistsFunc) == 0 {\n\t\tpexists = pathExists\n\t} else {\n\t\tpexists = pathExistsFunc[0]\n\t}\n\tvar localFullPath string\n\tif len(workDir) > 0 {\n\t\tlocalFullPath = filepath.Join(workDir, source)\n\t} else {\n\t\tlocalFullPath = source\n\t}\n\tif exists, err := pexists(localFullPath); err == nil && exists {\n\t\tlocalRepoRoot, err := GetRepoRoot(localFullPath)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tvar folder string\n\t\t// If the local repo root is a top level folder, we are not in a git repo.\n\t\t// In this case, we should take the last folder as folder name.\n\t\tif localRepoRoot == \"\" {\n\t\t\tfolder = filepath.Base(localFullPath)\n\t\t} else {\n\t\t\tfolder = strings.ReplaceAll(localFullPath, localRepoRoot+string(filepath.Separator), \"\")\n\t\t}\n\n\t\treturn &Source{\n\t\t\tLocal: true,\n\t\t\tFolder: folder,\n\t\t\tFullPath: localFullPath,\n\t\t\tLocalRepoRoot: localRepoRoot,\n\t\t\tRef: \"latest\", // @todo consider extracting branch from git here\n\t\t}, nil\n\t}\n\treturn ParseSource(source)\n}", "title": "" }, { "docid": "7f481002fd11bee86e7a819b5be97254", "score": "0.48319677", "text": "func GetSourcePath() string {\n\treturn GetClobberPath() + \"/src\"\n}", "title": "" }, { "docid": "a11f37b13b6d971657c243e47574bee5", "score": "0.48015955", "text": "func (e *Environment) LocalPathSourceInfo(path string) snapshot.SourceInfo {\n\treturn snapshot.SourceInfo{\n\t\tUserName: e.Repository.ClientOptions().Username,\n\t\tHost: e.Repository.ClientOptions().Hostname,\n\t\tPath: path,\n\t}\n}", "title": "" }, { "docid": "29e8fb84379df92f49cf29c2f2350a9b", "score": "0.47966552", "text": "func (h Harness) Workspace(ctx context.Context, name string) error {\n\tcmd := exec.CommandContext(ctx, h.Path, \"workspace\", \"select\", \"-no-color\", name) //nolint:gosec\n\tcmd.Dir = h.Dir\n\n\tif _, err := cmd.Output(); err == nil {\n\t\t// We successfully selected the workspace; we're done.\n\t\treturn nil\n\t}\n\n\t// We weren't able to select a workspace. We assume this was because the\n\t// workspace doesn't exist, which causes Terraform to return non-zero. This\n\t// is somewhat optimistic, but it shouldn't hurt to try.\n\tcmd = exec.CommandContext(ctx, h.Path, \"workspace\", \"new\", \"-no-color\", name) //nolint:gosec\n\tcmd.Dir = h.Dir\n\t_, err := cmd.Output()\n\treturn Classify(err)\n}", "title": "" }, { "docid": "ac9514c1a98ff67ab2eab978918a54e8", "score": "0.4794259", "text": "func pkgPath() (string, error) {\n\t_, thisFile, _, ok := runtime.Caller(1)\n\tif !ok {\n\t\treturn \"\", fmt.Errorf(\"failed to get current file\")\n\t}\n\n\tpkgPath := filepath.Dir(thisFile)\n\n\t// If we find bazel env variables, then -trimpath was passed so we need to\n\t// construct the path from the environment.\n\tif testSrcdir, testWorkspace := os.Getenv(\"TEST_SRCDIR\"), os.Getenv(\"TEST_WORKSPACE\"); testSrcdir != \"\" && testWorkspace != \"\" {\n\t\tpkgPath = filepath.Join(testSrcdir, testWorkspace, pkgPath)\n\t}\n\n\t// If the path is still not absolute, something other than bazel compiled\n\t// with -trimpath.\n\tif !filepath.IsAbs(pkgPath) {\n\t\treturn \"\", fmt.Errorf(\"can't construct an absolute path from %q\", pkgPath)\n\t}\n\n\treturn pkgPath, nil\n}", "title": "" }, { "docid": "ebd3f753748ef337241314d7ec135ea9", "score": "0.47924343", "text": "func FindWorkspace(root string, oserr error) (w *Workspace, err error) {\n\tif oserr != nil {\n\t\treturn nil, oserr\n\t}\n\tpath := root\n\t//loop until I've reached the root, or found the .sbr\n\tfor ; !fileExists(filepath.Join(path, SbrFile)) && path != \"/\"; path = filepath.Dir(path) {\n\t}\n\n\tif path != \"/\" {\n\t\treturn NewWorkspace(path), nil\n\t} else {\n\t\treturn NewWorkspace(root), ErrNoSbrfile\n\t}\n}", "title": "" }, { "docid": "d3e2f3d6085cf8a22fdbf14df0e45193", "score": "0.47893268", "text": "func getSingularitySrcDir() (string, error) {\n\tdir, err := os.Getwd()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tcanary := filepath.Join(dir, \"cmd\", \"singularity\", \"cli.go\")\n\n\tswitch _, err = os.Stat(canary); {\n\tcase os.IsNotExist(err):\n\t\treturn \"\", fmt.Errorf(\"cannot find \\\"%s\\\"\", canary)\n\n\tcase err != nil:\n\t\treturn \"\", fmt.Errorf(\"unexpected error while looking for \\\"%s\\\": %s\", canary, err)\n\n\tdefault:\n\t\treturn dir, nil\n\t}\n}", "title": "" }, { "docid": "2fe3fe7fd18e2f916121afe45d927c79", "score": "0.47875005", "text": "func findRoot() (string, error) {\n\twd, err := os.Getwd()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tfor {\n\t\tcontents, err := os.ReadFile(filepath.Join(wd, \"go.mod\"))\n\t\tif err == nil {\n\t\t\tfor _, line := range strings.Split(string(contents), \"\\n\") {\n\t\t\t\tif line == \"module github.com/sourcegraph/sourcegraph\" {\n\t\t\t\t\treturn wd, nil\n\t\t\t\t}\n\t\t\t}\n\t\t} else if !os.IsNotExist(err) {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\tif parent := filepath.Dir(wd); parent != wd {\n\t\t\twd = parent\n\t\t\tcontinue\n\t\t}\n\n\t\treturn \"\", errors.Errorf(\"not running inside sourcegraph/sourcegraph\")\n\t}\n}", "title": "" }, { "docid": "3eb4ec8a317226b69f6ae49891bf632e", "score": "0.47720593", "text": "func LookupWorkspace(ctx *pulumi.Context, args *LookupWorkspaceArgs, opts ...pulumi.InvokeOption) (*LookupWorkspaceResult, error) {\n\tvar rv LookupWorkspaceResult\n\terr := ctx.Invoke(\"azure-native:machinelearningexperimentation/v20170501preview:getWorkspace\", args, &rv, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &rv, nil\n}", "title": "" }, { "docid": "1904c2fd3c2928ba5990bfd5dc68ccbb", "score": "0.47706944", "text": "func (a *Common) SolvePath() *maze.Path {\n\treturn a.solvePath\n}", "title": "" }, { "docid": "8bc481c95f70ad5371b5c2181a18dbd7", "score": "0.4752208", "text": "func (o UserSourceInfoOutput) RelativePath() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v UserSourceInfo) *string { return v.RelativePath }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "8636fe4c6b8631dd7bc269eaf4301424", "score": "0.47493285", "text": "func LookupWorkspace(ctx *pulumi.Context, args *LookupWorkspaceArgs, opts ...pulumi.InvokeOption) (*LookupWorkspaceResult, error) {\n\topts = internal.PkgInvokeDefaultOpts(opts)\n\tvar rv LookupWorkspaceResult\n\terr := ctx.Invoke(\"aws-native:iottwinmaker:getWorkspace\", args, &rv, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &rv, nil\n}", "title": "" }, { "docid": "e92ba17b9a2bca4ccffadb679ee7a9da", "score": "0.4747773", "text": "func ResolvePath(path string) string {\n\tif filepath.IsAbs(path) {\n\t\treturn path\n\t}\n\tif Config.DataDir == \"\" {\n\t\treturn \"\"\n\t}\n\tfullpath := filepath.Join(Config.DataDir, Config.Name)\n\tfullpath = filepath.Join(fullpath, path)\n\treturn fullpath\n}", "title": "" }, { "docid": "dc2146b6919ac9218e1684bc173eb6c2", "score": "0.4741917", "text": "func (x jsImports) LookupLocal(pkgPath string) string {\n\tix := sort.Search(len(x), func(i int) bool { return x[i].Path >= pkgPath })\n\tif ix < len(x) && x[ix].Path == pkgPath {\n\t\treturn x[ix].Local\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "2cdc270a863425f108b1763ad2dde506", "score": "0.47332752", "text": "func resolveLocalPackage(dir string) (string, error) {\n\tvar absDir string\n\tif filepath.IsAbs(dir) {\n\t\tabsDir = filepath.Clean(dir)\n\t} else {\n\t\tabsDir = filepath.Join(base.Cwd, dir)\n\t}\n\n\tbp, err := cfg.BuildContext.ImportDir(absDir, 0)\n\tif err != nil && (bp == nil || len(bp.IgnoredGoFiles) == 0) {\n\t\t// golang.org/issue/32917: We should resolve a relative path to a\n\t\t// package path only if the relative path actually contains the code\n\t\t// for that package.\n\t\t//\n\t\t// If the named directory does not exist or contains no Go files,\n\t\t// the package does not exist.\n\t\t// Other errors may affect package loading, but not resolution.\n\t\tif _, err := os.Stat(absDir); err != nil {\n\t\t\tif os.IsNotExist(err) {\n\t\t\t\t// Canonicalize OS-specific errors to errDirectoryNotFound so that error\n\t\t\t\t// messages will be easier for users to search for.\n\t\t\t\treturn \"\", &os.PathError{Op: \"stat\", Path: absDir, Err: errDirectoryNotFound}\n\t\t\t}\n\t\t\treturn \"\", err\n\t\t}\n\t\tif _, noGo := err.(*build.NoGoError); noGo {\n\t\t\t// A directory that does not contain any Go source files — even ignored\n\t\t\t// ones! — is not a Go package, and we can't resolve it to a package\n\t\t\t// path because that path could plausibly be provided by some other\n\t\t\t// module.\n\t\t\t//\n\t\t\t// Any other error indicates that the package “exists” (at least in the\n\t\t\t// sense that it cannot exist in any other module), but has some other\n\t\t\t// problem (such as a syntax error).\n\t\t\treturn \"\", err\n\t\t}\n\t}\n\n\tif modRoot != \"\" && absDir == modRoot {\n\t\tif absDir == cfg.GOROOTsrc {\n\t\t\treturn \"\", errPkgIsGorootSrc\n\t\t}\n\t\treturn targetPrefix, nil\n\t}\n\n\t// Note: The checks for @ here are just to avoid misinterpreting\n\t// the module cache directories (formerly GOPATH/src/mod/foo@v1.5.2/bar).\n\t// It's not strictly necessary but helpful to keep the checks.\n\tif modRoot != \"\" && strings.HasPrefix(absDir, modRoot+string(filepath.Separator)) && !strings.Contains(absDir[len(modRoot):], \"@\") {\n\t\tsuffix := filepath.ToSlash(absDir[len(modRoot):])\n\t\tif strings.HasPrefix(suffix, \"/vendor/\") {\n\t\t\tif cfg.BuildMod != \"vendor\" {\n\t\t\t\treturn \"\", fmt.Errorf(\"without -mod=vendor, directory %s has no package path\", absDir)\n\t\t\t}\n\n\t\t\treadVendorList()\n\t\t\tpkg := strings.TrimPrefix(suffix, \"/vendor/\")\n\t\t\tif _, ok := vendorPkgModule[pkg]; !ok {\n\t\t\t\treturn \"\", fmt.Errorf(\"directory %s is not a package listed in vendor/modules.txt\", absDir)\n\t\t\t}\n\t\t\treturn pkg, nil\n\t\t}\n\n\t\tif targetPrefix == \"\" {\n\t\t\tpkg := strings.TrimPrefix(suffix, \"/\")\n\t\t\tif pkg == \"builtin\" {\n\t\t\t\t// \"builtin\" is a pseudo-package with a real source file.\n\t\t\t\t// It's not included in \"std\", so it shouldn't resolve from \".\"\n\t\t\t\t// within module \"std\" either.\n\t\t\t\treturn \"\", errPkgIsBuiltin\n\t\t\t}\n\t\t\treturn pkg, nil\n\t\t}\n\n\t\tpkg := targetPrefix + suffix\n\t\tif _, ok := dirInModule(pkg, targetPrefix, modRoot, true); !ok {\n\t\t\treturn \"\", &PackageNotInModuleError{Mod: Target, Pattern: pkg}\n\t\t}\n\t\treturn pkg, nil\n\t}\n\n\tif sub := search.InDir(absDir, cfg.GOROOTsrc); sub != \"\" && sub != \".\" && !strings.Contains(sub, \"@\") {\n\t\tpkg := filepath.ToSlash(sub)\n\t\tif pkg == \"builtin\" {\n\t\t\treturn \"\", errPkgIsBuiltin\n\t\t}\n\t\treturn pkg, nil\n\t}\n\n\tpkg := pathInModuleCache(absDir)\n\tif pkg == \"\" {\n\t\treturn \"\", fmt.Errorf(\"directory %s outside available modules\", base.ShortPath(absDir))\n\t}\n\treturn pkg, nil\n}", "title": "" }, { "docid": "765d1d36ae0456f01309fb52dd8d99a8", "score": "0.47310236", "text": "func GetDEPSCheckoutPath(c DEPSLocalConfig, workdir string) (string, error) {\n\tvar repoRelPath string\n\tif c.CheckoutPath == \"\" {\n\t\tnormUrl, err := git.NormalizeURL(c.RepoURL)\n\t\tif err != nil {\n\t\t\treturn \"\", skerr.Wrap(err)\n\t\t}\n\t\trepoRelPath = path.Base(normUrl)\n\t} else {\n\t\trepoRelPath = c.CheckoutPath\n\t}\n\treturn filepath.Join(workdir, repoRelPath), nil\n}", "title": "" }, { "docid": "0dbe181d70fbb6ed3adc7352de8cf354", "score": "0.47029996", "text": "func (cdk *CDK) closestProjectManager() (string, error) {\n\twd, err := cdk.exec.Getwd()\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"get working directory: %w\", err)\n\t}\n\tvar closest string\n\tfindLockFileFn := func(dir string) (string, error) {\n\t\tfor _, candidate := range packageManagers {\n\t\t\texists, err := afero.Exists(cdk.fs, filepath.Join(dir, candidate.lockFile))\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t\tif exists {\n\t\t\t\tclosest = candidate.name\n\t\t\t\treturn \"\", workspace.ErrTraverseUpShouldStop\n\t\t\t}\n\t\t}\n\t\treturn \"\", nil\n\t}\n\t_, err = cdk.exec.Find(wd, maxNumberOfLevelsChecked, findLockFileFn)\n\tif err == nil {\n\t\treturn closest, nil\n\t}\n\tvar errTargetNotFound *workspace.ErrTargetNotFound\n\tif errors.As(err, &errTargetNotFound) {\n\t\treturn \"\", nil\n\t}\n\treturn \"\", fmt.Errorf(\"find a package lock file: %w\", err)\n}", "title": "" }, { "docid": "86233df04f977c0f243cfb798213b622", "score": "0.47006348", "text": "func Load(dirPath string) ([]*api.Workspace, error) {\n\tfiles, err := ioutil.ReadDir(dirPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar bodies []hcl.Body\n\tdiags := hcl.Diagnostics{}\n\tparser := hclparse.NewParser()\n\tfor _, file := range files {\n\t\tfileName := file.Name()\n\n\t\tif suffix := filepath.Ext(fileName); suffix != \".hcl\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tf, d := parser.ParseHCLFile(filepath.Join(dirPath, fileName))\n\t\tif f != nil {\n\t\t\tbodies = append(bodies, f.Body)\n\t\t}\n\t\tdiags = diags.Extend(d)\n\t}\n\tif diags.HasErrors() {\n\t\treturn nil, diags\n\t}\n\n\tvar config struct {\n\t\tWorkspaces []*struct {\n\t\t\tName string `hcl:\"name,label\"`\n\t\t\tSource *struct {\n\t\t\t\tType string `hcl:\"type,label\"`\n\t\t\t\tOwner string `hcl:\"owner\"`\n\t\t\t\tRepo string `hcl:\"repo\"`\n\t\t\t\tPath string `hcl:\"path,optional\"`\n\t\t\t\tRef string `hcl:\"ref,optional\"`\n\t\t\t} `hcl:\"source,block\"`\n\t\t\tWorkspace string `hcl:\"workspace,optional\"`\n\t\t\tVars *cty.Value `hcl:\"vars,optional\"`\n\t\t\tVarFiles []string `hcl:\"var_files,optional\"`\n\t\t} `hcl:\"workspace,block\"`\n\t}\n\tdiags = gohcl.DecodeBody(hcl.MergeBodies(bodies), nil, &config)\n\tif diags.HasErrors() {\n\t\treturn nil, diags\n\t}\n\n\tout := make([]*api.Workspace, 0, len(config.Workspaces))\n\n\tfor _, d := range config.Workspaces {\n\t\tvars, err := convertRawVars(d.Vars)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tvarFiles, err := resolveVarFiles(dirPath, d.VarFiles)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tsourceType, ok := api.Source_Type_value[d.Source.Type]\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"invalid source type: %s\", d.Source.Type)\n\t\t}\n\n\t\tout = append(out, &api.Workspace{\n\t\t\tName: d.Name,\n\t\t\tSource: &api.Source{\n\t\t\t\tType: api.Source_Type(sourceType),\n\t\t\t\tOwner: d.Source.Owner,\n\t\t\t\tRepo: d.Source.Repo,\n\t\t\t\tPath: d.Source.Path,\n\t\t\t\tRef: d.Source.Ref,\n\t\t\t},\n\t\t\tWorkspace: d.Workspace,\n\t\t\tVars: vars,\n\t\t\tVarFiles: varFiles,\n\t\t})\n\t}\n\n\treturn out, nil\n}", "title": "" }, { "docid": "8648ace80ab1c6d0830422e96afb4b00", "score": "0.4699703", "text": "func getRootPath() string {\n\tvar root string\n \troot, err := bazel.RunfilesPath()\n \tif err != nil {\n\t\t// Fall back to the non-bazel way to get to the root directory.\n\t\troot = callerRoot + \"/../../../../\"\n\t}\n\treturn root\n}", "title": "" }, { "docid": "328aa7ef489462b7cf6b06b7524b5e3e", "score": "0.46842527", "text": "func (fs osFS) resolve(path string) string {\n\t// Clean the path so that it cannot possibly begin with ../.\n\t// If it did, the result of filepath.Join would be outside the\n\t// tree rooted at root. We probably won't ever see a path\n\t// with .. in it, but be safe anyway.\n\tpath = pathpkg.Clean(\"/\" + path)\n\n\treturn filepath.Join(string(fs.root), path)\n}", "title": "" }, { "docid": "b618c4954ce62be0fdf97090cb14038c", "score": "0.46747458", "text": "func (api *CoreAPI) ResolvePath(ctx context.Context, p coreiface.Path) (coreiface.Path, error) {\n\tif p.Resolved() {\n\t\treturn p, nil\n\t}\n\n\tr := &ipfspath.Resolver{\n\t\tDAG: api.node.DAG,\n\t\tResolveOnce: uio.ResolveUnixfsOnce,\n\t}\n\n\tp2 := ipfspath.FromString(p.String())\n\tnode, err := core.Resolve(ctx, api.node.Namesys, r, p2)\n\tif err == core.ErrNoNamesys {\n\t\treturn nil, coreiface.ErrOffline\n\t} else if err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar root *cid.Cid\n\tif p2.IsJustAKey() {\n\t\troot = node.Cid()\n\t}\n\n\treturn ResolvedPath(p.String(), node.Cid(), root), nil\n}", "title": "" }, { "docid": "82ea3b3b00adccf653fc6196a4ec21ba", "score": "0.4668797", "text": "func (o UserSourceInfoPtrOutput) RelativePath() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *UserSourceInfo) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.RelativePath\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "c035c51e0b13947d849e328b0dd645bf", "score": "0.4657454", "text": "func GopathSrc(subDirNames ...string) (gps string) {\r\n\tgp := []string{\"\", \"src\"}\r\n\tfor _, goPath := range AllGoPaths() { // in 99% of setups there's only 1 GOPATH, but hey..\r\n\t\tgp[0] = goPath\r\n\t\tif gps = filepath.Join(append(gp, subDirNames...)...); ufs.DirExists(gps) {\r\n\t\t\tbreak\r\n\t\t}\r\n\t}\r\n\treturn\r\n}", "title": "" }, { "docid": "adb14de1f0772de30bf051146cc29b1b", "score": "0.46447325", "text": "func (o DatadogAgentSpecClusterChecksRunnerConfigVolumesProjectedSourcesServiceAccountTokenPtrOutput) Path() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *DatadogAgentSpecClusterChecksRunnerConfigVolumesProjectedSourcesServiceAccountToken) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Path\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "acf13d31cb6bb7c7fe3627e9de9122b1", "score": "0.46443108", "text": "func (g *toolArgs) fixPath(path string) string {\n\tif fixed, ok := g.pathmap[path]; ok {\n\t\ttrimmed := trimPrefixDir(fixed, g.workDir)\n\t\tif root, ok := findBazelOut(path); ok && !strings.Contains(trimmed, root) {\n\t\t\treturn filepath.Join(root, trimmed)\n\t\t}\n\t\treturn trimmed\n\t}\n\treturn path\n}", "title": "" }, { "docid": "686830f4e51059631b22cdaeb8ada6c8", "score": "0.46397159", "text": "func (c Config) GetDPSetupPath() string {\n\t// If it's an absolute path, just return it\n\tif len(c.SetupRepo) > 0 && c.SetupRepo[0] == '/' {\n\t\treturn c.SetupRepo\n\t}\n\t// Otherwise assume it's in GOPATH/src\n\treturn filepath.Join(c.GoPath, \"src\", c.SetupRepo)\n}", "title": "" }, { "docid": "e841dd7cdd54816fbe2abc3876469316", "score": "0.46306193", "text": "func LocateWorkspaceConfigFile() (string, error) {\n\tworkingDirectory, err := os.Getwd()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tworkspaceRoot := ws.FindWorkspaceRoot(workingDirectory)\n\tif workspaceRoot == \"\" {\n\t\treturn \"\", err\n\t}\n\treturn filepath.Join(workspaceRoot, rcFileName), nil\n}", "title": "" }, { "docid": "c5c6739f059cca6e299bc725238d1eea", "score": "0.46298748", "text": "func (d *Destination) LocalPath(remotePath string) string {\n\treturn filepath.Join(*d.LocalRoot, remotePath[len(*d.remoteRoot):])\n}", "title": "" }, { "docid": "994d6ea3e28cc942e3501abddded49f4", "score": "0.46240014", "text": "func makePathLocal(basePath string) string {\n\treturn filepath.Join(basePath, ctx.config.LocalBuckets)\n}", "title": "" }, { "docid": "32d30974dd9f4619f82e259d4701af51", "score": "0.46228904", "text": "func TestGetOSSourcePath(t *testing.T) {\n\ttempConfigFile, err := ioutil.TempFile(\"\", \"odoconfig\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdefer tempConfigFile.Close()\n\tos.Setenv(localConfigEnvName, tempConfigFile.Name())\n\n\tbinarySourceType := BINARY\n\tlocalSourceType := LOCAL\n\tgitSourceType := GIT\n\n\ttests := []struct {\n\t\tname string\n\t\tparameter string\n\t\tvalue string\n\t\twantErr bool\n\t\texistingConfig LocalConfig\n\t}{\n\t\t{\n\t\t\tname: \"Case 1: Valid location (even though it shows c:/)\",\n\t\t\tparameter: SourceLocation,\n\t\t\tvalue: \"file://c:/foo/bar\",\n\t\t\twantErr: false,\n\t\t\texistingConfig: LocalConfig{\n\t\t\t\tcomponentSettings: ComponentSettings{\n\t\t\t\t\tSourceType: &binarySourceType,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"Case 2: Error if passing in blank\",\n\t\t\tparameter: SourceLocation,\n\t\t\tvalue: \"\",\n\t\t\twantErr: true,\n\t\t\texistingConfig: LocalConfig{\n\t\t\t\tcomponentSettings: ComponentSettings{\n\t\t\t\t\tSourceType: &localSourceType,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"Case 3: Error if we're passing in git source type...\",\n\t\t\tparameter: SourceLocation,\n\t\t\tvalue: \"\",\n\t\t\twantErr: true,\n\t\t\texistingConfig: LocalConfig{\n\t\t\t\tcomponentSettings: ComponentSettings{\n\t\t\t\t\tSourceType: &gitSourceType,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"Case 4: Error if passing in just a url but using local\",\n\t\t\tparameter: SourceLocation,\n\t\t\tvalue: \"https://redhat.com\",\n\t\t\twantErr: true,\n\t\t\texistingConfig: LocalConfig{\n\t\t\t\tcomponentSettings: ComponentSettings{\n\t\t\t\t\tSourceType: &localSourceType,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"Case 5: Valid path\",\n\t\t\tparameter: SourceLocation,\n\t\t\tvalue: \"/var/foo/bar\",\n\t\t\twantErr: false,\n\t\t\texistingConfig: LocalConfig{\n\t\t\t\tcomponentSettings: ComponentSettings{\n\t\t\t\t\tSourceType: &localSourceType,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"Case 6: Error if URL escapes were passed in..\",\n\t\t\tparameter: SourceLocation,\n\t\t\tvalue: \"%a\",\n\t\t\twantErr: true,\n\t\t\texistingConfig: LocalConfig{\n\t\t\t\tcomponentSettings: ComponentSettings{\n\t\t\t\t\tSourceType: &localSourceType,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"Case 7: Valid binary path\",\n\t\t\tparameter: SourceLocation,\n\t\t\tvalue: \"/var/foo/bar\",\n\t\t\twantErr: false,\n\t\t\texistingConfig: LocalConfig{\n\t\t\t\tcomponentSettings: ComponentSettings{\n\t\t\t\t\tSourceType: &binarySourceType,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\tcfg, err := NewLocalConfigInfo(\"\")\n\t\t\tif err != nil {\n\t\t\t\tt.Error(err)\n\t\t\t}\n\t\t\tcfg.LocalConfig = tt.existingConfig\n\n\t\t\terr = cfg.SetConfiguration(tt.parameter, tt.value)\n\t\t\tif err != nil {\n\t\t\t\tt.Error(err)\n\t\t\t}\n\t\t\tisSet := cfg.IsSet(tt.parameter)\n\t\t\tif !isSet {\n\t\t\t\tt.Errorf(\"the '%v' was not set\", tt.parameter)\n\t\t\t}\n\n\t\t\t_, err = cfg.GetOSSourcePath()\n\t\t\tif tt.wantErr && err == nil {\n\t\t\t\tt.Errorf(\"expected error for %s source path\", tt.value)\n\t\t\t} else if !tt.wantErr && err != nil {\n\t\t\t\tt.Error(err)\n\t\t\t}\n\n\t\t})\n\t}\n}", "title": "" }, { "docid": "11b46d65ee58f04454acc8c07cb15e3b", "score": "0.46208385", "text": "func OverlaySourceDir(overlayName string) string {\n\t/* Assume using old style overlay dir without rootfs */\n\tvar overlaypath = path.Join(OverlaySourceTopDir(), overlayName)\n\tif _, err := os.Stat(path.Join(overlaypath, \"rootfs\")); err == nil {\n\t\t/* rootfs exists, use it. */\n\t\toverlaypath = path.Join(overlaypath, \"rootfs\")\n\t}\n\treturn overlaypath\n}", "title": "" }, { "docid": "b02292ecdeba2c484458c6514a7302dc", "score": "0.4620198", "text": "func inferModulePath(ctx context.Context, pctx *processContext, projectDir string) (string, error) {\n\tcmd := pctx.NewCommand(ctx, \"\", \"go\", \"env\", \"GOPATH\")\n\t// Since we're going to call Output, we need to make sure cmd.Stdout is nil\n\t// so Output can collect stdout.\n\tcmd.Stdout = nil\n\tgopath, err := cmd.Output()\n\tif err != nil {\n\t\treturn \"\", xerrors.Errorf(\"infer module path: %w\", err)\n\t}\n\n\tgopathEntries := filepath.SplitList(strings.TrimSuffix(string(gopath), \"\\n\"))\n\tfor _, entry := range gopathEntries {\n\t\t// Check if the projectDir is relative to $GOPATH/src.\n\t\tsrcDir := filepath.Join(entry, \"src\")\n\t\trel, err := filepath.Rel(srcDir, projectDir)\n\t\tif err != nil {\n\t\t\treturn \"\", xerrors.Errorf(\"infer module path: %w\", err)\n\t\t}\n\t\tinGOPATH := !strings.HasPrefix(rel, \"..\"+string(filepath.Separator))\n\t\tif inGOPATH {\n\t\t\treturn filepath.ToSlash(rel), nil\n\t\t}\n\t}\n\t// If the project dir is outside of GOPATH, we can't infer the module import path.\n\treturn \"\", xerrors.Errorf(\"infer module path: %s not in GOPATH/src\", projectDir)\n}", "title": "" }, { "docid": "38ca4a61c271cc4d8e748d8de9fa0470", "score": "0.461152", "text": "func getProjectRoot() string {\n\tvar (\n\t\tpath string\n\t\terr error\n\t)\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tpanic(fmt.Sprintf(\"GetProjectRoot error :%+v\", err))\n\t\t}\n\t}()\n\tpath, err = filepath.Abs(filepath.Dir(os.Args[0]))\n\treturn path\n}", "title": "" }, { "docid": "f1b7baa2d6ebbf9cb56953a2ef2512a2", "score": "0.45973492", "text": "func (p *Manager) sourceDir() string {\n\treturn p.cfg.Source\n}", "title": "" }, { "docid": "1e6b76002c4711318e1b25f9002ca5e3", "score": "0.45882964", "text": "func GetCurrentWorkspace() (string, error) {\n\tc, err := config.GetCurrentContext()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif len(c.Workspace) == 0 {\n\t\treturn \"\", errors.New(\"Current workspace context not set, you can switch to a workspace with \\n\\tastro workspace switch WORKSPACEID\")\n\t}\n\n\treturn c.Workspace, nil\n}", "title": "" }, { "docid": "9f35e7b85760603b8975fab430a94baf", "score": "0.45807096", "text": "func (fs *FileSystem) Workspace() string {\n\treturn fs.workspace\n}", "title": "" }, { "docid": "6cc673080b0300dadba4f5418cd32891", "score": "0.4547645", "text": "func RelativeProjectPath(rel string) string {\n\tcurrentPath := getCurrentPath()\n\tbaseProjectPath := strings.Split(currentPath, \"/back-end/\")[0]\n\n\treturn filepath.Join(baseProjectPath, rel)\n}", "title": "" }, { "docid": "024f55cb11ec4215c6c9739c34a08bb0", "score": "0.45398214", "text": "func (e *Local) GetSource() string {\n\treturn e.WorkspaceSource\n}", "title": "" }, { "docid": "d0c460786b735ebe35bcbd4dda56b73e", "score": "0.45320797", "text": "func findWxGoPkgPath() string {\n\tgopaths := strings.Split(os.Getenv(\"GOPATH\"), string(filepath.ListSeparator))\n\tfor _, gopath := range gopaths {\n\t\tpath := filepath.Join(filepath.Join(gopath, \"src\"), wxPackage)\n\t\tif fi, err := os.Stat(path); err == nil && fi.IsDir() {\n\t\t\treturn path\n\t\t}\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "79cf96eeb895001f1e3ff35b877f7736", "score": "0.4506267", "text": "func (conn *ftpConnection) resolvePath(args []string) (string, error) {\n\tvar filePath string\n\tif len(args) == 0 {\n\t\tfilePath = conn.ctx.CWD\n\t} else {\n\t\tfilePath = args[0]\n\t\tif filePath[0] != '/' {\n\t\t\tfilePath = path.Clean(path.Join(conn.ctx.CWD, filePath))\n\t\t}\n\t}\n\tif !conn.checkAccessControl(filePath) {\n\t\treturn \"\", fmt.Errorf(\"Access not allowed\")\n\t}\n\treturn filePath, nil\n}", "title": "" }, { "docid": "cca97da19030714c14fd9ab28fb73c56", "score": "0.44944993", "text": "func (c *Config) defaultSourceDir(\n\tfileSystem vfs.Stater,\n\tbds *xdg.BaseDirectorySpecification,\n) (chezmoi.AbsPath, error) {\n\t// Check for XDG Base Directory Specification data directories first.\n\tfor _, dataDir := range bds.DataDirs {\n\t\tdataDirAbsPath, err := chezmoi.NewAbsPathFromExtPath(dataDir, c.homeDirAbsPath)\n\t\tif err != nil {\n\t\t\treturn chezmoi.EmptyAbsPath, err\n\t\t}\n\t\tsourceDirAbsPath := dataDirAbsPath.Join(chezmoiRelPath)\n\t\tif _, err := fileSystem.Stat(sourceDirAbsPath.String()); err == nil {\n\t\t\treturn sourceDirAbsPath, nil\n\t\t}\n\t}\n\t// Fallback to XDG Base Directory Specification default.\n\tdataHomeAbsPath, err := chezmoi.NewAbsPathFromExtPath(bds.DataHome, c.homeDirAbsPath)\n\tif err != nil {\n\t\treturn chezmoi.EmptyAbsPath, err\n\t}\n\treturn dataHomeAbsPath.Join(chezmoiRelPath), nil\n}", "title": "" }, { "docid": "5cb9d33b3c6c1abeeeeeeae0ee70100d", "score": "0.4491212", "text": "func FindCurrent() (*Project, error) {\n\tpath, err := os.Getwd()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error while searching for project: %w\", err)\n\t}\n\treturn findByPath(path)\n}", "title": "" }, { "docid": "7a364004df108b90a42831b084b8f222", "score": "0.4490963", "text": "func FindProjectroot(path string) (string, error) {\n\tif path == \"\" {\n\t\treturn \"\", fmt.Errorf(\"project root is blank\")\n\t}\n\tstart := path\n\tfor path != filepath.Dir(path) {\n\t\troot := filepath.Join(path, \"src\")\n\t\tif _, err := os.Stat(root); err != nil {\n\t\t\tif os.IsNotExist(err) {\n\t\t\t\tpath = filepath.Dir(path)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn \"\", err\n\t\t}\n\t\tpath, err := filepath.EvalSymlinks(path)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\treturn path, nil\n\t}\n\treturn \"\", fmt.Errorf(\"could not find project root in %q or its parents\", start)\n}", "title": "" }, { "docid": "da92d71eb02d9020e1a65110a91c46ed", "score": "0.4488932", "text": "func GatherLocalRepositories(sess *Session) {\n\n\t// This is the number of targets as we don't do forks or anything else.\n\t// It will contain directorys, that will then be added to the repo count\n\t// if they contain a .git directory\n\tsess.Stats.Targets = len(sess.LocalDirs)\n\tsess.Stats.Status = StatusGathering\n\tsess.Out.Important(\"Gathering Local Repositories...\\n\")\n\n\tfor _, pth := range sess.LocalDirs {\n\n\t\tif !PathExists(pth, sess) {\n\t\t\tsess.Out.Error(\"\\n[*] <%s> does not exist! Quitting.\\n\", pth)\n\t\t\tos.Exit(1)\n\t\t}\n\n\t\t// Gather all paths in the tree\n\t\terr0 := filepath.Walk(pth, func(path string, f os.FileInfo, err1 error) error {\n\t\t\tif err1 != nil {\n\t\t\t\tsess.Out.Error(\"Failed to enumerate the path: %s\\n\", err1.Error())\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\t// If it is a directory then move forward\n\t\t\tif f.IsDir() {\n\n\t\t\t\t// If there is a .git directory then we have a repo\n\t\t\t\tif filepath.Ext(path) == \".git\" { // TODO Should we reverse this to ! to make the code cleaner\n\n\t\t\t\t\tparent, _ := filepath.Split(path)\n\n\t\t\t\t\tgitProjName, _ := filepath.Split(parent)\n\n\t\t\t\t\topenRepo, err2 := git.PlainOpen(parent)\n\t\t\t\t\tif err2 != nil {\n\n\t\t\t\t\t\treturn nil\n\t\t\t\t\t}\n\n\t\t\t\t\tref, err3 := openRepo.Head()\n\t\t\t\t\tif err3 != nil {\n\t\t\t\t\t\tsess.Out.Error(\"Failed to open the repo HEAD: %s\\n\", err3.Error())\n\t\t\t\t\t\treturn nil\n\t\t\t\t\t}\n\n\t\t\t\t\t// Get the name of the branch we are working on\n\t\t\t\t\ts := ref.Strings()\n\t\t\t\t\tbranchPath := fmt.Sprintf(\"%s\", s[0])\n\t\t\t\t\tbranchPathParts := strings.Split(branchPath, string(\"refs/heads/\"))\n\t\t\t\t\tbranchName := branchPathParts[len(branchPathParts)-1]\n\t\t\t\t\tpBranchName := &branchName\n\n\t\t\t\t\tcommit, _ := openRepo.CommitObject(ref.Hash())\n\t\t\t\t\tvar commitHash = commit.Hash[:]\n\n\t\t\t\t\t// TODO make this a generic function at some point\n\t\t\t\t\t// Generate a uid for the repo\n\t\t\t\t\th := sha1.New()\n\t\t\t\t\trepoID := fmt.Sprintf(\"%x\", h.Sum(commitHash))\n\n\t\t\t\t\tintRepoID, _ := strconv.ParseInt(repoID, 10, 64)\n\t\t\t\t\tvar pRepoID *int64\n\t\t\t\t\tpRepoID = &intRepoID\n\n\t\t\t\t\t// Set the url to the relative path of the repo based on the execution path of wraith\n\t\t\t\t\tpRepoURL := &parent\n\n\t\t\t\t\t// This is used to id the owner, fullname, and description of the repo. It is ugly but effective. It is the relative path to the repo, for example ../foo\n\t\t\t\t\tpGitProjName := &gitProjName\n\n\t\t\t\t\t// The project name is simply the parent directory in the case of a local scan with all other path bits removed for example ../foo -> foo.\n\t\t\t\t\tprojectPathParts := strings.Split(*pGitProjName, string(os.PathSeparator))\n\t\t\t\t\tpProjectName := &projectPathParts[len(projectPathParts)-2]\n\n\t\t\t\t\tsessR := Repository{\n\t\t\t\t\t\tOwner: pGitProjName,\n\t\t\t\t\t\tID: pRepoID,\n\t\t\t\t\t\tName: pProjectName,\n\t\t\t\t\t\tFullName: pGitProjName,\n\t\t\t\t\t\tCloneURL: pRepoURL,\n\t\t\t\t\t\tURL: pRepoURL,\n\t\t\t\t\t\tDefaultBranch: pBranchName,\n\t\t\t\t\t\tDescription: pGitProjName,\n\t\t\t\t\t\tHomepage: pRepoURL,\n\t\t\t\t\t}\n\n\t\t\t\t\t// Add the repo to the sess to be cloned and scanned\n\t\t\t\t\tsess.AddRepository(&sessR)\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\t\tif err0 != nil {\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b91d7c54f48c4d1f6f87cd3e261200d1", "score": "0.44845256", "text": "func (v *VirtualizationTool) SharedFilesystemPath() string { return v.config.SharedFilesystemPath }", "title": "" }, { "docid": "31e07925d89344896fcc2f780394b586", "score": "0.44835734", "text": "func getConfigPath() (string, error) {\n\tlocations := core.QStandardPaths_StandardLocations(\n\t\tcore.QStandardPaths__AppLocalDataLocation,\n\t)\n\tif len(locations) == 0 {\n\t\treturn \"\", errors.New(\"failed to locate application data directory\")\n\t}\n\n\t// Grab the first available location.\n\treturn locations[0], nil\n}", "title": "" }, { "docid": "afa7a095b3a12d8e19e4c2f27a0c463d", "score": "0.44831797", "text": "func determineWorkDir(function fuzz.Func, requestedFuzzDir string) string {\n\tvar workDir string\n\timportPathDirs := filepath.FromSlash(function.PkgPath) // convert import path into filepath\n\tif requestedFuzzDir == \"\" {\n\t\t// default to GOPATH/pkg/fuzz/corpus/import/path/<func>\n\t\tgp := fuzz.Gopath()\n\t\tworkDir = filepath.Join(gp, \"pkg\", \"fuzz\", \"corpus\", importPathDirs, function.FuncName)\n\t} else if requestedFuzzDir == \"testdata\" {\n\t\t// place under the package of interest in the testdata directory.\n\t\tworkDir = filepath.Join(function.PkgDir, \"testdata\", \"fuzz\", function.FuncName)\n\t} else {\n\t\t// requestedFuzzDir was specified to be an actual directory.\n\t\t// still use the import path to handle fuzzing multiple functions across multiple packages.\n\t\tworkDir = filepath.Join(requestedFuzzDir, importPathDirs, function.FuncName)\n\t}\n\treturn workDir\n}", "title": "" }, { "docid": "a5a085b4782a90d1f12042b7fdd97f50", "score": "0.44823685", "text": "func (ws *Workspace) RootPath() string {\n\treturn ws.rootPath\n}", "title": "" }, { "docid": "c9c0f2f2951ee6f0e2870a61ee6150c4", "score": "0.44642043", "text": "func setupWorkDir(ctx context.Context, tf tfexec.TerraformCLI, workspace string) (*tfexec.State, func(), error) {\n\t// check if terraform command is available.\n\tversion, err := tf.Version(ctx)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tlog.Printf(\"[INFO] [migrator@%s] terraform version: %s\\n\", tf.Dir(), version)\n\n\t// init folder\n\tlog.Printf(\"[INFO] [migrator@%s] initialize work dir\\n\", tf.Dir())\n\terr = tf.Init(ctx, \"\", \"-input=false\", \"-no-color\")\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\t//switch to workspace\n\tlog.Printf(\"[INFO] [migrator@%s] switch to remote workspace %s\\n\", tf.Dir(), workspace)\n\terr = tf.WorkspaceSelect(ctx, workspace)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\t// get the current remote state.\n\tlog.Printf(\"[INFO] [migrator@%s] get the current remote state\\n\", tf.Dir())\n\tcurrentState, err := tf.StatePull(ctx)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\t//override backend to local\n\tlog.Printf(\"[INFO] [migrator@%s] override backend to local\\n\", tf.Dir())\n\tswitchBackToRemotekFunc, err := tf.OverrideBackendToLocal(ctx, \"_tfmigrate_override.tf\", workspace)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\treturn currentState, switchBackToRemotekFunc, nil\n}", "title": "" }, { "docid": "f8ea67d312db9440105799e9dbafd218", "score": "0.44617724", "text": "func ResolvePath(relative string) (string, error) {\n\tif filepath.IsAbs(relative) {\n\t\treturn relative, nil\n\t}\n\tabs := path.Join(AppRoot(), relative)\n\tif _, err := os.Stat(abs); err != nil {\n\t\treturn \"\", err\n\t}\n\treturn abs, nil\n}", "title": "" }, { "docid": "d5f88bc1884995066e169ae3d35cbbce", "score": "0.4450117", "text": "func (sm *SourceMgr) DeduceProjectRoot(ip string) (ProjectRoot, error) {\n\tif atomic.CompareAndSwapInt32(&sm.releasing, 1, 1) {\n\t\treturn \"\", smIsReleased{}\n\t}\n\tatomic.AddInt32(&sm.opcount, 1)\n\tsm.glock.RLock()\n\tdefer func() {\n\t\tsm.glock.RUnlock()\n\t\tatomic.AddInt32(&sm.opcount, -1)\n\t}()\n\n\tif prefix, root, has := sm.rootxt.LongestPrefix(ip); has {\n\t\t// The non-matching tail of the import path could still be malformed.\n\t\t// Validate just that part, if it exists\n\t\tif prefix != ip {\n\t\t\t// TODO(sdboyer) commented until i find a proper description of how\n\t\t\t// to validate an import path\n\t\t\t//if !pathvld.MatchString(strings.TrimPrefix(ip, prefix+\"/\")) {\n\t\t\t//return \"\", fmt.Errorf(\"%q is not a valid import path\", ip)\n\t\t\t//}\n\t\t\t// There was one, and it validated fine - add it so we don't have to\n\t\t\t// revalidate it later\n\t\t\tsm.rootxt.Insert(ip, root)\n\t\t}\n\t\treturn root, nil\n\t}\n\n\tft, err := sm.deducePathAndProcess(ip)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tr, err := ft.rootf()\n\treturn ProjectRoot(r), err\n}", "title": "" }, { "docid": "319ba355790115e77640df5f3b201c58", "score": "0.44499058", "text": "func (i *Info) RelativePath() string {\n\treturn path.Join(i.Org, i.Repo, i.Basename())\n}", "title": "" }, { "docid": "7a86a1b3d11efec47cc6481799ef9511", "score": "0.44436488", "text": "func expandKubeconfigPath(path string) string {\n\tif expandedPath, err := homedir.Expand(path); err == nil {\n\t\treturn expandedPath\n\t}\n\n\t// homedir.Expand is too restrictive for the ~ prefix,\n\t// i.e., it errors on \"~somepath\" which is a valid path,\n\t// so just return the original path.\n\treturn path\n}", "title": "" }, { "docid": "5b445a7987afd865029e31a53bbb1c32", "score": "0.44367793", "text": "func (o DatadogAgentSpecClusterAgentConfigVolumesProjectedSourcesServiceAccountTokenPtrOutput) Path() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *DatadogAgentSpecClusterAgentConfigVolumesProjectedSourcesServiceAccountToken) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Path\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "5833f0b2a34ef219be20b676df1b9c0f", "score": "0.44365072", "text": "func GetLocalProject() (LagoonProject, error) {\n\t_, err := os.Getwd()\n\tif err != nil {\n\t\treturn LagoonProject{}, fmt.Errorf(\"error determining the current directory: %s\", err)\n\t}\n\n\t// the .lagoon.yml file will likely be in a git repo, we should check if the directory we are in is a repo :)\n\troot, err := find.Repo()\n\tif err != nil {\n\t\treturn LagoonProject{}, err\n\t}\n\tappDir := fmt.Sprintf(\"%+v\", root)\n\treturn getProjectFromPath(appDir)\n}", "title": "" }, { "docid": "a58ff69be5e23089c3d4e4e13c8aba3f", "score": "0.44357187", "text": "func (fs *LocalFileStore) Path() string {\n\treturn fs.source.Path()\n}", "title": "" }, { "docid": "6e3f806bccccb2bfc260d1539e829c84", "score": "0.44340014", "text": "func getFileinCwd(name string) (lsp.DocumentURI, error) {\n\tcore.FindRepoRoot()\n\tfilePath := path.Join(core.RepoRoot, \"tools/build_langserver/langserver/\"+name)\n\n\treturn lsp.DocumentURI(filePath), nil\n}", "title": "" }, { "docid": "4baa502de318264fd946312c144212c1", "score": "0.44294533", "text": "func (c *Config) getSourceDirAbsPath(options *getSourceDirAbsPathOptions) (chezmoi.AbsPath, error) {\n\tif options == nil || !options.refresh {\n\t\tif !c.sourceDirAbsPath.Empty() || c.sourceDirAbsPathErr != nil {\n\t\t\treturn c.sourceDirAbsPath, c.sourceDirAbsPathErr\n\t\t}\n\t}\n\n\tswitch data, err := c.sourceSystem.ReadFile(c.SourceDirAbsPath.JoinString(chezmoi.RootName)); {\n\tcase errors.Is(err, fs.ErrNotExist):\n\t\tc.sourceDirAbsPath = c.SourceDirAbsPath\n\tcase err != nil:\n\t\tc.sourceDirAbsPathErr = err\n\tdefault:\n\t\tc.sourceDirAbsPath = c.SourceDirAbsPath.JoinString(string(bytes.TrimSpace(data)))\n\t}\n\n\treturn c.sourceDirAbsPath, c.sourceDirAbsPathErr\n}", "title": "" }, { "docid": "5c66b0b64e9a072e5f5cd054cde687e0", "score": "0.44288594", "text": "func (o DatadogAgentSpecClusterChecksRunnerConfigVolumesProjectedSourcesConfigMapItemsOutput) Path() pulumi.StringOutput {\n\treturn o.ApplyT(func(v DatadogAgentSpecClusterChecksRunnerConfigVolumesProjectedSourcesConfigMapItems) string {\n\t\treturn v.Path\n\t}).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "699102e9dbb3f4e5904ca617340821ec", "score": "0.4423087", "text": "func GetProjectRoot() (string, error) {\n\t// Create a map to store all paths visited, to avoid running in circles.\n\tvisitedPaths := make(map[string]bool)\n\t// Get the current directory.\n\twd, err := os.Getwd()\n\tif err != nil {\n\t\treturn wd, errorutils.CheckError(err)\n\t}\n\tdefer os.Chdir(wd)\n\n\t// Get the OS root.\n\tosRoot := os.Getenv(\"SYSTEMDRIVE\")\n\tif osRoot != \"\" {\n\t\t// If this is a Windows machine:\n\t\tosRoot += \"\\\\\"\n\t} else {\n\t\t// Unix:\n\t\tosRoot = \"/\"\n\t}\n\n\t// Check if the current directory includes the go.mod file. If not, check the parent directpry\n\t// and so on.\n\tfor {\n\t\t// If the go.mod is found the current directory, return the path.\n\t\texists, err := fileutils.IsFileExists(filepath.Join(wd, \"go.mod\"), false)\n\t\tif err != nil || exists {\n\t\t\treturn wd, err\n\t\t}\n\n\t\t// If this the OS root, we can stop.\n\t\tif wd == osRoot {\n\t\t\tbreak\n\t\t}\n\n\t\t// Save this path.\n\t\tvisitedPaths[wd] = true\n\t\t// CD to the parent directory.\n\t\twd = filepath.Dir(wd)\n\t\tos.Chdir(wd)\n\n\t\t// If we already visited this directory, it means that there's a loop and we can stop.\n\t\tif visitedPaths[wd] {\n\t\t\treturn \"\", errorutils.CheckError(errors.New(\"Could not find go.mod for project.\"))\n\t\t}\n\t}\n\n\treturn \"\", errorutils.CheckError(errors.New(\"Could not find go.mod for project.\"))\n}", "title": "" }, { "docid": "435b17a9a41c5ace97254cdff85ec608", "score": "0.441806", "text": "func DefaultRulesPath() string {\n\trulesPath := os.Getenv(\"SEEKRET_RULES_PATH\")\n\tif rulesPath == \"\" {\n\t\trulesPath = os.ExpandEnv(defaultRulesDir)\n\t}\n\treturn rulesPath\n}", "title": "" }, { "docid": "e23a6b2c4c3a10fc5faa0284b4741e06", "score": "0.44165567", "text": "func getStandardPackagesPath() string {\n\tgoRoot := os.Getenv(\"GOROOT\")\n\n\tif goRoot != \"\" {\n\t\treturn path.Join(goRoot, \"src\")\n\t}\n\n\treturn pickExistingDirectory(\n\t\t\"/usr/local/go/src\",\n\t\t\"/usr/lib/go/src/\",\n\t)\n}", "title": "" }, { "docid": "e65b76ee65617fd8ce07e90828ac9679", "score": "0.44038546", "text": "func resolveKey(target, srcPath, stripPrefix string) string {\n\tkey := filepath.Join(target, strings.TrimPrefix(srcPath, filepath.ToSlash(stripPrefix)))\n\tkey = filepath.ToSlash(key)\n\tif !strings.HasPrefix(key, \"/\") {\n\t\tkey = \"/\" + key\n\t}\n\treturn key\n}", "title": "" }, { "docid": "a1b3ca1ef8b79c9dcf14d617716f7446", "score": "0.43940276", "text": "func GetKubeConfigPath(clName string) (string, error) {\n\tcurrentDir, err := os.Getwd()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// Dummy destination\n\tconn, err := net.Dial(\"udp\", \"1.1.1.1:80\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer conn.Close()\n\n\tlocalAddr := conn.LocalAddr().(*net.UDPAddr)\n\tctx := context.Background()\n\tdockerCli, err := dockerclient.NewEnvClient()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tnetworkFilter := filters.NewArgs()\n\tnetworkFilter.Add(\"driver\", \"bridge\")\n\tnetworks, err := dockerCli.NetworkList(ctx, dockertypes.NetworkListOptions{Filters: networkFilter})\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tfor _, network := range networks {\n\t\tdockerNet := network.IPAM.Config[0].Subnet\n\t\t_, ipNet, err := net.ParseCIDR(dockerNet)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\tif ipNet.Contains(localAddr.IP) {\n\t\t\tlog.Debugf(\"Running in a container. Bridge network: %s, ip: %s.\t\", dockerNet, localAddr.IP)\n\t\t\tkubeConfigFilePath := filepath.Join(currentDir, defaults.ContainerKubeConfigDir, strings.Join([]string{\"kind-config\", clName}, \"-\"))\n\t\t\treturn kubeConfigFilePath, nil\n\t\t}\n\t}\n\tlog.Debugf(\"Running in a host mode. ip: %s.\", localAddr.IP)\n\tkubeConfigFilePath := filepath.Join(currentDir, defaults.LocalKubeConfigDir, strings.Join([]string{\"kind-config\", clName}, \"-\"))\n\treturn kubeConfigFilePath, nil\n}", "title": "" }, { "docid": "c49baf822e92654cd2fdb6160da1494c", "score": "0.43917075", "text": "func (pre *Prepare) getPath() string {\n\treturn path.Join(pre.SysFolder, pre.Name)\n}", "title": "" }, { "docid": "fb1abdb81624735182bd6a34e560ac59", "score": "0.43824375", "text": "func goPath() string {\n\tgpDefault := build.Default.GOPATH\n\tgps := filepath.SplitList(gpDefault)\n\n\treturn gps[0]\n}", "title": "" }, { "docid": "10e72927da2d01bb0d9cfc9875c0fc0d", "score": "0.43765548", "text": "func gpPath(relPath string) string {\n\tfor _, p := range filepath.SplitList(build.Default.GOPATH) {\n\t\tp = filepath.Join(p, \"src\", relPath)\n\t\tif _, err := os.Stat(p); err == nil {\n\t\t\treturn p\n\t\t}\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "1eee14bb4dd0319168ad2b43c97b3ca2", "score": "0.4370975", "text": "func hostToolPath(m android.Module) android.OptionalPath {\n\tif provider, ok := m.(android.HostToolProvider); ok {\n\t\treturn provider.HostToolPath()\n\t}\n\treturn android.OptionalPath{}\n\n}", "title": "" }, { "docid": "fad27ebe91ba7a9f2b0431ce9832f69d", "score": "0.4368707", "text": "func resolvedPath(p string) string {\n\tif p == \"/\" {\n\t\treturn \"\"\n\t}\n\n\treturn p\n}", "title": "" }, { "docid": "1122d0780fdd1e5175c983d8eb5a3e27", "score": "0.4368428", "text": "func (o DatadogAgentSpecAgentConfigVolumesProjectedSourcesServiceAccountTokenPtrOutput) Path() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *DatadogAgentSpecAgentConfigVolumesProjectedSourcesServiceAccountToken) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Path\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "17887ba54261c3f8b36ede6c51ec8cea", "score": "0.43631837", "text": "func (o *SingleInstallTemplateJobType) GetWorkspaceOk() (*Workspace, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Workspace, true\n}", "title": "" }, { "docid": "6b5bf79af4ab7e1cc75c3d042ce00af7", "score": "0.43612343", "text": "func GetLocalDataStorePath() string {\n\treturn getFilePath(KontrolioDatabaseFilename)\n}", "title": "" }, { "docid": "8834b533f42b4e9b1590836481941ca9", "score": "0.43604642", "text": "func GetFullPath(fromRootPath string) (string, error) {\n\tconst rootF = \"golang-elasticsearch-graphql\"\n\tconst maxSteps = 10\n\n\twd, err := os.Getwd()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tsteps := 0\n\tcurrentRootPath := wd\n\n\tfor steps < maxSteps {\n\t\tstrs := strings.Split(currentRootPath, \"/\")\n\t\tif len(strs) < 2 {\n\t\t\treturn \"\", errors.New(\"unable to locate the root path\")\n\t\t}\n\n\t\tif strs[len(strs)-1] == rootF {\n\t\t\treturn currentRootPath + fromRootPath, nil\n\t\t}\n\n\t\tcurrentRootPath = strings.Join(strs[:len(strs)-1], \"/\")\n\t\tsteps++\n\t}\n\n\treturn \"\", errors.New(\"unable to locate the root path\")\n}", "title": "" }, { "docid": "1a96567d7136da44363c13df92ee3f99", "score": "0.4355953", "text": "func pkgPath(f *ssa.Function) string {\n\tif f.Package() != nil && f.Package().Pkg != nil {\n\t\treturn f.Package().Pkg.Path()\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "6f993aa6a55f9231f523a4038f2ed62b", "score": "0.43547922", "text": "func GetRootPath() string {\n\tprojGOPATH := strings.Split(os.Getenv(\"GOPATH\"), \";\")[0]\n\tif !strings.Contains(projGOPATH, \"go-math-mapper\") {\n\t\texe, _ := os.Executable()\n\t\texeDir := filepath.Dir(exe)\n\t\treturn exeDir\n\t}\n\treturn projGOPATH\n}", "title": "" }, { "docid": "c9b049fcd352315f2b79d5175662b9c8", "score": "0.43539575", "text": "func (o DatadogAgentSpecClusterChecksRunnerConfigVolumesProjectedSourcesServiceAccountTokenOutput) Path() pulumi.StringOutput {\n\treturn o.ApplyT(func(v DatadogAgentSpecClusterChecksRunnerConfigVolumesProjectedSourcesServiceAccountToken) string {\n\t\treturn v.Path\n\t}).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "31459deab9070ff2dbc871c339801c6e", "score": "0.4353031", "text": "func (file File) LocalPath() string {\n\tfileSystem, path := file.ParseRawURI()\n\tif fileSystem != Local {\n\t\treturn \"\"\n\t}\n\treturn fileSystem.JoinCleanPath(path)\n}", "title": "" }, { "docid": "bbf508e135614210e8542e793dc7510a", "score": "0.43508142", "text": "func ResolvePath(path string) string {\n\thomeDirectory, err := os.UserHomeDir()\n\tif err != nil {\n\t\tpanic(exceptions.CheatException(\"Could not find home directory\", err))\n\t}\n\n\tabsPath, err := filepath.Abs(\n\t\tstrings.ReplaceAll(path, \"~\", homeDirectory),\n\t)\n\tif err != nil {\n\t\tpanic(exceptions.CheatException(\"Could not determine path from \\\"\"+path+\"\\\"\", err))\n\t}\n\n\treturn absPath\n}", "title": "" }, { "docid": "671d22707e207e7c73f6c7e578a7ff08", "score": "0.43403578", "text": "func GetLocal(dir, key string) (string, error) {\n\treturn ExecGit(dir, \"config\", \"--get\", \"-z\", \"--local\", key)\n}", "title": "" }, { "docid": "6d3429b9aafa153a53d46a8ab11bbc2f", "score": "0.4338739", "text": "func GetLocal(importPath string, goroot, gopath string, browseURLFmt, lineFmt string) (*Package, error) {\n\tctx := build.Default\n\tif goroot != \"\" {\n\t\tctx.GOROOT = goroot\n\t}\n\tif gopath != \"\" {\n\t\tctx.GOPATH = gopath\n\t}\n\tbpkg, err := ctx.Import(importPath, \".\", build.FindOnly)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdir := filepath.Join(bpkg.SrcRoot, filepath.FromSlash(importPath))\n\tfis, err := ioutil.ReadDir(dir)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar modTime time.Time\n\tvar files []*source\n\tfor _, fi := range fis {\n\t\tif fi.IsDir() || !isDocFile(fi.Name()) {\n\t\t\tcontinue\n\t\t}\n\t\tif fi.ModTime().After(modTime) {\n\t\t\tmodTime = fi.ModTime()\n\t\t}\n\t\tb, err := ioutil.ReadFile(filepath.Join(dir, fi.Name()))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfiles = append(files, &source{\n\t\t\tname: fi.Name(),\n\t\t\tbrowseURL: fmt.Sprintf(browseURLFmt, fi.Name()),\n\t\t\tdata: b,\n\t\t})\n\t}\n\tb := &builder{\n\t\tpdoc: &Package{\n\t\t\tLineFmt: lineFmt,\n\t\t\tImportPath: importPath,\n\t\t\tEtag: strconv.FormatInt(modTime.Unix(), 16),\n\t\t},\n\t}\n\treturn b.build(files)\n}", "title": "" }, { "docid": "a9b4c48ca1ed22d8ebbfc0a33b20d5d3", "score": "0.43380144", "text": "func (m *workspace) Path() string {\n\treturn m.pathField\n}", "title": "" }, { "docid": "bb72eb0492667f7e824101ba9f954e21", "score": "0.433751", "text": "func ResolveOptionPaths(options *BuildOptions) (_ *BuildOptions, err error) {\n\tlocalContext := false\n\tif options.ContextPath != \"\" && options.ContextPath != \"-\" {\n\t\tif !isRemoteURL(options.ContextPath) {\n\t\t\tlocalContext = true\n\t\t\toptions.ContextPath, err = filepath.Abs(options.ContextPath)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t}\n\tif options.DockerfileName != \"\" && options.DockerfileName != \"-\" {\n\t\tif localContext && !urlutil.IsURL(options.DockerfileName) {\n\t\t\toptions.DockerfileName, err = filepath.Abs(options.DockerfileName)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar contexts map[string]string\n\tfor k, v := range options.NamedContexts {\n\t\tif isRemoteURL(v) || strings.HasPrefix(v, \"docker-image://\") {\n\t\t\t// url prefix, this is a remote path\n\t\t} else if strings.HasPrefix(v, \"oci-layout://\") {\n\t\t\t// oci layout prefix, this is a local path\n\t\t\tp := strings.TrimPrefix(v, \"oci-layout://\")\n\t\t\tp, err = filepath.Abs(p)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tv = \"oci-layout://\" + p\n\t\t} else {\n\t\t\t// no prefix, assume local path\n\t\t\tv, err = filepath.Abs(v)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\n\t\tif contexts == nil {\n\t\t\tcontexts = make(map[string]string)\n\t\t}\n\t\tcontexts[k] = v\n\t}\n\toptions.NamedContexts = contexts\n\n\tvar cacheFrom []*CacheOptionsEntry\n\tfor _, co := range options.CacheFrom {\n\t\tswitch co.Type {\n\t\tcase \"local\":\n\t\t\tvar attrs map[string]string\n\t\t\tfor k, v := range co.Attrs {\n\t\t\t\tif attrs == nil {\n\t\t\t\t\tattrs = make(map[string]string)\n\t\t\t\t}\n\t\t\t\tswitch k {\n\t\t\t\tcase \"src\":\n\t\t\t\t\tp := v\n\t\t\t\t\tif p != \"\" {\n\t\t\t\t\t\tp, err = filepath.Abs(p)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\treturn nil, err\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tattrs[k] = p\n\t\t\t\tdefault:\n\t\t\t\t\tattrs[k] = v\n\t\t\t\t}\n\t\t\t}\n\t\t\tco.Attrs = attrs\n\t\t\tcacheFrom = append(cacheFrom, co)\n\t\tdefault:\n\t\t\tcacheFrom = append(cacheFrom, co)\n\t\t}\n\t}\n\toptions.CacheFrom = cacheFrom\n\n\tvar cacheTo []*CacheOptionsEntry\n\tfor _, co := range options.CacheTo {\n\t\tswitch co.Type {\n\t\tcase \"local\":\n\t\t\tvar attrs map[string]string\n\t\t\tfor k, v := range co.Attrs {\n\t\t\t\tif attrs == nil {\n\t\t\t\t\tattrs = make(map[string]string)\n\t\t\t\t}\n\t\t\t\tswitch k {\n\t\t\t\tcase \"dest\":\n\t\t\t\t\tp := v\n\t\t\t\t\tif p != \"\" {\n\t\t\t\t\t\tp, err = filepath.Abs(p)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\treturn nil, err\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tattrs[k] = p\n\t\t\t\tdefault:\n\t\t\t\t\tattrs[k] = v\n\t\t\t\t}\n\t\t\t}\n\t\t\tco.Attrs = attrs\n\t\t\tcacheTo = append(cacheTo, co)\n\t\tdefault:\n\t\t\tcacheTo = append(cacheTo, co)\n\t\t}\n\t}\n\toptions.CacheTo = cacheTo\n\tvar exports []*ExportEntry\n\tfor _, e := range options.Exports {\n\t\tif e.Destination != \"\" && e.Destination != \"-\" {\n\t\t\te.Destination, err = filepath.Abs(e.Destination)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\texports = append(exports, e)\n\t}\n\toptions.Exports = exports\n\n\tvar secrets []*Secret\n\tfor _, s := range options.Secrets {\n\t\tif s.FilePath != \"\" {\n\t\t\ts.FilePath, err = filepath.Abs(s.FilePath)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\tsecrets = append(secrets, s)\n\t}\n\toptions.Secrets = secrets\n\n\tvar ssh []*SSH\n\tfor _, s := range options.SSH {\n\t\tvar ps []string\n\t\tfor _, pt := range s.Paths {\n\t\t\tp := pt\n\t\t\tif p != \"\" {\n\t\t\t\tp, err = filepath.Abs(p)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t}\n\t\t\tps = append(ps, p)\n\n\t\t}\n\t\ts.Paths = ps\n\t\tssh = append(ssh, s)\n\t}\n\toptions.SSH = ssh\n\n\treturn options, nil\n}", "title": "" }, { "docid": "1a7b68dbb4fdf91292d52b036962d41b", "score": "0.4334988", "text": "func (a *AweLocal) GetPath() string { return fmt.Sprintf(\"/api/objects/awe/local/%s\", a.Reference) }", "title": "" }, { "docid": "d8bcf781b9c1a83a25e7dc6d1eacfbe2", "score": "0.43254864", "text": "func WorkDir() (string, error) {\n\twd := os.Getenv(\"FAKE_API\")\n\tif len(wd) > 0 {\n\t\treturn wd, nil\n\t}\n\n\ti := strings.LastIndex(AppPath, \"/\")\n\tif i == -1 {\n\t\treturn AppPath, nil\n\t}\n\treturn AppPath[:i], nil\n}", "title": "" } ]
8a8ec2e7a090d4c57018acdf1d54ecef
SetNeedStripURI sets the need_strip_uri field.
[ { "docid": "26eb0951ce2061495b6d4821a7baa4f3", "score": "0.8288483", "text": "func (hruo *HttpRuleUpdateOne) SetNeedStripURI(i int) *HttpRuleUpdateOne {\n\thruo.mutation.ResetNeedStripURI()\n\thruo.mutation.SetNeedStripURI(i)\n\treturn hruo\n}", "title": "" } ]
[ { "docid": "798ae49b8702bac2af653fbd7821d0f9", "score": "0.8308485", "text": "func (hru *HttpRuleUpdate) SetNeedStripURI(i int) *HttpRuleUpdate {\n\thru.mutation.ResetNeedStripURI()\n\thru.mutation.SetNeedStripURI(i)\n\treturn hru\n}", "title": "" }, { "docid": "3f54aa406a0cabcc39b79124b20f5922", "score": "0.68923795", "text": "func (hruo *HttpRuleUpdateOne) AddNeedStripURI(i int) *HttpRuleUpdateOne {\n\thruo.mutation.AddNeedStripURI(i)\n\treturn hruo\n}", "title": "" }, { "docid": "3371e20fa1c21a248307b6a6ef38b125", "score": "0.67668074", "text": "func (hru *HttpRuleUpdate) AddNeedStripURI(i int) *HttpRuleUpdate {\n\thru.mutation.AddNeedStripURI(i)\n\treturn hru\n}", "title": "" }, { "docid": "7af3b79d8a96e0bfb0d84a0ef88728d4", "score": "0.5200575", "text": "func (conn *Connection) RStrip(rstrip bool) *Connection {\n\tconn.rstrip = rstrip\n\treturn conn\n}", "title": "" }, { "docid": "c8102bff511abcabd9cc30a27082f4d1", "score": "0.5122553", "text": "func (ruo *RestaurantUpdateOne) SetURI(s string) *RestaurantUpdateOne {\n\truo.mutation.SetURI(s)\n\treturn ruo\n}", "title": "" }, { "docid": "0a3e69b1067658b095eb1d4e32ef2de2", "score": "0.50242", "text": "func (ru *RestaurantUpdate) SetURI(s string) *RestaurantUpdate {\n\tru.mutation.SetURI(s)\n\treturn ru\n}", "title": "" }, { "docid": "7fbb91994b95d43da61397ca8f0bc905", "score": "0.5002336", "text": "func (ruo *RestaurantUpdateOne) SetNillableURI(s *string) *RestaurantUpdateOne {\n\tif s != nil {\n\t\truo.SetURI(*s)\n\t}\n\treturn ruo\n}", "title": "" }, { "docid": "d99df3b75174d1d1ed133f06a9840f3c", "score": "0.49316514", "text": "func (ru *RestaurantUpdate) SetNillableURI(s *string) *RestaurantUpdate {\n\tif s != nil {\n\t\tru.SetURI(*s)\n\t}\n\treturn ru\n}", "title": "" }, { "docid": "1328352ae03bbc9866d38aaba275788d", "score": "0.49199027", "text": "func (ctx *RewriteContext) SetURI(b string) {\n\tctx.Request.URL.Path = b\n}", "title": "" }, { "docid": "7fc010e97b663b34f6057b2241c7c54c", "score": "0.4908609", "text": "func stripProtocol(uri string) string {\n\tprotocolParts := strings.Split(uri, \"://\")\n\n\tif len(protocolParts) > 1 {\n\t\treturn protocolParts[1]\n\t}\n\n\treturn uri\n}", "title": "" }, { "docid": "a528baf28f361486291f0b0807ccf643", "score": "0.48616514", "text": "func RemoveURI(container string) string {\n\t_, path := SplitURI(container)\n\treturn path\n}", "title": "" }, { "docid": "668dc0467bfb74b28dbff112f460b98a", "score": "0.47785047", "text": "func (s *Grantee) SetURI(v string) *Grantee {\n\ts.URI = &v\n\treturn s\n}", "title": "" }, { "docid": "838bf0ef0ece4642560cd7b40f58420b", "score": "0.47590524", "text": "func (o EdgeCacheServiceRoutingPathMatcherRouteRuleUrlRedirectOutput) StripQuery() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v EdgeCacheServiceRoutingPathMatcherRouteRuleUrlRedirect) *bool { return v.StripQuery }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "954bf9c63994751d4245f370e4df955a", "score": "0.47482526", "text": "func (a *AppV3) SetURI(uri string) {\n\ta.Spec.URI = uri\n}", "title": "" }, { "docid": "025617624b6c6802d227aca8ac97d693", "score": "0.47327995", "text": "func (o *StorageVirtualDrive) SetStripSize(v string) {\n\to.StripSize = &v\n}", "title": "" }, { "docid": "f11f64c348773d436a3d7324d2b343a8", "score": "0.47153914", "text": "func (ctx *Context) SetURI(b string) {\n\tctx.request.URL.Path = b\n}", "title": "" }, { "docid": "43e07ea85da9c5376c5de4441cedca8a", "score": "0.46914402", "text": "func repairURI(in string) (*url.URL, string) {\n\tconst prefix = fileScheme + \"://\"\n\tif !strings.HasPrefix(in, prefix) {\n\t\t// giving up: resolve to empty path\n\t\tu, _ := parseURL(\"\")\n\n\t\treturn u, \"\"\n\t}\n\n\t// attempt the repair, stripping the scheme should be sufficient\n\tu, _ := parseURL(strings.TrimPrefix(in, prefix))\n\tdebugLog(\"repaired URI: original: %q, repaired: %q\", in, u.String())\n\n\treturn u, u.String()\n}", "title": "" }, { "docid": "471e5824ef45181a5e9b6e3d9a41bb0d", "score": "0.4581148", "text": "func (e *StatusEndpoint) SetEndpointUri(u string) {\n\te.URI = u\n}", "title": "" }, { "docid": "d333b671563f380747b105d58f7eace1", "score": "0.45760563", "text": "func (o EdgeCacheServiceRoutingPathMatcherRouteRuleUrlRedirectPtrOutput) StripQuery() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v *EdgeCacheServiceRoutingPathMatcherRouteRuleUrlRedirect) *bool {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.StripQuery\n\t}).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "1974fa4d3ec42e30af5d95434437a3c5", "score": "0.4511534", "text": "func (obj *FileChooser) SetURI(uri string) bool {\n\treturn obj.Candy().Guify(\"gtk_file_chooser_set_uri\", obj, uri).MustBool()\n}", "title": "" }, { "docid": "26b959a06cb1cf35b014f7b0e9f138bd", "score": "0.4494011", "text": "func (b *BinLoader) Strip(value int) *BinLoader {\n\tb.strip = value\n\treturn b\n}", "title": "" }, { "docid": "67c08f99e18acacdc9de4cdcad3ff4c3", "score": "0.4416998", "text": "func (ru *RestaurantUpdate) ClearURI() *RestaurantUpdate {\n\tru.mutation.ClearURI()\n\treturn ru\n}", "title": "" }, { "docid": "437a92e97f3277ac3830ddd870d39479", "score": "0.44168934", "text": "func (o HttpRouteRuleActionRedirectOutput) StripQuery() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v HttpRouteRuleActionRedirect) *bool { return v.StripQuery }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "81ac958457b190a39aefa1580ffdbf60", "score": "0.43980557", "text": "func (ruo *RestaurantUpdateOne) ClearURI() *RestaurantUpdateOne {\n\truo.mutation.ClearURI()\n\treturn ruo\n}", "title": "" }, { "docid": "705392fc8e29474ea98477d1e480cfee", "score": "0.43465102", "text": "func (ctx *Context) URI() string {\n\tret := strings.Trim(ctx.req.RequestURI, `#/\\ `)\n\tif strings.Contains(ret, \"\\\\\") {\n\t\tret = strings.ReplaceAll(ret, \"\\\\\", \"/\")\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "1a69c39e73efc1a27f428b9772c67072", "score": "0.43061972", "text": "func (mu *MediaUpdate) SetNillableSourceURI(s *string) *MediaUpdate {\n\tif s != nil {\n\t\tmu.SetSourceURI(*s)\n\t}\n\treturn mu\n}", "title": "" }, { "docid": "df6ee0be69a6180758542f94113a7000", "score": "0.42881912", "text": "func (o *Network) SetUri(v string) {\n\to.Uri = &v\n}", "title": "" }, { "docid": "4eacd59b101d2ed741bc04a84264314c", "score": "0.4265181", "text": "func SkipUnlessBackingMongoDBURI(t *testing.T) {\n\t_, err := backingMongoDBURI()\n\tif err == nil {\n\t\treturn\n\t}\n\tskipWithError(t, err)\n}", "title": "" }, { "docid": "72cb24c43dbf1d90790d56a6c5a5a82c", "score": "0.42529458", "text": "func (muo *MediaUpdateOne) SetNillableSourceURI(s *string) *MediaUpdateOne {\n\tif s != nil {\n\t\tmuo.SetSourceURI(*s)\n\t}\n\treturn muo\n}", "title": "" }, { "docid": "e1975a9ba7729224e1d5ba22f3244360", "score": "0.42037612", "text": "func UnbindURI(s string) (WFN, error) {\n\tr := WFN{}\n\tif !strings.HasPrefix(s, cpe22Prefix) {\n\t\treturn r, fmt.Errorf(\"cpe: malformed CPE URI\")\n\t}\n\t// URI form allows parts to be elided, so set all the standard components to\n\t// a default of \"ANY\".\n\tattrs := [...]Attribute{Part, Vendor, Product, Version, Update, Edition, Language}\n\tfor _, a := range attrs {\n\t\tr.Attr[a].Kind = ValueAny\n\t}\n\tvar b strings.Builder\n\t// URI form percent-encodes instead of backslash-escaping, so splitting is\n\t// easier than FS form.\n\tcomp := strings.Split(s, \":\")\n\t// The second component has a slash prefix.\n\tcomp[1] = strings.TrimPrefix(comp[1], \"/\")\n\tfor i, c := range comp[1:] {\n\t\tif i >= len(attrs) {\n\t\t\treturn r, fmt.Errorf(\"cpe: unexpected %dth component\", i)\n\t\t}\n\t\tif i == 5 && strings.HasPrefix(c, \"~\") {\n\t\t\tattrs := [...]Attribute{Edition, SwEdition, TargetSW, TargetHW, Other}\n\t\t\tfor i, c := range strings.SplitN(c, `~`, 6)[1:] {\n\t\t\t\tr.Attr[attrs[i]].unbindURI(&b, c)\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\tr.Attr[attrs[i]].unbindURI(&b, c)\n\t}\n\treturn r, r.Valid()\n}", "title": "" }, { "docid": "a06c86ecf3a428e6a7849fd86e73d1df", "score": "0.419327", "text": "func (o *ParameterContextUpdateRequestDTO) SetUri(v string) {\n\to.Uri = &v\n}", "title": "" }, { "docid": "cd58769a2ea845b7d0dfbb4fbd08a9de", "score": "0.41850257", "text": "func normURI(uri string) string {\n\tparts := strings.Split(uri, \"/\")\n\tfor i := range parts {\n\t\tparts[i] = encodePathFrag(parts[i])\n\t}\n\treturn strings.Join(parts, \"/\")\n}", "title": "" }, { "docid": "14106ca3077064646c7bcd7f73e54567", "score": "0.4183355", "text": "func trimScheme(repo string) string {\n\tschemeSep := \"://\"\n\tschemeSepIdx := strings.Index(repo, schemeSep)\n\tif schemeSepIdx > -1 {\n\t\treturn repo[schemeSepIdx+len(schemeSep):]\n\t}\n\n\treturn repo\n}", "title": "" }, { "docid": "1e6adf5dbf9e9611d0485f8a10fa8254", "score": "0.41790447", "text": "func (checkBox *CheckBox) SetURIAction(uri *string) *CheckBox {\n\tcheckBox.uri = uri\n\treturn checkBox\n}", "title": "" }, { "docid": "86e9ab50d86a109a533da63610723585", "score": "0.4171101", "text": "func (o *StorageVirtualDrive) HasStripSize() bool {\n\tif o != nil && o.StripSize != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "ea0e89dc0673ffe49cf932d807e75872", "score": "0.41587046", "text": "func (o *FlowFileDTO) SetUri(v string) {\n\to.Uri = &v\n}", "title": "" }, { "docid": "e32b4d4f8735bb98225f4b028ae93eb8", "score": "0.41579044", "text": "func IsURI(raw string) bool {\n\t_, err := Parse(raw)\n\treturn err == nil\n}", "title": "" }, { "docid": "4796aea7ec003b378491e860d352039a", "score": "0.41561297", "text": "func StripBasePath(base string) Option {\n\treturn func(a *Adapter) {\n\t\ta.stripBasePath = base\n\t}\n}", "title": "" }, { "docid": "6281edeb1e0cb4e6fe6ad9ea7151b691", "score": "0.415301", "text": "func (o HttpRouteRuleActionRedirectPtrOutput) StripQuery() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v *HttpRouteRuleActionRedirect) *bool {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.StripQuery\n\t}).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "1130ef8fe8ae5e349f565d6d5f6384a8", "score": "0.41359082", "text": "func WithBrokerAddressURI(uri *apis.URL) BrokerOption {\n\treturn func(b *v1.Broker) {\n\t\tb.Status.SetAddress(uri)\n\t}\n}", "title": "" }, { "docid": "3966c32b4a3e04c564b7310da929a119", "score": "0.41177297", "text": "func (t *testClient) AllowRedirectURI(uri string) bool {\n\tif uri != t.redirectURI {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "e9c88df5d2f8bab7631cd337371f4e67", "score": "0.40996024", "text": "func filterUri(uri, maindom string)bool{\n\tif strings.Contains(uri, maindom) && strings.Contains(uri, \"http\"){\n\t\treturn true\n\t}else{\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "4e3276a7ee4badac6bdd99f1c99c38ff", "score": "0.409891", "text": "func WithURI(uri string) ClientOptionFunc {\n\treturn func(c *Client) error {\n\t\t_, err := url.Parse(c.uri)\n\t\tif err != nil {\n\t\t\treturn client.InvalidURIError{URI: uri, Err: err.Error()}\n\t\t}\n\t\tc.uri = uri\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "59e251ed1795e59b52d5bfcf8031017b", "score": "0.40920442", "text": "func stripPort(rawurl string) string {\n\tu, err := url.Parse(rawurl)\n\tif err != nil {\n\t\treturn rawurl\n\t}\n\tu.Host = u.Hostname()\n\treturn u.String()\n}", "title": "" }, { "docid": "a75f0e9983f3c96fd92a1c1b6a570906", "score": "0.40838358", "text": "func (u URL) StringNoFragment() string {\n\tu.URL.Fragment = \"\"\n\treturn u.String()\n}", "title": "" }, { "docid": "e5d7e30b68660dc577653a14f8c5ef3f", "score": "0.40585908", "text": "func (b *SupportCaseResponseBuilder) URI(value string) *SupportCaseResponseBuilder {\n\tb.uri = value\n\tb.bitmap_ |= 8\n\treturn b\n}", "title": "" }, { "docid": "0996ce33176860ee74e7c8e6a6b4dc5c", "score": "0.40530887", "text": "func (s *GetIntegrationOutput) SetUri(v string) *GetIntegrationOutput {\n\ts.Uri = &v\n\treturn s\n}", "title": "" }, { "docid": "1fce453a5e986bacc394a17192e6a739", "score": "0.40395826", "text": "func sanitizeURL(uri *url.URL) *url.URL {\n\tif uri == nil {\n\t\treturn nil\n\t}\n\tparams := uri.Query()\n\tif len(params.Get(\"client_secret\")) > 0 {\n\t\tparams.Set(\"client_secret\", \"REDACTED\")\n\t\turi.RawQuery = params.Encode()\n\t}\n\treturn uri\n}", "title": "" }, { "docid": "1fce453a5e986bacc394a17192e6a739", "score": "0.40395826", "text": "func sanitizeURL(uri *url.URL) *url.URL {\n\tif uri == nil {\n\t\treturn nil\n\t}\n\tparams := uri.Query()\n\tif len(params.Get(\"client_secret\")) > 0 {\n\t\tparams.Set(\"client_secret\", \"REDACTED\")\n\t\turi.RawQuery = params.Encode()\n\t}\n\treturn uri\n}", "title": "" }, { "docid": "8d4dc51d391114a2c5978f00adae347a", "score": "0.40384677", "text": "func (s *GetIntegrationInput) SetUri(v string) *GetIntegrationInput {\n\ts.Uri = &v\n\treturn s\n}", "title": "" }, { "docid": "5ccd053c437b9bd4dbc309197c90b1f5", "score": "0.40315187", "text": "func (muo *MediaUpdateOne) SetSourceURI(s string) *MediaUpdateOne {\n\tmuo.mutation.SetSourceURI(s)\n\treturn muo\n}", "title": "" }, { "docid": "035f6430638d6046ec0af029302b5521", "score": "0.40223363", "text": "func SanitizeEndpoint(endpoint *string) {\n\tif !strings.HasPrefix(*endpoint, \"/\") {\n\t\t*endpoint = fmt.Sprintf(\"/%s\", *endpoint)\n\t}\n\tif !strings.HasPrefix(*endpoint, \"/xapi\") {\n\t\t*endpoint = fmt.Sprintf(\"/xapi%s\", *endpoint)\n\t}\n}", "title": "" }, { "docid": "4dce7634145910e2d16c88fdf8e623fe", "score": "0.39946905", "text": "func (s *DeleteIntegrationInput) SetUri(v string) *DeleteIntegrationInput {\n\ts.Uri = &v\n\treturn s\n}", "title": "" }, { "docid": "72a2a314cde1c0f6ae8cc5e8b83eb2c7", "score": "0.398871", "text": "func (mc *MediaCreate) SetNillableSourceURI(s *string) *MediaCreate {\n\tif s != nil {\n\t\tmc.SetSourceURI(*s)\n\t}\n\treturn mc\n}", "title": "" }, { "docid": "3b760016dcb6ef15cb5aad5f29625c58", "score": "0.39809096", "text": "func IsURIReference(raw string) bool {\n\t_, err := ParseReference(raw)\n\treturn err == nil\n}", "title": "" }, { "docid": "615a44f9e631ba597abce1c836af0fb9", "score": "0.39777672", "text": "func (s *DestinationSummary) SetUri(v string) *DestinationSummary {\n\ts.Uri = &v\n\treturn s\n}", "title": "" }, { "docid": "50c3b71829b039d8ba8e91d4f921c0ed", "score": "0.39749452", "text": "func (d *DirCache) Strip(prefix string) *DirCache {\n\td.strip = prefix\n\treturn d\n}", "title": "" }, { "docid": "99e595801fee5c6c344557187b6a4d97", "score": "0.39747292", "text": "func (mu *MediaUpdate) SetSourceURI(s string) *MediaUpdate {\n\tmu.mutation.SetSourceURI(s)\n\treturn mu\n}", "title": "" }, { "docid": "ce62dd58973b8b1a30fa0e03192cdd28", "score": "0.397185", "text": "func (c *Client) MakeURI(req URIDef) (uri string, err error) {\n\tjd := struct {\n\t\tURI string `json:\"uri\"`\n\t}{}\n\terr = c.Do(\"make_uri\", &req, &jd)\n\tif err != nil {\n\t\treturn\n\t}\n\turi = jd.URI\n\treturn\n}", "title": "" }, { "docid": "08fe1d221bfd9fd1cfa19e08a26ea1d5", "score": "0.39537716", "text": "func (s *CodeHook) SetUri(v string) *CodeHook {\n\ts.Uri = &v\n\treturn s\n}", "title": "" }, { "docid": "08d23d3a9c16345260de70e72b6d6eac", "score": "0.39350244", "text": "func (s *ListAccountIntegrationsInput) SetUri(v string) *ListAccountIntegrationsInput {\n\ts.Uri = &v\n\treturn s\n}", "title": "" }, { "docid": "78dd271ad1d06e0a59f684da3b952bd9", "score": "0.3902048", "text": "func (mu *MediaUpdate) ClearSourceURI() *MediaUpdate {\n\tmu.mutation.ClearSourceURI()\n\treturn mu\n}", "title": "" }, { "docid": "b69a53b96edc47cd724d7ba9afc4df90", "score": "0.39003798", "text": "func (h *Libnbd) SetUriAllowLocalFile (allow bool) error {\n if h.h == nil {\n return closed_handle_error (\"set_uri_allow_local_file\")\n }\n\n var c_err C.struct_error\n c_allow := C.bool (allow)\n\n ret := C._nbd_set_uri_allow_local_file_wrapper (&c_err, h.h, c_allow)\n runtime.KeepAlive (h.h)\n if ret == -1 {\n err := get_error (\"set_uri_allow_local_file\", c_err)\n C.free_error (&c_err)\n return err\n }\n return nil\n}", "title": "" }, { "docid": "80e69636dcf539858c4656e51c0decd2", "score": "0.3889457", "text": "func (o *OBJ) StripPrefixAndSuffix(l []byte, p string) ([]byte, bool) {\n\tswitch {\n\tcase p == \"http\", p == \"https\":\n\t\tif !o.RX[HTTP].Match(l) {\n\t\t\treturn l, false\n\t\t}\n\t\tl = o.RX[HTTP].FindSubmatch(l)[1]\n\n\tcase bytes.HasPrefix(l, []byte(p)):\n\t\tl = bytes.TrimPrefix(l, []byte(p))\n\t}\n\n\tl = o.RX[SUFX].ReplaceAll(l, []byte{})\n\tl = bytes.Replace(l, []byte(`\"`), []byte{}, -1)\n\n\treturn bytes.TrimSpace(l), true\n}", "title": "" }, { "docid": "1398e8619ce5af9f7beb78b10c93f12d", "score": "0.38887396", "text": "func (s *EventStreamDestinationDetails) SetUri(v string) *EventStreamDestinationDetails {\n\ts.Uri = &v\n\treturn s\n}", "title": "" }, { "docid": "6367e32d69dda3265284de17ef66ead7", "score": "0.38864204", "text": "func (o *Network) HasUri() bool {\n\tif o != nil && o.Uri != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "6440eb9d34779ac185befa4a949534a4", "score": "0.38824528", "text": "func (o *StorageVirtualDrive) GetStripSizeOk() (*string, bool) {\n\tif o == nil || o.StripSize == nil {\n\t\treturn nil, false\n\t}\n\treturn o.StripSize, true\n}", "title": "" }, { "docid": "6e2708bfd093b494f7d49283aad4c3a8", "score": "0.3878725", "text": "func (h HTTPRouter) SetRedirectTrailingSlash(enabled bool) {\n\th.router.RedirectTrailingSlash = enabled\n\th.router.RedirectBehavior = httptreemux.Redirect307\n}", "title": "" }, { "docid": "56a282ed5a7d6d0d232b29cb4c4ba656", "score": "0.38756633", "text": "func (muo *MediaUpdateOne) ClearSourceURI() *MediaUpdateOne {\n\tmuo.mutation.ClearSourceURI()\n\treturn muo\n}", "title": "" }, { "docid": "042683e4a2c6c541256c542d8989d6bb", "score": "0.38681194", "text": "func CleanAndCheckForQuery(address url.URL) (url.URL, bool, error) {\n\taddress.Fragment = \"\"\n\tquery := false\n\tif address.RawQuery != \"\" {\n\t\tquery = true\n\t\taddress.RawQuery = \"\"\n\t}\n\tcleanedURL, err := url.Parse(address.String())\n\tif err != nil { // badly constructed url.URL\n\t\treturn *cleanedURL, false, err\n\t}\n\treturn *cleanedURL, query, nil\n}", "title": "" }, { "docid": "ba9802b08acf924bbae96b4cf25e14f1", "score": "0.38577554", "text": "func (r *Attributes) URI() string {\n\tif x, found := (*r)[\"uri\"]; found {\n\t\treturn x.(string)\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "ba9802b08acf924bbae96b4cf25e14f1", "score": "0.38577554", "text": "func (r *Attributes) URI() string {\n\tif x, found := (*r)[\"uri\"]; found {\n\t\treturn x.(string)\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "95774ed6a90c82fe86c3466db0909149", "score": "0.38505322", "text": "func BuildStripped() error {\n\tmg.Deps(Deps)\n\tfmt.Println(\"Building stripped version...\")\n\n\tgitCommit, err := getGitCommit()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn sh.Run(\"go\", \"build\", \"-ldflags\", \"-s -w -X main.GitCommit=\"+gitCommit, \".\")\n}", "title": "" }, { "docid": "d33261dc81278d5d29af9356dca2a49c", "score": "0.3849504", "text": "func StripModulePrefixesStr(in string) string {\n\treturn strings.Join(stripModulePrefixes(strings.Split(in, \"/\")), \"/\")\n}", "title": "" }, { "docid": "2093df182b9ea1e9662cda9bbcff24bb", "score": "0.38390204", "text": "func (s *CreateEventStreamInput) SetUri(v string) *CreateEventStreamInput {\n\ts.Uri = &v\n\treturn s\n}", "title": "" }, { "docid": "63339ef1e4ba1270bfb4ce892f71fe1d", "score": "0.3815846", "text": "func (mc *MediaCreate) SetSourceURI(s string) *MediaCreate {\n\tmc.mutation.SetSourceURI(s)\n\treturn mc\n}", "title": "" }, { "docid": "8feaaf06b85d6dd30fc701305ff82fde", "score": "0.3803616", "text": "func (r *Rule) SnortURILenFix() bool {\n\tvar modified bool\n\t// Update this once we parse urilen in a better structure.\n\tfor _, l := range r.LenMatchers() {\n\t\tif l.Kind == uriLen && l.Operator == \"<>\" {\n\t\t\tl.Min--\n\t\t\tl.Max++\n\t\t\tmodified = true\n\t\t}\n\t\tsetRaw := true\n\t\tfor _, o := range l.Options {\n\t\t\tif o == \"norm\" || o == \"raw\" {\n\t\t\t\t// If Snort rule specified norm or raw, trust author.\n\t\t\t\tsetRaw = false\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\t// If author did not specify, set 'raw'.\n\t\tif setRaw {\n\t\t\tmodified = true\n\t\t\tl.Options = append(l.Options, \"raw\")\n\t\t}\n\t}\n\tif modified {\n\t\tr.Metas = append(r.Metas, MetadataModifier(\"snort_urilen\"))\n\t}\n\treturn modified\n}", "title": "" }, { "docid": "e465b0f6d21c14e208ca63bd03801501", "score": "0.3800319", "text": "func (aruo *AuthRequestUpdateOne) SetRedirectURI(s string) *AuthRequestUpdateOne {\n\taruo.mutation.SetRedirectURI(s)\n\treturn aruo\n}", "title": "" }, { "docid": "f0cd5e44d58a0cfddff5fa99216599cf", "score": "0.3797061", "text": "func (c *Client) fixURL() {\n\tc.URL = strings.TrimRight(c.URL, \"/\")\n}", "title": "" }, { "docid": "dcbf71731ef7db3f51741eed1234b87a", "score": "0.3781551", "text": "func (e *StatusEndpoint) GetEndpointUri() string {\n\treturn e.URI\n}", "title": "" }, { "docid": "9de0dd150a1405b7826c80f781c46887", "score": "0.37808594", "text": "func BackingMongoDBURI(t *testing.T) string {\n\tmongoURI, err := backingMongoDBURI()\n\tif err != nil {\n\t\tskipWithError(t, err)\n\t\treturn \"\"\n\t}\n\treturn mongoURI\n}", "title": "" }, { "docid": "08a98afb3d9de27b8374936baf04905a", "score": "0.377631", "text": "func replaceRequestURIWithActualURL(str *string, uri, url string) {\n\tif uri == \"\" {\n\t\turi = \"/\"\n\t}\n\t*str = strings.Replace(*str, uri, url, 1)\n}", "title": "" }, { "docid": "31c85d9fa670bedffad901b89713e9df", "score": "0.37638223", "text": "func WithURIString(value string) zap.Field {\n\treturn zap.String(FieldURI, value)\n}", "title": "" }, { "docid": "93aa6297a439cb31e844cb4434801299", "score": "0.37636477", "text": "func TrimHTTPScheme(url string) string {\n\turl = strings.TrimPrefix(url, SCHEME_HTTP_PREFIX)\n\turl = strings.TrimPrefix(url, SCHEME_HTTPS_PREFIX)\n\treturn url\n}", "title": "" }, { "docid": "e4f9aea5d4bd7ea71b9bb9cb04cce481", "score": "0.3760084", "text": "func (_NFT1155 *NFT1155Filterer) FilterURI(opts *bind.FilterOpts, id []*big.Int) (*NFT1155URIIterator, error) {\n\n\tvar idRule []interface{}\n\tfor _, idItem := range id {\n\t\tidRule = append(idRule, idItem)\n\t}\n\n\tlogs, sub, err := _NFT1155.contract.FilterLogs(opts, \"URI\", idRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &NFT1155URIIterator{contract: _NFT1155.contract, event: \"URI\", logs: logs, sub: sub}, nil\n}", "title": "" }, { "docid": "bbb946f83cc90028db53c845a4e7e865", "score": "0.37590906", "text": "func (s *ListIntegrationItem) SetUri(v string) *ListIntegrationItem {\n\ts.Uri = &v\n\treturn s\n}", "title": "" }, { "docid": "d61a3b25237e3a54ab3ec14a5ac421dc", "score": "0.3758065", "text": "func (s *PutIntegrationOutput) SetUri(v string) *PutIntegrationOutput {\n\ts.Uri = &v\n\treturn s\n}", "title": "" }, { "docid": "9c0a8454235a8f876892defe2b8f36e3", "score": "0.37523636", "text": "func setRawPath(u *url.URL) error {\n\toldPath := u.Path\n\tpath, err := url.PathUnescape(u.Path)\n\tif err != nil {\n\t\treturn err\n\t}\n\tu.Path = path\n\tif escp := u.EscapedPath(); oldPath == escp {\n\t\t// Default encoding is fine.\n\t\tu.RawPath = \"\"\n\t} else {\n\t\tu.RawPath = oldPath\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a7b163612dd45c1b34aefb09da822f73", "score": "0.37520814", "text": "func stripParam(param, endpoint string) string {\n\tlogger := log.NewLogEntry()\n\n\tu, err := url.Parse(endpoint)\n\tif err != nil {\n\t\tlogger.WithURLParam(param).Error(err, \"error attempting to strip parameter\")\n\t\treturn endpoint\n\t}\n\n\tif u.RawQuery != \"\" {\n\t\tvalues, err := url.ParseQuery(u.RawQuery)\n\t\tif err != nil {\n\t\t\tlogger.WithURLParam(param).Error(\"error attempting to strip parameter\")\n\t\t\treturn u.String()\n\t\t}\n\n\t\tif val := values.Get(param); val != \"\" {\n\t\t\tvalues.Set(param, val[:(len(val)/2)]+\"...\")\n\t\t\tu.RawQuery = values.Encode()\n\t\t\treturn u.String()\n\t\t}\n\t}\n\n\treturn endpoint\n}", "title": "" }, { "docid": "62d44d06ff4ae5503683cc366cbeb8a0", "score": "0.3730139", "text": "func (m *GithubGistMutation) SetRawURL(s string) {\n\tm.raw_url = &s\n}", "title": "" }, { "docid": "61f3b479bac0f87a123b12c778afe4d2", "score": "0.37215334", "text": "func (o *PutProjectProjectNameResourceResourceURIParams) bindDisableUpstreamSync(rawData []string, hasKey bool, formats strfmt.Registry) error {\n\tvar raw string\n\tif len(rawData) > 0 {\n\t\traw = rawData[len(rawData)-1]\n\t}\n\n\t// Required: false\n\t// AllowEmptyValue: false\n\tif raw == \"\" { // empty values pass all other validations\n\t\t// Default values have been previously initialized by NewPutProjectProjectNameResourceResourceURIParams()\n\t\treturn nil\n\t}\n\n\tvalue, err := swag.ConvertBool(raw)\n\tif err != nil {\n\t\treturn errors.InvalidType(\"disableUpstreamSync\", \"query\", \"bool\", raw)\n\t}\n\to.DisableUpstreamSync = &value\n\n\treturn nil\n}", "title": "" }, { "docid": "c832c8069c39b8be390865840806342c", "score": "0.3715895", "text": "func (s *PutIntegrationInput) SetUri(v string) *PutIntegrationInput {\n\ts.Uri = &v\n\treturn s\n}", "title": "" }, { "docid": "de1a936d90000995863b192624a2f2ef", "score": "0.3710772", "text": "func (c *Client) uri(endpoint string) string {\n\tvar builder strings.Builder\n\n\tbuilder.WriteString(\"https://\")\n\tbuilder.WriteString(c.Host)\n\tbuilder.WriteString(estPathPrefix)\n\n\tif c.AdditionalPathSegment != \"\" {\n\t\tbuilder.WriteRune('/')\n\t\tbuilder.WriteString(c.AdditionalPathSegment)\n\t}\n\n\tbuilder.WriteString(endpoint)\n\n\treturn builder.String()\n}", "title": "" }, { "docid": "92022ee57c9772796c55568e67bd760a", "score": "0.37028462", "text": "func (o *StorageVirtualDrive) GetStripSize() string {\n\tif o == nil || o.StripSize == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.StripSize\n}", "title": "" }, { "docid": "3cb501605a36a496fdff38aef69e40f9", "score": "0.36979592", "text": "func (o *FlowFileDTO) HasUri() bool {\n\tif o != nil && o.Uri != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "d598c1ac9ecd7f259a51ab7ea3e13cad", "score": "0.36948007", "text": "func (c *Client) SetEndpointURL(urlStr string) error {\n\tif urlStr == \"\" {\n\t\treturn ErrDICOMURLCannotBeEmpty\n\t}\n\t// Make sure the given URL end with a slash\n\tif !strings.HasSuffix(urlStr, \"/\") {\n\t\turlStr += \"/\"\n\t}\n\tvar err error\n\tc.dicomStoreURL, err = url.Parse(urlStr)\n\tif err != nil {\n\t\treturn err\n\t}\n\tparts := strings.Split(c.dicomStoreURL.Path, \"/\")\n\tif len(parts) == 0 {\n\t\treturn ErrDICOMURLCannotBeEmpty\n\t}\n\tc.config.OrganizationID = parts[len(parts)-1]\n\tnewParts := parts[:len(parts)-1]\n\tc.dicomStoreURL.Path = strings.Join(newParts, \"/\")\n\treturn nil\n}", "title": "" }, { "docid": "c6906420d6e9caf4559c6113741b304d", "score": "0.36909828", "text": "func (_StarNFT *StarNFTCaller) GetURI(opts *bind.CallOpts, id *big.Int) (string, error) {\n\tvar (\n\t\tret0 = new(string)\n\t)\n\tout := ret0\n\terr := _StarNFT.contract.Call(opts, out, \"getURI\", id)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "55b3634d4d1a3357ed6e2c1dd219df98", "score": "0.36882383", "text": "func (db *DB) URI() string {\n\tu := span.URIFromPath(db.disk)\n\treturn string(u)\n}", "title": "" }, { "docid": "6586a17db51e12cb08523a736707a7db", "score": "0.36851588", "text": "func (s *QStr) Stripped() string {\n\treturn allColors.ReplaceAllString(string(*s), \"\")\n}", "title": "" }, { "docid": "537adf6dd3114b747ddb9fcd40944ae4", "score": "0.3682586", "text": "func (o *PipelineCacheContentUri) SetUri(v string) {\n\to.Uri = &v\n}", "title": "" } ]
bb1baf7b1e57a87f4ef8e303072f02e9
getMailingListID make API call to to get the 'id' of the given mailing list
[ { "docid": "a0f6ba5c5b2b202882965b93e74d46f5", "score": "0.80505717", "text": "func getMailingListID(mailingListName string) string {\n\ttoken := viper.GetString(\"X-API-TOKEN\")\n\tdc := viper.GetString(\"DATACENTER\")\n\tr := rest.New(token, dc)\n\tpath := \"mailinglists?offset=0\"\n\tallMailingLists := r.Get(path)\n\n\t// validate JSON returned from API\n\tif json.Valid([]byte(allMailingLists)) != true {\n\t\tlog.Fatalf(\"Error #45873: Invalid JSON returned from API:\\n%s\\n\", allMailingLists)\n\t}\n\n\tresult, _, _, err := jsonparser.Get([]byte(allMailingLists), \"result\")\n\tif err != nil {\n\t\tlog.Fatalf(\"Error #46237: parsing JSON for key='result'\\n%s\\n\", result)\n\t}\n\n\t// iterate through all mailing list entries and search for 'mailingListName'\n\thasList := false\n\tvar name, id string\n\t_, err = jsonparser.ArrayEach(result, func(value []byte, dataType jsonparser.ValueType, offset int, err error) {\n\t\tname, err = jsonparser.GetString(value, \"name\")\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"Error #46885: parsing JSON for key='name'\\n%s\\n\", value)\n\t\t}\n\t\tif name == mailingListName { // mailing list is found, get its 'id'\n\t\t\thasList = true\n\t\t\tid, err = jsonparser.GetString(value, \"id\")\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatalf(\"Error #46005: parsing JSON for key='id'\\n%s\\n\", value)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t}, \"elements\")\n\tif err != nil {\n\t\tlog.Fatalf(\"Error #38932: %s\", err)\n\t}\n\n\tif hasList == false {\n\t\tlog.Printf(\"Warning #46376: mailing list does not exist: %s\\n\", mailingListName)\n\t\treturn \"\"\n\t}\n\treturn id\n}", "title": "" } ]
[ { "docid": "2133721157192837a62dc7a64cd7d749", "score": "0.6955059", "text": "func (r *SendEmailRequest) ListID(listID int64) *SendEmailRequest {\n\tr.request.Add(\"list_id\", strconv.FormatInt(listID, 10))\n\treturn r\n}", "title": "" }, { "docid": "3ab408d70899f9e03743b3474b9e5928", "score": "0.6852075", "text": "func (m Message) GetListID(f *field.ListIDField) quickfix.MessageRejectError {\n\treturn m.Body.Get(f)\n}", "title": "" }, { "docid": "3ab408d70899f9e03743b3474b9e5928", "score": "0.6852075", "text": "func (m Message) GetListID(f *field.ListIDField) quickfix.MessageRejectError {\n\treturn m.Body.Get(f)\n}", "title": "" }, { "docid": "3ab408d70899f9e03743b3474b9e5928", "score": "0.6852075", "text": "func (m Message) GetListID(f *field.ListIDField) quickfix.MessageRejectError {\n\treturn m.Body.Get(f)\n}", "title": "" }, { "docid": "ca2cc88277bf9e2dfb24c8f6159931b0", "score": "0.6567799", "text": "func (repository *Repository) GetMailingList(id int64) (*MailingList, error) {\n\trow := repository.Conn.QueryRow(\"SELECT m.id, m.name, m.description FROM mailing_list m \"+\n\t\t\"WHERE m.id=(?)\", id)\n\tvar name, description string\n\tswitch err := row.Scan(&id, &name, &description); err {\n\tcase sql.ErrNoRows:\n\t\treturn nil, nil\n\tcase nil:\n\t\tmailingList := MailingList{\n\t\t\tID: id,\n\t\t\tName: name,\n\t\t\tDescription: description,\n\t\t}\n\t\treturn &mailingList, nil\n\tdefault:\n\t\treturn nil, err\n\t}\n}", "title": "" }, { "docid": "8f2cd5253ae7617de17d40ff6650bec7", "score": "0.63583076", "text": "func (msg *Message) ListID() string {\n\treturn msg.ExtraHeader.Get(\"List-Id\")\n}", "title": "" }, { "docid": "5a5ec16c6e8e326c9020a724e4375be4", "score": "0.63515705", "text": "func (m OrderCancelRequest) GetListID() (v string, err quickfix.MessageRejectError) {\n\tvar f field.ListIDField\n\tif err = m.Get(&f); err == nil {\n\t\tv = f.Value()\n\t}\n\treturn\n}", "title": "" }, { "docid": "3efca6a287f9569e591cefdd46b84bf6", "score": "0.61520857", "text": "func (m Message) ListID() (*field.ListIDField, quickfix.MessageRejectError) {\n\tf := &field.ListIDField{}\n\terr := m.Body.Get(f)\n\treturn f, err\n}", "title": "" }, { "docid": "3efca6a287f9569e591cefdd46b84bf6", "score": "0.61520857", "text": "func (m Message) ListID() (*field.ListIDField, quickfix.MessageRejectError) {\n\tf := &field.ListIDField{}\n\terr := m.Body.Get(f)\n\treturn f, err\n}", "title": "" }, { "docid": "3efca6a287f9569e591cefdd46b84bf6", "score": "0.61520857", "text": "func (m Message) ListID() (*field.ListIDField, quickfix.MessageRejectError) {\n\tf := &field.ListIDField{}\n\terr := m.Body.Get(f)\n\treturn f, err\n}", "title": "" }, { "docid": "fb6a44211873efb23f08f00566a61aa6", "score": "0.61187494", "text": "func (m ExecutionReport) GetListID() (v string, err quickfix.MessageRejectError) {\n\tvar f field.ListIDField\n\tif err = m.Get(&f); err == nil {\n\t\tv = f.Value()\n\t}\n\treturn\n}", "title": "" }, { "docid": "ae010d2a3f523d6c3b72ccdd26eff4e5", "score": "0.60748863", "text": "func (b *NewsfeedSaveListBuilder) ListID(v int) *NewsfeedSaveListBuilder {\n\tb.Params[\"list_id\"] = v\n\treturn b\n}", "title": "" }, { "docid": "a8517c27d6bd04c5e00ec3941d919444", "score": "0.5940124", "text": "func getListID(tx *sql.Tx, listName string) (int64, error) {\n\n\tvar id int64\n\terr := tx.QueryRow(\"SELECT id FROM lists WHERE name = $1\", listName).Scan(&id)\n\tswitch {\n\tcase err == sql.ErrNoRows:\n\t\t// Not an error, the list will be inserted\n\t\treturn id, nil\n\tcase err != nil:\n\t\treturn 0, fmt.Errorf(\"getListID: %s\", err.Error())\n\t}\n\n\treturn id, nil\n}", "title": "" }, { "docid": "3c5800dc1a39e90d34db52f2f0a201b9", "score": "0.5858587", "text": "func (a List) GetID() string {\n\treturn a.ID\n}", "title": "" }, { "docid": "7e8c3d7efd7143d5c6594dcf05ce0462", "score": "0.5782578", "text": "func (lists *Lists) GetByID(listGUID string) *List {\n\tlist := NewList(\n\t\tlists.client,\n\t\tfmt.Sprintf(\"%s('%s')\", lists.endpoint, listGUID),\n\t\tlists.config,\n\t)\n\treturn list\n}", "title": "" }, { "docid": "e208b93679ea67b86685929dbb064d70", "score": "0.5740766", "text": "func (service *ValidatorService) ValidateMailingList(ctx context.Context, mailingListID int) error {\n\tpath := \"/verifier-service/send-list-to-verify/\"\n\tvar response struct {\n\t\tResult bool `json:\"result\"`\n\t}\n\ttype bodyFormat struct {\n\t\tID int `json:\"id\"`\n\t}\n\tbody := bodyFormat{ID: mailingListID}\n\t_, err := service.client.newRequest(ctx, http.MethodPost, path, body, &response, true)\n\treturn err\n}", "title": "" }, { "docid": "ca72b1d2edaaf0a02cc73f4fddd3192b", "score": "0.5553402", "text": "func (service *ValidatorService) GetMailingListValidationResult(ctx context.Context, mailingListID int) (*MailingListValidationResultDetailed, error) {\n\tpath := fmt.Sprintf(\"/verifier-service/check/?id=%d\", mailingListID)\n\tvar response *MailingListValidationResultDetailed\n\t_, err := service.client.newRequest(ctx, http.MethodGet, path, nil, &response, true)\n\treturn response, err\n}", "title": "" }, { "docid": "451613ed05373fe69f1e89cd0cc2418a", "score": "0.5543858", "text": "func (r *TasklistsService) Get(tasklistid string) *TasklistsGetCall {\n\treturn &TasklistsGetCall{\n\t\ts: r.s,\n\t\ttasklistid: tasklistid,\n\t\tcaller_: googleapi.JSONCall{},\n\t\tparams_: make(map[string][]string),\n\t\tpathTemplate_: \"users/@me/lists/{tasklist}\",\n\t\tcontext_: googleapi.NoContext,\n\t}\n}", "title": "" }, { "docid": "14606065a39c52f5eb31dc2d0f1ed867", "score": "0.52889293", "text": "func (r *TasklistsService) Get(tasklistid string) *TasklistsGetCall {\n\tc := &TasklistsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.tasklistid = tasklistid\n\treturn c\n}", "title": "" }, { "docid": "c7fab82ea684329dc8e3c9f958713a8a", "score": "0.52689666", "text": "func (c *Client) FindMailMassMailingListId(criteria *Criteria, options *Options) (int64, error) {\n\tids, err := c.Search(MailMassMailingListModel, criteria, options)\n\tif err != nil {\n\t\treturn -1, err\n\t}\n\tif len(ids) > 0 {\n\t\treturn ids[0], nil\n\t}\n\treturn -1, fmt.Errorf(\"mail.mass_mailing.list was not found with criteria %v and options %v\", criteria, options)\n}", "title": "" }, { "docid": "3887316eb93fe2c30b3c46bb64b912f5", "score": "0.5263087", "text": "func (d *DisplayConsole) ListID(listID string) string {\n\tyellow := color.New(color.FgYellow).SprintFunc()\n\treturn yellow(listID)\n}", "title": "" }, { "docid": "3e3066bb547b60750487c6386ebe8196", "score": "0.5167766", "text": "func ListToListID(lists ...*List) []ListID {\n\tres := make([]ListID, 0, len(lists))\n\tfor _, list := range lists {\n\t\tif list != nil {\n\t\t\tres = append(res, list.ID)\n\t\t\tcontinue\n\t\t}\n\t\tres = append(res, \"<nil>\")\n\t}\n\treturn res\n}", "title": "" }, { "docid": "d8b4b0e97a05cc833d3537a669f58a89", "score": "0.5166432", "text": "func (m *MySQL) GetListByID(id int) (todo.List, error) {\n\trows, err := m.db.Queryx(\"SELECT list.id, list.name, COALESCE (item.id, 0), COALESCE (item.name, ''), COALESCE (item.done, false) FROM list LEFT JOIN item ON (item.list_id = list.id) WHERE list.id = ?\", id)\n\tif err != nil {\n\t\treturn todo.List{}, err\n\t}\n\tlists, err := sqlxRowsToTodoLists(*rows)\n\tif err != nil {\n\t\treturn todo.List{}, err\n\t}\n\tif len(lists) == 0 {\n\t\treturn todo.List{}, domainerrors.NewNotFoundError(fmt.Sprintf(\"list with id %v\", id), errors.New(\"list not found\"))\n\t}\n\treturn lists[0], err\n\n}", "title": "" }, { "docid": "534f8d58128717bbdf8f31ff873eb0c9", "score": "0.51650965", "text": "func (service *ValidatorService) GetMailingListValidationReport(ctx context.Context, mailingListID int) (*MailingListValidationResultDetailed, error) {\n\tpath := fmt.Sprintf(\"/verifier-service/check-report?id=%d\", mailingListID)\n\tvar response *MailingListValidationResultDetailed\n\t_, err := service.client.newRequest(ctx, http.MethodGet, path, nil, &response, true)\n\treturn response, err\n}", "title": "" }, { "docid": "54b6fcfa758cfa6e4da92a8ce7fade43", "score": "0.5118201", "text": "func BuildRecipientList(ipfs ipfs.Connector, localNodeDocCID, remoteNodeDocCID string) (map[string]documents.IDDoc, error) {\n\tremoteNodeDoc, err := RetrieveIDDocFromIPFS(ipfs, remoteNodeDocCID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalNodeDoc, err := RetrieveIDDocFromIPFS(ipfs, localNodeDocCID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\trecipients := map[string]documents.IDDoc{\n\t\tremoteNodeDocCID: remoteNodeDoc,\n\t\tlocalNodeDocCID: localNodeDoc,\n\t}\n\treturn recipients, nil\n}", "title": "" }, { "docid": "7646faf9ae8eeb42f629ef4bed79688c", "score": "0.5116637", "text": "func (m OrderCancelRequest) SetListID(v string) {\n\tm.Set(field.NewListID(v))\n}", "title": "" }, { "docid": "8a27cf8d52e90d093122baa79214333e", "score": "0.51159877", "text": "func BuildRecipientList(ipfs ipfs.Connector, localNodeDocCID, remoteNodeDocCID string) (map[string]*documents.IDDoc, error) {\n\tremoteNodeDoc, err := RetrieveIDDocFromIPFS(ipfs, remoteNodeDocCID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalNodeDoc, err := RetrieveIDDocFromIPFS(ipfs, localNodeDocCID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\trecipients := map[string]*documents.IDDoc{\n\t\tremoteNodeDocCID: remoteNodeDoc,\n\t\tlocalNodeDocCID: localNodeDoc,\n\t}\n\treturn recipients, nil\n}", "title": "" }, { "docid": "178af436f266ae147498e915daa166a2", "score": "0.50861204", "text": "func (rem *Reminders) GetId(w rest.ResponseWriter, r *rest.Request) {\n\trem.stats.AddHit(r.RequestURI)\n\n\tid, err := idFromString(r.PathParam(\"id\"))\n\tif err != nil {\n\t\trest.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\treminder, err := rem.s.GetID(id)\n\tif err != nil {\n\t\trest.NotFound(w, r)\n\t\treturn\n\t}\n\n\tw.WriteJson(&reminder)\n}", "title": "" }, { "docid": "bf5a49ff19c436b28def450423698b02", "score": "0.5080377", "text": "func (t *GormSuite) ListItemGetByID(ctx context.Context, id int) (*model.ListItem, error) {\n\n\tvar listItem model.ListItem\n\tif err := t.tr.Table(\"list_item\").Where(\"id = ?\", id).Take(&listItem).Error; err != nil {\n\t\tfmt.Println(err)\n\t\treturn nil, err\n\t}\n\n\treturn &listItem, nil\n}", "title": "" }, { "docid": "cec434569dfa4ac6f7b493831e34cd32", "score": "0.505845", "text": "func (d *DashboardList) GetId() int {\n\tif d == nil || d.Id == nil {\n\t\treturn 0\n\t}\n\treturn *d.Id\n}", "title": "" }, { "docid": "d58590d3a3452011749d38c34d432aaf", "score": "0.50420755", "text": "func (o *ServiceAccountListItemAllOf) GetId() string {\n\tif o == nil || o.Id == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Id\n}", "title": "" }, { "docid": "a218e498bd2fd86792b1e85963c7ec08", "score": "0.50264597", "text": "func NewRecipientId_List(s *capnp.Segment, sz int32) (RecipientId_List, error) {\n\tl, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 0}, sz)\n\treturn RecipientId_List{l}, err\n}", "title": "" }, { "docid": "36bc6d32890baa80b5b9ed421266da98", "score": "0.5019964", "text": "func (dom *Domain) MailingList(name string) *MailingList {\n\treturn &MailingList{Domain: dom, Name: name}\n}", "title": "" }, { "docid": "1f1634843876b3d6b560758e44ceb94b", "score": "0.50108546", "text": "func (c *Client) FindMailMassMailingListIds(criteria *Criteria, options *Options) ([]int64, error) {\n\tids, err := c.Search(MailMassMailingListModel, criteria, options)\n\tif err != nil {\n\t\treturn []int64{}, err\n\t}\n\treturn ids, nil\n}", "title": "" }, { "docid": "f299e2acd9b4eb62067024537f17f260", "score": "0.49748287", "text": "func (o *InlineResponse20095Tasklists) GetId() string {\n\tif o == nil || o.Id == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Id\n}", "title": "" }, { "docid": "d97436c18eca1c323dab6f086a5712ef", "score": "0.48618197", "text": "func (m *ChatMessageAttachment) GetId()(*string) {\n return m.id\n}", "title": "" }, { "docid": "4f63eba689c13d96aa9951134eb9ac8c", "score": "0.48394838", "text": "func (b *ListItemsCollectionRequestBuilder) ID(id string) *ListItemRequestBuilder {\n\tbb := &ListItemRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}\n\tbb.baseURL += \"/\" + id\n\treturn bb\n}", "title": "" }, { "docid": "cb731d07658b63871ca4ebf006a5e89c", "score": "0.48313433", "text": "func List(networkID string) (*protos.IDList, error) {\n\tclient, err := getCheckindClient()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn client.List(context.Background(), &protos.NetworkID{Id: networkID})\n}", "title": "" }, { "docid": "a9ae6a378baa4faf55328c0ccd0c90a5", "score": "0.48126787", "text": "func (d *DashboardListItem) GetId() int {\n\tif d == nil || d.Id == nil {\n\t\treturn 0\n\t}\n\treturn *d.Id\n}", "title": "" }, { "docid": "603cad32d33ae280d2dba22d4aec022a", "score": "0.4799867", "text": "func (c *Client) GetMailMassMailingList(id int64) (*MailMassMailingList, error) {\n\tmmls, err := c.GetMailMassMailingLists([]int64{id})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif mmls != nil && len(*mmls) > 0 {\n\t\treturn &((*mmls)[0]), nil\n\t}\n\treturn nil, fmt.Errorf(\"id %v of mail.mass_mailing.list not found\", id)\n}", "title": "" }, { "docid": "041c3c04e62c582ab40161947a56da16", "score": "0.47855008", "text": "func latestListID(tx *sql.Tx) (int64, string, time.Time, error) {\n\n\tvar id int64\n\tvar name string\n\tvar t time.Time\n\terr := tx.QueryRow(\"SELECT id, name, ts FROM lists ORDER BY ts DESC LIMIT 1\").Scan(&id, &name, &t)\n\tif err != nil {\n\t\treturn 0, \"\", time.Time{}, err\n\t}\n\n\treturn id, name, t, nil\n}", "title": "" }, { "docid": "5426996796aeb8630c0af76373b01a0d", "score": "0.4784121", "text": "func GetID(api *slack.Slack, r horenso.Report, channelName string, groupName string) string {\n\tif len(channelName) > 0 {\n\t\treturn GetChannelID(api, r, channelName)\n\t} else if len(groupName) > 0 {\n\t\treturn GetGroupID(api, r, groupName)\n\t}\n\n\tpanic(\"Could not resolve ID.\")\n}", "title": "" }, { "docid": "98fa34c3bfd1f982b6fd6cf1fb3244e4", "score": "0.47626182", "text": "func (m ExecutionReport) SetListID(v string) {\n\tm.Set(field.NewListID(v))\n}", "title": "" }, { "docid": "014e885f700b3125a098970ad3ac289e", "score": "0.4757107", "text": "func (m Message) GetApplID(f *field.ApplIDField) quickfix.MessageRejectError {\n\treturn m.Body.Get(f)\n}", "title": "" }, { "docid": "dca92e1da03e441376fd48b440cc4680", "score": "0.47406968", "text": "func (self *PushRequest) GetId(idx int) uint32 {\n\tif idx < 0 || idx >= len(self.Devtokens) {\n\t\treturn 0\n\t}\n\tstartId := self.MaxMsgId - uint32(len(self.Devtokens))\n\treturn startId + uint32(idx)\n}", "title": "" }, { "docid": "5fc07dd232a1e50db35317d28161fc16", "score": "0.47339386", "text": "func lookupList(listKey string) *config.List {\n\tfor _, list := range gConfig.Lists {\n\t\tif listKey == list.Id || listKey == list.Address {\n\t\t\treturn list\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f4cad0d22c0995aea66439a5581e6e99", "score": "0.47266114", "text": "func (m *Mail) getSocialIdFromEmail() (int64, error) {\n\n\tacc, err := GetAccount(m.From)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\taccountId, err := acc.GetSocialApiId()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn accountId, nil\n}", "title": "" }, { "docid": "ee020cb5ad423b3242a8705969242ba2", "score": "0.47085628", "text": "func GetMemberList(id string) (string, error) {\n\tvar dbListMember sql.NullString\n\tok := config.DB.QueryRow(\"SELECT interested_members FROM project WHERE id=?\", id).Scan(&dbListMember)\n\n\tif ok != nil {\n\t\treturn \"\", errors.New(\"Server is unable to execute query to database\")\n\t}\n\n\tif dbListMember.Valid {\n\t\treturn dbListMember.String, nil\n\t} else {\n\t\treturn \"\", nil\n\t}\n}", "title": "" }, { "docid": "db72bdae3ffc56e50b98b5120da613a6", "score": "0.4698192", "text": "func (service *ValidatorService) GetMailingListValidationProgress(ctx context.Context, mailingListID int) (*ValidationProgress, error) {\n\tpath := fmt.Sprintf(\"/verifier-service/get-progress/?id=%d\", mailingListID)\n\tvar response struct {\n\t\tResult bool `json:\"result\"`\n\t\tData *ValidationProgress `json:\"data\"`\n\t}\n\t_, err := service.client.newRequest(ctx, http.MethodGet, path, nil, &response, true)\n\treturn response.Data, err\n}", "title": "" }, { "docid": "b923c34f2da88113debb911737173f64", "score": "0.4691804", "text": "func cmdlistNetListID(c *cli.Context) error {\n\treturn listNetListbyID(c)\n}", "title": "" }, { "docid": "ba9cb12c8635bc0ef2b985cc3ebe4b23", "score": "0.4691201", "text": "func (m *GroupMembers) GetId()(*string) {\n val, err := m.GetBackingStore().Get(\"id\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "title": "" }, { "docid": "d7970754cf9a34e944770383249b573e", "score": "0.46851796", "text": "func (m *SiteItemRequestBuilder) ListsById(id string)(*i78f58c637039463a95013be84966d9b8b0483bfd65aa77130e076a7f7381cfd6.ListItemRequestBuilder) {\n urlTplParams := make(map[string]string)\n for idx, item := range m.pathParameters {\n urlTplParams[idx] = item\n }\n if id != \"\" {\n urlTplParams[\"list%2Did\"] = id\n }\n return i78f58c637039463a95013be84966d9b8b0483bfd65aa77130e076a7f7381cfd6.NewListItemRequestBuilderInternal(urlTplParams, m.requestAdapter);\n}", "title": "" }, { "docid": "812e8589aa55eb3e4272cb7a7086c649", "score": "0.46773985", "text": "func (c *CheckListItemDefinitionClient) Get(ctx context.Context, id int) (*CheckListItemDefinition, error) {\n\treturn c.Query().Where(checklistitemdefinition.ID(id)).Only(ctx)\n}", "title": "" }, { "docid": "966ed50cbd4e20b61dfe7239fa37c505", "score": "0.4673182", "text": "func (repository *Repository) SaveMailingList(mailingList *MailingList) error {\n\tstmt, err := repository.Conn.Prepare(\"INSERT INTO mailing_list(name, description) VALUES(?,?)\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tres, errExec := stmt.Exec(mailingList.Name, mailingList.Description)\n\tif errExec != nil {\n\t\treturn errExec\n\t}\n\n\tlastInsertedID, errInsert := res.LastInsertId()\n\tif errInsert != nil {\n\t\treturn errInsert\n\t}\n\n\tmailingList.ID = lastInsertedID\n\n\treturn nil\n}", "title": "" }, { "docid": "490a067a96f16e6e778f313b0b48b7e5", "score": "0.46640843", "text": "func (c APIClient) GetListKey(key string) (bool, contracts.ListCacheValueContract, error) {\n\tresp, err := c.getKey(listEndpoint + key)\n\tif err != nil {\n\t\treturn false, contracts.ListCacheValueContract{}, err\n\t}\n\tvar reply contracts.ListCacheValueContract\n\tif err = json.Unmarshal(resp.Body(), &reply); err != nil {\n\t\tlog.Fatal(\"unmarshal failed: \" + err.Error())\n\t\treturn false, contracts.ListCacheValueContract{}, err\n\t}\n\treturn resp.StatusCode() == 200, reply, nil\n}", "title": "" }, { "docid": "97f172c01b137ec8460d7a802075ea95", "score": "0.46371508", "text": "func New(name string) *MailingList {\n\tid := getMailingListID(name)\n\tif len(id) == 0 {\n\t\tlog.Fatalf(\"Error #58025: Mailing list not found: %s\\n\", name)\n\t}\n\ttoken := viper.GetString(\"X-API-TOKEN\")\n\tdc := viper.GetString(\"DATACENTER\")\n\tr := rest.New(token, dc)\n\treturn &MailingList{\n\t\tId: id,\n\t\tName: name,\n\t\tConn: Connection{token, dc, *r},\n\t}\n}", "title": "" }, { "docid": "56e958a83c0299cd182403f3dd2ccc86", "score": "0.4612744", "text": "func GetID(w http.ResponseWriter, r *http.Request) {\n\tparams := mux.Vars(r)\n\tfor _, item := range ord {\n\t\tif strconv.Itoa(item.OrderID) == params[\"id\"] {\n\t\t\tdb, err := sql.Open(\"mysql\", \"root:root123@tcp(127.0.0.1:3306)/test\")\n\t\t\t//var id int = 9555\n\t\t\tif err != nil {\n\t\t\t\tlog.Print(err.Error())\n\t\t\t}\n\t\t\tdefer db.Close()\n\n\t\t\tresults, err := db.Query(\"select * from orders where OrderID = ?;\", params[\"id\"])\n\t\t\tif err != nil {\n\t\t\t\tpanic(err.Error())\n\t\t\t}\n\t\t\tvar out Orders\n\t\t\tfor results.Next() {\n\t\t\t\terr = results.Scan(&out.Item, &out.Quantity, &out.OrderID)\n\t\t\t\tif err != nil {\n\t\t\t\t\tpanic(err.Error())\n\t\t\t\t}\n\t\t\t}\n\t\t\tjson.NewEncoder(w).Encode(out)\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a0d7b3f74847a0f7e66e883b9106ed79", "score": "0.46106356", "text": "func (c *Client) list(mailNum []int) ([]string, error) {\n\tvar err error\n\tvar msg string\n\tvar msgList []string\n\n\tif len(mailNum) > 0 {\n\t\terr = c.sendCmdWithArg(\"LIST\", strconv.Itoa(mailNum[0]))\n\t} else {\n\t\terr = c.sendCmd(\"LIST\")\n\t}\n\tif err != nil {\n\t\treturn msgList, err\n\t}\n\n\tif len(mailNum) == 0 {\n\t\tmsgList, err = c.readRespMultiLines()\n\t} else {\n\t\tmsg, err = c.readResp()\n\t\tmsgList = append(msgList, msg)\n\t}\n\treturn msgList, err\n}", "title": "" }, { "docid": "edcfaa5e42c9451c3c8e738796a7b021", "score": "0.4610399", "text": "func (b *NewsfeedGetListsBuilder) ListIDs(v []int) *NewsfeedGetListsBuilder {\n\tb.Params[\"list_ids\"] = v\n\treturn b\n}", "title": "" }, { "docid": "02c48dcd68e7dfecb04b377293122be5", "score": "0.45981044", "text": "func (o ListingOutput) ListingId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Listing) pulumi.StringOutput { return v.ListingId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "c1035fe7f1a75a63332b2eb8514776a3", "score": "0.45933494", "text": "func (f *FirebaseStore) SetListID(lid, password string) error {\n\tif lid == \"\" {\n\t\tlid = \"default\"\n\t}\n\tlid = strings.ToLower(lid)\n\n\tf.userRoot = f.db.NewRef(\"/\" + lid)\n\tf.userList = f.userRoot\n\tvar userData interface{}\n\tif err := f.userRoot.Get(context.Background(), &userData); err != nil {\n\t\treturn errors.Wrap(err, \"getting lid\")\n\t}\n\tif userData == nil {\n\t\tif err := f.userRoot.Set(context.Background(), lid); err != nil {\n\t\t\treturn errors.Wrap(err, \"setting up lid\")\n\t\t}\n\t}\n\n\tglobalIDNode := f.userRoot.Child(\"global_id\")\n\tvar globalID int\n\tif err := globalIDNode.Get(context.Background(), &globalID); err != nil {\n\t\treturn errors.Wrap(err, \"getting global id\")\n\t}\n\tif err := globalIDNode.Set(context.Background(), globalID); err != nil {\n\t\treturn errors.Wrap(err, \"setting up global id\")\n\t}\n\tf.globalID = globalID\n\n\tif f.userHasPassword() && !f.isCorrectPassword(password) {\n\t\treturn errors.Errorf(\"access unauthorized for list %q\", lid)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ceb9154b50feff9bcf58cc89e391d284", "score": "0.4592061", "text": "func getAPIId(accessToken, endpoint, name, version string) (string, error) {\n\tapiQuery := fmt.Sprintf(\"name:\\\"%s\\\" version:\\\"%s\\\"\", name, version)\n\tcount, apis, err := getAPIList(accessToken, endpoint, apiQuery, \"\")\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif count == 0 {\n\t\treturn \"\", nil\n\t}\n\treturn apis[0].ID, nil\n}", "title": "" }, { "docid": "3df1e3740948be3488fa5d2a89d8ec4a", "score": "0.45778543", "text": "func (g *GroupList) IDRef() *id.PropertyItemID {\n\tif g == nil {\n\t\treturn nil\n\t}\n\treturn g.itemBase.ID.Ref()\n}", "title": "" }, { "docid": "8de8ffa5948c1a0c45aa82a4614cb7ff", "score": "0.4541491", "text": "func getMessageId(r *http.Request) (uint, error) {\n\tmsgIdStr := GetPathValue(r, \"id\")\n\tif len(msgIdStr) > 0 {\n\t\tid, err := strconv.ParseUint(msgIdStr, 10, 64)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\treturn uint(id), nil\n\t}\n\treturn 0, nil\n}", "title": "" }, { "docid": "cb928c7776f47b0c0adb136447cae647", "score": "0.45376593", "text": "func BuildListPayload(walkthroughListID string) (*walkthrough.ListPayload, error) {\n\tvar id string\n\t{\n\t\tid = walkthroughListID\n\t}\n\tv := &walkthrough.ListPayload{}\n\tv.ID = id\n\n\treturn v, nil\n}", "title": "" }, { "docid": "3b7c57f46440572d697dac59a493a731", "score": "0.45262456", "text": "func GetPostusingID(response http.ResponseWriter, request *http.Request) {\r\n\tif request.Method != \"GET\" {\r\n\t\tresponse.WriteHeader(http.StatusMethodNotAllowed)\r\n\t\tresponse.Write([]byte(`{ \"message\": \"Incorrect Method\" }`))\r\n\t\treturn\r\n\t}\r\n\tresponse.Header().Set(\"content-type\", \"application/json\")\r\n\tfmt.Println(path.Base(request.URL.Path))\r\n\tid, _ := primitive.ObjectIDFromHex(path.Base(request.URL.Path))\r\n\tpostusingID, err := CheckPostusingID(id)\r\n\tif err != nil {\r\n\t\tresponse.WriteHeader(http.StatusBadRequest)\r\n\t\tresponse.Write([]byte(`{ \"message\": \"` + err.Error() + `\" }`))\r\n\t\treturn\r\n\t}\r\n\tjson.NewEncoder(response).Encode(postusingID)\r\n\r\n}", "title": "" }, { "docid": "d9a4d5f7dd34df7c56edf5dfd8d360fc", "score": "0.45165795", "text": "func (di *DBInfo) GetAppIDList() ([]int, error) {\n\treturn di.DBRepo.GetAppIDList(di.ID)\n}", "title": "" }, { "docid": "986b6c250f6484910859951c84e8ba7e", "score": "0.4507069", "text": "func (m *member) getID(cli etcdClient) (uint64, error) {\n\t// Get actual list of members.\n\tresp, err := cli.MemberList(context.Background())\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(\"listing existing cluster members: %w\", err)\n\t}\n\n\tfor _, member := range resp.Members {\n\t\tif member.Name == m.config.Name {\n\t\t\treturn member.ID, nil\n\t\t}\n\n\t\tfor _, p := range member.PeerURLs {\n\t\t\tfor _, u := range m.peerURLs() {\n\t\t\t\tif p == u {\n\t\t\t\t\treturn member.ID, nil\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn 0, nil\n}", "title": "" }, { "docid": "1f67b540784506e24e132aac5b8d2c59", "score": "0.4491774", "text": "func GetMultilistPath(elementID string) string {\n\tparam0 := elementID\n\n\treturn fmt.Sprintf(\"/xlist/elements/%s\", param0)\n}", "title": "" }, { "docid": "e60eea71ee6b555963efe043576dfd68", "score": "0.44806015", "text": "func (c *CheckListItemClient) Get(ctx context.Context, id int) (*CheckListItem, error) {\n\treturn c.Query().Where(checklistitem.ID(id)).Only(ctx)\n}", "title": "" }, { "docid": "8c682497eaa22d7455c067dfebc72da9", "score": "0.44606984", "text": "func (co ContactRepository) GetIDByData(clientid string, language string, identifier string) int {\n\n\tquery := `\n\tSELECT contactid FROM contact \n\tWHERE clientid = $1 AND language = $2 AND identifier = $3`\n\n\tvar contactid int\n\n\terr := co.queryable.QueryRow(query, clientid, language, identifier).Scan(&contactid)\n\n\tif err != nil {\n\t\treturn 0\n\t}\n\n\treturn contactid\n}", "title": "" }, { "docid": "be88367f029398c5d56a81f1455c4a5b", "score": "0.44577092", "text": "func (a Request) GetID(body string) string {\n\traw := strings.Join([]string{a.Method, a.URL, body}, \":\")\n\treturn fmt.Sprintf(\"%x\", md5.Sum([]byte(raw)))\n}", "title": "" }, { "docid": "77e2b1e3d994d3462e8d358bab677a63", "score": "0.44564682", "text": "func (_PermaChat *PermaChatCaller) GetRequestById(opts *bind.CallOpts, requestId *big.Int) (*big.Int, common.Address, string, string, string, *big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t\tret1 = new(common.Address)\n\t\tret2 = new(string)\n\t\tret3 = new(string)\n\t\tret4 = new(string)\n\t\tret5 = new(*big.Int)\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}\n\terr := _PermaChat.contract.Call(opts, out, \"getRequestById\", requestId)\n\treturn *ret0, *ret1, *ret2, *ret3, *ret4, *ret5, err\n}", "title": "" }, { "docid": "cdbb6f1b27c51846ec20cb875200d739", "score": "0.4451071", "text": "func (c *Client) FindMailShortcodeId(criteria *Criteria, options *Options) (int64, error) {\n\tids, err := c.Search(MailShortcodeModel, criteria, options)\n\tif err != nil {\n\t\treturn -1, err\n\t}\n\tif len(ids) > 0 {\n\t\treturn ids[0], nil\n\t}\n\treturn -1, fmt.Errorf(\"mail.shortcode was not found with criteria %v and options %v\", criteria, options)\n}", "title": "" }, { "docid": "a1b40a3c7e50394c702069ec4b3ff49a", "score": "0.44504118", "text": "func GetListLimit(ctx context.Context) int {\n\tlimit, _ := ctx.Value(listLimitKey{}).(int)\n\treturn limit\n}", "title": "" }, { "docid": "d376d9e4a93b79cdd97190099199db76", "score": "0.44464424", "text": "func (o *SupportContactDeleteListParams) bindParamID(formats strfmt.Registry) []string {\n\tiDIR := o.ID\n\n\tvar iDIC []string\n\tfor _, iDIIR := range iDIR { // explode []string\n\n\t\tiDIIV := iDIIR // string as string\n\t\tiDIC = append(iDIC, iDIIV)\n\t}\n\n\t// items.CollectionFormat: \"multi\"\n\tiDIS := swag.JoinByFormat(iDIC, \"multi\")\n\n\treturn iDIS\n}", "title": "" }, { "docid": "f58f0e6343665355d1217eba1a9e1051", "score": "0.443909", "text": "func GetPAdListById(id int) (v *PAdList, err error) {\n\to := orm.NewOrm()\n\tv = &PAdList{Id: id}\n\tif err = o.Read(v); err == nil {\n\t\treturn v, nil\n\t}\n\treturn nil, err\n}", "title": "" }, { "docid": "7a3fb7fad80eb6e63775a80e4f7d2867", "score": "0.44258818", "text": "func (r *Response) GetMessageId() (string, error) {\n\tdataInterface, ok := r.Data.(map[string]interface{})\n\tif !ok {\n\t\treturn \"\", fmt.Errorf(\"Invalid Data type: \", \"Cannot convert to map[string]interface{}\")\n\t}\n\temailID, ok := dataInterface[\"message-id\"].(string)\n\tif !ok {\n\t\treturn \"\", fmt.Errorf(\"Invalid Data type: \", \"message-id is not a string\")\n\t}\n\n\treturn emailID, nil\n}", "title": "" }, { "docid": "8c031146c5854177c422d32915c4fd3a", "score": "0.44241697", "text": "func (m *_EventFieldList) GetIdentifier() string {\n\treturn \"919\"\n}", "title": "" }, { "docid": "4c35269e5c1c1b6aebb42b0ebfe479d6", "score": "0.44220722", "text": "func getDNSRecordID(ctx context.Context, domainName, recType, content string) (string, error) {\n\tquery := \"?type=\" + recType + \"&name=\" + url.QueryEscape(domainName)\n\tif content != \"\" {\n\t\tquery = query + \"&content=\" + content\n\t}\n\n\tresponse, err := sendDNSRequest(ctx, \"GET\", query, nil)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tresult := response[\"result\"].([]interface{})\n\tif len(result) == 0 {\n\t\treturn \"\", nil\n\t}\n\trec := result[0].(map[string]interface{})\n\treturn rec[\"id\"].(string), nil\n}", "title": "" }, { "docid": "aea2e690eec0bfd2e6063ff2fd8044bf", "score": "0.441863", "text": "func (t *GormSuite) ListItemGetByListIds(ctx context.Context, listIds []int) ([]*model.ListItem, error) {\n\n\tvar listItems []*model.ListItem\n\tif err := t.tr.Table(\"list_item\").Where(\"list_id IN (?)\", listIds).Find(&listItems).Error; err != nil {\n\t\tfmt.Println(err)\n\t\treturn nil, err\n\t}\n\n\treturn listItems, nil\n}", "title": "" }, { "docid": "7a86cd286ebf7ea15482699670aebeff", "score": "0.44122058", "text": "func (a *Client) GetLedgerPostingID(params *GetLedgerPostingIDParams, authInfo runtime.ClientAuthInfoWriter) (*GetLedgerPostingIDOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetLedgerPostingIDParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"GetLedgerPostingID\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/ledger/posting/{id}\",\n\t\tProducesMediaTypes: []string{\"\"},\n\t\tConsumesMediaTypes: []string{\"\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &GetLedgerPostingIDReader{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.(*GetLedgerPostingIDOK), nil\n\n}", "title": "" }, { "docid": "7bba1b0143fc3d2b84e350b588b634fb", "score": "0.4399357", "text": "func NewListsContactsByListIDPostBadRequest() *ListsContactsByListIDPostBadRequest {\n\treturn &ListsContactsByListIDPostBadRequest{}\n}", "title": "" }, { "docid": "4ed87c4e199a6f52989cb986274449c3", "score": "0.43991354", "text": "func (c *Client) GetFileID(content string) (string, error) {\r\n\tre := regexp.MustCompile(`\"\\\\/app-api\\\\/enduserapp\\\\/item\\\\/f_(\\d+)\"`)\r\n\tif fileID := re.FindStringSubmatch(content); fileID != nil {\r\n\t\treturn fileID[1], nil\r\n\t}\r\n\treturn \"\", nil\r\n}", "title": "" }, { "docid": "b887f3c8f2100b762f16ccde6ea374ff", "score": "0.43957993", "text": "func (c *Client) BuildListRequest(ctx context.Context, v interface{}) (*http.Request, error) {\n\tvar (\n\t\tid string\n\t)\n\t{\n\t\tp, ok := v.(*step.ListPayload)\n\t\tif !ok {\n\t\t\treturn nil, goahttp.ErrInvalidType(\"step\", \"list\", \"*step.ListPayload\", v)\n\t\t}\n\t\tid = p.ID\n\t}\n\tu := &url.URL{Scheme: c.scheme, Host: c.host, Path: ListStepPath(id)}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\treturn nil, goahttp.ErrInvalidURL(\"step\", \"list\", 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": "8b35586d604c6a7513cf2e62fb9a842c", "score": "0.43912098", "text": "func (b *bot) getList(guild, list, arg, user string, roles []string) *discordgo.MessageEmbed {\n\tlis, msg := b.getDDBList(guild, list, user)\n\tif msg != nil {\n\t\treturn msg\n\t}\n\n\tif !lis.CanAccess(user, roles) {\n\t\treturn noPerms(list)\n\t}\n\n\tvar fields []*discordgo.MessageEmbedField\n\n\tvar values, desc string\n\tif arg == \"\" {\n\t\tdesc = \"Your List\"\n\t\tfor _, l := range lis.List {\n\t\t\tif len(values)+len(l.Value) > 1024 {\n\t\t\t\tfields = append(fields, &discordgo.MessageEmbedField{Name: list, Value: values})\n\t\t\t\tlist = l.Value\n\t\t\t\tvalues = \"\"\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tvalues = fmt.Sprintf(\"%s\\n%s\", values, l.Value)\n\t\t}\n\n\t\tif values == \"\" {\n\t\t\tvalues = \"This list is empty!\"\n\t\t}\n\n\t\tfields = append(fields, &discordgo.MessageEmbedField{Name: list, Value: values})\n\n\t\tfields = append(fields, &discordgo.MessageEmbedField{Name: \"List Entries\", Value: fmt.Sprintf(\"%d\", len(lis.List))})\n\t} else {\n\t\tdesc = \"Your Item\"\n\t\ti, err := strconv.Atoi(arg)\n\t\tif err != nil {\n\t\t\treturn &discordgo.MessageEmbed{\n\t\t\t\tDescription: \"The searched item needs to be a number!\",\n\t\t\t\tColor: yellow,\n\t\t\t}\n\t\t}\n\n\t\tvalues = lis.SelectItem(i)\n\t\tif values == \"\" {\n\t\t\treturn &discordgo.MessageEmbed{\n\t\t\t\tDescription: \"I couldn't find an item at that position!\",\n\t\t\t\tColor: yellow,\n\t\t\t}\n\t\t}\n\n\t\tfields = append(fields, &discordgo.MessageEmbedField{Name: fmt.Sprintf(\"Item at position %d\", i), Value: values})\n\t}\n\n\treturn &discordgo.MessageEmbed{\n\t\tDescription: desc,\n\t\tColor: green,\n\t\tFields: fields,\n\t}\n}", "title": "" }, { "docid": "3d2e3af5860704b00a379e200f9966df", "score": "0.43902835", "text": "func GetMeetingUsingID(w http.ResponseWriter,r *http.Request){\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tif r.Method != http.MethodGet{\n\t\tw.WriteHeader(405)\n\t\tw.Write([]byte(\"Method Not Allowed\"))\n\t\treturn\n\t}\n\tctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)\n\tparts := strings.Split(r.URL.String(), \"/\")\n\tid := parts[2]\n\tvar result Meeting\n\tmeetingCollection.FindOne(ctx, bson.M{\"id\": id}).Decode(&result)\n\tdefer cancel()\n\tmeeting,_:=json.Marshal(result)\n\tw.Write(meeting)\n}", "title": "" }, { "docid": "33b06eace0cc92485e0df980cde30b0d", "score": "0.43874946", "text": "func (m TradingSessionList) GetApplID() (v string, err quickfix.MessageRejectError) {\n\tvar f field.ApplIDField\n\tif err = m.Get(&f); err == nil {\n\t\tv = f.Value()\n\t}\n\treturn\n}", "title": "" }, { "docid": "785d9afbecbe0495b8401d5eed67acbb", "score": "0.4386404", "text": "func listGet() Spec {\n\treturn Spec{\n\t\tName: \"listGet\",\n\t\tInputs: []Pin{\n\t\t\tPin{\"index\", NUMBER},\n\t\t},\n\t\tOutputs: []Pin{\n\t\t\tPin{\"element\", ANY},\n\t\t},\n\t\tSource: LIST,\n\t\tKernel: func(in, out, internal MessageMap, s Source, i chan Interrupt) Interrupt {\n\t\t\tl := s.(*List)\n\t\t\tindexFloat, ok := in[0].(float64)\n\t\t\tif !ok {\n\t\t\t\tout[0] = NewError(\"List index is not a Number \")\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tindex := int(indexFloat)\n\t\t\t/*\n\t\t\t\t// TODO should we be happy with int() just flooring the index?\n\t\t\t\tif math.Mod(a, math.Floor(a)) > 0 {\n\t\t\t\t\tout[0] = NewError(\"List index must be an integer\")\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t*/\n\t\t\tif index < 0 {\n\t\t\t\tout[0] = NewError(\"List index must be ≥ 0\")\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tif index > len(l.list) {\n\t\t\t\tout[0] = NewError(\"List index out of range\")\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tout[0] = l.list[index]\n\t\t\treturn nil\n\t\t},\n\t}\n}", "title": "" }, { "docid": "59363f70db95b2effc6cd59e83a511f3", "score": "0.43842706", "text": "func (a Founder) GetID() string {\n\treturn a.ID.Hex()\n}", "title": "" }, { "docid": "2acbe81c1a27cc824beadd6d387ceac6", "score": "0.43659523", "text": "func getMaxID() int {\n\tmax := 0\n\tfor _, item := range contacts {\n\t\tif item.ID > max {\n\t\t\tmax = item.ID\n\t\t}\n\t}\n\treturn max\n}", "title": "" }, { "docid": "e87b13ff07719421c9ee8509d4843ac1", "score": "0.43599877", "text": "func GetFiremanID(text string) string {\n\ttopicPattern := regexp.MustCompile(`<@(.{11})> set the channel topic:.*<@(.{11})>`)\n\tif result := topicPattern.FindAllStringSubmatch(text, -1); len(result) > 0 {\n\t\treturn result[0][2]\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "470c7330aaf1ef189a4fceb60c18c286", "score": "0.43539178", "text": "func (r *TasklistsService) Delete(tasklistid string) *TasklistsDeleteCall {\n\treturn &TasklistsDeleteCall{\n\t\ts: r.s,\n\t\ttasklistid: tasklistid,\n\t\tcaller_: googleapi.JSONCall{},\n\t\tparams_: make(map[string][]string),\n\t\tpathTemplate_: \"users/@me/lists/{tasklist}\",\n\t\tcontext_: googleapi.NoContext,\n\t}\n}", "title": "" }, { "docid": "b0975041fe62bd6127f8fecdc83f16e1", "score": "0.4353801", "text": "func (m *Mail) getIdsFromMailboxHash() (int64, error) {\n\t// Split method get the MailboxHash field MailboxHash seems like\n\t// \"channelid.5678\", or MailboxHash seems like \"messageid.1234\"\n\ts := strings.Split(m.MailboxHash, \".\")\n\tif len(s) < 1 {\n\t\treturn 0, errLengthIsNotEnough\n\t}\n\n\t// ParseInt get the 1. index (2.parameter) of \"s\" value As explained above,\n\t// we got 1. index that \"5678\" as string and then, we convert string to\n\t// int64\n\tid, err := strconv.ParseInt(s[1], 10, 64)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn id, nil\n}", "title": "" }, { "docid": "614c3de625e6db1b45f0dac7d8fc3ded", "score": "0.43426168", "text": "func getMemberID(i int) string {\n\treturn fmt.Sprintf(\"%02d\", i)\n}", "title": "" }, { "docid": "006fdbf6edb0b8d0e8dd05b050213529", "score": "0.4338776", "text": "func (a *Attendee) GetID() string {\n\treturn a.ID\n}", "title": "" }, { "docid": "59bf75025def22178aab443e319c006c", "score": "0.4338718", "text": "func (o ListingIamPolicyOutput) ListingId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *ListingIamPolicy) pulumi.StringOutput { return v.ListingId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "78cf49886d8e2e0bced26683c3fe1b9b", "score": "0.43382257", "text": "func (c *Collection) GetEmail(ctx context.Context, id int, email string) (list []EmailInformation, err error) {\n\tr := c.client.R().SetContext(ctx)\n\t_, err = r.Get(fmt.Sprintf(\"/addressbooks/%d/emails/%s\", id, email))\n\treturn list, err\n}", "title": "" }, { "docid": "75fac2a1903b3edc76bc9b7a7e24cd6e", "score": "0.43363002", "text": "func listNetListbyID(c *cli.Context) error {\n\tcommon.VerifyArgumentByName(c, \"id\")\n\n\tlistNetListOptsv2 := edgegrid.ListNetworkListsOptionsv2{}\n\tlistNetListOptsv2.IncludeElements = c.Bool(\"includeElements\")\n\tlistNetListOptsv2.Extended = c.Bool(\"extended\")\n\n\tnetList, _, netlistErr := apiClient.NetworkListsv2.GetNetworkList(c.String(\"id\"), listNetListOptsv2)\n\tif netlistErr != nil {\n\t\treturn netlistErr\n\t}\n\n\tcommon.OutputJSON(netList)\n\n\treturn nil\n}", "title": "" }, { "docid": "4d835ce4ac06dd6501fb1f4f21b2e918", "score": "0.43353665", "text": "func (s *Service) Department_GetList(debtorID int) (*Department_GetListResponse, error) {\n\t// get a new request & response envelope\n\trequest, response := s.NewDepartment_GetListAction(debtorID)\n\n\t// copy authheader to new envelope\n\trequest.Envelope.Header.Data = s.AuthHeader\n\n\t// create a new HTTP request from the SOAP envelope\n\thttpReq, err := s.Client.NewRequest(s.Endpoint.String(), request)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// make the HTTP request\n\t_, err = s.Client.Do(httpReq, response)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// @TODO: check if this can be better\n\tlistResponse, ok := response.Envelope.Body.Data.(*Department_GetListResponse)\n\tif ok == false {\n\t\treturn listResponse, soap.ErrBadResponse\n\t}\n\n\treturn listResponse, err\n}", "title": "" } ]
00f5670ad7c2c3b4ecaee1d425d2ed25
SearchRetcodeAppByPageWithChan invokes the arms.SearchRetcodeAppByPage API asynchronously
[ { "docid": "9116a10149338db815960c60be0b671f", "score": "0.83721143", "text": "func (client *Client) SearchRetcodeAppByPageWithChan(request *SearchRetcodeAppByPageRequest) (<-chan *SearchRetcodeAppByPageResponse, <-chan error) {\n\tresponseChan := make(chan *SearchRetcodeAppByPageResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.SearchRetcodeAppByPage(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "title": "" } ]
[ { "docid": "ea849bd41f29073bccf115fb3283d183", "score": "0.8078584", "text": "func (client *Client) SearchRetcodeAppByPageWithCallback(request *SearchRetcodeAppByPageRequest, callback func(response *SearchRetcodeAppByPageResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *SearchRetcodeAppByPageResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.SearchRetcodeAppByPage(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "title": "" }, { "docid": "7a6f129b5472be1e23bb173d7e259e71", "score": "0.7172747", "text": "func (client *Client) SearchRetcodeAppByPage(request *SearchRetcodeAppByPageRequest) (response *SearchRetcodeAppByPageResponse, err error) {\n\tresponse = CreateSearchRetcodeAppByPageResponse()\n\terr = client.DoAction(request, response)\n\treturn\n}", "title": "" }, { "docid": "e0b52b3c2a95d31a5c8104cb070b27c6", "score": "0.59128696", "text": "func CreateSearchRetcodeAppByPageRequest() (request *SearchRetcodeAppByPageRequest) {\n\trequest = &SearchRetcodeAppByPageRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"ARMS\", \"2019-08-08\", \"SearchRetcodeAppByPage\", \"arms\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}", "title": "" }, { "docid": "b9b3045e3989ca8b727e021578d7570c", "score": "0.5410966", "text": "func CreateSearchRetcodeAppByPageResponse() (response *SearchRetcodeAppByPageResponse) {\n\tresponse = &SearchRetcodeAppByPageResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "title": "" }, { "docid": "ac59e41e962c42f2f11f9c5555ef038d", "score": "0.48356164", "text": "func (client *Client) GetRetcodeDataByQueryWithChan(request *GetRetcodeDataByQueryRequest) (<-chan *GetRetcodeDataByQueryResponse, <-chan error) {\n\tresponseChan := make(chan *GetRetcodeDataByQueryResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.GetRetcodeDataByQuery(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "title": "" }, { "docid": "0f1cd8647ebec110f12d3a0907b3069a", "score": "0.47982112", "text": "func getPage(page int, baseURL string, c chan<- []extractedInfo) {\n pageURL := \"\";\n var jobInfoCon []extractedInfo;\n jobInfoChannel := make(chan extractedInfo);\n\n if page != 0{\n pageURL = baseURL + \"&start=\" + strconv.Itoa(page * 10);\n } else {\n pageURL = baseURL;\n }\n fmt.Println(\"Requesting \", pageURL);\n res, err := http.Get(pageURL);\n defer res.Body.Close()\n checkErr(err)\n checkStatus(res);\n doc, _ := goquery.NewDocumentFromReader(res.Body);\n cards := doc.Find(\".tapItem\")\n //Request\n cards.Each(func(i int, card *goquery.Selection){\n go extractJonInfo(card, jobInfoChannel)\n })\n //Receive\n for i:=0; i<cards.Length(); i++ {\n jobInfoCon = append(jobInfoCon, <- jobInfoChannel);\n }\n\n c <- jobInfoCon;\n}", "title": "" }, { "docid": "67cd7e371e620ba457541afcb773ef6c", "score": "0.46987867", "text": "func (client *Client) GetRetcodeDataByQueryWithCallback(request *GetRetcodeDataByQueryRequest, callback func(response *GetRetcodeDataByQueryResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *GetRetcodeDataByQueryResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.GetRetcodeDataByQuery(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "title": "" }, { "docid": "40050889309dd05a2000080df43ad700", "score": "0.46976742", "text": "func (c *Client) SearchPage(query string, start int) (List, error) {\n\turi := c.FormatURL(query, c.Config.NbResults, c.Config.NbResults*start)\n\tresp, e := c.Download(uri)\n\tif e != nil {\n\t\treturn nil, e\n\t}\n\treturn c.Parse(resp)\n}", "title": "" }, { "docid": "490d0c75f7499dab7ea7f9113c633fce", "score": "0.4666325", "text": "func (c *ChromePage) SearchInResource(frameId types.ChromePageFrameId, url string, query string, caseSensitive bool, isRegex bool) ([]*types.ChromeDebuggerSearchMatch, error) {\n paramRequest := make(map[string]interface{}, 5)\n paramRequest[\"frameId\"] = frameId\n paramRequest[\"url\"] = url\n paramRequest[\"query\"] = query\n paramRequest[\"caseSensitive\"] = caseSensitive\n paramRequest[\"isRegex\"] = isRegex\n recvCh, _ := sendCustomReturn(c.target.sendCh, &ParamRequest{Id: c.target.getId(), Method: \"Page.searchInResource\", Params: paramRequest})\n resp := <-recvCh\n\n var chromeData struct {\n Result struct { \n Result []*types.ChromeDebuggerSearchMatch \n }\n }\n\n err := json.Unmarshal(resp.Data, &chromeData)\n if err != nil {\n cerr := &ChromeErrorResponse{}\n chromeError := json.Unmarshal(resp.Data, cerr)\n if chromeError == nil && cerr.Error != nil {\n return nil, &ChromeRequestErr{Resp: cerr}\n }\n return nil, err\n }\n\n return chromeData.Result.Result, nil\n}", "title": "" }, { "docid": "bed227dca0319b9329488e814504bd38", "score": "0.45004812", "text": "func (client *Client) ImageAsyncManualScanResultsWithCallback(request *ImageAsyncManualScanResultsRequest, callback func(response *ImageAsyncManualScanResultsResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *ImageAsyncManualScanResultsResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.ImageAsyncManualScanResults(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "title": "" }, { "docid": "9d33e8fb4a1518be65d42f2c060042a0", "score": "0.4500165", "text": "func Scrape() <-chan lotto.Result {\n\tc := make(chan lotto.Result)\n\n\tgo func() {\n\t\tdefer close(c)\n\n\t\tfor year := time.Now().Year(); year >= 1994; year-- {\n\t\t\t// Get archive page\n\t\t\tarchivePage, err := goquery.NewDocument(fmt.Sprintf(archiveURL, baseURL, year))\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\t// Find all results pages linked from archive page\n\t\t\tarchivePage.Find(\"#siteContainer .main .lotto tbody tr td a\").Each(func(i int, s *goquery.Selection) {\n\t\t\t\tresultURL, ok := s.Attr(\"href\")\n\t\t\t\tif !ok {\n\t\t\t\t\tlog.Println(\"No result URL for\", s.Text())\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tres, err := parseResultPage(resultURL)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Println(err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tc <- res\n\t\t\t})\n\t\t}\n\t}()\n\n\treturn c\n}", "title": "" }, { "docid": "735f8ec616604ad5620268cbfdec58d6", "score": "0.44367442", "text": "func (client *Client) ImageAsyncManualScanResultsWithChan(request *ImageAsyncManualScanResultsRequest) (<-chan *ImageAsyncManualScanResultsResponse, <-chan error) {\n\tresponseChan := make(chan *ImageAsyncManualScanResultsResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.ImageAsyncManualScanResults(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "title": "" }, { "docid": "4634bf960e707d91f5e02366fb755e2b", "score": "0.43599454", "text": "func RetrieveCardPages(allIndexURLch <-chan *url.URL, cardPageURLch chan<- *url.URL) {\n\tfor allIndexURL := range allIndexURLch {\n\t\tresp, err := http.Get(allIndexURL.String())\n\t\tif err != nil {\n\t\t\tlog.Fatalln(err)\n\t\t}\n\t\tdefer resp.Body.Close()\n\t\td := html.NewTokenizer(resp.Body)\n\t\tfor {\n\t\t\ttokenType := d.Next()\n\t\t\tif tokenType == html.ErrorToken {\n\t\t\t\ttime.Sleep(time.Second * 1)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\ttoken := d.Token()\n\t\t\tswitch tokenType {\n\t\t\tcase html.StartTagToken:\n\t\t\t\tswitch token.Data {\n\t\t\t\tcase \"a\":\n\t\t\t\t\tfor _, v := range token.Attr {\n\t\t\t\t\t\tif v.Key == \"href\" && strings.HasPrefix(v.Val, \"../cards\") {\n\t\t\t\t\t\t\tu, err := url.Parse(\"http://www.aozora.gr.jp\" + strings.Trim(v.Val, \"..\"))\n\t\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\t\tlog.Fatalln(err)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif u.IsAbs() {\n\t\t\t\t\t\t\t\tcardPageURLch <- u\n\t\t\t\t\t\t\t}\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\t\t\t}\n\t\t}\n\t}\n\tclose(cardPageURLch)\n\treturn\n}", "title": "" }, { "docid": "2b88ec844b46f2b84d85b434d9067b73", "score": "0.43582556", "text": "func (client *Client) SearchTableWithChan(request *SearchTableRequest) (<-chan *SearchTableResponse, <-chan error) {\n\tresponseChan := make(chan *SearchTableResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.SearchTable(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "title": "" }, { "docid": "6557ee1af50c87689c1017b7fbb4c7b2", "score": "0.4352752", "text": "func (client *Client) SearchTableWithCallback(request *SearchTableRequest, callback func(response *SearchTableResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *SearchTableResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.SearchTable(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "title": "" }, { "docid": "50c6a74741d4c9b97d4a223e86c0dd31", "score": "0.43520936", "text": "func (self *Api) Search(query string, page int, perPage int, sinceId int, locale string, lang string) <-chan []SearchResult {\n\tvariables := make(map[string]string)\n\turl_ := _QUERY_SEARCH\n\tresponseChannel := self.buildRespChannel(_SLICESEARCH).(chan []SearchResult)\n\n\tvariables[\"q\"] = query\n\n\tif page >= 2 {\n\t\tvariables[\"page\"] = strconv.Itoa(page)\n\t}\n\n\tif perPage > 0 {\n\t\tvariables[\"rpp\"] = strconv.Itoa(perPage)\n\t}\n\n\tif sinceId > 0 {\n\t\tvariables[\"since_id\"] = strconv.Itoa(sinceId)\n\t}\n\n\tif locale != \"\" {\n\t\tvariables[\"locale\"] = locale\n\t}\n\n\tif lang != \"\" {\n\t\tvariables[\"lang\"] = lang\n\t}\n\n\turl_ = addQueryVariables(url_, variables)\n\tgo self.goGetSearchResults(url_, responseChannel)\n\n\treturn responseChannel\n}", "title": "" }, { "docid": "7347bbdc96ddc0fec006d237f0767929", "score": "0.4292531", "text": "func Search(term string, page int) (SearchResults, error) {\n\tif len(term) > maxSearchTermLength {\n\t\treturn SearchResults{}, fmt.Errorf(\"Search term was >%d characters.\\n\",\n\t\t\tmaxSearchTermLength)\n\t}\n\n\tws, err := connectToWebsocket()\n\tif err != nil {\n\t\treturn SearchResults{}, err\n\t}\n\tdefer ws.Close()\n\n\terr = sendSearchQuery(ws, term, strconv.Itoa(page), &searchOptions{\n\t\tcrackStatus: CrackStatusAll,\n\t\treleaseStatus: ReleaseStatusAll,\n\t\tstudioType: StudioAll,\n\t\torderType: OrderTypeTitle,\n\t\tsortOrder: SortOrderAsc,\n\t})\n\tif err != nil {\n\t\treturn SearchResults{}, err\n\t}\n\n\tsearchResults, err := waitForSearchResults(ws)\n\tif err != nil {\n\t\treturn SearchResults{}, err\n\t}\n\n\treturn searchResults, nil\n}", "title": "" }, { "docid": "f2dace799aeb966379c965ccd0a1b783", "score": "0.4245975", "text": "func (cc *AssetLedger) searchpn(stub shim.ChaincodeStubInterface, args []string) peer.Response {\n\n\tif len(args) != 1 {\n\t\treturn shim.Error(\"Read: incorrect number of arguments; expecting only the search string.\")\n\t}\n\tsearchString := args[0]\n\n\t// stub.GetQueryResult takes a verbatim CouchDB (assuming this is used DB). See CouchDB documentation:\n\t// http://docs.couchdb.org/en/2.0.0/api/database/find.html\n\t// For example:\n\t//\t{\n\t//\t\t\"selector\": {\n\t//\t\t\t\"value\": {\"$regex\": %s\"}\n\t//\t\t},\n\t//\t\t\"fields\": [\"ID\",\"value\"],\n\t//\t\t\"limit\": 99\n\t//\t}\n\tqueryString := fmt.Sprintf(\"{\\\"selector\\\": {\\\"partnumber\\\": {\\\"$regex\\\": \\\"%s\\\"}}, \\\"fields\\\": [\\\"partnumber\\\",\\\"serialnumber\\\",\\\"scrapdatetime\\\",\\\"refdocumentid\\\",\\\"scrappingentity\\\",\\\"latitude\\\",\\\"longitude\\\",\\\"address\\\",\\\"partphoto\\\"],\\\"limit\\\":99}\", strings.Replace(searchString,\"\\\"\",\".\",-1))\n\n\t\t\tresultsIterator, err := stub.GetQueryResult(queryString)\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n defer resultsIterator.Close()\n\n // buffer is a JSON array containing QueryRecords (which are JSON objects)\n var buffer bytes.Buffer\n\tbuffer.WriteString(\"[\")\n\tfor resultsIterator.HasNext() {\n\t\tqueryResponse, _ := resultsIterator.Next()\n if buffer.Len() > 1 {\n \tbuffer.WriteString(\",\")\n }\n\t\tbuffer.WriteString(string(queryResponse.Value))\n\t}\n\tbuffer.WriteString(\"]\")\n\n\treturn shim.Success(buffer.Bytes())\n}", "title": "" }, { "docid": "4ec11e94b4b85b76420101e5ad5b635a", "score": "0.42427257", "text": "func (client CardsClient) SearchResponder(resp *http.Response) (result CardList, err error) {\n err = autorest.Respond(\n resp,\n azure.WithErrorUnlessStatusCode(http.StatusOK),\n autorest.ByUnmarshallingJSON(&result),\n autorest.ByClosing())\n result.Response = autorest.Response{Response: resp}\n return\n }", "title": "" }, { "docid": "66dd1915597271b5779f2f2be2d76b74", "score": "0.42302787", "text": "func (g google) Search(term string, results chan<- []Result) {\n\tlog.Printf(\"Google : Search : Started : search term[%s]\\n\", term)\n\n\t// Slice for the results.\n\tvar r []Result\n\n\t// Simulate an amount of time for the search.\n\ttime.Sleep(time.Millisecond * time.Duration(rand.Int63n(900)))\n\n\t// Simulate a result for the search.\n\tr = append(r, Result{\n\t\tEngine: \"Google\",\n\t\tTitle: \"The Go Programming Language\",\n\t\tDescription: \"The Go Programming Language\",\n\t\tLink: \"https://golang.org/\",\n\t})\n\n\tlog.Printf(\"Google : Search : Completed : Found[%d]\\n\", len(r))\n\tresults <- r\n}", "title": "" }, { "docid": "95193b47d808bca5001a3585bbc950fe", "score": "0.42299607", "text": "func ScanApp(ctx context.Context, s *testing.State) {\n\tcr := s.FixtValue().(chrome.HasChrome).Chrome()\n\n\tcleanupCtx := ctx\n\tctx, cancel := ctxutil.Shorten(ctx, 5*time.Second)\n\tdefer cancel()\n\n\ttconn, err := cr.TestAPIConn(ctx)\n\tif err != nil {\n\t\ts.Fatal(\"Failed to create Test API connection: \", err)\n\t}\n\n\tdefer faillog.DumpUITreeWithScreenshotOnError(cleanupCtx, s.OutDir(), s.HasError, cr, \"ui_dump\")\n\n\t// Reset the holding space.\n\tif err := holdingspace.ResetHoldingSpace(ctx, tconn,\n\t\tholdingspace.ResetHoldingSpaceOptions{}); err != nil {\n\t\ts.Fatal(\"Failed to reset holding space: \", err)\n\t}\n\n\tprinter, err := scanapp.StartPrinter(ctx, tconn)\n\tif err != nil {\n\t\ts.Fatal(\"Failed to start printer: \", err)\n\t}\n\tdefer func(ctx context.Context) {\n\t\tif err := printer.Stop(ctx); err != nil {\n\t\t\ts.Error(\"Failed to stop printer: \", err)\n\t\t}\n\t}(ctx)\n\n\tvar settings = scanapp.ScanSettings{\n\t\tScanner: printer.VisibleName,\n\t\tSource: scanapp.SourceFlatbed,\n\t\tFileType: scanapp.FileTypePNG,\n\t\tColorMode: scanapp.ColorModeColor,\n\t\tPageSize: scanapp.PageSizeLetter,\n\t\tResolution: scanapp.Resolution300DPI,\n\t}\n\n\tapp, err := scanapp.LaunchAndStartScanWithSettings(ctx, tconn, settings)\n\tif err != nil {\n\t\ts.Fatal(\"Failed to Launch scan app and start scan: \", err)\n\t}\n\tdefer func() {\n\t\tif err := app.Close(ctx); err != nil {\n\t\t\ts.Error(\"Failed to close app: \", err)\n\t\t}\n\t}()\n\n\tmyFilesPath, err := cryptohome.MyFilesPath(ctx, cr.NormalizedUser())\n\tif err != nil {\n\t\ts.Fatal(\"Failed to retrieve users MyFiles path: \", err)\n\t}\n\n\t// Remove scans after the test completes.\n\tdefaultScanPattern := filepath.Join(myFilesPath, scanapp.DefaultScanFilePattern)\n\tdefer func() {\n\t\tif err := scanapp.RemoveScans(defaultScanPattern); err != nil {\n\t\t\ts.Error(\"Failed to remove scans: \", err)\n\t\t}\n\t}()\n\n\tscan, err := scanapp.GetScan(defaultScanPattern)\n\tif err != nil {\n\t\ts.Fatal(\"Failed to find scan: \", err)\n\t}\n\n\t// Verify the scan can be found in the holding space.\n\tui := uiauto.New(tconn)\n\tif err := uiauto.Combine(\"Verify scanned file appears in holding space\",\n\t\tui.LeftClick(holdingspace.FindTray()),\n\t\tui.WaitUntilExists(holdingspace.FindDownloadChip().Name(filepath.Base(scan))),\n\t)(ctx); err != nil {\n\t\ts.Fatal(\"Failed to verify scanned file appears in holding space: \", err)\n\t}\n}", "title": "" }, { "docid": "8b7205c10ac9185a3ba56e249e297c05", "score": "0.42061022", "text": "func (recv *FindController) SearchNext() {\n\tC.webkit_find_controller_search_next((*C.WebKitFindController)(recv.native))\n\n\treturn\n}", "title": "" }, { "docid": "c8ae4c01091e3ce02378908d1a9d3f61", "score": "0.41958764", "text": "func Search(options *SearchOptions) ([]*Book, error) {\n\t// libgen search only allows query Results of 25, 50 or 100.\n\t// We handle that here\n\tvar res int\n\tswitch {\n\tcase options.Results <= 25:\n\t\tres = 25\n\tcase options.Results <= 50:\n\t\tres = 50\n\tdefault:\n\t\tres = 100\n\t}\n\n\t// Define DownloadURL with required query parameters\n\toptions.SearchMirror.Path = \"search.php\"\n\tq := options.SearchMirror.Query()\n\tq.Set(\"req\", options.Query)\n\tq.Set(\"lg_topic\", \"libgen\")\n\tq.Set(\"open\", \"0\")\n\tq.Set(\"view\", \"simple\")\n\tq.Set(\"res\", fmt.Sprint(res))\n\tq.Set(\"phrase\", \"1\")\n\tq.Set(\"column\", \"def\")\n\toptions.SearchMirror.RawQuery = q.Encode()\n\n\tb, err := getBody(options.SearchMirror.String())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Get hashes from raw webpage and store them in hashes\n\thashes := parseHashes(b, options.Results)\n\n\tbooks, err := GetDetails(&GetDetailsOptions{\n\t\tHashes: hashes,\n\t\tSearchMirror: options.SearchMirror,\n\t\tPrint: options.Print,\n\t\tRequireAuthor: options.RequireAuthor,\n\t\tExtension: options.Extension,\n\t\tYear: options.Year,\n\t\tPublisher: options.Publisher,\n\t\tLanguage: options.Language,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn books, nil\n}", "title": "" }, { "docid": "504877530f8205a108aa40e9d579962f", "score": "0.41827196", "text": "func main() {\n\t// Search term we are looking for.\n\tsearchTerm := \"president\"\n\n\t// Load the feeds for the data file.\n\tsites, err := feeds.Load()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t// Perpare the slice of results and the channel to\n\t// retrieve the results on.\n\tresult := make(chan find.Result)\n\n\t// Wait for the result from each goroutine\n\tgo func() {\n\t\tfor found := range result {\n\t\t\tlog.Printf(\"%s:\\n%s\\n\\n\", found.Field, found.Content)\n\t\t}\n\t}()\n\n\t// Setup a wait group so we can process all the feeds.\n\tvar waitGroup sync.WaitGroup\n\twaitGroup.Add(len(sites))\n\n\t// Launch a goroutine for each feed to find the results.\n\tfor _, site := range sites {\n\t\tvar matcher find.Matcher\n\n\t\t// Create the right type of matcher for this search.\n\t\tswitch site.Type {\n\t\tcase \"rss\":\n\t\t\tmatcher = rss.New(site)\n\n\t\tdefault:\n\t\t\tlog.Fatalln(\"Invalid Type\")\n\t\t}\n\n\t\t// Launch the goroutine to perform the search.\n\t\tgo func() {\n\t\t\tfind.Search(matcher, searchTerm, result)\n\t\t\twaitGroup.Done()\n\t\t}()\n\t}\n\n\t// Wait for everything to be processed.\n\twaitGroup.Wait()\n\n\t// Close the channel and exit.\n\tclose(result)\n}", "title": "" }, { "docid": "18f16ba102457cd385e6dc588663d8b0", "score": "0.41744253", "text": "func (client InstagramClient) Search(totalImageCount int, hashtag string, c chan *ImageMetaData) {\n\tremainingImageCount := totalImageCount\n\n\trecentMedia := \"https://api.instagram.com/v1/tags/%s/media/recent?client_id=%s&count=100\"\n\n\turl := fmt.Sprintf(recentMedia, hashtag, client.Id)\n\tvar count int\n\tfor remainingImageCount > 0 {\n\t\turl, count = InstagramQuery(url, remainingImageCount, c)\n\t\tremainingImageCount -= count\n\t}\n}", "title": "" }, { "docid": "4aff9e3e14e181c04be6ceab69ce99f6", "score": "0.416876", "text": "func (app PageApp) App() AppCall {\n\tdevices := make([]string, 0, len(app.Recipients))\n\tfor _, device := range app.Recipients {\n\t\tdevices = append(devices, device.String())\n\t}\n\tcall := AppCall{\n\t\tName: \"Page\",\n\t\tArgs: []string{strings.Join(devices, \"&\")},\n\t}\n\toptions := app.Options()\n\tif len(options) == 0 && app.Timeout <= 0 {\n\t\treturn call\n\t}\n\tcall.Args = append(call.Args, options)\n\tif app.Timeout > 0 {\n\t\tcall.Args = append(call.Args, strconv.Itoa(app.Timeout))\n\t}\n\treturn call\n}", "title": "" }, { "docid": "8454fcde1a62e50d20fda3d3c29509ad", "score": "0.41568562", "text": "func doSmartSearchRPCs(sessionState *session.State, actionState *action.State, appDoc *enigma.Doc, id int, searchText string, doRetries, acceptAborted bool) **enigma.SearchResult {\n\tsearchTerms := parseSearchTerms(searchText)\n\tif sessionState.LogEntry.ShouldLogDebug() {\n\t\tsessionState.LogEntry.LogDebugf(`search%d text %s becomes search terms: %s`, id, quote(searchText), quoteList(searchTerms))\n\t}\n\n\tcontextDecorator := func(ctx context.Context) context.Context {\n\t\tif doRetries {\n\t\t\treturn ctx\n\t\t}\n\t\treturn enigmahandlers.ContextWithoutRetries(ctx)\n\t}\n\n\tsessionState.QueueRequest(func(ctx context.Context) error {\n\t\tsearchSuggestionResult, err := appDoc.SearchSuggest(\n\t\t\tcontextDecorator(ctx),\n\t\t\tsearchSuggestDefaultSearchCombinationOptions,\n\t\t\tsearchTerms,\n\t\t)\n\t\tif err != nil {\n\t\t\tif acceptAborted && isAbortedError(err) {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn err\n\t\t}\n\t\tlogSearchSuggestionResult(sessionState.LogEntry, id, searchSuggestionResult)\n\t\treturn nil\n\t}, actionState, true, \"SearchSuggest call failed\")\n\n\tvar searchResultRet *enigma.SearchResult\n\tsessionState.QueueRequest(func(ctx context.Context) error {\n\t\tsearchResult, err := appDoc.SearchResults(\n\t\t\tcontextDecorator(ctx),\n\t\t\tsearchResultsDefaultSearchCombinationOptions,\n\t\t\tsearchTerms,\n\t\t\tsearchResultsDefaultSearchPage,\n\t\t)\n\t\tif err != nil {\n\t\t\tif acceptAborted && isAbortedError(err) {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn err\n\t\t}\n\t\tsearchResultRet = searchResult\n\t\tlogSearchResult(sessionState.LogEntry, id, searchResult)\n\t\treturn nil\n\t}, actionState, true, \"SearchResults call failed\")\n\n\treturn &searchResultRet\n}", "title": "" }, { "docid": "b42b3d5ad37a493f4608864efe54839a", "score": "0.41105318", "text": "func (client *Client) LiveStreamAsyncScanWithChan(request *LiveStreamAsyncScanRequest) (<-chan *LiveStreamAsyncScanResponse, <-chan error) {\n\tresponseChan := make(chan *LiveStreamAsyncScanResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.LiveStreamAsyncScan(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "title": "" }, { "docid": "7c2d0b53615d80fa35cdad38387abb14", "score": "0.4109508", "text": "func (client *Client) LiveStreamAsyncScanWithCallback(request *LiveStreamAsyncScanRequest, callback func(response *LiveStreamAsyncScanResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *LiveStreamAsyncScanResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.LiveStreamAsyncScan(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "title": "" }, { "docid": "11663a12169cb107db5abd1d7e6b3286", "score": "0.4095619", "text": "func (a *CIVisibilityTestsApi) SearchCIAppTestEventsWithPagination(ctx _context.Context, o ...SearchCIAppTestEventsOptionalParameters) (<-chan datadog.PaginationResult[CIAppTestEvent], func()) {\n\tctx, cancel := _context.WithCancel(ctx)\n\tpageSize_ := int32(10)\n\tif len(o) == 0 {\n\t\to = append(o, SearchCIAppTestEventsOptionalParameters{})\n\t}\n\tif o[0].Body == nil {\n\t\to[0].Body = NewCIAppTestEventsRequest()\n\t}\n\tif o[0].Body.Page == nil {\n\t\to[0].Body.Page = NewCIAppQueryPageOptions()\n\t}\n\tif o[0].Body.Page.Limit != nil {\n\t\tpageSize_ = *o[0].Body.Page.Limit\n\t}\n\to[0].Body.Page.Limit = &pageSize_\n\n\titems := make(chan datadog.PaginationResult[CIAppTestEvent], pageSize_)\n\tgo func() {\n\t\tfor {\n\t\t\tresp, _, err := a.SearchCIAppTestEvents(ctx, o...)\n\t\t\tif err != nil {\n\t\t\t\tvar returnItem CIAppTestEvent\n\t\t\t\titems <- datadog.PaginationResult[CIAppTestEvent]{returnItem, err}\n\t\t\t\tbreak\n\t\t\t}\n\t\t\trespData, ok := resp.GetDataOk()\n\t\t\tif !ok {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tresults := *respData\n\n\t\t\tfor _, item := range results {\n\t\t\t\tselect {\n\t\t\t\tcase items <- datadog.PaginationResult[CIAppTestEvent]{item, nil}:\n\t\t\t\tcase <-ctx.Done():\n\t\t\t\t\tclose(items)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t\tif len(results) < int(pageSize_) {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcursorMeta, ok := resp.GetMetaOk()\n\t\t\tif !ok {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcursorMetaPage, ok := cursorMeta.GetPageOk()\n\t\t\tif !ok {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcursorMetaPageAfter, ok := cursorMetaPage.GetAfterOk()\n\t\t\tif !ok {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\to[0].Body.Page.Cursor = cursorMetaPageAfter\n\t\t}\n\t\tclose(items)\n\t}()\n\treturn items, cancel\n}", "title": "" }, { "docid": "da6bc0d75477cafed27177289aa4627b", "score": "0.40882495", "text": "func SearchForAppInLauncher(query, result string, kb *input.KeyboardEventWriter, ui *uiauto.Context) uiauto.Action {\n\tsearchResult := nodewith.Role(\"listBoxOption\").NameContaining(result).HasClass(\"ui/app_list/SearchResultView\").First()\n\treturn ui.RetrySilently(2, uiauto.Combine(\"search and select result in launcher\",\n\t\tkb.AccelAction(\"Search\"),\n\t\tui.WaitUntilExists(nodewith.Role(role.TextField).HasClass(\"Textfield\")),\n\t\tkb.TypeAction(query),\n\t\tui.LeftClick(searchResult),\n\t))\n}", "title": "" }, { "docid": "0ab5f13b93c3dec97f9da027edebde8c", "score": "0.40879837", "text": "func (client *Client) SdkGenerateByAppForRegionWithChan(request *SdkGenerateByAppForRegionRequest) (<-chan *SdkGenerateByAppForRegionResponse, <-chan error) {\n\tresponseChan := make(chan *SdkGenerateByAppForRegionResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.SdkGenerateByAppForRegion(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "title": "" }, { "docid": "29fc7f51afa825bc42a97b44b7a6e14c", "score": "0.40864184", "text": "func (r *TeamAppsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]TeamsCatalogApp, error) {\n\treq, err := r.NewJSONRequest(method, path, obj)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif ctx != nil {\n\t\treq = req.WithContext(ctx)\n\t}\n\tres, err := r.client.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar values []TeamsCatalogApp\n\tfor {\n\t\tif res.StatusCode != http.StatusOK {\n\t\t\tb, _ := ioutil.ReadAll(res.Body)\n\t\t\tres.Body.Close()\n\t\t\terrRes := &ErrorResponse{Response: res}\n\t\t\terr := jsonx.Unmarshal(b, errRes)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"%s: %s\", res.Status, string(b))\n\t\t\t}\n\t\t\treturn nil, errRes\n\t\t}\n\t\tvar (\n\t\t\tpaging Paging\n\t\t\tvalue []TeamsCatalogApp\n\t\t)\n\t\terr := jsonx.NewDecoder(res.Body).Decode(&paging)\n\t\tres.Body.Close()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\terr = jsonx.Unmarshal(paging.Value, &value)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tvalues = append(values, value...)\n\t\tif n >= 0 {\n\t\t\tn--\n\t\t}\n\t\tif n == 0 || len(paging.NextLink) == 0 {\n\t\t\treturn values, nil\n\t\t}\n\t\treq, err = http.NewRequest(\"GET\", paging.NextLink, nil)\n\t\tif ctx != nil {\n\t\t\treq = req.WithContext(ctx)\n\t\t}\n\t\tres, err = r.client.Do(req)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2fef0bfff9bbbcc538197372a493bc4a", "score": "0.40853053", "text": "func Searchmanga(mangaName string) *[]Manga {\n\tmangaName = querySanitizer(mangaName)\n\tquery := \"manga-list.html?m_status=&author=&group=&name=\" + mangaName + \"&genre=&ungenre=\"\n\turl := baseURL + query\n\tmangas := []Manga{}\n\n\tc := colly.NewCollector(\n\t\tcolly.AllowedDomains(\"hanascan.com\"),\n\t\tcolly.Async(true),\n\t\tcolly.MaxDepth(10),\n\t)\n\n\tc.Limit(&colly.LimitRule{\n\t\tDomainGlob: \"*\",\n\t\tParallelism: 10,\n\t\tDelay: 5,\n\t})\n\n\tc.OnHTML(\".row .top .media-body\", func(e *colly.HTMLElement) {\n\t\tmanga := Manga{}\n\t\t// Finding the latest chapter on search page\n\t\te.ForEach(\"a\", func(_ int, elem *colly.HTMLElement) {\n\t\t\tnum := elem.Text\n\t\t\t// This bunch has also genres such as Action, Adventure. The last element is the\n\t\t\t// latest chapter.\n\t\t\tif res, err := strconv.Atoi(num); err == nil {\n\t\t\t\tmanga.LastChapter = res\n\t\t\t}\n\t\t})\n\n\t\t// Create the view for search result\n\t\te.ForEach(\"#tables\", func(_ int, elem *colly.HTMLElement) {\n\t\t\tmanga.URL = elem.ChildAttr(\"a\", \"href\")\n\t\t\tmanga.Title = elem.Text\n\t\t\tmanga.ChapterInfo = nil /*ChapterInfoExtractor(manga.URL)*/\n\t\t\tmangas = append(mangas, manga)\n\t\t})\n\n\t})\n\n\tc.OnRequest(func(r *colly.Request) {\n\t\tfmt.Println(\"Visiting..\", r.URL.String())\n\t})\n\n\tc.Visit(url)\n\tc.Wait()\n\tfmt.Printf(\"%+v\\n\", mangas)\n\n\treturn &mangas\n}", "title": "" }, { "docid": "d9bc367e53032d099143513f3dea0874", "score": "0.40841603", "text": "func (b bing) Search(term string, results chan<- []Result) {\n\tlog.Printf(\"Bing : Search : Started : search term [%s]\\n\", term)\n\n\t// Slice for the results.\n\tvar r []Result\n\n\t// Simulate an amount of time for the search.\n\ttime.Sleep(time.Millisecond * time.Duration(rand.Int63n(900)))\n\n\t// Simulate a result for the search.\n\tr = append(r, Result{\n\t\tEngine: \"Bing\",\n\t\tTitle: \"A Tour of Go\",\n\t\tDescription: \"Welcome to a tour of the Go programming language.\",\n\t\tLink: \"http://tour.golang.org/\",\n\t})\n\n\tlog.Printf(\"Bing : Search : Completed : Found[%d]\\n\", len(r))\n\tresults <- r\n}", "title": "" }, { "docid": "deadf32ecc39a3450679206a07c96c63", "score": "0.4072079", "text": "func (s *Session) ResidentialSearch(params types.SearchParameters) (*[]types.SearchResult, error) {\n\t// Clamp the page size\n\tparams.PageSize = 200\n\tresults := new([]types.SearchResult)\n\tc := make(chan *[]types.SearchResult)\n\te := make(chan error)\n\tfor page := 1; page < 6; page++ {\n\t\tgo s.searchPage(residentialURL, params, page, c, e)\n\t}\n\tfor i := 0; i < 5; i++ {\n\t\tselect {\n\t\tcase nextResults := <-c:\n\t\t\t*results = append(*results, *nextResults...)\n\t\tcase err := <-e:\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn results, nil\n}", "title": "" }, { "docid": "cf5d7e9d2b927cfb9f741b75b1f6a3aa", "score": "0.40346417", "text": "func (client *Client) ScanInvoiceWithCallback(request *ScanInvoiceRequest, callback func(response *ScanInvoiceResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *ScanInvoiceResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.ScanInvoice(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "title": "" }, { "docid": "1a110c3446e8559a662388e82aea7dd5", "score": "0.39964157", "text": "func (s *BitCaskSmiResultsPersister) GetResults(page, pageSize uint64) ([]byte, error) {\n\tif s.db == nil {\n\t\treturn nil, ErrDBConnection\n\t}\n\n\ttotal := s.db.Len()\n\n\tresults := []*SmiResult{}\n\n\tstart := page * pageSize\n\tend := (page+1)*pageSize - 1\n\tlogrus.Debugf(\"received page: %d, page size: %d, total: %d\", page, pageSize, total)\n\n\tlogrus.Debugf(\"computed start index: %d, end index: %d\", start, end)\n\n\tif start > uint64(total) {\n\t\treturn nil, fmt.Errorf(\"index out of range\")\n\t}\n\tvar localIndex uint64\n\n\tfor k := range s.db.Keys() {\n\t\tif localIndex >= start && localIndex <= end {\n\t\t\tdd, err := s.db.Get(k)\n\t\t\tif err != nil {\n\t\t\t\t//err = errors.Wrapf(err, \"Unable to read data from bitcask store\")\n\t\t\t\t//logrus.Error(err)\n\t\t\t\treturn nil, ErrDBRead(err)\n\t\t\t}\n\t\t\tif len(dd) > 0 {\n\t\t\t\tresult := &SmiResult{}\n\t\t\t\tif err := json.Unmarshal(dd, result); err != nil {\n\t\t\t\t\tobj := \"result data\"\n\t\t\t\t\t//err = errors.Wrapf(err, \"Unable to unmarshal data.\")\n\t\t\t\t\t//logrus.Error(err)\n\t\t\t\t\treturn nil, ErrUnmarshal(err, obj)\n\t\t\t\t}\n\t\t\t\tresults = append(results, result)\n\t\t\t}\n\t\t}\n\t\tlocalIndex++\n\t}\n\n\tbd, err := json.Marshal(&SmiResultPage{\n\t\tPage: page,\n\t\tPageSize: pageSize,\n\t\tTotalCount: total,\n\t\tResults: results,\n\t})\n\tif err != nil {\n\t\tobj := \"result data\"\n\t\t//err = errors.Wrapf(err, \"Unable to marshal result data.\")\n\t\treturn nil, ErrMarshal(err, obj)\n\t}\n\n\treturn bd, nil\n}", "title": "" }, { "docid": "5f5870b6e853485f7e5e87aa1f00056a", "score": "0.39901468", "text": "func (this *RedisDeployer) WaitOnApplication(timeout time.Duration) interface{} {\n\n\tticker := time.NewTicker(time.Millisecond * 500)\n\tdefer ticker.Stop()\n\n\tfor {\n\t\tselect {\n\t\tcase <-time.After(timeout):\n\t\t\treturn ErrTimeoutError\n\t\tcase <-ticker.C:\n\t\t\tif res := this.appRunning(); res != nil {\n\t\t\t\treturn res\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "fcc6044f42cd2e36f92ab70d0c8363a7", "score": "0.39844286", "text": "func InstagramQuery(url string, remainingImageCount int, c chan *ImageMetaData) (string, int) {\n\tresp, err := http.Get(url)\n\tif err != nil {\n\t\tlog.Println(\"Failed to search instagram\", err)\n\t}\n\n\t// Read the whole response from instagram, ignore the error\n\tbody, _ := ioutil.ReadAll(resp.Body)\n\tdefer resp.Body.Close()\n\n\tvar searchResponse InstagramSearchResponse\n\terr = json.Unmarshal(body, &searchResponse)\n\tif err != nil {\n\t\tlog.Println(\"Couldn't decode instagram search response\", err)\n\t}\n\n\tcount := 0\n\tfor _, im := range searchResponse.Data {\n\t\tif im.Type == \"image\" {\n\t\t\tvar metadata ImageMetaData\n\t\t\tmetadata.IgId = im.Id\n\t\t\tmetadata.FullSizeUrl = im.Images.StandardResolution.Url\n\t\t\tmetadata.SmallSizeUrl = im.Images.Thumbnail.Url\n\t\t\tmetadata.SmallDimensions.width = im.Images.Thumbnail.Width\n\t\t\tmetadata.SmallDimensions.height = im.Images.Thumbnail.Height\n\t\t\tc <- &metadata\n\t\t\tcount++\n\t\t}\n\t\tif remainingImageCount == count {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn searchResponse.Pagination.NextUrl, count\n}", "title": "" }, { "docid": "bf1159ec4c63a4d8c3c6dd78e5a739d5", "score": "0.3977621", "text": "func (c *ProjectsAgentSearchCall) Pages(ctx context.Context, f func(*GoogleCloudDialogflowV2SearchAgentsResponse) error) error {\n\tc.ctx_ = ctx\n\tdefer c.PageToken(c.urlParams_.Get(\"pageToken\")) // reset paging to original point\n\tfor {\n\t\tx, err := c.Do()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := f(x); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif x.NextPageToken == \"\" {\n\t\t\treturn nil\n\t\t}\n\t\tc.PageToken(x.NextPageToken)\n\t}\n}", "title": "" }, { "docid": "94223db9af4c242fd5d8e8e514e77ccc", "score": "0.3977161", "text": "func MakeSCRestAPICall(opCode int, relativePath string, params Params, cb zcncore.GetInfoCallback) {\n\tvar (\n\t\tresMaxCounterBody []byte\n\t\thashMaxCounter int\n\t\tmsg string\n\t\thashCounters = make(map[string]int)\n\t\tsharders = extractSharders()\n\t)\n\n\ttype queryResult struct {\n\t\thash string\n\t\tbody []byte\n\t}\n\n\tresults := make(chan *queryResult, len(sharders))\n\tdefer close(results)\n\n\tvar client = NewRetryableClient()\n\n\twg := &sync.WaitGroup{}\n\tfor _, sharder := range sharders {\n\t\twg.Add(1)\n\t\tgo func(sharderUrl string) {\n\t\t\tdefer wg.Done()\n\n\t\t\tvar u = makeURL(params, sharderUrl, relativePath)\n\t\t\tLogger.Info(\"Query \", u.String())\n\n\t\t\tresp, err := client.Get(u.String())\n\t\t\tif err != nil {\n\t\t\t\tLogger.Error(\"MakeSCRestAPICall - failed to get response from\", zap.String(\"URL\", sharderUrl), zap.Any(\"error\", err))\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif resp.StatusCode != http.StatusInternalServerError {\n\t\t\t\t//goland:noinspection ALL\n\t\t\t\tdefer resp.Body.Close()\n\t\t\t}\n\n\t\t\tif err != nil {\n\t\t\t\tLogger.Error(\"MakeSCRestAPICall - failed to get response from\", zap.String(\"URL\", sharderUrl), zap.Any(\"error\", err))\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif resp.StatusCode != http.StatusOK {\n\t\t\t\tLogger.Error(\"MakeSCRestAPICall - error getting response from\", zap.String(\"URL\", sharderUrl), zap.Any(\"error\", err))\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tLogger.Info(\"MakeSCRestAPICall successful query\")\n\n\t\t\thash, body, err := hashAndBytesOfReader(resp.Body)\n\t\t\tif err != nil {\n\t\t\t\tLogger.Error(\"MakeSCRestAPICall - error while reading response body\", zap.String(\"URL\", sharderUrl), zap.Any(\"error\", err))\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tLogger.Info(\"MakeSCRestAPICall push body to results: \", string(body))\n\n\t\t\tresults <- &queryResult{hash: hash, body: body}\n\t\t}(sharder)\n\t}\n\n\tLogger.Info(\"MakeSCRestAPICall waiting for response from all sharders\")\n\twg.Wait()\n\tLogger.Info(\"MakeSCRestAPICall closing results\")\n\n\tselect {\n\tcase result := <-results:\n\t\tLogger.Debug(\"request_sharders\", zap.String(\"received result\", result.hash), zap.String(\"received body\", string(result.body)))\n\t\thashCounters[result.hash]++\n\t\tif hashCounters[result.hash] > hashMaxCounter {\n\t\t\thashMaxCounter = hashCounters[result.hash]\n\t\t\tresMaxCounterBody = result.body\n\t\t}\n\tdefault:\n\t}\n\n\tif hashMaxCounter == 0 {\n\t\terr := errors.New(\"request_sharders\", \"no valid responses, last err: \"+msg)\n\t\tcb.OnInfoAvailable(opCode, zcncore.StatusError, \"\", err.Error())\n\t\tLogger.Error(err)\n\t\treturn\n\t}\n\n\tcb.OnInfoAvailable(opCode, zcncore.StatusSuccess, string(resMaxCounterBody), \"\")\n}", "title": "" }, { "docid": "7b405cbd6d078dfbc1eb74377670ae4d", "score": "0.39741462", "text": "func search(text string) (*handlers.SearchResponse, error) {\n\ts := struct {\n\t\tText string `json:\"text\"`\n\t}{\n\t\tText: text,\n\t}\n\n\tb, err := json.Marshal(s)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tendpoint := (\"/v1/search\")\n\treq, err := http.NewRequest(http.MethodGet, endpoint, bytes.NewBuffer(b))\n\tif err != nil {\n\t\terr = errors.Wrap(err, \"preparing search request\")\n\t\treturn nil, err\n\t}\n\n\tw := httptest.NewRecorder()\n\tts.App.ServeHTTP(w, req)\n\n\tvar res handlers.SearchResponse\n\td := web.Response{\n\t\tResults: &res,\n\t}\n\n\tif w.Code != http.StatusOK {\n\t\treturn nil, errors.New(\"received error performing search\")\n\t}\n\n\tif err := json.NewDecoder(w.Body).Decode(&d); err != nil {\n\t\treturn nil, errors.Wrap(err, \"unable to unmarshal json: %v\")\n\t}\n\n\treturn &res, nil\n}", "title": "" }, { "docid": "f865d4447e3d1d2bd53a9b87f143ec6d", "score": "0.3959947", "text": "func (client *Client) ScanInvoiceWithChan(request *ScanInvoiceRequest) (<-chan *ScanInvoiceResponse, <-chan error) {\n\tresponseChan := make(chan *ScanInvoiceResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.ScanInvoice(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "title": "" }, { "docid": "065cea8397b31e41c4699fd193899740", "score": "0.39597604", "text": "func (client ImagesClient) SearchResponder(resp *http.Response) (result Images, 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": "66ad82977f2a1827a4be28423533295f", "score": "0.3954885", "text": "func (client CardsClient) GetByCodeByNumberResponder(resp *http.Response) (result Card, err error) {\n err = autorest.Respond(\n resp,\n azure.WithErrorUnlessStatusCode(http.StatusOK),\n autorest.ByUnmarshallingJSON(&result),\n autorest.ByClosing())\n result.Response = autorest.Response{Response: resp}\n return\n }", "title": "" }, { "docid": "c82e7d2a1c9b2410817a135358017eb3", "score": "0.39539376", "text": "func (s *Scanner) ReadCodes(ctx context.Context) <-chan *code.Code {\n\n\tscanCtx, cancel := context.WithCancel(ctx)\n\n\tcodeChan := make(chan *code.Code)\n\tgo func() {\n\t\tdefer close(codeChan)\n\t\tfor {\n\t\t\tbuf := make([]byte, 255)\n\t\t\tn, err := s.device.ReadTimeout(buf, 500)\n\t\t\tif err != nil {\n\t\t\t\tcancel()\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif n > 0 {\n\t\t\t\tfmt.Println(buf)\n\t\t\t\tscannedCode, err := code.New(buf)\n\t\t\t\tif err != nil {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tcodeChan <- scannedCode\n\t\t\t}\n\n\t\t\tselect {\n\t\t\tcase <-scanCtx.Done():\n\t\t\t\ts.device.Close()\n\t\t\t\treturn\n\t\t\tdefault:\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn codeChan\n}", "title": "" }, { "docid": "65020645b2d6828bf31837a1d1062555", "score": "0.39492625", "text": "func CallProcessor(processor Processor, addrInput string, config Params, results chan<- Result) {\n\taddr, err := normalizeAddress(addrInput)\n\tif err != nil {\n\t\tresults <- resultError(err, addrInput)\n\t\treturn\n\t}\n\n\talgodDataURL := fmt.Sprintf(\"%s/v2/accounts/%s\", config.AlgodURL, addr)\n\tindexerDataURL := fmt.Sprintf(\"%s/v2/accounts/%s\", config.IndexerURL, addr)\n\n\t// Fetch algod account data outside the retry loop. When the data desynchronizes we'll keep fetching indexer data until it\n\t// catches up with the first algod account query.\n\talgodData, err := getData(algodDataURL, config.AlgodToken)\n\tif err != nil {\n\t\tresults <- resultError(err, addrInput)\n\t\treturn\n\t}\n\n\t// Retry loop.\n\tfor i := 0; true; i++ {\n\t\tindexerData, err := getData(indexerDataURL, config.IndexerToken)\n\t\tif err != nil {\n\t\t\tresults <- resultError(err, addrInput)\n\t\t\treturn\n\t\t}\n\n\t\tresult, err := processor.ProcessAddress(algodData, indexerData)\n\t\tif err != nil {\n\t\t\t// If there is an error return immediately and cram the error.\n\t\t\tresults <- Result{\n\t\t\t\tEqual: false,\n\t\t\t\tError: fmt.Errorf(\"error processing account %s: %v\", addr, err),\n\t\t\t\tRetries: i,\n\t\t\t\tDetails: &ErrorDetails{\n\t\t\t\t\tAddress: addr,\n\t\t\t\t},\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\tif result.Equal || result.SameRound || (i >= config.Retries) {\n\t\t\t// Return when results are equal, or when finished retrying.\n\t\t\tresult.Retries = i\n\t\t\tif result.Details != nil {\n\t\t\t\tresult.Details.Address = addr\n\t\t\t}\n\t\t\tresults <- result\n\t\t\treturn\n\t\t}\n\n\t\t// Wait before trying again to allow indexer to catch up to the algod account data.\n\t\ttime.Sleep(time.Duration(config.RetryDelayMS) * time.Millisecond)\n\t}\n}", "title": "" }, { "docid": "859fc30cf4648d2197a238bcc32af3ff", "score": "0.39481992", "text": "func search(term string) (string, error) {\n\ttime.Sleep(200 * time.Millisecond)\n\treturn \"some value\", nil\n}", "title": "" }, { "docid": "b1b5b65540b78b801fe9ef1e8170f82b", "score": "0.39375004", "text": "func (cli *Client) Search(query string) (*SearchResults, error) {\n\n\tvalidURL, err := url.Parse(fmt.Sprintf(\"https://urlscan.io/api/v1/search/?q=%s\", query))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq := fasthttp.AcquireRequest()\n\tresp := fasthttp.AcquireResponse()\n\tdefer fasthttp.ReleaseResponse(resp)\n\treq.Header.SetMethodBytes([]byte(\"GET\"))\n\treq.Header.SetUserAgent(\"urlscan-go client\")\n\treq.Header.SetContentType(\"application/json\")\n\treq.Header.Add(\"API-Key\", cli.Token)\n\treq.SetRequestURIBytes([]byte(validURL.String()))\n\n\terr = fasthttp.Do(req, resp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfasthttp.ReleaseRequest(req)\n\n\t//return resp.StatusCode(), resp.Body(), nil\n\n\tscode := resp.StatusCode()\n\tswitch scode {\n\tcase 429:\n\t\treturn nil, fmt.Errorf(\"rate limit exceeded\")\n\tcase 404:\n\t\treturn nil, fmt.Errorf(\"scan is not finished\")\n\tcase 200:\n\t\tbreak\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"status code: %d\", scode)\n\t}\n\n\tresult := &SearchResults{}\n\terr = json.Unmarshal(resp.Body(), result)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn result, nil\n}", "title": "" }, { "docid": "67c679b645554531f71dd6b0ec0cc0a9", "score": "0.39333245", "text": "func (client *Client) SearchOmsOpenAPIProjectsWithChan(request *SearchOmsOpenAPIProjectsRequest) (<-chan *SearchOmsOpenAPIProjectsResponse, <-chan error) {\n\tresponseChan := make(chan *SearchOmsOpenAPIProjectsResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.SearchOmsOpenAPIProjects(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "title": "" }, { "docid": "1ff76849ded4e56ebb1a24e95dc9d3e4", "score": "0.39285636", "text": "func (r *TeamInstalledAppsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]TeamsAppInstallation, error) {\n\treq, err := r.NewJSONRequest(method, path, obj)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif ctx != nil {\n\t\treq = req.WithContext(ctx)\n\t}\n\tres, err := r.client.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar values []TeamsAppInstallation\n\tfor {\n\t\tif res.StatusCode != http.StatusOK {\n\t\t\tb, _ := ioutil.ReadAll(res.Body)\n\t\t\tres.Body.Close()\n\t\t\terrRes := &ErrorResponse{Response: res}\n\t\t\terr := jsonx.Unmarshal(b, errRes)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"%s: %s\", res.Status, string(b))\n\t\t\t}\n\t\t\treturn nil, errRes\n\t\t}\n\t\tvar (\n\t\t\tpaging Paging\n\t\t\tvalue []TeamsAppInstallation\n\t\t)\n\t\terr := jsonx.NewDecoder(res.Body).Decode(&paging)\n\t\tres.Body.Close()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\terr = jsonx.Unmarshal(paging.Value, &value)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tvalues = append(values, value...)\n\t\tif n >= 0 {\n\t\t\tn--\n\t\t}\n\t\tif n == 0 || len(paging.NextLink) == 0 {\n\t\t\treturn values, nil\n\t\t}\n\t\treq, err = http.NewRequest(\"GET\", paging.NextLink, nil)\n\t\tif ctx != nil {\n\t\t\treq = req.WithContext(ctx)\n\t\t}\n\t\tres, err = r.client.Do(req)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n}", "title": "" }, { "docid": "8f2076942da5939143860da99438d8b8", "score": "0.39282596", "text": "func (o *GetCloudbreakEventsListByCrnParams) WithPage(page *int32) *GetCloudbreakEventsListByCrnParams {\n\to.SetPage(page)\n\treturn o\n}", "title": "" }, { "docid": "54272bab4d0dcbf4fa0ffbff98c0a6e1", "score": "0.3926804", "text": "func Search(page *agouti.Page) *SearchPage {\n\tsearch := SearchPage{\n\t\tSearchInput: page.FindByName(\"q\"),\n\t\tSButton: page.Find(\"asf\")}\n\treturn &search\n}", "title": "" }, { "docid": "181864f96a684f82f66da924bef4c489", "score": "0.39251313", "text": "func (client NewsClient) SearchResponder(resp *http.Response) (result News, 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": "422e478fe490e7c9c88f761228a3adbd", "score": "0.39227816", "text": "func scanWorker(host string, jobpipe chan uint64, respipe chan *ScanResult) {\n\tfor job := <-jobpipe; ; job = <-jobpipe {\n\t\trespipe <- scanPort(host, job)\n\t}\n}", "title": "" }, { "docid": "77a96c3cf87da9b4d963119f435fca5d", "score": "0.39185584", "text": "func main() {\n\tsearchTerm, numWorkers, links := parseCLI()\n\tc_links := make(chan string, len(links))\n\tc_results := make(chan Result, len(links))\n\t// Create our workers (goroutines) for processing urls\n\tfor i := uint(0); i < numWorkers; i++ {\n\t\tgo wordsOnPage(searchTerm, c_links, c_results)\n\t}\n\t// Add urls to links channel\n\tfor j := 0; j < len(links); j++ {\n\t\tc_links <- links[j]\n\t}\n\tclose(c_links) // Leave this alone now\n\t// Print whatever the workers bring back\n\tfor k := 0; k < len(links); k++ {\n\t\tfmt.Println(<-c_results)\n\t}\n\tclose(c_results) // All done, closing up shop\n\treturn\n}", "title": "" }, { "docid": "e2f7d6fe08b40a19b2496f05c2c0840c", "score": "0.39144063", "text": "func (bcs BotCommandSearch) getNResults(u url.URL, n int) (string, bool) {\n\tif bcs.Command == BotCommandMdnSearch {\n\t\treturn \"\", false\n\t}\n\tres, err := http.Get(u.String())\n\tif err != nil {\n\t\tfmt.Printf(\"Error in %T.getNResults\\nParams:%v\\nError:%v\", bcs, u, err)\n\t}\n\n\tdefer closeReader(res.Body)\n\n\tif res.StatusCode != 200 {\n\t\tfmt.Printf(\"status code error: %d %s\", res.StatusCode, res.Status)\n\t}\n\n\tdoc, err := goquery.NewDocumentFromReader(res.Body)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\n\tresults := make([]string, 0, n+1)\n\tswitch bcs.Command {\n\tcase BotCommandGoPkgSearch:\n\t\tresults = append(results, \"Here's what I found at pkg.go.dev...\")\n\t\tdoc.Find(\".SearchResults .LegacySearchSnippet\").Each(func(i int, s *goquery.Selection) {\n\t\t\tif i > 2 {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tvar rs string\n\t\t\tif link, exists := s.Find(\"a\").First().Attr(\"href\"); exists {\n\t\t\t\trs += formatUrlForMessage(u, link)\n\t\t\t\trs += s.Find(\"p.SearchSnippet-synopsis\").First().Text()\n\t\t\t}\n\n\t\t\tif rs != \"\" {\n\t\t\t\tresults = append(results, rs)\n\t\t\t}\n\t\t})\n\tcase BotCommandGithubSearch:\n\t\tresults = append(results, \"Here's what I found at the ol' Github...\")\n\t\tdoc.Find(\".repo-list-item\").Each(func(i int, s *goquery.Selection) {\n\t\t\tif i > 2 {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tvar rs string\n\t\t\tif link, exists := s.Find(\"a\").First().Attr(\"href\"); exists {\n\t\t\t\trs += formatUrlForMessage(u, link)\n\t\t\t\traw := s.Find(\"p\").First().Text()\n\t\t\t\ttrimmed := strings.Replace(raw, \"<em>\", \"\", -1)\n\t\t\t\ttrimmed = strings.Replace(trimmed, \"</em>\", \"\", -1)\n\t\t\t\ttrimmed = strings.Replace(trimmed, \"\\n\", \"\", -1)\n\t\t\t\trs += trimmed\n\t\t\t}\n\n\t\t\tif rs != \"\" {\n\t\t\t\tresults = append(results, rs)\n\t\t\t}\n\t\t})\n\t}\n\n\tif len(results) == 0 {\n\t\tresults = append(results, \"Seems like there wasn't anything to find. Sorry.\")\n\t}\n\n\treturn strings.Join(results, \"\\n\\n\"), true\n}", "title": "" }, { "docid": "2355fc4e1ac43584f2bcb55d72c767da", "score": "0.3906758", "text": "func (app *app) search() http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tvar paginationToken int\n\t\tvar category string\n\t\tvar err error\n\n\t\t// pagination token - initial request does not need to start with a page, so set to 0 if not present\n\t\ttoken := r.URL.Query().Get(\"token\")\n\t\tif token == \"\" {\n\t\t\tpaginationToken = 0\n\t\t} else {\n\t\t\tpaginationToken, err = strconv.Atoi(token)\n\t\t\tif err != nil {\n\t\t\t\tmessage := \"invalid request\"\n\t\t\t\thttp.Error(w, message, http.StatusBadRequest)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\tcategoryParam := r.URL.Query().Get(\"category\")\n\n\t\t// set default category if none present\n\t\tif categoryParam == \"\" {\n\t\t\tcategory = \"restaurant\"\n\t\t} else {\n\t\t\tcategory = categoryParam\n\t\t}\n\n\t\tresults, err := app.fetcher.Fetch(paginationToken, paginationToken+pageSize, category)\n\t\tif err != nil {\n\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\tfmt.Fprintf(w, \"oh shit\")\n\t\t}\n\n\t\terr = json.NewEncoder(w).Encode(results)\n\t\tif err != nil {\n\t\t\tstatus := http.StatusInternalServerError\n\t\t\thttp.Error(w, http.StatusText(status), status)\n\t\t\treturn\n\t\t}\n\t})\n}", "title": "" }, { "docid": "a281ff36b27f4c2a8e353ee83d6e7a83", "score": "0.3906734", "text": "func readStations(responses chan string, response string, items map[string]gasStation, typees map[string]string, wg *sync.WaitGroup, c1 *int, c2 *int, baseurl string, delay *time.Duration){\n \n var nstations, stations, nprov, ntype, aux, aux2 string\n tokens := strings.Split(response, \"<p>\")\n\n //test a valid response string\n if strings.Index(response,\" estaciones\")==-1 || strings.Index(tokens[1],\"</p>\")==-1 {\n return \n }\n\n //get number of stations from string in text to run the pagination loop if we are in the first page of a request for a Province and type\n nstations = tokens[1][0:strings.Index(tokens[1],\"</p>\")]\n nstations = nstations[0:strings.Index(nstations,\" estaciones\")]\n nstations = nstations[strings.LastIndex(nstations, \" \")+1:]\n \n //parse html to get items\n stations = tokens[1][strings.Index(tokens[1],\"<tbody>\"):]\n stations = stations[0:strings.LastIndex(stations, \"</tbody>\")]\n\n tr := strings.Split(stations, \"<tr \")\n\n if len(tr)==0 {\n return\n }\n\n aux = response[strings.LastIndex(response,\"||\")+2:]\n nprov = aux[0:strings.Index(aux,\"|\")] \n ntype = aux[strings.LastIndex(aux,\"|\")+1:] \n\n ajustCols := 0\n if ntype==\"8\" || ntype==\"16\" {\n ajustCols = 1\n }\n\n //starts routines for pages\n if strings.Index(response, \"{{first-request-}}\")>-1{\n if n, err := strconv.Atoi(nstations); err==nil {\n n = n/10 // pages have 10 records\n for k:=1; k<n+1; k++ {\n wg.Add(1)\n *c1++ \n *c2++\n go utils.Get(createURL(baseurl, strconv.Itoa(k*10), nprov, ntype), \"||\"+nprov+\"|\"+ntype, responses, wg, delay)\n time.Sleep(*delay * time.Millisecond)\n }\n }\n }\n \n getContent := func(s string, s1 string, s2 string) string{\n if strings.Index(s,s1)>-1 && strings.Index(s,s2)>-1{\n return strings.TrimRight(strings.TrimLeft(s[strings.Index(s,s1)+1:strings.Index(s,s2)], \" \"), \" \")\n }\n return \"\"\n }\n\n for i:=1; i<len(tr); i++ {\n props := strings.Split(tr[i],\"<td \")\n\n station := gasStation{}\n station.Province = getContent(props[1],\">\",\"<\")\n station.Address = getContent(props[3],\">\",\"<\")\n\n aux = getContent(props[11+ajustCols],\">\", \"</img>\")\n if len(aux)>0 {\n aux = aux[strings.LastIndex(aux,\"(\")+1:strings.LastIndex(aux,\")\")]\n aux2 = strings.Replace(aux[0:strings.Index(aux,\",\")],\",\",\".\",-1)\n if faux64, err := strconv.ParseFloat(aux2, 64); err == nil {\n station.Location.Coordinates[1] = faux64\n }\n aux2 = strings.Replace(aux[strings.Index(aux,\",\")+1:strings.LastIndex(aux,\",\")],\",\",\".\",-1)\n if faux64, err := strconv.ParseFloat(aux2, 64); err == nil {\n station.Location.Coordinates[0] = faux64\n }\n station.Location.Type = \"Point\"\n }\n\n if _, ok := items[station.Province+station.Address+strconv.FormatFloat(station.Location.Coordinates[0],'f',10,64)]; ok{\n station = items[station.Province+station.Address+strconv.FormatFloat(station.Location.Coordinates[0],'f',10,64)]\n } \n\n station.Locality = getContent(props[2],\">\",\"<\")\n station.Date = getContent(props[5],\">\",\"<\")\n if len(station.Types)==0 {\n station.Types = make(map[string]float64)\n }\n station.Name = getContent(props[7+ajustCols],\">\",\"<\")\n station.Id = strconv.FormatFloat(station.Location.Coordinates[0],'f',10,64) + \"|\" + strconv.FormatFloat(station.Location.Coordinates[1],'f',10,64)\n aux = strings.Replace(getContent(props[6],\">\",\"<\"),\",\",\".\",-1)\n if faux64, err := strconv.ParseFloat(aux, 64); err == nil{ \n station.Types[typees[ntype]] = faux64\n }\n station.FullText = utils.FlattenWord(\" \" + station.Name + \" \" + station.Locality + \" \" + station.Address + \" \" + station.Province + \" \")\n items[station.Province+station.Address+strconv.FormatFloat(station.Location.Coordinates[0],'f',10,64)] = station\n } \n}", "title": "" }, { "docid": "3ec0784e5e440f327776405755416a27", "score": "0.38942996", "text": "func (c *ProjectsLocationsCatalogsServingConfigsSearchCall) Pages(ctx context.Context, f func(*GoogleCloudRetailV2SearchResponse) error) error {\n\tc.ctx_ = ctx\n\tdefer func(pt string) { c.googlecloudretailv2searchrequest.PageToken = pt }(c.googlecloudretailv2searchrequest.PageToken) // reset paging to original point\n\tfor {\n\t\tx, err := c.Do()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := f(x); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif x.NextPageToken == \"\" {\n\t\t\treturn nil\n\t\t}\n\t\tc.googlecloudretailv2searchrequest.PageToken = x.NextPageToken\n\t}\n}", "title": "" }, { "docid": "8c1c22865ff7901b79b17f39bd66a176", "score": "0.3882732", "text": "func (client *Client) ListResourcesByAdvancedSearchWithCallback(request *ListResourcesByAdvancedSearchRequest, callback func(response *ListResourcesByAdvancedSearchResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *ListResourcesByAdvancedSearchResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.ListResourcesByAdvancedSearch(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "title": "" }, { "docid": "5a1a6b9dece16e0b40395d17c3e143fa", "score": "0.3880072", "text": "func (r *BckListTask) genNextPage(token string, cnt uint) error {\n\tif glog.FastV(4, glog.SmoduleAIS) {\n\t\tglog.Infof(\"[%s] token: %q\", r, r.msg.ContinuationToken)\n\t}\n\tif token != \"\" && token == r.token {\n\t\treturn nil\n\t}\n\n\t// Due to impossibility of getting object name from continuation token,\n\t// in case of Cloud, a target keeps only the entire last sent page.\n\t// The page is replaced with a new one when a client asks for next page.\n\tif r.fromRemote {\n\t\tr.token = token\n\t\treturn r.nextPageCloud()\n\t}\n\n\tif r.token > token {\n\t\tr.initTraverse() // Restart traversing as we cannot go back in time :(.\n\t\tr.lastPage = r.lastPage[:0]\n\t} else {\n\t\tif r.walkDone {\n\t\t\treturn nil\n\t\t}\n\t\tr.discardObsolete(token)\n\t}\n\tr.token = token\n\treturn r.nextPageAIS(cnt)\n}", "title": "" }, { "docid": "371fe5d610af6f2d9a983b971d47fdde", "score": "0.38763496", "text": "func (client CardsClient) SearchSender(req *http.Request) (*http.Response, error) {\n return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n }", "title": "" }, { "docid": "69dc9a09b2aeaf922182ead21f527706", "score": "0.38739803", "text": "func (client *Client) SearchOmsOpenAPIProjectsWithCallback(request *SearchOmsOpenAPIProjectsRequest, callback func(response *SearchOmsOpenAPIProjectsResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *SearchOmsOpenAPIProjectsResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.SearchOmsOpenAPIProjects(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "title": "" }, { "docid": "3cbe124429a0c094617ae5be7da31d58", "score": "0.3873596", "text": "func FetchAppsInfo(cfapp *cfenv.App, log *log.Logger) {\n\tlog.Println(\"running FetchAppsInfo cron\")\n\theritageClient := getHeritageClient(cfapp)\n\tcfclient := cf.NewCloudFoundryClient(heritageClient, log)\n\tappSearch := new(applications.AppSearch).Init(cfclient)\n\tappSearch.CompileAllApps()\n\tlocalCache.AppsBlob = appSearch.AppStats\n}", "title": "" }, { "docid": "feaf5da59d8c629fcd79c1d75477a45b", "score": "0.38711888", "text": "func SearchCall(request *restful.Request, response *restful.Response) {\n\ts := request.QueryParameter(\"s\")\n\te := request.QueryParameter(\"e\")\n\tr := SimpleRange(s, e)\n\n\tresponse.Write([]byte(r))\n}", "title": "" }, { "docid": "6506ee2364d122047f5498146ab6bf22", "score": "0.386236", "text": "func Search(alias, domain string, tracing bool) (response *SearchResponse, err error) {\n\n\t// Set the url for the request\n\treqURL := fmt.Sprintf(\"https://txt.%s/search/json?text=%s@%s\", bitPicURL, alias, domain)\n\n\t// Create a Client and start the request\n\tclient := resty.New().SetTimeout(defaultGetTimeout * time.Second)\n\tvar resp *resty.Response\n\treq := client.R().SetHeader(\"User-Agent\", UserAgent)\n\tif tracing {\n\t\treq.EnableTrace()\n\t}\n\tif resp, err = req.Get(reqURL); err != nil {\n\t\treturn\n\t}\n\n\t// Start the response\n\tresponse = new(SearchResponse)\n\n\t// Tracing enabled?\n\tif tracing {\n\t\tresponse.Tracing = resp.Request.TraceInfo()\n\t}\n\n\t// Check for a successful status code\n\tresponse.StatusCode = resp.StatusCode()\n\tif response.StatusCode != http.StatusOK && response.StatusCode != http.StatusNotModified {\n\t\terr = fmt.Errorf(\"bad response from bitpic provider: %d\", response.StatusCode)\n\t\treturn\n\t}\n\n\t// No profile result?\n\tif string(resp.Body()) == \"{}\" {\n\t\treturn\n\t}\n\n\t// Decode the body of the response\n\terr = json.Unmarshal(resp.Body(), &response)\n\n\treturn\n}", "title": "" }, { "docid": "2f06a1b449fc53e597a131a0ec80d7b0", "score": "0.38614026", "text": "func showIndexPage(ac pb.RecipesClient) gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\treq := &pb.Empty{}\n\t\trecipes, err := ac.ListRecipes(c, req)\n\n\t\tif err != nil {\n\t\t\tc.AbortWithError(http.StatusNotFound, err)\n\t\t\treturn\n\t\t}\n\n\t\ttitleList := recipes.GetTitle()\n\n\t\ttype Title struct {\n\t\t\tTitle string\n\t\t}\n\t\tvar titles []Title\n\t\tfor _, t := range titleList {\n\t\t\ttitles = append(titles, Title{Title: t})\n\t\t}\n\n\t\tc.HTML(\n\t\t\thttp.StatusOK,\n\t\t\t\"index.html\",\n\t\t\tgin.H{\n\t\t\t\t\"title\": \"Home Page\",\n\t\t\t\t\"payload\": titles,\n\t\t\t},\n\t\t)\n\t}\n}", "title": "" }, { "docid": "3b3f787e1e70eac6f08795d3e9dc6e2e", "score": "0.3857023", "text": "func (p *pages) handlePage(r *gdrive.FileList) error {\n\tfor _, f := range r.Files {\n\t\tif f.MimeType == \"application/vnd.google-apps.folder\" {\n\t\t\tcontinue\n\t\t}\n\t\tp.numFiles++\n\t\tif f.Properties != nil {\n\t\t\tif zb, ok := f.Properties[\"zb\"]; ok {\n\t\t\t\tif !*refresh {\n\t\t\t\t\tglog.V(2).Infof(\"Skipping file %s (%s) with zb: %s\", f.Name, f.Id, zb)\n\t\t\t\t\tp.skippedFiles++\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tglog.V(3).Infof(\"requesting processing of file: %s (%s)\", f.Name, f.Id)\n\t\tp.found <- f\n\t}\n\tglog.Infof(\"Processed %d files (%d completed).\", p.numFiles, p.skippedFiles)\n\treturn nil\n}", "title": "" }, { "docid": "9010ace77347192f2052c2ebf3d5041d", "score": "0.38518196", "text": "func (c *ProjectsJobsSearchForAlertCall) Pages(ctx context.Context, f func(*SearchJobsResponse) error) error {\n\tc.ctx_ = ctx\n\tdefer func(pt string) { c.searchjobsrequest.PageToken = pt }(c.searchjobsrequest.PageToken) // reset paging to original point\n\tfor {\n\t\tx, err := c.Do()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := f(x); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif x.NextPageToken == \"\" {\n\t\t\treturn nil\n\t\t}\n\t\tc.searchjobsrequest.PageToken = x.NextPageToken\n\t}\n}", "title": "" }, { "docid": "a78d5c137932f9fac7f6cb5ce60479fd", "score": "0.3838979", "text": "func (y yahoo) Search(term string, results chan<- []Result) {\n\tlog.Printf(\"Yahoo : Search : Started : search term [%s]\\n\", term)\n\n\t// Slice for the results.\n\tvar r []Result\n\n\t// Simulate an amount of time for the search.\n\ttime.Sleep(time.Millisecond * time.Duration(rand.Int63n(900)))\n\n\t// Simulate a result for the search.\n\tr = append(r, Result{\n\t\tEngine: \"Yahoo\",\n\t\tTitle: \"Go Playground\",\n\t\tDescription: \"The Go Playground is a web service that runs on golang.org's servers\",\n\t\tLink: \"http://play.golang.org/\",\n\t})\n\n\tlog.Printf(\"Yahoo : Search : Completed : Found[%d]\\n\", len(r))\n\tresults <- r\n}", "title": "" }, { "docid": "06e756be7163166d83c74ed0f80d3538", "score": "0.38388476", "text": "func (n *npiRegistry) Search(ctx context.Context, opt *SearchOpts) (*SearchResult, error) {\n\tp, err := url.Parse(SearchPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tu := n.baseURL\n\tq := u.Query()\n\tu = u.ResolveReference(p)\n\tq = opt.BuildQueryParams(q)\n\tu.RawQuery = q.Encode()\n\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq = req.WithContext(ctx)\n\n\treq.URL.RawQuery = opt.BuildQueryParams(req.URL.Query()).Encode()\n\n\tresp, err := n.client.Do(req)\n\tif err != nil {\n\t\t// If we got an error, and the context has been canceled,\n\t\t// the context's error is probably more useful.\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn nil, ctx.Err()\n\t\tdefault:\n\t\t\t// Do nothing\n\t\t}\n\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != 200 {\n\t\terrx := Error{}\n\t\terrx.Message = fmt.Sprintf(\"NPI Registry return a status of: %v\", resp.StatusCode)\n\t\terrx.Response.StatusCode = resp.StatusCode\n\t\tb, err := ioutil.ReadAll(resp.Body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\terrx.Response.Body = string(b)\n\t\treturn nil, errx\n\t}\n\n\tvar buf bytes.Buffer\n\n\ttee := io.TeeReader(resp.Body, &buf)\n\tb1, err := ioutil.ReadAll(tee)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tb2, err := ioutil.ReadAll(&buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsearchResult := &SearchResult{}\n\tunMarshalErr := json.Unmarshal(b2, &searchResult)\n\tif unMarshalErr != nil {\n\t\treturn nil, unMarshalErr\n\t}\n\tsearchResult.Raw = b1\n\n\treturn searchResult, nil\n}", "title": "" }, { "docid": "629e5d574096b7f2218bfb3a1906e663", "score": "0.38350517", "text": "func retrievePage(url string) *[]byte {\n\tfmt.Printf(\"--- URL: %v\\n\", url)\n\t// establish connection\n\tresp, err := http.Get(url)\n\tdefer resp.Body.Close() // close connection at end of func\n\tabortIfError(err)\n\n\t// retrieve json payload\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tabortIfError(err)\n\tif debug {\n\t\tfmt.Printf(\"*** Retrieved ***\\n%v\\n\", string(body))\n\t}\n\treturn &body\n}", "title": "" }, { "docid": "3d60ce36f59e29795f314655897bf1a2", "score": "0.38298532", "text": "func (client *Client) GetMockRuleByProviderAppIdWithChan(request *GetMockRuleByProviderAppIdRequest) (<-chan *GetMockRuleByProviderAppIdResponse, <-chan error) {\n\tresponseChan := make(chan *GetMockRuleByProviderAppIdResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.GetMockRuleByProviderAppId(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "title": "" }, { "docid": "2377c69d8eed76eaa6a5a9974e8eca66", "score": "0.3825608", "text": "func (o *GetCloudbreakEventsListByCrnParams) SetPage(page *int32) {\n\to.Page = page\n}", "title": "" }, { "docid": "32ebd8d84781f64f339758a22d2561e0", "score": "0.38253036", "text": "func (client CardsClient) Search(ctx context.Context, q string, unique UniqueStrategy, order SortOrder, dir SortDirection, includeExtras *bool, page *int32) (result CardList, err error) {\n if tracing.IsEnabled() {\n ctx = tracing.StartSpan(ctx, fqdn + \"/CardsClient.Search\")\n defer func() {\n sc := -1\n if result.Response.Response != nil {\n sc = result.Response.Response.StatusCode\n }\n tracing.EndSpan(ctx, sc, err)\n }()\n }\n req, err := client.SearchPreparer(ctx, q, unique, order, dir, includeExtras, page)\n if err != nil {\n err = autorest.NewErrorWithError(err, \"scryfall.CardsClient\", \"Search\", nil , \"Failure preparing request\")\n return\n }\n\n resp, err := client.SearchSender(req)\n if err != nil {\n result.Response = autorest.Response{Response: resp}\n err = autorest.NewErrorWithError(err, \"scryfall.CardsClient\", \"Search\", resp, \"Failure sending request\")\n return\n }\n\n result, err = client.SearchResponder(resp)\n if err != nil {\n err = autorest.NewErrorWithError(err, \"scryfall.CardsClient\", \"Search\", resp, \"Failure responding to request\")\n }\n\n return\n}", "title": "" }, { "docid": "0311bf5606c40c0da41c120b615c1210", "score": "0.38239622", "text": "func (c *CustomersReportsFindInstalledAppDevicesCall) Pages(ctx context.Context, f func(*GoogleChromeManagementV1FindInstalledAppDevicesResponse) error) error {\n\tc.ctx_ = ctx\n\tdefer c.PageToken(c.urlParams_.Get(\"pageToken\")) // reset paging to original point\n\tfor {\n\t\tx, err := c.Do()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := f(x); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif x.NextPageToken == \"\" {\n\t\t\treturn nil\n\t\t}\n\t\tc.PageToken(x.NextPageToken)\n\t}\n}", "title": "" }, { "docid": "b2df3a645cf95fcb8697521ace428ae8", "score": "0.38197008", "text": "func (r *OncallRead) search(q *msg.Request, mr *msg.Result) {\n\tvar (\n\t\toncallID, oncallName string\n\t\trows *sql.Rows\n\t\terr error\n\t)\n\n\tif rows, err = r.stmtSearch.Query(\n\t\tq.Search.Oncall.Name,\n\t); err != nil {\n\t\tmr.ServerError(err, q.Section)\n\t\treturn\n\t}\n\n\tfor rows.Next() {\n\t\tif err = rows.Scan(&oncallID, &oncallName); err != nil {\n\t\t\trows.Close()\n\t\t\tmr.ServerError(err, q.Section)\n\t\t\treturn\n\t\t}\n\t\tmr.Oncall = append(mr.Oncall, proto.Oncall{\n\t\t\tID: oncallID,\n\t\t\tName: oncallName,\n\t\t})\n\t}\n\tif err = rows.Err(); err != nil {\n\t\tmr.ServerError(err, q.Section)\n\t\treturn\n\t}\n\tmr.OK()\n}", "title": "" }, { "docid": "7a964ae9c0c128ab09d134035257d8de", "score": "0.38182566", "text": "func SearchResult(offset int, empName string) (string, error) {\n\tclient := &http.Client{\n\t\tTimeout: 10 * time.Second,\n\t}\n\n\tloadPayload := make(map[string]string)\n\n\tloadPayload[\"employee_id\"] = strconv.Itoa(offset)\n\tloadPayload[\"employee_name\"] = empName\n\n\tloadreq, err := json.Marshal(loadPayload)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t_, err = client.Post(dep+\"/load\", \"application/json\", bytes.NewBuffer((loadreq)))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\ttime.Sleep(10 * time.Second)\n\tbody := make(map[string]interface{})\n\n\tbody[\"key\"] = \"search\"\n\tbody[\"start\"] = strconv.Itoa(offset)\n\tbody[\"stop\"] = strconv.Itoa(offset + 10)\n\n\treqBody, err := json.Marshal(body)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// fetch the unique resuts in 10 search result from cache\n\tfmt.Println(\"send body:\", string(reqBody))\n\tres, err := client.Post(cep+\"/search\", \"application/json\", bytes.NewBuffer(reqBody))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tbd, _ := ioutil.ReadAll(res.Body)\n\treturn string(bd), nil\n}", "title": "" }, { "docid": "f0438633320835cac42c4c122ccbf29b", "score": "0.38123804", "text": "func scrape(url string, word string) ([]*Entry, error) {\n\tif word == \"\" {\n\t\treturn nil, errors.New(\"word cannot be empty\")\n\t}\n\n\treq, err := http.NewRequest(\"GET\", url, nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to initiate request to rae: %v\", err)\n\t}\n\treq.Header.Set(\"User-Agent\", \"\")\n\tclient := &http.Client{}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to make request to rae: %v\", err)\n\t}\n\n\tdefer resp.Body.Close()\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to read response body: %v\", err)\n\t}\n\n\tsolveRe := regexp.MustCompile(\"Please enable JavaScript to view the page content.\")\n\tif solveRe.Match(body) {\n\t\t// We need to do some work to get an actual response.\n\t\tbody, err = solve(body)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to solve challenge: %v\", err)\n\t\t}\n\t}\n\n\tdoc, err := goquery.NewDocumentFromReader(bytes.NewReader(body))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to parse response from rae: %v\", err)\n\t}\n\n\t// Look for entries.\n\tnodes := doc.Find(\"article\")\n\t// If no entries were found, there is probably a list of links to definitions.\n\tif nodes.Length() == 0 {\n\t\t// Choose the link for the word that is not a verb.\n\t\turl, err := findNonVerbURL(doc.Find(\"body\"))\n\t\tif err != nil {\n\t\t\treturn nil, NotFoundError{err}\n\t\t}\n\t\treturn scrape(raeAPI+url, word)\n\t}\n\n\tvar wg sync.WaitGroup\n\twg.Add(nodes.Length())\n\tentries := make([]*Entry, nodes.Length())\n\tnodes.Each(func(k int, s *goquery.Selection) {\n\t\t// Parallelize generating entries.\n\t\tgo func(k int, s *goquery.Selection) {\n\t\t\tetymology := s.Find(\"p.n2\").Text()\n\t\t\tdefs := make([]*Definition, 0)\n\t\t\tvars := make([]*Variation, 0)\n\n\t\t\ts.Find(\"p[class^='j']\").Each(func(i int, s *goquery.Selection) {\n\t\t\t\tdefs = append(defs, scrapeDefinition(s))\n\t\t\t})\n\n\t\t\ts.Find(\"p[class^='k']\").Each(func(i int, s *goquery.Selection) {\n\t\t\t\tvars = append(vars, &Variation{Variation: s.Text()})\n\n\t\t\t\ts.NextAll().EachWithBreak(func(_ int, s *goquery.Selection) bool {\n\t\t\t\t\tclass, _ := s.Attr(\"class\")\n\t\t\t\t\tif strings.HasPrefix(class, \"l\") {\n\t\t\t\t\t\td := &Definition{\n\t\t\t\t\t\t\tDefinition: s.Text(),\n\t\t\t\t\t\t\tOrigin: []string{},\n\t\t\t\t\t\t\tNotes: []string{},\n\t\t\t\t\t\t\tExamples: []string{},\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvars[i].Definitions = append(vars[i].Definitions, d)\n\t\t\t\t\t\treturn true\n\t\t\t\t\t}\n\t\t\t\t\tif class != \"m\" {\n\t\t\t\t\t\treturn false\n\t\t\t\t\t}\n\t\t\t\t\tvars[i].Definitions = append(vars[i].Definitions, scrapeDefinition(s))\n\t\t\t\t\treturn true\n\t\t\t\t})\n\t\t\t})\n\n\t\t\t// Insert directly into entries vs using a channel to guarantee order.\n\t\t\tentries[k] = &Entry{\n\t\t\t\tWord: word,\n\t\t\t\tEtymology: etymology,\n\t\t\t\tDefinitions: defs,\n\t\t\t\tVariations: vars,\n\t\t\t}\n\t\t\twg.Done()\n\t\t}(k, s)\n\t})\n\n\twg.Wait()\n\treturn entries, nil\n}", "title": "" }, { "docid": "54a5c2f62f5437e096d1e75ffda88de3", "score": "0.3811486", "text": "func (recv *FindController) SearchFinish() {\n\tC.webkit_find_controller_search_finish((*C.WebKitFindController)(recv.native))\n\n\treturn\n}", "title": "" }, { "docid": "f9880e408cd662b67c1c44809046e781", "score": "0.3809964", "text": "func (client *Client) SearchBodyWithCallback(request *SearchBodyRequest, callback func(response *SearchBodyResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *SearchBodyResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.SearchBody(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "title": "" }, { "docid": "27328c977620ac7eea32e3fbe6e56538", "score": "0.38037392", "text": "func (p *ListSnapshotsInRecycleBinPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListSnapshotsInRecycleBinOutput, error) {\n\tif !p.HasMorePages() {\n\t\treturn nil, fmt.Errorf(\"no more pages available\")\n\t}\n\n\tparams := *p.params\n\tparams.NextToken = p.nextToken\n\n\tvar limit *int32\n\tif p.options.Limit > 0 {\n\t\tlimit = &p.options.Limit\n\t}\n\tparams.MaxResults = limit\n\n\tresult, err := p.client.ListSnapshotsInRecycleBin(ctx, &params, optFns...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tp.firstPage = false\n\n\tprevToken := p.nextToken\n\tp.nextToken = result.NextToken\n\n\tif p.options.StopOnDuplicateToken &&\n\t\tprevToken != nil &&\n\t\tp.nextToken != nil &&\n\t\t*prevToken == *p.nextToken {\n\t\tp.nextToken = nil\n\t}\n\n\treturn result, nil\n}", "title": "" }, { "docid": "c1e6181d715dbccbebc7dd34eaf3ca0c", "score": "0.38027418", "text": "func paginator(resource string, params Query) chan Response {\n\n\tch := make(chan Response)\n\n\tgo func() {\n\n\t\tvar offset int\n\t\tlimit := MaxLimitResponseSize\n\t\tfor {\n\n\t\t\t//Set pagination parameters\n\t\t\tparams[\"limit\"] = strconv.Itoa(limit)\n\t\t\tparams[\"offset\"] = strconv.Itoa(offset)\n\n\t\t\tdata, err := get(resource, params)\n\t\t\tif err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tvar resp Response\n\t\t\terr = json.Unmarshal(data, &resp)\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"Could not unmarshal. %s\", err)\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tch <- resp\n\n\t\t\toffset += limit\n\t\t\tif offset > resp.TotalCount {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tclose(ch)\n\t}()\n\treturn ch\n}", "title": "" }, { "docid": "8af05f6facb28d72c39fcb4cbeaf3bf5", "score": "0.37985575", "text": "func receive(page_lst *Pages){\n\tfor i:=0; i < len(backends); i++{\n\t\tif backends[i].status == true{\n\t\t\tfmt.Fprintf(backends[i].server, \"readR\")\n\t\t\terr := backends[i].decoder.Decode(page_lst)\n\t\t\tif err != nil{\n\t\t\t\tfmt.Println(err.Error())\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "94d2966a5caab62075b1bb98ff485de5", "score": "0.37953085", "text": "func (client *Client) SearchBodyWithChan(request *SearchBodyRequest) (<-chan *SearchBodyResponse, <-chan error) {\n\tresponseChan := make(chan *SearchBodyResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.SearchBody(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "title": "" }, { "docid": "902e23fa19d54c4d47e6babf4b948d8d", "score": "0.3794839", "text": "func (fetcher *Fetcher) FetchPage(config *data.UserPagemonitor) error {\n\terr := func() error {\n\t\tpage := fetcher.getPreviousResult(config)\n\n\t\tresp, err := fetcher.Client.Get(config.URL)\n\t\tif err == nil {\n\t\t\tdefer resp.Body.Close()\n\t\t}\n\n\t\tif err == nil && resp.StatusCode != http.StatusOK {\n\t\t\terr = fmt.Errorf(\"cannot GET page (status code %v)\", resp.StatusCode)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"cannot GET page %v: %w\", config, err)\n\t\t}\n\n\t\ttext, err := convertHTMLtoText(resp.Body)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"cannot convert HTML to text %v: %w\", config, err)\n\t\t}\n\n\t\tvar textFiltered, previousTextFiltered string\n\t\tif config.Match != \"\" {\n\t\t\tregex, err := regexp.Compile(config.Match)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"cannot compile match regex %v: %w\", config, err)\n\t\t\t}\n\t\t\ttextFiltered = regex.ReplaceAllString(text, config.Replace)\n\t\t\tpreviousTextFiltered = regex.ReplaceAllString(page.Contents, config.Replace)\n\t\t} else {\n\t\t\ttextFiltered = text\n\t\t\tpreviousTextFiltered = page.Contents\n\t\t}\n\n\t\tif previousTextFiltered == textFiltered {\n\t\t\t// Save if nothing changed to update last seen time\n\t\t\treturn fetcher.DB.SavePage(page)\n\t\t}\n\n\t\tdiff, err := difflib.GetUnifiedDiffString(difflib.UnifiedDiff{\n\t\t\tA: difflib.SplitLines(previousTextFiltered),\n\t\t\tB: difflib.SplitLines(textFiltered),\n\t\t\tContext: 3,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"cannot create diff for page %v: %w\", config, err)\n\t\t}\n\t\tpage.Delta = diff\n\t\tpage.Contents = text\n\t\tpage.Updated = time.Now()\n\t\tpage.Config = config\n\t\terr = fetcher.DB.SetReadStatusForAll(config.CreateKey(), false)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"cannot mark page %v as unread: %w\", config, err)\n\t\t}\n\n\t\tlog.WithField(\"value\", page).WithField(\"page\", config).WithField(\"delta\", page.Delta).Debug(\"Page has changed\")\n\n\t\treturn fetcher.DB.SavePage(page)\n\t}()\n\n\tfetchStatus := &data.FetchStatus{}\n\tif err != nil {\n\t\tlog.WithField(\"page\", config).WithError(err).Error(\"Failed to get page\")\n\t\tfetchStatus.LastFailure = time.Now()\n\t} else {\n\t\tfetchStatus.LastSuccess = time.Now()\n\t}\n\n\tfetchStatusKey := config.CreateKey()\n\tif err := fetcher.DB.SetFetchStatus(fetchStatusKey, fetchStatus); err != nil {\n\t\tlog.WithField(\"page\", config).WithError(err).Error(\"Failed to save fetch status for page\")\n\t}\n\treturn err\n}", "title": "" }, { "docid": "c1400dc63de5d738a4e193f6b89df665", "score": "0.37890905", "text": "func callServiceAsync(service func(a int) Result, results chan<- Result, wg *sync.WaitGroup, value int) {\n\tresults <- service(value)\n\twg.Done()\n}", "title": "" }, { "docid": "1847679543c6a3d55143142891d212dd", "score": "0.37817475", "text": "func (client *Client) SdkGenerateByAppForRegionWithCallback(request *SdkGenerateByAppForRegionRequest, callback func(response *SdkGenerateByAppForRegionResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *SdkGenerateByAppForRegionResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.SdkGenerateByAppForRegion(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "title": "" }, { "docid": "cd3014c08e3cc07b3f17536d90bc7ca1", "score": "0.3777936", "text": "func scanHandler(w http.ResponseWriter, r *http.Request) error {\n\tif err := r.ParseForm(); err != nil {\n\t\tlog.Warningf(\"failed to parse body: %v\", err)\n\t\treturn errors.NewBadRequest(err)\n\t}\n\n\tfamily := r.Form.Get(\"family\")\n\tscanner := r.Form.Get(\"scanner\")\n\tip := r.Form.Get(\"ip\")\n\ttimeoutStr := r.Form.Get(\"timeout\")\n\tvar timeout time.Duration\n\tvar err error\n\tif timeoutStr != \"\" {\n\t\tif timeout, err = time.ParseDuration(timeoutStr); err != nil {\n\t\t\treturn errors.NewBadRequest(err)\n\t\t}\n\t\tif timeout < time.Second || timeout > 5*time.Minute {\n\t\t\treturn errors.NewBadRequestString(\"invalid timeout given\")\n\t\t}\n\t} else {\n\t\ttimeout = time.Minute\n\t}\n\n\thost := r.Form.Get(\"host\")\n\tif host == \"\" {\n\t\tlog.Warningf(\"no host given\")\n\t\treturn errors.NewBadRequestString(\"no host given\")\n\t}\n\n\tresults, err := scan.Default.RunScans(host, ip, family, scanner, timeout)\n\tif err != nil {\n\t\treturn errors.NewBadRequest(err)\n\t}\n\n\treturn json.NewEncoder(w).Encode(api.NewSuccessResponse(results))\n}", "title": "" }, { "docid": "18860112c4a499c2041760a2382bcf92", "score": "0.37776062", "text": "func (recv *FindController) Search(searchText string, findOptions uint32, maxMatchCount uint32) {\n\tc_search_text := C.CString(searchText)\n\tdefer C.free(unsafe.Pointer(c_search_text))\n\n\tc_find_options := (C.guint32)(findOptions)\n\n\tc_max_match_count := (C.guint)(maxMatchCount)\n\n\tC.webkit_find_controller_search((*C.WebKitFindController)(recv.native), c_search_text, c_find_options, c_max_match_count)\n\n\treturn\n}", "title": "" }, { "docid": "4221e20c3cf0d4c2f8a7b7f82dfa26b2", "score": "0.37725332", "text": "func (gb GoogleBooks) Search(search string) (*Response, error) {\n\turl := fmt.Sprintf(\"%s?q=intitle:%s&key=%s\", gb.baseURL, search, gb.apiKey)\n\tresp, err := gb.client.Get(url)\n\n\tdefer func() {\n\t\tif resp != nil {\n\t\t\tif err := resp.Body.Close(); err != nil {\n\t\t\t\tgb.log(\"google books has failed to close Response body\",\n\t\t\t\t\t\"error\", err,\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t}()\n\n\tif err != nil {\n\t\t_, _ = ioutil.ReadAll(resp.Body)\n\t\treturn nil, err\n\t}\n\n\tvar response Response\n\tif err := json.NewDecoder(resp.Body).Decode(&response); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(response.Items) > gb.resultLimit {\n\t\tresponse.Items = response.Items[:gb.resultLimit]\n\t}\n\n\treturn &response, nil\n}", "title": "" }, { "docid": "9a5ff65d6f9e001fd7117359b4aa7139", "score": "0.37641945", "text": "func (ex *Executor) Scrap(ctx context.Context, scrapfile string) error {\n\tex.ctx = ctx\n\n\terr := ex.declareTask(scrapfile)\n\tif err != nil {\n\t\treturn err\n\t}\n\tgo ex.selector()\n\tgo ex.appsBatch()\n\n\tlast, _ := ex.cache.GetV(\"last\")\n\tcachedBundles, err := ex.cache.GetV(\"bundles\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tbundles, ok := cachedBundles.([]string)\n\tstartAt := 0\n\tex.logger.Log(\"last bundle\", last)\n\tif last != nil {\n\t\tl := last.(string)\n\t\tfor i, b := range bundles {\n\t\t\tif b == l {\n\t\t\t\tstartAt = i\n\t\t\t}\n\t\t}\n\t}\n\tif !ok {\n\t\treturn errors.New(\"can not convert bundles\")\n\t}\n\n\tex.storeApps(true, bundles[startAt:]...)\n\tif err := ex.keyCache.Distinct(); err != nil {\n\t\treturn err\n\t}\n\n\t<-ex.wait\n\n\treturn nil\n}", "title": "" }, { "docid": "34541e8b6612f6fc49dc739e870b2722", "score": "0.37619004", "text": "func (p *SearchResourcesPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*SearchResourcesOutput, error) {\n\tif !p.HasMorePages() {\n\t\treturn nil, fmt.Errorf(\"no more pages available\")\n\t}\n\n\tparams := *p.params\n\tparams.NextToken = p.nextToken\n\n\tvar limit *int32\n\tif p.options.Limit > 0 {\n\t\tlimit = &p.options.Limit\n\t}\n\tparams.MaxResults = limit\n\n\tresult, err := p.client.SearchResources(ctx, &params, optFns...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tp.firstPage = false\n\n\tprevToken := p.nextToken\n\tp.nextToken = result.NextToken\n\n\tif p.options.StopOnDuplicateToken && prevToken != nil && p.nextToken != nil && *prevToken == *p.nextToken {\n\t\tp.nextToken = nil\n\t}\n\n\treturn result, nil\n}", "title": "" }, { "docid": "d0308c5814b4a114f378d3fc45fad83b", "score": "0.3761233", "text": "func CodeIndex(w http.ResponseWriter, r *http.Request) {\n\tcodes := &Code{}\n\tprettyPrint := getPrettyPrintValue(r)\n\tqueryFields := getQueryFieldsValue(r)\n\tsortFields := getSortFields(r)\n\tif sortFields == \"\" {\n\t\tsortFields = \" \"\n\t}\n\n\tfields := splitCommaFieldsToMap(queryFields)\n\tif queryFields == \"\" {\n\t\tfields = nil\n\t}\n\n\tvar results []Code\n\n\terr := All(codes).Sort(sortFields).Select(fields).All(&results)\n\tif err != nil {\n\t\tfmt.Printf(\"got an error finding code for %s\\n\", err)\n\t\thandleError(w, 404)\n\t\treturn\n\t}\n\n\tJSON(w, results, prettyPrint, 200)\n}", "title": "" }, { "docid": "48a8b02590f623ca3926b5c8aa0c3a3a", "score": "0.37580314", "text": "func scanqrcodeHandler(w http.ResponseWriter, r *http.Request) {\n\tprefix := fmt.Sprintf(\"[%s]\", \"scanQrcodeHandler\")\n\tglog.Infof(\"%s %s %s\", prefix, r.Method, r.RequestURI)\n\n\toauth2RedirectURI := fmt.Sprintf(\"https://%s/backend/scanqrcode\", domain)\n\toauth2Scope := \"snsapi_base\"\n\toauth2State := \"scanqrcode\"\n\tAuthCodeURL := mpoauth2.AuthCodeURL(wxAppId, oauth2RedirectURI, oauth2Scope, oauth2State)\n\n\tqueryValues, err := url.ParseQuery(r.URL.RawQuery)\n\tif err != nil {\n\t\tglog.Errorf(\"%s cannot parse url querystring, err %s\", prefix, err)\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tcode := queryValues.Get(\"code\")\n\tstate := queryValues.Get(\"state\")\n\n\t//request isn't redirected by wechat, return notice page\n\tif code == \"\" || state == \"\" {\n\t\tglog.Infof(\"%s request isn't redirect by weixin, return notice page\")\n\t\thttp.Redirect(w, r, AuthCodeURL, http.StatusFound)\n\t\treturn\n\t}\n\n\tvar openId string\n\tvar sid string\n\tvar validSession bool = false\n\n\tcookie, err := r.Cookie(\"sid\")\n\t//no cookie sid\n\tif err == nil {\n\t\tglog.Infof(\"%s get cookie sid %s\", prefix, cookie.Value)\n\t\topenId, err = parseSession(cookie.Value)\n\t\tif err == nil {\n\t\t\tvalidSession = true\n\t\t\tglog.Infof(\"%s session is valid, user openid %s\", prefix, openId)\n\t\t}\n\t} else {\n\t\tglog.Infof(\"%s no cookie sid\", prefix)\n\t}\n\n\t//cookie is not exist or invalid cookie\n\tif !validSession {\n\t\tglog.Infof(\"%s cookie not exist or invalid cookie, generating newOne\", prefix)\n\t\t//get openid\n\t\topenId, err = getUserOpenId(code)\n\t\tif err != nil {\n\t\t\tglog.Errorf(\"%s cannot get user openid from wechat, err %s\", prefix, err)\n\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tglog.Infof(\"%s get user openid %s\", prefix, openId)\n\n\t\t//set session\n\t\tsid, err = newSession(openId)\n\t\tif err != nil {\n\t\t\tglog.Errorf(\"%s cannot get new session, err %s\", prefix, err)\n\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\tcookie := http.Cookie{\n\t\t\tName: \"sid\",\n\t\t\tValue: sid,\n\t\t\tHttpOnly: true,\n\t\t}\n\t\thttp.SetCookie(w, &cookie)\n\t\tglog.Infof(\"%s new session create for user with openid %s\", prefix, openId)\n\t}\n\n\tuser := User{}\n\tdb.Debug().Where(\"wx_openid = ?\", openId).First(&user)\n\tif user.ID == 0 {\n\t\t// openid isn't related to a user\n\t\tglog.Infof(\"%s openid is not related to a user\", prefix)\n\t\t//redirectURIPrefix := fmt.Sprintf(\"https://%s/backend/%%s\", domain)\n\t\t//oauth2Scope := \"snsapi_base\"\n\t\t//bindingRedirectURI := fmt.Sprintf(redirectURIPrefix, \"binding\")\n\t\t//bindingState := \"binding\"\n\t\t//bindingURI := mpoauth2.AuthCodeURL(wxAppId, bindingRedirectURI, oauth2Scope, bindingState)\n\t\tmsgbody := fmt.Sprintf(\"在菜单中或绑定企业,绑定企业后再进行拍照,谢谢\")\n\t\tn := NoticePage{Domain: domain, Title: \"扫描监控地点二维码\", Type: noticePagefail, Msgtitle: \"用户未绑定企业\", Msgbody: msgbody}\n\t\tnoticepageTmpl := template.Must(template.New(\"noticepage\").Parse(myTemplate.NOTICEPAGE))\n\t\tnoticepageTmpl.Execute(w, n)\n\t\tnoticepageTmpl.Execute(os.Stdout, n)\n\t\treturn\n\t}\n\n\tcompany := Company{}\n\tdb.Debug().First(&company, user.CompanyId)\n\n\t// openid is related to a user\n\tnonceStr := string(rand.NewHex())\n\ttimeNow := time.Now().Unix()\n\tticket, err := ticketServer.Ticket()\n\t//cannot get ticket\n\tif err != nil {\n\t\terrmsg := fmt.Sprintf(\"cannot get ticket %s\", err)\n\t\tglog.Errorf(\"%s %s\", prefix, errmsg)\n\t\treturn\n\t}\n\n\tvar jssdkObj struct {\n\t\tDomain string\n\t\tTimestamp string\n\t\tNoncestr string\n\t\tWxappid string\n\t\tSignature string\n\t\tTitle string\n\t\tUser string\n\t\tCompany string\n\t\tPhone string\n\t}\n\tjssdkObj.Domain = domain\n\tjssdkObj.Timestamp = fmt.Sprintf(\"%d\", timeNow)\n\tjssdkObj.Noncestr = nonceStr\n\tjssdkObj.Wxappid = wxAppId\n\tjssdkObj.Signature = jssdk.WXConfigSign(ticket, nonceStr, jssdkObj.Timestamp, fmt.Sprintf(\"https://%s%s\", domain, r.URL))\n\tjssdkObj.User = user.Name\n\tjssdkObj.Company = company.Name\n\tjssdkObj.Phone = user.Phone\n\n\tglog.Infof(\"%s get ticket %s, signature %s, noncestr %s, uri %s\", prefix, ticket, jssdkObj.Signature, nonceStr, r.URL)\n\tglog.Infof(\"%s user %s, phone %s, company %s\", prefix, jssdkObj.User, jssdkObj.Phone, jssdkObj.Company)\n\tscanqrcodeTmpl := template.Must(template.New(\"scanqrcode\").Parse(myTemplate.SCANQRCODE))\n\tscanqrcodeTmpl.Execute(w, jssdkObj)\n\tscanqrcodeTmpl.Execute(os.Stdout, jssdkObj)\n\tw.WriteHeader(http.StatusOK)\n\tglog.Infof(\"%s end of scanqrcode\", prefix)\n\treturn\n}", "title": "" }, { "docid": "aaf6751dd739f4212673528e4b21ee90", "score": "0.37416446", "text": "func (client *Client) ListResourcesByAdvancedSearchWithChan(request *ListResourcesByAdvancedSearchRequest) (<-chan *ListResourcesByAdvancedSearchResponse, <-chan error) {\n\tresponseChan := make(chan *ListResourcesByAdvancedSearchResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.ListResourcesByAdvancedSearch(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "title": "" }, { "docid": "038fa80275adc37b4ed7462473675710", "score": "0.37363696", "text": "func Page(recipients ...Device) PageApp {\n\treturn PageApp{\n\t\tRecipients: recipients,\n\t}\n}", "title": "" }, { "docid": "05f86badc1dbdafb9eb9ac124d537769", "score": "0.37348416", "text": "func wordsOnPage(word string, links chan string, results chan Result) {\n\t// Loop over every entry in buffered channel links\n\tfor link := range links {\n\t\t// Issue a GET to the url, store data in resp, error in err\n\t\tresp, err := http.Get(link)\n\t\tif err != nil {\n\t\t\t// Get() returns error, URL not open\n\t\t\tresults <- Result{link, 0, err}\n\t\t} else if resp.Status != \"200 OK\" {\n\t\t\t// Something went wrong opening URL\n\t\t\tresErr := errors.New(\"Did not receive 200 OK\")\n\t\t\tresults <- Result{link, 0, resErr}\n\t\t} else {\n\t\t\t// No errors detected\n\t\t\twordCount, resErr := countOccurrences(word, resp.Body)\n\t\t\tresults <- Result{link, wordCount, resErr}\n\t\t}\n\t}\n\treturn\n}", "title": "" } ]
d51511dde8c5d4457fe0518755f9d324
NewCreateOauthAppReq instantiates a new CreateOauthAppReq 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": "c03424ed17599b3784fb67b48fdbade1", "score": "0.74025005", "text": "func NewCreateOauthAppReq() *CreateOauthAppReq {\n\tthis := CreateOauthAppReq{}\n\treturn &this\n}", "title": "" } ]
[ { "docid": "34578bd61925d21698fa0d27b8a50b42", "score": "0.7201669", "text": "func NewCreateOauthAppReqWithDefaults() *CreateOauthAppReq {\n\tthis := CreateOauthAppReq{}\n\treturn &this\n}", "title": "" }, { "docid": "858bd06a4bd6e9a639c538524b01ade5", "score": "0.58690083", "text": "func NewAndroidForWorkSettingsRequestSignupUrlPostRequestBody()(*AndroidForWorkSettingsRequestSignupUrlPostRequestBody) {\n m := &AndroidForWorkSettingsRequestSignupUrlPostRequestBody{\n }\n m.backingStore = ie8677ce2c7e1b4c22e9c3827ecd078d41185424dd9eeb92b7d971ed2d49a392e.BackingStoreFactoryInstance();\n m.SetAdditionalData(make(map[string]any))\n return m\n}", "title": "" }, { "docid": "0055e7a43fb0e9f014663e16d6dd9146", "score": "0.5792966", "text": "func (o *CreateAppParams) 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\t// header param Authorization\n\tif err := r.SetHeaderParam(\"Authorization\", o.Authorization); err != nil {\n\t\treturn err\n\t}\n\n\tif o.CreateOrUpdateAppRequest != nil {\n\t\tif err := r.SetBodyParam(o.CreateOrUpdateAppRequest); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.RequireConfirmation != nil {\n\n\t\t// query param requireConfirmation\n\t\tvar qrRequireConfirmation bool\n\t\tif o.RequireConfirmation != nil {\n\t\t\tqrRequireConfirmation = *o.RequireConfirmation\n\t\t}\n\t\tqRequireConfirmation := swag.FormatBool(qrRequireConfirmation)\n\t\tif qRequireConfirmation != \"\" {\n\t\t\tif err := r.SetQueryParam(\"requireConfirmation\", qRequireConfirmation); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.SignatureType != nil {\n\n\t\t// query param signatureType\n\t\tvar qrSignatureType string\n\t\tif o.SignatureType != nil {\n\t\t\tqrSignatureType = *o.SignatureType\n\t\t}\n\t\tqSignatureType := qrSignatureType\n\t\tif qSignatureType != \"\" {\n\t\t\tif err := r.SetQueryParam(\"signatureType\", qSignatureType); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b5730091d388adbcd7141dfc90fc2cf4", "score": "0.56790537", "text": "func NewDeleteAppRequestWithoutParam() *DeleteAppRequest {\n\n return &DeleteAppRequest{\n JDCloudRequest: core.JDCloudRequest{\n URL: \"/regions/{regionId}/app/{clientId}\",\n Method: \"DELETE\",\n Header: nil,\n Version: \"v1\",\n },\n }\n}", "title": "" }, { "docid": "a50c9de5c74a648a2793db06d15865fb", "score": "0.5675628", "text": "func NewRequest(apiToken, method, url string, formData *url.Values) *Request {\n return &Request{\n ApiToken: apiToken,\n FormData: formData,\n Method: method,\n Url: url,\n }\n}", "title": "" }, { "docid": "df77c65ab36626251489bf26a30a58fb", "score": "0.5642647", "text": "func (c *ConfigService) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\t// Run custom request initialization if present\n\tif initRequest != nil {\n\t\tinitRequest(req)\n\t}\n\n\treturn req\n}", "title": "" }, { "docid": "d02302ef21ce5e4076f6e652f2b766de", "score": "0.56144595", "text": "func (s *AuthService) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := s.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "2924bb442d05e798172d60fd1caedaa2", "score": "0.557441", "text": "func (s *AccessTokenValidatorsService) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := s.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "77a3adb43718678b67c7beeb1ab9bc2b", "score": "0.55064327", "text": "func (c *CodeDeploy) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\t// Run custom request initialization if present\n\tif initRequest != nil {\n\t\tinitRequest(req)\n\t}\n\n\treturn req\n}", "title": "" }, { "docid": "fae96f9b5e2344225f35236590e28abf", "score": "0.547355", "text": "func (c *WAF) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\t// Run custom request initialization if present\n\tif initRequest != nil {\n\t\tinitRequest(req)\n\t}\n\n\treturn req\n}", "title": "" }, { "docid": "cbe20c67790b2c5fee7eecac7a22fd0c", "score": "0.544486", "text": "func (c *CustomRequest) New(tag int) *CustomRequest {\n\n\tif tag <= 0 {\n\t\tlog.Error(\"invalid string passed to method New(tag int) when try create CustomRequest\")\n\t}\n\tc.setAPIKey()\n\tc.encodeTag(tag)\n\treturn c\n}", "title": "" }, { "docid": "0146a739badb06a30ab32fd1606d0556", "score": "0.5413541", "text": "func (rm *resourceManager) newCreateRequestPayload(\n\tctx context.Context,\n\tr *resource,\n) (*svcsdk.CreateBrokerRequest, error) {\n\tres := &svcsdk.CreateBrokerRequest{}\n\n\tif r.ko.Spec.AuthenticationStrategy != nil {\n\t\tres.SetAuthenticationStrategy(*r.ko.Spec.AuthenticationStrategy)\n\t}\n\tif r.ko.Spec.AutoMinorVersionUpgrade != nil {\n\t\tres.SetAutoMinorVersionUpgrade(*r.ko.Spec.AutoMinorVersionUpgrade)\n\t}\n\tif r.ko.Spec.Name != nil {\n\t\tres.SetBrokerName(*r.ko.Spec.Name)\n\t}\n\tif r.ko.Spec.Configuration != nil {\n\t\tf3 := &svcsdk.ConfigurationId{}\n\t\tif r.ko.Spec.Configuration.ID != nil {\n\t\t\tf3.SetId(*r.ko.Spec.Configuration.ID)\n\t\t}\n\t\tif r.ko.Spec.Configuration.Revision != nil {\n\t\t\tf3.SetRevision(*r.ko.Spec.Configuration.Revision)\n\t\t}\n\t\tres.SetConfiguration(f3)\n\t}\n\tif r.ko.Spec.CreatorRequestID != nil {\n\t\tres.SetCreatorRequestId(*r.ko.Spec.CreatorRequestID)\n\t}\n\tif r.ko.Spec.DeploymentMode != nil {\n\t\tres.SetDeploymentMode(*r.ko.Spec.DeploymentMode)\n\t}\n\tif r.ko.Spec.EncryptionOptions != nil {\n\t\tf6 := &svcsdk.EncryptionOptions{}\n\t\tif r.ko.Spec.EncryptionOptions.KMSKeyID != nil {\n\t\t\tf6.SetKmsKeyId(*r.ko.Spec.EncryptionOptions.KMSKeyID)\n\t\t}\n\t\tif r.ko.Spec.EncryptionOptions.UseAWSOwnedKey != nil {\n\t\t\tf6.SetUseAwsOwnedKey(*r.ko.Spec.EncryptionOptions.UseAWSOwnedKey)\n\t\t}\n\t\tres.SetEncryptionOptions(f6)\n\t}\n\tif r.ko.Spec.EngineType != nil {\n\t\tres.SetEngineType(*r.ko.Spec.EngineType)\n\t}\n\tif r.ko.Spec.EngineVersion != nil {\n\t\tres.SetEngineVersion(*r.ko.Spec.EngineVersion)\n\t}\n\tif r.ko.Spec.HostInstanceType != nil {\n\t\tres.SetHostInstanceType(*r.ko.Spec.HostInstanceType)\n\t}\n\tif r.ko.Spec.LDAPServerMetadata != nil {\n\t\tf10 := &svcsdk.LdapServerMetadataInput{}\n\t\tif r.ko.Spec.LDAPServerMetadata.Hosts != nil {\n\t\t\tf10f0 := []*string{}\n\t\t\tfor _, f10f0iter := range r.ko.Spec.LDAPServerMetadata.Hosts {\n\t\t\t\tvar f10f0elem string\n\t\t\t\tf10f0elem = *f10f0iter\n\t\t\t\tf10f0 = append(f10f0, &f10f0elem)\n\t\t\t}\n\t\t\tf10.SetHosts(f10f0)\n\t\t}\n\t\tif r.ko.Spec.LDAPServerMetadata.RoleBase != nil {\n\t\t\tf10.SetRoleBase(*r.ko.Spec.LDAPServerMetadata.RoleBase)\n\t\t}\n\t\tif r.ko.Spec.LDAPServerMetadata.RoleName != nil {\n\t\t\tf10.SetRoleName(*r.ko.Spec.LDAPServerMetadata.RoleName)\n\t\t}\n\t\tif r.ko.Spec.LDAPServerMetadata.RoleSearchMatching != nil {\n\t\t\tf10.SetRoleSearchMatching(*r.ko.Spec.LDAPServerMetadata.RoleSearchMatching)\n\t\t}\n\t\tif r.ko.Spec.LDAPServerMetadata.RoleSearchSubtree != nil {\n\t\t\tf10.SetRoleSearchSubtree(*r.ko.Spec.LDAPServerMetadata.RoleSearchSubtree)\n\t\t}\n\t\tif r.ko.Spec.LDAPServerMetadata.ServiceAccountPassword != nil {\n\t\t\tf10.SetServiceAccountPassword(*r.ko.Spec.LDAPServerMetadata.ServiceAccountPassword)\n\t\t}\n\t\tif r.ko.Spec.LDAPServerMetadata.ServiceAccountUsername != nil {\n\t\t\tf10.SetServiceAccountUsername(*r.ko.Spec.LDAPServerMetadata.ServiceAccountUsername)\n\t\t}\n\t\tif r.ko.Spec.LDAPServerMetadata.UserBase != nil {\n\t\t\tf10.SetUserBase(*r.ko.Spec.LDAPServerMetadata.UserBase)\n\t\t}\n\t\tif r.ko.Spec.LDAPServerMetadata.UserRoleName != nil {\n\t\t\tf10.SetUserRoleName(*r.ko.Spec.LDAPServerMetadata.UserRoleName)\n\t\t}\n\t\tif r.ko.Spec.LDAPServerMetadata.UserSearchMatching != nil {\n\t\t\tf10.SetUserSearchMatching(*r.ko.Spec.LDAPServerMetadata.UserSearchMatching)\n\t\t}\n\t\tif r.ko.Spec.LDAPServerMetadata.UserSearchSubtree != nil {\n\t\t\tf10.SetUserSearchSubtree(*r.ko.Spec.LDAPServerMetadata.UserSearchSubtree)\n\t\t}\n\t\tres.SetLdapServerMetadata(f10)\n\t}\n\tif r.ko.Spec.Logs != nil {\n\t\tf11 := &svcsdk.Logs{}\n\t\tif r.ko.Spec.Logs.Audit != nil {\n\t\t\tf11.SetAudit(*r.ko.Spec.Logs.Audit)\n\t\t}\n\t\tif r.ko.Spec.Logs.General != nil {\n\t\t\tf11.SetGeneral(*r.ko.Spec.Logs.General)\n\t\t}\n\t\tres.SetLogs(f11)\n\t}\n\tif r.ko.Spec.MaintenanceWindowStartTime != nil {\n\t\tf12 := &svcsdk.WeeklyStartTime{}\n\t\tif r.ko.Spec.MaintenanceWindowStartTime.DayOfWeek != nil {\n\t\t\tf12.SetDayOfWeek(*r.ko.Spec.MaintenanceWindowStartTime.DayOfWeek)\n\t\t}\n\t\tif r.ko.Spec.MaintenanceWindowStartTime.TimeOfDay != nil {\n\t\t\tf12.SetTimeOfDay(*r.ko.Spec.MaintenanceWindowStartTime.TimeOfDay)\n\t\t}\n\t\tif r.ko.Spec.MaintenanceWindowStartTime.TimeZone != nil {\n\t\t\tf12.SetTimeZone(*r.ko.Spec.MaintenanceWindowStartTime.TimeZone)\n\t\t}\n\t\tres.SetMaintenanceWindowStartTime(f12)\n\t}\n\tif r.ko.Spec.PubliclyAccessible != nil {\n\t\tres.SetPubliclyAccessible(*r.ko.Spec.PubliclyAccessible)\n\t}\n\tif r.ko.Spec.SecurityGroups != nil {\n\t\tf14 := []*string{}\n\t\tfor _, f14iter := range r.ko.Spec.SecurityGroups {\n\t\t\tvar f14elem string\n\t\t\tf14elem = *f14iter\n\t\t\tf14 = append(f14, &f14elem)\n\t\t}\n\t\tres.SetSecurityGroups(f14)\n\t}\n\tif r.ko.Spec.StorageType != nil {\n\t\tres.SetStorageType(*r.ko.Spec.StorageType)\n\t}\n\tif r.ko.Spec.SubnetIDs != nil {\n\t\tf16 := []*string{}\n\t\tfor _, f16iter := range r.ko.Spec.SubnetIDs {\n\t\t\tvar f16elem string\n\t\t\tf16elem = *f16iter\n\t\t\tf16 = append(f16, &f16elem)\n\t\t}\n\t\tres.SetSubnetIds(f16)\n\t}\n\tif r.ko.Spec.Tags != nil {\n\t\tf17 := map[string]*string{}\n\t\tfor f17key, f17valiter := range r.ko.Spec.Tags {\n\t\t\tvar f17val string\n\t\t\tf17val = *f17valiter\n\t\t\tf17[f17key] = &f17val\n\t\t}\n\t\tres.SetTags(f17)\n\t}\n\tif r.ko.Spec.Users != nil {\n\t\tf18 := []*svcsdk.User{}\n\t\tfor _, f18iter := range r.ko.Spec.Users {\n\t\t\tf18elem := &svcsdk.User{}\n\t\t\tif f18iter.ConsoleAccess != nil {\n\t\t\t\tf18elem.SetConsoleAccess(*f18iter.ConsoleAccess)\n\t\t\t}\n\t\t\tif f18iter.Groups != nil {\n\t\t\t\tf18elemf1 := []*string{}\n\t\t\t\tfor _, f18elemf1iter := range f18iter.Groups {\n\t\t\t\t\tvar f18elemf1elem string\n\t\t\t\t\tf18elemf1elem = *f18elemf1iter\n\t\t\t\t\tf18elemf1 = append(f18elemf1, &f18elemf1elem)\n\t\t\t\t}\n\t\t\t\tf18elem.SetGroups(f18elemf1)\n\t\t\t}\n\t\t\tif f18iter.Password != nil {\n\t\t\t\ttmpSecret, err := rm.rr.SecretValueFromReference(ctx, f18iter.Password)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tif tmpSecret != \"\" {\n\t\t\t\t\tf18elem.SetPassword(tmpSecret)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif f18iter.Username != nil {\n\t\t\t\tf18elem.SetUsername(*f18iter.Username)\n\t\t\t}\n\t\t\tf18 = append(f18, f18elem)\n\t\t}\n\t\tres.SetUsers(f18)\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "af046c9a21c421e16eb6c7e61abc752a", "score": "0.53608125", "text": "func (c *Client) newRequest(method, urlStr string, body interface{}) (*http.Request, error) {\n\tu, err := c.BaseURL.Parse(urlStr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar buf io.ReadWriter\n\tif body != nil {\n\t\tbuf = new(bytes.Buffer)\n\t\tenc := json.NewEncoder(buf)\n\t\tenc.SetEscapeHTML(false)\n\t\tif err := enc.Encode(body); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treq, err := http.NewRequest(method, u.String(), buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif body != nil {\n\t\treq.Header.Set(\"Content-Type\", \"application/json\")\n\t}\n\n\treq.Header.Set(\"Authorization\", c.token)\n\treq.Header.Set(\"User-Agent\", \"bitrise-add-new-project/0.14\")\n\n\treturn req, nil\n}", "title": "" }, { "docid": "3b35c416a3b54461de6372d5d0b75506", "score": "0.5354012", "text": "func new(clientID, clientSecret, email, appName, callbackURL string) *Basecampclient {\n\tc := &Basecampclient{\n\t\tappName: appName,\n\t\temail: email,\n\t\tid: 0,\n\t\tstate: xid.New().String(),\n\t\tcode: \"\",\n\t\ttoken: &oauth2.Token{},\n\t\toauthConfig: &oauth2.Config{\n\t\t\tRedirectURL: callbackURL,\n\t\t\tClientID: clientID,\n\t\t\tClientSecret: clientSecret,\n\t\t\tScopes: []string{},\n\t\t\tEndpoint: oauth2.Endpoint{\n\t\t\t\tAuthStyle: oauth2.AuthStyleAutoDetect,\n\t\t\t\tAuthURL: \"https://launchpad.37signals.com/authorization/new\",\n\t\t\t\tTokenURL: \"https://launchpad.37signals.com/authorization/token\",\n\t\t\t},\n\t\t},\n\t\thttpclient: http.DefaultClient,\n\t}\n\tclients = append(clients, c)\n\treturn c\n}", "title": "" }, { "docid": "10a1874ca1c57719713cda4d66fa655a", "score": "0.53428996", "text": "func newKeyCreateRequest(db *sql.DB, endpoint *model.RemoteEndpoint, data *json.RawMessage) (Request, error) {\n\trequest := &KeyCreateRequest{}\n\tif err := json.Unmarshal(*data, request); err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to unmarshal request json: %v\", err)\n\t}\n\trequest.endpoint = endpoint\n\trequest.db = db\n\treturn request, nil\n}", "title": "" }, { "docid": "34a71d6e28427a9cf961203ce0d19660", "score": "0.53422767", "text": "func CreateDescribeCloudAppRequest() (request *DescribeCloudAppRequest) {\nrequest = &DescribeCloudAppRequest{\nRpcRequest: &requests.RpcRequest{},\n}\nrequest.InitWithApiInfo(\"AMS\", \"2016-02-01\", \"DescribeCloudApp\", \"\", \"\")\nreturn\n}", "title": "" }, { "docid": "2400e0b5375cc08902113d70991ba06c", "score": "0.5332596", "text": "func (c *CodePipeline) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\t// Run custom request initialization if present\n\tif initRequest != nil {\n\t\tinitRequest(req)\n\t}\n\n\treturn req\n}", "title": "" }, { "docid": "4c3e7e334ef6b404f79ba8da24aef4fc", "score": "0.53289914", "text": "func newClient(clientid string, clientsecret string) *Gotappd {\n\tapi := Gotappd{}\n\n\tapi.clientid = clientid\n\tapi.clientsecret = clientsecret\n\t\n\treturn &api\n}", "title": "" }, { "docid": "27087697d82b91d40dca5f981237c7f9", "score": "0.5320153", "text": "func (c *InputService3ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "6dd827572f29af785f96afa2cf925f5c", "score": "0.53190786", "text": "func New(d ...dict.Dict) RequestArgs {\n\tif len(d) == 0 || len(d[0]) == 0 {\n\t\treturn RequestArgs(dict.New())\n\t}\n\tif len(d) > 1 {\n\t\tpanic(\"len(d) > 1\")\n\t}\n\treturn RequestArgs(d[0].Clone())\n}", "title": "" }, { "docid": "66a7ec5ecbc66ff1f2c17dca7e624bc7", "score": "0.5285046", "text": "func (c *InputService2ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "bd4666b64a376b3f67d20223490cae2b", "score": "0.5276741", "text": "func (c *InputService1ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "515492d64e845acbe7243c41954fe600", "score": "0.52638245", "text": "func (c Choice) CreateAPIRequest(t auth.AccessToken) *http.Request {\n\t// TODO: Find a way to get the current token and when it was cached (which\n\t// is held in the db) from here. May need to take a look at changing\n\t// architecture a bit.\n\treq, err := http.NewRequest(c.APIMethod, c.APIRoute, nil)\n\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tos.Exit(1)\n\t}\n\n\treq.Header.Add(\"Authorization\", fmt.Sprintf(\"Bearer %s\", t.Token))\n\treq.Header.Add(\"Content-Type\", \"application/x-www-form-urlencoded\")\n\treq.Header.Add(\"Accept\", \"application/json\")\n\treturn req\n}", "title": "" }, { "docid": "14a302c2569c6d8eae8c1a3af1d186e8", "score": "0.52509", "text": "func NewCreateAppParams() *CreateAppParams {\n\tvar ()\n\treturn &CreateAppParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "bc65467a731d0520f18586b51c9eaa86", "score": "0.5250186", "text": "func (c *InputService4ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "200927996b123025f369229416a3b685", "score": "0.52203244", "text": "func (c *InputService10ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "41166de2f4848fc23640120f6d85e0c8", "score": "0.52063656", "text": "func (c *InputService11ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "9dbae5f7e73f0cdcad844011a57453c7", "score": "0.52062356", "text": "func newKeyGenerateRequest(db *sql.DB, endpoint *model.RemoteEndpoint, data *json.RawMessage) (Request, error) {\n\trequest := &KeyGenerateRequest{}\n\tif err := json.Unmarshal(*data, request); err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to unmarshal request json: %v\", err)\n\t}\n\trequest.endpoint = endpoint\n\trequest.db = db\n\treturn request, nil\n}", "title": "" }, { "docid": "34359db6c5cc6c0360c0486a0a6f7c35", "score": "0.51987886", "text": "func NewApprovalSettings()(*ApprovalSettings) {\n m := &ApprovalSettings{\n }\n m.SetAdditionalData(make(map[string]interface{}));\n return m\n}", "title": "" }, { "docid": "4d559ae65a1faa09b096653310580eee", "score": "0.51958966", "text": "func newRequest(method, route string, config Config, body io.Reader) *http.Request {\n\treq, err := http.NewRequest(method, config.API.ToURL(route), body)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tos.Exit(1)\n\t}\n\treq.Header.Set(\"Authorization\", config.Auth.AccessKey)\n\treturn req\n}", "title": "" }, { "docid": "e44ca3bb7ac1ce17e0261bf7ce44b65d", "score": "0.51838297", "text": "func (c *Client) newRequest(method string, urlStr string, body interface{}) (*http.Request, error) {\n\tu, err := c.BaseURL.Parse(urlStr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbuf := new(bytes.Buffer)\n\tif body != nil {\n\t\terr = json.NewEncoder(buf).Encode(body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treq, err := http.NewRequest(method, u.String(), buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Add(\"Content-Type\", mediaType)\n\treq.Header.Add(\"Accept\", mediaType)\n\tif c.Token != \"\" {\n\t\treq.Header.Add(\"X-Auth-Header\", c.Token)\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "03ac67b0a6dd4edb0da1da6f3318acec", "score": "0.5179643", "text": "func (c *InputService8ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "25ea9622c8fb1051bebe509839790cd2", "score": "0.5159969", "text": "func (c *InputService5ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "702af20907e798db9172bab50fe8a7a4", "score": "0.5157435", "text": "func (c *InputService7ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "af1e372f431d0bc9b2198648fc1c94cd", "score": "0.51470095", "text": "func (c *InputService9ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "3d5f3fe696f87f5118f1852527318afc", "score": "0.51291883", "text": "func NewAppCredentialSignInActivity()(*AppCredentialSignInActivity) {\n m := &AppCredentialSignInActivity{\n Entity: *NewEntity(),\n }\n return m\n}", "title": "" }, { "docid": "0af13e885e084eda7150140dfc1bd298", "score": "0.5118269", "text": "func newRegistrationRequest(registrationURL string, client *ClientMetadata) (*http.Request, error) {\n\t// TODO This should accept a `map[string]interface{}`\n\tb, err := json.Marshal(client)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := http.NewRequest(http.MethodPost, registrationURL, bytes.NewReader(b))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treq.Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "53a0085514dc4933c8a547035a3a141c", "score": "0.5108282", "text": "func NewApplication(name, vendor, version string) *ApiApplication {\n\tif name == \"\" {\n\t\tname = \"TempApp\"\n\t}\n\tif vendor == \"\" {\n\t\tvendor = \"TempVendor\"\n\t}\n\tif version == \"\" {\n\t\tversion = \"v1.0.1\"\n\t}\n\treturn &ApiApplication{\n\t\tName: name,\n\t\tVendor: vendor,\n\t\tVersion: version,\n\t}\n}", "title": "" }, { "docid": "616c72417ffd690a5a3dbe2e963a0779", "score": "0.51066226", "text": "func newClient(c clientConfig) (client, error) {\n\tif c.app.tokenURL == \"\" {\n\t\tc.app.tokenURL = tokenURL\n\t}\n\n\tif c.app.unauthenticated() {\n\t\treturn &appClient{\n\t\t\tapp: &c.app,\n\t\t}, nil\n\t}\n\n\tif err := c.app.validateAuth(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn newAppClient(c)\n}", "title": "" }, { "docid": "b2b5addd215b671f135dde0a05758dcb", "score": "0.510101", "text": "func NewApp(clientId string, description string, id string, name string, scopes string, type_ AppType, ) *App {\n\tthis := App{}\n\tthis.ClientId = clientId\n\tthis.Description = description\n\tthis.Id = id\n\tthis.Name = name\n\tthis.Scopes = scopes\n\tthis.Type = type_\n\treturn &this\n}", "title": "" }, { "docid": "1c409f026f9f82d1d73cbb4e43e41f93", "score": "0.5089298", "text": "func (c *Client) newRequest(method, url string, body ...io.Reader) *http.Request {\n\tvar bodyR io.Reader\n\tif len(body) > 0 {\n\t\tbodyR = body[0]\n\t}\n\tif len(body) > 1 {\n\t\tpanic(\"too many body arguments\")\n\t}\n\treq, err := http.NewRequest(method, url, bodyR)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\t// not done by http.NewRequest in Go 1.0:\n\tif br, ok := bodyR.(*bytes.Reader); ok {\n\t\treq.ContentLength = int64(br.Len())\n\t}\n\tc.authMode.AddAuthHeader(req)\n\treturn req\n}", "title": "" }, { "docid": "739f2c1c2694fa7e3019194f248a011a", "score": "0.50807333", "text": "func newReq(verb string, reqURL string, authHeader string) *http.Response {\n\treq, err := http.NewRequest(verb, reqURL, nil)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\n\tif authHeader != \"\" {\n\t\treq.Header.Set(\"Authorization\", authHeader)\n\t}\n\n\t// \"Do\" the request\n\tclient := &http.Client{}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\n\treturn resp\n}", "title": "" }, { "docid": "5dcd603518bf24d8ef4fce8a80799841", "score": "0.507009", "text": "func CreateStartAppRequest() (request *StartAppRequest) {\n\trequest = &StartAppRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"rtc\", \"2018-01-11\", \"StartApp\", \"rtc\", \"openAPI\")\n\treturn\n}", "title": "" }, { "docid": "4774a62e13ffd37e4f6ad1f9339b8a8e", "score": "0.5059273", "text": "func MakeCreateAppRequestFromNativeAppPost(f NativeAppPost) CreateAppRequest {\n\treturn CreateAppRequest{nativeAppPost: &f}\n}", "title": "" }, { "docid": "f677d736304f73ecbd53cbfa6c8449a9", "score": "0.5049525", "text": "func (c *OutputService1ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "dc7106ae849b2c66e289e36d3d7235ff", "score": "0.50466555", "text": "func (c *OutputService2ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "fe37cb380134b88e1a03cff600919a38", "score": "0.50428665", "text": "func (c *OutputService3ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "e137672e9ed6588e530843d1172d1636", "score": "0.5017077", "text": "func (c *Client) newRequest(ctx context.Context, method, path, contentType string, body io.Reader) (*http.Request, error) {\n\tif !strings.HasPrefix(path, \"/\") {\n\t\tpath = \"/\" + path\n\t}\n\tpath = prodAPIURL + path\n\n\treq, err := http.NewRequestWithContext(ctx, method, path, body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif contentType != \"\" {\n\t\treq.Header.Add(\"Content-Type\", contentType)\n\t}\n\n\treq.Header.Add(\"Authorization\", \"Bearer \"+c.bearerToken)\n\n\treturn req, nil\n}", "title": "" }, { "docid": "9a85476755397ca8885974beadc9f147", "score": "0.5008447", "text": "func NewRequest() *Request {\n\tr := &Request{\n\t\tSettings: make(map[string]json.RawMessage, 0),\n\t}\n\treturn r\n}", "title": "" }, { "docid": "7afe5d4088d62fe8faa08e19f8385c0c", "score": "0.50082594", "text": "func NewRequest(client *http.Client, method string, baseURL *url.URL, token string, basicAuth *BasicAuth, headers map[string]string) *Request {\n\treturn &Request{\n\t\tclient: client,\n\t\tmethod: method,\n\t\ttoken: token,\n\t\tbasicAuth: basicAuth,\n\t\theaders: headers,\n\t\tbaseURL: baseURL,\n\t\tapiPrefix: defaultAPIPrefix,\n\t\tapiVersion: defaultAPIVersion,\n\t}\n}", "title": "" }, { "docid": "85b4ebc1ba88ac1e13673fc4a2c3cb40", "score": "0.50075966", "text": "func NewCreateAppDefault(code int) *CreateAppDefault {\n\tif code <= 0 {\n\t\tcode = 500\n\t}\n\n\treturn &CreateAppDefault{\n\t\t_statusCode: code,\n\t}\n}", "title": "" }, { "docid": "367ea38c643d0105dd15f6f88744f807", "score": "0.5006193", "text": "func MakeCreateAppRequestFromServiceAppPost(f ServiceAppPost) CreateAppRequest {\n\treturn CreateAppRequest{serviceAppPost: &f}\n}", "title": "" }, { "docid": "c67533a5f7f28d26de328ec363fd8f47", "score": "0.5006073", "text": "func NewRequest(typ CmdType, pointer interface{}, ctxs ...kvrpcpb.Context) *Request {\n\tif len(ctxs) > 0 {\n\t\treturn &Request{\n\t\t\tType: typ,\n\t\t\tReq: pointer,\n\t\t\tContext: ctxs[0],\n\t\t}\n\t}\n\treturn &Request{\n\t\tType: typ,\n\t\tReq: pointer,\n\t}\n}", "title": "" }, { "docid": "145ad088b6aca6e5f8c531ad78515144", "score": "0.50039554", "text": "func (c *InputService6ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "34b078dcb2d01239872a41a06cc08a5d", "score": "0.5001422", "text": "func oidcAppCreate(d *schema.ResourceData, m interface{}) error {\n\toidcApp, err := appschema.Inflate(map[string]interface{}{\n\t\t\"name\": d.Get(\"name\"),\n\t\t\"description\": d.Get(\"description\"),\n\t\t\"notes\": d.Get(\"notes\"),\n\t\t\"connector_id\": d.Get(\"connector_id\"),\n\t\t\"visible\": d.Get(\"visible\"),\n\t\t\"allow_assumed_signin\": d.Get(\"allow_assumed_signin\"),\n\t\t\"parameters\": d.Get(\"parameters\"),\n\t\t\"provisioning\": d.Get(\"provisioning\"),\n\t\t\"configuration\": d.Get(\"configuration\"),\n\t})\n\tif err != nil {\n\t\tlog.Println(\"Unable to convert string in plan to required value type\", err)\n\t\treturn err\n\t}\n\tclient := m.(*client.APIClient)\n\terr = client.Services.AppsV2.Create(&oidcApp)\n\tif err != nil {\n\t\tlog.Println(\"[ERROR] There was a problem creating the app!\", err)\n\t\treturn err\n\t}\n\tlog.Printf(\"[CREATED] Created app with %d\", *(oidcApp.ID))\n\n\td.SetId(fmt.Sprintf(\"%d\", *(oidcApp.ID)))\n\treturn oidcAppRead(d, m)\n}", "title": "" }, { "docid": "13412d982bd3e0a3f2ebae4c2552aee6", "score": "0.5000954", "text": "func NewRequest(service, schemaID, operationID string, arg interface{}) *Request {\n\tr := &Request{\n\t\tMicroServiceName: service,\n\t\tSchema: schemaID,\n\t\tOperation: operationID,\n\t\tArg: arg,\n\t}\n\treturn r\n}", "title": "" }, { "docid": "9cb7ad091cc3306a3adb9efed60fdee9", "score": "0.50004846", "text": "func (c *OutputService4ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "3e40f9c3c2debcc3fb05becc3b7b3d82", "score": "0.49951443", "text": "func (c *Client) NewRequest(task string, payload interface{}) (*http.Request, error) {\n\n\t// var buf io.Reader\n\tvar b url.Values\n\tvar err error\n\tvar url string\n\n\tif payload != nil {\n\t\tb, err = form.EncodeToValues(payload)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\t// buf = bytes.NewBuffer()\n\t}\n\n\turl, err = c.GetAPIPath(task)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn http.NewRequest(\"POST\", url, strings.NewReader(b.Encode()))\n}", "title": "" }, { "docid": "98ea277ae4e079118f1d74f8dda791f2", "score": "0.49890834", "text": "func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error) {\n\tif !strings.HasSuffix(c.BaseURL.Path, \"/\") {\n\t\treturn nil, fmt.Errorf(\"BaseURL must have a trailing slash, but %q does not\", c.BaseURL)\n\t}\n\tu, err := c.BaseURL.Parse(urlStr)\n\n\t// Add api key to params\n\tv := u.Query()\n\tv.Set(\"api_key\", c.apiKey)\n\tu.RawQuery = v.Encode()\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar buf io.ReadWriter\n\tif body != nil {\n\t\tbuf = new(bytes.Buffer)\n\t\tenc := json.NewEncoder(buf)\n\t\tenc.SetEscapeHTML(false)\n\t\terr := enc.Encode(body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treq, err := http.NewRequest(method, u.String(), buf)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Header.Set(\"Authorization\", \"Bearer \"+c.accessToken)\n\n\tif body != nil {\n\t\treq.Header.Set(\"Content-Type\", \"application/json\")\n\t}\n\tif c.UserAgent != \"\" {\n\t\treq.Header.Set(\"User-Agent\", c.UserAgent)\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "5a24210cba70c2c68e971d15b3bd709d", "score": "0.49887305", "text": "func (c *OutputService12ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "37a13eb814492ac0bc26cfe2c5b5102c", "score": "0.4984693", "text": "func newApp(config *config.Config) (*options.AppOptions, error) {\n\to := &options.AppOptions{}\n\tapp := kingpin.New(\"beaker\", \"Beaker is a lab assistant to run and view experiments.\")\n\n\t// Set a usage template to print better help messages.\n\tapp.UsageTemplate(usageTemplate)\n\n\t// Disable interspersing flags with positional args.\n\tapp.Interspersed(false)\n\n\t// Add global flags. These flags will also be available to sub-commands.\n\tapp.HelpFlag.Short('h')\n\tapp.Version(makeVersion())\n\tapp.VersionFlag.Short('v')\n\tapp.Flag(\"debug\", \"Print verbose stack traces on error.\").BoolVar(&o.Debug)\n\n\t// Build out sub-command groups.\n\talpha.NewAlphaCmd(app, o, config)\n\tblueprint.NewBlueprintCmd(app, o, config)\n\tdataset.NewDatasetCmd(app, o, config)\n\texperiment.NewExperimentCmd(app, o, config)\n\tgroup.NewGroupCmd(app, o, config)\n\ttask.NewTaskCmd(app, o, config)\n\n\t// Attach sub-commands.\n\tNewConfigCmd(app)\n\tNewVersionCmd(app)\n\n\t// Parse command line input.\n\t_, err := app.Parse(os.Args[1:])\n\treturn o, err\n}", "title": "" }, { "docid": "9ea39862693ea8dc38fd05f70209b4b3", "score": "0.49793294", "text": "func (c *OutputService10ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "ca2ada6b1bdbab0d97baa46d6fc84c48", "score": "0.497892", "text": "func (cl *AgentClient) AppCreate(postData netproto.App) error {\n\tvar resp Response\n\n\terr := netutils.HTTPPost(\"http://\"+cl.agentURL+\"/api/apps/\", &postData, &resp)\n\n\treturn err\n\n}", "title": "" }, { "docid": "56c683f17ff1bfa75f3a423e9eff2889", "score": "0.49778587", "text": "func (c *OutputService13ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "7740847f2f98c44e74b8e2a2641919db", "score": "0.49760863", "text": "func (sc *SC) NewRequest(method, path string, data ...map[string]interface{}) *Request {\n\tr := &Request{\n\t\tsc: sc,\n\t\tmethod: method,\n\t\tpath: path,\n\t}\n\n\tif len(data) > 0 {\n\t\tr.data = mergeData(data...)\n\t} else {\n\t\tr.data = make(map[string]interface{})\n\t}\n\n\treturn r\n}", "title": "" }, { "docid": "277a4f9dd7b53954f3c6987c06eed4ed", "score": "0.49739733", "text": "func (a *Auth) NewRequest(method string) *Request {\n\treturn NewRequest(method).Auth(a)\n}", "title": "" }, { "docid": "f46ad8e8c831c33aa40f61a5239d855d", "score": "0.4967206", "text": "func (c *Client) newRequest(method string, endpoint string, body []byte) (*http.Request, error) {\n\n\tvar urlStr string\n\tif c.ApiVersion > 0 {\n\t\turlStr = c.ServerUrl + \"/api/v\" + strconv.Itoa(c.ApiVersion) + endpoint\n\t} else {\n\t\turlStr = c.ServerUrl + endpoint\n\t}\n\turl, err := url.Parse(urlStr)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error during parsing request URL: %s\", err)\n\t}\n\n\tvar bodyReader io.Reader\n\tif body != nil {\n\t\tbodyReader = bytes.NewReader(body)\n\t}\n\n\treq, err := http.NewRequest(method, url.String(), bodyReader)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error during creation of request: %s\", err)\n\t}\n\n\treq.Header.Add(\"X-API-Key\", c.ApiKey)\n\treq.Header.Add(\"Accept\", \"application/json\")\n\n\tif method != \"GET\" {\n\t\treq.Header.Add(\"Content-Type\", \"application/json\")\n\t}\n\n\treturn req, nil\n}", "title": "" }, { "docid": "28cce89f8a9a1a78e2b8dcc62a5b618e", "score": "0.49626544", "text": "func (c *OutputService7ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "dfe8af532549c850a601ac7b6aced41d", "score": "0.4950734", "text": "func (s *WebSessionManagementService) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := s.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "221195569b5cd27ad901812b39b66bff", "score": "0.4947259", "text": "func NewMobileAppAssignmentSettings()(*MobileAppAssignmentSettings) {\n m := &MobileAppAssignmentSettings{\n }\n m.SetAdditionalData(make(map[string]interface{}));\n return m\n}", "title": "" }, { "docid": "0f0bc9da9677545ab89cac0cfe7f0377", "score": "0.49385518", "text": "func New(oauthClient *http.Client) (*Client, error) {\n\tif oauthClient == nil {\n\t\treturn nil, errors.New(\"oauthClient is nil\")\n\t}\n\treturn constructClient(oauthClient, \"\"), nil\n}", "title": "" }, { "docid": "2d582dc09489bdb10a9e7fb6b07cf322", "score": "0.4936035", "text": "func NewConfigureTransmissionTaskRequestWithoutParam() *ConfigureTransmissionTaskRequest {\n\n return &ConfigureTransmissionTaskRequest{\n JDCloudRequest: core.JDCloudRequest{\n URL: \"/regions/{regionId}/dts/{taskId}/configure\",\n Method: \"POST\",\n Header: nil,\n Version: \"v2\",\n },\n }\n}", "title": "" }, { "docid": "27fd4c4e64d5019132d39c9a088e087f", "score": "0.4934991", "text": "func NewRequest(service string, request *Message, options ...ClientOptions) *Message {\n\tc := new(client)\n\tc.Service = service\n\tc.Req = request\n\tif c.Req.Values == nil {\n\t\tc.Req.Values = make(map[string]string)\n\t}\n\tfor _, option := range options {\n\t\toption(c)\n\t}\n\tc.Resp = &Message{}\n\tc.Execute()\n\treturn c.Resp\n}", "title": "" }, { "docid": "85a23e4e77194185ec013937583142a0", "score": "0.49340528", "text": "func (r *Client) newRequest(method string, url string, body io.Reader) (*http.Request, error) {\n\tif !strings.HasPrefix(url, \"http\") {\n\t\turl = r.APIPath + url\n\t}\n\n\ttoken, err := r.getToken(method, url)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := http.NewRequest(method, url, body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Header.Set(\"Authorization\", fmt.Sprintf(\"Bearer %s\", token))\n\n\treturn req, nil\n}", "title": "" }, { "docid": "b80965dd2cb3705ad156492a0acfbc5b", "score": "0.49215293", "text": "func New(w http.ResponseWriter, rc http.Request) (error, http.Request) {\n\n\tvar req request.Request\n\treq = rc.Context().Value(\"request\").(request.Request)\n\n\tauthKeys := rc.Context().Value(\"claims\").([]string)\n\tauthAllKeys := rc.Context().Value(\"claimsAll\").(bool)\n\n\tif rc.Context().Value(\"admin\").(int) >= 0 {\n\t\tif !authAllKeys {\n\t\t\tif !utils.AllStringsInSlice(req.Keys, authKeys) {\n\t\t\t\tlog.Println(\"Requested Keys are not in requestors allowed\")\n\t\t\t\treturn errors.New(\"Permission Denied. Requested Keys are not in requestors allowed scope\"), rc\n\t\t\t}\n\t\t}\n\t} else {\n\t\treturn errors.New(\"Permission Denied. Not an admin token\"), rc\n\t}\n\n\ttokenString, err := GenerateToken(req.Keys, time.Now().Unix()+req.Expiration, randid.Generate(32), req.Admin)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn err, rc\n\t}\n\n\tio.WriteString(w, tokenString)\n\treturn nil, rc\n}", "title": "" }, { "docid": "2e0afc7a7c2cae5902e400f77cdaa7fe", "score": "0.4921496", "text": "func (c *DynamoDB) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\t// Run custom request initialization if present\n\tif initRequest != nil {\n\t\tinitRequest(req)\n\t}\n\n\treturn req\n}", "title": "" }, { "docid": "76a92c21d7885b07fc64b8014dc90f32", "score": "0.49195746", "text": "func NewApplication(ctx context.Context, flags *cliFlags) (*application, func(), error) {\n\twire.Build(\n\t\twire.FieldsOf(new(*cliFlags), \"Log\", \"Census\", \"MySQL\", \"Orc8r\"),\n\t\tlog.Set,\n\t\tnewApplication,\n\t\tnewTenancy,\n\t\tnewAuthURL,\n\t\tnewTopic,\n\t\tnewSubscribeFunc,\n\t\tmysql.Open,\n\t\tgraphhttp.NewServer,\n\t\twire.Struct(new(graphhttp.Config), \"*\"),\n\t\tgraphgrpc.NewServer,\n\t\twire.Struct(new(graphgrpc.Config), \"*\"),\n\t)\n\treturn nil, nil, nil\n}", "title": "" }, { "docid": "007ed9c50409d8e61ba743512388f2c6", "score": "0.4918711", "text": "func (c *OutputService5ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "a08e559108b9a93de0f62eb543b8ea85", "score": "0.49165222", "text": "func (c *OutputService8ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "e9b27da8a8731d80f43cea402a34e3da", "score": "0.4912345", "text": "func (c *OutputService9ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "49f5cdd2f2e3e3c35fb311fbefefe66e", "score": "0.49118638", "text": "func NewRequest() *Request {\n\tr := &Request{\n\t\tMaxBucketCardinality: make(map[string]int64, 0),\n\t\tOverallCardinality: make(map[string]int64, 0),\n\t}\n\treturn r\n}", "title": "" }, { "docid": "dc7a14fe207852e19b99b3bfbd21ee45", "score": "0.4907311", "text": "func (c *Client) NewRequest(method, urlStr string, data interface{}) (*http.Request, error) {\n\trelativeURL, err := url.Parse(urlStr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tabsoluteURL := c.BaseURL.ResolveReference(relativeURL)\n\n\tvar body io.ReadWriter\n\tif data != nil {\n\t\tbody = new(bytes.Buffer)\n\n\t\terr := json.NewEncoder(body).Encode(data)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treq, err := http.NewRequest(method, absoluteURL.String(), body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// set api_key for auth\n\tq := req.URL.Query()\n\tq.Set(\"api_key\", c.apiKey)\n\treq.URL.RawQuery = q.Encode()\n\n\treq.Header.Set(\"Accept\", mediaType)\n\treq.Header.Set(\"User-Agent\", c.UserAgent)\n\n\tif data != nil {\n\t\treq.Header.Set(\"Content-Type\", \"application/json\")\n\t}\n\n\treturn req, nil\n}", "title": "" }, { "docid": "fbb4fcc179dad8fbc9ae49b707f20841", "score": "0.4897837", "text": "func (a *Client) GenerateAppOauth(params *GenerateAppOauthParams, authInfo runtime.ClientAuthInfoWriter) (*GenerateAppOauthOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGenerateAppOauthParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"generateAppOauth\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/apps/{appNameOrId}/oauth/generate\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &GenerateAppOauthReader{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.(*GenerateAppOauthOK), nil\n\n}", "title": "" }, { "docid": "2cb1119d13f0979a7081829fae631325", "score": "0.4896097", "text": "func (c *OutputService11ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "315b15b2be0d3a133f24b1a89f95a4ff", "score": "0.48911384", "text": "func newRequest(data url.Values) (*http.Request, error) {\n\trqst, err := http.NewRequest(data.Get(\"method\"), data.Get(\"url\"), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor k, v := range extractMapFromRequestParam(\"headers\", data) {\n\t\trqst.Header.Set(k, v)\n\t}\n\n\tswitch data.Get(\"auth\") {\n\tcase \"basic\":\n\t\trqst.SetBasicAuth(data.Get(\"username\"), data.Get(\"password\"))\n\t}\n\n\treturn rqst, nil\n}", "title": "" }, { "docid": "5388636f62b3e12069c70764e14ccb68", "score": "0.48891684", "text": "func (s SandstormCore_claimRequest_Params) NewRequiredPermissions(n int32) (capnp.BitList, error) {\n\tl, err := capnp.NewBitList(s.Struct.Segment(), n)\n\tif err != nil {\n\t\treturn capnp.BitList{}, err\n\t}\n\terr = s.Struct.SetPtr(1, l.List.ToPtr())\n\treturn l, err\n}", "title": "" }, { "docid": "4b73586fd7adb9b66fd5c30e464d7141", "score": "0.48887205", "text": "func NewRequest(cmd string, args ...string) (*Request, error) {\n\tif len(cmd) < 1 {\n\t\treturn nil, ErrEmptyCommand\n\t}\n\n\treturn &Request{cmd, args}, nil\n}", "title": "" }, { "docid": "6cf92b31bb05de9cfff78a03efa1b9d5", "score": "0.48863587", "text": "func newRequest(method, path string, body io.Reader) *http.Request {\n\treq, _ := http.NewRequest(method, APIUrl+path, body)\n\treturn req\n}", "title": "" }, { "docid": "3e7954fb325393a97265b5566d483d31", "score": "0.48826888", "text": "func NewRequest() *Request {\n\tr := &Request{\n\t\tAggs: make(map[string]types.Aggregations, 0),\n\t}\n\treturn r\n}", "title": "" }, { "docid": "3ce2564b6ac457ac91902662c462e415", "score": "0.4881966", "text": "func NewRequest(client *http.Client) *Request {\n\tr := &Request{\n\t\tHeader: http.Header{},\n\t\tFormData: url.Values{},\n\t\tQueryData: url.Values{},\n\t\tCookies: make([]*http.Cookie, 0),\n\t\tBasicAuth: struct{ Username, Password string }{},\n\t\tClient: client,\n\t\tIsKeepAlive: true,\n\t}\n\t// default init\n\treturn r\n}", "title": "" }, { "docid": "680b2c4de9925c0f5cdde9417f54ddf0", "score": "0.4875861", "text": "func (c *Client) newRequest(method string, path *string, queryParams mod.Queryable, body io.Reader) (*http.Request, error) {\n\n\tp, err := utl.AddQueryToPath(*path, queryParams)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlog.Println(\"Path:\", p)\n\t// Parse the OneLogin domain and path\n\tu, err := url.Parse(c.OLdomain + p)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Create a new HTTP request\n\treq, err := http.NewRequest(method, u.String(), body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Get authentication token\n\tlog.Println(\"Getting authentication token...\")\n\ttk, err := c.Auth.GetToken()\n\tif err != nil {\n\t\tlog.Println(\"Error getting authentication token:\", err)\n\t\treturn nil, olerror.NewAuthenticationError(\"Access Token Retrieval Error\")\n\t}\n\tlog.Println(\"Authentication token retrieved successfully.\")\n\n\t// Set request headers\n\treq.Header.Set(\"Authorization\", fmt.Sprintf(\"Bearer %s\", tk))\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\treturn req, nil\n}", "title": "" }, { "docid": "b0bd67f40142244cb2e0121d034fc404", "score": "0.48747462", "text": "func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error) {\n\trel, err := url.Parse(urlStr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tu := c.BaseURL.ResolveReference(rel)\n\n\tvar buf io.ReadWriter\n\tif body != nil {\n\t\tbuf = new(bytes.Buffer)\n\t\terr := json.NewEncoder(buf).Encode(body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treq, err := http.NewRequest(method, u.String(), buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Add(\"Accept\", \"application/json\")\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\n\t// Authentication v1\n\treq.Header.Add(xAIOKeyHeader, c.APIKey)\n\n\tif c.userAgent != \"\" {\n\t\treq.Header.Add(\"User-Agent\", c.userAgent)\n\t}\n\n\treturn req, nil\n}", "title": "" }, { "docid": "26207b3c386d635d818ef92ead91b6ca", "score": "0.4874315", "text": "func (c *APIAppAPI) Create(parms APIAppCreateParms) (*APIApp, error) {\n\tapp := &apiAppRaw{}\n\tif err := c.postFormAndParse(\"api_app\", &parms, app); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &app.APIApp, nil\n}", "title": "" }, { "docid": "fb2d83d8fef2aae2d66577d8d47eba2a", "score": "0.4874231", "text": "func (a UtilitiesApi) CreateOAuthClient(name string, redirectUri string) (*OAuthClient, *APIResponse, error) {\n\n\tvar httpMethod = \"Post\"\n\t// create path and map variables\n\tpath := a.Configuration.BasePath + \"/oauthclient\"\n\n\n\theaderParams := make(map[string]string)\n\tqueryParams := url.Values{}\n\tformParams := make(map[string]string)\n\tvar postBody interface{}\n\tvar fileName string\n\tvar fileBytes []byte\n\t// authentication '(BBOAuth2)' required\n\t// oauth required\n\tif a.Configuration.AccessToken != \"\"{\n\t\theaderParams[\"Authorization\"] = \"Bearer \" + a.Configuration.AccessToken\n\t}\n\t// add default headers if any\n\tfor key := range a.Configuration.DefaultHeader {\n\t\theaderParams[key] = a.Configuration.DefaultHeader[key]\n\t}\n\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{ \"application/x-www-form-urlencoded\", }\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\theaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"application/json\",\n\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\theaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\n\tformParams[\"name\"] = name\n\tformParams[\"redirectUri\"] = redirectUri\n\tvar successPayload = new(OAuthClient)\n\thttpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)\n\tif err != nil {\n\t\treturn successPayload, NewAPIResponse(httpResponse.RawResponse), err\n\t}\n\terr = json.Unmarshal(httpResponse.Body(), &successPayload)\n\treturn successPayload, NewAPIResponse(httpResponse.RawResponse), err\n}", "title": "" }, { "docid": "ae72067968da4456ecca74e9fdda28e7", "score": "0.4872723", "text": "func New(key, appname string) (Client, error) {\n\n\tif appname == \"\" {\n\t\treturn Client{}, errors.New(\"Missing appname\")\n\t}\n\n\treturn Client{\n\t\tic: &innerClient{\n\t\t\tappName: appname,\n\t\t\tapikey: key,\n\t\t},\n\t}, nil\n}", "title": "" }, { "docid": "320f3409ba4fd60280312f66e2a6037a", "score": "0.48708048", "text": "func CreateRequestWithOutAuth(method, URL string, body io.Reader) (*http.Request, error) {\n\tr, err := http.NewRequest(method, URL, body)\n\treturn r, err\n}", "title": "" }, { "docid": "2fe336c6e7a0254bd566d24a0dcf13be", "score": "0.48691761", "text": "func NewConstructor(req *http.Request, payload Payload) *Constructor {\n\tc := &Constructor{request: req, payload: payload}\n\treturn c\n}", "title": "" }, { "docid": "533fa1bc3759e36ef1a4d652d2f687de", "score": "0.48575637", "text": "func NewAddDatapushVenderRequestWithoutParam() *AddDatapushVenderRequest {\n\n return &AddDatapushVenderRequest{\n JDCloudRequest: core.JDCloudRequest{\n URL: \"/datapushVenders\",\n Method: \"POST\",\n Header: nil,\n Version: \"v1\",\n },\n }\n}", "title": "" }, { "docid": "1eb7822b74695e0d9dab8169aedaf8aa", "score": "0.48573834", "text": "func CreateApplyBoardTokenRequest() (request *ApplyBoardTokenRequest) {\n\trequest = &ApplyBoardTokenRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"live\", \"2016-11-01\", \"ApplyBoardToken\", \"live\", \"openAPI\")\n\treturn\n}", "title": "" }, { "docid": "850ceab7f5ecdc364670e91d9d6172b6", "score": "0.4856801", "text": "func NewNewTokenRequest(server string, body NewTokenJSONRequestBody) (*http.Request, error) {\n\tvar bodyReader io.Reader\n\tbuf, err := json.Marshal(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbodyReader = bytes.NewReader(buf)\n\treturn NewNewTokenRequestWithBody(server, \"application/json\", bodyReader)\n}", "title": "" } ]
87e9b5f1b03c53010bb224f3ca7510d8
GetPageWidth is a wrapper around gtk_page_setup_get_page_width().
[ { "docid": "cec25f69685dfd7a38c1d0113d154d95", "score": "0.8651142", "text": "func (v *PageSetup) GetPageWidth(unit Unit) float64 {\n\tc := C.gtk_page_setup_get_page_width(v.native(), C.GtkUnit(unit))\n\treturn float64(c)\n}", "title": "" } ]
[ { "docid": "96cf3b44464e8c4b639b1363ebf30941", "score": "0.7523807", "text": "func (v *PageSetup) GetPaperWidth(unit Unit) float64 {\n\tc := C.gtk_page_setup_get_paper_width(v.native(), C.GtkUnit(unit))\n\treturn float64(c)\n}", "title": "" }, { "docid": "cd389357d8ba6456b62c746494aee978", "score": "0.6892794", "text": "func (v *PaperSize) GetWidth(unit Unit) float64 {\n\tc := C.gtk_paper_size_get_width(v.native(), C.GtkUnit(unit))\n\treturn float64(c)\n}", "title": "" }, { "docid": "be4964a4c9e06a1bbd6971bb1b19acea", "score": "0.6813992", "text": "func (v *PrintContext) GetWidth() float64 {\n\tc := C.gtk_print_context_get_width(v.native())\n\treturn float64(c)\n}", "title": "" }, { "docid": "965e91ab0d2e5c6307cb3097473535e4", "score": "0.6619465", "text": "func (v *PrintSettings) GetPaperWidth(unit Unit) float64 {\n\tc := C.gtk_print_settings_get_paper_width(v.native(), C.GtkUnit(unit))\n\treturn float64(c)\n}", "title": "" }, { "docid": "7daa203ec25fcce7ab8d258dd0eaee65", "score": "0.630979", "text": "func (v *Screen) GetWidth() int {\n\tc := C.gdk_screen_get_width(v.native())\n\treturn int(c)\n}", "title": "" }, { "docid": "7daa203ec25fcce7ab8d258dd0eaee65", "score": "0.630979", "text": "func (v *Screen) GetWidth() int {\n\tc := C.gdk_screen_get_width(v.native())\n\treturn int(c)\n}", "title": "" }, { "docid": "f2a307494b1df0120528f31229689fe7", "score": "0.6172233", "text": "func (p *Pvr) GetWidth() int {\n if p.err != nil { return 0 }\n return p.info.width\n}", "title": "" }, { "docid": "251afc458968b4ed637441a380ca9c9c", "score": "0.60456604", "text": "func (d *HTMLDocument) Width() int {\n return int(C.webkit_dom_html_document_get_width(d.native()))\n}", "title": "" }, { "docid": "03a05291b60d107eb4ce3ab8d68fadde", "score": "0.6024692", "text": "func (o *CSGBox) GetWidth() gdnative.Real {\n\t//log.Println(\"Calling CSGBox.GetWidth()\")\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(\"CSGBox\", \"get_width\")\n\n\t// Call the parent method.\n\t// float\n\tretPtr := gdnative.NewEmptyReal()\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.NewRealFromPointer(retPtr)\n\treturn ret\n}", "title": "" }, { "docid": "b2f007d808394341b857a6711b404c95", "score": "0.6018771", "text": "func (o *Image) GetWidth() gdnative.Int {\n\t//log.Println(\"Calling Image.GetWidth()\")\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(\"Image\", \"get_width\")\n\n\t// Call the parent method.\n\t// int\n\tretPtr := gdnative.NewEmptyInt()\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.NewIntFromPointer(retPtr)\n\treturn ret\n}", "title": "" }, { "docid": "4aa9f50afcb11e88ad0afa47495e7aa8", "score": "0.5970394", "text": "func (m Model) GetWidth() int {\n\treturn m.Viewport.Width\n}", "title": "" }, { "docid": "ef9c75dff843f54cda0b436e7f9454be", "score": "0.5956968", "text": "func (n *DockerStatusWidget) GetWidth() int {\n\treturn n.options.GetWidth()\n}", "title": "" }, { "docid": "5c0907af7e8e7083f19331d8e3608a37", "score": "0.5945796", "text": "func (c *Context) Width() float64 {\n\tw, _ := c.Renderer.Size()\n\treturn w\n}", "title": "" }, { "docid": "edf3fb91bcca68b6b4b15e6bae555052", "score": "0.59297484", "text": "func (v *PageSetup) GetLeftMargin(unit Unit) float64 {\n\tc := C.gtk_page_setup_get_left_margin(v.native(), C.GtkUnit(unit))\n\treturn float64(c)\n}", "title": "" }, { "docid": "a37d53348fee8bf383cf7afde24555cd", "score": "0.59159094", "text": "func (v *Size) GetWidth() (o float64) {\n\tif v != nil {\n\t\to = v.Width\n\t}\n\treturn\n}", "title": "" }, { "docid": "7cbbef49ce787dd3e2e7b7bb26363799", "score": "0.5899628", "text": "func (p LoadParams) GetWidth() int32 {\n\treturn p.width\n}", "title": "" }, { "docid": "932695aafb4fd1927717e92ad7515890", "score": "0.5890528", "text": "func (mw *MagickWand) GetImageWidth() uint {\n\treturn uint(C.MagickGetImageWidth(mw.mw))\n}", "title": "" }, { "docid": "edfa758422d688f3baa060b7480a7e51", "score": "0.58591264", "text": "func (pc *PenConfig) GetWidth(w string) float64 {\n\n\twidth := func(name string) float64 {\n\t\tswitch name {\n\t\tcase \"narrow\":\n\t\t\treturn 1.875\n\t\tcase \"broad\":\n\t\t\treturn 2.125\n\t\t}\n\t\treturn 2.000\n\t}\n\n\tswitch w {\n\tcase \"narrow\":\n\t\treturn width(\"narrow\") / width(pc.Weight) * pc.Width\n\tcase \"broad\":\n\t\treturn width(\"broad\") / width(pc.Weight) * pc.Width\n\t}\n\treturn width(\"standard\") / width(pc.Weight) * pc.Width\n}", "title": "" }, { "docid": "04ffa845caa71d3706da51536131a143", "score": "0.58358073", "text": "func (v *Screen) GetWidthMM() int {\n\treturn int(C.gdk_screen_get_width_mm(v.native()))\n}", "title": "" }, { "docid": "04ffa845caa71d3706da51536131a143", "score": "0.58358073", "text": "func (v *Screen) GetWidthMM() int {\n\treturn int(C.gdk_screen_get_width_mm(v.native()))\n}", "title": "" }, { "docid": "3dc74c8321f5da39e33cc9614f48f8cc", "score": "0.5798803", "text": "func (p *PhotoSize) GetWidth() (value int32) {\n\tif p == nil {\n\t\treturn\n\t}\n\treturn p.Width\n}", "title": "" }, { "docid": "7828988bdb5aa44b6a0cf47ae05a931b", "score": "0.5760883", "text": "func (image *Image) GetWidth() float32 {\n\treturn image.w\n}", "title": "" }, { "docid": "250b42e06256fb3eb77f98e720abd4cb", "score": "0.56657344", "text": "func (m *MediaThumbnailSize) GetWidth() int {\n\treturn m.Width\n}", "title": "" }, { "docid": "d874e8c421629bca4b1054cec685e032", "score": "0.5575403", "text": "func (o *Image) GetWidth() int32 {\n\tif o == nil || o.Width == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\treturn *o.Width\n}", "title": "" }, { "docid": "6b6da3b54aaa236ecb78246425b55624", "score": "0.5557411", "text": "func (v *PageSetup) GetPaperSize() *PaperSize {\n\tc := C.gtk_page_setup_get_paper_size(v.native())\n\tp := wrapPaperSize(c)\n\truntime.SetFinalizer(p, (*PaperSize).free)\n\treturn p\n}", "title": "" }, { "docid": "028172506472e0536020e1ff34a755f6", "score": "0.55372816", "text": "func (canvas ImageCanvas) GetWidth() int {\n\tif canvas.Image == nil {\n\t\treturn 0\n\t}\n\treturn canvas.Image.Bounds().Size().X\n}", "title": "" }, { "docid": "3ed0e0ec7cc909f0509d4fba9e4c78a7", "score": "0.5486056", "text": "func (v *PrintContext) GetPageSetup() *PageSetup {\n\tc := C.gtk_print_context_get_page_setup(v.native())\n\tobj := glib.Take(unsafe.Pointer(c))\n\treturn wrapPageSetup(obj)\n}", "title": "" }, { "docid": "cf7d9cba285d77b1efa9a52dc7a0129c", "score": "0.5443703", "text": "func (b *Bin) GetWidth() float64 {\n\treturn b.Width\n}", "title": "" }, { "docid": "4bd9b9a5125d738eb74d7fb5dd8b3cb4", "score": "0.54414546", "text": "func (r *RichTextIcon) GetWidth() (value int32) {\n\tif r == nil {\n\t\treturn\n\t}\n\treturn r.Width\n}", "title": "" }, { "docid": "a90096b7dbc031dfb098d1b42605242d", "score": "0.53903556", "text": "func (v *PrintOperation) GetNPagesToPrint() int {\n\tc := C.gtk_print_operation_get_n_pages_to_print(v.native())\n\treturn int(c)\n}", "title": "" }, { "docid": "b911ff73c04958c42e5431678cdcdd1c", "score": "0.53764856", "text": "func (s *Sticker) GetWidth() (value int32) {\n\tif s == nil {\n\t\treturn\n\t}\n\treturn s.Width\n}", "title": "" }, { "docid": "e94ccaa67768be69f61c80de1ff0dd15", "score": "0.53463364", "text": "func (e *HTMLFrameElement) Width() int {\n return int(C.webkit_dom_html_frame_element_get_width(e.native()))\n}", "title": "" }, { "docid": "fe60a557b1e99b828815f635e070fe36", "score": "0.5335718", "text": "func (i *PDFt) GetNumberOfPage() int {\n\tpageObjIds, err := i.pdf.getPageObjIDs()\n\tif err != nil {\n\t\treturn 0\n\t}\n\treturn len(pageObjIds)\n}", "title": "" }, { "docid": "a009ee793d9125f6bea6e42b7ff4f7b9", "score": "0.5335092", "text": "func (e *HTMLObjectElement) Width() string {\n cstr := C.webkit_dom_html_object_element_get_width(e.native())\n return C.GoString((*C.char)(cstr))\n}", "title": "" }, { "docid": "63344674318a49383ce0165bd6026249", "score": "0.5330925", "text": "func getWidth() (int, error) {\n\tw, _, err := terminal.GetSize(int(os.Stdout.Fd()))\n\tif err != nil {\n\t\treturn -1, err\n\t}\n\treturn w, nil\n}", "title": "" }, { "docid": "45839f29fbdea3d1d2658d7a199e48e2", "score": "0.5323854", "text": "func (ctx *c64bmp) Width() int {\n\treturn len(ctx.pixmap)\n}", "title": "" }, { "docid": "6af680e89d5d8f2c7abfffe6683536d8", "score": "0.5317812", "text": "func (v *PageSetup) GetPageHeight(unit Unit) float64 {\n\tc := C.gtk_page_setup_get_page_height(v.native(), C.GtkUnit(unit))\n\treturn float64(c)\n}", "title": "" }, { "docid": "d0396d428141b07ae61d270a82d8d1f7", "score": "0.5315721", "text": "func (r *Rectangle) Width() int {\n\treturn r.X2 - r.X1\n}", "title": "" }, { "docid": "cf1444166c6d7241a00bb1d522adf70e", "score": "0.5314529", "text": "func (e *HTMLFrameElement) MarginWidth() string {\n cstr := C.webkit_dom_html_frame_element_get_margin_width(e.native())\n return C.GoString((*C.char)(cstr))\n}", "title": "" }, { "docid": "90ddcb1c5c76b707ec969a32a739f622", "score": "0.52958256", "text": "func (board *Board) GetWidth() int {\n\treturn board.width\n}", "title": "" }, { "docid": "5847ef05455cf0f49bf95de5d3873f47", "score": "0.5287794", "text": "func (d *Display) Width() int {\n\treturn int(C.al_get_display_width((*C.ALLEGRO_DISPLAY)(d)))\n}", "title": "" }, { "docid": "f8b5dd395ba25e234354cea9d2c2d22e", "score": "0.52634436", "text": "func (_this *XRViewport) Width() int {\n\tvar ret int\n\tvalue := _this.Value_JS.Get(\"width\")\n\tret = (value).Int()\n\treturn ret\n}", "title": "" }, { "docid": "fdb0c23e195a6df4965e0a9314e29c1b", "score": "0.5262849", "text": "func (e *HTMLImageElement) Width() int {\n return int(C.webkit_dom_html_image_element_get_width(e.native()))\n}", "title": "" }, { "docid": "0ee6e41b75e4c513022137e6ebc9b553", "score": "0.5259145", "text": "func (m Model) GetHorizontalFrameSize() int {\n\treturn m.Style.GetHorizontalFrameSize()\n}", "title": "" }, { "docid": "ec40d2788066300661da4aa41764d5ec", "score": "0.5244155", "text": "func (r *PostgresqlRepository) GetCountPages(productId uint64, countOrdersOnPage int) (int, error) {\n\trow := r.db.QueryRow(\n\t\t\"SELECT count(id) \"+\n\t\t\t\"FROM reviews \"+\n\t\t\t\"WHERE product_id = $1\",\n\t\tproductId,\n\t)\n\n\tvar countPages int\n\tif err := row.Scan(&countPages); err != nil {\n\t\treturn 0, errors.ErrDBInternalError\n\t}\n\tcountPages = int(math.Ceil(float64(countPages) / float64(countOrdersOnPage)))\n\n\treturn countPages, nil\n}", "title": "" }, { "docid": "c835db240472e95bf16202ad7235a89d", "score": "0.5210597", "text": "func (g *Grid) Width() int {\n\treturn sumIntSlice(g.colWidths)\n}", "title": "" }, { "docid": "1546dd259fb98d8ab54a14d343f8691f", "score": "0.5171976", "text": "func GetSizeWidth(img *IplImage) int {\n\tsize := C.cvGetSize(unsafe.Pointer(img))\n\tw := int(size.width)\n\treturn w\n}", "title": "" }, { "docid": "2917201adf2369058905123bbd17ff35", "score": "0.509925", "text": "func (o GoogleCloudRecommendationengineV1beta1ImageOutput) Width() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v GoogleCloudRecommendationengineV1beta1Image) *int { return v.Width }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "9faa206235b4b62811c3df7fecac616d", "score": "0.50957316", "text": "func (scr Console) Width() int {\n\tw, _ := scr.Screen.Size()\n\treturn w\n}", "title": "" }, { "docid": "7799c83f28716e5bcc2ce4e8f10cd1d8", "score": "0.5090271", "text": "func (p *Panel) calcWidth() float32 {\r\n\r\n\treturn p.content.Width +\r\n\t\tp.paddingSizes.Left + p.paddingSizes.Right +\r\n\t\tp.borderSizes.Left + p.borderSizes.Right +\r\n\t\tp.marginSizes.Left + p.marginSizes.Right\r\n}", "title": "" }, { "docid": "91f4aa165b1e7155c6d58235bdcba8f5", "score": "0.50811785", "text": "func (me *Image) Width() int {\n\treturn me.size.Width\n}", "title": "" }, { "docid": "4dd4d1ea3f7bf942d46a25357d62efd3", "score": "0.507286", "text": "func (p *Panel) Width() float32 {\r\n\r\n\treturn p.width\r\n}", "title": "" }, { "docid": "75ca34b9bf317194d7e215e5241e412a", "score": "0.50684595", "text": "func (tex *Drawable) Width() int {\n\tsize := C.sfRenderTexture_getSize(tex.tex)\n\treturn int(size.x)\n}", "title": "" }, { "docid": "3643e9d721a05be388c0b7fcf0182354", "score": "0.5051203", "text": "func (m AsciiBox) Width() int {\n\tmaxWidth := 0\n\tfor _, line := range strings.Split(string(m), \"\\n\") {\n\t\tcurrentLength := countChars(line)\n\t\tif maxWidth < currentLength {\n\t\t\tmaxWidth = currentLength\n\t\t}\n\t}\n\treturn maxWidth\n}", "title": "" }, { "docid": "130d7a736b97dff0d422c016e5d006d7", "score": "0.5049756", "text": "func (k Kernel) Width() int {\n\tif k.Height() > 0 {\n\t\treturn len(k[0])\n\t}\n\treturn 0\n}", "title": "" }, { "docid": "1170b3a5a8df6dddbeda62f8e93d6bb3", "score": "0.5047152", "text": "func getWidth() int {\n\treturn 0\n}", "title": "" }, { "docid": "2185cf4d514eb3e3b3a5c874ffee65cd", "score": "0.5041606", "text": "func (session EditSession) GetScreenWidth() int {\n\treturn session.Call(\"getScreenWidth\").Int()\n}", "title": "" }, { "docid": "9388d8dec555a8be39bf794fbd19c1e3", "score": "0.50320363", "text": "func getWebPageLength(url string, resultsChannel chan WebPage) {\n\tres, err := http.Get(url)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer res.Body.Close()\n\n\t// get the size of the response body\n\tsize, err := ioutil.ReadAll(res.Body)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t// populate the WebPage struct and add it to the channel\n\tvar page WebPage\n\tpage.URL = url\n\tpage.Size = len(size)\n\tresultsChannel <- page\n}", "title": "" }, { "docid": "133dd63403aaa5770f870d8172c4e02d", "score": "0.50291187", "text": "func (e *HTMLEmbedElement) Width() int {\n return int(C.webkit_dom_html_embed_element_get_width(e.native()))\n}", "title": "" }, { "docid": "42cd8ee48636809758a63164e64bfa4e", "score": "0.50259805", "text": "func (v *PrintSettings) GetLength(key string, unit Unit) float64 {\n\tcstr := C.CString(key)\n\tdefer C.free(unsafe.Pointer(cstr))\n\tc := C.gtk_print_settings_get_length(v.native(), (*C.gchar)(cstr), C.GtkUnit(unit))\n\treturn float64(c)\n}", "title": "" }, { "docid": "dd579a82093dde8f3512cadf08c23f0f", "score": "0.5011035", "text": "func WindowWidth(window Window) (width int) {\n\tname(nvim_win_get_width)\n}", "title": "" }, { "docid": "806dfafcf591ea6ae754bee0bd4901bb", "score": "0.50067383", "text": "func (screen *Screen) Width() int {\n\treturn screen.width\n}", "title": "" }, { "docid": "d9f61f5d2865fddf343238070088e7c6", "score": "0.50062007", "text": "func (s *Slider) GetFieldWidth() int {\n\treturn 0\n}", "title": "" }, { "docid": "2874de854fee66785a252a083c4b153e", "score": "0.4972251", "text": "func (g *ScriptableGrid) Width() int {\n\treturn g.DataTileGrid.Width\n}", "title": "" }, { "docid": "02a2776a079373269ab0e6e1ec96a979", "score": "0.49649042", "text": "func (d *Document) GetPageConfiguration(iw, ih float64) (\n\tw, h float64, orientation Orientation) {\n\n\tw, h = d.GetPageSize()\n\n\t// Add page with correct orientation\n\torientation = d.orientation\n\tif orientation == AutoOrientation {\n\t\tif iw > ih {\n\t\t\tw, h = h, w\n\t\t\torientation = LandscapeOrientation\n\t\t} else {\n\t\t\torientation = PortraitOrientation\n\t\t}\n\t}\n\n\tif iw*h < ih*w {\n\t\tw = h * iw / ih\n\t} else {\n\t\th = w * ih / iw\n\t}\n\n\treturn w, h, orientation\n}", "title": "" }, { "docid": "230749a8aaad6871c6f3087fa9a02512", "score": "0.49643177", "text": "func (element Canvas) Width() int {\n\treturn element.Get(\"width\").Int()\n}", "title": "" }, { "docid": "1119a60a1e0ab6f8a8eecc82fc433c36", "score": "0.4957101", "text": "func (self *Text) WordWrapWidth() int{\n return self.Object.Get(\"wordWrapWidth\").Int()\n}", "title": "" }, { "docid": "ea957a0219ba93d487565a5f6ad86fb9", "score": "0.49555805", "text": "func (wp WeightedPages) Count() int { return len(wp) }", "title": "" }, { "docid": "79eceefaa4d66c214667167a4282dbfd", "score": "0.4952085", "text": "func (c *Checkbox) GetFieldWidth() int {\n\treturn StringWidth(Styles.GraphicsCheckboxUnchecked)\n}", "title": "" }, { "docid": "9ed5ecd5b64f6886fbc7c448694d1454", "score": "0.4947728", "text": "func (v *PageSetup) GetRightMargin(unit Unit) float64 {\n\tc := C.gtk_page_setup_get_right_margin(v.native(), C.GtkUnit(unit))\n\treturn float64(c)\n}", "title": "" }, { "docid": "23591850c382bfc0731d5cf44998a1e6", "score": "0.49198163", "text": "func (a Annotation) Width() float64 {\n\treturn a.Coords[2] - a.Coords[0]\n}", "title": "" }, { "docid": "bccd442267566a1fcf7d4395d3e43dee", "score": "0.49113262", "text": "func (w *Window) GetSize() (int, int) {\n\treturn w.fbWidth, w.fbHeight\n}", "title": "" }, { "docid": "712a9c1a93ecc61697bd4c0b68ec32a0", "score": "0.49040014", "text": "func (im ImageMatrix) GetWidth() int {\n\treturn len(im)\n}", "title": "" }, { "docid": "a06c48be85d5867f66621b08cc6b508f", "score": "0.4902384", "text": "func (e *HTMLImage) Width(v int) *HTMLImage {\n\te.a[\"width\"] = v\n\treturn e\n}", "title": "" }, { "docid": "325fd0afd898d3b9a3a47a07f1264b8a", "score": "0.49017626", "text": "func (v *PageSetup) GetPaperHeight(unit Unit) float64 {\n\tc := C.gtk_page_setup_get_paper_height(v.native(), C.GtkUnit(unit))\n\treturn float64(c)\n}", "title": "" }, { "docid": "9da6cb5baba4a822daeae55333d9886f", "score": "0.48959032", "text": "func (qreg *QReg) Width() int {\n\treturn qreg.width\n}", "title": "" }, { "docid": "9da6cb5baba4a822daeae55333d9886f", "score": "0.48959032", "text": "func (qreg *QReg) Width() int {\n\treturn qreg.width\n}", "title": "" }, { "docid": "6950c204c0a26cee0c0d92345c4fe3e2", "score": "0.4886591", "text": "func GetNumPage(perPage, totalCount int) int {\n\treturn int(math.Ceil(float64(totalCount) / float64(perPage)))\n}", "title": "" }, { "docid": "4f320f942b5bc044c1935d6fcbba50b8", "score": "0.48858592", "text": "func (o *PaginatedCommitstatuses) GetPagelen() int32 {\n\tif o == nil || o.Pagelen == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\treturn *o.Pagelen\n}", "title": "" }, { "docid": "1946bae22468ba6d7dcfbcb0301b546f", "score": "0.48779908", "text": "func (v *Widget) GetMarginStart() int {\n\tc := C.gtk_widget_get_margin_start(v.native())\n\treturn int(c)\n}", "title": "" }, { "docid": "51a89270daac132ac4749b0ab6d6b070", "score": "0.48657408", "text": "func (f *File) WidthOf(field PDFieldFlag) int {\n\tvar w int\n\tswitch field {\n\tcase PFieldINode:\n\t\tw = len(cast.ToString(f.INode()))\n\tcase PFieldPermissions:\n\t\tw = len(f.Permission())\n\tcase PFieldLinks:\n\t\tw = len(cast.ToString(f.NLinks()))\n\tcase PFieldSize:\n\t\tw, _, _ = f.widthOfSize()\n\tcase PFieldBlocks:\n\t\tw = len(cast.ToString(f.Blocks()))\n\tcase PFieldUser:\n\t\tw = paw.StringWidth(f.User())\n\tcase PFieldGroup:\n\t\tw = paw.StringWidth(f.Group())\n\tcase PFieldModified:\n\t\tw = len(DateString(f.ModifiedTime()))\n\tcase PFieldCreated:\n\t\tw = len(DateString(f.CreatedTime()))\n\tcase PFieldAccessed:\n\t\tw = len(DateString(f.AccessedTime()))\n\t// case PFieldGit:\n\t// \tw = 3\n\tcase PFieldMd5:\n\t\tw = len(f.GetMd5())\n\tdefault: // name\n\t\tw = 0\n\t}\n\treturn w\n}", "title": "" }, { "docid": "c4efe6a27cea7a381d4263ecd7fe4c62", "score": "0.48598728", "text": "func GetScreenWidth() int {\n\tres := C.GetScreenWidth()\n\treturn int(int32(res))\n}", "title": "" }, { "docid": "d9ee987901ec07cfeeb5420771641d9b", "score": "0.4857014", "text": "func (md Metadata) Width() (width uint64, ok bool) {\n\tif val, ok := md[string(TagWidth)]; ok && val != nil {\n\t\treturn uint64(val.(float64)), ok\n\t}\n\treturn\n}", "title": "" }, { "docid": "22a100a43f35b86c4ba2789482ef2bd4", "score": "0.48314494", "text": "func Xsqlite3BtreeGetPageSize(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:67878:20: */\n\treturn int32((*BtShared)(unsafe.Pointer((*Btree)(unsafe.Pointer(p)).FpBt)).FpageSize)\n}", "title": "" }, { "docid": "aac6c0d4ea087460d0e0e196dc7157d0", "score": "0.48228115", "text": "func (me *XsdGoPkgHasElem_Width) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElem_Width; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "b348e433dc91a35be151ae3e83f0117a", "score": "0.481382", "text": "func (self *Text) Width() int{\n return self.Object.Get(\"width\").Int()\n}", "title": "" }, { "docid": "5a652995d71d2418e98c0bd9b7fb50df", "score": "0.4805892", "text": "func GetMonitorWidth(monitor int) int {\n\tres := C.GetMonitorWidth(C.int(int32(monitor)))\n\treturn int(int32(res))\n}", "title": "" }, { "docid": "54ec0b64fba74b1e7b09d4270d748b45", "score": "0.48029155", "text": "func TerminalWidth() int {\n\tvar info consoleScreenBufferInfo\n\tr1, _, _ := procGetConsoleScreenBufferInfo.Call(uintptr(windows.Stdout), uintptr(unsafe.Pointer(&info)))\n\tif r1 == 0 {\n\t\treturn 0 // something went wrong\n\t}\n\treturn int(info.dwSize.X)\n}", "title": "" }, { "docid": "46757f90d3f5bb978d67111a9b0979ae", "score": "0.48023242", "text": "func DisplayWidth() int {\n\tvar w, h C.int\n\tC.SDL_GetWindowSize(screen, &w, &h)\n\treturn int(w)\n}", "title": "" }, { "docid": "c2986e1ff5fc100407d06702c69deb9b", "score": "0.47997257", "text": "func GetTermWidth() (termWidth int) {\n\tvar err error\n\tfd := int(os.Stdout.Fd())\n\ttermWidth, _, err = GetSize(fd)\n\tif err != nil {\n\t\ttermWidth = 80 // default to 80 with term width unknown as that is the de factor standard on older terms.\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "9ec5aab5c59aafd1dc6a44ff9ff40164", "score": "0.47941926", "text": "func (e *Event) Width() int {\n\treturn int(C.evWidth((*C.ev)(e)))\n}", "title": "" }, { "docid": "b9cacd1c9cc21b3421f74bba70c7ee6c", "score": "0.47779787", "text": "func (area *Area) getWidth() int {\n\twidth := -1\n\tfor row := 0; row < area.NRows; row++ {\n\t\tw := 0\n\t\tfor col := 0; col < area.NCols; col++ {\n\t\t\timgChunk := area.chunk(assets.LayerKindBackground, row, col)\n\t\t\tbounds := imgChunk.Bounds()\n\t\t\tw += bounds.Dx()\n\t\t}\n\t\tif width == -1 {\n\t\t\twidth = w\n\t\t} else if w != width {\n\t\t\tpanic(fmt.Errorf(\"mismatch between width of %q (prev=%d, new=%d)\", area.Name, width, w))\n\t\t}\n\t}\n\treturn width\n}", "title": "" }, { "docid": "6f5a5e11014e8fd183f09a878a2b3a20", "score": "0.4777855", "text": "func PrintGetPageDimensions(c *xgb.Conn, Context Pcontext) PrintGetPageDimensionsCookie {\n\tc.ExtLock.RLock()\n\tdefer c.ExtLock.RUnlock()\n\tif _, ok := c.Extensions[\"XpExtension\"]; !ok {\n\t\tpanic(\"Cannot issue request 'PrintGetPageDimensions' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.\")\n\t}\n\tcookie := c.NewCookie(true, true)\n\tc.NewRequest(printGetPageDimensionsRequest(c, Context), cookie)\n\treturn PrintGetPageDimensionsCookie{cookie}\n}", "title": "" }, { "docid": "1da422fb07e3e759a1d8a430dc18bd61", "score": "0.47777244", "text": "func (plot *PlotWindow) WindowWidth() int {\n\tplot.window.Geometry()\n\treturn plot.window.Geom.Width()\n}", "title": "" }, { "docid": "2d215ecece729764065d548a511404ec", "score": "0.47614473", "text": "func (o GoogleCloudRecommendationengineV1beta1ImageResponseOutput) Width() pulumi.IntOutput {\n\treturn o.ApplyT(func(v GoogleCloudRecommendationengineV1beta1ImageResponse) int { return v.Width }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "dd02b2a4cfe36eb8ef0b3412da2f1b29", "score": "0.47468928", "text": "func (w *Window) GetSize() image.Point {\n\twidth, height := w.handle.GetSize()\n\treturn image.Point{width, height}\n}", "title": "" }, { "docid": "f6d6a0eb3f3f0b16342f331dbf34f06d", "score": "0.47392085", "text": "func (v *Widget) GetPreferredHeightAndBaselineForWidth(height int) (int, int, int, int) {\n\n\tvar minimum, natural, minimum_baseline, natural_baseline C.gint\n\n\tC.gtk_widget_get_preferred_height_and_baseline_for_width(\n\t\tv.native(),\n\t\tC.gint(height),\n\t\t&minimum,\n\t\t&natural,\n\t\t&minimum_baseline,\n\t\t&natural_baseline)\n\treturn int(minimum),\n\t\tint(natural),\n\t\tint(minimum_baseline),\n\t\tint(natural_baseline)\n}", "title": "" }, { "docid": "fa379b0dd4b168834ee3d11697e860d6", "score": "0.47296083", "text": "func (me *XsdGoPkgHasElems_Width) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElems_Width; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "17b564cf083892f82f2028b4bd1027a0", "score": "0.47256443", "text": "func DrawGetSize(ih Ihandle) (w, h int){\n\tC.IupDrawGetSize(ih.ptr(), (*C.int)(unsafe.Pointer(&w)), (*C.int)(unsafe.Pointer(&h)))\n\treturn\n}", "title": "" }, { "docid": "b9ba52bffc5bd5d18dbd07d8fad23782", "score": "0.47215092", "text": "func (c *Canvas) Width() uint32 {\n\n\treturn c.width\n}", "title": "" } ]
f88cb251664ca78435068789fe14232c
InSliceString checks if x exists in a slice of strings and returns TRUE if x is found.
[ { "docid": "d8ce57b2e0c84e6cc61060797526f69d", "score": "0.8528017", "text": "func InSliceString(x string, a []string) bool {\n\tif len(a) == 0 {\n\t\treturn false\n\t}\n\n\tfor _, v := range a {\n\t\tif x == v {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" } ]
[ { "docid": "8d1eca5269e14271406b8cd8f0474be6", "score": "0.80759853", "text": "func StringInSlice(s string, sl []string) bool {\n\tfor _, i := range sl {\n\t\tif i == s {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "9b8e3cba5e5f917fac76de06f6235422", "score": "0.80413043", "text": "func IsInSliceString(list []string, s string) bool {\n\tfor _, v := range list {\n\t\tif s == v {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "1828a027f829e5ad73a625f5608f87b7", "score": "0.79867584", "text": "func StringInSlice(sliceString []string, needle string) bool {\n\tfor _, b := range sliceString {\n\t\tif b == needle {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "7a252e3cbcfdf82b503dcd59cda70e2e", "score": "0.7947839", "text": "func InSlice(slice []string, s string) bool {\n\tfor _, ss := range slice {\n\t\tif strings.EqualFold(s, ss) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "c990b74e229741f8cba411c678ad62ae", "score": "0.7864407", "text": "func StringInSlice(a string, slice []string) bool {\n\tfor _, b := range slice {\n\t\tif b == a {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "a8a297ba17bd31dcacead034c16294ef", "score": "0.7843374", "text": "func StringInSlice(s string, list []string) bool {\n\tfor _, v := range list {\n\t\tif v == s {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "7710c90060fedcc7d15420744d3a6d62", "score": "0.780594", "text": "func stringInSlice(a string, slice []string) bool {\n\tfor _, b := range slice {\n\t\tif b == a {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "7710c90060fedcc7d15420744d3a6d62", "score": "0.780594", "text": "func stringInSlice(a string, slice []string) bool {\n\tfor _, b := range slice {\n\t\tif b == a {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "8b565a097e9406908e62e131b4771dcb", "score": "0.7780449", "text": "func StringInSlice(a string, list []string) bool {\n\tfor _, b := range list {\n\t\tif b == a {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "8b565a097e9406908e62e131b4771dcb", "score": "0.7780449", "text": "func StringInSlice(a string, list []string) bool {\n\tfor _, b := range list {\n\t\tif b == a {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "8b565a097e9406908e62e131b4771dcb", "score": "0.7780449", "text": "func StringInSlice(a string, list []string) bool {\n\tfor _, b := range list {\n\t\tif b == a {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "8b565a097e9406908e62e131b4771dcb", "score": "0.7780449", "text": "func StringInSlice(a string, list []string) bool {\n\tfor _, b := range list {\n\t\tif b == a {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "35e237634abb66a49add68626a5200b6", "score": "0.77693665", "text": "func StringInSlice(strSlice []string, needle string) bool {\n\tfor _, item := range strSlice {\n\t\tif item == needle {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "45d99f9621b72f6d54353bebc47cab06", "score": "0.7756707", "text": "func stringInSlice(a string, slc []string) bool {\n\tfor _, b := range slc {\n\t\tif b == a {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "09433d268524cde46085ad1fd3e495b0", "score": "0.7737708", "text": "func IsStringInSlice(s string, slice []string) bool {\n\tfor _, str := range slice {\n\t\tif str == s {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "32a7ee01a06291e8c5f3cfef1f4fd899", "score": "0.7737706", "text": "func StringInSlice(searchStr string, strs []string) bool {\n\tfor _, str := range strs {\n\t\tif searchStr == str {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "e1f2a7bfa2ef19fd46ef3c4dba8b1dd3", "score": "0.7735268", "text": "func stringInSlice(s string, strings []string) bool {\n\tfor _, k := range strings {\n\t\tif s == k {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "a9e068a16ecaa36630e9cd6521967432", "score": "0.7730812", "text": "func stringInSlice(a string, slice []string) bool {\n\tfor _, b := range slice {\n\t\tif a == b {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "7695a4b1d00bb3ab7de141f913526a30", "score": "0.7719171", "text": "func IsStringInSlice(a string, list []string) (inSlice bool) {\n\tfor _, b := range list {\n\t\tif b == a {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "777066280efde0d086399ac4e8f11d2c", "score": "0.77117395", "text": "func StringSliceContains(slice []string, s string) bool {\n\tsort.Strings(slice)\n\ti := sort.SearchStrings(slice, s)\n\t// s is present at slice[i], otherwise s is not present in slice, but i is the index where it would be inserted.\n\treturn i < len(slice) && slice[i] == s\n}", "title": "" }, { "docid": "a5791585ca801f0345ef92a6661373e8", "score": "0.7698737", "text": "func IsStringInSlice(a string, list []string) bool {\n\tfor _, b := range list {\n\t\tif b == a {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "aedcac884b89a08e7b76f3bda175ffdf", "score": "0.76919025", "text": "func inSlice(slice []string, s string) bool {\n\tfor _, ss := range slice {\n\t\tif s == ss {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "aedcac884b89a08e7b76f3bda175ffdf", "score": "0.76919025", "text": "func inSlice(slice []string, s string) bool {\n\tfor _, ss := range slice {\n\t\tif s == ss {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "4de52bcd3489c5686b6250ca6b1dfab3", "score": "0.76868594", "text": "func stringInSlice(a string, list []string) bool {\n\tfor _, b := range list {\n\t\tif b == a {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "4de52bcd3489c5686b6250ca6b1dfab3", "score": "0.76868594", "text": "func stringInSlice(a string, list []string) bool {\n\tfor _, b := range list {\n\t\tif b == a {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "4de52bcd3489c5686b6250ca6b1dfab3", "score": "0.76868594", "text": "func stringInSlice(a string, list []string) bool {\n\tfor _, b := range list {\n\t\tif b == a {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "4de52bcd3489c5686b6250ca6b1dfab3", "score": "0.76868594", "text": "func stringInSlice(a string, list []string) bool {\n\tfor _, b := range list {\n\t\tif b == a {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "4de52bcd3489c5686b6250ca6b1dfab3", "score": "0.76868594", "text": "func stringInSlice(a string, list []string) bool {\n\tfor _, b := range list {\n\t\tif b == a {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "4de52bcd3489c5686b6250ca6b1dfab3", "score": "0.76868594", "text": "func stringInSlice(a string, list []string) bool {\n\tfor _, b := range list {\n\t\tif b == a {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "4de52bcd3489c5686b6250ca6b1dfab3", "score": "0.76868594", "text": "func stringInSlice(a string, list []string) bool {\n\tfor _, b := range list {\n\t\tif b == a {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "4de52bcd3489c5686b6250ca6b1dfab3", "score": "0.76868594", "text": "func stringInSlice(a string, list []string) bool {\n\tfor _, b := range list {\n\t\tif b == a {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "59152e8c2e480b24200ba2008f33ae9c", "score": "0.7672888", "text": "func StringInSlice(str string, list []string) bool {\n\tfor _, item := range list {\n\t\tif item == str {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "307c3f33d9c72fc2a1cd1549ccedbeb3", "score": "0.7672824", "text": "func StringInSlice(a []string, toCheck string) bool {\n\tfor _, s := range a {\n\t\tif s == toCheck {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "c8c1ddd045d49584a11ee5fab53e7595", "score": "0.7653334", "text": "func StringInSlice(arr []string, i string) bool {\n\tfor _, v := range arr {\n\t\tif v == i {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "c8c1ddd045d49584a11ee5fab53e7595", "score": "0.7653334", "text": "func StringInSlice(arr []string, i string) bool {\n\tfor _, v := range arr {\n\t\tif v == i {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "a6fc1d5c914ca9dbea80b34edea6e019", "score": "0.7653021", "text": "func IsStringInSlice(slice []string, str string) bool {\n\tfor _, el := range slice {\n\t\tif el == str {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "0ed59c0a4a45ba8018231346ce72fe7b", "score": "0.76401585", "text": "func StringSliceContains(slice []string, s string) bool {\n\tfor i := range slice {\n\t\tif slice[i] == s {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "b24388dcf4077076286ab9a85da22f22", "score": "0.7638146", "text": "func stringInSlice(str string, list []string) bool {\n\tfor _, v := range list {\n\t\tif v == str {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "2af819769c39d8b6e7037783c086b1c8", "score": "0.7603506", "text": "func IsStringInSlice(needle string, haystack []string) bool {\n\tfor _, hs := range haystack {\n\t\tif needle == hs {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "3003a920a2598f235049df8c5611134a", "score": "0.7599774", "text": "func SliceContainsString(needle string, haystack []string) bool {\n\tfor _, v := range haystack {\n\t\tif v == needle {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "81b44c03c1d1ce073ac962833b93b263", "score": "0.75601363", "text": "func stringInSlice(a string, list *[]string) bool {\n\n\tfor _, b := range *list {\n\n\t\tif strings.Contains(b, a) {\n\t\t\treturn true\n\t\t}\n\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "f905e410013b67c8d020da93e9a7385e", "score": "0.75261056", "text": "func CheckStringInSlice(s string, arr []string) bool {\n\tfor _, i := range arr {\n\t\tif i == s {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "6a3bf7446b42c569c6c142c1d108c01d", "score": "0.7509931", "text": "func ContainsString(slice []string, s string) bool {\n\tfor _, item := range slice {\n\t\tif item == s {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "274cc1f32b7bdeef2066554051049aeb", "score": "0.7509202", "text": "func SliceContainsString(slice []string, value string) bool {\n\texists := false\n\tfor _, targetNamespace := range slice {\n\t\tif targetNamespace == value {\n\t\t\texists = true\n\t\t}\n\t}\n\treturn exists\n}", "title": "" }, { "docid": "640dad2d971bd4394b317ac38d559e7e", "score": "0.75036526", "text": "func StringInSlice(target string, sli []string) bool {\n\tfor _, element := range sli {\n\t\tif element == target {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "8859eccc102561684d21c473d33f9367", "score": "0.7500121", "text": "func ContainsString(slice []string, s string) bool {\n\tfor _, item := range slice {\n\t\tif item == s {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "8859eccc102561684d21c473d33f9367", "score": "0.7500121", "text": "func ContainsString(slice []string, s string) bool {\n\tfor _, item := range slice {\n\t\tif item == s {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "8859eccc102561684d21c473d33f9367", "score": "0.7500121", "text": "func ContainsString(slice []string, s string) bool {\n\tfor _, item := range slice {\n\t\tif item == s {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "8859eccc102561684d21c473d33f9367", "score": "0.7500121", "text": "func ContainsString(slice []string, s string) bool {\n\tfor _, item := range slice {\n\t\tif item == s {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "8859eccc102561684d21c473d33f9367", "score": "0.7500121", "text": "func ContainsString(slice []string, s string) bool {\n\tfor _, item := range slice {\n\t\tif item == s {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "8859eccc102561684d21c473d33f9367", "score": "0.7500121", "text": "func ContainsString(slice []string, s string) bool {\n\tfor _, item := range slice {\n\t\tif item == s {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "8859eccc102561684d21c473d33f9367", "score": "0.7500121", "text": "func ContainsString(slice []string, s string) bool {\n\tfor _, item := range slice {\n\t\tif item == s {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "83e24833acf0a83ccd681874ba8d0011", "score": "0.7489059", "text": "func inSlice(x string, l []string) bool {\n\tfor _, y := range l {\n\t\tif x == y {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "a32297a5edec587b0308649d2c7f601c", "score": "0.748324", "text": "func StringInSlice(target string, list []string) bool {\n\tfor _, candidate := range list {\n\t\tif candidate == target {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "2e7708b7ba8ccac97f9e2cfbeac3f1a6", "score": "0.74827164", "text": "func stringInSlice(target string, slice []string) bool {\n\tsort.Strings(slice)\n\ti := sort.Search(len(slice),\n\t\tfunc(i int) bool { return slice[i] >= target })\n\tif i < len(slice) && slice[i] == target {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "29e349ff7e154c0c885fdd9f4957f1a6", "score": "0.7475053", "text": "func stringInSlice(value string, list []string) bool {\n\tfor i := range list {\n\t\tif value == list[i] {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "5ea6e1e6db75337b95405cc929ccd013", "score": "0.7474867", "text": "func StringInSlice(element string, slice []string) (bool, int) {\n\n\t// for element in slice\n\tfor index, value := range slice {\n\t\tif value == element {\n\t\t\treturn true, index\n\t\t}\n\t}\n\n\t// return false, placeholder\n\treturn false, -1\n\n}", "title": "" }, { "docid": "10a74da18a1a17759ccfcc3423b12911", "score": "0.74498427", "text": "func containsString(slice []string, s string) bool {\n\tfor _, item := range slice {\n\t\tif item == s {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "10a74da18a1a17759ccfcc3423b12911", "score": "0.74498427", "text": "func containsString(slice []string, s string) bool {\n\tfor _, item := range slice {\n\t\tif item == s {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "10a74da18a1a17759ccfcc3423b12911", "score": "0.74498427", "text": "func containsString(slice []string, s string) bool {\n\tfor _, item := range slice {\n\t\tif item == s {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "10a74da18a1a17759ccfcc3423b12911", "score": "0.74498427", "text": "func containsString(slice []string, s string) bool {\n\tfor _, item := range slice {\n\t\tif item == s {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "10a74da18a1a17759ccfcc3423b12911", "score": "0.74498427", "text": "func containsString(slice []string, s string) bool {\n\tfor _, item := range slice {\n\t\tif item == s {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "10a74da18a1a17759ccfcc3423b12911", "score": "0.74498427", "text": "func containsString(slice []string, s string) bool {\n\tfor _, item := range slice {\n\t\tif item == s {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "10a74da18a1a17759ccfcc3423b12911", "score": "0.74498427", "text": "func containsString(slice []string, s string) bool {\n\tfor _, item := range slice {\n\t\tif item == s {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "10a74da18a1a17759ccfcc3423b12911", "score": "0.74498427", "text": "func containsString(slice []string, s string) bool {\n\tfor _, item := range slice {\n\t\tif item == s {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "10a74da18a1a17759ccfcc3423b12911", "score": "0.74498427", "text": "func containsString(slice []string, s string) bool {\n\tfor _, item := range slice {\n\t\tif item == s {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "10a74da18a1a17759ccfcc3423b12911", "score": "0.74498427", "text": "func containsString(slice []string, s string) bool {\n\tfor _, item := range slice {\n\t\tif item == s {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "10a74da18a1a17759ccfcc3423b12911", "score": "0.74498427", "text": "func containsString(slice []string, s string) bool {\n\tfor _, item := range slice {\n\t\tif item == s {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "d696643bcea8aef5576ffb4dd62f55a5", "score": "0.7433983", "text": "func stringInSlice(a string, list []string) bool {\n\tfor _, v := range list {\n\t\t//fmt.Println(\"compare:\", a, v)\n\t\tif v == a {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "1960ef8bf9c0b7c95215e94b68a9cc58", "score": "0.74269664", "text": "func ContainsString(slice []string, str string) bool {\n\tfor _, s := range slice {\n\t\tif s == str {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "4a56f1bb0ed5b6640eba1f9801fa635d", "score": "0.7421141", "text": "func sliceContainsString(str string, slice []string) bool {\n\tfor _, b := range slice {\n\t\tif b == str {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "0ce7df5398a64b2680e90989e2d5f03d", "score": "0.73950845", "text": "func stringIn(str string, slice []string) bool {\n\tfor _, s := range slice {\n\t\tif s == str {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "16ecdb1d219cf472f4b6589951b1c3fa", "score": "0.7390894", "text": "func SliceContainsString(sl *[]string, str string) bool {\n\tfor _, n := range *sl {\n\t\tif str == n {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "f6ede0b39ba8bc2378bf469332d02f3f", "score": "0.7344664", "text": "func StrSliceContains(ss []string, s string) bool {\n\tfor _, v := range ss {\n\t\tif v == s {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "ef67cd786498dde02122fc7dfcdfdc00", "score": "0.73299485", "text": "func StrInSlice(str string, list []string) bool {\n\tfor _, b := range list {\n\t\tif b == str {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "806ae97982b77344da3221d28506f42b", "score": "0.7323588", "text": "func TestStringInSlice(t *testing.T) {\n\ta := []string{\"one\", \"two\", \"three\", \"four\", \"five\", \"six\"}\n\n\tassert.True(t, StringInSlice(\"four\", a))\n\tassert.False(t, StringInSlice(\"seven\", a))\n}", "title": "" }, { "docid": "755ecb6b15f30c89ce7452ad139c0c24", "score": "0.7299267", "text": "func InStrings(slice []string, elem string) bool {\n\treturn Index(slice, elem) >= 0\n}", "title": "" }, { "docid": "2da4cc23b821916f2f89902771c81456", "score": "0.72805524", "text": "func sliceContains(s []string, str string) bool {\n\tfor _, v := range s {\n\t\tif v == str {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "22a214bf990433574337d9aef89ea1ee", "score": "0.72686315", "text": "func ContainsString(slice []string, item string) bool {\n\tfor _, sliceItem := range slice {\n\t\tif sliceItem == item {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "7cfa8d03c2782f69eeef0c3dca223b23", "score": "0.72178006", "text": "func FindStringInSlice(val string, slice []string) (isFound bool) {\n\tfor _, item := range slice {\n\t\tif item == val {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "52fdca034215405e746d1a4889aa6b7c", "score": "0.720104", "text": "func ContainsString(stringSlice []string, str string) bool {\n\tOfStringNotNull(stringSlice)\n\tfor _, s := range stringSlice {\n\t\tif s == str {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "2065d833b54fcb248173a5198c1574e5", "score": "0.71674675", "text": "func FindInSlice(xIn interface{}, sliceIn interface{}) (int, bool) {\n\n\tx := xIn.(string)\n\tslice := sliceIn.([]string)\n\n\txLocationInSliceIn := -1\n\n\tfor sliceIndex, sliceValue := range slice {\n\t\tif x == sliceValue {\n\t\t\txLocationInSliceIn = sliceIndex\n\t\t}\n\t}\n\n\treturn xLocationInSliceIn, xLocationInSliceIn >= 0\n}", "title": "" }, { "docid": "7855fed2818e5a0e48958a6ebd25ab15", "score": "0.71658134", "text": "func StrInSlice(str string, targets []string) (in bool) {\n\tfor _, t := range targets {\n\t\tif str == t {\n\t\t\tin = true\n\t\t\tbreak\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "eebb518d4da77bdc9766a36160564857", "score": "0.7163298", "text": "func StringInSlice(a string, list []string) bool {\n\tfor _, b := range list {\n\t\tif strings.ToLower(b) == strings.ToLower(a) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "bf8ce9e55eecfa1fbeaa46be81988e4c", "score": "0.71617085", "text": "func SubSliceInSlice(subSlice []string, slice []string) bool {\n\tfor _, vs := range subSlice {\n\t\tfor _, v := range slice {\n\t\t\tif strings.EqualFold(vs, v) {\n\t\t\t\tgoto nextCheck\n\t\t\t}\n\t\t}\n\t\treturn false\n\tnextCheck:\n\t}\n\treturn true\n}", "title": "" }, { "docid": "15da98776890035e1a1a75f0f803ef07", "score": "0.71426934", "text": "func InSlice(slice []string, val string) (int, bool) {\n\tfor i, item := range slice {\n\t\tif item == val {\n\t\t\treturn i, true\n\t\t}\n\t}\n\treturn -1, false\n}", "title": "" }, { "docid": "fe4a429916bc9b1318bbd086f3191a9f", "score": "0.71347106", "text": "func StringSliceIncludes(s []string, str string) bool {\n\tfor _, x := range s {\n\t\tif x == str {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "283fc54883b93728626f9f01a0a62e41", "score": "0.7132504", "text": "func containsString(slice []string, element string) bool {\n\treturn !(posString(slice, element) == -1)\n}", "title": "" }, { "docid": "283fc54883b93728626f9f01a0a62e41", "score": "0.7132504", "text": "func containsString(slice []string, element string) bool {\n\treturn !(posString(slice, element) == -1)\n}", "title": "" }, { "docid": "283fc54883b93728626f9f01a0a62e41", "score": "0.7132504", "text": "func containsString(slice []string, element string) bool {\n\treturn !(posString(slice, element) == -1)\n}", "title": "" }, { "docid": "b86d94bd8b92deb4813d4511e72958aa", "score": "0.7088564", "text": "func sliceInSlice(s, target []string) ([]string, bool) {\n\tre := make([]string, 0)\n\ttargetStr := strings.Join(target, \" \")\n\tfor _, ele := range s {\n\t\tif !strings.Contains(targetStr, ele) {\n\t\t\tre = append(re, ele)\n\t\t}\n\t}\n\tif len(re) > 0 {\n\t\treturn re, false\n\t}\n\treturn nil, true\n}", "title": "" }, { "docid": "e12b4e13dbbf9a4b6555411a6ad7aaee", "score": "0.7066234", "text": "func inSlice(slice []string, val string) bool {\n\tfor _, item := range slice {\n\t\tif item == val {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "b52fc0d9caf3d5200f399cf6d95fb20e", "score": "0.70600635", "text": "func StrIn(str string, slice []string) bool {\n\tpred := func(strx string) bool { return (strx == str) }\n\treturn AnySatisfies(pred, slice)\n}", "title": "" }, { "docid": "8783e711175cb71d9a65ac33c01f5b3c", "score": "0.70483714", "text": "func isIn(str string, slice []string) bool {\n\tfor _, v := range slice {\n\t\tif str == v {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "89ced04975fd50322ac87752633645ae", "score": "0.70453185", "text": "func StringInSlice(kind string, list []string) bool {\n\tfor _, b := range list {\n\t\tif b == kind {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "7b4c2d43cc360ce4b76a72a7741b0a4d", "score": "0.704294", "text": "func sliceContains(slc []string, str string) bool {\n\tfor _, s := range slc {\n\t\tif s == str {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "6429cd3c2b3fa4fe23635919ca3640d2", "score": "0.7039692", "text": "func isSliceContainsStr(sl []string, str string) bool {\n\tfor _, s := range sl {\n\t\tif s == str {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "5a2936fc53669bbc10d8b6f9f65d065b", "score": "0.7029964", "text": "func ContainsString(str string, slice []string) bool {\n\tfor _, s := range slice {\n\t\tif strings.EqualFold(s, str) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "6ba748111337599cdbe36ca447eb6e98", "score": "0.702008", "text": "func isInSlice(value string, slice []string) bool {\n\tfor i := range slice {\n\t\tif value == slice[i] {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "49e320dda52469cb92ea516e7e395484", "score": "0.70161945", "text": "func SliceContainsString(slice []string, target string, insensitive ...bool) bool {\n\tif len(insensitive) != 0 && insensitive[0] {\n\t\ttarget = strings.ToLower(target)\n\t\treturn SliceContainsFunc(slice, func(t string) bool { return strings.ToLower(t) == target })\n\t}\n\n\treturn SliceContains(slice, target)\n}", "title": "" } ]
553e21bff0d83657a9cf3a1529b78fbe
to implement an interface in go we just need to implement all the methods in it
[ { "docid": "3d10777fa75ef7a40be2bed8c21671d9", "score": "0.0", "text": "func (rect rectangle) area() float64 {\n\treturn rect.width * rect.height\n}", "title": "" } ]
[ { "docid": "527f84470a7c77e75fe8e7b26754c736", "score": "0.69041836", "text": "func Interface(base interface{}) Registrar {\n\n}", "title": "" }, { "docid": "4aae1b7b821ee023d07b358549d9b7bc", "score": "0.6083313", "text": "func (s *BaseEGraphQLListener) EnterImplementsInterfaces(ctx *ImplementsInterfacesContext) {}", "title": "" }, { "docid": "cbae003be579d85a7e65d1ad7fc9b4b2", "score": "0.58287084", "text": "func (r *Resolver) Interface() InterfaceResolver { return &interfaceResolver{r} }", "title": "" }, { "docid": "ba979b30bd45e1e987a2669bb6fc7076", "score": "0.5808084", "text": "func interfaceEncode(enc *gob.Encoder, p adapter.Split) {\n\terr := enc.Encode(&p)\n\tif err != nil {\n\t\tlog.Fatal(\"encode:\", err)\n\t}\n}", "title": "" }, { "docid": "b8b51db32da750e3030eb54fb3b006ac", "score": "0.5785581", "text": "func (p *Builder) Interface() exec.Builder {\n\treturn (*iBuilder)(p)\n}", "title": "" }, { "docid": "6c5bb1feabad60d390ce89c4133d8c8b", "score": "0.5747642", "text": "func CodeIface(ifLogic, resTyp, code string, args ...interface{}) interface{} { return nil }", "title": "" }, { "docid": "a0a58808cc8aa6a1cd86b4ad93a4435b", "score": "0.57068354", "text": "func TestInterface_case1(t *testing.T) {\n\n\tgunit.Run(new(fixture.InterfaceFixTure), t)\n}", "title": "" }, { "docid": "ba613ef29825f2ada38c3ad3d9ef7106", "score": "0.5703685", "text": "func (a *App) HelloInterface(name interface{}, r *interface{}) error {\n\t*r = map[string]interface{}{\n\t\t\"hello\": name,\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d46e027a9ebe908065cd09ec5bc9de62", "score": "0.57005763", "text": "func ImplementCar() {\n\tsedan := &Car{\"Leather\", 7, 4, true, \"large\"}\n\tvar thisCar Car\n\tmyCar := sedan.DescribeCar(&thisCar)\n\tfmt.Printf(\"This is my car description: %v\\n\", *myCar)\n}", "title": "" }, { "docid": "272346c6eba16cbb9876e919a5c2a31a", "score": "0.5648969", "text": "func (s *BaseEGraphQLListener) ExitImplementsInterfaces(ctx *ImplementsInterfacesContext) {}", "title": "" }, { "docid": "a5d617da34e7d8d5df9c9a029ef64126", "score": "0.5636876", "text": "func intfFunc(i Icar) {\n\tfmt.Println(i.engine())\n\tfmt.Println(i.isElectric())\n\tfmt.Println(i.wheels())\n}", "title": "" }, { "docid": "1cc1b5750a2f526e7cd539fd7d8bdb9c", "score": "0.5601767", "text": "func (name MyName) contractToImplement() {\n\tfmt.Println(name)\n}", "title": "" }, { "docid": "4623f591c64e18194130dbcd880fc7ca", "score": "0.55757606", "text": "func (self *ParticlesArcadeEmitter) MoveDownI(args ...interface{}) interface{}{\n return self.Object.Call(\"moveDown\", args)\n}", "title": "" }, { "docid": "fda53c81f8bb6b54be9f62b2e918cb7e", "score": "0.55639285", "text": "func (gr *goResource) generateInterfaceFile(directory string) error {\n\tgr.SortMethods()\n\tfilename := directory + \"/\" + strings.ToLower(gr.Name) + \"_if.go\"\n\treturn commons.GenerateFile(gr, resourceIfTemplate, \"resource_if_template\", filename, true)\n}", "title": "" }, { "docid": "2156be8dce844b3ceb3964327980efb5", "score": "0.5555462", "text": "func basicInterface() {\n\tvar animal []animals\n\tanimal = []animals{\n\t\tdog{\"A dog\", \"Gaff\"},\n\t\tcat{\"A cat\", \"Myau\"},\n\t\tman{\"A man\", \"Oh, hi!\"}}\n\n\tfor _, str := range animal {\n\t\tfmt.Printf(\"\\tInterface msg: %v\\n\", str.about())\n\t}\n}", "title": "" }, { "docid": "c380b86a3d4ca10c702ff6b043b6905a", "score": "0.55335677", "text": "func (c *Challenge) Implement(intf interface{}) *Challenge {\n\tc.t.Helper()\n\n\tif c.v == nil {\n\t\tc.expect(false, \"Value is nil. It does not implement %v\", reflect.TypeOf(c.v))\n\t\treturn c\n\t}\n\n\tt := reflect.TypeOf(c.v)\n\n\tintft := reflect.TypeOf(intf)\n\tif intft.Elem().Kind() != reflect.Interface {\n\t\tc.expect(false, \"Expected '%v' to be pointer to interface like (*error)(nil)\", intft)\n\t\treturn c\n\t}\n\tc.expect(t == intft || (t.Implements(intft.Elem())), \"Expected '%v' to be implementator of %v\", t, intf)\n\treturn c\n}", "title": "" }, { "docid": "c157f1aea47f73f1e1fc3efb98018c44", "score": "0.5510054", "text": "func (self *Sound) AddMarkerI(args ...interface{}) {\n self.Object.Call(\"addMarker\", args)\n}", "title": "" }, { "docid": "73a3af92da7d3329d43af2adfd02a69a", "score": "0.54766494", "text": "func TestInterfaces(t *testing.T) {\n\tvar myfirstInterfaceImpl MyFirstInterface = MyCustomType{\"politrons\", \"male\"}\n\tmyfirstInterfaceImpl.contractToImplement()\n\tfmt.Printf(\"(%v, %T)\\n\", myfirstInterfaceImpl, myfirstInterfaceImpl)\n\n\tvar nameType MyFirstInterface = MyName(\"Golang has cool features\")\n\tnameType.contractToImplement()\n\tfmt.Printf(\"(%v, %T)\\n\", nameType, nameType)\n}", "title": "" }, { "docid": "e888fcee89c4b0db3fd8a431e2bb0e3f", "score": "0.54543597", "text": "func (self *LinkedList) AddI(args ...interface{}) interface{}{\n return self.Object.Call(\"add\", args)\n}", "title": "" }, { "docid": "a6c345cb01edad794261c31d3337e6bf", "score": "0.5444322", "text": "func GetIface(ifLogic, resTyp, name string) interface{} { return nil }", "title": "" }, { "docid": "f355b3fd4bd12495b13d52fbe9db7e4b", "score": "0.54231304", "text": "func New() Interface { return new(impl) }", "title": "" }, { "docid": "62260aff2c9a449bb9d2cf4093e19083", "score": "0.54216266", "text": "func TestInterface(t *testing.T) {\n\tvar commander kflags.Commander\n\tvar command kflags.Command\n\n\tv := &KCommand{}\n\tcommander = v\n\tcommand = v\n\tt.Log(commander, command)\n}", "title": "" }, { "docid": "03f50a70eb2f867955c84fe5530df459", "score": "0.540803", "text": "func (v Value) Interface(mrb *MrbState) interface{} { return mrb.Intf(v) }", "title": "" }, { "docid": "40b8bd5c33a107b56cd5465c8d8b90be", "score": "0.54062", "text": "func (b *PhysicsSystem) AddByInterface(o Physicsable) {\n\tb.Add(o.GetBasicEntity(), o.GetSpaceComponent(), o.GetBox2dComponent())\n}", "title": "" }, { "docid": "c0c56d66c15152dbf693f5cdd5010aa9", "score": "0.54038584", "text": "func (self *PhysicsP2Body) MoveForwardI(args ...interface{}) {\n self.Object.Call(\"moveForward\", args)\n}", "title": "" }, { "docid": "dd8e835b00af6bd01e7410c58637b225", "score": "0.53971153", "text": "func (v *visitor) processInterface(t *types.Interface) error {\n\tfor i := 0; i < t.NumMethods(); i++ {\n\t\tname := t.Method(i).Name()\n\t\tsignature := t.Method(i).Type().(*types.Signature)\n\t\tfor _, validator := range v.validators {\n\t\t\terr := validator(signature)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrapf(err, \"failed to validate method '%v'\", name)\n\t\t\t}\n\t\t}\n\t\tv.methods[name] = signature\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "779a627aced5dec000d778161505e845", "score": "0.5392732", "text": "func init() {\n\tgob.Register(CustomImpl(0))\n}", "title": "" }, { "docid": "eee8e611962d2670d1dc4c935528d9cd", "score": "0.5370583", "text": "func (n *RelayAgent_Dhcp) Interface(Id string) *RelayAgent_Dhcp_Interface {\n\treturn &RelayAgent_Dhcp_Interface{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"interfaces\", \"interface\"},\n\t\t\tmap[string]interface{}{\"id\": Id},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "eee8e611962d2670d1dc4c935528d9cd", "score": "0.5369856", "text": "func (n *RelayAgent_Dhcp) Interface(Id string) *RelayAgent_Dhcp_Interface {\n\treturn &RelayAgent_Dhcp_Interface{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"interfaces\", \"interface\"},\n\t\t\tmap[string]interface{}{\"id\": Id},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "c7b82f38bf34fefa45bd3cab047d0f9f", "score": "0.53647095", "text": "func (self *PhysicsArcadeBody) MoveFromI(args ...interface{}) bool{\n return self.Object.Call(\"moveFrom\", args).Bool()\n}", "title": "" }, { "docid": "63deb968539cf04e10f2a5ab6a78a9de", "score": "0.5360494", "text": "func (self *ParticlesArcadeEmitter) MoveUpI(args ...interface{}) interface{}{\n return self.Object.Call(\"moveUp\", args)\n}", "title": "" }, { "docid": "aa59f46ad039af3f23cecb8b8e9b3814", "score": "0.5359539", "text": "func I(v ...interface{}) {\n\tbeego.Informational(v...)\n}", "title": "" }, { "docid": "c1b06ca66a8bbdd9913a6aef70bfa6bc", "score": "0.5357413", "text": "func (self *ParticlesArcadeEmitter) AddToHashI(args ...interface{}) bool{\n return self.Object.Call(\"addToHash\", args).Bool()\n}", "title": "" }, { "docid": "7c025fdd1b587da25d7efdd5e948a55e", "score": "0.535577", "text": "func (e *Entry) Interface(key string, i interface{}) *Entry {\n\tif e == nil {\n\t\treturn nil\n\t}\n\n\tif o, ok := i.(ObjectMarshaler); ok {\n\t\treturn e.Object(key, o)\n\t}\n\n\te.buf = append(e.buf, ',', '\"')\n\te.buf = append(e.buf, key...)\n\te.buf = append(e.buf, '\"', ':', '\"')\n\tb := bbpool.Get().(*bb)\n\tb.B = b.B[:0]\n\tenc := json.NewEncoder(b)\n\tenc.SetEscapeHTML(false)\n\terr := enc.Encode(i)\n\tif err != nil {\n\t\tb.B = b.B[:0]\n\t\tfmt.Fprintf(b, \"marshaling error: %+v\", err)\n\t} else {\n\t\tb.B = b.B[:len(b.B)-1]\n\t}\n\te.bytes(b.B)\n\te.buf = append(e.buf, '\"')\n\tif cap(b.B) <= bbcap {\n\t\tbbpool.Put(b)\n\t}\n\n\treturn e\n}", "title": "" }, { "docid": "58b8c6002a80925fb1ae7038e991d22d", "score": "0.5355727", "text": "func FsetIface(ifLogic, resTyp string, object uintptr, haxeType string, name string, val interface{}) {\n}", "title": "" }, { "docid": "058fb53f5b101f952936e8d305bdc1ca", "score": "0.534558", "text": "func (lprc *LPRC) checkInterface() {\n\tcheckFunc := func(search PrefixSearch) bool {\n\t\treturn true\n\t}\n\tvar sPs PrefixSearch\n\tsLprc := NewLPRC([]string{}, 1.0)\n\tsPs = &sLprc\n\tcheckFunc(sPs)\n}", "title": "" }, { "docid": "fb18df93da2b297dd7c6f4662ea3c637", "score": "0.5340748", "text": "func (c *client) Interfaces() ([]*Interface, error) {\n\treturn nil, errUnimplemented\n}", "title": "" }, { "docid": "fb6786b6397db87156979da4aceda181", "score": "0.5339574", "text": "func RegisterInterfaces(registry types.InterfaceRegistry) {\n}", "title": "" }, { "docid": "47b2c4fd963771ea02972c91520411b6", "score": "0.53257805", "text": "func buildInterface(path string) (*Interface, error) {\n\tpkgPath, interfaceName, methodName, err := parseImport(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tinterfaceName, err = formatInterface(interfaceName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tpkg, err := buildPackage(pkgPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ttypeSpec, err := interfaceTypeSpec(interfaceName, pkg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tinterfaceType, ok := typeSpec.Type.(*ast.InterfaceType)\n\tif !ok {\n\t\treturn nil, NewNotAnInterfaceError(\"%q is not an interface\", typeSpec.Name.Name)\n\t}\n\n\tdl(\"Going through %d fields of %q\\n\", len(interfaceType.Methods.List), typeSpec.Name.Name)\n\tmethods := make([]Method, 0, len(interfaceType.Methods.List))\n\n\tfor i, field := range interfaceType.Methods.List {\n\t\tdl(\" %dth field with type %T and Names %v\\n\", i, field.Type, field.Names)\n\t\tfuncType, isMethod := field.Type.(*ast.FuncType)\n\t\tif namesl := len(field.Names); namesl > 0 && isMethod {\n\t\t\tmethods = append(methods, buildMethod(field.Names[0].Name, funcType))\n\t\t} else if ident, ok := field.Type.(*ast.Ident); ok {\n\t\t\tdl(\" embedded interface field %q\\n\", ident.Name)\n\t\t\tembedded, err := buildInterface(fmt.Sprintf(\"%s.%s\", pkgPath, ident.Name))\n\t\t\tif err != nil {\n\t\t\t\tdl(\" error building embedded interface %q: %s\\n\", ident.Name, err.Error())\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tdl(\" adding %d methods from embedded interface\\n\", len(embedded.Methods))\n\t\t\tfor _, m := range embedded.Methods {\n\t\t\t\tmethods = append(methods, m)\n\t\t\t}\n\t\t} else {\n\t\t\tdl(\" unexpected field %q was not processed\\n\", ident.Name)\n\t\t}\n\t}\n\tmethods, err = filterMethod(methods, methodName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn NewInterface(methods), nil\n}", "title": "" }, { "docid": "cdeb0dec18ef3a3be435d6bf157d5bbb", "score": "0.5308284", "text": "func (n *Stp) Interface(Name string) *Stp_Interface {\n\treturn &Stp_Interface{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"interfaces\", \"interface\"},\n\t\t\tmap[string]interface{}{\"name\": Name},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "cdeb0dec18ef3a3be435d6bf157d5bbb", "score": "0.53077054", "text": "func (n *Stp) Interface(Name string) *Stp_Interface {\n\treturn &Stp_Interface{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"interfaces\", \"interface\"},\n\t\t\tmap[string]interface{}{\"name\": Name},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "a93b187b2dcdbf5821cdcc4dcdfc591a", "score": "0.52933115", "text": "func (n *Lacp) Interface(Name string) *Lacp_Interface {\n\treturn &Lacp_Interface{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"interfaces\", \"interface\"},\n\t\t\tmap[string]interface{}{\"name\": Name},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "a93b187b2dcdbf5821cdcc4dcdfc591a", "score": "0.52928025", "text": "func (n *Lacp) Interface(Name string) *Lacp_Interface {\n\treturn &Lacp_Interface{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"interfaces\", \"interface\"},\n\t\t\tmap[string]interface{}{\"name\": Name},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "89373e4dcb6fd8f17364ff7ece16adda", "score": "0.52876025", "text": "func SetIface(ifLogic, resTyp, name string, val interface{}) {}", "title": "" }, { "docid": "79a4a45acc636ff017c8404f79277c1e", "score": "0.5286919", "text": "func renderInterface(i *Interface, receiver string, w io.Writer) error {\n\tvar ugly bytes.Buffer\n\tmethodTmpl, err := template.\n\t\tNew(\"method\").\n\t\tFuncs(template.FuncMap{\"Receiver\": func() string { return receiver }}).\n\t\tParse(\n\t\t\"func ({{Receiver}}) {{.Name}}\" +\n\t\t\t\"({{range .In}}{{.Name}} {{.Type}}, {{end}}) \" +\n\t\t\t\"{{if ne (len .Out) 0}}({{range .Out}}{{.Name}} {{.Type}}, {{end}}){{end}} {\\n\" +\n\t\t\t\"panic(\\\"TODO: implement this method\\\") }\\n\\n\")\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error building template (methods %v): %s\\n\", i.Methods, err)\n\t}\n\n\tfor _, m := range i.Methods {\n\t\tdl(\"rendering method %q\\n\", m.Name)\n\t\terr := methodTmpl.Execute(&ugly, m)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error rendering method %q (%v): %s\\n\", m.Name, m, err)\n\t\t}\n\t}\n\tpretty, err := format.Source(ugly.Bytes())\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error formatting source:\\n%s\\n: %s\\n\",\n\t\t\tugly.Bytes(), err.Error())\n\t}\n\t_, err = w.Write(pretty)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error writing the formatted source: %s\\n\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "83b41c35ad2e674f46a5ef91d960305c", "score": "0.52818584", "text": "func TestTranslatorInterface(t *testing.T) {\n\tvar translator Translator = &testTranslator{}\n\ttranslator.Translate(\"\", \"\", \"\")\n}", "title": "" }, { "docid": "102f8b1746665f3d91dd3472905efcae", "score": "0.527904", "text": "func (t namedInterfaceType) Implementation() visitableType {\n\treturn t\n}", "title": "" }, { "docid": "72f6792ae85e57bc112e2ee1439e24c0", "score": "0.52784836", "text": "func (n *Lldp) Interface(Name string) *Lldp_Interface {\n\treturn &Lldp_Interface{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"interfaces\", \"interface\"},\n\t\t\tmap[string]interface{}{\"name\": Name},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "72f6792ae85e57bc112e2ee1439e24c0", "score": "0.5276908", "text": "func (n *Lldp) Interface(Name string) *Lldp_Interface {\n\treturn &Lldp_Interface{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"interfaces\", \"interface\"},\n\t\t\tmap[string]interface{}{\"name\": Name},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "9442fecc5940de4dd00aa0513d12100e", "score": "0.52756023", "text": "func WriteInterface(w io.Writer, i Interface) {\n\tfmap := map[string]interface{}{\n\t\t\"name\": i.Name,\n\t\t\"signatures\": i.Signatures,\n\t}\n\tconst pattern = `\n type {{ name }} interface {\n {{ range signatures }}\n {{ . }}\n {{ end }}\n }\n `\n\ttempl := template.Must(template.New(\"interface\").Funcs(fmap).Parse(pattern))\n\ttempl.Execute(w, nil)\n}", "title": "" }, { "docid": "c09c1363dcab44351906fbeaa838d32b", "score": "0.5270795", "text": "func (self *PhysicsArcadeBody) MoveToI(args ...interface{}) bool{\n return self.Object.Call(\"moveTo\", args).Bool()\n}", "title": "" }, { "docid": "18048061a542f4fc27352ec10bddf8d1", "score": "0.52682245", "text": "func (s *BaseWebIDLListener) EnterInterfaceMembers(ctx *InterfaceMembersContext) {}", "title": "" }, { "docid": "a4e9b365ac1d13b8297945983a16b010", "score": "0.52586913", "text": "func Dependable_Implement(instance IDependable, trait Dependable) {\n\t_init_.Initialize()\n\n\t_jsii_.StaticInvokeVoid(\n\t\t\"constructs.Dependable\",\n\t\t\"implement\",\n\t\t[]interface{}{instance, trait},\n\t)\n}", "title": "" }, { "docid": "378d029fecbc5dddee189600a18b7031", "score": "0.5255098", "text": "func marshalInterface(obj interface{}) (json.RawMessage, error) {\n\tdata, err := json.Marshal(obj)\n\tif err != nil {\n\t\treturn json.RawMessage{}, fmt.Errorf(\"failed to marshal json: %w\", err)\n\t}\n\treturn json.RawMessage(data), nil\n}", "title": "" }, { "docid": "66fd8fb1cea21d1816660344d639cba8", "score": "0.52548796", "text": "func (n *Stp_Rstp) Interface(Name string) *Stp_Rstp_Interface {\n\treturn &Stp_Rstp_Interface{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"interfaces\", \"interface\"},\n\t\t\tmap[string]interface{}{\"name\": Name},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "66fd8fb1cea21d1816660344d639cba8", "score": "0.52545804", "text": "func (n *Stp_Rstp) Interface(Name string) *Stp_Rstp_Interface {\n\treturn &Stp_Rstp_Interface{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"interfaces\", \"interface\"},\n\t\t\tmap[string]interface{}{\"name\": Name},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "747b5f509ac112d6e99721290501b7c2", "score": "0.5250926", "text": "func implicitInterface() string {\n\tvar a animals = dog{\"Dog\", \"Coold\"}\n\treturn a.about()\n}", "title": "" }, { "docid": "6c34093c8f59eb713641978713b3ca90", "score": "0.5236037", "text": "func (r *PackageMapper) IndexInterface(tInterface *types.Interface) {\n\tfor i := 0; i < tInterface.NumMethods(); i++ {\n\t\tr.IndexFunc(tInterface.Method(i))\n\t}\n}", "title": "" }, { "docid": "05c414cda2c4bdd298213127011de02c", "score": "0.52346027", "text": "func (self *Keyboard) StartI(args ...interface{}) {\n self.Object.Call(\"start\", args)\n}", "title": "" }, { "docid": "b2d7ed50cd2e73a2f84a2b59e2a0f448", "score": "0.52338856", "text": "func (s *BaseWebIDLListener) EnterInterfaceOrMixin(ctx *InterfaceOrMixinContext) {}", "title": "" }, { "docid": "b8c4f9626df963d5a9021cdd23ffc69a", "score": "0.5232652", "text": "func (n *Lacp_Interface_Member) Interface() *Lacp_Interface_Member_Interface {\n\treturn &Lacp_Interface_Member_Interface{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"interface\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "b8c4f9626df963d5a9021cdd23ffc69a", "score": "0.5232652", "text": "func (n *Lacp_Interface_Member) Interface() *Lacp_Interface_Member_Interface {\n\treturn &Lacp_Interface_Member_Interface{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"interface\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "c106b8a8af26973c3218dfdddebb1145", "score": "0.52319944", "text": "func (s *Schema) Interface(name string, typ interface{}, typeResolve interface{}, descs ...string) *Interface {\n\tif typ == nil {\n\t\tpanic(\"nil type passed to Interface\")\n\t}\n\tif name == \"\" {\n\t\tpanic(\"must provide name\")\n\t}\n\tt := reflect.TypeOf(typ)\n\tif t.Kind() == reflect.Ptr {\n\t\tt = t.Elem()\n\t}\n\tif t.Kind() != reflect.Interface {\n\t\tpanic(\"Interface must be a interface Operation in Golang\")\n\t}\n\tif _, ok := s.interfaces[name]; ok {\n\t\tpanic(\"duplicate interface \" + name)\n\t}\n\tvar desc string\n\tif len(descs) > 0 {\n\t\tdesc = descs[0]\n\t}\n\ts.interfaces[name] = &Interface{\n\t\tName: name,\n\t\tDesc: desc,\n\t\tType: typ,\n\t\tFn: typeResolve,\n\t\tPossibleTypes: map[string]*Object{},\n\t}\n\treturn s.interfaces[name]\n}", "title": "" }, { "docid": "0a1a796937d2d1509690ddf6477549e7", "score": "0.5231314", "text": "func (self *ParticlesArcadeEmitter) GetByNameI(args ...interface{}) interface{}{\n return self.Object.Call(\"getByName\", args)\n}", "title": "" }, { "docid": "7a189bbe02a1e4267eab8dd7aa959a2b", "score": "0.5223363", "text": "func main() {\n\tfmt.Println(\"----------Interface-----------\\n\")\n\tvar a Abser\n\tf := MyFloat(-math.Sqrt2)\n\tv := Vertex{3, 4}\n\n\tfmt.Println(\"-----------Example------------\")\n\ta = f // works because MyFloat implements Abser\n\tfmt.Println(a.Abs())\n\ta = &v // works because *Vertex implements Abser\n\tfmt.Println(a.Abs())\n\t// a = &v Doesn't work\n\n\t// So that this main doesn't get too clustered\n\tnilMain()\n}", "title": "" }, { "docid": "ddc2d9447671f1290a1d0044aa0337d0", "score": "0.5220155", "text": "func (customType MyCustomType) contractToImplement() {\n\tfmt.Println(customType.name + \" \" + customType.sex)\n}", "title": "" }, { "docid": "3f1b80a41ae15de1d3483061bd57adc6", "score": "0.521891", "text": "func (n *RelayAgent_Dhcpv6) Interface(Id string) *RelayAgent_Dhcpv6_Interface {\n\treturn &RelayAgent_Dhcpv6_Interface{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"interfaces\", \"interface\"},\n\t\t\tmap[string]interface{}{\"id\": Id},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "3f1b80a41ae15de1d3483061bd57adc6", "score": "0.52188456", "text": "func (n *RelayAgent_Dhcpv6) Interface(Id string) *RelayAgent_Dhcpv6_Interface {\n\treturn &RelayAgent_Dhcpv6_Interface{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"interfaces\", \"interface\"},\n\t\t\tmap[string]interface{}{\"id\": Id},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "60f9f98854de233d749f547c0914b09d", "score": "0.5214771", "text": "func (self *PhysicsP2Body) MoveDownI(args ...interface{}) {\n self.Object.Call(\"moveDown\", args)\n}", "title": "" }, { "docid": "7d2d541f2cb5b7106f405e97c08d4ec0", "score": "0.52013594", "text": "func (self *ParticlesArcadeEmitter) NextI(args ...interface{}) interface{}{\n return self.Object.Call(\"next\", args)\n}", "title": "" }, { "docid": "9c972c3904e37af690a1b054bad827b5", "score": "0.5197463", "text": "func ExampleGetProofOfWorkImpl() {}", "title": "" }, { "docid": "6cb848993d400d650a12f67effd04ea9", "score": "0.51958114", "text": "func implements(q *Query) error {\n\tlconf := loader.Config{Build: q.Build}\n\tallowErrors(&lconf)\n\n\tqpkg, err := importQueryPackage(q.Pos, &lconf)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Set the packages to search.\n\t{\n\t\t// Otherwise inspect the forward and reverse\n\t\t// transitive closure of the selected package.\n\t\t// (In theory even this is incomplete.)\n\t\t_, rev, _ := importgraph.Build(q.Build)\n\t\tfor path := range rev.Search(qpkg) {\n\t\t\tlconf.ImportWithTests(path)\n\t\t}\n\n\t\t// TODO(adonovan): for completeness, we should also\n\t\t// type-check and inspect function bodies in all\n\t\t// imported packages. This would be expensive, but we\n\t\t// could optimize by skipping functions that do not\n\t\t// contain type declarations. This would require\n\t\t// changing the loader's TypeCheckFuncBodies hook to\n\t\t// provide the []*ast.File.\n\t}\n\n\t// Load/parse/type-check the program.\n\tlprog, err := lconf.Load()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tqpos, err := parseQueryPos(lprog, q.Pos, false)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Find the selected type.\n\tpath, action := findInterestingNode(qpos.info, qpos.path)\n\n\tvar method *types.Func\n\tvar T types.Type // selected type (receiver if method != nil)\n\n\tswitch action {\n\tcase actionExpr:\n\t\t// method?\n\t\tif id, ok := path[0].(*ast.Ident); ok {\n\t\t\tif obj, ok := qpos.info.ObjectOf(id).(*types.Func); ok {\n\t\t\t\trecv := obj.Type().(*types.Signature).Recv()\n\t\t\t\tif recv == nil {\n\t\t\t\t\treturn fmt.Errorf(\"this function is not a method\")\n\t\t\t\t}\n\t\t\t\tmethod = obj\n\t\t\t\tT = recv.Type()\n\t\t\t}\n\t\t}\n\n\t\t// If not a method, use the expression's type.\n\t\tif T == nil {\n\t\t\tT = qpos.info.TypeOf(path[0].(ast.Expr))\n\t\t}\n\n\tcase actionType:\n\t\tT = qpos.info.TypeOf(path[0].(ast.Expr))\n\t}\n\tif T == nil {\n\t\treturn fmt.Errorf(\"not a type, method, or value\")\n\t}\n\n\t// Find all named types, even local types (which can have\n\t// methods due to promotion) and the built-in \"error\".\n\t// We ignore aliases 'type M = N' to avoid duplicate\n\t// reporting of the Named type N.\n\tvar allNamed []*types.Named\n\tfor _, info := range lprog.AllPackages {\n\t\tfor _, obj := range info.Defs {\n\t\t\tif obj, ok := obj.(*types.TypeName); ok && !isAlias(obj) {\n\t\t\t\tif named, ok := obj.Type().(*types.Named); ok {\n\t\t\t\t\tallNamed = append(allNamed, named)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tallNamed = append(allNamed, types.Universe.Lookup(\"error\").Type().(*types.Named))\n\n\tvar msets typeutil.MethodSetCache\n\n\t// Test each named type.\n\tvar to, from, fromPtr []types.Type\n\tfor _, U := range allNamed {\n\t\tif isInterface(T) {\n\t\t\tif msets.MethodSet(T).Len() == 0 {\n\t\t\t\tcontinue // empty interface\n\t\t\t}\n\t\t\tif isInterface(U) {\n\t\t\t\tif msets.MethodSet(U).Len() == 0 {\n\t\t\t\t\tcontinue // empty interface\n\t\t\t\t}\n\n\t\t\t\t// T interface, U interface\n\t\t\t\tif !types.Identical(T, U) {\n\t\t\t\t\tif types.AssignableTo(U, T) {\n\t\t\t\t\t\tto = append(to, U)\n\t\t\t\t\t}\n\t\t\t\t\tif types.AssignableTo(T, U) {\n\t\t\t\t\t\tfrom = append(from, U)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// T interface, U concrete\n\t\t\t\tif types.AssignableTo(U, T) {\n\t\t\t\t\tto = append(to, U)\n\t\t\t\t} else if pU := types.NewPointer(U); types.AssignableTo(pU, T) {\n\t\t\t\t\tto = append(to, pU)\n\t\t\t\t}\n\t\t\t}\n\t\t} else if isInterface(U) {\n\t\t\tif msets.MethodSet(U).Len() == 0 {\n\t\t\t\tcontinue // empty interface\n\t\t\t}\n\n\t\t\t// T concrete, U interface\n\t\t\tif types.AssignableTo(T, U) {\n\t\t\t\tfrom = append(from, U)\n\t\t\t} else if pT := types.NewPointer(T); types.AssignableTo(pT, U) {\n\t\t\t\tfromPtr = append(fromPtr, U)\n\t\t\t}\n\t\t}\n\t}\n\n\tvar pos interface{} = qpos\n\tif nt, ok := deref(T).(*types.Named); ok {\n\t\tpos = nt.Obj()\n\t}\n\n\t// Sort types (arbitrarily) to ensure test determinism.\n\tsort.Sort(typesByString(to))\n\tsort.Sort(typesByString(from))\n\tsort.Sort(typesByString(fromPtr))\n\n\tvar toMethod, fromMethod, fromPtrMethod []*types.Selection // contain nils\n\tif method != nil {\n\t\tfor _, t := range to {\n\t\t\ttoMethod = append(toMethod,\n\t\t\t\ttypes.NewMethodSet(t).Lookup(method.Pkg(), method.Name()))\n\t\t}\n\t\tfor _, t := range from {\n\t\t\tfromMethod = append(fromMethod,\n\t\t\t\ttypes.NewMethodSet(t).Lookup(method.Pkg(), method.Name()))\n\t\t}\n\t\tfor _, t := range fromPtr {\n\t\t\tfromPtrMethod = append(fromPtrMethod,\n\t\t\t\ttypes.NewMethodSet(t).Lookup(method.Pkg(), method.Name()))\n\t\t}\n\t}\n\n\tq.Output(lprog.Fset, &implementsResult{\n\t\tqpos, T, pos, to, from, fromPtr, method, toMethod, fromMethod, fromPtrMethod,\n\t})\n\treturn nil\n}", "title": "" }, { "docid": "311fa97d2f47fda451b1887d8020fef6", "score": "0.51934993", "text": "func (self *PhysicsP2Body) AddToWorldI(args ...interface{}) {\n self.Object.Call(\"addToWorld\", args)\n}", "title": "" }, { "docid": "743bc946b2d76310a3dba3588b132fab", "score": "0.5186287", "text": "func (gr *goResource) generateInterfaceFile(directory string) error {\n\tfilename := directory + \"/\" + strings.ToLower(gr.Name) + \"_if.go\"\n\treturn commons.GenerateFile(gr, resourceIfTemplate, \"resource_if_template\", filename, true)\n}", "title": "" }, { "docid": "1540f2c51d5ef322db038d3053de9326", "score": "0.51839834", "text": "func (n *OpticalAmplifier_SupervisoryChannel) Interface() *OpticalAmplifier_SupervisoryChannel_Interface {\n\treturn &OpticalAmplifier_SupervisoryChannel_Interface{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"interface\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "1540f2c51d5ef322db038d3053de9326", "score": "0.5183092", "text": "func (n *OpticalAmplifier_SupervisoryChannel) Interface() *OpticalAmplifier_SupervisoryChannel_Interface {\n\treturn &OpticalAmplifier_SupervisoryChannel_Interface{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"interface\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "b5fda70bf27abb8b7cc14f5ffd923bc0", "score": "0.51780874", "text": "func (self *PhysicsP2Body) AddLineI(args ...interface{}) *P2Line{\n return &P2Line{self.Object.Call(\"addLine\", args)}\n}", "title": "" }, { "docid": "0b51aafb9fc00f09af46061496466ac5", "score": "0.5173314", "text": "func (s *BaseWebIDLListener) EnterInterfaceMember(ctx *InterfaceMemberContext) {}", "title": "" }, { "docid": "271edc6e70782a2231a96430e1da16f3", "score": "0.5169979", "text": "func (p Ptr) Interface() Interface {\n\tif p.flags.ptrType() != interfacePtrType {\n\t\treturn Interface{}\n\t}\n\treturn Interface{\n\t\tseg: p.seg,\n\t\tcap: CapabilityID(p.lenOrCap),\n\t}\n}", "title": "" }, { "docid": "9d56254fb83316ca4244e336dc23fbbb", "score": "0.51630026", "text": "func RegisterInterface(f InterfaceGeneratorFunc) {\n\tgenerators.register(f)\n}", "title": "" }, { "docid": "07a8daa040f3f7d85a28605cb4f6938d", "score": "0.51590496", "text": "func (a *MediaFolder1) Interface() string {\n\treturn a.client.Config.Iface\n}", "title": "" }, { "docid": "9fbf399037e52acb2f68505914c5a411", "score": "0.5156976", "text": "func findInterface(interfaceFile, interfaceName string) (*Interface, error) {\n\tabsPath, err := filepath.Abs(interfaceFile)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to find absolute file path: %w\", err)\n\t}\n\n\tmode := packages.NeedName | packages.NeedFiles | packages.NeedCompiledGoFiles | packages.NeedImports\n\tmode = mode | packages.NeedDeps | packages.NeedTypes | packages.NeedTypesSizes | packages.NeedSyntax | packages.NeedTypesInfo\n\tpkgs, err := packages.Load(&packages.Config{Mode: mode}, absPath)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to load package with import path: %w\", err)\n\t}\n\n\tif len(pkgs) != 1 {\n\t\treturn nil, fmt.Errorf(\"invalid number of packages found: %d\", len(pkgs))\n\t}\n\n\tobj := pkgs[0].Types.Scope().Lookup(interfaceName)\n\tif obj == nil {\n\t\tfmt.Println(\"lookup failed\")\n\t\treturn nil, errNotFound\n\t}\n\n\ttyp, ok := obj.Type().(*types.Named)\n\tif !ok {\n\t\tfmt.Println(\"cast of Type failed\")\n\t\treturn nil, errNotFound\n\t}\n\n\ti := &Interface{\n\t\tName: interfaceName,\n\t\tPkg: pkgs[0].Types,\n\t\tQualifiedName: pkgs[0].Types.Path(),\n\t\tFileName: absPath,\n\t\tNamedType: typ,\n\t}\n\n\tiface, ok := typ.Underlying().(*types.Interface)\n\tif ok {\n\t\ti.IsFunction = false\n\t\ti.ActualInterface = iface\n\t} else {\n\t\tsig, ok := typ.Underlying().(*types.Signature)\n\t\tif !ok {\n\t\t\tfmt.Println(\"cast to signature failed\")\n\t\t\treturn nil, errNotFound\n\t\t}\n\t\ti.IsFunction = true\n\t\ti.SingleFunction = &Method{Name: \"Execute\", Signature: sig}\n\t}\n\n\treturn i, nil\n}", "title": "" }, { "docid": "31e65dbca4989da5807ac2e49ad821b7", "score": "0.5155535", "text": "func (n *NetworkInstance_Protocol_Igmp) Interface(InterfaceId string) *NetworkInstance_Protocol_Igmp_Interface {\n\treturn &NetworkInstance_Protocol_Igmp_Interface{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"interfaces\", \"interface\"},\n\t\t\tmap[string]interface{}{\"interface-id\": InterfaceId},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "b194f8f1de75dbf6b0fe3e68731ca033", "score": "0.5154603", "text": "func (a *LEAdvertisement1) Interface() string {\n\treturn a.client.Config.Iface\n}", "title": "" }, { "docid": "31e65dbca4989da5807ac2e49ad821b7", "score": "0.51530915", "text": "func (n *NetworkInstance_Protocol_Igmp) Interface(InterfaceId string) *NetworkInstance_Protocol_Igmp_Interface {\n\treturn &NetworkInstance_Protocol_Igmp_Interface{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"interfaces\", \"interface\"},\n\t\t\tmap[string]interface{}{\"interface-id\": InterfaceId},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "430daf8c92c426a9637b78346e369ffd", "score": "0.5146499", "text": "func checkInterface(i *interpreter, itype *types.Interface, x iface) string {\n\tif meth, _ := types.MissingMethod(x.t, itype, true); meth != nil {\n\t\treturn fmt.Sprintf(\"interface conversion: %v is not %v: missing method %s\",\n\t\t\tx.t, itype, meth.Name())\n\t}\n\treturn \"\" // ok\n}", "title": "" }, { "docid": "10e6c53f7bb6b80e560a45fecb45739f", "score": "0.51385593", "text": "func (a *MessageAccess1) Interface() string {\n\treturn a.client.Config.Iface\n}", "title": "" }, { "docid": "187971095b4b6427b8371d633fc76e08", "score": "0.51335716", "text": "func BenchmarkInterface(b *testing.B) {\n\tfor i := 0; i < b.N; i++ {\n\t\tcallInteface(data)\n\t}\n}", "title": "" }, { "docid": "302e1c99928726c613faf3e82c02f533", "score": "0.51323617", "text": "func (self *ParticlesArcadeEmitter) UpdateI(args ...interface{}) {\n self.Object.Call(\"update\", args)\n}", "title": "" }, { "docid": "decdbf17e71da122633c5b1a5c2c83c0", "score": "0.51242554", "text": "func (self *ParticlesArcadeEmitter) GetAllI(args ...interface{}) interface{}{\n return self.Object.Call(\"getAll\", args)\n}", "title": "" }, { "docid": "2835b89b932d3c9efc7afe6f1b1230dc", "score": "0.51175886", "text": "func (self *PhysicsArcadeBody) RenderI(args ...interface{}) {\n self.Object.Call(\"render\", args)\n}", "title": "" }, { "docid": "fe1ddabea2ee8653e28151d1d66c89a4", "score": "0.51156074", "text": "func Interface(node *goeapi.Node) *BaseInterfaceEntity {\n\treturn &BaseInterfaceEntity{&AbstractBaseEntity{node}}\n}", "title": "" }, { "docid": "d660900a4e68f7712398a4638ce5f6ac", "score": "0.5110554", "text": "func main() {\n\t// Calling a method on an interface executes the method of the same name on its underlying type\n\tvar i I\n\n\t// Instantiate a struct T and assign the address to a variable directly\n\tdescribe(i)\n\ti.M()\n\n\ti = F(math.Pi)\n\tdescribe(i)\n\ti.M()\n}", "title": "" }, { "docid": "008031439b5116f184a2e8011910b3cf", "score": "0.5110161", "text": "func (*NetworkInstance_Protocol_Isis_Interface) IsYANGGoStruct() {}", "title": "" }, { "docid": "008031439b5116f184a2e8011910b3cf", "score": "0.5110161", "text": "func (*NetworkInstance_Protocol_Isis_Interface) IsYANGGoStruct() {}", "title": "" }, { "docid": "2269a7b23ac6d82e1e0d941f9666e35f", "score": "0.5106879", "text": "func (self *ParticlesArcadeEmitter) ReplaceI(args ...interface{}) interface{}{\n return self.Object.Call(\"replace\", args)\n}", "title": "" }, { "docid": "d7429470e644a7a430484ef3722df3b1", "score": "0.5099434", "text": "func (self *PhysicsP2Body) MoveUpI(args ...interface{}) {\n self.Object.Call(\"moveUp\", args)\n}", "title": "" }, { "docid": "8bfc7c81a623679484636aca7a7f4c7f", "score": "0.50993836", "text": "func MarshalInterface(in interface{}, out interface{}) (err error) {\n\tinB, err := json.Marshal(in)\n\tif err != nil {\n\t\tlog.Print(err)\n\t\treturn\n\t}\n\treturn json.Unmarshal(inB, &out)\n}", "title": "" }, { "docid": "0ae41f69b28947ec6730d67e44e491b5", "score": "0.5098625", "text": "func (self *Sound) UpdateI(args ...interface{}) {\n self.Object.Call(\"update\", args)\n}", "title": "" }, { "docid": "72c10d01d37418fb0e0d6f8913a2c0c3", "score": "0.5096875", "text": "func (self *ParticlesArcadeEmitter) StartI(args ...interface{}) *ParticlesArcadeEmitter{\n return &ParticlesArcadeEmitter{self.Object.Call(\"start\", args)}\n}", "title": "" }, { "docid": "79975b028c6ecc89cddedf8fe39b8799", "score": "0.5093294", "text": "func PrintInterface(i interface{}) {\n\tfmt.Printf(\"print interface %v %T\\n\", i, i)\n}", "title": "" } ]
052c06192058391f5afc77505ea7523b
AsTwinUpdatesNotInAllowedRange is the BasicCustomAlertRule implementation for FailedLocalLoginsNotInAllowedRange.
[ { "docid": "cd2764a47ef42ffa250d5d7cf7bfea34", "score": "0.7760302", "text": "func (fllniar FailedLocalLoginsNotInAllowedRange) AsTwinUpdatesNotInAllowedRange() (*TwinUpdatesNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" } ]
[ { "docid": "d4b595f3ae28341d86d88ca249b7fb4d", "score": "0.7683986", "text": "func (twcar TimeWindowCustomAlertRule) AsFailedLocalLoginsNotInAllowedRange() (*FailedLocalLoginsNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "767f3df54ccd40f2777714c040d8e389", "score": "0.76515985", "text": "func (tuniar TwinUpdatesNotInAllowedRange) AsFailedLocalLoginsNotInAllowedRange() (*FailedLocalLoginsNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "b2686af737fe019880fc969ccfff02af", "score": "0.7558366", "text": "func (luna LocalUserNotAllowed) AsTwinUpdatesNotInAllowedRange() (*TwinUpdatesNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "66bab04112616fa03ac886a014ca4c8e", "score": "0.7543515", "text": "func (lcar ListCustomAlertRule) AsTwinUpdatesNotInAllowedRange() (*TwinUpdatesNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "1e4712b5eaaa318f6a6cf39a5d1bb711", "score": "0.75344193", "text": "func (dcar DenylistCustomAlertRule) AsFailedLocalLoginsNotInAllowedRange() (*FailedLocalLoginsNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "82c2f1db64e9c659198191ffd8e71105", "score": "0.7529533", "text": "func (lcar ListCustomAlertRule) AsFailedLocalLoginsNotInAllowedRange() (*FailedLocalLoginsNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "4572c37adacc8e680e9dfd2a39867c16", "score": "0.74892443", "text": "func (car CustomAlertRule) AsFailedLocalLoginsNotInAllowedRange() (*FailedLocalLoginsNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "7c448aa49de14394533e48b407b508b0", "score": "0.74596286", "text": "func (tcar ThresholdCustomAlertRule) AsFailedLocalLoginsNotInAllowedRange() (*FailedLocalLoginsNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "0a10085a99801452e446f81599b0108d", "score": "0.74525857", "text": "func (acar AllowlistCustomAlertRule) AsFailedLocalLoginsNotInAllowedRange() (*FailedLocalLoginsNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "79337a57013dd989132236eae631522a", "score": "0.7445124", "text": "func (dcar DenylistCustomAlertRule) AsTwinUpdatesNotInAllowedRange() (*TwinUpdatesNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "9c7fa3251c1cd1a0893bffd15b8b3f0e", "score": "0.74127537", "text": "func (acar AllowlistCustomAlertRule) AsTwinUpdatesNotInAllowedRange() (*TwinUpdatesNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "5516990e0917670a8fc0f18f388e7543", "score": "0.7324039", "text": "func (car CustomAlertRule) AsTwinUpdatesNotInAllowedRange() (*TwinUpdatesNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "06a4a64a7a32a186c6dc5ef4dda52be1", "score": "0.73168063", "text": "func (hdmniar HTTPD2CMessagesNotInAllowedRange) AsFailedLocalLoginsNotInAllowedRange() (*FailedLocalLoginsNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "4b17f1bb56e380b3c23cda1b8dd04cac", "score": "0.7167343", "text": "func (mdmniar MqttD2CMessagesNotInAllowedRange) AsFailedLocalLoginsNotInAllowedRange() (*FailedLocalLoginsNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "51416065a4e91cd34580a35ca6c894b4", "score": "0.7166681", "text": "func (tcar ThresholdCustomAlertRule) AsTwinUpdatesNotInAllowedRange() (*TwinUpdatesNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "061b8e769498b0fba9f346610925fe0f", "score": "0.7142151", "text": "func (twcar TimeWindowCustomAlertRule) AsTwinUpdatesNotInAllowedRange() (*TwinUpdatesNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "aa03c809baa155a532490177317dc4c7", "score": "0.71294963", "text": "func (mcmniar MqttC2DMessagesNotInAllowedRange) AsFailedLocalLoginsNotInAllowedRange() (*FailedLocalLoginsNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "7ff300753a45d6d7b874e771f56f1301", "score": "0.7075699", "text": "func (uoniar UnauthorizedOperationsNotInAllowedRange) AsFailedLocalLoginsNotInAllowedRange() (*FailedLocalLoginsNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "9abf4b5fff5a9ea7710261b35f044ebd", "score": "0.70648324", "text": "func (admniar AmqpD2CMessagesNotInAllowedRange) AsFailedLocalLoginsNotInAllowedRange() (*FailedLocalLoginsNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "5f7d044084268d8479c41317f57fdd02", "score": "0.7061969", "text": "func (luna LocalUserNotAllowed) AsFailedLocalLoginsNotInAllowedRange() (*FailedLocalLoginsNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "23932317c3a0d972e020ce9142205cba", "score": "0.7038125", "text": "func (mcrmniar MqttC2DRejectedMessagesNotInAllowedRange) AsFailedLocalLoginsNotInAllowedRange() (*FailedLocalLoginsNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "f06acdb7ff0cdabe3fa3882d5de0c635", "score": "0.7029795", "text": "func (hcmniar HTTPC2DMessagesNotInAllowedRange) AsFailedLocalLoginsNotInAllowedRange() (*FailedLocalLoginsNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "3e1f233988e5bc2a2154e3eb7c29affb", "score": "0.7017156", "text": "func (hdmniar HTTPD2CMessagesNotInAllowedRange) AsTwinUpdatesNotInAllowedRange() (*TwinUpdatesNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "4ea593f611989db73cc78b2d3ccec57e", "score": "0.70103896", "text": "func (hcrmniar HTTPC2DRejectedMessagesNotInAllowedRange) AsFailedLocalLoginsNotInAllowedRange() (*FailedLocalLoginsNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "f9df6a718084fc35deb0a042a8c89ffa", "score": "0.70031005", "text": "func (hcrmniar HTTPC2DRejectedMessagesNotInAllowedRange) AsTwinUpdatesNotInAllowedRange() (*TwinUpdatesNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "5197717dc9a4910aed5f92dd8fa5addb", "score": "0.69652575", "text": "func (mcrmniar MqttC2DRejectedMessagesNotInAllowedRange) AsTwinUpdatesNotInAllowedRange() (*TwinUpdatesNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "e1f86b65bfb4b1157e439a4b32053faf", "score": "0.6935819", "text": "func (acniar ActiveConnectionsNotInAllowedRange) AsFailedLocalLoginsNotInAllowedRange() (*FailedLocalLoginsNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "7e512d07e7538a9cc09d4e4804091036", "score": "0.6935727", "text": "func (uoniar UnauthorizedOperationsNotInAllowedRange) AsTwinUpdatesNotInAllowedRange() (*TwinUpdatesNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "f2682dad3734e3ea4da56cee7a228449", "score": "0.69313973", "text": "func (ctina ConnectionToIPNotAllowed) AsFailedLocalLoginsNotInAllowedRange() (*FailedLocalLoginsNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "6568892b555279fe5c5dc925c4d72a86", "score": "0.68864614", "text": "func (mdmniar MqttD2CMessagesNotInAllowedRange) AsTwinUpdatesNotInAllowedRange() (*TwinUpdatesNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "326c6710554c00572e0bda2c756b81d1", "score": "0.68737173", "text": "func (ctina ConnectionToIPNotAllowed) AsTwinUpdatesNotInAllowedRange() (*TwinUpdatesNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "0a1487f6101fe3fd7e8b019d994661c1", "score": "0.6845363", "text": "func (acniar ActiveConnectionsNotInAllowedRange) AsTwinUpdatesNotInAllowedRange() (*TwinUpdatesNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "f481144ab144ba40b30548ac8fefbe03", "score": "0.6838724", "text": "func (admniar AmqpD2CMessagesNotInAllowedRange) AsTwinUpdatesNotInAllowedRange() (*TwinUpdatesNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "84581ca750ca9275556e1a5f390b112e", "score": "0.68244547", "text": "func (acrmniar AmqpC2DRejectedMessagesNotInAllowedRange) AsTwinUpdatesNotInAllowedRange() (*TwinUpdatesNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "3c9538f1cbed7a743dc9406e3944bc27", "score": "0.6820956", "text": "func (acrmniar AmqpC2DRejectedMessagesNotInAllowedRange) AsFailedLocalLoginsNotInAllowedRange() (*FailedLocalLoginsNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "c548e2e51bc04934983ec8f74f86d218", "score": "0.6804786", "text": "func (cfina ConnectionFromIPNotAllowed) AsTwinUpdatesNotInAllowedRange() (*TwinUpdatesNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "ced330f4f55a73a60a910034bcc09050", "score": "0.6803357", "text": "func (acmniar AmqpC2DMessagesNotInAllowedRange) AsFailedLocalLoginsNotInAllowedRange() (*FailedLocalLoginsNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "01d1e61147816c3b3a86f76d3fc2d6f6", "score": "0.67869246", "text": "func (cfina ConnectionFromIPNotAllowed) AsFailedLocalLoginsNotInAllowedRange() (*FailedLocalLoginsNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "1d7afb2b3611d0e090cd69e88ad92a1c", "score": "0.6779008", "text": "func (mcmniar MqttC2DMessagesNotInAllowedRange) AsTwinUpdatesNotInAllowedRange() (*TwinUpdatesNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "fbd29b3f960d9f18205dcf7495fed8ee", "score": "0.6756551", "text": "func (hcmniar HTTPC2DMessagesNotInAllowedRange) AsTwinUpdatesNotInAllowedRange() (*TwinUpdatesNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "e373da243bcc6ac2fe68bc7613e5e752", "score": "0.6713792", "text": "func (dminiar DirectMethodInvokesNotInAllowedRange) AsFailedLocalLoginsNotInAllowedRange() (*FailedLocalLoginsNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "54a9c2309c4f8cce4c6a30a7e2c69105", "score": "0.6660695", "text": "func (fllniar FailedLocalLoginsNotInAllowedRange) AsCustomAlertRule() (*CustomAlertRule, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "caa29fbb2fca4627b5f7050c40c12e90", "score": "0.6573623", "text": "func (tuniar TwinUpdatesNotInAllowedRange) AsCustomAlertRule() (*CustomAlertRule, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "28250ecc1dfcb7dc3bac5e65ad230971", "score": "0.65676516", "text": "func (hdmniar HTTPD2CMessagesNotInAllowedRange) AsCustomAlertRule() (*CustomAlertRule, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "20dba9986ccef419b1b9eceed8cea72c", "score": "0.65545845", "text": "func (fllniar FailedLocalLoginsNotInAllowedRange) AsDenylistCustomAlertRule() (*DenylistCustomAlertRule, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "8554dd928ed65e96595dd77e98b78d60", "score": "0.655451", "text": "func (acmniar AmqpC2DMessagesNotInAllowedRange) AsTwinUpdatesNotInAllowedRange() (*TwinUpdatesNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "cd4809f79015e2b96de2db01af784aee", "score": "0.6506129", "text": "func (fllniar FailedLocalLoginsNotInAllowedRange) AsHTTPD2CMessagesNotInAllowedRange() (*HTTPD2CMessagesNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "9fc372ae9cbed000805c0c5deca5b8fd", "score": "0.65020263", "text": "func (fllniar FailedLocalLoginsNotInAllowedRange) AsTimeWindowCustomAlertRule() (*TimeWindowCustomAlertRule, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "3fd99422c18de0dbc3386d46c508d152", "score": "0.6462704", "text": "func (luna LocalUserNotAllowed) AsHTTPD2CMessagesNotInAllowedRange() (*HTTPD2CMessagesNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "0d2032247228e2806938ca7828670f13", "score": "0.64301634", "text": "func (pna ProcessNotAllowed) AsFailedLocalLoginsNotInAllowedRange() (*FailedLocalLoginsNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "6fab75df239a9d85b01f49b4f9e071fd", "score": "0.642214", "text": "func (fllniar FailedLocalLoginsNotInAllowedRange) AsFailedLocalLoginsNotInAllowedRange() (*FailedLocalLoginsNotInAllowedRange, bool) {\n\treturn &fllniar, true\n}", "title": "" }, { "docid": "94ebe80939d7e9301b0c1da55f2cca9d", "score": "0.6412214", "text": "func (hdmniar HTTPD2CMessagesNotInAllowedRange) AsAllowlistCustomAlertRule() (*AllowlistCustomAlertRule, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "948b52696ab2cde9e0f094f349ea5425", "score": "0.64113927", "text": "func (funiar FileUploadsNotInAllowedRange) AsFailedLocalLoginsNotInAllowedRange() (*FailedLocalLoginsNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "f233d62e709e65cd0676e4db42d8e0cb", "score": "0.63777584", "text": "func (pna ProcessNotAllowed) AsTwinUpdatesNotInAllowedRange() (*TwinUpdatesNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "55ef9acf5c8800623796f02bcc0f79fa", "score": "0.6347672", "text": "func (fllniar FailedLocalLoginsNotInAllowedRange) AsHTTPC2DMessagesNotInAllowedRange() (*HTTPC2DMessagesNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "c828ef271665e3442c5ff713a307ccc5", "score": "0.63476175", "text": "func (fllniar FailedLocalLoginsNotInAllowedRange) AsAllowlistCustomAlertRule() (*AllowlistCustomAlertRule, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "f714fa09ed85f06dc24eb9eb121a4655", "score": "0.63297594", "text": "func (fllniar FailedLocalLoginsNotInAllowedRange) AsUnauthorizedOperationsNotInAllowedRange() (*UnauthorizedOperationsNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "517f35ad941a4793b562617522d04300", "score": "0.63265765", "text": "func (hdmniar HTTPD2CMessagesNotInAllowedRange) AsDenylistCustomAlertRule() (*DenylistCustomAlertRule, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "961e84769fe333fcc351d75166e89e4c", "score": "0.6316799", "text": "func (tuniar TwinUpdatesNotInAllowedRange) AsDenylistCustomAlertRule() (*DenylistCustomAlertRule, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "2bc30dc3ed87bcc3f353c08942a9bc0e", "score": "0.630454", "text": "func (mdmniar MqttD2CMessagesNotInAllowedRange) AsCustomAlertRule() (*CustomAlertRule, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "9daee81aeaa1e82167ecac08b1dd33d3", "score": "0.62972504", "text": "func (luna LocalUserNotAllowed) AsHTTPC2DMessagesNotInAllowedRange() (*HTTPC2DMessagesNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "6b3b57099ea8e49982abad0e0a7d3fd4", "score": "0.62795717", "text": "func (twcar TimeWindowCustomAlertRule) AsHTTPD2CMessagesNotInAllowedRange() (*HTTPD2CMessagesNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "d3715a2d24a0283d07e602ce965b4fc5", "score": "0.6275727", "text": "func (uoniar UnauthorizedOperationsNotInAllowedRange) AsCustomAlertRule() (*CustomAlertRule, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "4698c07f1da13f661615ec3dd485aefa", "score": "0.62721777", "text": "func (lcar ListCustomAlertRule) AsHTTPD2CMessagesNotInAllowedRange() (*HTTPD2CMessagesNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "c2a0de1b0bf1f1d0a69ad9293c53e400", "score": "0.62690467", "text": "func (funiar FileUploadsNotInAllowedRange) AsTwinUpdatesNotInAllowedRange() (*TwinUpdatesNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "a1ee14490e3e6de306f45b54fe6102fa", "score": "0.6262809", "text": "func (acar AllowlistCustomAlertRule) AsHTTPD2CMessagesNotInAllowedRange() (*HTTPD2CMessagesNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "7577f082aac92912c2c5f1ff0dd830ce", "score": "0.62504745", "text": "func (qpniar QueuePurgesNotInAllowedRange) AsFailedLocalLoginsNotInAllowedRange() (*FailedLocalLoginsNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "f1eaa9399314ca8f735868c436b3e51d", "score": "0.62481743", "text": "func (hcmniar HTTPC2DMessagesNotInAllowedRange) AsCustomAlertRule() (*CustomAlertRule, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "6c8866d172bb1e7655d1152ebac8e4d9", "score": "0.62368363", "text": "func (fllniar FailedLocalLoginsNotInAllowedRange) AsBasicTimeWindowCustomAlertRule() (BasicTimeWindowCustomAlertRule, bool) {\n\treturn &fllniar, true\n}", "title": "" }, { "docid": "860bd4ecfba302ef33b4b061647c2b4f", "score": "0.6231881", "text": "func (mcmniar MqttC2DMessagesNotInAllowedRange) AsCustomAlertRule() (*CustomAlertRule, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "4da6e9ffdd5f70b144504bec19e66348", "score": "0.62231225", "text": "func (admniar AmqpD2CMessagesNotInAllowedRange) AsCustomAlertRule() (*CustomAlertRule, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "9153358cfeade673c98deb30a2057d8a", "score": "0.62148464", "text": "func (mdmniar MqttD2CMessagesNotInAllowedRange) AsAllowlistCustomAlertRule() (*AllowlistCustomAlertRule, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "d439b962f33a3b24393efdf516c3f7f9", "score": "0.6210164", "text": "func (hdmniar HTTPD2CMessagesNotInAllowedRange) AsListCustomAlertRule() (*ListCustomAlertRule, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "4316ef3dcc9d2417142ac21d89068338", "score": "0.6204022", "text": "func (tuniar TwinUpdatesNotInAllowedRange) AsListCustomAlertRule() (*ListCustomAlertRule, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "2d3d2f633d4184590b3eb64693e5af57", "score": "0.6187835", "text": "func (lcar ListCustomAlertRule) AsHTTPC2DMessagesNotInAllowedRange() (*HTTPC2DMessagesNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "0a9c792444c73720bf461e8123e84219", "score": "0.61848235", "text": "func (hcrmniar HTTPC2DRejectedMessagesNotInAllowedRange) AsCustomAlertRule() (*CustomAlertRule, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "74a69c069bfb90ad0acd61224950b689", "score": "0.61820537", "text": "func (tuniar TwinUpdatesNotInAllowedRange) AsAllowlistCustomAlertRule() (*AllowlistCustomAlertRule, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "87ab4c04ecfa82c4d428ff49f7a6c316", "score": "0.6181945", "text": "func (mcmniar MqttC2DMessagesNotInAllowedRange) AsAllowlistCustomAlertRule() (*AllowlistCustomAlertRule, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "387f4d43a4560ffb5d5b45007cca632f", "score": "0.61798674", "text": "func (fllniar FailedLocalLoginsNotInAllowedRange) AsListCustomAlertRule() (*ListCustomAlertRule, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "b9e144c0c777f3e8f85551bc2d6b412d", "score": "0.6177058", "text": "func (twcar TimeWindowCustomAlertRule) AsUnauthorizedOperationsNotInAllowedRange() (*UnauthorizedOperationsNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "71414734c6e1c8713bde1fc2d074c23c", "score": "0.6173439", "text": "func (acar AllowlistCustomAlertRule) AsHTTPC2DMessagesNotInAllowedRange() (*HTTPC2DMessagesNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "5408bc01a4ead72149dc7bfc583a49c4", "score": "0.6168056", "text": "func (fllniar FailedLocalLoginsNotInAllowedRange) AsHTTPC2DRejectedMessagesNotInAllowedRange() (*HTTPC2DRejectedMessagesNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "4193fdcb3d456012cade161034d375f0", "score": "0.61575437", "text": "func (dcar DenylistCustomAlertRule) AsHTTPD2CMessagesNotInAllowedRange() (*HTTPD2CMessagesNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "fb494fe15bb6aae7a96e4dace41f8d0a", "score": "0.61526334", "text": "func (tuniar TwinUpdatesNotInAllowedRange) AsHTTPD2CMessagesNotInAllowedRange() (*HTTPD2CMessagesNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "f73abd4be8cae0ad5af2be3440a40acc", "score": "0.6148568", "text": "func (dcar DenylistCustomAlertRule) AsHTTPC2DMessagesNotInAllowedRange() (*HTTPC2DMessagesNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "0a2434c4d4dbc6ce8cbe761f55fc9efd", "score": "0.61456156", "text": "func (fllniar FailedLocalLoginsNotInAllowedRange) AsThresholdCustomAlertRule() (*ThresholdCustomAlertRule, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "d8832e98d21a1f33c0eb8fb7b3f41354", "score": "0.6139775", "text": "func (hdmniar HTTPD2CMessagesNotInAllowedRange) AsThresholdCustomAlertRule() (*ThresholdCustomAlertRule, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "b351544e236e0b82466f0098d5005f8a", "score": "0.6132689", "text": "func (lcar ListCustomAlertRule) AsUnauthorizedOperationsNotInAllowedRange() (*UnauthorizedOperationsNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "aabf9a12b44f3a145c0831b68e61292a", "score": "0.61278033", "text": "func (luna LocalUserNotAllowed) AsHTTPC2DRejectedMessagesNotInAllowedRange() (*HTTPC2DRejectedMessagesNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "8d7b0b5430ad3d7b1f9bf1e83727da7d", "score": "0.6111482", "text": "func (mcrmniar MqttC2DRejectedMessagesNotInAllowedRange) AsAllowlistCustomAlertRule() (*AllowlistCustomAlertRule, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "c855c9c6d934e8ac52b3df87a17511e8", "score": "0.6104838", "text": "func (mcrmniar MqttC2DRejectedMessagesNotInAllowedRange) AsCustomAlertRule() (*CustomAlertRule, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "119bcfbc8d90d408d12c4cd0de687b3e", "score": "0.6100548", "text": "func (hcrmniar HTTPC2DRejectedMessagesNotInAllowedRange) AsAllowlistCustomAlertRule() (*AllowlistCustomAlertRule, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "e4c5b3d979d560a33979d37dc935325f", "score": "0.60862607", "text": "func (hdmniar HTTPD2CMessagesNotInAllowedRange) AsTimeWindowCustomAlertRule() (*TimeWindowCustomAlertRule, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "f6c63b61685fc64fd3e5d98bc1e1d0a6", "score": "0.6086138", "text": "func (hcmniar HTTPC2DMessagesNotInAllowedRange) AsAllowlistCustomAlertRule() (*AllowlistCustomAlertRule, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "4641c32ada8574a7d76ee1ec350b6322", "score": "0.6077652", "text": "func (uoniar UnauthorizedOperationsNotInAllowedRange) AsDenylistCustomAlertRule() (*DenylistCustomAlertRule, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "b87028620a136ab542026e16e3875d9b", "score": "0.60626054", "text": "func (fllniar FailedLocalLoginsNotInAllowedRange) AsBasicListCustomAlertRule() (BasicListCustomAlertRule, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "e9b05e2c2a1216c2879e4c1b4f4e2308", "score": "0.606252", "text": "func (dminiar DirectMethodInvokesNotInAllowedRange) AsTwinUpdatesNotInAllowedRange() (*TwinUpdatesNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "cc76d4f85b5291645b4b62cff390e626", "score": "0.6061192", "text": "func (luna LocalUserNotAllowed) AsMqttC2DMessagesNotInAllowedRange() (*MqttC2DMessagesNotInAllowedRange, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "9e85c970fbe3eb8e7703006e79a6943f", "score": "0.6055134", "text": "func (hdmniar HTTPD2CMessagesNotInAllowedRange) AsBasicListCustomAlertRule() (BasicListCustomAlertRule, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "53376d34647d5e6dd015b007384eb4dd", "score": "0.605395", "text": "func (mdmniar MqttD2CMessagesNotInAllowedRange) AsDenylistCustomAlertRule() (*DenylistCustomAlertRule, bool) {\n\treturn nil, false\n}", "title": "" } ]
45e14033c4ba7da79e2b9dd240221b96
SetBudgetName sets the BudgetName field's value.
[ { "docid": "a8423684fe7df719f05995f68933c871", "score": "0.8339047", "text": "func (s *Budget) SetBudgetName(v string) *Budget {\n\ts.BudgetName = &v\n\treturn s\n}", "title": "" } ]
[ { "docid": "a8850603a558af27eb1dc56b0a581410", "score": "0.8659602", "text": "func (o *TransactionSplitUpdate) SetBudgetName(v string) {\n\to.BudgetName.Set(&v)\n}", "title": "" }, { "docid": "e140e81261c5771c871f9a9d6379deef", "score": "0.85690236", "text": "func (s *Action) SetBudgetName(v string) *Action {\n\ts.BudgetName = &v\n\treturn s\n}", "title": "" }, { "docid": "73b7e1642779b2a1bf4d9515f84cc6d2", "score": "0.84729415", "text": "func (s *UpdateSubscriberInput) SetBudgetName(v string) *UpdateSubscriberInput {\n\ts.BudgetName = &v\n\treturn s\n}", "title": "" }, { "docid": "f96428916e563ab0122c96737eafd5df", "score": "0.8448276", "text": "func (s *ExecuteBudgetActionOutput) SetBudgetName(v string) *ExecuteBudgetActionOutput {\n\ts.BudgetName = &v\n\treturn s\n}", "title": "" }, { "docid": "8defe012bd90a1614b239569de590a4b", "score": "0.8441317", "text": "func (s *CreateSubscriberInput) SetBudgetName(v string) *CreateSubscriberInput {\n\ts.BudgetName = &v\n\treturn s\n}", "title": "" }, { "docid": "1f820f6122374882c6660d82ef19b18e", "score": "0.83956915", "text": "func (s *CreateBudgetActionOutput) SetBudgetName(v string) *CreateBudgetActionOutput {\n\ts.BudgetName = &v\n\treturn s\n}", "title": "" }, { "docid": "6a28e068adb5663a8e0e3c6a9e5cc97d", "score": "0.83926886", "text": "func (s *UpdateBudgetActionOutput) SetBudgetName(v string) *UpdateBudgetActionOutput {\n\ts.BudgetName = &v\n\treturn s\n}", "title": "" }, { "docid": "21b8e82967066371b74c94b4787dc66a", "score": "0.8369342", "text": "func (s *UpdateNotificationInput) SetBudgetName(v string) *UpdateNotificationInput {\n\ts.BudgetName = &v\n\treturn s\n}", "title": "" }, { "docid": "d354d22ced0d846958f09173a5f21dff", "score": "0.83686686", "text": "func (s *ExecuteBudgetActionInput) SetBudgetName(v string) *ExecuteBudgetActionInput {\n\ts.BudgetName = &v\n\treturn s\n}", "title": "" }, { "docid": "c5d8d0fdc88a05c7c6e3858f630d0b82", "score": "0.8363232", "text": "func (s *DescribeBudgetActionOutput) SetBudgetName(v string) *DescribeBudgetActionOutput {\n\ts.BudgetName = &v\n\treturn s\n}", "title": "" }, { "docid": "a941ab1bd240b8c2349644985df8f2d3", "score": "0.83466136", "text": "func (s *UpdateBudgetActionInput) SetBudgetName(v string) *UpdateBudgetActionInput {\n\ts.BudgetName = &v\n\treturn s\n}", "title": "" }, { "docid": "a1a1df7adc08ecc535ffba33b3a8d6c1", "score": "0.8342649", "text": "func (s *DeleteBudgetActionOutput) SetBudgetName(v string) *DeleteBudgetActionOutput {\n\ts.BudgetName = &v\n\treturn s\n}", "title": "" }, { "docid": "eb402fd546a9d7b7227c7b8f35bbb5fa", "score": "0.834048", "text": "func (s *BudgetPerformanceHistory) SetBudgetName(v string) *BudgetPerformanceHistory {\n\ts.BudgetName = &v\n\treturn s\n}", "title": "" }, { "docid": "3379860353b6176a81252a6a84af540c", "score": "0.83383024", "text": "func (s *DeleteSubscriberInput) SetBudgetName(v string) *DeleteSubscriberInput {\n\ts.BudgetName = &v\n\treturn s\n}", "title": "" }, { "docid": "b3bbcb3c723c6d927d0a57ecd59c23ab", "score": "0.83263606", "text": "func (s *CreateNotificationInput) SetBudgetName(v string) *CreateNotificationInput {\n\ts.BudgetName = &v\n\treturn s\n}", "title": "" }, { "docid": "a13c454be83465f8351ceb32013e067f", "score": "0.83206993", "text": "func (s *DescribeBudgetInput) SetBudgetName(v string) *DescribeBudgetInput {\n\ts.BudgetName = &v\n\treturn s\n}", "title": "" }, { "docid": "02bba741119256f71802817ed968dff9", "score": "0.831608", "text": "func (s *CreateBudgetActionInput) SetBudgetName(v string) *CreateBudgetActionInput {\n\ts.BudgetName = &v\n\treturn s\n}", "title": "" }, { "docid": "81c156ec6f998d4525d78fb4cc0c7574", "score": "0.8304982", "text": "func (s *DescribeBudgetActionInput) SetBudgetName(v string) *DescribeBudgetActionInput {\n\ts.BudgetName = &v\n\treturn s\n}", "title": "" }, { "docid": "7ede18010c9f769a74645ddd136d939e", "score": "0.82912844", "text": "func (s *DescribeBudgetPerformanceHistoryInput) SetBudgetName(v string) *DescribeBudgetPerformanceHistoryInput {\n\ts.BudgetName = &v\n\treturn s\n}", "title": "" }, { "docid": "cf9aa13eb0593c5dd96883d2d9034ea6", "score": "0.82867306", "text": "func (s *DeleteBudgetActionInput) SetBudgetName(v string) *DeleteBudgetActionInput {\n\ts.BudgetName = &v\n\treturn s\n}", "title": "" }, { "docid": "5badeb219b98a16fb80d18dbf8cec278", "score": "0.82657063", "text": "func (s *DeleteNotificationInput) SetBudgetName(v string) *DeleteNotificationInput {\n\ts.BudgetName = &v\n\treturn s\n}", "title": "" }, { "docid": "40dc9e508eed8e51561675838b8b52cf", "score": "0.8262338", "text": "func (s *DeleteBudgetInput) SetBudgetName(v string) *DeleteBudgetInput {\n\ts.BudgetName = &v\n\treturn s\n}", "title": "" }, { "docid": "0c45cad6f0fcd3c6991c7ecf88b9e08d", "score": "0.8241366", "text": "func (s *DescribeSubscribersForNotificationInput) SetBudgetName(v string) *DescribeSubscribersForNotificationInput {\n\ts.BudgetName = &v\n\treturn s\n}", "title": "" }, { "docid": "a5dad96f6d0660d5edb7fb79122df1e8", "score": "0.8214696", "text": "func (s *DescribeBudgetActionHistoriesInput) SetBudgetName(v string) *DescribeBudgetActionHistoriesInput {\n\ts.BudgetName = &v\n\treturn s\n}", "title": "" }, { "docid": "f64471754ff19118fd1a95a089e8e71d", "score": "0.8180052", "text": "func (s *DescribeBudgetActionsForBudgetInput) SetBudgetName(v string) *DescribeBudgetActionsForBudgetInput {\n\ts.BudgetName = &v\n\treturn s\n}", "title": "" }, { "docid": "82724f9da6ef9b74e645afbf920d8535", "score": "0.81535196", "text": "func (s *DescribeNotificationsForBudgetInput) SetBudgetName(v string) *DescribeNotificationsForBudgetInput {\n\ts.BudgetName = &v\n\treturn s\n}", "title": "" }, { "docid": "0f01f3b2bb6919a822c95e5e267b62b8", "score": "0.811617", "text": "func (s *BudgetNotificationsForAccount) SetBudgetName(v string) *BudgetNotificationsForAccount {\n\ts.BudgetName = &v\n\treturn s\n}", "title": "" }, { "docid": "4c22a8d1a52ea6d5cea027e9b980e32e", "score": "0.6623894", "text": "func (o *TransactionSplitUpdate) UnsetBudgetName() {\n\to.BudgetName.Unset()\n}", "title": "" }, { "docid": "ac9d4fd81c97925eff083ce0411f0b14", "score": "0.65479475", "text": "func (o *TransactionSplitUpdate) GetBudgetName() string {\n\tif o == nil || o.BudgetName.Get() == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.BudgetName.Get()\n}", "title": "" }, { "docid": "4d9b4c95c047bf95e89457dbcc0cd601", "score": "0.63829625", "text": "func (o *TransactionSplitUpdate) SetBudgetNameNil() {\n\to.BudgetName.Set(nil)\n}", "title": "" }, { "docid": "f2d6d643ff07fac00d1596c677ab79ad", "score": "0.5722673", "text": "func (o *TransactionSplitUpdate) HasBudgetName() bool {\n\tif o != nil && o.BudgetName.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "b57e45f61d8e343063c554ec7b87c7f2", "score": "0.5631112", "text": "func (o *TransactionSplitUpdate) SetBudgetId(v string) {\n\to.BudgetId.Set(&v)\n}", "title": "" }, { "docid": "27eb09771f9e8c0b05ba922112cbb7b0", "score": "0.5535932", "text": "func (o *TransactionSplitUpdate) GetBudgetNameOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.BudgetName.Get(), o.BudgetName.IsSet()\n}", "title": "" }, { "docid": "8bc404a3567ef746a3739ff2549a6117", "score": "0.5323174", "text": "func (u *DBUser) GetName() string {\n\treturn u.Name\n}", "title": "" }, { "docid": "990b4b22f6f6217f0040194be3c5f849", "score": "0.5283607", "text": "func (s *BudgetPerformanceHistory) SetBudgetType(v string) *BudgetPerformanceHistory {\n\ts.BudgetType = &v\n\treturn s\n}", "title": "" }, { "docid": "d706c541a0e7efe06f1b47ffd86e24b5", "score": "0.5195824", "text": "func (s *Budget) SetBudgetType(v string) *Budget {\n\ts.BudgetType = &v\n\treturn s\n}", "title": "" }, { "docid": "f7091b5857e3e1d685c14e5cfb4505ec", "score": "0.51494646", "text": "func (d *Dish) SetName(name string) {\n\n}", "title": "" }, { "docid": "dcea346f09a02b28bbe25bdf5520c268", "score": "0.50669885", "text": "func (w *Widget) SetName(name string) {\n\tw.Candy().Guify(\"gtk_widget_set_name\", w, name)\n}", "title": "" }, { "docid": "54f1a70b3c0bd9742291245e9367ae33", "score": "0.50284696", "text": "func (pkg *Package) SetName(name string) {\n\tpkg.Name = fs.Basename(name)\n}", "title": "" }, { "docid": "8ced78b30e9cee9e72bb203f3d42a782", "score": "0.498706", "text": "func (lb *LoggerBase) SetName(name string) {\n\tlb.name = name\n}", "title": "" }, { "docid": "0cd95ff756693583fde736475cc349ab", "score": "0.4969158", "text": "func (dc *DeviceCreate) SetDname(s string) *DeviceCreate {\n\tdc.mutation.SetDname(s)\n\treturn dc\n}", "title": "" }, { "docid": "4b43a04b1e03ba2c6fc2abe007a6eaf9", "score": "0.49536815", "text": "func (e *Adaptor) SetName(n string) { e.name = n }", "title": "" }, { "docid": "4b43a04b1e03ba2c6fc2abe007a6eaf9", "score": "0.49536815", "text": "func (e *Adaptor) SetName(n string) { e.name = n }", "title": "" }, { "docid": "1889cfafab36ddb3c52d282713c3df41", "score": "0.49518818", "text": "func (a *Adaptor) SetName(n string) { a.name = n }", "title": "" }, { "docid": "73345b46dd68fba43e20c128d6732033", "score": "0.49324965", "text": "func (n *Adaptor) SetName(name string) { n.name = name }", "title": "" }, { "docid": "88adadbfa9ad858a7c5cde40f6294568", "score": "0.48981804", "text": "func (o *TransactionSplitUpdate) SetBillName(v string) {\n\to.BillName.Set(&v)\n}", "title": "" }, { "docid": "ecfab9ba57ac9ff77440b7fc1de2947c", "score": "0.48952502", "text": "func (obj *DaemonSet) SetName(name string) *DaemonSet {\n\tobj.ds.SetName(name)\n\treturn obj\n}", "title": "" }, { "docid": "f95cf83af17f864812ae646db82240b1", "score": "0.48926127", "text": "func (dtc *DrugTypeCreate) SetDrugTypeName(s string) *DrugTypeCreate {\n\tdtc.mutation.SetDrugTypeName(s)\n\treturn dtc\n}", "title": "" }, { "docid": "d1f15062fb6062886ba713bfc65a05e1", "score": "0.48809657", "text": "func (mb *MessageBuilder) SetName(newName string) *MessageBuilder {\n\tif err := mb.TrySetName(newName); err != nil {\n\t\tpanic(err)\n\t}\n\treturn mb\n}", "title": "" }, { "docid": "372d25d8a1d06c8f6ea9b810be281019", "score": "0.48615345", "text": "func (biu *BagItemUpdate) SetName(s string) *BagItemUpdate {\n\tbiu.mutation.SetName(s)\n\treturn biu\n}", "title": "" }, { "docid": "938c4fbf2b2f59a471626441b16a4213", "score": "0.48596364", "text": "func (v *Widget) SetName(name string) {\n\tcstr := C.CString(name)\n\tdefer C.free(unsafe.Pointer(cstr))\n\tC.gtk_widget_set_name(v.native(), (*C.gchar)(cstr))\n}", "title": "" }, { "docid": "42d4dfc8c458164571159dd9955025a4", "score": "0.4854392", "text": "func (o *BoneAttachment) SetBoneName(boneName string) {\n\tlog.Println(\"Calling BoneAttachment.SetBoneName()\")\n\n\t// Build out the method's arguments\n\tgoArguments := make([]reflect.Value, 1, 1)\n\tgoArguments[0] = reflect.ValueOf(boneName)\n\n\t// Call the parent method.\n\n\to.callParentMethod(o.baseClass(), \"set_bone_name\", goArguments, \"\")\n\n\tlog.Println(\" Function successfully completed.\")\n\n}", "title": "" }, { "docid": "9c8e340c2e4b830bf0d66f7f51d6db4d", "score": "0.48168263", "text": "func (o *RefreshDatahubsParams) SetDatalakeName(datalakeName string) {\n\to.DatalakeName = datalakeName\n}", "title": "" }, { "docid": "88232590d75969b01872a8ba7d4d654b", "score": "0.48011035", "text": "func (l *Logger) SetName(name string) {\n\tl.wlock.Lock()\n\tdefer l.wlock.Unlock()\n\tl.name = name\n}", "title": "" }, { "docid": "c8c13f6fa8b901b83e7d325d28a9079c", "score": "0.47998446", "text": "func (user *User) SetName(new string) {\n\tuser.Lock()\n\tdefer user.Unlock()\n\tuser.name = new\n}", "title": "" }, { "docid": "c70df3401a1120fe3f2dd319ae47967c", "score": "0.4788152", "text": "func (gruo *GithubRepositoryUpdateOne) SetName(s string) *GithubRepositoryUpdateOne {\n\tgruo.mutation.SetName(s)\n\treturn gruo\n}", "title": "" }, { "docid": "e5ec2bfdc256ad78765c8ff335977a2e", "score": "0.4767234", "text": "func (u PaymentSystemUpdater) SetName(name string) PaymentSystemUpdater {\n\tu.fields[string(PaymentSystemDBSchema.Name)] = name\n\treturn u\n}", "title": "" }, { "docid": "6358eb61eacf78f8cac0f4de34b4a248", "score": "0.47479495", "text": "func (cmd *StaffDirCmd) SetLastname(lastname string) {\n\tcmd.Params[\"lastname\"] = lastname\n}", "title": "" }, { "docid": "02867c25870999ea7d3562e28e08e621", "score": "0.47108078", "text": "func (biuo *BagItemUpdateOne) SetName(s string) *BagItemUpdateOne {\n\tbiuo.mutation.SetName(s)\n\treturn biuo\n}", "title": "" }, { "docid": "a97b01a31dc6b0c668ab1c6e3d89fd16", "score": "0.47057873", "text": "func (m *DepartmentMutation) SetDname(s string) {\n\tm.dname = &s\n}", "title": "" }, { "docid": "74f8e9032a9f12bfd5561141a2a52c95", "score": "0.47049624", "text": "func SetDeviceName(devName string) {\n\t// check if device name is in the list\n\tDeviceName = devName\n\tHistory.Append(tui.NewLabel(\"ok... device name set as: \" + DeviceName))\n}", "title": "" }, { "docid": "d865d71c9d4706b7bd58b40f5dd9f596", "score": "0.4703211", "text": "func (recv *Source) SetName(name string) {\n\tc_name := C.CString(name)\n\tdefer C.free(unsafe.Pointer(c_name))\n\n\tC.g_source_set_name((*C.GSource)(recv.native), c_name)\n\n\treturn\n}", "title": "" }, { "docid": "ab40ed662f2b05ad33d94cde6b02baec", "score": "0.46946916", "text": "func (dsu *DataSourceUpdate) SetName(s string) *DataSourceUpdate {\n\tdsu.mutation.SetName(s)\n\treturn dsu\n}", "title": "" }, { "docid": "b5d8116acdfc6fbd79b1f7d630f4c897", "score": "0.4686223", "text": "func (cuo *ClubUpdateOne) SetName(s string) *ClubUpdateOne {\n\tcuo.mutation.SetName(s)\n\treturn cuo\n}", "title": "" }, { "docid": "de4022c9b58fded5efcabedd995b9048", "score": "0.4671315", "text": "func (gru *GithubRepositoryUpdate) SetName(s string) *GithubRepositoryUpdate {\n\tgru.mutation.SetName(s)\n\treturn gru\n}", "title": "" }, { "docid": "4c65d2a32d7d028a492b89657e1ef6e1", "score": "0.46567523", "text": "func (k *Adaptor) SetName(name string) {\n\tk.name = name\n}", "title": "" }, { "docid": "86dab949bfb01fa3fff11ab7e6ecc307", "score": "0.46498856", "text": "func (dsuo *DataSourceUpdateOne) SetName(s string) *DataSourceUpdateOne {\n\tdsuo.mutation.SetName(s)\n\treturn dsuo\n}", "title": "" }, { "docid": "9307676878b130b357e0755cb2fd054f", "score": "0.46423456", "text": "func (cmd *StaffDirCmd) SetName(name string) {\n\tcmd.Params[\"name\"] = name\n}", "title": "" }, { "docid": "be5f19de5334f846e3e350e4df567d98", "score": "0.4638108", "text": "func (cu *ClubUpdate) SetName(s string) *ClubUpdate {\n\tcu.mutation.SetName(s)\n\treturn cu\n}", "title": "" }, { "docid": "cea93ee6633ea2e5b9528a89f9aaf6b3", "score": "0.46370628", "text": "func (*Bandcamp) GetName() string {\n\treturn \"Bandcamp\"\n}", "title": "" }, { "docid": "3d331a6f459d0ff5ab22b1b00a075b3b", "score": "0.46223304", "text": "func (du *DevelopperUpdate) SetName(s string) *DevelopperUpdate {\n\tdu.mutation.SetName(s)\n\treturn du\n}", "title": "" }, { "docid": "40beb28b6139cf55d48c3e33b4804496", "score": "0.46120614", "text": "func (cmd *StaffDirCmd) Setname(name string) {\n\tcmd.Params[\"name\"] = name\n}", "title": "" }, { "docid": "0ce9c6d834f6cf011507f2dcdc0ed90c", "score": "0.46116006", "text": "func (o *TransactionSplitUpdate) UnsetBillName() {\n\to.BillName.Unset()\n}", "title": "" }, { "docid": "2d3c6a38ee17094f3addac97dd56d181", "score": "0.45835152", "text": "func (cu *ComparatorUpdate) SetName(s string) *ComparatorUpdate {\n\tcu.mutation.SetName(s)\n\treturn cu\n}", "title": "" }, { "docid": "4982fb0fccd0268f65975a0841c924cb", "score": "0.4582023", "text": "func (duo *DevelopperUpdateOne) SetName(s string) *DevelopperUpdateOne {\n\tduo.mutation.SetName(s)\n\treturn duo\n}", "title": "" }, { "docid": "7c8c26246e8eb70215220e3b79a1708a", "score": "0.45801458", "text": "func (kssu *K8sStatefulSetUpdate) SetName(s string) *K8sStatefulSetUpdate {\n\tkssu.mutation.SetName(s)\n\treturn kssu\n}", "title": "" }, { "docid": "8f0562d7a6f9e57dee08bc72a8084a17", "score": "0.4572847", "text": "func (client *Client) SetName(req *SetNameRequest) (*Ok, error) {\n\tresult, err := client.Send(Request{\n\t\tmeta: meta{\n\t\t\tType: \"setName\",\n\t\t},\n\t\tData: map[string]interface{}{\n\t\t\t\"first_name\": req.FirstName,\n\t\t\t\"last_name\": req.LastName,\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": "fdb2f650c52535acb66cc9fd24556f6e", "score": "0.45683694", "text": "func (s *SprinklerMCP23017Driver) SetName(n string) { s.name = n }", "title": "" }, { "docid": "dccca1ab12302e9a8124249d56742a31", "score": "0.4556401", "text": "func (o *BeaconUserName) SetFamilyName(v string) {\n\to.FamilyName = v\n}", "title": "" }, { "docid": "3871e98198d729f045b831aa46ac8eef", "score": "0.45522112", "text": "func (fduo *FlowDraftUpdateOne) SetName(s string) *FlowDraftUpdateOne {\n\tfduo.mutation.SetName(s)\n\treturn fduo\n}", "title": "" }, { "docid": "938cbfb6f61485ae353a8695c20fd219", "score": "0.45372275", "text": "func (u *User) SetName(val string) {\n\t(*u.lock).Lock()\n\tdefer (*u.lock).Unlock()\n\tu.name = val\n}", "title": "" }, { "docid": "c983cc54917a1aff4ac3fabbc4783eab", "score": "0.45261732", "text": "func (kssuo *K8sStatefulSetUpdateOne) SetName(s string) *K8sStatefulSetUpdateOne {\n\tkssuo.mutation.SetName(s)\n\treturn kssuo\n}", "title": "" }, { "docid": "b9d8283751b5b628cec1e4dbda443120", "score": "0.45109105", "text": "func (a *LoggerAdaptor) SetName(name string) {\n\ta.name = name\n}", "title": "" }, { "docid": "c6486121382cf3a9c544fe7e95697c1a", "score": "0.4508418", "text": "func (c *Change) SetName(name string) *Change { c.Name = name; return c }", "title": "" }, { "docid": "702324976e145dc33427c8203e1e35df", "score": "0.4507023", "text": "func (o *audioServer) SetBusName(busIdx int64, name string) {\n\tlog.Println(\"Calling AudioServer.SetBusName()\")\n\n\t// Build out the method's arguments\n\tgoArguments := make([]reflect.Value, 2, 2)\n\tgoArguments[0] = reflect.ValueOf(busIdx)\n\tgoArguments[1] = reflect.ValueOf(name)\n\n\t// Call the parent method.\n\n\to.callParentMethod(o.baseClass(), \"set_bus_name\", goArguments, \"\")\n\n\tlog.Println(\" Function successfully completed.\")\n\n}", "title": "" }, { "docid": "f3e5f5be9b168804a4122fb2b7dbbb97", "score": "0.44993347", "text": "func SetName(name string) Option {\n\treturn func(x *Bucket) error {\n\t\tif len(name) == 0 {\n\t\t\treturn errBucketName\n\t\t}\n\t\tx.name = name\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "d15e2a71b30ec87aca55266e435f3768", "score": "0.4494122", "text": "func (cuo *ComparatorUpdateOne) SetName(s string) *ComparatorUpdateOne {\n\tcuo.mutation.SetName(s)\n\treturn cuo\n}", "title": "" }, { "docid": "e7c7dab63942ad2ab46d6a0f2395dc70", "score": "0.44939974", "text": "func (ad *AliasDomain) setName(name string) error {\n\tif !validAliasDomainName(name) {\n\t\treturn ErrInvalidAliasDomainName\n\t}\n\n\tad.name = name\n\n\treturn nil\n}", "title": "" }, { "docid": "6893aa08e930a17caa36164ff061fba3", "score": "0.44928485", "text": "func (r *TaobaoBaichuanOpenaccountResetcodeSendAPIRequest) SetName(_name string) error {\n\tr._name = _name\n\tr.Set(\"name\", _name)\n\treturn nil\n}", "title": "" }, { "docid": "23bba3808993af091532776aa0a77511", "score": "0.44912127", "text": "func (payload *BitbucketPayload) SetBranchName(branchName string) {\n\tfor idx := range payload.Push.Changes {\n\t\tpayload.Push.Changes[idx].New.Name = branchName\n\t}\n}", "title": "" }, { "docid": "0f36f8a6f6bd293fc6269d438b8f66a9", "score": "0.4474061", "text": "func (d *Descriptor) SetName(name string) {\n\tcopy(d.Name[:], []byte(name))\n\tfor i := len(name); i < len(d.Name); i++ {\n\t\td.Name[i] = 0\n\t}\n}", "title": "" }, { "docid": "cd6e825afe26f57b2952aec301ccf940", "score": "0.44647115", "text": "func (m *IntuneBrandingProfile) SetProfileName(value *string)() {\n err := m.GetBackingStore().Set(\"profileName\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "840feeecb0ec71fc59be27dd714f85e0", "score": "0.44645056", "text": "func (w *WindowDriver) SetName(n string) { w.name = n }", "title": "" }, { "docid": "d73f57a7f785140df3405bea4f8184a4", "score": "0.44625267", "text": "func (dp DirPath) BlindName(key *crypto.SymmetricKey) (string, error) {\n\treturn blindName(key, dp.String())\n}", "title": "" }, { "docid": "bf1c0701ebf93dbf346f7230b5042888", "score": "0.44543993", "text": "func (rp RepoPath) BlindName(key *crypto.SymmetricKey) (string, error) {\n\treturn blindName(key, rp.String())\n}", "title": "" }, { "docid": "81de6ca2bd7acdb4e88b0dae9691a992", "score": "0.44373527", "text": "func (ku *KqiUpdate) SetName(s string) *KqiUpdate {\n\tku.mutation.SetName(s)\n\treturn ku\n}", "title": "" }, { "docid": "aacc9226b559ea72972e26cfac2c8dc1", "score": "0.44356775", "text": "func (_Person *PersonTransactor) SetName(opts *bind.TransactOpts, _name string) (*types.Transaction, error) {\n\treturn _Person.contract.Transact(opts, \"setName\", _name)\n}", "title": "" }, { "docid": "d8f57e13cd123378976879075e4addd2", "score": "0.44343692", "text": "func (_Token *TokenTransactor) SetName(opts *bind.TransactOpts, name_ [32]byte) (*types.Transaction, error) {\n\treturn _Token.contract.Transact(opts, \"setName\", name_)\n}", "title": "" }, { "docid": "5902e26c9a5bf304fab88727db7c2c86", "score": "0.44341886", "text": "func (fdu *FlowDraftUpdate) SetName(s string) *FlowDraftUpdate {\n\tfdu.mutation.SetName(s)\n\treturn fdu\n}", "title": "" }, { "docid": "153c03b7f3d20a17a61046af8dd4c75c", "score": "0.44339123", "text": "func (p *ChatPool) SetName(n string) {\n\tp.Name = n\n}", "title": "" } ]
5ee511831002d952e1a1862bf58e4fe9
WithContext adds the context to the post stack in workspace v4 internal params
[ { "docid": "9bafbe92c3542bb23df9b8d746345496", "score": "0.6983619", "text": "func (o *PostStackInWorkspaceV4InternalParams) WithContext(ctx context.Context) *PostStackInWorkspaceV4InternalParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" } ]
[ { "docid": "166af3d263e43b5f5e3037a14ffa4f17", "score": "0.5893052", "text": "func PostWithContext(ctx context.Context, url, contentType string, body io.Reader) (resp *Response, err error) {\n\treq, err := NewRequest(MethodPost, url, body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Header.Set(\"Content-Type\", contentType)\n\treturn DefaultClient.Do(req)\n}", "title": "" }, { "docid": "a74deaa38663fd02cb09929ab0544263", "score": "0.5815906", "text": "func PostFormWithContext(ctx context.Context, url string, data url.Values) (resp *Response, err error) {\n\treturn PostWithContext(ctx, url, \"application/x-www-form-urlencoded\", strings.NewReader(data.Encode()))\n}", "title": "" }, { "docid": "c361c0ca120db6ad213bc3ef9d4ac0e0", "score": "0.5642381", "text": "func (o *PostStackInWorkspaceV4InternalParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "b748a0b94c26a92082c87fd454ebd039", "score": "0.56047606", "text": "func NewPostStackInWorkspaceV4InternalParamsWithContext(ctx context.Context) *PostStackInWorkspaceV4InternalParams {\n\tvar ()\n\treturn &PostStackInWorkspaceV4InternalParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "3d36795a2d2d33474fd09293b54f7f1e", "score": "0.55956364", "text": "func (o *PostStackInWorkspaceV4InternalParams) WithBody(body *model.StackV4Request) *PostStackInWorkspaceV4InternalParams {\n\to.SetBody(body)\n\treturn o\n}", "title": "" }, { "docid": "506bb065c476559251e9867c66706ebb", "score": "0.5556075", "text": "func (o *PostSepainstantParams) WithContext(ctx context.Context) *PostSepainstantParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "62afe249a2ec6d471541d7406d3adddd", "score": "0.5422647", "text": "func NewPostStackInWorkspaceV4InternalParamsWithHTTPClient(client *http.Client) *PostStackInWorkspaceV4InternalParams {\n\tvar ()\n\treturn &PostStackInWorkspaceV4InternalParams{\n\t\tHTTPClient: client,\n\t}\n}", "title": "" }, { "docid": "5c71e78349ff953e728c55738011a4f2", "score": "0.53788465", "text": "func (o *StorageServiceLoggingLevelPostParams) WithContext(ctx context.Context) *StorageServiceLoggingLevelPostParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "27ab6dc60454231fdfd03e268d8cf405", "score": "0.52988946", "text": "func (o *PostWalletSiacoinsOKBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "a72df7517e85021783f6292fe3b70d4b", "score": "0.527925", "text": "func NewPostStackInWorkspaceV4InternalParams() *PostStackInWorkspaceV4InternalParams {\n\tvar ()\n\treturn &PostStackInWorkspaceV4InternalParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "3ffe6975c135dcd36e9cf97e385997de", "score": "0.51753324", "text": "func (o *PostAPI24RemoteProtectionGroupSnapshotsParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "08077af388b6e5cb0eead17a191bfbac", "score": "0.51644063", "text": "func (o *StorageServiceLoggingLevelPostParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "7cae016c24ca390b3ef65a119996db6b", "score": "0.5150948", "text": "func addContext(data map[string]interface{}, depth int) {\n\t// TODO(dwe): Use logrus to handle this? https://github.com/Sirupsen/logrus/issues/63\n\tdata[callerKey] = caller(depth)\n\n\tfor k, v := range context {\n\t\tdata[k] = v\n\t}\n}", "title": "" }, { "docid": "f8ca4849f23a31d263dd8d9d947041d8", "score": "0.5137281", "text": "func (o *PostWorkflowWorkflowDefinitionsMoidParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "450bdbec35e6c2b47fd70ddfe1f9ac92", "score": "0.513278", "text": "func (req InsertManyRequest) Context(ctx context.Context) InsertManyRequest {\n\treq.impl = req.impl.Context(ctx)\n\n\treturn req\n}", "title": "" }, { "docid": "bb16e65859602eb98b016db8c6aab3cc", "score": "0.5132038", "text": "func (o *PostSepainstantParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "726bcd4910c0a2a97eab90fae0dc9924", "score": "0.5119825", "text": "func (o *CreateUsingPOSTParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "c19a8fdff40b12866f726149492aebfb", "score": "0.5116803", "text": "func (o *PostItemCommandParams) WithContext(ctx context.Context) *PostItemCommandParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "c192dba9c2c5e4a05ed07a547164993c", "score": "0.511508", "text": "func (req InsertObjectManyRequest) Context(ctx context.Context) InsertObjectManyRequest {\n\treq.impl = req.impl.Context(ctx)\n\n\treturn req\n}", "title": "" }, { "docid": "8061f9ce12854fa68e2e06858104f417", "score": "0.5097806", "text": "func (o *PostBuildingsParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "f863e1f5441ea3e0df3a897e1cc7d921", "score": "0.5088746", "text": "func WithContext(next http.HandlerFunc) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tctx := r.Context()\n\n\t\tctx = context.WithValue(ctx, \"values\", map[string]interface{}{})\n\n\t\tr = r.WithContext(ctx)\n\n\t\tnext.ServeHTTP(w, r)\n\t}\n}", "title": "" }, { "docid": "176df2ad47c29416ee9c49ac901d45ef", "score": "0.50886726", "text": "func (q *AQueue) PushWithContext(ctx context.Context, val interface{}) error {\n\tif ctx == nil {\n\t\treturn errInvalidArgument\n\t}\n\tpushFunc, cancelFunc := q.PushAsync(val)\n\tgo func() {\n\t\t<-ctx.Done()\n\t\tcancelFunc()\n\t}()\n\treturn pushFunc()\n}", "title": "" }, { "docid": "1cdb7af4b2310df4ec0ebb7e7d320a0a", "score": "0.5081773", "text": "func (o *SyncUsingPOSTParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "47294e599e4f5534d6e1ee36640a4a2d", "score": "0.506515", "text": "func (im *impl) WithContext(ctx context.Context) { im.ctx = ctx }", "title": "" }, { "docid": "5b94ab6fab98c630d2442aea96a3d683", "score": "0.50545824", "text": "func (o *PostIntermediateWordParams) WithContext(ctx context.Context) *PostIntermediateWordParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "265fd23f275370ded0d7b209e39379aa", "score": "0.5051556", "text": "func (o *PostWorkflowWorkflowDefinitionsMoidParams) WithContext(ctx context.Context) *PostWorkflowWorkflowDefinitionsMoidParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "7a2b0b2dcfd32ca88dc4c8112749c6f9", "score": "0.5042596", "text": "func (o *PostCloudProjectServiceNameStorageContainerIDPublicURLParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "122c7fdbf8b748d14f8160c3c3edd7c5", "score": "0.50170016", "text": "func (o *PostWasmContractsContractAddressOwnerParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "60384d4d54346be5b1c12a8d9b3d0fe1", "score": "0.49968696", "text": "func (o *TimesheetEntryPostParams) WithContext(ctx context.Context) *TimesheetEntryPostParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "11e7198b9ee084dc261ba0b98b5aec4d", "score": "0.4993603", "text": "func NewPostSepainstantParamsWithContext(ctx context.Context) *PostSepainstantParams {\n\tvar ()\n\treturn &PostSepainstantParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "d09ccca477a0721f3f4a0e60364115af", "score": "0.49829677", "text": "func (o *PostAuthBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "c7bb0e7510665a91aaedde250f350823", "score": "0.4958875", "text": "func (o *GetNextCommandUsingPOSTParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "cf9bb4a680b4c04a50737af1c36a2068", "score": "0.4951548", "text": "func (o *SearchAddressInfoUsingPOSTParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "6315893c300c7a507cc9c76bba614cfe", "score": "0.49494204", "text": "func (o *CreateMeteringAssignmentStrategyUsingPOSTParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "5d32ad36e96918344d0e1ff4088ed872", "score": "0.49396232", "text": "func (o *PostStackInWorkspaceV4InternalParams) WithHTTPClient(client *http.Client) *PostStackInWorkspaceV4InternalParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "title": "" }, { "docid": "da28512ba6dd0a83fde93dfac7e8d7a3", "score": "0.49287063", "text": "func (o *PcloudPvminstancesSnapshotsRestorePostParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "8ba3442ecdcf7f3e1d6a6fa30bd7425a", "score": "0.49240458", "text": "func (o *GetCompatablityMatrixUsingPOSTParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "96b6de1b628da7c93d33e455312050b2", "score": "0.49206707", "text": "func (o *PostStoragePhysicalDiskUsagesMoidParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "c9daa9557281f1e610553abb1c697933", "score": "0.49142498", "text": "func (o *PostIntermediateWordParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "8337c2d7c8ecc9f3bc3a2fac7d31eac4", "score": "0.49124196", "text": "func (o *FAXInboundAutomationPostParams) WithContext(ctx context.Context) *FAXInboundAutomationPostParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "2997379826442080c688fbe5c92e00f0", "score": "0.490944", "text": "func (o *CreatePropertyGroupUsingPOSTParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "59642fc36b4ed0e377799c8d98b45853", "score": "0.49064434", "text": "func (o *SyncUsingPOSTParams) WithContext(ctx context.Context) *SyncUsingPOSTParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "0d3414d6038844f620ca4d0d7aae92da", "score": "0.48985723", "text": "func (o *FAXInboundAutomationPostParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "19e5f1f3abe18b12b5226564c2a9a88d", "score": "0.48926052", "text": "func (o *TimesheetEntryPostParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "ba7cd0a075288b8c999e619c8b7f8f44", "score": "0.48901346", "text": "func (o *GetNextCommandUsingPOSTParams) WithContext(ctx context.Context) *GetNextCommandUsingPOSTParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "2a107abdf61d53c066192898f93d807d", "score": "0.48895934", "text": "func (mr *MockSNSClientMockRecorder) PublishWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\tvarargs := append([]interface{}{arg0, arg1}, arg2...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"PublishWithContext\", reflect.TypeOf((*MockSNSClient)(nil).PublishWithContext), varargs...)\n}", "title": "" }, { "docid": "c8c6d188e4b20362a247c6f97d78ee8c", "score": "0.487733", "text": "func (o *PostWorkflowsParams) WithContext(ctx context.Context) *PostWorkflowsParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "108e0439c35175ab3a12c1946fd77b86", "score": "0.4871966", "text": "func (o *PostWalletInitParams) WithContext(ctx context.Context) *PostWalletInitParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "c12110c51befa4930ee8e589c56f4622", "score": "0.48516613", "text": "func (o *PostIamAPIKeysMoidParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "6666e0401fafed656fe2b1d5cf6a31c9", "score": "0.4841633", "text": "func (o *PostWorkflowsParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "72ae1aa944a865cc26fc56b87b5b0c81", "score": "0.48372325", "text": "func (o *StorageServiceMovePostParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "8d738675c6d00efcdcfeafb5bce5713b", "score": "0.48331985", "text": "func (o *PostItemCommandParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "13e2e2daaf36bd027a4474fb29866199", "score": "0.48145685", "text": "func (o *PostIgnoredServiceParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "3a84497d661f6f0378e9174ecd905cd1", "score": "0.48139757", "text": "func (o *GetPostBoxesParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "ffd14e003fd9f5ab5ec23caba48c9840", "score": "0.48138115", "text": "func DoWithContext(ctx Context, actor func(Context)) {\n\tif saveCtx, ok := threadlocal.Get(PuppetContextKey); ok {\n\t\tdefer func() {\n\t\t\tthreadlocal.Set(PuppetContextKey, saveCtx)\n\t\t}()\n\t} else {\n\t\tthreadlocal.Init()\n\t}\n\tthreadlocal.Set(PuppetContextKey, ctx)\n\tactor(ctx)\n}", "title": "" }, { "docid": "4aadedb3e65eed00ee8cd2ea694abb58", "score": "0.48075238", "text": "func (o *PostIgnoredServiceParams) WithContext(ctx context.Context) *PostIgnoredServiceParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "8fcbc55e53db34b09cf6ba6eebd781db", "score": "0.48066232", "text": "func NewWithContext(source string, contextValues map[string]interface{}) KayveeLogger {\n\tcontext := M{}\n\tfor k, v := range contextValues {\n\t\tupdateContextMapIfNotReserved(context, k, v)\n\t}\n\tif os.Getenv(\"_DEPLOY_ENV\") != \"\" {\n\t\tcontext[\"deploy_env\"] = os.Getenv(\"_DEPLOY_ENV\")\n\t}\n\tif os.Getenv(\"_EXECUTION_NAME\") != \"\" {\n\t\tcontext[\"wf_id\"] = os.Getenv(\"_EXECUTION_NAME\")\n\t}\n\tif os.Getenv(\"_POD_ID\") != \"\" {\n\t\tcontext[\"pod-id\"] = os.Getenv(\"_POD_ID\")\n\t}\n\tif os.Getenv(\"_POD_REGION\") != \"\" {\n\t\tcontext[\"pod-region\"] = os.Getenv(\"_POD_REGION\")\n\t}\n\tif os.Getenv(\"_POD_ACCOUNT\") != \"\" {\n\t\tcontext[\"pod-account\"] = os.Getenv(\"_POD_ACCOUNT\")\n\t}\n\tlogObj := Logger{\n\t\tglobals: context,\n\t}\n\n\tfl := defaultFormatLogger{}\n\tlogObj.fLogger = &fl\n\n\tvar logLvl LogLevel\n\tstrLogLvl := os.Getenv(\"KAYVEE_LOG_LEVEL\")\n\tif strLogLvl == \"\" {\n\t\tlogLvl = Trace\n\t} else {\n\t\tfor key, val := range logLevelNames {\n\t\t\tif strings.ToLower(strLogLvl) == val {\n\t\t\t\tlogLvl = key\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\tlogObj.SetConfig(source, logLvl, kv.Format, os.Stderr)\n\n\treturn &logObj\n}", "title": "" }, { "docid": "fa1e90353b4caad94609c395752e81eb", "score": "0.48045266", "text": "func (o *FailureDetectorPhiPostParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "396a462ec0f34e3d0f7eff44fb63210b", "score": "0.48013052", "text": "func (o *AddVappOKBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "22876c063e9179815959216144161277", "score": "0.47982904", "text": "func (o *StorageServiceMovePostParams) WithContext(ctx context.Context) *StorageServiceMovePostParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "62bf2f9d2a1ba1a39b395517c21d6fd3", "score": "0.47951686", "text": "func (o *PostBuildingsParams) WithContext(ctx context.Context) *PostBuildingsParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "8a6b13cc0bf5a43212371157ea77a76e", "score": "0.47927117", "text": "func (m *PostV1PostMortemsReports) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "e853e9983bdba6491c38aafd6378cade", "score": "0.47890186", "text": "func (_obj *MessageWall) PostMessageWithContext(tarsCtx context.Context, Msg *Message, _opt ...map[string]string) (ret int32, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = Msg.WriteBlock(_os, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 0, \"PostMessage\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\t_is := codec.NewReader(tools.Int8ToByte(_resp.SBuffer))\n\terr = _is.Read_int32(&ret, 0, true)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "title": "" }, { "docid": "b13c4818c90342fcf18b87631d188adc", "score": "0.478456", "text": "func (o *PostPolicyListParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "880cad184c6fe74dada0c4549ea36517", "score": "0.4782365", "text": "func (o *CreateOrUpdateUsingPOST2Params) WithContext(ctx context.Context) *CreateOrUpdateUsingPOST2Params {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "3f2bdb231f162c7b614de7d9e9f72156", "score": "0.47815812", "text": "func (o *PostHealthchecksParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "ccdf0abe9f2edc6f53faaf5d5a066959", "score": "0.47796255", "text": "func (o *PostWalletInitParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "de159e455fbe8404776555dbb1400d66", "score": "0.47774637", "text": "func (o *FailureDetectorPhiPostParams) WithContext(ctx context.Context) *FailureDetectorPhiPostParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "a7193b0426202aba5ab8171e637af231", "score": "0.47604772", "text": "func (_obj *Apiupload) AddServantWithContext(imp _impApiuploadWithContext, obj string) {\n\ttars.AddServantWithContext(_obj, imp, obj)\n}", "title": "" }, { "docid": "13eecf194a6d21265dbfdec06b23a423", "score": "0.47584826", "text": "func (o *PostHyperflexServerModelsParams) WithContext(ctx context.Context) *PostHyperflexServerModelsParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "6890f729ccc4d1119fff246e48b5f9ee", "score": "0.4757827", "text": "func (o *CreateOrUpdateUsingPOST2Params) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "7bb68c0182ab7d37039b02255262996b", "score": "0.47557735", "text": "func WithContext(ctx context.Context) RequestHook {\n\treturn func(req *Request) error {\n\t\treq.SetContext(ctx)\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "e188520f91b6e8cc41bc6151721fc69a", "score": "0.47529012", "text": "func (o *PostLolLobbyV1LobbyCustomBotsBySummonerInternalNameParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "8d8a3495ae5e549fca6b8bfa6ebc93ac", "score": "0.4749937", "text": "func SendWithContext[T any](\n\tctx context.Context,\n\tch chan<- T,\n\tval T,\n) error {\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn ctx.Err()\n\tcase ch <- val:\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "e7521923c3ae3f01e48cf8e7bbb14e9d", "score": "0.47451055", "text": "func (m *PostActionPayload) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.contextValidateMetaData(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "067bb4a6cb7214890cfa0bfeb1843d3e", "score": "0.4744951", "text": "func (o *NegotiableQuoteShipmentEstimationV1EstimateByExtendedAddressPostParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "11c997b1525f0964129ba4f1a211317c", "score": "0.4741993", "text": "func (o *PostStoragePureArraysMoidParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "10d6c470a36cefe820bc61fadb458cab", "score": "0.47385946", "text": "func (o *GetWasmContractsContractAddressStoreRawParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "ad0c8ee95c8ea381088ef7383a7fc593", "score": "0.47367802", "text": "func (o *PostHealthchecksParams) WithContext(ctx context.Context) *PostHealthchecksParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "d3a23668d34af6504d670af8b93bdab6", "score": "0.47324553", "text": "func (o *PostV1PostMortemsReportsReportIDAffectedComponentsParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "043d6bdde0bfd0bf7ceca272f59aadd1", "score": "0.472664", "text": "func (o *PostScanPatternSimulationParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "31f3c5dc7d02cfc65c79ffbb55375c9d", "score": "0.47236338", "text": "func (o *EmployeesPostParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "ca06b2743a122f8d0ad1d345e917698a", "score": "0.47218817", "text": "func (o *CheckoutTotalsInformationManagementV1CalculatePostMineParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "16e43ebfbb7b2e6ddf987117ed9ba2f8", "score": "0.47214824", "text": "func (o *AddVappBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "3dfe8ce3fb67563fa52c1a579459eaee", "score": "0.47192696", "text": "func (o *PostStackInWorkspaceV4InternalParams) WithTimeout(timeout time.Duration) *PostStackInWorkspaceV4InternalParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "title": "" }, { "docid": "70bc7a4812c46e2f47bd8b378268fa14", "score": "0.47184765", "text": "func (o *SupportGeometryUploadURLParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "6803cfd3b200ccb932ecbc0d273f4947", "score": "0.47090632", "text": "func NewPostStackInWorkspaceV4InternalParamsWithTimeout(timeout time.Duration) *PostStackInWorkspaceV4InternalParams {\n\tvar ()\n\treturn &PostStackInWorkspaceV4InternalParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "title": "" }, { "docid": "709b4049dfa9bc0e3003a8dd03545379", "score": "0.47075194", "text": "func newContext(ctx context.Context, e events.APIGatewayRequest) context.Context {\n\treturn context.WithValue(ctx, requestContextKey, e.Context)\n}", "title": "" }, { "docid": "67d89e8f0faa9ed6fa8564f913f74f9a", "score": "0.4704338", "text": "func (o *PostVrackServiceNameDedicatedServerParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "5bbba5ad67fd0cc6abd3e72d91095601", "score": "0.47028953", "text": "func (o *SMSDeliveryReceiptAutomationPostParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "ec559a6e20737b3af83a0d6b500931b1", "score": "0.46984148", "text": "func (o *PostAPINotesSubdomainTargetNameRootDomainNameSubdomainNameParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "2a111345e956cddca765f3787601ddce", "score": "0.46951976", "text": "func (o *GetSaltPasswordStatusForStackInWorkspaceV4InternalParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "89638222c60157f7a69ddea8eade1ff8", "score": "0.46930254", "text": "func newContext(ctx context.Context, e events.APIGatewayProxyRequest) context.Context {\n\treturn context.WithValue(ctx, requestContextKey, e.RequestContext)\n}", "title": "" }, { "docid": "c7e12e98019642c1746282a0eb3524da", "score": "0.46927094", "text": "func (o *EmployeesPostParams) WithContext(ctx context.Context) *EmployeesPostParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "e94d7e3e2650cb476ae96f1c098b416c", "score": "0.46921787", "text": "func (o *PostManagementControllersMoidParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "116c3cb170c3fa7f208a602ec01ad24b", "score": "0.46822703", "text": "func (page * PublisherListAPIModelPage) NextWithContext(ctx context.Context) (err error) {\n if tracing.IsEnabled() {\n ctx = tracing.StartSpan(ctx, fqdn + \"/PublisherListAPIModelPage.NextWithContext\")\n defer func() {\n sc := -1\n if page.Response().Response.Response != nil {\n sc = page.Response().Response.Response.StatusCode\n }\n tracing.EndSpan(ctx, sc, err)\n }()\n }\n next, err := page.fn(ctx, page.plam)\n if err != nil {\n return err\n }\n page.plam = next\n return nil\n }", "title": "" }, { "docid": "17daea6e038ee284ff7be5e6ad5953f3", "score": "0.4675612", "text": "func (obj *Greeter) AddServantWithContext(imp impGreeterWithContext, objStr string) {\n\ttars.AddServantWithContext(obj, imp, objStr)\n}", "title": "" }, { "docid": "068b012c796657c04a5a9b72a6236e89", "score": "0.4674564", "text": "func NewPostIntermediateWordParamsWithContext(ctx context.Context) *PostIntermediateWordParams {\n\tvar ()\n\treturn &PostIntermediateWordParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "a265f136ee234d93940d4f36f5226c92", "score": "0.46700168", "text": "func (o *PostWalletSweepSeedParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "4e7cf5b48d1d487a3afa85289dbdb619", "score": "0.46675527", "text": "func (x *xmlWriteBuffer) PushContext(logicalName string, writerArgs ...WithWriterArgs) error {\n\t// Pre-emptive flush to avoid overflow when for a long time no context gets popped\n\tif err := x.Flush(); err != nil {\n\t\treturn err\n\t}\n\tattrs := make([]xml.Attr, 0)\n\tattrs = x.markAsListIfRequired(writerArgs, attrs)\n\treturn x.EncodeToken(xml.StartElement{Name: xml.Name{Local: x.SanitizeLogicalName(logicalName)}, Attr: attrs})\n}", "title": "" } ]
88d4551db914ba4ca77682f03fce4c64
Listen throws data from channel outgoing to Broadcast
[ { "docid": "2bb914f4ac78d1efeba7fc3577310d44", "score": "0.6897121", "text": "func (c *Channel) Listen() {\n\tgo func() {\n\t\tfor data := range c.outgoing {\n\t\t\tc.Broadcast(data)\n\t\t}\n\t}()\n}", "title": "" } ]
[ { "docid": "a0a001f4c3482f8372017e03e11807fd", "score": "0.65348333", "text": "func (b *Broadcaster) Listen() error {\n\tfor {\n\t\tselect {\n\t\tcase m := <-b.send:\n\t\t\tmessage, err := json.Marshal(m)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tb.Send(message)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5c80f11b77eaec70cb983053c678534e", "score": "0.6422199", "text": "func (b *Broadcaster) Broadcast(data []byte) {\n for connection, _ := range b.connections {\n select {\n case connection.write <- data:\n // sent data to write pipe\n\n default:\n // so agressive?\n b.Remove(connection)\n }\n }\n}", "title": "" }, { "docid": "ff8c9fa23c75987fc2dad6ca3c37cdff", "score": "0.63844955", "text": "func (a *App) listen() {\n\tfor {\n\t\t_, msg, err := a.socket.ReadMessage()\n\t\tif err != nil {\n\t\t\tlog.Printf(`failed to read message from server: %s`, err)\n\t\t\t// a.hub.OnDisconnect()\n\t\t\treturn\n\t\t}\n\t\ta.hub.OnServerMessage(msg)\n\t}\n}", "title": "" }, { "docid": "f2b7fc8e2d0b1944a0c0412a321c46a1", "score": "0.63735956", "text": "func (s *Server) broadcast(r *Result) {\n msg, err := json.Marshal(r)\n r.Free()\n\n if err != nil {\n s.Log <- err\n return\n }\n\n for conn, _ := range s.conns {\n conn.msg <- msg\n }\n}", "title": "" }, { "docid": "c608209cbd489b2721309baf5ca62279", "score": "0.61506647", "text": "func (c *Channel) Broadcast(data []byte) {\n\tfor _, client := range c.clients {\n\t\tclient.outgoing <- data\n\t}\n}", "title": "" }, { "docid": "de5e747f2de38734e986b079b937add4", "score": "0.6136943", "text": "func (cm *ConnectionManager) broadcast(r *Message) {\n\tfor _, c := range cm.connection {\n\t\t// buffer to all connections\n\t\tc.messages.PushBack(r)\n\n\t\t// send if polling\n\t\tc.pollCheck()\n\t}\n}", "title": "" }, { "docid": "7555845fa35adf28386ad6bb6a95e809", "score": "0.61193496", "text": "func (s *SocketService) Broadcast(msg *Message) {\n\ts.sessions.Range(func(k, v interface{}) bool {\n\t\ts := v.(*Session)\n\t\tif err := s.GetConn().SendMessage(msg); err != nil {\n\t\t\t// log.Println(err)\n\t\t}\n\t\treturn true\n\t})\n}", "title": "" }, { "docid": "fb270f626ae0079beebdac5135075f40", "score": "0.6096774", "text": "func (chatroom *Chatroom) broadcast(event *models.Event) {\n\tm := MessageResponse{\n\t\tType: \"message\", //replace hardcode\n\t\tData: event,\n\t}\n\tdata, err := json.Marshal(&m)\n\tif err != nil {\n\t\tbeego.Error(\"Error upon marshalling event data: \", err)\n\t\treturn\n\t}\n\n\tfor _, sub := range chatroom.subscribers {\n\t\tif sub.Conn != nil {\n\t\t\tif sub.Conn.WriteMessage(websocket.TextMessage, data) != nil {\n\t\t\t\tchatroom.unsubscribe <- sub.Id\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ddd8d0a2eb8b4e1953390e7d5f0945df", "score": "0.6081235", "text": "func listenToEMDR(connection *zmq4.Socket) {\n\n\tdefer connection.Close()\n\n\tfor {\n\t\tmessage, err := connection.RecvBytes(0)\n\t\tif err != nil {\n\t\t\tlogrus.WithError(err).Error(\"Recv error.\")\n\t\t\tcontinue\n\t\t}\n\n\t\tgo processMessage(message)\n\n\t}\n}", "title": "" }, { "docid": "5ef0d47b9bbcf474c54e8b13a9e34998", "score": "0.60571134", "text": "func (server *Server) listen() {\n\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\t//case data := <-server.incoming:\n\n\t\t\t//\t\t\t\tserver.Broadcast(data)\n\t\t\tcase conn := <-server.joins:\n\t\t\t\tserver.Join(conn)\n\t\t\t}\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "559c0480cf786aaff25dd3819dc897ce", "score": "0.60505396", "text": "func (h *Hub) Broadcast(msg []byte) {\n\th.broadcast <- msg\n}", "title": "" }, { "docid": "663c3a0408635b4a26abeb1d70a30c63", "score": "0.6048618", "text": "func (a *AppHandler) Broadcast(p Payload) {\n\tfor _, c := range a.connections {\n\t\tif c.Type == READER {\n\t\t\tc.Send(p)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "d36a8f127c213ec63588342fc35a62cf", "score": "0.6041765", "text": "func (s *Socket) Broadcast(eventName string, data interface{}) {\n\ts.serv.hub.broadcast(&BroadcastMsg{eventName, data})\n}", "title": "" }, { "docid": "3e980f8dd44103182b19ec767436c9ef", "score": "0.5993483", "text": "func (h *Executor) Broadcast(_ context.Context, cmd *BroadcastRequest) *BroadcastResponse {\n\tdefer observe(time.Now(), h.protocol, \"broadcast\")\n\n\tresp := &BroadcastResponse{}\n\n\tchannels := cmd.Channels\n\tdata := cmd.Data\n\n\tif len(channels) == 0 {\n\t\th.node.Log(centrifuge.NewLogEntry(centrifuge.LogLevelError, \"channels required for broadcast\", nil))\n\t\tresp.Error = ErrorBadRequest\n\t\treturn resp\n\t}\n\n\tif len(data) == 0 {\n\t\th.node.Log(centrifuge.NewLogEntry(centrifuge.LogLevelError, \"data required for broadcast\", nil))\n\t\tresp.Error = ErrorBadRequest\n\t\treturn resp\n\t}\n\n\terrs := make([]error, len(channels))\n\n\tvar wg sync.WaitGroup\n\n\tfor i, ch := range channels {\n\n\t\tif ch == \"\" {\n\t\t\th.node.Log(centrifuge.NewLogEntry(centrifuge.LogLevelError, \"channel can not be blank in broadcast\", nil))\n\t\t\tresp.Error = ErrorBadRequest\n\t\t\treturn resp\n\t\t}\n\n\t\t_, found, err := h.ruleContainer.NamespacedChannelOptions(ch)\n\t\tif err != nil {\n\t\t\th.node.Log(centrifuge.NewLogEntry(centrifuge.LogLevelError, \"error getting options for channel\", map[string]interface{}{\"channel\": ch, \"error\": err.Error()}))\n\t\t\tresp.Error = ErrorInternal\n\t\t\treturn resp\n\t\t}\n\t\tif !found {\n\t\t\th.node.Log(centrifuge.NewLogEntry(centrifuge.LogLevelError, \"can't find namespace for channel\", map[string]interface{}{\"channel\": ch}))\n\t\t\tresp.Error = ErrorNamespaceNotFound\n\t\t\treturn resp\n\t\t}\n\n\t\twg.Add(1)\n\t\tgo func(i int, ch string) {\n\t\t\t_, err := h.node.Publish(ch, data)\n\t\t\terrs[i] = err\n\t\t\twg.Done()\n\t\t}(i, ch)\n\t}\n\twg.Wait()\n\n\tvar firstErr error\n\tfor i := range errs {\n\t\terr := errs[i]\n\t\tif err != nil {\n\t\t\tif firstErr == nil {\n\t\t\t\tfirstErr = err\n\t\t\t}\n\t\t\th.node.Log(centrifuge.NewLogEntry(centrifuge.LogLevelError, \"error publishing into channel\", map[string]interface{}{\"channel\": channels[i], \"error\": err.Error()}))\n\t\t}\n\t}\n\tif firstErr != nil {\n\t\th.node.Log(centrifuge.NewLogEntry(centrifuge.LogLevelError, \"error broadcasting data\", map[string]interface{}{\"error\": firstErr.Error()}))\n\t\tresp.Error = ErrorInternal\n\t\treturn resp\n\t}\n\treturn resp\n}", "title": "" }, { "docid": "92525f388f0632ff4a861e8bd6f759b8", "score": "0.5952793", "text": "func (h *hub) broadcast(username string, room string, msg string, typ string) {\n\tfor _, c := range h.roomConnections[room] {\n\t\tselect {\n\t\tcase c.send <- outgoing{F: username, R: room, M: msg, T: typ}:\n\t\tdefault:\n\t\t\th.disconnect(c)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "7a38a54f891692d3310983456c26b66a", "score": "0.59427434", "text": "func (stream *Event) listen() {\n\tfor {\n\t\tselect {\n\t\t// Add new available client\n\t\tcase client := <-stream.NewClients:\n\t\t\tstream.TotalClients[client] = true\n\t\t\tlog.Printf(\"Client added. %d registered clients\", len(stream.TotalClients))\n\n\t\t// Remove closed client\n\t\tcase client := <-stream.ClosedClients:\n\t\t\tdelete(stream.TotalClients, client)\n\t\t\tclose(client)\n\t\t\tlog.Printf(\"Removed client. %d registered clients\", len(stream.TotalClients))\n\n\t\t// Broadcast message to client\n\t\tcase eventMsg := <-stream.Message:\n\t\t\tfor clientMessageChan := range stream.TotalClients {\n\t\t\t\tclientMessageChan <- eventMsg\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "8f20e955ab6693577d8eabdf1428aac8", "score": "0.58880055", "text": "func listen(events chan []byte, port int) {\n\taddr := net.UDPAddr{\n\t\tPort: port,\n\t\tIP: net.ParseIP(\"127.0.0.1\"),\n\t}\n\tconn, err := net.ListenUDP(\"udp\", &addr)\n\tdefer conn.Close()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tvar buff [1024]byte\n\tfor {\n\t\tn, _, err := conn.ReadFromUDP(buff[:])\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tevents <- buff[:n]\n\t}\n}", "title": "" }, { "docid": "5bab6ab3d2e3c5f002f1aee03b8f973c", "score": "0.58667284", "text": "func Accept(lis net.Listener) {}", "title": "" }, { "docid": "0b7165d3d17bd0fca7e2ec14f3982c62", "score": "0.58576286", "text": "func (ec *EchoServer) Broadcast(channel string, message *types.Data) error {\n\tif socket := ec.Find(message.Socket); message.Socket != \"\" && socket != nil {\n\t\treturn ec.ToOthers(socket, channel, message)\n\t} else {\n\t\treturn ec.ToAll(channel, message)\n\t}\n}", "title": "" }, { "docid": "fb25f7d8959d7c4d2193ab321d776d5c", "score": "0.58576274", "text": "func broadcast(msg *tbuikit.ColorizedString) {\n\tfor _, c := range clientHolder.getClients() {\n\t\tc.WriteMessage(msg)\n\t}\n}", "title": "" }, { "docid": "f04105a5d6da3d0e1751442d043b15f5", "score": "0.58003086", "text": "func (r *Relay) Broadcast(b []byte) {\n\tr.forward <- b\n}", "title": "" }, { "docid": "e2df8467e3caac73738bb64b7f5967a7", "score": "0.57781434", "text": "func (h *Hub) Broadcast(m string) {\n\th.msgMux.Lock()\n\tmsg := NewLogMessage(m)\n\th.messages = append(h.messages, msg)\n\tif len(h.messages) > h.bufSize {\n\t\th.messages = h.messages[len(h.messages)-h.bufSize:]\n\t}\n\th.msgMux.Unlock()\n\th.realBroadcast(\"0\" + msg.String())\n}", "title": "" }, { "docid": "c02896561ce4f4231da7104aeb8002d9", "score": "0.5763826", "text": "func (self *ircBot) listen() {\n\n\tvar contentData []byte\n\tvar content string\n\tvar err error\n\n\tbufRead := bufio.NewReader(self.socket)\n\tfor self.isRunning {\n\t\tcontentData, err = bufRead.ReadBytes('\\n')\n\n\t\tif err != nil {\n\t\t\tnetErr, ok := err.(net.Error)\n\t\t\tif ok && netErr.Timeout() == true {\n\t\t\t\tcontinue\n\n\t\t\t} else if !self.isRunning {\n\t\t\t\t// Close() wants us to stop\n\t\t\t\treturn\n\n\t\t\t} else {\n\t\t\t\tlog.Println(\"Lost IRC server connection. \", err)\n\t\t\t\tself.Close()\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\tif len(contentData) == 0 {\n\t\t\tcontinue\n\t\t}\n\n\t\tcontent = toUnicode(contentData)\n\n\t\tlog.Print(\"[RAW\" + strconv.Itoa(self.id) + \"]\" + content)\n\n\t\ttheLine, err := parseLine(content)\n\t\tif err == nil {\n\t\t\ttheLine.ChatBotId = self.id\n\t\t\tself.act(theLine)\n\t\t} else {\n\t\t\tlog.Println(\"Invalid line:\", content)\n\t\t}\n\n\t}\n}", "title": "" }, { "docid": "ffc07f3f6b2bb9a8650470512b47694b", "score": "0.57435906", "text": "func (l *Listener) listen(sock net.PacketConn) error {\n\tbuf := make([]byte, 4096)\n\tfailures := 0\n\tvar payload struct {\n\t\tCommand string `json:\"command\"`\n\t\tPID int `json:\"pid\"`\n\t}\n\tfor l.ctx.Err() == nil {\n\t\tn, _, err := sock.ReadFrom(buf)\n\t\tif err != nil {\n\t\t\tif l.ctx.Err() != nil {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tlog.Printf(\"error: failed to read from notify socket: %s\", err)\n\t\t\tfailures++\n\t\t\tif failures > 100 {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\ttime.Sleep(100 * time.Millisecond)\n\t\t}\n\t\tfailures = 0\n\t\tif err := json.Unmarshal(buf[:n], &payload); err != nil {\n\t\t\tlog.Printf(\"error: failed to decode notification: %s\", err)\n\t\t\tcontinue\n\t\t}\n\t\tswitch payload.Command {\n\t\tcase \"worker:ack\":\n\t\t\tl.ready <- payload.PID\n\t\tcase \"worker:stopping\":\n\t\t\tl.stopping <- payload.PID\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d9be1560ac0457af73d346bfac7859c9", "score": "0.5737904", "text": "func (sw *Switch) Broadcast(chId byte, msg interface{}) chan bool {\n\tsuccessChan := make(chan bool, len(sw.peers.List()))\n\tlog.Debug(\"Broadcast\", \"channel\", chId, \"msg\", msg)\n\tfor _, peer := range sw.peers.List() {\n\t\tgo func(peer *Peer) {\n\t\t\tsuccess := peer.Send(chId, msg)\n\t\t\tsuccessChan <- success\n\t\t}(peer)\n\t}\n\treturn successChan\n\n}", "title": "" }, { "docid": "310e3203d2ed80eee95f84f01b71bf30", "score": "0.57306653", "text": "func (n *Node) Broadcast(m *Message) {\n\tn.bus.in <- MsgCtrl{sender: n, payload: m, receiver: \"all\"}\n}", "title": "" }, { "docid": "be2dca659f369795e967b62472d37459", "score": "0.5729544", "text": "func (client *Client) broadcast(s *subscription, contentType string, body []byte) {\n\thash := md5.New().Sum(body)\n\n\t// TODO: Use expiring cache if history size increases to handle higher message\n\t// throughputs.\n\tunique := true\n\tclient.history.Do(func(v interface{}) {\n\t\tb, ok := v.([]byte)\n\t\tif ok && bytes.Equal(hash, b) {\n\t\t\tunique = false\n\t\t}\n\t})\n\n\tif unique {\n\t\tclient.history.Value = hash\n\t\tclient.history = client.history.Next()\n\t\ts.handler(contentType, body)\n\t}\n}", "title": "" }, { "docid": "e8bdb302d7e451d949fb5123883e66df", "score": "0.5717033", "text": "func main() {\n\n\tlistener, err := net.Listen(\"tcp\", \"localhost:8000\")\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\n\tgo broadcaster()\n\tfor {\n\t\tconn, err := listener.Accept()\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t}\n\n\t\tnum++\n\t\tfmt.Printf(\"Client number: %d\\n\", num)\n\n\t\tgo handler(conn)\n\n\t}\n}", "title": "" }, { "docid": "ec1c13142eb87db7e12b2379653675ed", "score": "0.5716027", "text": "func BroadcastServer(ctx context.Context, cancel context.CancelFunc, port string) (err error) {\n\tvar (\n\t\tpassProxyCnt int // one time only\n\t)\n\tdefer cancel()\n\tbindaddr := \":\" + port\n\tif port == \"\" {\n\t\tbindaddr = \":\" + RuntimeConfig.BroadcastPort\n\t}\n\tpc, err := net.ListenPacket(\"udp4\", bindaddr)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer pc.Close()\n\tlog.Println(\"BroadcastServer started\")\n\n\tbuf := make([]byte, 1024)\n\n\t// reverseProxy listener\n\t// ssh reverse proxy\n\tgo func() {\n\t\terr = tun.SSHProxyServer(RuntimeConfig.SSHProxyPort)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"SSHProxyServer: %v\", err)\n\t\t}\n\t}()\n\t// monitor socks5://127.0.0.1:RuntimeConfig.ProxyPort until it works\n\tgo func() {\n\t\t// does the proxy work?\n\t\trproxy := fmt.Sprintf(\"socks5://127.0.0.1:%s\", RuntimeConfig.AutoProxyPort)\n\t\tfor !tun.IsProxyOK(rproxy) {\n\t\t\ttime.Sleep(time.Second)\n\t\t}\n\t\tRuntimeConfig.C2TransportProxy = rproxy\n\t\tlog.Printf(\"[+] Reverse proxy configured to %s\", rproxy)\n\n\t\t// pass the proxy to others\n\t\tif RuntimeConfig.C2TransportProxy == rproxy {\n\t\t\tgo passProxy(ctx, cancel, &passProxyCnt)\n\t\t}\n\t}()\n\n\t// keep listening for broadcasts\n\tfor ctx.Err() == nil {\n\t\tn, addr, err := pc.ReadFrom(buf)\n\t\tif err != nil || n == 0 {\n\t\t\tlog.Printf(\"BroadcastServer has read nothing: %v\", err)\n\t\t\tcontinue\n\t\t}\n\n\t\t// decrypt broadcast message\n\t\tdecMsg := tun.AESDecrypt(emp3r0r_data.AESKey, string(buf[:n]))\n\t\tif decMsg == \"\" {\n\t\t\tlog.Printf(\"%x cannot be decrypted\", buf[:n])\n\t\t\tcontinue\n\t\t}\n\t\tlog.Printf(\"BroadcastServer: %s sent this: %s\\n\", addr, decMsg)\n\t\tif RuntimeConfig.C2TransportProxy != \"\" && tun.IsProxyOK(RuntimeConfig.C2TransportProxy) {\n\t\t\tlog.Printf(\"BroadcastServer: %s already set and working fine\\n\", RuntimeConfig.C2TransportProxy)\n\t\t\tcontinue\n\t\t}\n\n\t\tif tun.IsProxyOK(decMsg) {\n\t\t\tRuntimeConfig.C2TransportProxy = decMsg\n\t\t\tlog.Printf(\"BroadcastServer: %s set as RuntimeConfig.AgentProxy\\n\", RuntimeConfig.C2TransportProxy)\n\n\t\t\t// pass the proxy to others\n\t\t\tgo passProxy(ctx, cancel, &passProxyCnt)\n\n\t\t} else {\n\t\t\tlog.Printf(\"Oh crap! %s doen't work, we have to wait for a reverse proxy\", decMsg)\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "8c2e5bdcf1672a08ff1b2b13843297f8", "score": "0.5715562", "text": "func broadcastMessage(currentConn *WebSocketConnection, kind, message string) {\n\tfor _, eachConn := range connections{\n\t\tif eachConn == currentConn{\n\t\t\tcontinue\n\t\t}\n\n\t\teachConn.WriteJSON(SocketResponse{ // mengirim data dari server ke client dengan melalui eachConn\n\t\t\tFrom: currentConn.Username,\n\t\t\tType: kind,\n\t\t\tMessage: message,\n\t\t})\n\t}\n}", "title": "" }, { "docid": "71ef1d9232c95b3c6796b9d4413e7b29", "score": "0.5710627", "text": "func (h *handler) listen(ctx context.Context) {\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn\n\t\tcase value := <-h.buffer:\n\t\t\t(*h.callback)(value)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b83b7c669f22fc9dc4d59f2b1264d9b7", "score": "0.5709263", "text": "func broadcastData(c echo.Context) error {\n\tvar request jsonmodels.DataRequest\n\tif err := c.Bind(&request); err != nil {\n\t\tlog.Info(err.Error())\n\t\treturn c.JSON(http.StatusBadRequest, jsonmodels.DataResponse{Error: err.Error()})\n\t}\n\n\tissueData := func() (*tangle.Message, error) {\n\t\treturn messagelayer.Tangle().IssuePayload(payload.NewGenericDataPayload(request.Data))\n\t}\n\n\t// await MessageScheduled event to be triggered.\n\tmsg, err := messagelayer.AwaitMessageToBeIssued(issueData, messagelayer.Tangle().Options.Identity.PublicKey(), maxIssuedAwaitTime)\n\tif err != nil {\n\t\treturn c.JSON(http.StatusInternalServerError, jsonmodels.DataResponse{Error: err.Error()})\n\t}\n\n\treturn c.JSON(http.StatusOK, jsonmodels.DataResponse{ID: msg.ID().Base58()})\n}", "title": "" }, { "docid": "0f67da5c48aca2960afc0a528d0d8291", "score": "0.57078195", "text": "func (srv *Server) Broadcast(protocol string, code uint64, data ...interface{}) {\n\tvar payload []byte\n\tif data != nil {\n\t\tpayload = encodePayload(data...)\n\t}\n\tsrv.lock.RLock()\n\tdefer srv.lock.RUnlock()\n\tfor _, peer := range srv.peers {\n\t\tif peer != nil {\n\t\t\tvar msg = Msg{Code: code}\n\t\t\tif data != nil {\n\t\t\t\tmsg.Payload = bytes.NewReader(payload)\n\t\t\t\tmsg.Size = uint32(len(payload))\n\t\t\t}\n\t\t\tpeer.writeProtoMsg(protocol, msg)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1a5440225d8a09d3d0d322cb09d1f23e", "score": "0.5706929", "text": "func (hub *Hub) Broadcast(event string, data interface{}) {\n\thub.broadcast <- &message{\n\t\tevent: event,\n\t\tdata: data,\n\t}\n}", "title": "" }, { "docid": "2c24c4bf44656f65fab048c494f11815", "score": "0.57060605", "text": "func (chatBoard *ChatBoard) Listen() {\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase data := <-chatBoard.in:\n\t\t\t\tchatBoard.SendMessage(data)\n\t\t\tcase conn := <-chatBoard.connections:\n\t\t\t\tchatBoard.Connect(conn)\n\t\t\t}\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "23aa58c6fe60b950daab463bab324745", "score": "0.568712", "text": "func (inst *instance) Broadcast(msg *pb.OpenchainMessage, peerType pb.PeerEndpoint_Type) error {\n\tnet := inst.net\n\tnet.cond.L.Lock()\n\tdefer net.cond.L.Unlock()\n\tnet.broadcastFilter(inst, msg.Payload)\n\tnet.cond.Signal()\n\treturn nil\n}", "title": "" }, { "docid": "8213a94f91497f585c34e6c69f2a62ba", "score": "0.56772184", "text": "func (c *client) mssgListener() error {\n\tfor {\n\t\tbuf := make([]byte, 200)\n\t\tn, err := c.UDPconn.Read(buf)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error: \", err)\n\t\t}\n\t\tmssg := Message{}\n\t\tjson.Unmarshal(buf[0:n], &mssg)\n\t\tswitch mssg.Type {\n\t\tcase MsgData:\n\t\t\tc.dataMsgCh <- &mssg\n\t\tcase MsgAck:\n\t\t\tc.ackMsgCh <- &mssg\n\t\t}\n\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "77f586e27144038e2b958a71bc1a7748", "score": "0.5641771", "text": "func (c *Client) listenWrite() {\n\tfor {\n\t\tselect {\n\t\t// Send a PING keepalive\n\t\tcase msg := <-c.pingch:\n\t\t\twebsocket.JSON.Send(c.ws, msg)\n\t\t// send message to the client\n\t\tcase msg := <-c.ch:\n\t\t\t// log.Println(\"Send:\", msg)\n\t\t\twebsocket.JSON.Send(c.ws, msg)\n\n\t\t// receive done request\n\t\tcase <-c.doneCh:\n\t\t\t_server.remove(c)\n\t\t\tc.doneCh <- true // for listenRead method\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "370facaba1ebb110659108d6eeb10ddd", "score": "0.5631746", "text": "func (sub *HttpSubscriber) handleData(w http.ResponseWriter, r *http.Request, router httprouter.Params, broadcast Broadcast) {\n\tdata := bytes.NewBuffer(nil)\n\n\tif bd, ok := r.Body.(io.ReadCloser); ok && bd != nil {\n\t\tdata.ReadFrom(bd)\n\t\tbd.Close()\n\t} else {\n\t\tsub.badResponse(w, r, `Event must include channel, event name and data`)\n\t\treturn\n\t}\n\n\tvar body HttpSubscriberData\n\tif err := json.NewDecoder(data).Decode(&body); err != nil {\n\t\tsub.badResponse(w, r, err.Error())\n\t\treturn\n\t}\n\tif (len(body.Channels) > 0 || body.Channel != \"\") && body.Name != \"\" && body.Data != \"\" {\n\t\tvar data any\n\t\tif err := json.Unmarshal([]byte(body.Data), &data); err != nil {\n\t\t\tsub.badResponse(w, r, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\tmessage := &types.Data{\n\t\t\tEvent: body.Name,\n\t\t\tData: data,\n\t\t\tSocket: body.SocketId,\n\t\t}\n\t\tchannels := []string{}\n\t\tif len(body.Channels) > 0 {\n\t\t\tchannels = body.Channels\n\t\t} else {\n\t\t\tchannels = []string{body.Channel}\n\t\t}\n\n\t\tif sub.options.DevMode {\n\t\t\tutils.Log().Info(\"Channel: \" + sub.join(channels, \", \"))\n\t\t\tutils.Log().Info(\"Event: \" + message.Event)\n\t\t}\n\t\tfor _, channel := range channels {\n\t\t\t// sync\n\t\t\tbroadcast(channel, message)\n\t\t}\n\t} else {\n\t\tsub.badResponse(w, r, `Event must include channel, event name and data`)\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\tio.WriteString(w, `{\"message\":\"ok\"}`)\n}", "title": "" }, { "docid": "0864ad10b35ca685e70c7fcb39f8d672", "score": "0.5621304", "text": "func (n *GossipNode) broadcastLoop() {\n\n\toutgoingMessageChannel := n.App.OutgoingMessageChannel()\n\n\tfor {\n\t\tselect {\n\t\tcase m := <-outgoingMessageChannel:\n\t\t\tn.forward(m, \"\")\n\t\tcase m := <-n.forwardMessageChan:\n\t\t\tn.forward(m, m.Sender)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3b100d573befd4298315d700a5535680", "score": "0.5612972", "text": "func broadCast(s *pb.Msg) {\n\tclients.RLock()\n\tfor _, v := range clients.Msg {\n\t\tselect {\n\t\tcase v <- s:\n\t\tdefault:\n\t\t\tlog.Println(\"Channel is full\")\n\t\t}\n\t}\n\tclients.RUnlock()\n}", "title": "" }, { "docid": "b5c098bc7ce1be59072fdd87d04c262e", "score": "0.5612252", "text": "func broadcast(msg *Message){\n\t//use gob to serialized data before sending\n\tb := getGobFromMsg(msg)\n\tfor Id,addr := range mem_list {\n\t\tif (Id != id) {\n\t\t\t// resolve address\n\t\t\tudpAddr,err1 := net.ResolveUDPAddr(\"udp4\", addr)\n\t\t\tif err1 != nil {\n\t\t\t\tfmt.Println(\"Err getting addr\")\n\t\t\t\treturn //gracefully deal with connection error\n\t\t\t}\n\t\t\t// create send socket\n\t\t\tconn,err2 := net.DialUDP(\"udp\", nil, udpAddr)\n\t\t\tif err2 != nil {\n\t\t\t\tfmt.Println(\"Err dialing.\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// send the data\n\t\t\tconn.Write(b)\n\t\t\tconn.Close()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1774682a4a001060c93b70a260b8e951", "score": "0.56080335", "text": "func listen(ch chan Knock, port int) {\n\taddr, err := net.ResolveUDPAddr(\"udp\", fmt.Sprintf(\":%v\", port))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tconn, err := net.ListenUDP(\"udp\", addr)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer conn.Close()\n\n\tbuf := make([]byte, 2)\n\n\tfor {\n\t\t_, raddr, err := conn.ReadFromUDP(buf)\n\t\tif err != nil {\n\t\t\tlog.Error().Err(err).Send()\n\t\t}\n\t\tch <- Knock{raddr.IP, port}\n\t}\n}", "title": "" }, { "docid": "d4c5020888ffd2acdb9a9503193e09e0", "score": "0.56075495", "text": "func Listen(bindAddress string, log *logger.Logger, shutdownSignal <-chan struct{}) error {\n\n\tlistener, err := net.Listen(\"tcp\", bindAddress)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to start Broadcast daemon: %w\", err)\n\t}\n\n\tgo func() {\n\t\tfor {\n\t\t\tconnection, err := listener.Accept()\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tlog.Infof(\"Started connection: %s\", connection.RemoteAddr().String())\n\t\t\tgo handleConnection(connection, log, shutdownSignal)\n\t\t}\n\t}()\n\n\tgo func() {\n\t\tdefer func(listener net.Listener) {\n\t\t\terr := listener.Close()\n\t\t\tif err != nil {\n\t\t\t\tlog.Infof(\"Error closing listener: %s\",err)\n\t\t\t}\n\t\t}(listener)\n\n\t\t<-shutdownSignal\n\n\t\tlog.Infof(\"Closing Broadcast server...\")\n\t\tfor i := 0; i < index; i++ {\n\t\t\tconnectionList[i].active = false\n\t\t}\n\t\tlog.Infof(\"Closing Broadcast server... \\tDone\")\n\t}()\n\n\treturn nil\n}", "title": "" }, { "docid": "6f00aae22a85a8dee681ac389a4637b5", "score": "0.55988234", "text": "func (c *Core) listen(dc *dexConnection) {\n\tmsgs := dc.conn.MessageSource()\n\tdefer c.wg.Done()\nout:\n\tfor {\n\t\tselect {\n\t\tcase msg := <-msgs:\n\t\t\tswitch msg.Type {\n\t\t\tcase msgjson.Request:\n\t\t\t\tswitch msg.Route {\n\t\t\t\tcase msgjson.MatchDataRoute:\n\t\t\t\t\tlog.Info(\"match_data message received\")\n\t\t\t\tcase msgjson.MatchProofRoute:\n\t\t\t\t\tlog.Info(\"match_proof message received\")\n\t\t\t\tcase msgjson.PreimageRoute:\n\t\t\t\t\tlog.Info(\"preimage message received\")\n\t\t\t\tcase msgjson.MatchRoute:\n\t\t\t\t\tlog.Info(\"match message received\")\n\t\t\t\tcase msgjson.AuditRoute:\n\t\t\t\t\tlog.Info(\"audit message received\")\n\t\t\t\tcase msgjson.RedemptionRoute:\n\t\t\t\t\tlog.Info(\"redemption message received\")\n\t\t\t\tcase msgjson.RevokeMatchRoute:\n\t\t\t\t\tlog.Info(\"revoke_match message received\")\n\t\t\t\tcase msgjson.SuspensionRoute:\n\t\t\t\t\tlog.Info(\"suspension message received\")\n\n\t\t\t\tcase msgjson.UnsubOrderBookRoute:\n\t\t\t\t\terr := c.handleUnsubOrderBookMsg(dc, msg)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlog.Error(err)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\tcase msgjson.Notification:\n\t\t\t\tswitch msg.Route {\n\t\t\t\tcase msgjson.BookOrderRoute:\n\t\t\t\t\terr := c.handleBookOrderMsg(dc, msg)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlog.Error(err)\n\t\t\t\t\t}\n\n\t\t\t\tcase msgjson.EpochOrderRoute:\n\t\t\t\t\tlog.Info(\"epoch_order message received\")\n\n\t\t\t\tcase msgjson.UnbookOrderRoute:\n\t\t\t\t\terr := c.handleUnbookOrderMsg(dc, msg)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlog.Error(err)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\tcase msgjson.Response:\n\t\t\t\tswitch msg.Route {\n\t\t\t\tcase msgjson.OrderBookRoute:\n\t\t\t\t\terr := c.handleOrderBookMsg(dc, msg)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlog.Error(err)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\tdefault:\n\t\t\t\tlog.Errorf(\"invalid message type %d from MessageSource\", msg.Type)\n\t\t\t}\n\t\tcase <-c.ctx.Done():\n\t\t\tbreak out\n\t\t}\n\t}\n}", "title": "" }, { "docid": "06854bd911d4df556de3517ccc0d99d9", "score": "0.5585358", "text": "func (g *Gossiper) ReceiveBroadcast(message BroadcastMessage) {\n\tif message.Destination != g.Name {\n\t\t//Send it further.\n\t\tmessage.HopLimit--\n\t\tlog.Lvl2(g.Name, \"forwarding to \", message.Destination)\n\t\tif message.HopLimit > 0 {\n\t\t\taddr := g.FindPath(message.Destination)\n\t\t\tif addr == \"\" {\n\t\t\t\tlog.Error(g.Name, \"Could not find path to \", message.Destination)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tgp := GossipPacket{Broadcast: &message}\n\t\t\tg.SendToRandom(gp)\n\t\t}\n\t\treturn\n\t}\n\tif g.Cluster != nil && message.ClusterID == *g.Cluster.ClusterID {\n\t\tlog.Lvl2(\"Got broadcast for my cluster\")\n\n\t\tif message.Rollout {\n\t\t\t//Update for a rollout.\n\t\t\tlog.Lvl1(g.Name, \" received message for rollout\")\n\t\t\tcluster := clusters.Cluster{}\n\t\t\tdata := ies.Decrypt(g.Cluster.MasterKey, message.Data)\n\t\t\terr := protobuf.Decode(data, &cluster)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(\"Could not decode rollout info \", err)\n\t\t\t}\n\t\t\tClusterUpdated <- true\n\t\t\tg.UpdateFromRollout(cluster)\n\n\t\t} else if message.Reset {\n\t\t\tlog.Lvl1(g.Name, \" received message for reset\")\n\t\t\tcluster := clusters.Cluster{}\n\t\t\tdata := ies.Decrypt(g.Cluster.MasterKey, message.Data)\n\t\t\terr := protobuf.Decode(data, &cluster)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(\"Could not decode reset info \", err)\n\t\t\t}\n\n\t\t\tg.UpdateFromReset(cluster)\n\t\t\tg.BroadcastAck(message.CaseRequest)\n\n\t\t} else if message.LeaveRequest {\n\t\t\tlog.Lvl1(\"Got leave request\")\n\t\t\tdecrypted := ies.Decrypt(g.Cluster.MasterKey, message.Data)\n\t\t\tvar rumor RumorMessage\n\t\t\terr := protobuf.Decode(decrypted, &rumor)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(g.Name, \"Error decoding packet : \", err, \"This may be due to an ongoing rollout.\")\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tg.Cluster.HeartBeats[rumor.Origin] = false\n\t\t\tdelete(g.Cluster.PublicKeys, rumor.Origin)\n\t\t\tg.Cluster.Members = RemoveFromList(g.Cluster.Members, rumor.Origin)\n\n\t\t} else if message.JoinRequest {\n\t\t\tlog.Lvl1(g.Name, \" received message for JOIN e-voting request\")\n\t\t\tdecrypted := ies.Decrypt(g.Cluster.MasterKey, message.Data)\n\t\t\tvar rumor RumorMessage\n\t\t\terr := protobuf.Decode(decrypted, &rumor)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(g.Name, \"Error decoding packet : \", err, \"This may be due to an ongoing rollout.\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif rumor.Text != \"\" {\n\t\t\t\t//print the message\n\t\t\t\tg.PrintEvotingJoinStep(rumor.Text)\n\t\t\t\tg.displayed_requests = append(g.displayed_requests, \"JOIN \" + rumor.Text)\n\t\t\t\tif g.Cluster.IsAnAuthority(g.Name) {\n\t\t\t\t\tslice_pending := make([]string, 0)\n\t\t\t\t\ttag := \"JOIN \" + rumor.Text\n\t\t\t\t\tslice_pending = append(slice_pending, tag)\n\t\t\t\t\tg.slice_results = append(g.slice_results, slice_pending)\n\t\t\t\t}\n\t\t\t}\n\t\t\t//in any case add it to the map..\n\t\t\tif g.Name != rumor.Origin {\n\t\t\t\tg.Cluster.HeartBeats[rumor.Origin] = true\n\t\t\t}\n\n\t\t} else if message.ExpelRequest {\n\t\t\tlog.Lvl1(g.Name, \" received message for EXPEL e-voting request\")\n\t\t\tdecrypted := ies.Decrypt(g.Cluster.MasterKey, message.Data)\n\t\t\tvar rumor RumorMessage\n\t\t\terr := protobuf.Decode(decrypted, &rumor)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(g.Name, \"Error decoding packet : \", err, \"This may be due to an ongoing rollout.\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif rumor.Text != \"\" && rumor.Text != g.Name {\n\t\t\t\t//print the message\n\t\t\t\tg.PrintEvotingExpelStep(rumor.Text)\n\t\t\t\tg.displayed_requests = append(g.displayed_requests, \"EXPEL \" + rumor.Text)\n\t\t\t\tif g.Cluster.IsAnAuthority(g.Name) {\n\t\t\t\t\tslice_pending := make([]string, 0)\n\t\t\t\t\ttag := \"EXPEL \" + rumor.Text\n\t\t\t\t\tslice_pending = append(slice_pending, tag)\n\t\t\t\t\tg.slice_results = append(g.slice_results, slice_pending)\n\t\t\t\t}\n\t\t\t}\n\t\t\t//in any case add it to the map..\n\t\t\tif g.Name != rumor.Origin {\n\t\t\t\tg.Cluster.HeartBeats[rumor.Origin] = true\n\t\t\t}\n\n\t\t} else if message.AcceptProposition {\n\t\t\tlog.Lvl1(g.Name, \" received ACCEPT for e-voting case\")\n\t\t\tdecrypted := ies.Decrypt(g.Cluster.MasterKey, message.Data)\n\t\t\tvar rumor RumorMessage\n\t\t\terr := protobuf.Decode(decrypted, &rumor)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(g.Name, \"Error decoding packet : \", err, \"This may be due to an ongoing rollout.\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\tlog.Lvl1(g.Cluster.Authorities)\n\t\t\tif g.Cluster.IsAnAuthority(g.Name) {\n\t\t\t\tlog.Lvl1(\"rumor txtd\", rumor.Text)\n\t\t\t\tif rumor.Text != \"\" {\n\t\t\t\t\t//print the message\n\t\t\t\t\tg.PrintEvotingPropositionStep(1, rumor.Text, rumor.Origin)\n\t\t\t\t\tcorrect_tag_join := \"JOIN \" + rumor.Text\n\t\t\t\t\tcorrect_tag_expel := \"EXPEL \" + rumor.Text\n\t\t\t\t\tlog.Lvl1(g.slice_results)\n\t\t\t\t\tfor i := 0 ; i < len(g.slice_results) ; i++ {\n\t\t\t\t\t\tif string((g.slice_results[i])[0]) == correct_tag_join {\n\t\t\t\t\t\t\tis_existing := false\n\t\t\t\t\t\t\tfor j := 1 ; j < len(g.slice_results[i]) ; j++ {\n\t\t\t\t\t\t\t\tif string((g.slice_results[i])[j]) == \"1 : \" + rumor.Origin || string((g.slice_results[i])[j]) == \"0 : \" + rumor.Origin {\n\t\t\t\t\t\t\t\t\tis_existing = true\n\n\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif is_existing == false {\n\t\t\t\t\t\t\t\tg.slice_results[i] = append(g.slice_results[i], \"1 : \" + rumor.Origin)\n\n\t\t\t\t\t\t\t\tif len(g.Cluster.Members) == len(g.slice_results[i]) - 1 {\n\t\t\t\t\t\t\t\t\tg.BroadcastCollected(g.slice_results[i][0])\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t} else if string((g.slice_results[i])[0]) == correct_tag_expel && rumor.Text != rumor.Origin && rumor.Text != g.Name {\n\t\t\t\t\t\t\tis_existing := false\n\t\t\t\t\t\t\tfor j := 1 ; j < len(g.slice_results[i]) ; j++ {\n\t\t\t\t\t\t\t\tif string((g.slice_results[i])[j]) == \"1 : \" + rumor.Origin || string((g.slice_results[i])[j]) == \"0 : \" + rumor.Origin {\n\t\t\t\t\t\t\t\t\tis_existing = true\n\n\t\t\t\t\t\t\t\t\tlog.Lvl1(\"Already existing\", g.slice_results)\n\n\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif is_existing == false {\n\t\t\t\t\t\t\t\tg.slice_results[i] = append(g.slice_results[i], \"1 : \" + rumor.Origin)\n\n\t\t\t\t\t\t\t\tlog.Lvl1(g.slice_results)\n\n\t\t\t\t\t\t\t\tif len(g.Cluster.Members) - 1 == len(g.slice_results[i]) - 1 {\n\t\t\t\t\t\t\t\t\tg.BroadcastCollected(g.slice_results[i][0])\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\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\t\t\t}\n\t\t\t//in any case add it to the map..\n\t\t\tif g.Name != rumor.Origin {\n\t\t\t\tg.Cluster.HeartBeats[rumor.Origin] = true\n\t\t\t}\n\n\t\t} else if message.DenyProposition {\n\t\t\tlog.Lvl1(g.Name, \" received DENY for e-voting case\")\n\t\t\tdecrypted := ies.Decrypt(g.Cluster.MasterKey, message.Data)\n\t\t\tvar rumor RumorMessage\n\t\t\terr := protobuf.Decode(decrypted, &rumor)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(g.Name, \"Error decoding packet : \", err, \"This may be due to an ongoing rollout.\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif g.Cluster.IsAnAuthority(g.Name) {\n\t\t\t\tif rumor.Text != \"\" {\n\t\t\t\t\t//print the message\n\t\t\t\t\tg.PrintEvotingPropositionStep(0, rumor.Text, rumor.Origin)\n\t\t\t\t\tcorrect_tag_join := \"JOIN \" + rumor.Text\n\t\t\t\t\tcorrect_tag_expel := \"EXPEL \" + rumor.Text\n\t\t\t\t\tfor i := 0 ; i < len(g.slice_results) ; i++ {\n\t\t\t\t\t\tif string((g.slice_results[i])[0]) == correct_tag_join {\n\t\t\t\t\t\t\tis_existing := false\n\t\t\t\t\t\t\tfor j := 0 ; j < len(g.slice_results[i]) ; j++ {\n\t\t\t\t\t\t\t\tif string((g.slice_results[i])[j]) == \"1 : \" + rumor.Origin || string((g.slice_results[i])[j]) == \"0 : \" + rumor.Origin {\n\t\t\t\t\t\t\t\t\tis_existing = true\n\n\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif is_existing == false {\n\t\t\t\t\t\t\t\tg.slice_results[i] = append(g.slice_results[i], \"0 : \" + rumor.Origin)\n\n\t\t\t\t\t\t\t\tif len(g.Cluster.Members) == len(g.slice_results[i]) - 1 {\n\t\t\t\t\t\t\t\t\tg.BroadcastCollected(g.slice_results[i][0])\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t} else if string((g.slice_results[i])[0]) == correct_tag_expel && rumor.Text != rumor.Origin && rumor.Text != g.Name {\n\t\t\t\t\t\t\tis_existing := false\n\t\t\t\t\t\t\tfor j := 1 ; j < len(g.slice_results[i]) ; j++ {\n\t\t\t\t\t\t\t\tif string((g.slice_results[i])[j]) == \"1 : \" + rumor.Origin || string((g.slice_results[i])[j]) == \"0 : \" + rumor.Origin {\n\t\t\t\t\t\t\t\t\tis_existing = true\n\n\t\t\t\t\t\t\t\t\t//fmt.Println(\"Already existing\", g.slice_results)\n\n\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif is_existing == false {\n\t\t\t\t\t\t\t\tg.slice_results[i] = append(g.slice_results[i], \"0 : \" + rumor.Origin)\n\n\t\t\t\t\t\t\t\t//fmt.Println(g.slice_results)\n\n\t\t\t\t\t\t\t\tif len(g.Cluster.Members) - 1 == len(g.slice_results[i]) - 1 {\n\t\t\t\t\t\t\t\t\tg.BroadcastCollected(g.slice_results[i][0])\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\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\t\t\t}\n\t\t\t//in any case add it to the map..\n\t\t\tif g.Name != rumor.Origin {\n\t\t\t\tg.Cluster.HeartBeats[rumor.Origin] = true\n\t\t\t}\n\n\t\t} else if message.CaseCompare {\n\t\t\tlog.Lvl1(g.Name, \" received e-voting identifier to start comparison process\")\n\t\t\tdecrypted := ies.Decrypt(g.Cluster.MasterKey, message.Data)\n\t\t\tvar rumor RumorMessage\n\t\t\terr := protobuf.Decode(decrypted, &rumor)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(g.Name, \"Error decoding packet : \", err, \"This may be due to an ongoing rollout.\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif g.Cluster.IsAnAuthority(g.Name) {\n\t\t\t\tif rumor.Text != \"\" {\n\t\t\t\t\t//print the message\n\t\t\t\t\tg.PrintEvotingCaseStep(rumor.Text, rumor.Origin)\n\n\t\t\t\t\tif string(rumor.Text[0:4]) == \"JOIN\" {\n\t\t\t\t\t\t_, ok := g.acks_cases[rumor.Text]\n\t\t\t\t\t\tif ok == true {\n\t\t\t\t\t\t\tis_existing := false\n\t\t\t\t\t\t\tfor i := 0 ; i < len(g.acks_cases[rumor.Text]) ; i++ {\n\t\t\t\t\t\t\t\tif g.acks_cases[rumor.Text][i] == rumor.Origin {\n\t\t\t\t\t\t\t\t\tis_existing = true\n\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif is_existing == false {\n\t\t\t\t\t\t\t\tif g.Cluster.IsAnAuthority(rumor.Origin) {\n\t\t\t\t\t\t\t\t\tg.acks_cases[rumor.Text] = append(g.acks_cases[rumor.Text], rumor.Origin)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else { // ok == false\n\t\t\t\t\t\t\tif g.Cluster.IsAnAuthority(rumor.Origin) {\n\t\t\t\t\t\t\t\tg.acks_cases[rumor.Text] = []string{rumor.Origin}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif g.Cluster.AmountAuthorities() == len(g.acks_cases[rumor.Text]) {\n\t\t\t\t\t\t\tfor j := 0 ; j < len(g.slice_results) ; j++ {\n\t\t\t\t\t\t\t\tif string((g.slice_results[j])[0]) == rumor.Text {\n\t\t\t\t\t\t\t\t\tif (g.Cluster.AmountAuthorities() > 1) {\n\t\t\t\t\t\t\t\t\t\tg.BroadcastResults(g.slice_results[j])\n\t\t\t\t\t\t\t\t\t} else { // g.Cluster.AmountAuthorities() == 1\n\t\t\t\t\t\t\t\t\t\taccept_counts := 0\n\t\t\t\t\t\t\t\t\t\tdeny_counts := 0\n\t\t\t\t\t\t\t\t\t\tfor k := 1 ; k < len(g.slice_results[j]) ; k++ {\n\t\t\t\t\t\t\t\t\t\t\tstr := string(((g.slice_results[j])[k])[0])\n\t\t\t\t\t\t\t\t\t\t\tif str == \"1\" {\n\t\t\t\t\t\t\t\t\t\t\t\taccept_counts++\n\t\t\t\t\t\t\t\t\t\t\t} else if str == \"0\" {\n\t\t\t\t\t\t\t\t\t\t\t\tdeny_counts++\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\t\t\t\t\t\t\t\t\t\tif deny_counts == accept_counts {\n\t\t\t\t\t\t\t\t\t\t\taccept_counts = 0\n\t\t\t\t\t\t\t\t\t\t\tdeny_counts = 0\n\t\t\t\t\t\t\t\t\t\t\tfor l := 1 ; l < len(g.slice_results[j]) ; l++ {\n\t\t\t\t\t\t\t\t\t\t\t\tstr := (g.slice_results[j])[l]\n\t\t\t\t\t\t\t\t\t\t\t\tlist_authorities := g.acks_cases[rumor.Text]\n\t\t\t\t\t\t\t\t\t\t\t\tfor m := 0 ; m < len(list_authorities) ; m++ {\n\t\t\t\t\t\t\t\t\t\t\t\t\tif string(str[4:]) == list_authorities[m] {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tstr = string(str[0])\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tif str == \"1\" {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\taccept_counts++\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t} else if str == \"0\" {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdeny_counts++\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tif accept_counts > deny_counts {\n\t\t\t\t\t\t\t\t\t\t\tanswer := \"ACCEPT \" + rumor.Text\n\t\t\t\t\t\t\t\t\t\t\tg.BroadcastDecision(answer)\n\t\t\t\t\t\t\t\t\t\t} else { // accept_counts < deny_counts\n\t\t\t\t\t\t\t\t\t\t\tanswer := \"DENY \" + rumor.Text\n\t\t\t\t\t\t\t\t\t\t\tg.BroadcastDecision(answer)\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak\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} else if string(rumor.Text[0:5]) == \"EXPEL\" && string(rumor.Text[6:]) != g.Name {\n\t\t\t\t\t\t_, ok := g.acks_cases[rumor.Text]\n\t\t\t\t\t\tif ok == true {\n\t\t\t\t\t\t\tis_existing := false\n\t\t\t\t\t\t\tfor i := 0 ; i < len(g.acks_cases[rumor.Text]) ; i++ {\n\t\t\t\t\t\t\t\tif g.acks_cases[rumor.Text][i] == rumor.Origin {\n\t\t\t\t\t\t\t\t\tis_existing = true\n\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif is_existing == false {\n\t\t\t\t\t\t\t\tif g.Cluster.IsAnAuthority(rumor.Origin) {\n\t\t\t\t\t\t\t\t\tg.acks_cases[rumor.Text] = append(g.acks_cases[rumor.Text], rumor.Origin)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else { // ok == false\n\t\t\t\t\t\t\tif g.Cluster.IsAnAuthority(rumor.Origin) {\n\t\t\t\t\t\t\t\tg.acks_cases[rumor.Text] = []string{rumor.Origin}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tvar maxToCollect int\n\t\t\t\t\t\tif g.Cluster.IsAnAuthority(string(rumor.Text[6:])) {\n\t\t\t\t\t\t\tmaxToCollect = g.Cluster.AmountAuthorities() - 1\n\t\t\t\t\t\t} else { // g.Cluster.IsAnAuthority(string(rumor.Text[6:])) == false\n\t\t\t\t\t\t\tmaxToCollect = g.Cluster.AmountAuthorities()\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif maxToCollect == len(g.acks_cases[rumor.Text]) {\n\t\t\t\t\t\t\tfor j := 0 ; j < len(g.slice_results) ; j++ {\n\t\t\t\t\t\t\t\tif string((g.slice_results[j])[0]) == rumor.Text {\n\t\t\t\t\t\t\t\t\tg.BroadcastResults(g.slice_results[j])\n\t\t\t\t\t\t\t\t\tbreak\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}\n\t\t\t}\n\t\t\t//in any case add it to the map..\n\t\t\tif g.Name != rumor.Origin {\n\t\t\t\tg.Cluster.HeartBeats[rumor.Origin] = true\n\t\t\t}\n\n\t\t} else if message.ResultsValidation {\n\t\t\tlog.Lvl1(g.Name, \" received list of e-voting results for validation\")\n\t\t\tdecrypted := ies.Decrypt(g.Cluster.MasterKey, message.Data)\n\t\t\tvar rumor RumorMessage\n\t\t\terr := protobuf.Decode(decrypted, &rumor)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(g.Name, \"Error decoding packet : \", err, \"This may be due to an ongoing rollout.\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif g.Cluster.IsAnAuthority(g.Name) {\n\t\t\t\tif rumor.Results != nil {\n\t\t\t\t\t//print the message\n\t\t\t\t\tg.PrintEvotingValidationStep(rumor.Results, rumor.Origin)\n\n\t\t\t\t\tif string((rumor.Results[0])[0:4]) == \"JOIN\" {\n\t\t\t\t\t\tis_matched := true\n\t\t\t\t\t\tfor i := 0 ; i < len(g.slice_results) ; i++ {\n\t\t\t\t\t\t\tif string((g.slice_results[i])[0]) == string(rumor.Results[0]) {\n\t\t\t\t\t\t\t\tfor j := 1 ; j < len(g.slice_results[i]) ; j++ {\n\t\t\t\t\t\t\t\t\tfound := false\n\t\t\t\t\t\t\t\t\tfor k := 1 ; k < len(rumor.Results) ; k++ {\n\t\t\t\t\t\t\t\t\t\tif string((g.slice_results[i])[j]) == string(rumor.Results[k]) {\n\t\t\t\t\t\t\t\t\t\t\tfound = true\n\t\t\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif found == false {\n\t\t\t\t\t\t\t\t\t\tis_matched = false\n\n\t\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif is_matched == true {\n\t\t\t\t\t\t\t_, ok := g.correct_results_rcv[rumor.Results[0]]\n\t\t\t\t\t\t\tif ok == true {\n\t\t\t\t\t\t\t\tis_existing := false\n\t\t\t\t\t\t\t\tfor i := 0 ; i < len(g.correct_results_rcv[rumor.Results[0]]) ; i++ {\n\t\t\t\t\t\t\t\t\tif g.correct_results_rcv[rumor.Results[0]][i] == rumor.Origin {\n\t\t\t\t\t\t\t\t\t\tis_existing = true\n\t\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif is_existing == false {\n\t\t\t\t\t\t\t\t\tif g.Cluster.IsAnAuthority(rumor.Origin) {\n\t\t\t\t\t\t\t\t\t\tg.correct_results_rcv[rumor.Results[0]] = append(g.correct_results_rcv[rumor.Results[0]], rumor.Origin)\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else { // ok == false\n\t\t\t\t\t\t\t\tif g.Cluster.IsAnAuthority(rumor.Origin) {\n\t\t\t\t\t\t\t\t\tg.correct_results_rcv[rumor.Results[0]] = []string{rumor.Origin}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif g.Cluster.AmountAuthorities() - 1 == len(g.correct_results_rcv[rumor.Results[0]]) {\n\t\t\t\t\t\t\t\taccept_counts := 0\n\t\t\t\t\t\t\t\tdeny_counts := 0\n\t\t\t\t\t\t\t\tfor i := 0 ; i < len(g.slice_results) ; i++ {\n\t\t\t\t\t\t\t\t\tif string(g.slice_results[i][0]) == string(rumor.Results[0]) {\n\t\t\t\t\t\t\t\t\t\tfor j := 1 ; j < len(g.slice_results[i]) ; j++ {\n\t\t\t\t\t\t\t\t\t\t\tstr := string(((g.slice_results[i])[j])[0])\n\t\t\t\t\t\t\t\t\t\t\tif str == \"1\" {\n\t\t\t\t\t\t\t\t\t\t\t\taccept_counts++\n\t\t\t\t\t\t\t\t\t\t\t} else if str == \"0\" {\n\t\t\t\t\t\t\t\t\t\t\t\tdeny_counts++\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif deny_counts == accept_counts {\n\t\t\t\t\t\t\t\t\taccept_counts = 0\n\t\t\t\t\t\t\t\t\tdeny_counts = 0\n\t\t\t\t\t\t\t\t\tfor i := 0 ; i < len(g.slice_results) ; i++ {\n\t\t\t\t\t\t\t\t\t\tif string((g.slice_results[i])[0]) == string(rumor.Results[0]) {\n\t\t\t\t\t\t\t\t\t\t\tfor j := 1 ; j < len(g.slice_results[i]) ; j++ {\n\t\t\t\t\t\t\t\t\t\t\t\tstr := (g.slice_results[i])[j]\n\t\t\t\t\t\t\t\t\t\t\t\tlist_authorities := g.acks_cases[rumor.Results[0]]\n\t\t\t\t\t\t\t\t\t\t\t\tfor k := 0 ; k < len(list_authorities) ; k++ {\n\t\t\t\t\t\t\t\t\t\t\t\t\tif string(str[4:]) == list_authorities[k] {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tstr = string(str[0])\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tif str == \"1\" {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\taccept_counts++\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t} else if str == \"0\" {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdeny_counts++\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif accept_counts > deny_counts {\n\t\t\t\t\t\t\t\t\tanswer := \"ACCEPT \" + rumor.Results[0]\n\t\t\t\t\t\t\t\t\tg.BroadcastDecision(answer)\n\t\t\t\t\t\t\t\t} else { // accept_counts < deny_counts\n\t\t\t\t\t\t\t\t\tanswer := \"DENY \" + rumor.Results[0]\n\t\t\t\t\t\t\t\t\tg.BroadcastDecision(answer)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else { // is_matched == false\n\t\t\t\t\t\t\tg.BroadcastCancel(rumor.Results[0])\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if string((rumor.Results[0])[0:5]) == \"EXPEL\" && string((rumor.Results[0])[6:]) != g.Name {\n\t\t\t\t\t\tis_matched := true\n\t\t\t\t\t\tfor i := 0 ; i < len(g.slice_results) ; i++ {\n\t\t\t\t\t\t\tif string((g.slice_results[i])[0]) == string(rumor.Results[0]) {\n\t\t\t\t\t\t\t\tfor j := 1 ; j < len(g.slice_results[i]) ; j++ {\n\t\t\t\t\t\t\t\t\tfound := false\n\t\t\t\t\t\t\t\t\tfor k := 1 ; k < len(rumor.Results) ; k++ {\n\t\t\t\t\t\t\t\t\t\tif string((g.slice_results[i])[j]) == string(rumor.Results[k]) {\n\t\t\t\t\t\t\t\t\t\t\tfound = true\n\t\t\t\t\t\t\t\t\t\t\tbreak\n\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif found == false {\n\t\t\t\t\t\t\t\t\t\tis_matched = false\n\t\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif is_matched == true {\n\t\t\t\t\t\t\t_, ok := g.correct_results_rcv[rumor.Results[0]]\n\t\t\t\t\t\t\tif ok == true {\n\t\t\t\t\t\t\t\tis_existing := false\n\t\t\t\t\t\t\t\tfor i := 0 ; i < len(g.correct_results_rcv[rumor.Results[0]]) ; i++ {\n\t\t\t\t\t\t\t\t\tif g.correct_results_rcv[rumor.Results[0]][i] == rumor.Origin {\n\t\t\t\t\t\t\t\t\t\tis_existing = true\n\t\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif is_existing == false {\n\t\t\t\t\t\t\t\t\tif g.Cluster.IsAnAuthority(rumor.Origin) {\n\t\t\t\t\t\t\t\t\t\tg.correct_results_rcv[rumor.Results[0]] = append(g.correct_results_rcv[rumor.Results[0]], rumor.Origin)\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else { // ok == false\n\t\t\t\t\t\t\t\tif g.Cluster.IsAnAuthority(rumor.Origin) {\n\t\t\t\t\t\t\t\t\tg.correct_results_rcv[rumor.Results[0]] = []string{rumor.Origin}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tvar maxToCollect int\n\t\t\t\t\t\t\tif g.Cluster.IsAnAuthority(string((rumor.Results[0])[6:])) {\n\t\t\t\t\t\t\t\tmaxToCollect = g.Cluster.AmountAuthorities() - 2\n\t\t\t\t\t\t\t} else { // g.Cluster.IsAnAuthority(string((rumor.Results[0])[6:])) == false\n\t\t\t\t\t\t\t\tmaxToCollect = g.Cluster.AmountAuthorities() - 1\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif maxToCollect == len(g.correct_results_rcv[rumor.Results[0]]) {\n\t\t\t\t\t\t\t\taccept_counts := 0\n\t\t\t\t\t\t\t\tdeny_counts := 0\n\n\t\t\t\t\t\t\t\tfor i := 0 ; i < len(g.slice_results) ; i++ {\n\t\t\t\t\t\t\t\t\tif string(g.slice_results[i][0]) == string(rumor.Results[0]) {\n\t\t\t\t\t\t\t\t\t\tfor j := 1 ; j < len(g.slice_results[i]) ; j++ {\n\t\t\t\t\t\t\t\t\t\t\tstr := string(((g.slice_results[i])[j])[0])\n\t\t\t\t\t\t\t\t\t\t\tif str == \"1\" {\n\t\t\t\t\t\t\t\t\t\t\t\taccept_counts++\n\t\t\t\t\t\t\t\t\t\t\t} else if str == \"0\" {\n\t\t\t\t\t\t\t\t\t\t\t\tdeny_counts++\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif deny_counts == accept_counts {\n\t\t\t\t\t\t\t\t\taccept_counts = 0\n\t\t\t\t\t\t\t\t\tdeny_counts = 0\n\t\t\t\t\t\t\t\t\tfor i := 0 ; i < len(g.slice_results) ; i++ {\n\t\t\t\t\t\t\t\t\t\tif string((g.slice_results[i])[0]) == string(rumor.Results[0]) {\n\t\t\t\t\t\t\t\t\t\t\tfor j := 1 ; j < len(g.slice_results[i]) ; j++ {\n\t\t\t\t\t\t\t\t\t\t\t\tstr := (g.slice_results[i])[j]\n\t\t\t\t\t\t\t\t\t\t\t\tlist_authorities := g.acks_cases[rumor.Results[0]]\n\t\t\t\t\t\t\t\t\t\t\t\tfor k := 0 ; k < len(list_authorities) ; k++ {\n\t\t\t\t\t\t\t\t\t\t\t\t\tif string(str[4:]) == list_authorities[k] {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tstr = string(str[0])\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tif str == \"1\" {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\taccept_counts++\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t} else if str == \"0\" {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdeny_counts++\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t//fmt.Println(\"Accept counts =\", accept_counts, \"and deny counts =\", deny_counts)\n\n\t\t\t\t\t\t\t\tif accept_counts > deny_counts {\n\t\t\t\t\t\t\t\t\tanswer := \"ACCEPT \" + rumor.Results[0]\n\t\t\t\t\t\t\t\t\tg.BroadcastDecision(answer)\n\t\t\t\t\t\t\t\t} else { // accept_counts < deny_counts OR accept_counts == deny_counts\n\t\t\t\t\t\t\t\t\tanswer := \"DENY \" + rumor.Results[0]\n\t\t\t\t\t\t\t\t\tg.BroadcastDecision(answer)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else { // is_matched == false\n\t\t\t\t\t\t\tg.BroadcastCancel(rumor.Results[0])\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t//in any case add it to the map..\n\t\t\tif g.Name != rumor.Origin {\n\t\t\t\tg.Cluster.HeartBeats[rumor.Origin] = true\n\t\t\t}\n\n\t\t} else if message.FinalDecision {\n\t\t\tlog.Lvl1(g.Name, \" received e-voting final decision\")\n\t\t\tif g.Cluster != nil {\n\t\t\t\tdecrypted := ies.Decrypt(g.Cluster.MasterKey, message.Data)\n\t\t\t\tvar rumor RumorMessage\n\t\t\t\terr := protobuf.Decode(decrypted, &rumor)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Error(g.Name, \"Error decoding packet : \", err, \"This may be due to an ongoing rollout.\")\n\n\t\t\t\t}\n\t\t\t\tif rumor.Text != \"\" && strings.Contains(rumor.Text, g.Name) == false {\n\t\t\t\t\t//print the message\n\t\t\t\t\tg.PrintEvotingDecisionStep(rumor.Text, rumor.Origin)\n\t\t\t\t\tif g.Cluster.IsAnAuthority(g.Name) {\n\t\t\t\t\t\tfor i := 0 ; i < len(g.slice_results) ; i++ {\n\t\t\t\t\t\t\tif strings.Contains(rumor.Text, string((g.slice_results[i])[0])) {\n\t\t\t\t\t\t\t\tcopy(g.slice_results[i:], g.slice_results[i+1:])\n\t\t\t\t\t\t\t\tg.slice_results = g.slice_results[:len(g.slice_results) - 1]\n\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif strings.Contains(rumor.Text, \"ACCEPT\") {\n\t\t\t\t\t\t\tstr := string(rumor.Text[7:])\n\t\t\t\t\t\t\t_, ok1 := g.acks_cases[str]\n\t\t\t\t\t\t\tif ok1 {\n\t\t\t\t\t\t\t\tdelete(g.acks_cases, str)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t_, ok2 := g.correct_results_rcv[str]\n\t\t\t\t\t\t\tif ok2 {\n\t\t\t\t\t\t\t\tdelete(g.correct_results_rcv, str)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else { // strings.Contains(rumor.Text, \"DENY\") == true\n\t\t\t\t\t\t\tstr := string(rumor.Text[5:])\n\t\t\t\t\t\t\t_, ok1 := g.acks_cases[str]\n\t\t\t\t\t\t\tif ok1 {\n\t\t\t\t\t\t\t\tdelete(g.acks_cases, str)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t_, ok2 := g.correct_results_rcv[str]\n\t\t\t\t\t\t\tif ok2 {\n\t\t\t\t\t\t\t\tdelete(g.correct_results_rcv, str)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif strings.Contains(rumor.Text, \"ACCEPT EXPEL\") {\n\t\t\t\t\t\tg.UpdateClusterExpel(rumor.Text[13:])\n\t\t\t\t\t}\n\n\t\t\t\t\tfound_request := false\n\t\t\t\t\tidx_request := -1\n\t\t\t\t\tfor i := 0 ; i < len(g.pending_nodes_requests) ; i++ {\n\t\t\t\t\t\tif strings.Contains(rumor.Text, g.pending_nodes_requests[i]) {\n\t\t\t\t\t\t\tfound_request = true\n\t\t\t\t\t\t\tidx_request = i\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\tif found_request == true {\n\t\t\t\t\t\tif strings.Contains(g.pending_nodes_requests[idx_request], \"JOIN \") {\n\t\t\t\t\t\t\tvar msg RequestMessage\n\t\t\t\t\t\t\tfor j := 0 ; j < len(g.pending_messages_requests) ; j++ {\n\t\t\t\t\t\t\t\tif (g.pending_messages_requests[j]).Origin == string((g.pending_nodes_requests[idx_request])[5:]) {\n\t\t\t\t\t\t\t\t\tmsg = g.pending_messages_requests[j]\n\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tfor i := 0 ; i < len(g.pending_nodes_requests) ; i++ {\n\t\t\t\t\t\t\t\tif string(g.pending_nodes_requests[i]) == \"JOIN \" + msg.Origin {\n\t\t\t\t\t\t\t\t\tcopy(g.pending_nodes_requests[i:], g.pending_nodes_requests[i+1:])\n\t\t\t\t\t\t\t\t\tg.pending_nodes_requests = g.pending_nodes_requests[:len(g.pending_nodes_requests) - 1]\n\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\n\t\t\t\t\t\t\tfor i := 0 ; i < len(g.pending_messages_requests) ; i++ {\n\t\t\t\t\t\t\t\tif (g.pending_messages_requests[i]).Origin == msg.Origin && (g.pending_messages_requests[i]).Recipient == msg.Recipient && bytes.Compare(g.pending_messages_requests[i].PublicKey, msg.PublicKey ) == 0 {\n\t\t\t\t\t\t\t\t\tcopy(g.pending_messages_requests[i:], g.pending_messages_requests[i+1:])\n\t\t\t\t\t\t\t\t\tg.pending_messages_requests = g.pending_messages_requests[:len(g.pending_messages_requests) - 1]\n\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tvar final_decision int\n\t\t\t\t\t\t\tif (strings.Contains(rumor.Text, \"ACCEPT \")) {\n\t\t\t\t\t\t\t\tfinal_decision = 1\n\t\t\t\t\t\t\t} else { // strings.Contains(rumor.Text, \"DENY \") == true\n\t\t\t\t\t\t\t\tfinal_decision = 0\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tg.ReceiveDecisionJoinRequest(msg, final_decision)\n\n\t\t\t\t\t\t} else if strings.Contains(g.pending_nodes_requests[idx_request], \"EXPEL \") {\n\t\t\t\t\t\t\tvar msg RequestMessage\n\t\t\t\t\t\t\tfor j := 0 ; j < len(g.pending_messages_requests) ; j++ {\n\t\t\t\t\t\t\t\tif (g.pending_messages_requests[j]).Recipient == string((g.pending_nodes_requests[idx_request])[6:]) {\n\t\t\t\t\t\t\t\t\tmsg = g.pending_messages_requests[j]\n\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tfor i := 0 ; i < len(g.pending_nodes_requests) ; i++ {\n\t\t\t\t\t\t\t\tif string(g.pending_nodes_requests[i]) == \"EXPEL \" + msg.Recipient {\n\t\t\t\t\t\t\t\t\tcopy(g.pending_nodes_requests[i:], g.pending_nodes_requests[i+1:])\n\t\t\t\t\t\t\t\t\tg.pending_nodes_requests = g.pending_nodes_requests[:len(g.pending_nodes_requests) - 1]\n\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tfor i := 0 ; i < len(g.pending_messages_requests) ; i++ {\n\t\t\t\t\t\t\t\tif (g.pending_messages_requests[i]).Origin == msg.Origin && (g.pending_messages_requests[i]).Recipient == msg.Recipient && bytes.Compare(g.pending_messages_requests[i].PublicKey, msg.PublicKey) == 0 {\n\t\t\t\t\t\t\t\t\tcopy(g.pending_messages_requests[i:], g.pending_messages_requests[i+1:])\n\t\t\t\t\t\t\t\t\tg.pending_messages_requests = g.pending_messages_requests[:len(g.pending_messages_requests) - 1]\n\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tvar final_decision int\n\t\t\t\t\t\t\tif (strings.Contains(rumor.Text, \"ACCEPT \")) {\n\t\t\t\t\t\t\t\tfinal_decision = 1\n\t\t\t\t\t\t\t} else { // strings.Contains(rumor.Text, \"DENY \") == true\n\t\t\t\t\t\t\t\tfinal_decision = 0\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tg.ReceiveDecisionExpelRequest(msg, final_decision)\n\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t//in any case add it to the map..\n\t\t\t\tif g.Name != rumor.Origin {\n\t\t\t\t\tg.Cluster.HeartBeats[rumor.Origin] = true\n\t\t\t\t}\n\t\t\t}\n\n\t\t} else if message.CancelRequest {\n\t\t\tlog.Lvl1(g.Name, \" received e-voting cancellation\")\n\t\t\tdecrypted := ies.Decrypt(g.Cluster.MasterKey, message.Data)\n\t\t\tvar rumor RumorMessage\n\t\t\terr := protobuf.Decode(decrypted, &rumor)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(g.Name, \"Error decoding packet : \", err, \"This may be due to an ongoing rollout.\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif rumor.Text != \"\" && strings.Contains(rumor.Text, g.Name) == false {\n\t\t\t\t//print the message\n\t\t\t\tg.PrintEvotingCancellationStep(rumor.Text, rumor.Origin)\n\t\t\t\tif g.Cluster.IsAnAuthority(g.Name) {\n\t\t\t\t\tfor i := 0 ; i < len(g.slice_results) ; i++ {\n\t\t\t\t\t\tif rumor.Text == string((g.slice_results[i])[0]) {\n\t\t\t\t\t\t\tcopy(g.slice_results[i:], g.slice_results[i+1:])\n\t\t\t\t\t\t\tg.slice_results = g.slice_results[:len(g.slice_results) - 1]\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\t_, ok1 := g.acks_cases[rumor.Text]\n\t\t\t\t\tif ok1 {\n\t\t\t\t\t\tdelete(g.acks_cases, rumor.Text)\n\t\t\t\t\t}\n\t\t\t\t\t_, ok2 := g.correct_results_rcv[rumor.Text]\n\t\t\t\t\tif ok2 {\n\t\t\t\t\t\tdelete(g.correct_results_rcv, rumor.Text)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tg.BroadcastReset(rumor.Text)\n\t\t\t}\n\t\t\t//in any case add it to the map..\n\t\t\tif g.Name != rumor.Origin {\n\t\t\t\tg.Cluster.HeartBeats[rumor.Origin] = true\n\t\t\t}\n\n\t\t} else if message.ResetIndication {\n\t\t\tlog.Lvl1(g.Name, \" received e-voting reset\")\n\t\t\tdecrypted := ies.Decrypt(g.Cluster.MasterKey, message.Data)\n\t\t\tvar rumor RumorMessage\n\t\t\terr := protobuf.Decode(decrypted, &rumor)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(g.Name, \"Error decoding packet : \", err, \"This may be due to an ongoing rollout.\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif rumor.Text != \"\" {\n\t\t\t\t//print the message\n\t\t\t\tg.PrintEvotingResetStep(rumor.Origin, rumor.Text)\n\n\t\t\t\tis_existing := false\n\t\t\t\tfor i := 0 ; i < len(g.pending_nodes_requests) ; i++ {\n\t\t\t\t\tif rumor.Text == g.pending_nodes_requests[i] {\n\t\t\t\t\t\tis_existing = 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 is_existing == true {\n\t\t\t\t\t_, ok := g.reset_requests[rumor.Text]\n\t\t\t\t\tif ok == true {\n\t\t\t\t\t\tfound := false\n\t\t\t\t\t\tfor j := 0 ; j < len(g.reset_requests[rumor.Text]) ; j++ {\n\t\t\t\t\t\t\tif g.reset_requests[rumor.Text][j] == rumor.Origin {\n\t\t\t\t\t\t\t\tfound = true\n\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif found == false {\n\t\t\t\t\t\t\tg.reset_requests[rumor.Text] = append(g.reset_requests[rumor.Text], rumor.Origin)\n\t\t\t\t\t\t}\n\t\t\t\t\t} else { // ok == false\n\t\t\t\t\t\tg.reset_requests[rumor.Text] = []string{rumor.Origin}\n\t\t\t\t\t}\n\n\t\t\t\t\tvar maxToCollect int\n\t\t\t\t\tif strings.Contains(rumor.Text, \"EXPEL\") {\n\t\t\t\t\t\tmaxToCollect = len(g.Cluster.Members) - 1\n\t\t\t\t\t} else { // strings.Contains(rumor.Text, \"EXPEL\") == false\n\t\t\t\t\t\tmaxToCollect = len(g.Cluster.Members)\n\t\t\t\t\t}\n\n\t\t\t\t\tif len(g.reset_requests[rumor.Text]) == maxToCollect {\n\n\t\t\t\t\t\tdelete(g.reset_requests, rumor.Text)\n\n\t\t\t\t\t\tnumbers := (len(g.Cluster.Members) + 1 ) / 2\n\t\t\t\t\t\tif numbers % 2 == 0 {\n\t\t\t\t\t\t\tnumbers ++\n\t\t\t\t\t\t}\n\t\t\t\t\t\tidx := rand.Perm(len(g.Cluster.Members))[:numbers]\n\t\t\t\t\t\tauth := make([]string, numbers)\n\t\t\t\t\t\tfor i, e := range idx{\n\t\t\t\t\t\t\tauth[i] = g.Cluster.Members[e]\n\t\t\t\t\t\t}\n\t\t\t\t\t\tg.Cluster.Authorities = auth\n\n\t\t\t\t\t\tcluster := g.Cluster\n\t\t\t\t\t\tdata, err := protobuf.Encode(cluster)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\tlog.Error(\"Could not encode cluster :\", err)\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcipher := ies.Encrypt(g.Cluster.MasterKey, data)\n\n\t\t\t\t\t\tfor _, member := range cluster.Members {\n\t\t\t\t\t\t\t//send them the new master key using the previous master key\n\t\t\t\t\t\t\tif member == g.Name {\n\t\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\taddr := g.FindPath(member)\n\n\t\t\t\t\t\t\tbc := BroadcastMessage{\n\t\t\t\t\t\t\t\tClusterID: *cluster.ClusterID,\n\t\t\t\t\t\t\t\tDestination: member,\n\t\t\t\t\t\t\t\tHopLimit: 10,\n\t\t\t\t\t\t\t\tReset: true,\n\t\t\t\t\t\t\t\tCaseRequest: rumor.Text,\n\t\t\t\t\t\t\t\tData: cipher,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tgp := GossipPacket{Broadcast: &bc}\n\t\t\t\t\t\t\tgo g.SendTo(addr, gp)\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\t//in any case add it to the map..\n\t\t\tif g.Name != rumor.Origin {\n\t\t\t\tg.Cluster.HeartBeats[rumor.Origin] = true\n\t\t\t}\n\n\t\t} else if message.AckResend {\n\t\t\tlog.Lvl1(g.Name, \" received e-voting ack for request resending\")\n\t\t\tdecrypted := ies.Decrypt(g.Cluster.MasterKey, message.Data)\n\t\t\tvar rumor RumorMessage\n\t\t\terr := protobuf.Decode(decrypted, &rumor)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(g.Name, \"Error decoding packet : \", err, \"This may be due to an ongoing rollout.\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif rumor.Text != \"\" {\n\t\t\t\t//print the message\n\t\t\t\tg.PrintEvotingResendStep(rumor.Origin, rumor.Text)\n\n\t\t\t\tis_existing := false\n\t\t\t\tfor i := 0 ; i < len(g.pending_nodes_requests) ; i++ {\n\t\t\t\t\tif rumor.Text == g.pending_nodes_requests[i] {\n\t\t\t\t\t\tis_existing = 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 is_existing == true {\n\t\t\t\t\t_, ok := g.members_ready_resend_requests[rumor.Text]\n\t\t\t\t\tif ok == true {\n\t\t\t\t\t\tfound := false\n\t\t\t\t\t\tfor j := 0 ; j < len(g.members_ready_resend_requests[rumor.Text]) ; j++ {\n\t\t\t\t\t\t\tif g.members_ready_resend_requests[rumor.Text][j] == rumor.Origin {\n\t\t\t\t\t\t\t\tfound = true\n\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif found == false {\n\t\t\t\t\t\t\tg.members_ready_resend_requests[rumor.Text] = append(g.members_ready_resend_requests[rumor.Text], rumor.Origin)\n\t\t\t\t\t\t}\n\t\t\t\t\t} else { // ok == false\n\t\t\t\t\t\tg.members_ready_resend_requests[rumor.Text] = []string{rumor.Origin}\n\t\t\t\t\t}\n\n\t\t\t\t\tif len(g.members_ready_resend_requests[rumor.Text]) == len(g.Cluster.Members) - 1 {\n\t\t\t\t\t\tdelete(g.members_ready_resend_requests, rumor.Text)\n\n\t\t\t\t\t\tif strings.Contains(rumor.Text, \"JOIN \") {\n\t\t\t\t\t\t\tnodeRequest := rumor.Text[5:]\n\t\t\t\t\t\t\tg.BroadcastJoin(nodeRequest)\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\t//in any case add it to the map..\n\t\t\tif g.Name != rumor.Origin {\n\t\t\t\tg.Cluster.HeartBeats[rumor.Origin] = true\n\t\t\t}\n\n\t\t} else {\n\t\t\tdecrypted := ies.Decrypt(g.Cluster.MasterKey, message.Data)\n\t\t\tvar rumor RumorMessage\n\t\t\terr := protobuf.Decode(decrypted, &rumor)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(g.Name, \"Error decoding packet : \", err, \"This may be due to an ongoing rollout.\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\tlog.Lvl2(g.Name, \"got a broadcast..from \", rumor.Origin)\n\n\t\t\tif rumor.Text != \"\" && rumor.Origin != g.Name {\n\t\t\t\t//print the message\n\t\t\t\tg.PrintBroadcast(rumor)\n\n\t\t\t}\n\t\t\t//in any case add it to the map..\n\t\t\tg.Cluster.HeartBeats[rumor.Origin] = true\n\t\t\tif !Contains(g.Cluster.Members, rumor.Origin) {\n\t\t\t\tg.Cluster.Members = append(g.Cluster.Members, rumor.Origin)\n\t\t\t}\n\t\t}\n\n\t}\n\n}", "title": "" }, { "docid": "b7f7dd8c5388a9dacdb1695a442af435", "score": "0.5584161", "text": "func (bh *handlerImpl) Handle(srv ab.AtomicBroadcast_BroadcastServer) error {\n\taddr := util.ExtractRemoteAddress(srv.Context())\n\tlogger.Debugf(\"Starting new broadcast loop for %s\", addr)\n\tfor {\n\t\tmsg, err := srv.Recv()\n\t\tif err == io.EOF {\n\t\t\tlogger.Debugf(\"Received EOF from %s, hangup\", addr)\n\t\t\treturn nil\n\t\t}\n\t\tif err != nil {\n\t\t\tlogger.Warningf(\"Error reading from %s: %s\", addr, err)\n\t\t\treturn err\n\t\t}\n\n\t\tchdr, isConfig, processor, err := bh.sm.BroadcastChannelSupport(msg)\n\t\tif err != nil {\n\t\t\tlogger.Warningf(\"[channel: %s] Could not get message processor for serving %s: %s\", chdr.ChannelId, addr, err)\n\t\t\treturn srv.Send(&ab.BroadcastResponse{Status: cb.Status_INTERNAL_SERVER_ERROR, Info: err.Error()})\n\t\t}\n\n\t\tif err = processor.WaitReady(); err != nil {\n\t\t\tlogger.Warningf(\"[channel: %s] Rejecting broadcast of message from %s with SERVICE_UNAVAILABLE: rejected by Consenter: %s\", chdr.ChannelId, addr, err)\n\t\t\treturn srv.Send(&ab.BroadcastResponse{Status: cb.Status_SERVICE_UNAVAILABLE, Info: err.Error()})\n\t\t}\n\n\t\tif !isConfig {\n\t\t\tlogger.Debugf(\"[channel: %s] Broadcast is processing normal message from %s with txid '%s' of type %s\", chdr.ChannelId, addr, chdr.TxId, cb.HeaderType_name[chdr.Type])\n\n\t\t\tconfigSeq, err := processor.ProcessNormalMsg(msg)\n\t\t\tif err != nil {\n\t\t\t\tlogger.Warningf(\"[channel: %s] Rejecting broadcast of normal message from %s because of error: %s\", chdr.ChannelId, addr, err)\n\t\t\t\treturn srv.Send(&ab.BroadcastResponse{Status: ClassifyError(err), Info: err.Error()})\n\t\t\t}\n\n\t\t\terr = processor.Order(msg, configSeq)\n\t\t\tif err != nil {\n\t\t\t\tlogger.Warningf(\"[channel: %s] Rejecting broadcast of normal message from %s with SERVICE_UNAVAILABLE: rejected by Order: %s\", chdr.ChannelId, addr, err)\n\t\t\t\treturn srv.Send(&ab.BroadcastResponse{Status: cb.Status_SERVICE_UNAVAILABLE, Info: err.Error()})\n\t\t\t}\n\t\t} else { // isConfig\n\t\t\tlogger.Debugf(\"[channel: %s] Broadcast is processing config update message from %s\", chdr.ChannelId, addr)\n\n\t\t\tconfig, configSeq, err := processor.ProcessConfigUpdateMsg(msg)\n\t\t\tif err != nil {\n\t\t\t\tlogger.Warningf(\"[channel: %s] Rejecting broadcast of config message from %s because of error: %s\", chdr.ChannelId, addr, err)\n\t\t\t\treturn srv.Send(&ab.BroadcastResponse{Status: ClassifyError(err), Info: err.Error()})\n\t\t\t}\n\n\t\t\terr = processor.Configure(config, configSeq)\n\t\t\tif err != nil {\n\t\t\t\tlogger.Warningf(\"[channel: %s] Rejecting broadcast of config message from %s with SERVICE_UNAVAILABLE: rejected by Configure: %s\", chdr.ChannelId, addr, err)\n\t\t\t\treturn srv.Send(&ab.BroadcastResponse{Status: cb.Status_SERVICE_UNAVAILABLE, Info: err.Error()})\n\t\t\t}\n\t\t}\n\n\t\tlogger.Debugf(\"[channel: %s] Broadcast has successfully enqueued message of type %s from %s\", chdr.ChannelId, cb.HeaderType_name[chdr.Type], addr)\n\n\t\terr = srv.Send(&ab.BroadcastResponse{Status: cb.Status_SUCCESS})\n\t\tif err != nil {\n\t\t\tlogger.Warningf(\"[channel: %s] Error sending to %s: %s\", chdr.ChannelId, addr, err)\n\t\t\treturn err\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e1328398c0a8e2acc1d3b9f2e1c2ead0", "score": "0.5580663", "text": "func (p *peerDiscovery) listen() (recievedBytes []byte, err error) {\n\tp.RLock()\n\taddress := net.JoinHostPort(p.settings.MulticastAddress, p.settings.Port)\n\tportNum := p.settings.portNum\n\tallowSelf := p.settings.AllowSelf\n\tp.RUnlock()\n\tlocalIPs := getLocalIPs()\n\n\t// get interfaces\n\tifaces, err := net.Interfaces()\n\tif err != nil {\n\t\treturn\n\t}\n\t// log.Println(ifaces)\n\n\t// Open up a connection\n\tc, err := net.ListenPacket(fmt.Sprintf(\"udp%d\", p.settings.IPVersion), address)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer c.Close()\n\n\tgroup := p.settings.multicastAddressNumbers\n\tvar p2 interface{}\n\tif p.settings.IPVersion == IPv4 {\n\t\tp2 = ipv4.NewPacketConn(c)\n\t} else {\n\t\tp2 = ipv6.NewPacketConn(c)\n\t}\n\n\tfor i := range ifaces {\n\t\tif p.settings.IPVersion == IPv4 {\n\t\t\tp2.(*ipv4.PacketConn).JoinGroup(&ifaces[i], &net.UDPAddr{IP: group, Port: portNum})\n\t\t} else {\n\t\t\tp2.(*ipv6.PacketConn).JoinGroup(&ifaces[i], &net.UDPAddr{IP: group, Port: portNum})\n\t\t}\n\t}\n\n\t// Loop forever reading from the socket\n\tfor {\n\t\tbuffer := make([]byte, maxDatagramSize)\n\t\tvar (\n\t\t\tn int\n\t\t\tsrc net.Addr\n\t\t\terrRead error\n\t\t)\n\t\tif p.settings.IPVersion == IPv4 {\n\t\t\tn, _, src, errRead = p2.(*ipv4.PacketConn).ReadFrom(buffer)\n\t\t} else {\n\t\t\tn, _, src, errRead = p2.(*ipv6.PacketConn).ReadFrom(buffer)\n\t\t}\n\t\t// log.Println(n, src.String(), err, buffer[:n])\n\t\tif errRead != nil {\n\t\t\terr = errRead\n\t\t\treturn\n\t\t}\n\n\t\tsrcHost, _, _ := net.SplitHostPort(src.String())\n\n\t\tif _, ok := localIPs[srcHost]; ok && !allowSelf {\n\t\t\tcontinue\n\t\t}\n\n\t\t// log.Println(src, hex.Dump(buffer[:n]))\n\n\t\tp.Lock()\n\t\tif _, ok := p.received[srcHost]; !ok {\n\t\t\tp.received[srcHost] = buffer[:n]\n\t\t}\n\t\tp.Unlock()\n\t\tp.RLock()\n\t\tif len(p.received) >= p.settings.Limit && p.settings.Limit > 0 {\n\t\t\tp.RUnlock()\n\t\t\tbreak\n\t\t}\n\t\tp.RUnlock()\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "cae15e14a468f59c811e061b8de0fabd", "score": "0.556324", "text": "func broadcast() {\n\t// clients set\n\tclients := map[clientReader]bool{}\n\tfor {\n\t\tselect {\n\t\tcase c := <-enter:\n\t\t\tclients[c] = true\n\t\tcase c := <-leave:\n\t\t\tdelete(clients, c)\n\t\tcase m := <-msg:\n\t\t\tfor c := range clients {\n\t\t\t\tc <- m\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e702071f1961493eff17d42e79d9d9bd", "score": "0.5556533", "text": "func net_listen(frame *rtda.Frame) {\n\n}", "title": "" }, { "docid": "72626eaf7b2a55a4a250fb1723b2560e", "score": "0.5553218", "text": "func (t *PacketTransport) listen() {\n\tfor {\n\t\t// Do a blocking read into a fresh buffer. Grab a time stamp as\n\t\t// close as possible to the I/O.\n\t\tbuf := make([]byte, udpPacketBufSize)\n\t\tn, addr, err := t.packetListener.ReadFrom(buf)\n\t\tts := time.Now()\n\n\t\tif t.checkShutDown() {\n\t\t\tbreak\n\t\t}\n\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"[ERR] Error reading UDP packet: %v\", err)\n\t\t\tcontinue\n\t\t}\n\n\t\t// Check the length - it needs to have at least one byte to be a\n\t\t// proper message.\n\t\tif n < 1 {\n\t\t\tfmt.Printf(\"[ERR] UDP packet too short (%d bytes) %s\", len(buf), addr.String())\n\t\t\tcontinue\n\t\t}\n\n\t\t// Ingest the packet.\n\t\tt.packetCh <- &Packet{\n\t\t\tBuf: buf[:n],\n\t\t\tAddr: addr,\n\t\t\tTimestamp: ts,\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c6570c36541f2b709b440f8d4a9e63b3", "score": "0.5550873", "text": "func (h *Hub) Broadcast(message *string) {\n\n\th.broadcast <- []byte(*message)\n}", "title": "" }, { "docid": "a8f1a428880ade90d4d0154ccb187b51", "score": "0.55409396", "text": "func (m *manager) broadcast(p []byte) {\n\tfor _, s := range m.users {\n\t\ts.WriteMessage(websocket.OpcodeText, p)\n\t}\n}", "title": "" }, { "docid": "3201d917d3ec29b5fc8f6a7dd7ef2882", "score": "0.5538331", "text": "func (conn *Conn) listen() {\n\treader := bufio.NewReader(conn)\n\twriter := bufio.NewWriter(conn)\n\n\t// Process all messages from the server into the In channel.\n\tgo func() {\n\t\tfor {\n\t\t\tstr, err := reader.ReadString(byte('\\n'))\n\t\t\tif err != nil {\n\t\t\t\tfmt.Fprintf(os.Stderr, \"irc: read error: %s\\n\", err)\n\t\t\t\tconn.Closed <- true\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tmessage := parseMessage(str)\n\t\t\tif conn.In[message.Command] != nil {\n\t\t\t\tconn.In[message.Command] <- message\n\t\t\t} else {\n\t\t\t\tconn.Unhandled <- message\n\t\t\t}\n\t\t}\n\t}()\n\n\t// Send all output in the Out channel to the server.\n\tgo func() {\n\t\tfor str := range conn.Out {\n\t\t\tif _, err := writer.WriteString(str + \"\\n\\r\"); err != nil {\n\t\t\t\tfmt.Fprintf(os.Stderr, \"irc: write error: %s\\n\", err)\n\t\t\t\tconn.Closed <- true\n\t\t\t\tbreak\n\t\t\t} else {\n\t\t\t\twriter.Flush()\n\t\t\t\tfmt.Println(\"wrote:\", str)\n\t\t\t}\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "17a995a9446f0a12c4ad9f6d81abdd2a", "score": "0.55379546", "text": "func (b *Broadcaster) Listen() {\n\tclients := make(map[string]map[string]Client)\n\tfor {\n\t\tselect {\n\t\tcase msg := <-b.messages:\n\t\t\t// send incoming message to all clients except sender\n\t\t\tlog.Printf(\"[DEBUG] Got incoming message %v\\n\", msg)\n\t\t\tfor name, clis := range clients {\n\t\t\t\tif name != msg.from.name {\n\t\t\t\t\tfor _, c := range clis {\n\t\t\t\t\t\tc.ch <- Message{from: msg.from, text: msg.text}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\tcase cli := <-b.entering:\n\t\t\tlog.Printf(\"[DEBUG] Got entering client %v\\n\", cli)\n\n\t\t\t// add new client\n\t\t\t_, ok := clients[cli.name]\n\t\t\tif !ok {\n\t\t\t\tclients[cli.name] = map[string]Client{cli.addr: cli}\n\t\t\t} else {\n\t\t\t\tclients[cli.name][cli.addr] = cli\n\t\t\t}\n\n\t\t\t// send others that client was connected\n\t\t\ttext := cli.name + \" is online\"\n\t\t\tfor name, clis := range clients {\n\t\t\t\tif name != cli.name && !ok {\n\t\t\t\t\tfor _, c := range clis {\n\t\t\t\t\t\tc.ch <- Message{from: cli, text: text, internal: true}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\tcase cli := <-b.leaving:\n\t\t\tlog.Printf(\"[DEBUG] Got leaving client %v\\n\", cli)\n\n\t\t\t// delete from clients\n\t\t\tclis, ok := clients[cli.name]\n\t\t\tsingle := true\n\t\t\tif ok {\n\t\t\t\tif len(clis) == 1 {\n\t\t\t\t\tdelete(clients, cli.name)\n\t\t\t\t} else {\n\t\t\t\t\tsingle = false\n\t\t\t\t\tdelete(clis, cli.addr)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tlog.Printf(\"[WARN] Client %v must be in clients map\\n\", cli)\n\t\t\t}\n\n\t\t\t// send others that client was disconnected\n\t\t\ttext := cli.name + \" is offline\"\n\t\t\tfor name, clis := range clients {\n\t\t\t\tif name != cli.name && single {\n\t\t\t\t\tfor _, c := range clis {\n\t\t\t\t\t\tc.ch <- Message{from: cli, text: text, internal: true}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ff4cacee0de6ad0b8d1394b71e426d4b", "score": "0.5536983", "text": "func (ec *EchoServer) Listen() {\n\tec.mu.RLock()\n\tdefer ec.mu.RUnlock()\n\n\tfor _, subscriber := range ec.subscribers {\n\t\tsubscriber.Subscribe(func(channel string, message *types.Data) {\n\t\t\tec.Broadcast(channel, message)\n\t\t})\n\t}\n}", "title": "" }, { "docid": "c48e7131dff6107f532f21020e2833ba", "score": "0.5516297", "text": "func (l *LeaderListener) broadcast() { // TODO: we may want to pass in a type\n\tl.mu.Lock()\n\tdefer l.mu.Unlock()\n\tfor _, w := range l.watchers {\n\t\tw.c <- struct{}{}\n\t}\n\tl.watchers = make([]watcher, 0)\n}", "title": "" }, { "docid": "60dab259b814dd4706d6e68d191c00ec", "score": "0.5496052", "text": "func (cm *ConnectionManager) handleBroadcastRequest(m *Message) {\n\t// change type from BroadcastRequest to Broadcast\n\tm.Type = Broadcast\n\n\t// buffer messages and push to waiting connections\n\tcm.broadcast(m)\n\n\t//log.Println(\"ConnectionManager: sending broadcast response\")\n\n\tm.RChan <- &Message{\n\t\tType: BroadcastResponse,\n\t\tErr: nil,\n\t}\n\n\t//log.Println(\"ConnectionManager: sent broadcast response\")\n}", "title": "" }, { "docid": "f8f653ca9dee62ee27a40371ab5f9383", "score": "0.5490017", "text": "func (serv *server) Broadcast(m string) {\n\tfor c := range serv.clients {\n\t\tc.SendingChan <- m\n\t}\n}", "title": "" }, { "docid": "23b55981d497c0847de8fc59d1f19813", "score": "0.5486099", "text": "func (notifee *Notifee) Listen(network.Network, multiaddr.Multiaddr) {}", "title": "" }, { "docid": "62866eefb8f93029143ea3f3041ee92c", "score": "0.54674965", "text": "func (r *Radio) Broadcast(message interface{}) error {\n\tif !r.live {\n\t\treturn errors.New(\"This radio channel is offline\")\n\t}\n\n\tr.antenna <- message\n\n\treturn nil\n}", "title": "" }, { "docid": "67321cfd43683de2a4d429d8f006b1f1", "score": "0.5465136", "text": "func listenToIncomingEvents(listen chan state.ClusterEvent) {\n\n\tvar cmd state.ClusterEvent\n\n\tfor {\n\t\tlog.Println(\"Listening for Incoming events.\")\n\n\t\tselect {\n\t\tcase cmd = <-listen:\n\t\t\tparseEvent(cmd)\n\t\tcase <-common.DoneCh:\n\t\t\temit.Info(\"DONE signal received, exiting ClusterManager\")\n\t\t\treturn\n\t\t}\n\n\t\tlog.Println(\"Message Received :\")\n\t}\n}", "title": "" }, { "docid": "ffc8029e6521469bb327afe83fdc7b80", "score": "0.5443915", "text": "func (h *Hub) realBroadcast(m string) {\n\th.mux.Lock()\n\tfor _, c := range h.out {\n\t\tc <- m\n\t}\n\th.mux.Unlock()\n}", "title": "" }, { "docid": "8a3af69c42dc592a93138cc893d0fcf8", "score": "0.54418445", "text": "func (h *Hub) Broadcast(topic string, msg interface{}) {\n\th.lock.Lock()\n\tdefer h.lock.Unlock()\n\n\tif tokens, ok := h.topics[topic]; ok {\n\t\tfor i := range tokens {\n\t\t\t// TODO: if the receiver refused to receive the msg, we should deal this\n\t\t\tif ch, ok := h.chs[tokens[i]]; ok {\n\t\t\t\tch <- msg\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b990a4be925c1e8f3ddfa6280ee4c91a", "score": "0.5441064", "text": "func (nn *cmNotifee) Listen(n inet.Network, addr ma.Multiaddr) {}", "title": "" }, { "docid": "7e7069c0051905f3e925073075444396", "score": "0.54362226", "text": "func listenForGameData(name string, c chan interface{}) {\n\tvar (\n\t\terr error\n\t\tbuffer []byte\n\t\tmessage string\n\t\tgameinfo *json_GameInfo\n\t\tlevelinfo *json_LevelInfo\n\t\tinitialized bool\n\t\tbufConn *bufio.Reader\n\t)\n\t// Buffer the connection so we can read it line by line\n\tbufConn = bufio.NewReader(conn)\n\nloop:\n\tfor {\n\t\tif buffer, err = bufConn.ReadBytes('\\n'); err != nil {\n\t\t\tlog.Println(err)\n\t\t\tbreak\n\t\t}\n\t\tmessage = strings.TrimSpace(string(buffer))\n\t\tswitch message {\n\t\tcase \"\":\n\t\t\tlog.Println(\"Empty line from conn\")\n\t\t\tcontinue loop\n\t\tcase \"<connect>\":\n\t\t\t// Server handshake\n\t\t\tconnect := new(json_ConnectServer)\n\t\t\tif err = jsonFromBuffer(bufConn, &connect); err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif api_version != connect.Value.ProtocolVersion {\n\t\t\t\tlog.Printf(\"Wrong json api version.\\nServer: %s\\nClient: %s\", connect.Value.ProtocolVersion, api_version)\n\t\t\t\tbreak loop\n\t\t\t}\n\n\t\t\treply := &json_ClientConnect{\n\t\t\t\tClass: \"ConnectClient\",\n\t\t\t}\n\t\t\treply.Value.CommanderName = name\n\t\t\treply.Value.Language = \"Go\"\n\t\t\tb, _ := json.Marshal(reply)\n\n\t\t\t// Client handshake\n\t\t\tconn.Write([]byte(\"<connect>\\n\"))\n\t\t\tconn.Write(trim(b))\n\t\tcase \"<initialize>\":\n\t\t\tif initialized {\n\t\t\t\tlog.Printf(\"Unexpected initialize message '%s'\", message)\n\t\t\t}\n\t\t\t// Read level info\n\t\t\tlevelinfo = new(json_LevelInfo)\n\t\t\tif err = jsonFromBuffer(bufConn, &levelinfo); err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// Read game info\n\t\t\tgameinfo = new(json_GameInfo)\n\t\t\tif err = jsonFromBuffer(bufConn, &gameinfo); err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// Only send the actual data of LevelInfo\n\t\t\tc <- levelinfo.Value\n\t\t\t// Make GameInfo more intuitive to use\n\t\t\tc <- gameinfo.simplify()\n\t\t\tinitialized = true\n\t\tcase \"<tick>\":\n\t\t\tif !initialized {\n\t\t\t\tlog.Printf(\"Unexpected message '%s' while waiting for initialize\", message)\n\t\t\t}\n\t\t\tgameinfo = new(json_GameInfo)\n\t\t\tif err = jsonFromBuffer(bufConn, &gameinfo); err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tc <- gameinfo.simplify()\n\t\tcase \"<shutdown>\":\n\t\t\tif !initialized {\n\t\t\t\tlog.Printf(\"Unexpected message '%s' while waiting for initialize\", message)\n\t\t\t}\n\t\t\tbreak loop\n\t\tdefault:\n\t\t\tlog.Printf(\"unknown message received: '%s'\", message)\n\t\t}\n\t}\n\t// Tell the commander that we're done here.\n\tclose(c)\n}", "title": "" }, { "docid": "3dc5d5b1e29c3c2a199d1cd8e1203971", "score": "0.5431245", "text": "func onChannelJoined(msg map[string]interface{}) {\n}", "title": "" }, { "docid": "661114aa581ece90a3c7d5e89fdddb21", "score": "0.54308033", "text": "func (c *WsClient) listen(closer chan<- *WsClient) {\n\tdefer func() {\n\t\tcloser <- c\n\t}()\n\n\tfor {\n\t\t// in case of an error just return and signal closing down of the ws\n\t\tif _, _, err := c.ReadMessage(); err != nil {\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5ba4a9d805b8173e0982123390a900af", "score": "0.54259515", "text": "func (client *client) listen() {\n\tgo client.read()\n\tgo client.write()\n}", "title": "" }, { "docid": "3cbb9ad4344611361d19b4d881d71b53", "score": "0.54219174", "text": "func (t *things) Broadcast(client string, ch chan interface{}, value interface{}) {\n\tif cap(ch) != broadcastChannelBuffer {\n\t\tlog.Printf(\"error: %s - use unbuffered broadcasting channel\", client)\n\t\treturn\n\t}\n\t// use channel only if the buffer is half full or half empty ;)\n\tif (cap(ch)+1)/2 > len(ch) {\n\t\tch <- value\n\t} else {\n\t\tlog.Printf(\"warn: %s - broadcasting on full channel\\n\", client)\n\t}\n}", "title": "" }, { "docid": "f99aad599e7bd37fc346366ca7e3c17b", "score": "0.5421363", "text": "func (n *Network) BlockUntilListening() {\n\t<-n.listeningCh\n}", "title": "" }, { "docid": "8ba07f9846c3a5a5914ce1941ae73fa5", "score": "0.5412557", "text": "func (r *Rattle) Broadcast(m *Message) {\n\tfor _, v := range r.Connections.PickAllLeafs() {\n\t\tv.(Connection).ws.Write(m.Bytes())\n\t}\n}", "title": "" }, { "docid": "a8e2d2ae70ff10b3f38b95479e4d5b54", "score": "0.5411099", "text": "func (chatRoom *ChatRoom) Broadcast(message string) {\n\tchatRoom.expiry = time.Now().Add(EXPIRY_TIME)\n\tchatRoom.messages = append(chatRoom.messages, message)\n\tfor _, client := range chatRoom.clients {\n\t\tclient.outgoing <- message\n\t}\n}", "title": "" }, { "docid": "bd37601b0228fb3c24c5e5bd1c671655", "score": "0.5407296", "text": "func (e *Endpoint) listen() {\n\tlog.Infof(\"%s listening on :%d\", e.miner, e.port)\n\tfor {\n\t\tconn, err := e.listener.Accept()\n\t\tif err != nil {\n\t\t\tvar opErr *net.OpError\n\t\t\tif errors.As(err, &opErr) {\n\t\t\t\tif opErr.Op == \"accept\" {\n\t\t\t\t\tif strings.Contains(opErr.Err.Error(),\n\t\t\t\t\t\t\"use of closed network connection\") {\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\tlog.Errorf(\"unable to accept client connection for \"+\n\t\t\t\t\"%s endpoint: %v\", e.miner, err)\n\t\t\treturn\n\t\t}\n\t\te.connCh <- &connection{\n\t\t\tConn: conn,\n\t\t\tDone: make(chan bool),\n\t\t}\n\t}\n}", "title": "" }, { "docid": "48865121f020805762544e74e30c7efd", "score": "0.5394033", "text": "func (p *Protocol) Broadcast(payload []byte, nextProt string) error {\n\tp.With().Debug(\"broadcasting message\", log.String(\"from_type\", nextProt))\n\treturn p.processMessage(p.localNodePubkey, nextProt, service.DataBytes{Payload: payload})\n\t//todo: should this ever return error ? then when processMessage should return error ?. should it block?\n}", "title": "" }, { "docid": "286a0e32035f5b364dfe77dfd1df3614", "score": "0.5388749", "text": "func (r *Redis) BroadcastFromBackend(b chan<- *gosock.BroadcastMsg) {\n\tfor {\n\t\tswitch n := r.pscBroadCast.Receive().(type) {\n\t\tcase redis.Message:\n\t\t\tlog.Info.Printf(\"Broad Message: %s %s\\n\", n.Channel, n.Data)\n\n\t\t\tbcast := &BCData{}\n\t\t\tjson.Unmarshal(n.Data, bcast)\n\n\t\t\tswitch n.Channel {\n\t\t\tcase r.bc:\n\t\t\t\tb <- &gosock.BroadcastMsg{EventName: bcast.Event, Data: bcast.Data}\n\t\t\t}\n\t\tcase redis.Subscription:\n\t\t\tlog.Info.Printf(\"%s: %s %d\\n\", n.Channel, n.Kind, n.Count)\n\t\tcase error:\n\t\t\tlog.Err.Printf(\"error: %v\\n\", n)\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3fd6aafcd3441b11bc69786abe5185e3", "score": "0.5386953", "text": "func (b *Broadcaster) Listen() Receiver {\n\tc := make(chan chan broadcast)\n\tb.listenC <- c\n\treturn Receiver{<-c}\n}", "title": "" }, { "docid": "c8f3fa0d0efd74b195194058a135e74b", "score": "0.53854877", "text": "func listenForMessage(LANID string, LANConn net.Conn) {\n\td := json.NewDecoder(LANConn)\n\tfor {\n\n\t\tvar unknownMessage Message\n\t\terr := d.Decode(&unknownMessage)\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"horrible error\")\n\t\t\tpanic(err)\n\t\t}\n\n\t\tif unknownMessage.Type == \"bpdu\" {\n\t\t\treceivedBPDUs <- IncomingBPDU{BPDU: unknownMessage,\n\t\t\t\tLANID: LANID,\n\t\t\t}\n\n\t\t} else {\n\t\t\tfmt.Printf(\"Received message %v on port %s from %s to %s\\n\", unknownMessage.Message[\"id\"], LANID, unknownMessage.Source, unknownMessage.Dest)\n\t\t\tif enabledLANConns[LANID] {\n\t\t\t\tforwardingTableMap[unknownMessage.Source] = LANForwardingEntry{\n\t\t\t\t\tLANID: LANID,\n\t\t\t\t\tCreatedAt: time.Now(),\n\t\t\t\t}\n\n\t\t\t\tsendData(unknownMessage, LANID)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b625f91d9aceff5b3c862855dd52ebf5", "score": "0.53778446", "text": "func listen(msgs <-chan amqp.Delivery) {\n\tlog.Println(\"Listening for b o u n d l e s s messages\")\n\tfor msg := range msgs {\n\t\tlog.Println(string(msg.Body))\n\t}\n\n}", "title": "" }, { "docid": "0687c2521174304311196bb09c9d6b29", "score": "0.5377464", "text": "func (n *Node) Broadcast(msg *common.StreamMessage) {\n\tn.Metrics.Counter(metricsBroadcastMsg).Inc()\n\tn.log.Debugf(\"Incoming pubsub message: %v\", msg)\n\tn.hub.BroadcastMessage(msg)\n}", "title": "" }, { "docid": "d3b9e06c92b8ebd7a505107ec8aa38b9", "score": "0.5375441", "text": "func (e *Emma) Broadcast(msg []byte) error {\n\tfor client := range e.clients {\n\t\tclient.Send(msg)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8a5226f8eb7f3e1637684e56dd40f58e", "score": "0.5365723", "text": "func (s *SocketsService) Broadcast(room, event string, args ...interface{}) bool {\n\treturn s.Server.BroadcastToRoom(\"/\", room, event, args...)\n}", "title": "" }, { "docid": "dd05d1753db281aac453d6ac27d2c2f7", "score": "0.53624123", "text": "func (m *PeerManager) broadcast(peerUpdate PeerUpdate) {\n\tfor _, sub := range m.subscriptions {\n\t\tselect {\n\t\tcase sub.updatesCh <- peerUpdate:\n\t\tcase <-sub.doneCh:\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e199173682aa967e2383876150965b54", "score": "0.53621554", "text": "func (rm *Chatroom) Broadcast(i interface{}, sender *websocket.Conn) error {\n\trm.Lock()\n\tdefer rm.Unlock()\n\n\tlog.Printf(\"Broadcasting: %v\", i)\n\n\tvar lasterr error\n\tfor _, ws := range rm.websockets {\n\t\tif ws != sender {\n\t\t\tif err := websocket.JSON.Send(ws, i); err != nil {\n\t\t\t\tlog.Printf(\"send: %v\", err)\n\t\t\t\tlasterr = err\n\t\t\t}\n\t\t}\n\t}\n\n\t// returning only the last error encountered\n\t// in practice we should return a custom error that has all errors collected\n\treturn lasterr\n}", "title": "" }, { "docid": "f9e6fe7b1f33964cd2c8d2a8eae3a111", "score": "0.5358856", "text": "func (h *Hub) broadcastMsg(m *Message) {\n\tb, err := json.Marshal(*m)\n\tif err != nil {\n\t\tlog.Println(\"broadcastMsg: msg failed to convert to []byte\")\n\t}\n\tlog.Println(\"brodcastMsg: \", m)\n\thub.broadcast <- b\n}", "title": "" }, { "docid": "4a1bfc952f33dbd66c6d1c66a053dbd3", "score": "0.53575563", "text": "func (c Client) listenWrite() {\n\tlog.Println(\"Listening write to client\")\n\tfor {\n\t\tselect {\n\t\t// send message to the client\n\t\tcase msg := <-c.ch:\n\t\t\tlog.Println(\"Send:\", msg)\n\t\t\twebsocket.JSON.Send(c.ws, msg)\n\n\t\t// receive done request\n\t\tcase <-c.doneCh: // tells the server to delete current client( if there is new data?)\n\t\t\tc.server.Del(c)\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "74df5968f94a89ef692f782f14581715", "score": "0.5350031", "text": "func (c *Client) Listen() {\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase msg := <-c.feed:\n\t\t\t\tfmt.Println(msg)\n\n\t\t\tcase delay := <-c.sleep:\n\t\t\t\ttime.Sleep(delay)\n\n\t\t\tcase <-c.done:\n\t\t\t\treturn\n\n\t\t\tdefault:\n\t\t\t\ttime.Sleep(451 * time.Millisecond)\n\t\t\t}\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "e450267c4a12cc7c4d439a35a13f480f", "score": "0.534984", "text": "func listener(cli *Client, inbox *Box){\n\treader := bufio.NewReader(cli.in_con)\n\t// create local request buffer\n\tfor {\n\t\ts, err := reader.ReadString('\\n')\n\t\tfmt.Printf(\"# recieved string %s\\n\", s)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"#Error in listening\")\n\t\t\tfmt.Printf(\"# %s\", err)\n\t\t\treturn\n\t\t}\n\t\ts = strings.TrimSpace(s)\n\t\tm := Msg{}\n\t\tm.Parse(s)\n\t\tm.from = cli\n\t\tif (m.GetType() != \"BEGIN\") {\n\t\t\tm.transId = clientToTrans[m.from.num]\n\t\t}\n\t\tinbox.enqueue(m)\n\t\t// msg := strings.Split(s, \" \")\n\t}\n}", "title": "" }, { "docid": "bd5de545e747c5f95d9da9428333bfb4", "score": "0.5349395", "text": "func (c *Client) listenRead() {\n\tfor {\n\t\tselect {\n\n\t\t// receive done request\n\t\tcase <-c.doneCh:\n\t\t\t_server.remove(c)\n\t\t\tc.doneCh <- true // for listenWrite method\n\t\t\treturn\n\n\t\t// read data from websocket connection\n\t\tdefault:\n\t\t\tvar msg models.ChatMessage\n\t\t\tid, err := shortid.Generate()\n\t\t\tif err != nil {\n\t\t\t\tlog.Panicln(err)\n\t\t\t}\n\n\t\t\tmsg.ID = id\n\t\t\tmsg.MessageType = \"CHAT\"\n\t\t\tmsg.Timestamp = time.Now()\n\n\t\t\tif err := websocket.JSON.Receive(c.ws, &msg); err == io.EOF {\n\t\t\t\tc.doneCh <- true\n\t\t\t\treturn\n\t\t\t} else if err != nil {\n\t\t\t\t_server.err(err)\n\t\t\t} else {\n\t\t\t\tc.MessageCount++\n\n\t\t\t\tmsg.ClientID = c.id\n\t\t\t\t_server.SendToAll(msg)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e9ee49c7afbfc6f7bfd5e9930d7f24fd", "score": "0.53457236", "text": "func (cm *discoveryProtocol) Listen(network.Network, multiaddr.Multiaddr) {}", "title": "" }, { "docid": "6163d28d59d3af0997619439f3903167", "score": "0.53388166", "text": "func BroadcastEvent(data interface{}) (dropped bool, err error) {\n\tvar ev *MaestroEvent\n\tchannels.Range(func(key, value interface{}) bool {\n\t\tif ev == nil {\n\t\t\tev = &MaestroEvent{Data: data, enqueTime: time.Now().UnixNano()}\n\t\t}\n\t\tchannel := value.(*eventChannel)\n\t\tdrop, _ := channel.fifo.Push(ev)\n\t\tif drop {\n\t\t\tdropped = true\n\t\t}\n\t\treturn true\n\t})\n\n\treturn\n}", "title": "" }, { "docid": "26b6ccada2d1c582099251d11a449f0e", "score": "0.53378785", "text": "func (net *netService) Broadcast(route string, data []byte) {\n\tif App.Config.IsFrontend {\n\t\tfor _, s := range net.agentMap {\n\t\t\tnet.Push(s.session, route, data)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "799eebefbd230263be1f1bd20374f17d", "score": "0.5331246", "text": "func broadcast(msg *Message) {\n\t// Convert to JSON\n\tmsgBytes, err := json.Marshal(msg)\n\tif err != nil {\n\t\treturn\n\t}\n\tmsgJSON := string(msgBytes)\n\n\t// send non-empty messages to self\n\tif len(msg.Content) != 0 {\n\t\tMessagesFIFO.Enqueue(msg)\n\t}\n\n\t// send message to other servers\n\tfor id := 0; id < NUM_PROCS; id++ {\n\t\tif id == ID {\n\t\t\tcontinue\n\t\t}\n\n\t\tsendMarshaled(msgJSON, id)\n\t}\n}", "title": "" }, { "docid": "21b120d3f7930c49f10e329b36e614a6", "score": "0.5331245", "text": "func (b *Broadcaster) Listen() *Receiver {\n\tb.mx.Lock()\n\tdefer b.mx.Unlock()\n\n\treturn &Receiver{sync.Mutex{}, b.c}\n}", "title": "" }, { "docid": "17f68374fbda2fd4f4fc82c1b78b3c94", "score": "0.5325101", "text": "func (o *ocrEndpoint) Broadcast(payload []byte) {\n\tvar wg sync.WaitGroup\n\tfor oracleID := range o.peerMapping {\n\t\twg.Add(1)\n\t\tgo func(oid types.OracleID) {\n\t\t\to.SendTo(payload, oid)\n\t\t\twg.Done()\n\t\t}(oracleID)\n\t}\n\twg.Wait()\n}", "title": "" }, { "docid": "35e19c75f94d0ba1590a7d187ed71e09", "score": "0.5321223", "text": "func (p *ClientPool) listenChans(ctx context.Context) {\n\tvar (\n\t\tclient = p.poolManager.AcquireCurrent()\n\t\tblockChan = client.BlockChannel()\n\t\ttxChan = client.TxChannel()\n\t)\n\tdefer p.poolManager.ReleaseCurrent()\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase block := <-blockChan:\n\t\t\t\tp.blockChan <- block\n\t\t\tcase tx := <-txChan:\n\t\t\t\tp.txChan <- tx\n\t\t\tcase <-ctx.Done():\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "40aed873d991b1a87a8c1ab7c20763fd", "score": "0.5320685", "text": "func bytesRecvNotiFn_Broadcast(me interface{}, hd c2s_packet.Header, rbody []byte) error {\n\trobj, err := c2s_json.UnmarshalPacket(hd, rbody)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Packet type miss match %v\", rbody)\n\t}\n\trecved, ok := robj.(*c2s_obj.NotiBroadcast_data)\n\tif !ok {\n\t\treturn fmt.Errorf(\"packet mismatch %v\", robj)\n\t}\n\treturn fmt.Errorf(\"Not implemented %v\", recved)\n}", "title": "" }, { "docid": "982a15250fdb13930c505821ead183e1", "score": "0.5318643", "text": "func (g *ClientGroup) Broadcast(v interface{}) {\n\tg.m.Lock()\n\tfor _, c := range g.c {\n\t\tc.c.Write(v)\n\t}\n\tg.m.Unlock()\n}", "title": "" }, { "docid": "4a508fbffab83635cda2c09e4669509f", "score": "0.53135324", "text": "func listen(w http.ResponseWriter, req *http.Request) {\n\t\n\tkey := req.URL.Query().Get(\"key\")\n\t\t\n\th, _ := w.(http.Hijacker)\n\tconn, rw, _ := h.Hijack()\n\tdefer conn.Close()\n\t\n\trw.Write([]byte(\"HTTP/1.1 200 OK\\r\\n\"))\n\trw.Write([]byte(\"Content-Type: text/event-stream\\r\\n\\r\\n\"))\n\trw.Flush()\n\t\n\tvar mr *mosRequest\n\tvar ok bool\n\t\n\tif mr, ok = mosRequests[key]; !ok {\n\t\tfmt.Println(\"key not found\")\n return\n\t}\n\tdelete(mosRequests,key)\n\t\t\n\tdisconnect:=make(chan bool, 1)\n\t\n\tgo func(){\n\t\t_,err := rw.ReadByte()\n\t\tif err==io.EOF {\n\t\t\tdisconnect<-true\n\t\t}\n\t}()\n\t\n\tfor {\n\t\t\n\t\tselect{\n\t\tcase <-disconnect:\n\t\t\tfmt.Println(\"disconnected\")\n\t\t\treturn\n\t\t\t\n\t\tcase msg := <-mr.Progress:\n\t\t\t\n\t\t\trw.Write([]byte(\"event: progress\\n\"))\n\t\t\trw.Write([]byte(\"data: \" + msg+\"\\n\\n\"))\n\t\t\trw.Flush()\n\t\t\t\n\t\tcase mosaic := <-mr.Result:\n\t\t\t\n\t\t\tvar b bytes.Buffer\t\n\t\n\t\t\tjpeg.Encode(&b,mosaic,nil)\n\t\t\t\n\t\t\t//str := base64.StdEncoding.EncodeToString(result.Mosaic.Bytes())\n\t\t\t//json:= \"{\\\"height\\\":\" + strconv.Itoa(result.Height) + \",\\\"width\\\":\" + strconv.Itoa(result.Width) + \",\\\"base64\\\":\\\"\"+str+ \"\\\"}\"\n\t\t\tbb,_:= json.Marshal(b.Bytes())\t\t\n\t\t\t\n\t\t\trw.Write([]byte(\"event: image\\n\"))\n\t\t\trw.Write([]byte(\"data: \"))\n\t\t\trw.Write(bb)\n\t\t\t//rw.Write([]byte(json))\n\t\t\trw.Write([]byte(\"\\n\\n\"))\n\t\t\trw.Flush()\n\t\t\treturn\t\t\t\t\n\t\t}\t\t\n\t}\t\t\n}", "title": "" }, { "docid": "d0e080a067a05e3d84de1098b0ca7f0b", "score": "0.53082204", "text": "func (b *BasicBroadcaster) Broadcast(seqNo uint64, data []byte) error {\n\t//This should only get invoked once per broadcaster\n\tif b.working == false {\n\t\tctxB, cancel := context.WithCancel(context.Background())\n\t\tb.cancelWorker = cancel\n\t\tgo b.broadcastToListeners(ctxB)\n\t\tb.working = true\n\t}\n\n\tlatest := &StreamDataMsg{SeqNo: seqNo, Data: data}\n\tb.lastMsgs = append(b.lastMsgs, latest)\n\tb.lastMsgs = b.lastMsgs[1:]\n\tb.q <- latest\n\treturn nil\n}", "title": "" } ]
1cec8b1cc7c725bf8eadfec33da02a79
WriteToRequest writes these params to a swagger request
[ { "docid": "2f45200bd1229c64033f6cb92ff69626", "score": "0.0", "text": "func (o *DeleteUnusedCouponCodesCouponSetParams) 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\t// path param id\n\tif err := r.SetPathParam(\"id\", o.ID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" } ]
[ { "docid": "34a05559dcfc073ab13a820623e3f106", "score": "0.72732097", "text": "func (o *SemverGenerateParams) 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.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param projectUuid\n\tif err := r.SetPathParam(\"projectUuid\", o.ProjectUUID.String()); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "228f0eb3f21aaea82d4a0b07e316c341", "score": "0.71483296", "text": "func (o *GetParams) 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.DollarExpand != nil {\n\n\t\t// query param $expand\n\t\tvar qrNrDollarExpand string\n\t\tif o.DollarExpand != nil {\n\t\t\tqrNrDollarExpand = *o.DollarExpand\n\t\t}\n\t\tqNrDollarExpand := qrNrDollarExpand\n\t\tif qNrDollarExpand != \"\" {\n\t\t\tif err := r.SetQueryParam(\"$expand\", qNrDollarExpand); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// query param api-version\n\tqrAPIVersion := o.APIVersion\n\tqAPIVersion := qrAPIVersion\n\tif qAPIVersion != \"\" {\n\t\tif err := r.SetQueryParam(\"api-version\", qAPIVersion); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param organization\n\tif err := r.SetPathParam(\"organization\", o.Organization); err != nil {\n\t\treturn err\n\t}\n\n\t// path param processTypeId\n\tif err := r.SetPathParam(\"processTypeId\", o.ProcessTypeID.String()); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "83d75e05b1af01e23586f9d3bcb27f75", "score": "0.7143085", "text": "func (o *WriteToMicrostorageParams) 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.ContentLength != nil {\n\n\t\t// header param Content-Length\n\t\tif err := r.SetHeaderParam(\"Content-Length\", swag.FormatInt64(*o.ContentLength)); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\n\tif o.ContentType != nil {\n\n\t\t// header param Content-Type\n\t\tif err := r.SetHeaderParam(\"Content-Type\", *o.ContentType); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\n\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\treturn err\n\t}\n\n\t// path param id4n\n\tif err := r.SetPathParam(\"id4n\", o.ID4N); err != nil {\n\t\treturn err\n\t}\n\n\t// path param organization\n\tif err := r.SetPathParam(\"organization\", o.Organization); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "882d15b1667ff2c63d5b5a6af8a94711", "score": "0.7109384", "text": "func (o *GetSampleV2Params) 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\t// query param ids\n\tqrIds := o.Ids\n\tqIds := qrIds\n\tif qIds != \"\" {\n\n\t\tif err := r.SetQueryParam(\"ids\", qIds); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.PasswordProtected != nil {\n\n\t\t// query param password_protected\n\t\tvar qrPasswordProtected bool\n\n\t\tif o.PasswordProtected != nil {\n\t\t\tqrPasswordProtected = *o.PasswordProtected\n\t\t}\n\t\tqPasswordProtected := swag.FormatBool(qrPasswordProtected)\n\t\tif qPasswordProtected != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"password_protected\", qPasswordProtected); err != nil {\n\t\t\t\treturn err\n\t\t\t}\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": "5b411819b2d18298fd51573a105ab366", "score": "0.70693165", "text": "func (o *GetTagParams) 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\t// path param owner\n\tif err := r.SetPathParam(\"owner\", o.Owner); err != nil {\n\t\treturn err\n\t}\n\n\t// path param repo\n\tif err := r.SetPathParam(\"repo\", o.Repo); err != nil {\n\t\treturn err\n\t}\n\n\t// path param sha\n\tif err := r.SetPathParam(\"sha\", o.Sha); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ec31e917a0aafd419287aac61884d9c9", "score": "0.7062532", "text": "func (o *AddTagParams) 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\t// path param organizationName\n\tif err := r.SetPathParam(\"organizationName\", o.OrganizationName); err != nil {\n\t\treturn err\n\t}\n\n\t// path param projectName\n\tif err := r.SetPathParam(\"projectName\", o.ProjectName); err != nil {\n\t\treturn err\n\t}\n\tif o.Tag != nil {\n\t\tif err := r.SetBodyParam(o.Tag); 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": "d9b7693259307f74db2b5b0db38d8f45", "score": "0.70486313", "text": "func (o *SearchDocParams) 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\t// header param X-Cassandra-Token\n\tif err := r.SetHeaderParam(\"X-Cassandra-Token\", o.XCassandraToken); err != nil {\n\t\treturn err\n\t}\n\n\t// path param collection-id\n\tif err := r.SetPathParam(\"collection-id\", o.CollectionID); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Fields != nil {\n\n\t\t// query param fields\n\t\tvar qrFields string\n\t\tif o.Fields != nil {\n\t\t\tqrFields = *o.Fields\n\t\t}\n\t\tqFields := qrFields\n\t\tif qFields != \"\" {\n\t\t\tif err := r.SetQueryParam(\"fields\", qFields); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// path param namespace-id\n\tif err := r.SetPathParam(\"namespace-id\", o.NamespaceID); err != nil {\n\t\treturn err\n\t}\n\n\tif o.PageSize != nil {\n\n\t\t// query param page-size\n\t\tvar qrPageSize int32\n\t\tif o.PageSize != nil {\n\t\t\tqrPageSize = *o.PageSize\n\t\t}\n\t\tqPageSize := swag.FormatInt32(qrPageSize)\n\t\tif qPageSize != \"\" {\n\t\t\tif err := r.SetQueryParam(\"page-size\", qPageSize); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.PageState != nil {\n\n\t\t// query param page-state\n\t\tvar qrPageState string\n\t\tif o.PageState != nil {\n\t\t\tqrPageState = *o.PageState\n\t\t}\n\t\tqPageState := qrPageState\n\t\tif qPageState != \"\" {\n\t\t\tif err := r.SetQueryParam(\"page-state\", qPageState); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Raw != nil {\n\n\t\t// query param raw\n\t\tvar qrRaw bool\n\t\tif o.Raw != nil {\n\t\t\tqrRaw = *o.Raw\n\t\t}\n\t\tqRaw := swag.FormatBool(qrRaw)\n\t\tif qRaw != \"\" {\n\t\t\tif err := r.SetQueryParam(\"raw\", qRaw); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Where != nil {\n\n\t\t// query param where\n\t\tvar qrWhere string\n\t\tif o.Where != nil {\n\t\t\tqrWhere = *o.Where\n\t\t}\n\t\tqWhere := qrWhere\n\t\tif qWhere != \"\" {\n\t\t\tif err := r.SetQueryParam(\"where\", qWhere); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ceec037cd6b8c28a93dd9773233b2f87", "score": "0.7048582", "text": "func (o *CreateSnippetParams) 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.JSONBody != nil {\n\t\tif err := r.SetBodyParam(o.JSONBody); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param id\n\tif err := r.SetPathParam(\"id\", o.ID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e3417554a9350a535d4e859e4accc5b0", "score": "0.7044478", "text": "func (o *ScanSamplesParams) 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\tif o.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); 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": "b0cb5fb169c1ba4fa13a741c51911fb8", "score": "0.70216024", "text": "func (o *ListParams) 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\t// query param api-version\n\tqrAPIVersion := o.APIVersion\n\tqAPIVersion := qrAPIVersion\n\tif qAPIVersion != \"\" {\n\t\tif err := r.SetQueryParam(\"api-version\", qAPIVersion); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.ContinuationToken != nil {\n\n\t\t// query param continuationToken\n\t\tvar qrContinuationToken string\n\t\tif o.ContinuationToken != nil {\n\t\t\tqrContinuationToken = *o.ContinuationToken\n\t\t}\n\t\tqContinuationToken := qrContinuationToken\n\t\tif qContinuationToken != \"\" {\n\t\t\tif err := r.SetQueryParam(\"continuationToken\", qContinuationToken); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.IsPublic != nil {\n\n\t\t// query param isPublic\n\t\tvar qrIsPublic bool\n\t\tif o.IsPublic != nil {\n\t\t\tqrIsPublic = *o.IsPublic\n\t\t}\n\t\tqIsPublic := swag.FormatBool(qrIsPublic)\n\t\tif qIsPublic != \"\" {\n\t\t\tif err := r.SetQueryParam(\"isPublic\", qIsPublic); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.PageSize != nil {\n\n\t\t// query param pageSize\n\t\tvar qrPageSize int32\n\t\tif o.PageSize != nil {\n\t\t\tqrPageSize = *o.PageSize\n\t\t}\n\t\tqPageSize := swag.FormatInt32(qrPageSize)\n\t\tif qPageSize != \"\" {\n\t\t\tif err := r.SetQueryParam(\"pageSize\", qPageSize); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// path param subjectDescriptor\n\tif err := r.SetPathParam(\"subjectDescriptor\", o.SubjectDescriptor); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "adae7819fa0736cf2fdf08e66b344313", "score": "0.7015827", "text": "func (o *APIServiceBlockParams) 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\tvaluesFields := o.Fields\n\n\tjoinedFields := swag.JoinByFormat(valuesFields, \"multi\")\n\t// query array param fields\n\tif err := r.SetQueryParam(\"fields\", joinedFields...); err != nil {\n\t\treturn err\n\t}\n\n\t// path param height\n\tif err := r.SetPathParam(\"height\", o.Height); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "01d54c99ccc2558bcc51c008df76568a", "score": "0.7005215", "text": "func (o *GetBancorInfoParams) 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\t// path param symbol\n\tif err := r.SetPathParam(\"symbol\", o.Symbol); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9729142fb6847b60277f5581d16aef86", "score": "0.7001334", "text": "func (o *VscanGetParams) 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.Fields != nil {\n\n\t\t// binding items for fields\n\t\tjoinedFields := o.bindParamFields(reg)\n\n\t\t// query array param fields\n\t\tif err := r.SetQueryParam(\"fields\", joinedFields...); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param svm.uuid\n\tif err := r.SetPathParam(\"svm.uuid\", o.SvmUUID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "864d0c8a50f493bd246d32bdb067eff3", "score": "0.6985303", "text": "func (o *GetCwfParams) 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 len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "55a82706f7dce98ada9a0396ebcfb873", "score": "0.6954727", "text": "func (o *RouteGetByParamsParams) 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\tif o.Req != nil {\n\t\tif err := r.SetBodyParam(o.Req); 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": "541406ff393e6bac5ad80da363223325", "score": "0.69518435", "text": "func (o *PutCustomFieldsParams) 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.BulkFields != nil {\n\n\t\t// form param bulk_fields\n\t\tvar frBulkFields string\n\t\tif o.BulkFields != nil {\n\t\t\tfrBulkFields = *o.BulkFields\n\t\t}\n\t\tfBulkFields := frBulkFields\n\t\tif fBulkFields != \"\" {\n\t\t\tif err := r.SetFormParam(\"bulk_fields\", fBulkFields); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.ClearValue != nil {\n\n\t\t// form param clear_value\n\t\tvar frClearValue string\n\t\tif o.ClearValue != nil {\n\t\t\tfrClearValue = *o.ClearValue\n\t\t}\n\t\tfClearValue := frClearValue\n\t\tif fClearValue != \"\" {\n\t\t\tif err := r.SetFormParam(\"clear_value\", fClearValue); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// form param key\n\tfrKey := o.Key\n\tfKey := frKey\n\tif fKey != \"\" {\n\t\tif err := r.SetFormParam(\"key\", fKey); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// form param name\n\tfrName := o.Name\n\tfName := frName\n\tif fName != \"\" {\n\t\tif err := r.SetFormParam(\"name\", fName); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.Notes != nil {\n\n\t\t// form param notes\n\t\tvar frNotes string\n\t\tif o.Notes != nil {\n\t\t\tfrNotes = *o.Notes\n\t\t}\n\t\tfNotes := frNotes\n\t\tif fNotes != \"\" {\n\t\t\tif err := r.SetFormParam(\"notes\", fNotes); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.RelatedFieldName != nil {\n\n\t\t// form param related_field_name\n\t\tvar frRelatedFieldName string\n\t\tif o.RelatedFieldName != nil {\n\t\t\tfrRelatedFieldName = *o.RelatedFieldName\n\t\t}\n\t\tfRelatedFieldName := frRelatedFieldName\n\t\tif fRelatedFieldName != \"\" {\n\t\t\tif err := r.SetFormParam(\"related_field_name\", fRelatedFieldName); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Type != nil {\n\n\t\t// form param type\n\t\tvar frType string\n\t\tif o.Type != nil {\n\t\t\tfrType = *o.Type\n\t\t}\n\t\tfType := frType\n\t\tif fType != \"\" {\n\t\t\tif err := r.SetFormParam(\"type\", fType); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Value != nil {\n\n\t\t// form param value\n\t\tvar frValue string\n\t\tif o.Value != nil {\n\t\t\tfrValue = *o.Value\n\t\t}\n\t\tfValue := frValue\n\t\tif fValue != \"\" {\n\t\t\tif err := r.SetFormParam(\"value\", fValue); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8433a9870f71279b27dff1cf21d3ef6e", "score": "0.6950149", "text": "func (o *DeleteAPIParams) 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\t// path param api\n\tif err := r.SetPathParam(\"api\", o.APIID); err != nil {\n\t\treturn err\n\t}\n\n\t// path param tid\n\tif err := r.SetPathParam(\"tid\", o.Tid); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b7d6260943c0e8e1a4b41a2cfb278d7d", "score": "0.6936926", "text": "func (o *GetAPIFeaturesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tr.SetTimeout(o.timeout)\n\tvar res []error\n\n\tif o.Limit != nil {\n\n\t\t// query param limit\n\t\tvar qrLimit int64\n\t\tif o.Limit != nil {\n\t\t\tqrLimit = *o.Limit\n\t\t}\n\t\tqLimit := swag.FormatInt64(qrLimit)\n\t\tif qLimit != \"\" {\n\t\t\tif err := r.SetQueryParam(\"limit\", qLimit); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tvaluesNames := o.Names\n\n\tjoinedNames := swag.JoinByFormat(valuesNames, \"\")\n\t// query array param names\n\tif err := r.SetQueryParam(\"names\", joinedNames...); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Offset != nil {\n\n\t\t// query param offset\n\t\tvar qrOffset int64\n\t\tif o.Offset != nil {\n\t\t\tqrOffset = *o.Offset\n\t\t}\n\t\tqOffset := swag.FormatInt64(qrOffset)\n\t\tif qOffset != \"\" {\n\t\t\tif err := r.SetQueryParam(\"offset\", qOffset); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "052fad6a44c1854fcf69bd9b8d0b2998", "score": "0.69213337", "text": "func (o *AddWaterLogParams) 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\t// query param amount\n\tqrAmount := o.Amount\n\tqAmount := swag.FormatInt64(qrAmount)\n\tif qAmount != \"\" {\n\t\tif err := r.SetQueryParam(\"amount\", qAmount); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// query param date\n\tqrDate := o.Date\n\tqDate := qrDate.String()\n\tif qDate != \"\" {\n\t\tif err := r.SetQueryParam(\"date\", qDate); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.Unit != nil {\n\n\t\t// query param unit\n\t\tvar qrUnit string\n\t\tif o.Unit != nil {\n\t\t\tqrUnit = *o.Unit\n\t\t}\n\t\tqUnit := qrUnit\n\t\tif qUnit != \"\" {\n\t\t\tif err := r.SetQueryParam(\"unit\", qUnit); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "14e281af5913e9cb365b63106373d2e7", "score": "0.69174767", "text": "func (o *ListServicesParams) 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.Limit != nil {\n\n\t\t// query param limit\n\t\tvar qrLimit int64\n\t\tif o.Limit != nil {\n\t\t\tqrLimit = *o.Limit\n\t\t}\n\t\tqLimit := swag.FormatInt64(qrLimit)\n\t\tif qLimit != \"\" {\n\t\t\tif err := r.SetQueryParam(\"limit\", qLimit); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Offset != nil {\n\n\t\t// query param offset\n\t\tvar qrOffset int64\n\t\tif o.Offset != nil {\n\t\t\tqrOffset = *o.Offset\n\t\t}\n\t\tqOffset := swag.FormatInt64(qrOffset)\n\t\tif qOffset != \"\" {\n\t\t\tif err := r.SetQueryParam(\"offset\", qOffset); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// path param organization\n\tif err := r.SetPathParam(\"organization\", o.Organization); err != nil {\n\t\treturn err\n\t}\n\n\t// path param project\n\tif err := r.SetPathParam(\"project\", o.Project); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "53da9ba15853f976ca3cb0344cd547db", "score": "0.6915877", "text": "func (o *CreateanewPbxDeviceParams) 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.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// header param Content-Type\n\tif err := r.SetHeaderParam(\"Content-Type\", o.ContentType); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "275197dea7360b92add55500e0e42e49", "score": "0.6914226", "text": "func (o *SetActionParams) 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.JSONBody != nil {\n\t\tif err := r.SetBodyParam(o.JSONBody); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param collectorId\n\tif err := r.SetPathParam(\"collectorId\", o.CollectorID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f83bbb67735987b7244093902727aa8d", "score": "0.6913859", "text": "func (o *ServeChangesParams) 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.Build != nil {\n\n\t\t// query param build\n\t\tvar qrBuild string\n\t\tif o.Build != nil {\n\t\t\tqrBuild = *o.Build\n\t\t}\n\t\tqBuild := qrBuild\n\t\tif qBuild != \"\" {\n\t\t\tif err := r.SetQueryParam(\"build\", qBuild); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.BuildType != nil {\n\n\t\t// query param buildType\n\t\tvar qrBuildType string\n\t\tif o.BuildType != nil {\n\t\t\tqrBuildType = *o.BuildType\n\t\t}\n\t\tqBuildType := qrBuildType\n\t\tif qBuildType != \"\" {\n\t\t\tif err := r.SetQueryParam(\"buildType\", qBuildType); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Count != nil {\n\n\t\t// query param count\n\t\tvar qrCount int32\n\t\tif o.Count != nil {\n\t\t\tqrCount = *o.Count\n\t\t}\n\t\tqCount := swag.FormatInt32(qrCount)\n\t\tif qCount != \"\" {\n\t\t\tif err := r.SetQueryParam(\"count\", qCount); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Fields != nil {\n\n\t\t// query param fields\n\t\tvar qrFields string\n\t\tif o.Fields != nil {\n\t\t\tqrFields = *o.Fields\n\t\t}\n\t\tqFields := qrFields\n\t\tif qFields != \"\" {\n\t\t\tif err := r.SetQueryParam(\"fields\", qFields); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Locator != nil {\n\n\t\t// query param locator\n\t\tvar qrLocator string\n\t\tif o.Locator != nil {\n\t\t\tqrLocator = *o.Locator\n\t\t}\n\t\tqLocator := qrLocator\n\t\tif qLocator != \"\" {\n\t\t\tif err := r.SetQueryParam(\"locator\", qLocator); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Project != nil {\n\n\t\t// query param project\n\t\tvar qrProject string\n\t\tif o.Project != nil {\n\t\t\tqrProject = *o.Project\n\t\t}\n\t\tqProject := qrProject\n\t\tif qProject != \"\" {\n\t\t\tif err := r.SetQueryParam(\"project\", qProject); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.SinceChange != nil {\n\n\t\t// query param sinceChange\n\t\tvar qrSinceChange string\n\t\tif o.SinceChange != nil {\n\t\t\tqrSinceChange = *o.SinceChange\n\t\t}\n\t\tqSinceChange := qrSinceChange\n\t\tif qSinceChange != \"\" {\n\t\t\tif err := r.SetQueryParam(\"sinceChange\", qSinceChange); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Start != nil {\n\n\t\t// query param start\n\t\tvar qrStart int64\n\t\tif o.Start != nil {\n\t\t\tqrStart = *o.Start\n\t\t}\n\t\tqStart := swag.FormatInt64(qrStart)\n\t\tif qStart != \"\" {\n\t\t\tif err := r.SetQueryParam(\"start\", qStart); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.VcsRoot != nil {\n\n\t\t// query param vcsRoot\n\t\tvar qrVcsRoot string\n\t\tif o.VcsRoot != nil {\n\t\t\tqrVcsRoot = *o.VcsRoot\n\t\t}\n\t\tqVcsRoot := qrVcsRoot\n\t\tif qVcsRoot != \"\" {\n\t\t\tif err := r.SetQueryParam(\"vcsRoot\", qVcsRoot); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "16342355ecd2a737994236309f05526b", "score": "0.69069576", "text": "func (o *DescribeKeyPairsParams) 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.Description != nil {\n\n\t\t// query param description\n\t\tvar qrDescription string\n\t\tif o.Description != nil {\n\t\t\tqrDescription = *o.Description\n\t\t}\n\t\tqDescription := qrDescription\n\t\tif qDescription != \"\" {\n\t\t\tif err := r.SetQueryParam(\"description\", qDescription); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.KeyPairID != nil {\n\n\t\t// query param key_pair_id\n\t\tvar qrKeyPairID string\n\t\tif o.KeyPairID != nil {\n\t\t\tqrKeyPairID = *o.KeyPairID\n\t\t}\n\t\tqKeyPairID := qrKeyPairID\n\t\tif qKeyPairID != \"\" {\n\t\t\tif err := r.SetQueryParam(\"key_pair_id\", qKeyPairID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Limit != nil {\n\n\t\t// query param limit\n\t\tvar qrLimit int64\n\t\tif o.Limit != nil {\n\t\t\tqrLimit = *o.Limit\n\t\t}\n\t\tqLimit := swag.FormatInt64(qrLimit)\n\t\tif qLimit != \"\" {\n\t\t\tif err := r.SetQueryParam(\"limit\", qLimit); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Name != nil {\n\n\t\t// query param name\n\t\tvar qrName string\n\t\tif o.Name != nil {\n\t\t\tqrName = *o.Name\n\t\t}\n\t\tqName := qrName\n\t\tif qName != \"\" {\n\t\t\tif err := r.SetQueryParam(\"name\", qName); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Offset != nil {\n\n\t\t// query param offset\n\t\tvar qrOffset int64\n\t\tif o.Offset != nil {\n\t\t\tqrOffset = *o.Offset\n\t\t}\n\t\tqOffset := swag.FormatInt64(qrOffset)\n\t\tif qOffset != \"\" {\n\t\t\tif err := r.SetQueryParam(\"offset\", qOffset); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tvaluesOwner := o.Owner\n\n\tjoinedOwner := swag.JoinByFormat(valuesOwner, \"multi\")\n\t// query array param owner\n\tif err := r.SetQueryParam(\"owner\", joinedOwner...); err != nil {\n\t\treturn err\n\t}\n\n\tif o.PubKey != nil {\n\n\t\t// query param pub_key\n\t\tvar qrPubKey string\n\t\tif o.PubKey != nil {\n\t\t\tqrPubKey = *o.PubKey\n\t\t}\n\t\tqPubKey := qrPubKey\n\t\tif qPubKey != \"\" {\n\t\t\tif err := r.SetQueryParam(\"pub_key\", qPubKey); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.SearchWord != nil {\n\n\t\t// query param search_word\n\t\tvar qrSearchWord string\n\t\tif o.SearchWord != nil {\n\t\t\tqrSearchWord = *o.SearchWord\n\t\t}\n\t\tqSearchWord := qrSearchWord\n\t\tif qSearchWord != \"\" {\n\t\t\tif err := r.SetQueryParam(\"search_word\", qSearchWord); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "54be5cc7e03f3d3636f2c3d5ff5af80b", "score": "0.68933755", "text": "func (o *GetCDNIpsParams) 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.Filter != nil {\n\n\t\t// query param filter\n\t\tvar qrFilter string\n\t\tif o.Filter != nil {\n\t\t\tqrFilter = *o.Filter\n\t\t}\n\t\tqFilter := qrFilter\n\t\tif qFilter != \"\" {\n\t\t\tif err := r.SetQueryParam(\"filter\", qFilter); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.ResponseType != nil {\n\n\t\t// query param response_type\n\t\tvar qrResponseType string\n\t\tif o.ResponseType != nil {\n\t\t\tqrResponseType = *o.ResponseType\n\t\t}\n\t\tqResponseType := qrResponseType\n\t\tif qResponseType != \"\" {\n\t\t\tif err := r.SetQueryParam(\"response_type\", qResponseType); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d32d6e0667c3b0f982ed936bd5f1b916", "score": "0.6889142", "text": "func (o *FpolicyCreateParams) 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\tif o.Info != nil {\n\t\tif err := r.SetBodyParam(o.Info); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.ReturnRecords != nil {\n\n\t\t// query param return_records\n\t\tvar qrReturnRecords bool\n\n\t\tif o.ReturnRecords != nil {\n\t\t\tqrReturnRecords = *o.ReturnRecords\n\t\t}\n\t\tqReturnRecords := swag.FormatBool(qrReturnRecords)\n\t\tif qReturnRecords != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"return_records\", qReturnRecords); err != nil {\n\t\t\t\treturn err\n\t\t\t}\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": "9372ea57f2d8185f321076ad392de6f6", "score": "0.6869864", "text": "func (o *PushGatewayRequestsParams) 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.GatewayRequestEvents != nil {\n\t\tif err := r.SetBodyParam(o.GatewayRequestEvents); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.AuthorizerVersion != nil {\n\n\t\t// query param authorizer_version\n\t\tvar qrAuthorizerVersion string\n\t\tif o.AuthorizerVersion != nil {\n\t\t\tqrAuthorizerVersion = *o.AuthorizerVersion\n\t\t}\n\t\tqAuthorizerVersion := qrAuthorizerVersion\n\t\tif qAuthorizerVersion != \"\" {\n\t\t\tif err := r.SetQueryParam(\"authorizer_version\", qAuthorizerVersion); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// path param tid\n\tif err := r.SetPathParam(\"tid\", o.Tid); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fca9e0a36f047f0f91cfceafd6f9a59f", "score": "0.6869233", "text": "func (o *GetVlansParams) 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.ContentLanguage != nil {\n\n\t\t// header param content-language\n\t\tif err := r.SetHeaderParam(\"content-language\", *o.ContentLanguage); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif o.RequestBody != nil {\n\t\tif err := r.SetBodyParam(o.RequestBody); 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": "4fb8eb7340cbd1d0e5331f27090c59b4", "score": "0.68680143", "text": "func (o *GetPacketAnalyzerParams) 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\t// path param id\n\tif err := r.SetPathParam(\"id\", o.ID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9c7213744ff4f08f2910c20df211fc55", "score": "0.686303", "text": "func (o *GetPaymentsParams) 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.Length != nil {\n\n\t\t// query param length\n\t\tvar qrLength int64\n\t\tif o.Length != nil {\n\t\t\tqrLength = *o.Length\n\t\t}\n\t\tqLength := swag.FormatInt64(qrLength)\n\t\tif qLength != \"\" {\n\t\t\tif err := r.SetQueryParam(\"length\", qLength); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Offset != nil {\n\n\t\t// query param offset\n\t\tvar qrOffset int64\n\t\tif o.Offset != nil {\n\t\t\tqrOffset = *o.Offset\n\t\t}\n\t\tqOffset := swag.FormatInt64(qrOffset)\n\t\tif qOffset != \"\" {\n\t\t\tif err := r.SetQueryParam(\"offset\", qOffset); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6aa364e19e3b18a298402b01742cccc5", "score": "0.68611056", "text": "func (o *CreateIOCParams) 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\tif o.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); 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": "49c2608f627cc9bd78cfb0e7c4adb28f", "score": "0.6859794", "text": "func (o *GetaspecificNumberParams) 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\t// path param id\n\tif err := r.SetPathParam(\"id\", o.ID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1c45ffa9186014b16413cf814d7423c0", "score": "0.68515295", "text": "func (o *GetUsingGET1Params) 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\t// header param Authorization\n\tif err := r.SetHeaderParam(\"Authorization\", o.Authorization); err != nil {\n\t\treturn err\n\t}\n\n\t// query param apiVersion\n\tqrAPIVersion := o.APIVersion\n\tqAPIVersion := qrAPIVersion\n\n\tif err := r.SetQueryParam(\"apiVersion\", qAPIVersion); err != nil {\n\t\treturn err\n\t}\n\n\t// path param id\n\tif err := r.SetPathParam(\"id\", o.ID); err != nil {\n\t\treturn err\n\t}\n\n\tif o.QueryParams != nil {\n\n\t\t// binding items for queryParams\n\t\tjoinedQueryParams := o.bindParamQueryParams(reg)\n\n\t\t// query array param queryParams\n\t\tif err := r.SetQueryParam(\"queryParams\", joinedQueryParams...); 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": "faba4803bfc3c66e35aeef5b439f951d", "score": "0.6839328", "text": "func (o *GetPolicyParams) 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\tif o.Labels != nil {\n\t\tif err := r.SetBodyParam(o.Labels); 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": "d3bd98f1ea270a312d855de6a18cc361", "score": "0.6836879", "text": "func (o *ListParams) 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\t// query param api-version\n\tqrAPIVersion := o.APIVersion\n\tqAPIVersion := qrAPIVersion\n\tif qAPIVersion != \"\" {\n\t\tif err := r.SetQueryParam(\"api-version\", qAPIVersion); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.AssetTypes != nil {\n\n\t\t// query param assetTypes\n\t\tvar qrAssetTypes string\n\t\tif o.AssetTypes != nil {\n\t\t\tqrAssetTypes = *o.AssetTypes\n\t\t}\n\t\tqAssetTypes := qrAssetTypes\n\t\tif qAssetTypes != \"\" {\n\t\t\tif err := r.SetQueryParam(\"assetTypes\", qAssetTypes); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.IncludeDisabledExtensions != nil {\n\n\t\t// query param includeDisabledExtensions\n\t\tvar qrIncludeDisabledExtensions bool\n\t\tif o.IncludeDisabledExtensions != nil {\n\t\t\tqrIncludeDisabledExtensions = *o.IncludeDisabledExtensions\n\t\t}\n\t\tqIncludeDisabledExtensions := swag.FormatBool(qrIncludeDisabledExtensions)\n\t\tif qIncludeDisabledExtensions != \"\" {\n\t\t\tif err := r.SetQueryParam(\"includeDisabledExtensions\", qIncludeDisabledExtensions); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.IncludeErrors != nil {\n\n\t\t// query param includeErrors\n\t\tvar qrIncludeErrors bool\n\t\tif o.IncludeErrors != nil {\n\t\t\tqrIncludeErrors = *o.IncludeErrors\n\t\t}\n\t\tqIncludeErrors := swag.FormatBool(qrIncludeErrors)\n\t\tif qIncludeErrors != \"\" {\n\t\t\tif err := r.SetQueryParam(\"includeErrors\", qIncludeErrors); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.IncludeInstallationIssues != nil {\n\n\t\t// query param includeInstallationIssues\n\t\tvar qrIncludeInstallationIssues bool\n\t\tif o.IncludeInstallationIssues != nil {\n\t\t\tqrIncludeInstallationIssues = *o.IncludeInstallationIssues\n\t\t}\n\t\tqIncludeInstallationIssues := swag.FormatBool(qrIncludeInstallationIssues)\n\t\tif qIncludeInstallationIssues != \"\" {\n\t\t\tif err := r.SetQueryParam(\"includeInstallationIssues\", qIncludeInstallationIssues); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// path param organization\n\tif err := r.SetPathParam(\"organization\", o.Organization); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "672254ef57e2fb67abdb57f85aed572c", "score": "0.6813312", "text": "func (o *GetResourceActionsUsingGETParams) 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\t// path param depId\n\tif err := r.SetPathParam(\"depId\", o.DepID.String()); err != nil {\n\t\treturn err\n\t}\n\n\t// path param resourceId\n\tif err := r.SetPathParam(\"resourceId\", o.ResourceID.String()); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "66b8b630e3d235ab1b6a525f82a04836", "score": "0.68100166", "text": "func (o *GetStatsParams) 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\t// path param namespace\n\tif err := r.SetPathParam(\"namespace\", o.Namespace); err != nil {\n\t\treturn err\n\t}\n\n\tif o.CycleIds != nil {\n\n\t\t// query param cycleIds\n\t\tvar qrCycleIds string\n\t\tif o.CycleIds != nil {\n\t\t\tqrCycleIds = *o.CycleIds\n\t\t}\n\t\tqCycleIds := qrCycleIds\n\t\tif qCycleIds != \"\" {\n\t\t\tif err := r.SetQueryParam(\"cycleIds\", qCycleIds); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.IsGlobal != nil {\n\n\t\t// query param isGlobal\n\t\tvar qrIsGlobal bool\n\t\tif o.IsGlobal != nil {\n\t\t\tqrIsGlobal = *o.IsGlobal\n\t\t}\n\t\tqIsGlobal := swag.FormatBool(qrIsGlobal)\n\t\tif qIsGlobal != \"\" {\n\t\t\tif err := r.SetQueryParam(\"isGlobal\", qIsGlobal); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.IsPublic != nil {\n\n\t\t// query param isPublic\n\t\tvar qrIsPublic bool\n\t\tif o.IsPublic != nil {\n\t\t\tqrIsPublic = *o.IsPublic\n\t\t}\n\t\tqIsPublic := swag.FormatBool(qrIsPublic)\n\t\tif qIsPublic != \"\" {\n\t\t\tif err := r.SetQueryParam(\"isPublic\", qIsPublic); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Limit != nil {\n\n\t\t// query param limit\n\t\tvar qrLimit int32\n\t\tif o.Limit != nil {\n\t\t\tqrLimit = *o.Limit\n\t\t}\n\t\tqLimit := swag.FormatInt32(qrLimit)\n\t\tif qLimit != \"\" {\n\t\t\tif err := r.SetQueryParam(\"limit\", qLimit); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Offset != nil {\n\n\t\t// query param offset\n\t\tvar qrOffset int32\n\t\tif o.Offset != nil {\n\t\t\tqrOffset = *o.Offset\n\t\t}\n\t\tqOffset := swag.FormatInt32(qrOffset)\n\t\tif qOffset != \"\" {\n\t\t\tif err := r.SetQueryParam(\"offset\", qOffset); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// setting the default header value\n\tif err := r.SetHeaderParam(\"User-Agent\", utils.UserAgentGen()); err != nil {\n\t\treturn err\n\t}\n\n\tif err := r.SetHeaderParam(\"X-Amzn-Trace-Id\", utils.AmazonTraceIDGen()); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "12d956d09db75880d841fd22b32a0d06", "score": "0.6808097", "text": "func (o *EndpointsDiscoveryParams) 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.EndpointType != nil {\n\n\t\t// query param EndpointType\n\t\tvar qrEndpointType string\n\n\t\tif o.EndpointType != nil {\n\t\t\tqrEndpointType = *o.EndpointType\n\t\t}\n\t\tqEndpointType := qrEndpointType\n\t\tif qEndpointType != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"EndpointType\", qEndpointType); err != nil {\n\t\t\t\treturn err\n\t\t\t}\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": "dbae8dd76545e1497214d68751ec69e3", "score": "0.6802178", "text": "func (o *GetCheckMetricDataParams) 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.From != nil {\n\n\t\t// query param from\n\t\tvar qrFrom strfmt.DateTime\n\n\t\tif o.From != nil {\n\t\t\tqrFrom = *o.From\n\t\t}\n\t\tqFrom := qrFrom.String()\n\t\tif qFrom != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"from\", qFrom); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// path param id\n\tif err := r.SetPathParam(\"id\", swag.FormatInt32(o.ID)); err != nil {\n\t\treturn err\n\t}\n\n\tif o.IncludeSummary != nil {\n\n\t\t// query param include_summary\n\t\tvar qrIncludeSummary bool\n\n\t\tif o.IncludeSummary != nil {\n\t\t\tqrIncludeSummary = *o.IncludeSummary\n\t\t}\n\t\tqIncludeSummary := swag.FormatBool(qrIncludeSummary)\n\t\tif qIncludeSummary != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"include_summary\", qIncludeSummary); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Locations != nil {\n\n\t\t// binding items for locations\n\t\tjoinedLocations := o.bindParamLocations(reg)\n\n\t\t// query array param locations\n\t\tif err := r.SetQueryParam(\"locations\", joinedLocations...); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.Names != nil {\n\n\t\t// binding items for names\n\t\tjoinedNames := o.bindParamNames(reg)\n\n\t\t// query array param names\n\t\tif err := r.SetQueryParam(\"names\", joinedNames...); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.Range != nil {\n\n\t\t// query param range\n\t\tvar qrRange string\n\n\t\tif o.Range != nil {\n\t\t\tqrRange = *o.Range\n\t\t}\n\t\tqRange := qrRange\n\t\tif qRange != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"range\", qRange); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.To != nil {\n\n\t\t// query param to\n\t\tvar qrTo strfmt.DateTime\n\n\t\tif o.To != nil {\n\t\t\tqrTo = *o.To\n\t\t}\n\t\tqTo := qrTo.String()\n\t\tif qTo != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"to\", qTo); err != nil {\n\t\t\t\treturn err\n\t\t\t}\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": "11e03c631f3685120415fc778de6d38f", "score": "0.67930764", "text": "func (o *CreateCustomPropertyForDeviceParams) 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\t// path param deviceId\n\tif err := r.SetPathParam(\"deviceId\", o.DeviceID); err != nil {\n\t\treturn err\n\t}\n\n\tif err := r.SetBodyParam(o.Request); err != nil {\n\t\treturn err\n\t}\n\n\t// path param tenantId\n\tif err := r.SetPathParam(\"tenantId\", o.TenantID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a22757fdb49ee63f26fccc4b8b74e454", "score": "0.6786152", "text": "func (o *AcceptBackfillParams) 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.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param backfillID\n\tif err := r.SetPathParam(\"backfillID\", o.BackfillID); err != nil {\n\t\treturn err\n\t}\n\n\t// path param namespace\n\tif err := r.SetPathParam(\"namespace\", o.Namespace); err != nil {\n\t\treturn err\n\t}\n\n\t// setting the default header value\n\tif err := r.SetHeaderParam(\"User-Agent\", utils.UserAgentGen()); err != nil {\n\t\treturn err\n\t}\n\n\tif err := r.SetHeaderParam(\"X-Amzn-Trace-Id\", utils.AmazonTraceIDGen()); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ad230d1e4dc87a6bcff4f70b4a2e7c49", "score": "0.6779427", "text": "func (o *GetPublicGetInstrumentsParams) 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\t// query param currency\n\tqrCurrency := o.Currency\n\tqCurrency := qrCurrency\n\tif qCurrency != \"\" {\n\t\tif err := r.SetQueryParam(\"currency\", qCurrency); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.Expired != nil {\n\n\t\t// query param expired\n\t\tvar qrExpired bool\n\t\tif o.Expired != nil {\n\t\t\tqrExpired = *o.Expired\n\t\t}\n\t\tqExpired := swag.FormatBool(qrExpired)\n\t\tif qExpired != \"\" {\n\t\t\tif err := r.SetQueryParam(\"expired\", qExpired); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Kind != nil {\n\n\t\t// query param kind\n\t\tvar qrKind string\n\t\tif o.Kind != nil {\n\t\t\tqrKind = *o.Kind\n\t\t}\n\t\tqKind := qrKind\n\t\tif qKind != \"\" {\n\t\t\tif err := r.SetQueryParam(\"kind\", qKind); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7852b5a12a3052e62e2fe03de63c42f9", "score": "0.6779053", "text": "func (o *WorkflowsGetByInstanceIDParams) 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\t// path param identifier\n\tif err := r.SetPathParam(\"identifier\", o.Identifier); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0c7f164d995cf67ebcd7eb66624efe8f", "score": "0.6773946", "text": "func (o *AllocateSpecificIPParams) 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\tif o.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param ip\n\tif err := r.SetPathParam(\"ip\", o.IP); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "47b6fec5016971cb2b85d6be999f1ae2", "score": "0.6768589", "text": "func (o *ListAccessPointsParams) 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.Versions != nil {\n\n\t\t// query param versions\n\t\tvar qrVersions bool\n\t\tif o.Versions != nil {\n\t\t\tqrVersions = *o.Versions\n\t\t}\n\t\tqVersions := swag.FormatBool(qrVersions)\n\t\tif qVersions != \"\" {\n\t\t\tif err := r.SetQueryParam(\"versions\", qVersions); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "027c5fdff9bff04d1636dcdd341fe04f", "score": "0.6766278", "text": "func (o *AutoUpdateConfigurationCollectionGetParams) 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.Action != nil {\n\n\t\t// query param action\n\t\tvar qrAction string\n\n\t\tif o.Action != nil {\n\t\t\tqrAction = *o.Action\n\t\t}\n\t\tqAction := qrAction\n\t\tif qAction != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"action\", qAction); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Category != nil {\n\n\t\t// query param category\n\t\tvar qrCategory string\n\n\t\tif o.Category != nil {\n\t\t\tqrCategory = *o.Category\n\t\t}\n\t\tqCategory := qrCategory\n\t\tif qCategory != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"category\", qCategory); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.DescriptionCode != nil {\n\n\t\t// query param description.code\n\t\tvar qrDescriptionCode string\n\n\t\tif o.DescriptionCode != nil {\n\t\t\tqrDescriptionCode = *o.DescriptionCode\n\t\t}\n\t\tqDescriptionCode := qrDescriptionCode\n\t\tif qDescriptionCode != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"description.code\", qDescriptionCode); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.DescriptionMessage != nil {\n\n\t\t// query param description.message\n\t\tvar qrDescriptionMessage string\n\n\t\tif o.DescriptionMessage != nil {\n\t\t\tqrDescriptionMessage = *o.DescriptionMessage\n\t\t}\n\t\tqDescriptionMessage := qrDescriptionMessage\n\t\tif qDescriptionMessage != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"description.message\", qDescriptionMessage); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Fields != nil {\n\n\t\t// binding items for fields\n\t\tjoinedFields := o.bindParamFields(reg)\n\n\t\t// query array param fields\n\t\tif err := r.SetQueryParam(\"fields\", joinedFields...); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.MaxRecords != nil {\n\n\t\t// query param max_records\n\t\tvar qrMaxRecords int64\n\n\t\tif o.MaxRecords != nil {\n\t\t\tqrMaxRecords = *o.MaxRecords\n\t\t}\n\t\tqMaxRecords := swag.FormatInt64(qrMaxRecords)\n\t\tif qMaxRecords != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"max_records\", qMaxRecords); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.OrderBy != nil {\n\n\t\t// binding items for order_by\n\t\tjoinedOrderBy := o.bindParamOrderBy(reg)\n\n\t\t// query array param order_by\n\t\tif err := r.SetQueryParam(\"order_by\", joinedOrderBy...); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.ReturnRecords != nil {\n\n\t\t// query param return_records\n\t\tvar qrReturnRecords bool\n\n\t\tif o.ReturnRecords != nil {\n\t\t\tqrReturnRecords = *o.ReturnRecords\n\t\t}\n\t\tqReturnRecords := swag.FormatBool(qrReturnRecords)\n\t\tif qReturnRecords != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"return_records\", qReturnRecords); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.ReturnTimeout != nil {\n\n\t\t// query param return_timeout\n\t\tvar qrReturnTimeout int64\n\n\t\tif o.ReturnTimeout != nil {\n\t\t\tqrReturnTimeout = *o.ReturnTimeout\n\t\t}\n\t\tqReturnTimeout := swag.FormatInt64(qrReturnTimeout)\n\t\tif qReturnTimeout != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"return_timeout\", qReturnTimeout); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.UUID != nil {\n\n\t\t// query param uuid\n\t\tvar qrUUID string\n\n\t\tif o.UUID != nil {\n\t\t\tqrUUID = *o.UUID\n\t\t}\n\t\tqUUID := qrUUID\n\t\tif qUUID != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"uuid\", qUUID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\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": "dd0c729316a3e96e5cde8a1c08f86d4c", "score": "0.6763308", "text": "func (o *CreateIntegrationParams) 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\t// path param id\n\tif err := r.SetPathParam(\"id\", o.ID); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Integration != nil {\n\t\tif err := r.SetBodyParam(o.Integration); 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": "9b8932980d22cc288d9e14c87f686c15", "score": "0.67585343", "text": "func (o *GetWorkItemParams) 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\t// path param ownerId\n\tif err := r.SetPathParam(\"ownerId\", o.OwnerID); err != nil {\n\t\treturn err\n\t}\n\n\t// path param workItemId\n\tif err := r.SetPathParam(\"workItemId\", o.WorkItemID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bdb44b9c0135db6c88a9dadef7950236", "score": "0.6758399", "text": "func (o *MachinePxeParams) 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\tif o.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param id\n\tif err := r.SetPathParam(\"id\", o.ID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8471ecad79f745e34ce2554d21ed69e1", "score": "0.6749656", "text": "func (o *HelloWorldParams) 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 len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6cac5175fdb1a166cfe39dbe585ef24f", "score": "0.674283", "text": "func (o *GetEventsParams) 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.Cache != nil {\n\n\t\t// query param cache\n\t\tvar qrCache strfmt.Base64\n\t\tif o.Cache != nil {\n\t\t\tqrCache = *o.Cache\n\t\t}\n\t\tqCache := qrCache.String()\n\t\tif qCache != \"\" {\n\t\t\tif err := r.SetQueryParam(\"cache\", qCache); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.ContextID != nil {\n\n\t\t// query param context_id\n\t\tvar qrContextID string\n\t\tif o.ContextID != nil {\n\t\t\tqrContextID = *o.ContextID\n\t\t}\n\t\tqContextID := qrContextID\n\t\tif qContextID != \"\" {\n\t\t\tif err := r.SetQueryParam(\"context_id\", qContextID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Count != nil {\n\n\t\t// query param count\n\t\tvar qrCount int32\n\t\tif o.Count != nil {\n\t\t\tqrCount = *o.Count\n\t\t}\n\t\tqCount := swag.FormatInt32(qrCount)\n\t\tif qCount != \"\" {\n\t\t\tif err := r.SetQueryParam(\"count\", qCount); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Index != nil {\n\n\t\t// query param index\n\t\tvar qrIndex int32\n\t\tif o.Index != nil {\n\t\t\tqrIndex = *o.Index\n\t\t}\n\t\tqIndex := swag.FormatInt32(qrIndex)\n\t\tif qIndex != \"\" {\n\t\t\tif err := r.SetQueryParam(\"index\", qIndex); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Keywords != nil {\n\n\t\t// query param keywords\n\t\tvar qrKeywords string\n\t\tif o.Keywords != nil {\n\t\t\tqrKeywords = *o.Keywords\n\t\t}\n\t\tqKeywords := qrKeywords\n\t\tif qKeywords != \"\" {\n\t\t\tif err := r.SetQueryParam(\"keywords\", qKeywords); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Report != nil {\n\n\t\t// query param report\n\t\tvar qrReport string\n\t\tif o.Report != nil {\n\t\t\tqrReport = *o.Report\n\t\t}\n\t\tqReport := qrReport\n\t\tif qReport != \"\" {\n\t\t\tif err := r.SetQueryParam(\"report\", qReport); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Transform != nil {\n\n\t\t// query param transform\n\t\tvar qrTransform string\n\t\tif o.Transform != nil {\n\t\t\tqrTransform = *o.Transform\n\t\t}\n\t\tqTransform := qrTransform\n\t\tif qTransform != \"\" {\n\t\t\tif err := r.SetQueryParam(\"transform\", qTransform); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bdf12cd12db277b97d148c539dfd587f", "score": "0.6738203", "text": "func (o *RevokeParams) 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\t// path param aid\n\tif err := r.SetPathParam(\"aid\", o.Aid); err != nil {\n\t\treturn err\n\t}\n\n\t// path param tid\n\tif err := r.SetPathParam(\"tid\", o.Tid); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Token != nil {\n\n\t\t// form param token\n\t\tvar frToken string\n\t\tif o.Token != nil {\n\t\t\tfrToken = *o.Token\n\t\t}\n\t\tfToken := frToken\n\t\tif fToken != \"\" {\n\t\t\tif err := r.SetFormParam(\"token\", fToken); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d4db7a285e3a223247a22fcc77203922", "score": "0.6734998", "text": "func (o *BurnTokenParams) 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 err := r.SetBodyParam(o.Amount); err != nil {\n\t\treturn err\n\t}\n\n\t// path param symbol\n\tif err := r.SetPathParam(\"symbol\", o.Symbol); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "89ed9588eba925315152b9ec278fad3f", "score": "0.6731431", "text": "func (o *GetAppcompsParams) 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.Device != nil {\n\n\t\t// query param device\n\t\tvar qrDevice string\n\t\tif o.Device != nil {\n\t\t\tqrDevice = *o.Device\n\t\t}\n\t\tqDevice := qrDevice\n\t\tif qDevice != \"\" {\n\t\t\tif err := r.SetQueryParam(\"device\", qDevice); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.DeviceID != nil {\n\n\t\t// query param device_id\n\t\tvar qrDeviceID string\n\t\tif o.DeviceID != nil {\n\t\t\tqrDeviceID = *o.DeviceID\n\t\t}\n\t\tqDeviceID := qrDeviceID\n\t\tif qDeviceID != \"\" {\n\t\t\tif err := r.SetQueryParam(\"device_id\", qDeviceID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0a95f4919feecd47afed5cffbceb08c2", "score": "0.67305315", "text": "func (o *EdgeInfoUpdateParams) 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\t// header param Authorization\n\tif err := r.SetHeaderParam(\"Authorization\", o.Authorization); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param id\n\tif err := r.SetPathParam(\"id\", o.ID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b50031842a3d745c94dd0cbddcf61e84", "score": "0.67287594", "text": "func (o *ConnectPipelinesParams) 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.JSONBody != nil {\n\t\tif err := r.SetBodyParam(o.JSONBody); 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": "141cbb1d2a3eb846d1aa444cd6753032", "score": "0.6726623", "text": "func (o *TagsListParams) 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.Filters != nil {\n\n\t\t// query param filters\n\t\tvar qrFilters string\n\t\tif o.Filters != nil {\n\t\t\tqrFilters = *o.Filters\n\t\t}\n\t\tqFilters := qrFilters\n\t\tif qFilters != \"\" {\n\t\t\tif err := r.SetQueryParam(\"filters\", qFilters); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.ID != nil {\n\n\t\t// query param id\n\t\tvar qrID float64\n\t\tif o.ID != nil {\n\t\t\tqrID = *o.ID\n\t\t}\n\t\tqID := swag.FormatFloat64(qrID)\n\t\tif qID != \"\" {\n\t\t\tif err := r.SetQueryParam(\"id\", qID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.IDIn != nil {\n\n\t\t// query param id__in\n\t\tvar qrIDIn float64\n\t\tif o.IDIn != nil {\n\t\t\tqrIDIn = *o.IDIn\n\t\t}\n\t\tqIDIn := swag.FormatFloat64(qrIDIn)\n\t\tif qIDIn != \"\" {\n\t\t\tif err := r.SetQueryParam(\"id__in\", qIDIn); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Limit != nil {\n\n\t\t// query param limit\n\t\tvar qrLimit int64\n\t\tif o.Limit != nil {\n\t\t\tqrLimit = *o.Limit\n\t\t}\n\t\tqLimit := swag.FormatInt64(qrLimit)\n\t\tif qLimit != \"\" {\n\t\t\tif err := r.SetQueryParam(\"limit\", qLimit); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Name != nil {\n\n\t\t// query param name\n\t\tvar qrName string\n\t\tif o.Name != nil {\n\t\t\tqrName = *o.Name\n\t\t}\n\t\tqName := qrName\n\t\tif qName != \"\" {\n\t\t\tif err := r.SetQueryParam(\"name\", qName); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.NameContains != nil {\n\n\t\t// query param name__contains\n\t\tvar qrNameContains string\n\t\tif o.NameContains != nil {\n\t\t\tqrNameContains = *o.NameContains\n\t\t}\n\t\tqNameContains := qrNameContains\n\t\tif qNameContains != \"\" {\n\t\t\tif err := r.SetQueryParam(\"name__contains\", qNameContains); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.NameIcontains != nil {\n\n\t\t// query param name__icontains\n\t\tvar qrNameIcontains string\n\t\tif o.NameIcontains != nil {\n\t\t\tqrNameIcontains = *o.NameIcontains\n\t\t}\n\t\tqNameIcontains := qrNameIcontains\n\t\tif qNameIcontains != \"\" {\n\t\t\tif err := r.SetQueryParam(\"name__icontains\", qNameIcontains); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.NameStartswith != nil {\n\n\t\t// query param name__startswith\n\t\tvar qrNameStartswith string\n\t\tif o.NameStartswith != nil {\n\t\t\tqrNameStartswith = *o.NameStartswith\n\t\t}\n\t\tqNameStartswith := qrNameStartswith\n\t\tif qNameStartswith != \"\" {\n\t\t\tif err := r.SetQueryParam(\"name__startswith\", qNameStartswith); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Offset != nil {\n\n\t\t// query param offset\n\t\tvar qrOffset int64\n\t\tif o.Offset != nil {\n\t\t\tqrOffset = *o.Offset\n\t\t}\n\t\tqOffset := swag.FormatInt64(qrOffset)\n\t\tif qOffset != \"\" {\n\t\t\tif err := r.SetQueryParam(\"offset\", qOffset); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Ordering != nil {\n\n\t\t// query param ordering\n\t\tvar qrOrdering string\n\t\tif o.Ordering != nil {\n\t\t\tqrOrdering = *o.Ordering\n\t\t}\n\t\tqOrdering := qrOrdering\n\t\tif qOrdering != \"\" {\n\t\t\tif err := r.SetQueryParam(\"ordering\", qOrdering); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Org != nil {\n\n\t\t// query param org\n\t\tvar qrOrg string\n\t\tif o.Org != nil {\n\t\t\tqrOrg = *o.Org\n\t\t}\n\t\tqOrg := qrOrg\n\t\tif qOrg != \"\" {\n\t\t\tif err := r.SetQueryParam(\"org\", qOrg); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.OrgID != nil {\n\n\t\t// query param org_id\n\t\tvar qrOrgID string\n\t\tif o.OrgID != nil {\n\t\t\tqrOrgID = *o.OrgID\n\t\t}\n\t\tqOrgID := qrOrgID\n\t\tif qOrgID != \"\" {\n\t\t\tif err := r.SetQueryParam(\"org_id\", qOrgID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.OrgIDIn != nil {\n\n\t\t// query param org_id__in\n\t\tvar qrOrgIDIn string\n\t\tif o.OrgIDIn != nil {\n\t\t\tqrOrgIDIn = *o.OrgIDIn\n\t\t}\n\t\tqOrgIDIn := qrOrgIDIn\n\t\tif qOrgIDIn != \"\" {\n\t\t\tif err := r.SetQueryParam(\"org_id__in\", qOrgIDIn); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Search != nil {\n\n\t\t// query param search\n\t\tvar qrSearch string\n\t\tif o.Search != nil {\n\t\t\tqrSearch = *o.Search\n\t\t}\n\t\tqSearch := qrSearch\n\t\tif qSearch != \"\" {\n\t\t\tif err := r.SetQueryParam(\"search\", qSearch); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "91e06a67a399f56be5cb40a572d85849", "score": "0.6725066", "text": "func (o *ExtrasCustomFieldsListParams) 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.ContentTypes != nil {\n\n\t\t// query param content_types\n\t\tvar qrContentTypes string\n\n\t\tif o.ContentTypes != nil {\n\t\t\tqrContentTypes = *o.ContentTypes\n\t\t}\n\t\tqContentTypes := qrContentTypes\n\t\tif qContentTypes != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"content_types\", qContentTypes); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.FilterLogic != nil {\n\n\t\t// query param filter_logic\n\t\tvar qrFilterLogic string\n\n\t\tif o.FilterLogic != nil {\n\t\t\tqrFilterLogic = *o.FilterLogic\n\t\t}\n\t\tqFilterLogic := qrFilterLogic\n\t\tif qFilterLogic != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"filter_logic\", qFilterLogic); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.ID != nil {\n\n\t\t// query param id\n\t\tvar qrID float64\n\n\t\tif o.ID != nil {\n\t\t\tqrID = *o.ID\n\t\t}\n\t\tqID := swag.FormatFloat64(qrID)\n\t\tif qID != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"id\", qID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Limit != nil {\n\n\t\t// query param limit\n\t\tvar qrLimit int64\n\n\t\tif o.Limit != nil {\n\t\t\tqrLimit = *o.Limit\n\t\t}\n\t\tqLimit := swag.FormatInt64(qrLimit)\n\t\tif qLimit != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"limit\", qLimit); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Name != nil {\n\n\t\t// query param name\n\t\tvar qrName string\n\n\t\tif o.Name != nil {\n\t\t\tqrName = *o.Name\n\t\t}\n\t\tqName := qrName\n\t\tif qName != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"name\", qName); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Offset != nil {\n\n\t\t// query param offset\n\t\tvar qrOffset int64\n\n\t\tif o.Offset != nil {\n\t\t\tqrOffset = *o.Offset\n\t\t}\n\t\tqOffset := swag.FormatInt64(qrOffset)\n\t\tif qOffset != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"offset\", qOffset); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Required != nil {\n\n\t\t// query param required\n\t\tvar qrRequired string\n\n\t\tif o.Required != nil {\n\t\t\tqrRequired = *o.Required\n\t\t}\n\t\tqRequired := qrRequired\n\t\tif qRequired != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"required\", qRequired); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Weight != nil {\n\n\t\t// query param weight\n\t\tvar qrWeight float64\n\n\t\tif o.Weight != nil {\n\t\t\tqrWeight = *o.Weight\n\t\t}\n\t\tqWeight := swag.FormatFloat64(qrWeight)\n\t\tif qWeight != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"weight\", qWeight); err != nil {\n\t\t\t\treturn err\n\t\t\t}\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": "69cac8b43ec57264d4518088fb113cd3", "score": "0.6723039", "text": "func (o *PostKeysKeyParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tr.SetTimeout(o.timeout)\n\tvar res []error\n\n\t// path param key\n\tif err := r.SetPathParam(\"key\", o.Key); err != nil {\n\t\treturn err\n\t}\n\n\t// query param value\n\tqrValue := o.Value\n\tqValue := qrValue\n\tif qValue != \"\" {\n\t\tif err := r.SetQueryParam(\"value\", qValue); 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": "41c94cce296b15e5fad37b1e053862c0", "score": "0.672233", "text": "func (o *MultiAdminVerifyRequestModifyParams) 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\t// path param index\n\tif err := r.SetPathParam(\"index\", o.Index); err != nil {\n\t\treturn err\n\t}\n\tif o.Info != nil {\n\t\tif err := r.SetBodyParam(o.Info); 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": "649d2b43b93c30aec7936957ab5ed9ff", "score": "0.67199224", "text": "func (o *APIKeyEnableParams) 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\t// form param apiKeyID\n\tfrAPIKeyID := o.APIKeyID\n\tfAPIKeyID := frAPIKeyID\n\tif fAPIKeyID != \"\" {\n\t\tif err := r.SetFormParam(\"apiKeyID\", fAPIKeyID); 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": "2e39ed588133b6aa9da6c7545e755559", "score": "0.67179656", "text": "func (o *ServeBuildsParams) 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.AgentName != nil {\n\n\t\t// query param agentName\n\t\tvar qrAgentName string\n\t\tif o.AgentName != nil {\n\t\t\tqrAgentName = *o.AgentName\n\t\t}\n\t\tqAgentName := qrAgentName\n\t\tif qAgentName != \"\" {\n\t\t\tif err := r.SetQueryParam(\"agentName\", qAgentName); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// path param btLocator\n\tif err := r.SetPathParam(\"btLocator\", o.BtLocator); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Count != nil {\n\n\t\t// query param count\n\t\tvar qrCount int32\n\t\tif o.Count != nil {\n\t\t\tqrCount = *o.Count\n\t\t}\n\t\tqCount := swag.FormatInt32(qrCount)\n\t\tif qCount != \"\" {\n\t\t\tif err := r.SetQueryParam(\"count\", qCount); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Fields != nil {\n\n\t\t// query param fields\n\t\tvar qrFields string\n\t\tif o.Fields != nil {\n\t\t\tqrFields = *o.Fields\n\t\t}\n\t\tqFields := qrFields\n\t\tif qFields != \"\" {\n\t\t\tif err := r.SetQueryParam(\"fields\", qFields); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.IncludeCanceled != nil {\n\n\t\t// query param includeCanceled\n\t\tvar qrIncludeCanceled bool\n\t\tif o.IncludeCanceled != nil {\n\t\t\tqrIncludeCanceled = *o.IncludeCanceled\n\t\t}\n\t\tqIncludeCanceled := swag.FormatBool(qrIncludeCanceled)\n\t\tif qIncludeCanceled != \"\" {\n\t\t\tif err := r.SetQueryParam(\"includeCanceled\", qIncludeCanceled); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.IncludePersonal != nil {\n\n\t\t// query param includePersonal\n\t\tvar qrIncludePersonal bool\n\t\tif o.IncludePersonal != nil {\n\t\t\tqrIncludePersonal = *o.IncludePersonal\n\t\t}\n\t\tqIncludePersonal := swag.FormatBool(qrIncludePersonal)\n\t\tif qIncludePersonal != \"\" {\n\t\t\tif err := r.SetQueryParam(\"includePersonal\", qIncludePersonal); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Locator != nil {\n\n\t\t// query param locator\n\t\tvar qrLocator string\n\t\tif o.Locator != nil {\n\t\t\tqrLocator = *o.Locator\n\t\t}\n\t\tqLocator := qrLocator\n\t\tif qLocator != \"\" {\n\t\t\tif err := r.SetQueryParam(\"locator\", qLocator); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.OnlyPinned != nil {\n\n\t\t// query param onlyPinned\n\t\tvar qrOnlyPinned bool\n\t\tif o.OnlyPinned != nil {\n\t\t\tqrOnlyPinned = *o.OnlyPinned\n\t\t}\n\t\tqOnlyPinned := swag.FormatBool(qrOnlyPinned)\n\t\tif qOnlyPinned != \"\" {\n\t\t\tif err := r.SetQueryParam(\"onlyPinned\", qOnlyPinned); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// path param projectLocator\n\tif err := r.SetPathParam(\"projectLocator\", o.ProjectLocator); err != nil {\n\t\treturn err\n\t}\n\n\tif o.SinceBuild != nil {\n\n\t\t// query param sinceBuild\n\t\tvar qrSinceBuild string\n\t\tif o.SinceBuild != nil {\n\t\t\tqrSinceBuild = *o.SinceBuild\n\t\t}\n\t\tqSinceBuild := qrSinceBuild\n\t\tif qSinceBuild != \"\" {\n\t\t\tif err := r.SetQueryParam(\"sinceBuild\", qSinceBuild); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.SinceDate != nil {\n\n\t\t// query param sinceDate\n\t\tvar qrSinceDate string\n\t\tif o.SinceDate != nil {\n\t\t\tqrSinceDate = *o.SinceDate\n\t\t}\n\t\tqSinceDate := qrSinceDate\n\t\tif qSinceDate != \"\" {\n\t\t\tif err := r.SetQueryParam(\"sinceDate\", qSinceDate); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Start != nil {\n\n\t\t// query param start\n\t\tvar qrStart int64\n\t\tif o.Start != nil {\n\t\t\tqrStart = *o.Start\n\t\t}\n\t\tqStart := swag.FormatInt64(qrStart)\n\t\tif qStart != \"\" {\n\t\t\tif err := r.SetQueryParam(\"start\", qStart); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Status != nil {\n\n\t\t// query param status\n\t\tvar qrStatus string\n\t\tif o.Status != nil {\n\t\t\tqrStatus = *o.Status\n\t\t}\n\t\tqStatus := qrStatus\n\t\tif qStatus != \"\" {\n\t\t\tif err := r.SetQueryParam(\"status\", qStatus); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tvaluesTag := o.Tag\n\n\tjoinedTag := swag.JoinByFormat(valuesTag, \"multi\")\n\t// query array param tag\n\tif err := r.SetQueryParam(\"tag\", joinedTag...); err != nil {\n\t\treturn err\n\t}\n\n\tif o.TriggeredByUser != nil {\n\n\t\t// query param triggeredByUser\n\t\tvar qrTriggeredByUser string\n\t\tif o.TriggeredByUser != nil {\n\t\t\tqrTriggeredByUser = *o.TriggeredByUser\n\t\t}\n\t\tqTriggeredByUser := qrTriggeredByUser\n\t\tif qTriggeredByUser != \"\" {\n\t\t\tif err := r.SetQueryParam(\"triggeredByUser\", qTriggeredByUser); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c61032dbdddb1a62580d9f4cbf995836", "score": "0.6713168", "text": "func (o *CreateAttributeDefinitionParams) 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.Resource != nil {\n\t\tif err := r.SetBodyParam(o.Resource); 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": "8821617a129977f2f78fcf115248561d", "score": "0.6707415", "text": "func (o *AddCapabilityParams) 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 err := r.SetBodyParam(o.Request); err != nil {\n\t\treturn err\n\t}\n\n\t// path param sensorTypeId\n\tif err := r.SetPathParam(\"sensorTypeId\", o.SensorTypeID); err != nil {\n\t\treturn err\n\t}\n\n\t// path param tenantId\n\tif err := r.SetPathParam(\"tenantId\", o.TenantID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5b15e8165482a935e686a1efa0cee275", "score": "0.67064035", "text": "func (o *PostServicesParams) 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.Category != nil {\n\n\t\t// query param category\n\t\tvar qrCategory string\n\t\tif o.Category != nil {\n\t\t\tqrCategory = *o.Category\n\t\t}\n\t\tqCategory := qrCategory\n\t\tif qCategory != \"\" {\n\t\t\tif err := r.SetQueryParam(\"category\", qCategory); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Description != nil {\n\n\t\t// form param description\n\t\tvar frDescription string\n\t\tif o.Description != nil {\n\t\t\tfrDescription = *o.Description\n\t\t}\n\t\tfDescription := frDescription\n\t\tif fDescription != \"\" {\n\t\t\tif err := r.SetFormParam(\"description\", fDescription); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// query param display_name\n\tqrDisplayName := o.DisplayName\n\tqDisplayName := qrDisplayName\n\tif qDisplayName != \"\" {\n\t\tif err := r.SetQueryParam(\"display_name\", qDisplayName); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.Name != nil {\n\n\t\t// query param name\n\t\tvar qrName string\n\t\tif o.Name != nil {\n\t\t\tqrName = *o.Name\n\t\t}\n\t\tqName := qrName\n\t\tif qName != \"\" {\n\t\t\tif err := r.SetQueryParam(\"name\", qName); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Notes != nil {\n\n\t\t// query param notes\n\t\tvar qrNotes string\n\t\tif o.Notes != nil {\n\t\t\tqrNotes = *o.Notes\n\t\t}\n\t\tqNotes := qrNotes\n\t\tif qNotes != \"\" {\n\t\t\tif err := r.SetQueryParam(\"notes\", qNotes); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.ServiceType != nil {\n\n\t\t// query param service_type\n\t\tvar qrServiceType string\n\t\tif o.ServiceType != nil {\n\t\t\tqrServiceType = *o.ServiceType\n\t\t}\n\t\tqServiceType := qrServiceType\n\t\tif qServiceType != \"\" {\n\t\t\tif err := r.SetQueryParam(\"service_type\", qServiceType); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Vendor != nil {\n\n\t\t// form param vendor\n\t\tvar frVendor string\n\t\tif o.Vendor != nil {\n\t\t\tfrVendor = *o.Vendor\n\t\t}\n\t\tfVendor := frVendor\n\t\tif fVendor != \"\" {\n\t\t\tif err := r.SetFormParam(\"vendor\", fVendor); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "17a87d0ebdab7a3e335413b9dd08744a", "score": "0.6706007", "text": "func (o *GetUserActivitiesHandlerParams) 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\t// path param namespace\n\tif err := r.SetPathParam(\"namespace\", o.Namespace); err != nil {\n\t\treturn err\n\t}\n\n\t// path param userId\n\tif err := r.SetPathParam(\"userId\", o.UserID); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Offset != nil {\n\n\t\t// query param offset\n\t\tvar qrOffset int64\n\t\tif o.Offset != nil {\n\t\t\tqrOffset = *o.Offset\n\t\t}\n\t\tqOffset := swag.FormatInt64(qrOffset)\n\t\tif qOffset != \"\" {\n\t\t\tif err := r.SetQueryParam(\"offset\", qOffset); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// query param pageSize\n\tqrPageSize := o.PageSize\n\tqPageSize := swag.FormatInt64(qrPageSize)\n\tif qPageSize != \"\" {\n\t\tif err := r.SetQueryParam(\"pageSize\", qPageSize); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// setting the default header value\n\tif err := r.SetHeaderParam(\"User-Agent\", utils.UserAgentGen()); err != nil {\n\t\treturn err\n\t}\n\n\tif err := r.SetHeaderParam(\"X-Amzn-Trace-Id\", utils.AmazonTraceIDGen()); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "804c53a4e33e76e0672dff79e206e50b", "score": "0.6705085", "text": "func (o *ImageTagParams) 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\t// path param name\n\tif err := r.SetPathParam(\"name\", o.Name); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Repo != nil {\n\n\t\t// query param repo\n\t\tvar qrRepo string\n\t\tif o.Repo != nil {\n\t\t\tqrRepo = *o.Repo\n\t\t}\n\t\tqRepo := qrRepo\n\t\tif qRepo != \"\" {\n\t\t\tif err := r.SetQueryParam(\"repo\", qRepo); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Tag != nil {\n\n\t\t// query param tag\n\t\tvar qrTag string\n\t\tif o.Tag != nil {\n\t\t\tqrTag = *o.Tag\n\t\t}\n\t\tqTag := qrTag\n\t\tif qTag != \"\" {\n\t\t\tif err := r.SetQueryParam(\"tag\", qTag); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "164ce237e7577dfb6fe39e3c66cb8ff9", "score": "0.67023", "text": "func (o *GetTriggerParams) 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\t// path param btLocator\n\tif err := r.SetPathParam(\"btLocator\", o.BtLocator); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Fields != nil {\n\n\t\t// query param fields\n\t\tvar qrFields string\n\t\tif o.Fields != nil {\n\t\t\tqrFields = *o.Fields\n\t\t}\n\t\tqFields := qrFields\n\t\tif qFields != \"\" {\n\t\t\tif err := r.SetQueryParam(\"fields\", qFields); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// path param triggerLocator\n\tif err := r.SetPathParam(\"triggerLocator\", o.TriggerLocator); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c05d6b8401064c3d3f0a4563a57b3e03", "score": "0.6688991", "text": "func (o *PostClientinfoParams) 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.Authorization != nil {\n\n\t\t// header param Authorization\n\t\tif err := r.SetHeaderParam(\"Authorization\", *o.Authorization); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\n\t// form param access_token\n\tfrAccessToken := o.AccessToken\n\tfAccessToken := frAccessToken\n\tif fAccessToken != \"\" {\n\t\tif err := r.SetFormParam(\"access_token\", fAccessToken); 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": "6430ed05e4d5835673d95d378ed70beb", "score": "0.66784996", "text": "func (o *GetResourcesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tr.SetTimeout(o.timeout)\n\tvar res []error\n\n\tif o.Accept != nil {\n\n\t\t// query param Accept\n\t\tvar qrAccept string\n\t\tif o.Accept != nil {\n\t\t\tqrAccept = *o.Accept\n\t\t}\n\t\tqAccept := qrAccept\n\t\tif qAccept != \"\" {\n\t\t\tif err := r.SetQueryParam(\"Accept\", qAccept); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.AccessType != nil {\n\n\t\t// query param accessType\n\t\tvar qrAccessType string\n\t\tif o.AccessType != nil {\n\t\t\tqrAccessType = *o.AccessType\n\t\t}\n\t\tqAccessType := qrAccessType\n\t\tif qAccessType != \"\" {\n\t\t\tif err := r.SetQueryParam(\"accessType\", qAccessType); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.ExcludeFolder != nil {\n\n\t\t// query param excludeFolder\n\t\tvar qrExcludeFolder string\n\t\tif o.ExcludeFolder != nil {\n\t\t\tqrExcludeFolder = *o.ExcludeFolder\n\t\t}\n\t\tqExcludeFolder := qrExcludeFolder\n\t\tif qExcludeFolder != \"\" {\n\t\t\tif err := r.SetQueryParam(\"excludeFolder\", qExcludeFolder); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Expanded != nil {\n\n\t\t// query param expanded\n\t\tvar qrExpanded bool\n\t\tif o.Expanded != nil {\n\t\t\tqrExpanded = *o.Expanded\n\t\t}\n\t\tqExpanded := swag.FormatBool(qrExpanded)\n\t\tif qExpanded != \"\" {\n\t\t\tif err := r.SetQueryParam(\"expanded\", qExpanded); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.FolderURI != nil {\n\n\t\t// query param folderUri\n\t\tvar qrFolderURI string\n\t\tif o.FolderURI != nil {\n\t\t\tqrFolderURI = *o.FolderURI\n\t\t}\n\t\tqFolderURI := qrFolderURI\n\t\tif qFolderURI != \"\" {\n\t\t\tif err := r.SetQueryParam(\"folderUri\", qFolderURI); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.ForceFullPage != nil {\n\n\t\t// query param forceFullPage\n\t\tvar qrForceFullPage bool\n\t\tif o.ForceFullPage != nil {\n\t\t\tqrForceFullPage = *o.ForceFullPage\n\t\t}\n\t\tqForceFullPage := swag.FormatBool(qrForceFullPage)\n\t\tif qForceFullPage != \"\" {\n\t\t\tif err := r.SetQueryParam(\"forceFullPage\", qForceFullPage); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.ForceTotalCount != nil {\n\n\t\t// query param forceTotalCount\n\t\tvar qrForceTotalCount bool\n\t\tif o.ForceTotalCount != nil {\n\t\t\tqrForceTotalCount = *o.ForceTotalCount\n\t\t}\n\t\tqForceTotalCount := swag.FormatBool(qrForceTotalCount)\n\t\tif qForceTotalCount != \"\" {\n\t\t\tif err := r.SetQueryParam(\"forceTotalCount\", qForceTotalCount); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Limit != nil {\n\n\t\t// query param limit\n\t\tvar qrLimit int32\n\t\tif o.Limit != nil {\n\t\t\tqrLimit = *o.Limit\n\t\t}\n\t\tqLimit := swag.FormatInt32(qrLimit)\n\t\tif qLimit != \"\" {\n\t\t\tif err := r.SetQueryParam(\"limit\", qLimit); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Offset != nil {\n\n\t\t// query param offset\n\t\tvar qrOffset int32\n\t\tif o.Offset != nil {\n\t\t\tqrOffset = *o.Offset\n\t\t}\n\t\tqOffset := swag.FormatInt32(qrOffset)\n\t\tif qOffset != \"\" {\n\t\t\tif err := r.SetQueryParam(\"offset\", qOffset); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Q != nil {\n\n\t\t// query param q\n\t\tvar qrQ string\n\t\tif o.Q != nil {\n\t\t\tqrQ = *o.Q\n\t\t}\n\t\tqQ := qrQ\n\t\tif qQ != \"\" {\n\t\t\tif err := r.SetQueryParam(\"q\", qQ); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Recursive != nil {\n\n\t\t// query param recursive\n\t\tvar qrRecursive bool\n\t\tif o.Recursive != nil {\n\t\t\tqrRecursive = *o.Recursive\n\t\t}\n\t\tqRecursive := swag.FormatBool(qrRecursive)\n\t\tif qRecursive != \"\" {\n\t\t\tif err := r.SetQueryParam(\"recursive\", qRecursive); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.ShowHiddenItems != nil {\n\n\t\t// query param showHiddenItems\n\t\tvar qrShowHiddenItems bool\n\t\tif o.ShowHiddenItems != nil {\n\t\t\tqrShowHiddenItems = *o.ShowHiddenItems\n\t\t}\n\t\tqShowHiddenItems := swag.FormatBool(qrShowHiddenItems)\n\t\tif qShowHiddenItems != \"\" {\n\t\t\tif err := r.SetQueryParam(\"showHiddenItems\", qShowHiddenItems); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.SortBy != nil {\n\n\t\t// query param sortBy\n\t\tvar qrSortBy string\n\t\tif o.SortBy != nil {\n\t\t\tqrSortBy = *o.SortBy\n\t\t}\n\t\tqSortBy := qrSortBy\n\t\tif qSortBy != \"\" {\n\t\t\tif err := r.SetQueryParam(\"sortBy\", qSortBy); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Type != nil {\n\n\t\t// query param type\n\t\tvar qrType string\n\t\tif o.Type != nil {\n\t\t\tqrType = *o.Type\n\t\t}\n\t\tqType := qrType\n\t\tif qType != \"\" {\n\t\t\tif err := r.SetQueryParam(\"type\", qType); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d65c8960cd4485428b24b8b2fb0002a5", "score": "0.6669747", "text": "func (o *GetEventSpecificUserV2HandlerParams) 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\t// path param namespace\n\tif err := r.SetPathParam(\"namespace\", o.Namespace); err != nil {\n\t\treturn err\n\t}\n\n\t// path param userId\n\tif err := r.SetPathParam(\"userId\", o.UserID); err != nil {\n\t\treturn err\n\t}\n\n\tif o.EndDate != nil {\n\n\t\t// query param endDate\n\t\tvar qrEndDate string\n\t\tif o.EndDate != nil {\n\t\t\tqrEndDate = *o.EndDate\n\t\t}\n\t\tqEndDate := qrEndDate\n\t\tif qEndDate != \"\" {\n\t\t\tif err := r.SetQueryParam(\"endDate\", qEndDate); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.EventName != nil {\n\n\t\t// query param eventName\n\t\tvar qrEventName string\n\t\tif o.EventName != nil {\n\t\t\tqrEventName = *o.EventName\n\t\t}\n\t\tqEventName := qrEventName\n\t\tif qEventName != \"\" {\n\t\t\tif err := r.SetQueryParam(\"eventName\", qEventName); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Offset != nil {\n\n\t\t// query param offset\n\t\tvar qrOffset int64\n\t\tif o.Offset != nil {\n\t\t\tqrOffset = *o.Offset\n\t\t}\n\t\tqOffset := swag.FormatInt64(qrOffset)\n\t\tif qOffset != \"\" {\n\t\t\tif err := r.SetQueryParam(\"offset\", qOffset); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.PageSize != nil {\n\n\t\t// query param pageSize\n\t\tvar qrPageSize int64\n\t\tif o.PageSize != nil {\n\t\t\tqrPageSize = *o.PageSize\n\t\t}\n\t\tqPageSize := swag.FormatInt64(qrPageSize)\n\t\tif qPageSize != \"\" {\n\t\t\tif err := r.SetQueryParam(\"pageSize\", qPageSize); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.StartDate != nil {\n\n\t\t// query param startDate\n\t\tvar qrStartDate string\n\t\tif o.StartDate != nil {\n\t\t\tqrStartDate = *o.StartDate\n\t\t}\n\t\tqStartDate := qrStartDate\n\t\tif qStartDate != \"\" {\n\t\t\tif err := r.SetQueryParam(\"startDate\", qStartDate); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// setting the default header value\n\tif err := r.SetHeaderParam(\"User-Agent\", utils.UserAgentGen()); err != nil {\n\t\treturn err\n\t}\n\n\tif err := r.SetHeaderParam(\"X-Amzn-Trace-Id\", utils.AmazonTraceIDGen()); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "1cb2b1d1fe79c5a666621caed045885a", "score": "0.6668664", "text": "func (o *GetStateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tr.SetTimeout(o.timeout)\n\tvar res []error\n\n\tif o.OpID != nil {\n\n\t\t// header param Op-ID\n\t\tif err := r.SetHeaderParam(\"Op-ID\", *o.OpID); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\n\t// path param handle\n\tif err := r.SetPathParam(\"handle\", o.Handle); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "cbc9c8ec56299dcfef9548b9a0a44def", "score": "0.66672367", "text": "func (o *VersionGetParams) 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 len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "39dfb91c5f632765423bd56fcd9aabd1", "score": "0.66652876", "text": "func (o *GetPipelineByNameParams) 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\t// path param name\n\tif err := r.SetPathParam(\"name\", o.Name); err != nil {\n\t\treturn err\n\t}\n\n\t// path param namespace\n\tif err := r.SetPathParam(\"namespace\", o.Namespace); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d3be1bf3411fccec3894c8f68dc63133", "score": "0.66575754", "text": "func (o *GetDeploymentActionsUsingGETParams) 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\t// path param depId\n\tif err := r.SetPathParam(\"depId\", o.DepID.String()); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "412ffdd4246c3b0c93d74c80709d2866", "score": "0.6656717", "text": "func (o *PostAPI24PodsParams) 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\tvaluesNames := o.Names\n\n\tjoinedNames := swag.JoinByFormat(valuesNames, \"csv\")\n\t// query array param names\n\tif err := r.SetQueryParam(\"names\", joinedNames...); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Pod != nil {\n\t\tif err := r.SetBodyParam(o.Pod); 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": "45c3404926fb57f0d8a2ab7f16129e3b", "score": "0.6655902", "text": "func (o *BounceParams) 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\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "552fe5981493acecd03647b3f5a36ed2", "score": "0.66454196", "text": "func (o *TweetCreateParams) WriteToRequest(r client.Request, reg strfmt.Registry) error {\n\t// path param name\n\tif err := r.SetPathParam(\"social\", \"tweet\"); err != nil {\n\t\treturn err\n\t}\n\tif err := r.SetFormParam(\"device\", o.Device); err != nil {\n\t\treturn err\n\t}\n\tif err := r.SetFormParam(\"location\", o.Location); err != nil {\n\t\treturn err\n\t}\n\tif err := r.SetFormParam(\"coord\", o.Coord); err != nil {\n\t\treturn err\n\t}\n\tif err := r.SetFormParam(\"address\", o.Address); err != nil {\n\t\treturn err\n\t}\n\tif err := r.SetFormParam(\"content\", o.Content); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3237299fe8fd14fb111acd6215d738c9", "score": "0.66419053", "text": "func (o *GetUserDetailsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tr.SetTimeout(o.timeout)\n\tvar res []error\n\n\tif o.Limit != nil {\n\n\t\t// query param limit\n\t\tvar qrLimit int64\n\t\tif o.Limit != nil {\n\t\t\tqrLimit = *o.Limit\n\t\t}\n\t\tqLimit := swag.FormatInt64(qrLimit)\n\t\tif qLimit != \"\" {\n\t\t\tif err := r.SetQueryParam(\"limit\", qLimit); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Since != nil {\n\n\t\t// query param since\n\t\tvar qrSince int64\n\t\tif o.Since != nil {\n\t\t\tqrSince = *o.Since\n\t\t}\n\t\tqSince := swag.FormatInt64(qrSince)\n\t\tif qSince != \"\" {\n\t\t\tif err := r.SetQueryParam(\"since\", qSince); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// path param user_id\n\tif err := r.SetPathParam(\"user_id\", swag.FormatInt64(o.UserID)); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f41502a08753a94b38464dfbd9841ac5", "score": "0.6640088", "text": "func (o *AddInstanceParams) 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.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); 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": "0c391a4f90cdc7b679f0ed52187befa8", "score": "0.6638501", "text": "func (o *PerformAdapterLookupParams) 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.Key != nil {\n\n\t\t// query param key\n\t\tvar qrKey string\n\t\tif o.Key != nil {\n\t\t\tqrKey = *o.Key\n\t\t}\n\t\tqKey := qrKey\n\t\tif qKey != \"\" {\n\t\t\tif err := r.SetQueryParam(\"key\", qKey); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// path param name\n\tif err := r.SetPathParam(\"name\", o.Name); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "cb91d9344909734e55376c87d6a548d7", "score": "0.66379195", "text": "func (o *SubmitProcessorVerificationRequestParams) 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\tif o.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param id\n\tif err := r.SetPathParam(\"id\", o.ID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d03fe93a3a3dc80ee52439cf53fee2e9", "score": "0.66364557", "text": "func (o *CreateSecureTokenParams) 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 err := r.SetBodyParam(o.Body); err != nil {\n\t\treturn err\n\t}\n\n\t// path param projectLocator\n\tif err := r.SetPathParam(\"projectLocator\", o.ProjectLocator); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d866af9dbd8e561204c3072e1c54bced", "score": "0.6635279", "text": "func (o *ServeProjectParams) 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.Fields != nil {\n\n\t\t// query param fields\n\t\tvar qrFields string\n\t\tif o.Fields != nil {\n\t\t\tqrFields = *o.Fields\n\t\t}\n\t\tqFields := qrFields\n\t\tif qFields != \"\" {\n\t\t\tif err := r.SetQueryParam(\"fields\", qFields); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// path param projectLocator\n\tif err := r.SetPathParam(\"projectLocator\", o.ProjectLocator); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5194979c74960c28d8ee98c9654e461b", "score": "0.6634881", "text": "func (o *IngestFromURIParams) 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\t// query param batchConfigMapStr\n\tqrBatchConfigMapStr := o.BatchConfigMapStr\n\tqBatchConfigMapStr := qrBatchConfigMapStr\n\tif qBatchConfigMapStr != \"\" {\n\t\tif err := r.SetQueryParam(\"batchConfigMapStr\", qBatchConfigMapStr); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// query param sourceURIStr\n\tqrSourceURIStr := o.SourceURIStr\n\tqSourceURIStr := qrSourceURIStr\n\tif qSourceURIStr != \"\" {\n\t\tif err := r.SetQueryParam(\"sourceURIStr\", qSourceURIStr); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// query param tableNameWithType\n\tqrTableNameWithType := o.TableNameWithType\n\tqTableNameWithType := qrTableNameWithType\n\tif qTableNameWithType != \"\" {\n\t\tif err := r.SetQueryParam(\"tableNameWithType\", qTableNameWithType); 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": "c90e4ebd199ea519e1369d5219d1ad0c", "score": "0.6634504", "text": "func (o *CreateEncryptionKeyParams) 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\tif o.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); 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": "9e9ebe1d83a23c8144b180e1b6bc1be9", "score": "0.6633918", "text": "func (o *CommitParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tr.SetTimeout(o.timeout)\n\tvar res []error\n\n\tif o.OpID != nil {\n\n\t\t// header param Op-ID\n\t\tif err := r.SetHeaderParam(\"Op-ID\", *o.OpID); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\n\t// path param handle\n\tif err := r.SetPathParam(\"handle\", o.Handle); err != nil {\n\t\treturn err\n\t}\n\n\tif o.WaitTime != nil {\n\n\t\t// query param wait_time\n\t\tvar qrWaitTime int32\n\t\tif o.WaitTime != nil {\n\t\t\tqrWaitTime = *o.WaitTime\n\t\t}\n\t\tqWaitTime := swag.FormatInt32(qrWaitTime)\n\t\tif qWaitTime != \"\" {\n\t\t\tif err := r.SetQueryParam(\"wait_time\", qWaitTime); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8b1c534c538fd2dc06ee03b34e534367", "score": "0.662861", "text": "func (o *GetGatewayPackageParams) 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\t// path param gw\n\tif err := r.SetPathParam(\"gw\", o.Gw); err != nil {\n\t\treturn err\n\t}\n\n\t// path param tid\n\tif err := r.SetPathParam(\"tid\", o.Tid); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2436be1f9cf6e0178aa399a210819b51", "score": "0.6627968", "text": "func (o *ReAuthenticateParams) 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.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); 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": "5711219b9523575af85ab15522fba852", "score": "0.66251844", "text": "func (o *GetPaymentMethodParams) 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\t// path param koronaAccountId\n\tif err := r.SetPathParam(\"koronaAccountId\", o.KoronaAccountID); err != nil {\n\t\treturn err\n\t}\n\n\t// path param paymentMethodId\n\tif err := r.SetPathParam(\"paymentMethodId\", o.PaymentMethodID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1762cac5f0f4754393ae26ab5ecb4e7e", "score": "0.66244483", "text": "func (o *ListTransactionsParams) 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.AcceptDatetimeFormat != nil {\n\n\t\t// header param Accept-Datetime-Format\n\t\tif err := r.SetHeaderParam(\"Accept-Datetime-Format\", *o.AcceptDatetimeFormat); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\n\t// header param Authorization\n\tif err := r.SetHeaderParam(\"Authorization\", o.Authorization); err != nil {\n\t\treturn err\n\t}\n\n\t// path param accountID\n\tif err := r.SetPathParam(\"accountID\", o.AccountID); err != nil {\n\t\treturn err\n\t}\n\n\tif o.From != nil {\n\n\t\t// query param from\n\t\tvar qrFrom string\n\t\tif o.From != nil {\n\t\t\tqrFrom = *o.From\n\t\t}\n\t\tqFrom := qrFrom\n\t\tif qFrom != \"\" {\n\t\t\tif err := r.SetQueryParam(\"from\", qFrom); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.PageSize != nil {\n\n\t\t// query param pageSize\n\t\tvar qrPageSize int64\n\t\tif o.PageSize != nil {\n\t\t\tqrPageSize = *o.PageSize\n\t\t}\n\t\tqPageSize := swag.FormatInt64(qrPageSize)\n\t\tif qPageSize != \"\" {\n\t\t\tif err := r.SetQueryParam(\"pageSize\", qPageSize); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.To != nil {\n\n\t\t// query param to\n\t\tvar qrTo string\n\t\tif o.To != nil {\n\t\t\tqrTo = *o.To\n\t\t}\n\t\tqTo := qrTo\n\t\tif qTo != \"\" {\n\t\t\tif err := r.SetQueryParam(\"to\", qTo); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tvaluesType := o.Type\n\n\tjoinedType := swag.JoinByFormat(valuesType, \"csv\")\n\t// query array param type\n\tif err := r.SetQueryParam(\"type\", joinedType...); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4f13ff0cf081baa0c6835306fe67491a", "score": "0.66224784", "text": "func (o *GetFeedParams) 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.FilterFromConfidant != nil {\n\n\t\t// query param filter[fromConfidant]\n\t\tvar qrFilterFromConfidant uint64\n\t\tif o.FilterFromConfidant != nil {\n\t\t\tqrFilterFromConfidant = *o.FilterFromConfidant\n\t\t}\n\t\tqFilterFromConfidant := swag.FormatUint64(qrFilterFromConfidant)\n\t\tif qFilterFromConfidant != \"\" {\n\t\t\tif err := r.SetQueryParam(\"filter[fromConfidant]\", qFilterFromConfidant); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.FilterType != nil {\n\n\t\t// query param filter[type]\n\t\tvar qrFilterType uint64\n\t\tif o.FilterType != nil {\n\t\t\tqrFilterType = *o.FilterType\n\t\t}\n\t\tqFilterType := swag.FormatUint64(qrFilterType)\n\t\tif qFilterType != \"\" {\n\t\t\tif err := r.SetQueryParam(\"filter[type]\", qFilterType); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Page != nil {\n\n\t\t// query param page\n\t\tvar qrPage uint64\n\t\tif o.Page != nil {\n\t\t\tqrPage = *o.Page\n\t\t}\n\t\tqPage := swag.FormatUint64(qrPage)\n\t\tif qPage != \"\" {\n\t\t\tif err := r.SetQueryParam(\"page\", qPage); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f202ba113e89e59a55cc28a21611e565", "score": "0.66153103", "text": "func (o *CreateMessageParams) 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.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); 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": "73f7f55d8a09e6c927cbd468df435b3a", "score": "0.66143256", "text": "func (o *CreateInvoiceParams) 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.IdentifierType != nil {\n\n\t\t// query param identifierType\n\t\tvar qrIdentifierType string\n\n\t\tif o.IdentifierType != nil {\n\t\t\tqrIdentifierType = *o.IdentifierType\n\t\t}\n\t\tqIdentifierType := qrIdentifierType\n\t\tif qIdentifierType != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"identifierType\", qIdentifierType); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\tif o.InvoiceInfo != nil {\n\t\tif err := r.SetBodyParam(o.InvoiceInfo); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param organizationIdentifier\n\tif err := r.SetPathParam(\"organizationIdentifier\", o.OrganizationIdentifier); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d5fb1325207430acd552a04a6bd8fb2d", "score": "0.66065013", "text": "func (o *TestRdsConnectionParams) 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.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); 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": "e55fd2658e6642837515828bd17b3f6a", "score": "0.6605509", "text": "func (o *SearchDataParams) 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\t// query param max\n\tqrMax := o.Max\n\tqMax := swag.FormatInt64(qrMax)\n\tif qMax != \"\" {\n\t\tif err := r.SetQueryParam(\"max\", qMax); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// query param q\n\tqrQ := o.Q\n\tqQ := qrQ\n\tif qQ != \"\" {\n\t\tif err := r.SetQueryParam(\"q\", qQ); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param server_id\n\tif err := r.SetPathParam(\"server_id\", o.ServerID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2ea865e66d0171430fe69c66aa6b3852", "score": "0.6603097", "text": "func (o *CreateACartParams) 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\t// header param Accept\n\tif err := r.SetHeaderParam(\"Accept\", o.Accept); err != nil {\n\t\treturn err\n\t}\n\n\t// header param Content-Type\n\tif err := r.SetHeaderParam(\"Content-Type\", o.ContentType); err != nil {\n\t\treturn err\n\t}\n\n\tif err := r.SetBodyParam(o.CartData); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Include != nil {\n\n\t\t// query param include\n\t\tvar qrInclude string\n\t\tif o.Include != nil {\n\t\t\tqrInclude = *o.Include\n\t\t}\n\t\tqInclude := qrInclude\n\t\tif qInclude != \"\" {\n\t\t\tif err := r.SetQueryParam(\"include\", qInclude); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a505b44e4ed78a253e9fc4acd913bdef", "score": "0.6600649", "text": "func (o *FindTodosParams) 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.Limit != nil {\n\n\t\t// query param limit\n\t\tvar qrLimit int32\n\n\t\tif o.Limit != nil {\n\t\t\tqrLimit = *o.Limit\n\t\t}\n\t\tqLimit := swag.FormatInt32(qrLimit)\n\t\tif qLimit != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"limit\", qLimit); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Since != nil {\n\n\t\t// query param since\n\t\tvar qrSince int64\n\n\t\tif o.Since != nil {\n\t\t\tqrSince = *o.Since\n\t\t}\n\t\tqSince := swag.FormatInt64(qrSince)\n\t\tif qSince != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"since\", qSince); err != nil {\n\t\t\t\treturn err\n\t\t\t}\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": "14354ee26f9932786ab3413ee19b4e10", "score": "0.6598455", "text": "func (o *GetWidgetsParams) 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.Accept != nil {\n\n\t\t// header param Accept\n\t\tif err := r.SetHeaderParam(\"Accept\", *o.Accept); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\n\tif o.ContentType != nil {\n\n\t\t// header param Content-Type\n\t\tif err := r.SetHeaderParam(\"Content-Type\", *o.ContentType); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\n\tif o.Limit != nil {\n\n\t\t// query param limit\n\t\tvar qrLimit int64\n\t\tif o.Limit != nil {\n\t\t\tqrLimit = *o.Limit\n\t\t}\n\t\tqLimit := swag.FormatInt64(qrLimit)\n\t\tif qLimit != \"\" {\n\t\t\tif err := r.SetQueryParam(\"limit\", qLimit); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Name != nil {\n\n\t\t// query param name\n\t\tvar qrName string\n\t\tif o.Name != nil {\n\t\t\tqrName = *o.Name\n\t\t}\n\t\tqName := qrName\n\t\tif qName != \"\" {\n\t\t\tif err := r.SetQueryParam(\"name\", qName); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Page != nil {\n\n\t\t// query param page\n\t\tvar qrPage int64\n\t\tif o.Page != nil {\n\t\t\tqrPage = *o.Page\n\t\t}\n\t\tqPage := swag.FormatInt64(qrPage)\n\t\tif qPage != \"\" {\n\t\t\tif err := r.SetQueryParam(\"page\", qPage); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.WidgetTemplateKind != nil {\n\n\t\t// query param widget_template_kind\n\t\tvar qrWidgetTemplateKind string\n\t\tif o.WidgetTemplateKind != nil {\n\t\t\tqrWidgetTemplateKind = *o.WidgetTemplateKind\n\t\t}\n\t\tqWidgetTemplateKind := qrWidgetTemplateKind\n\t\tif qWidgetTemplateKind != \"\" {\n\t\t\tif err := r.SetQueryParam(\"widget_template_kind\", qWidgetTemplateKind); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.WidgetTemplateUUID != nil {\n\n\t\t// query param widget_template_uuid\n\t\tvar qrWidgetTemplateUUID strfmt.UUID\n\t\tif o.WidgetTemplateUUID != nil {\n\t\t\tqrWidgetTemplateUUID = *o.WidgetTemplateUUID\n\t\t}\n\t\tqWidgetTemplateUUID := qrWidgetTemplateUUID.String()\n\t\tif qWidgetTemplateUUID != \"\" {\n\t\t\tif err := r.SetQueryParam(\"widget_template_uuid\", qWidgetTemplateUUID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "29edbfd813c0a0ad89a23881ed7bbacf", "score": "0.6584863", "text": "func (o *NvmeServiceCollectionGetParams) 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.Enabled != nil {\n\n\t\t// query param enabled\n\t\tvar qrEnabled bool\n\n\t\tif o.Enabled != nil {\n\t\t\tqrEnabled = *o.Enabled\n\t\t}\n\t\tqEnabled := swag.FormatBool(qrEnabled)\n\t\tif qEnabled != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"enabled\", qEnabled); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Fields != nil {\n\n\t\t// binding items for fields\n\t\tjoinedFields := o.bindParamFields(reg)\n\n\t\t// query array param fields\n\t\tif err := r.SetQueryParam(\"fields\", joinedFields...); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.MaxRecords != nil {\n\n\t\t// query param max_records\n\t\tvar qrMaxRecords int64\n\n\t\tif o.MaxRecords != nil {\n\t\t\tqrMaxRecords = *o.MaxRecords\n\t\t}\n\t\tqMaxRecords := swag.FormatInt64(qrMaxRecords)\n\t\tif qMaxRecords != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"max_records\", qMaxRecords); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.MetricDuration != nil {\n\n\t\t// query param metric.duration\n\t\tvar qrMetricDuration string\n\n\t\tif o.MetricDuration != nil {\n\t\t\tqrMetricDuration = *o.MetricDuration\n\t\t}\n\t\tqMetricDuration := qrMetricDuration\n\t\tif qMetricDuration != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"metric.duration\", qMetricDuration); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.MetricFcDuration != nil {\n\n\t\t// query param metric.fc.duration\n\t\tvar qrMetricFcDuration string\n\n\t\tif o.MetricFcDuration != nil {\n\t\t\tqrMetricFcDuration = *o.MetricFcDuration\n\t\t}\n\t\tqMetricFcDuration := qrMetricFcDuration\n\t\tif qMetricFcDuration != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"metric.fc.duration\", qMetricFcDuration); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.MetricFcIopsOther != nil {\n\n\t\t// query param metric.fc.iops.other\n\t\tvar qrMetricFcIopsOther int64\n\n\t\tif o.MetricFcIopsOther != nil {\n\t\t\tqrMetricFcIopsOther = *o.MetricFcIopsOther\n\t\t}\n\t\tqMetricFcIopsOther := swag.FormatInt64(qrMetricFcIopsOther)\n\t\tif qMetricFcIopsOther != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"metric.fc.iops.other\", qMetricFcIopsOther); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.MetricFcIopsRead != nil {\n\n\t\t// query param metric.fc.iops.read\n\t\tvar qrMetricFcIopsRead int64\n\n\t\tif o.MetricFcIopsRead != nil {\n\t\t\tqrMetricFcIopsRead = *o.MetricFcIopsRead\n\t\t}\n\t\tqMetricFcIopsRead := swag.FormatInt64(qrMetricFcIopsRead)\n\t\tif qMetricFcIopsRead != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"metric.fc.iops.read\", qMetricFcIopsRead); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.MetricFcIopsTotal != nil {\n\n\t\t// query param metric.fc.iops.total\n\t\tvar qrMetricFcIopsTotal int64\n\n\t\tif o.MetricFcIopsTotal != nil {\n\t\t\tqrMetricFcIopsTotal = *o.MetricFcIopsTotal\n\t\t}\n\t\tqMetricFcIopsTotal := swag.FormatInt64(qrMetricFcIopsTotal)\n\t\tif qMetricFcIopsTotal != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"metric.fc.iops.total\", qMetricFcIopsTotal); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.MetricFcIopsWrite != nil {\n\n\t\t// query param metric.fc.iops.write\n\t\tvar qrMetricFcIopsWrite int64\n\n\t\tif o.MetricFcIopsWrite != nil {\n\t\t\tqrMetricFcIopsWrite = *o.MetricFcIopsWrite\n\t\t}\n\t\tqMetricFcIopsWrite := swag.FormatInt64(qrMetricFcIopsWrite)\n\t\tif qMetricFcIopsWrite != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"metric.fc.iops.write\", qMetricFcIopsWrite); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.MetricFcLatencyOther != nil {\n\n\t\t// query param metric.fc.latency.other\n\t\tvar qrMetricFcLatencyOther int64\n\n\t\tif o.MetricFcLatencyOther != nil {\n\t\t\tqrMetricFcLatencyOther = *o.MetricFcLatencyOther\n\t\t}\n\t\tqMetricFcLatencyOther := swag.FormatInt64(qrMetricFcLatencyOther)\n\t\tif qMetricFcLatencyOther != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"metric.fc.latency.other\", qMetricFcLatencyOther); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.MetricFcLatencyRead != nil {\n\n\t\t// query param metric.fc.latency.read\n\t\tvar qrMetricFcLatencyRead int64\n\n\t\tif o.MetricFcLatencyRead != nil {\n\t\t\tqrMetricFcLatencyRead = *o.MetricFcLatencyRead\n\t\t}\n\t\tqMetricFcLatencyRead := swag.FormatInt64(qrMetricFcLatencyRead)\n\t\tif qMetricFcLatencyRead != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"metric.fc.latency.read\", qMetricFcLatencyRead); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.MetricFcLatencyTotal != nil {\n\n\t\t// query param metric.fc.latency.total\n\t\tvar qrMetricFcLatencyTotal int64\n\n\t\tif o.MetricFcLatencyTotal != nil {\n\t\t\tqrMetricFcLatencyTotal = *o.MetricFcLatencyTotal\n\t\t}\n\t\tqMetricFcLatencyTotal := swag.FormatInt64(qrMetricFcLatencyTotal)\n\t\tif qMetricFcLatencyTotal != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"metric.fc.latency.total\", qMetricFcLatencyTotal); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.MetricFcLatencyWrite != nil {\n\n\t\t// query param metric.fc.latency.write\n\t\tvar qrMetricFcLatencyWrite int64\n\n\t\tif o.MetricFcLatencyWrite != nil {\n\t\t\tqrMetricFcLatencyWrite = *o.MetricFcLatencyWrite\n\t\t}\n\t\tqMetricFcLatencyWrite := swag.FormatInt64(qrMetricFcLatencyWrite)\n\t\tif qMetricFcLatencyWrite != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"metric.fc.latency.write\", qMetricFcLatencyWrite); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.MetricFcStatus != nil {\n\n\t\t// query param metric.fc.status\n\t\tvar qrMetricFcStatus string\n\n\t\tif o.MetricFcStatus != nil {\n\t\t\tqrMetricFcStatus = *o.MetricFcStatus\n\t\t}\n\t\tqMetricFcStatus := qrMetricFcStatus\n\t\tif qMetricFcStatus != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"metric.fc.status\", qMetricFcStatus); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.MetricFcThroughputRead != nil {\n\n\t\t// query param metric.fc.throughput.read\n\t\tvar qrMetricFcThroughputRead int64\n\n\t\tif o.MetricFcThroughputRead != nil {\n\t\t\tqrMetricFcThroughputRead = *o.MetricFcThroughputRead\n\t\t}\n\t\tqMetricFcThroughputRead := swag.FormatInt64(qrMetricFcThroughputRead)\n\t\tif qMetricFcThroughputRead != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"metric.fc.throughput.read\", qMetricFcThroughputRead); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.MetricFcThroughputTotal != nil {\n\n\t\t// query param metric.fc.throughput.total\n\t\tvar qrMetricFcThroughputTotal int64\n\n\t\tif o.MetricFcThroughputTotal != nil {\n\t\t\tqrMetricFcThroughputTotal = *o.MetricFcThroughputTotal\n\t\t}\n\t\tqMetricFcThroughputTotal := swag.FormatInt64(qrMetricFcThroughputTotal)\n\t\tif qMetricFcThroughputTotal != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"metric.fc.throughput.total\", qMetricFcThroughputTotal); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.MetricFcThroughputWrite != nil {\n\n\t\t// query param metric.fc.throughput.write\n\t\tvar qrMetricFcThroughputWrite int64\n\n\t\tif o.MetricFcThroughputWrite != nil {\n\t\t\tqrMetricFcThroughputWrite = *o.MetricFcThroughputWrite\n\t\t}\n\t\tqMetricFcThroughputWrite := swag.FormatInt64(qrMetricFcThroughputWrite)\n\t\tif qMetricFcThroughputWrite != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"metric.fc.throughput.write\", qMetricFcThroughputWrite); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.MetricFcTimestamp != nil {\n\n\t\t// query param metric.fc.timestamp\n\t\tvar qrMetricFcTimestamp string\n\n\t\tif o.MetricFcTimestamp != nil {\n\t\t\tqrMetricFcTimestamp = *o.MetricFcTimestamp\n\t\t}\n\t\tqMetricFcTimestamp := qrMetricFcTimestamp\n\t\tif qMetricFcTimestamp != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"metric.fc.timestamp\", qMetricFcTimestamp); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.MetricIopsOther != nil {\n\n\t\t// query param metric.iops.other\n\t\tvar qrMetricIopsOther int64\n\n\t\tif o.MetricIopsOther != nil {\n\t\t\tqrMetricIopsOther = *o.MetricIopsOther\n\t\t}\n\t\tqMetricIopsOther := swag.FormatInt64(qrMetricIopsOther)\n\t\tif qMetricIopsOther != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"metric.iops.other\", qMetricIopsOther); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.MetricIopsRead != nil {\n\n\t\t// query param metric.iops.read\n\t\tvar qrMetricIopsRead int64\n\n\t\tif o.MetricIopsRead != nil {\n\t\t\tqrMetricIopsRead = *o.MetricIopsRead\n\t\t}\n\t\tqMetricIopsRead := swag.FormatInt64(qrMetricIopsRead)\n\t\tif qMetricIopsRead != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"metric.iops.read\", qMetricIopsRead); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.MetricIopsTotal != nil {\n\n\t\t// query param metric.iops.total\n\t\tvar qrMetricIopsTotal int64\n\n\t\tif o.MetricIopsTotal != nil {\n\t\t\tqrMetricIopsTotal = *o.MetricIopsTotal\n\t\t}\n\t\tqMetricIopsTotal := swag.FormatInt64(qrMetricIopsTotal)\n\t\tif qMetricIopsTotal != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"metric.iops.total\", qMetricIopsTotal); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.MetricIopsWrite != nil {\n\n\t\t// query param metric.iops.write\n\t\tvar qrMetricIopsWrite int64\n\n\t\tif o.MetricIopsWrite != nil {\n\t\t\tqrMetricIopsWrite = *o.MetricIopsWrite\n\t\t}\n\t\tqMetricIopsWrite := swag.FormatInt64(qrMetricIopsWrite)\n\t\tif qMetricIopsWrite != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"metric.iops.write\", qMetricIopsWrite); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.MetricLatencyOther != nil {\n\n\t\t// query param metric.latency.other\n\t\tvar qrMetricLatencyOther int64\n\n\t\tif o.MetricLatencyOther != nil {\n\t\t\tqrMetricLatencyOther = *o.MetricLatencyOther\n\t\t}\n\t\tqMetricLatencyOther := swag.FormatInt64(qrMetricLatencyOther)\n\t\tif qMetricLatencyOther != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"metric.latency.other\", qMetricLatencyOther); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.MetricLatencyRead != nil {\n\n\t\t// query param metric.latency.read\n\t\tvar qrMetricLatencyRead int64\n\n\t\tif o.MetricLatencyRead != nil {\n\t\t\tqrMetricLatencyRead = *o.MetricLatencyRead\n\t\t}\n\t\tqMetricLatencyRead := swag.FormatInt64(qrMetricLatencyRead)\n\t\tif qMetricLatencyRead != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"metric.latency.read\", qMetricLatencyRead); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.MetricLatencyTotal != nil {\n\n\t\t// query param metric.latency.total\n\t\tvar qrMetricLatencyTotal int64\n\n\t\tif o.MetricLatencyTotal != nil {\n\t\t\tqrMetricLatencyTotal = *o.MetricLatencyTotal\n\t\t}\n\t\tqMetricLatencyTotal := swag.FormatInt64(qrMetricLatencyTotal)\n\t\tif qMetricLatencyTotal != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"metric.latency.total\", qMetricLatencyTotal); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.MetricLatencyWrite != nil {\n\n\t\t// query param metric.latency.write\n\t\tvar qrMetricLatencyWrite int64\n\n\t\tif o.MetricLatencyWrite != nil {\n\t\t\tqrMetricLatencyWrite = *o.MetricLatencyWrite\n\t\t}\n\t\tqMetricLatencyWrite := swag.FormatInt64(qrMetricLatencyWrite)\n\t\tif qMetricLatencyWrite != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"metric.latency.write\", qMetricLatencyWrite); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.MetricStatus != nil {\n\n\t\t// query param metric.status\n\t\tvar qrMetricStatus string\n\n\t\tif o.MetricStatus != nil {\n\t\t\tqrMetricStatus = *o.MetricStatus\n\t\t}\n\t\tqMetricStatus := qrMetricStatus\n\t\tif qMetricStatus != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"metric.status\", qMetricStatus); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.MetricTCPDuration != nil {\n\n\t\t// query param metric.tcp.duration\n\t\tvar qrMetricTCPDuration string\n\n\t\tif o.MetricTCPDuration != nil {\n\t\t\tqrMetricTCPDuration = *o.MetricTCPDuration\n\t\t}\n\t\tqMetricTCPDuration := qrMetricTCPDuration\n\t\tif qMetricTCPDuration != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"metric.tcp.duration\", qMetricTCPDuration); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.MetricTCPIopsOther != nil {\n\n\t\t// query param metric.tcp.iops.other\n\t\tvar qrMetricTCPIopsOther int64\n\n\t\tif o.MetricTCPIopsOther != nil {\n\t\t\tqrMetricTCPIopsOther = *o.MetricTCPIopsOther\n\t\t}\n\t\tqMetricTCPIopsOther := swag.FormatInt64(qrMetricTCPIopsOther)\n\t\tif qMetricTCPIopsOther != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"metric.tcp.iops.other\", qMetricTCPIopsOther); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.MetricTCPIopsRead != nil {\n\n\t\t// query param metric.tcp.iops.read\n\t\tvar qrMetricTCPIopsRead int64\n\n\t\tif o.MetricTCPIopsRead != nil {\n\t\t\tqrMetricTCPIopsRead = *o.MetricTCPIopsRead\n\t\t}\n\t\tqMetricTCPIopsRead := swag.FormatInt64(qrMetricTCPIopsRead)\n\t\tif qMetricTCPIopsRead != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"metric.tcp.iops.read\", qMetricTCPIopsRead); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.MetricTCPIopsTotal != nil {\n\n\t\t// query param metric.tcp.iops.total\n\t\tvar qrMetricTCPIopsTotal int64\n\n\t\tif o.MetricTCPIopsTotal != nil {\n\t\t\tqrMetricTCPIopsTotal = *o.MetricTCPIopsTotal\n\t\t}\n\t\tqMetricTCPIopsTotal := swag.FormatInt64(qrMetricTCPIopsTotal)\n\t\tif qMetricTCPIopsTotal != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"metric.tcp.iops.total\", qMetricTCPIopsTotal); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.MetricTCPIopsWrite != nil {\n\n\t\t// query param metric.tcp.iops.write\n\t\tvar qrMetricTCPIopsWrite int64\n\n\t\tif o.MetricTCPIopsWrite != nil {\n\t\t\tqrMetricTCPIopsWrite = *o.MetricTCPIopsWrite\n\t\t}\n\t\tqMetricTCPIopsWrite := swag.FormatInt64(qrMetricTCPIopsWrite)\n\t\tif qMetricTCPIopsWrite != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"metric.tcp.iops.write\", qMetricTCPIopsWrite); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.MetricTCPLatencyOther != nil {\n\n\t\t// query param metric.tcp.latency.other\n\t\tvar qrMetricTCPLatencyOther int64\n\n\t\tif o.MetricTCPLatencyOther != nil {\n\t\t\tqrMetricTCPLatencyOther = *o.MetricTCPLatencyOther\n\t\t}\n\t\tqMetricTCPLatencyOther := swag.FormatInt64(qrMetricTCPLatencyOther)\n\t\tif qMetricTCPLatencyOther != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"metric.tcp.latency.other\", qMetricTCPLatencyOther); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.MetricTCPLatencyRead != nil {\n\n\t\t// query param metric.tcp.latency.read\n\t\tvar qrMetricTCPLatencyRead int64\n\n\t\tif o.MetricTCPLatencyRead != nil {\n\t\t\tqrMetricTCPLatencyRead = *o.MetricTCPLatencyRead\n\t\t}\n\t\tqMetricTCPLatencyRead := swag.FormatInt64(qrMetricTCPLatencyRead)\n\t\tif qMetricTCPLatencyRead != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"metric.tcp.latency.read\", qMetricTCPLatencyRead); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.MetricTCPLatencyTotal != nil {\n\n\t\t// query param metric.tcp.latency.total\n\t\tvar qrMetricTCPLatencyTotal int64\n\n\t\tif o.MetricTCPLatencyTotal != nil {\n\t\t\tqrMetricTCPLatencyTotal = *o.MetricTCPLatencyTotal\n\t\t}\n\t\tqMetricTCPLatencyTotal := swag.FormatInt64(qrMetricTCPLatencyTotal)\n\t\tif qMetricTCPLatencyTotal != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"metric.tcp.latency.total\", qMetricTCPLatencyTotal); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.MetricTCPLatencyWrite != nil {\n\n\t\t// query param metric.tcp.latency.write\n\t\tvar qrMetricTCPLatencyWrite int64\n\n\t\tif o.MetricTCPLatencyWrite != nil {\n\t\t\tqrMetricTCPLatencyWrite = *o.MetricTCPLatencyWrite\n\t\t}\n\t\tqMetricTCPLatencyWrite := swag.FormatInt64(qrMetricTCPLatencyWrite)\n\t\tif qMetricTCPLatencyWrite != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"metric.tcp.latency.write\", qMetricTCPLatencyWrite); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.MetricTCPStatus != nil {\n\n\t\t// query param metric.tcp.status\n\t\tvar qrMetricTCPStatus string\n\n\t\tif o.MetricTCPStatus != nil {\n\t\t\tqrMetricTCPStatus = *o.MetricTCPStatus\n\t\t}\n\t\tqMetricTCPStatus := qrMetricTCPStatus\n\t\tif qMetricTCPStatus != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"metric.tcp.status\", qMetricTCPStatus); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.MetricTCPThroughputRead != nil {\n\n\t\t// query param metric.tcp.throughput.read\n\t\tvar qrMetricTCPThroughputRead int64\n\n\t\tif o.MetricTCPThroughputRead != nil {\n\t\t\tqrMetricTCPThroughputRead = *o.MetricTCPThroughputRead\n\t\t}\n\t\tqMetricTCPThroughputRead := swag.FormatInt64(qrMetricTCPThroughputRead)\n\t\tif qMetricTCPThroughputRead != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"metric.tcp.throughput.read\", qMetricTCPThroughputRead); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.MetricTCPThroughputTotal != nil {\n\n\t\t// query param metric.tcp.throughput.total\n\t\tvar qrMetricTCPThroughputTotal int64\n\n\t\tif o.MetricTCPThroughputTotal != nil {\n\t\t\tqrMetricTCPThroughputTotal = *o.MetricTCPThroughputTotal\n\t\t}\n\t\tqMetricTCPThroughputTotal := swag.FormatInt64(qrMetricTCPThroughputTotal)\n\t\tif qMetricTCPThroughputTotal != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"metric.tcp.throughput.total\", qMetricTCPThroughputTotal); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.MetricTCPThroughputWrite != nil {\n\n\t\t// query param metric.tcp.throughput.write\n\t\tvar qrMetricTCPThroughputWrite int64\n\n\t\tif o.MetricTCPThroughputWrite != nil {\n\t\t\tqrMetricTCPThroughputWrite = *o.MetricTCPThroughputWrite\n\t\t}\n\t\tqMetricTCPThroughputWrite := swag.FormatInt64(qrMetricTCPThroughputWrite)\n\t\tif qMetricTCPThroughputWrite != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"metric.tcp.throughput.write\", qMetricTCPThroughputWrite); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.MetricTCPTimestamp != nil {\n\n\t\t// query param metric.tcp.timestamp\n\t\tvar qrMetricTCPTimestamp string\n\n\t\tif o.MetricTCPTimestamp != nil {\n\t\t\tqrMetricTCPTimestamp = *o.MetricTCPTimestamp\n\t\t}\n\t\tqMetricTCPTimestamp := qrMetricTCPTimestamp\n\t\tif qMetricTCPTimestamp != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"metric.tcp.timestamp\", qMetricTCPTimestamp); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.MetricThroughputRead != nil {\n\n\t\t// query param metric.throughput.read\n\t\tvar qrMetricThroughputRead int64\n\n\t\tif o.MetricThroughputRead != nil {\n\t\t\tqrMetricThroughputRead = *o.MetricThroughputRead\n\t\t}\n\t\tqMetricThroughputRead := swag.FormatInt64(qrMetricThroughputRead)\n\t\tif qMetricThroughputRead != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"metric.throughput.read\", qMetricThroughputRead); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.MetricThroughputTotal != nil {\n\n\t\t// query param metric.throughput.total\n\t\tvar qrMetricThroughputTotal int64\n\n\t\tif o.MetricThroughputTotal != nil {\n\t\t\tqrMetricThroughputTotal = *o.MetricThroughputTotal\n\t\t}\n\t\tqMetricThroughputTotal := swag.FormatInt64(qrMetricThroughputTotal)\n\t\tif qMetricThroughputTotal != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"metric.throughput.total\", qMetricThroughputTotal); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.MetricThroughputWrite != nil {\n\n\t\t// query param metric.throughput.write\n\t\tvar qrMetricThroughputWrite int64\n\n\t\tif o.MetricThroughputWrite != nil {\n\t\t\tqrMetricThroughputWrite = *o.MetricThroughputWrite\n\t\t}\n\t\tqMetricThroughputWrite := swag.FormatInt64(qrMetricThroughputWrite)\n\t\tif qMetricThroughputWrite != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"metric.throughput.write\", qMetricThroughputWrite); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.MetricTimestamp != nil {\n\n\t\t// query param metric.timestamp\n\t\tvar qrMetricTimestamp string\n\n\t\tif o.MetricTimestamp != nil {\n\t\t\tqrMetricTimestamp = *o.MetricTimestamp\n\t\t}\n\t\tqMetricTimestamp := qrMetricTimestamp\n\t\tif qMetricTimestamp != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"metric.timestamp\", qMetricTimestamp); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.OrderBy != nil {\n\n\t\t// binding items for order_by\n\t\tjoinedOrderBy := o.bindParamOrderBy(reg)\n\n\t\t// query array param order_by\n\t\tif err := r.SetQueryParam(\"order_by\", joinedOrderBy...); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.ReturnRecords != nil {\n\n\t\t// query param return_records\n\t\tvar qrReturnRecords bool\n\n\t\tif o.ReturnRecords != nil {\n\t\t\tqrReturnRecords = *o.ReturnRecords\n\t\t}\n\t\tqReturnRecords := swag.FormatBool(qrReturnRecords)\n\t\tif qReturnRecords != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"return_records\", qReturnRecords); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.ReturnTimeout != nil {\n\n\t\t// query param return_timeout\n\t\tvar qrReturnTimeout int64\n\n\t\tif o.ReturnTimeout != nil {\n\t\t\tqrReturnTimeout = *o.ReturnTimeout\n\t\t}\n\t\tqReturnTimeout := swag.FormatInt64(qrReturnTimeout)\n\t\tif qReturnTimeout != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"return_timeout\", qReturnTimeout); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsFcIopsRawOther != nil {\n\n\t\t// query param statistics.fc.iops_raw.other\n\t\tvar qrStatisticsFcIopsRawOther int64\n\n\t\tif o.StatisticsFcIopsRawOther != nil {\n\t\t\tqrStatisticsFcIopsRawOther = *o.StatisticsFcIopsRawOther\n\t\t}\n\t\tqStatisticsFcIopsRawOther := swag.FormatInt64(qrStatisticsFcIopsRawOther)\n\t\tif qStatisticsFcIopsRawOther != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.fc.iops_raw.other\", qStatisticsFcIopsRawOther); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsFcIopsRawRead != nil {\n\n\t\t// query param statistics.fc.iops_raw.read\n\t\tvar qrStatisticsFcIopsRawRead int64\n\n\t\tif o.StatisticsFcIopsRawRead != nil {\n\t\t\tqrStatisticsFcIopsRawRead = *o.StatisticsFcIopsRawRead\n\t\t}\n\t\tqStatisticsFcIopsRawRead := swag.FormatInt64(qrStatisticsFcIopsRawRead)\n\t\tif qStatisticsFcIopsRawRead != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.fc.iops_raw.read\", qStatisticsFcIopsRawRead); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsFcIopsRawTotal != nil {\n\n\t\t// query param statistics.fc.iops_raw.total\n\t\tvar qrStatisticsFcIopsRawTotal int64\n\n\t\tif o.StatisticsFcIopsRawTotal != nil {\n\t\t\tqrStatisticsFcIopsRawTotal = *o.StatisticsFcIopsRawTotal\n\t\t}\n\t\tqStatisticsFcIopsRawTotal := swag.FormatInt64(qrStatisticsFcIopsRawTotal)\n\t\tif qStatisticsFcIopsRawTotal != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.fc.iops_raw.total\", qStatisticsFcIopsRawTotal); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsFcIopsRawWrite != nil {\n\n\t\t// query param statistics.fc.iops_raw.write\n\t\tvar qrStatisticsFcIopsRawWrite int64\n\n\t\tif o.StatisticsFcIopsRawWrite != nil {\n\t\t\tqrStatisticsFcIopsRawWrite = *o.StatisticsFcIopsRawWrite\n\t\t}\n\t\tqStatisticsFcIopsRawWrite := swag.FormatInt64(qrStatisticsFcIopsRawWrite)\n\t\tif qStatisticsFcIopsRawWrite != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.fc.iops_raw.write\", qStatisticsFcIopsRawWrite); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsFcLatencyRawOther != nil {\n\n\t\t// query param statistics.fc.latency_raw.other\n\t\tvar qrStatisticsFcLatencyRawOther int64\n\n\t\tif o.StatisticsFcLatencyRawOther != nil {\n\t\t\tqrStatisticsFcLatencyRawOther = *o.StatisticsFcLatencyRawOther\n\t\t}\n\t\tqStatisticsFcLatencyRawOther := swag.FormatInt64(qrStatisticsFcLatencyRawOther)\n\t\tif qStatisticsFcLatencyRawOther != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.fc.latency_raw.other\", qStatisticsFcLatencyRawOther); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsFcLatencyRawRead != nil {\n\n\t\t// query param statistics.fc.latency_raw.read\n\t\tvar qrStatisticsFcLatencyRawRead int64\n\n\t\tif o.StatisticsFcLatencyRawRead != nil {\n\t\t\tqrStatisticsFcLatencyRawRead = *o.StatisticsFcLatencyRawRead\n\t\t}\n\t\tqStatisticsFcLatencyRawRead := swag.FormatInt64(qrStatisticsFcLatencyRawRead)\n\t\tif qStatisticsFcLatencyRawRead != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.fc.latency_raw.read\", qStatisticsFcLatencyRawRead); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsFcLatencyRawTotal != nil {\n\n\t\t// query param statistics.fc.latency_raw.total\n\t\tvar qrStatisticsFcLatencyRawTotal int64\n\n\t\tif o.StatisticsFcLatencyRawTotal != nil {\n\t\t\tqrStatisticsFcLatencyRawTotal = *o.StatisticsFcLatencyRawTotal\n\t\t}\n\t\tqStatisticsFcLatencyRawTotal := swag.FormatInt64(qrStatisticsFcLatencyRawTotal)\n\t\tif qStatisticsFcLatencyRawTotal != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.fc.latency_raw.total\", qStatisticsFcLatencyRawTotal); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsFcLatencyRawWrite != nil {\n\n\t\t// query param statistics.fc.latency_raw.write\n\t\tvar qrStatisticsFcLatencyRawWrite int64\n\n\t\tif o.StatisticsFcLatencyRawWrite != nil {\n\t\t\tqrStatisticsFcLatencyRawWrite = *o.StatisticsFcLatencyRawWrite\n\t\t}\n\t\tqStatisticsFcLatencyRawWrite := swag.FormatInt64(qrStatisticsFcLatencyRawWrite)\n\t\tif qStatisticsFcLatencyRawWrite != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.fc.latency_raw.write\", qStatisticsFcLatencyRawWrite); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsFcStatus != nil {\n\n\t\t// query param statistics.fc.status\n\t\tvar qrStatisticsFcStatus string\n\n\t\tif o.StatisticsFcStatus != nil {\n\t\t\tqrStatisticsFcStatus = *o.StatisticsFcStatus\n\t\t}\n\t\tqStatisticsFcStatus := qrStatisticsFcStatus\n\t\tif qStatisticsFcStatus != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.fc.status\", qStatisticsFcStatus); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsFcThroughputRawRead != nil {\n\n\t\t// query param statistics.fc.throughput_raw.read\n\t\tvar qrStatisticsFcThroughputRawRead int64\n\n\t\tif o.StatisticsFcThroughputRawRead != nil {\n\t\t\tqrStatisticsFcThroughputRawRead = *o.StatisticsFcThroughputRawRead\n\t\t}\n\t\tqStatisticsFcThroughputRawRead := swag.FormatInt64(qrStatisticsFcThroughputRawRead)\n\t\tif qStatisticsFcThroughputRawRead != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.fc.throughput_raw.read\", qStatisticsFcThroughputRawRead); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsFcThroughputRawTotal != nil {\n\n\t\t// query param statistics.fc.throughput_raw.total\n\t\tvar qrStatisticsFcThroughputRawTotal int64\n\n\t\tif o.StatisticsFcThroughputRawTotal != nil {\n\t\t\tqrStatisticsFcThroughputRawTotal = *o.StatisticsFcThroughputRawTotal\n\t\t}\n\t\tqStatisticsFcThroughputRawTotal := swag.FormatInt64(qrStatisticsFcThroughputRawTotal)\n\t\tif qStatisticsFcThroughputRawTotal != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.fc.throughput_raw.total\", qStatisticsFcThroughputRawTotal); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsFcThroughputRawWrite != nil {\n\n\t\t// query param statistics.fc.throughput_raw.write\n\t\tvar qrStatisticsFcThroughputRawWrite int64\n\n\t\tif o.StatisticsFcThroughputRawWrite != nil {\n\t\t\tqrStatisticsFcThroughputRawWrite = *o.StatisticsFcThroughputRawWrite\n\t\t}\n\t\tqStatisticsFcThroughputRawWrite := swag.FormatInt64(qrStatisticsFcThroughputRawWrite)\n\t\tif qStatisticsFcThroughputRawWrite != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.fc.throughput_raw.write\", qStatisticsFcThroughputRawWrite); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsFcTimestamp != nil {\n\n\t\t// query param statistics.fc.timestamp\n\t\tvar qrStatisticsFcTimestamp string\n\n\t\tif o.StatisticsFcTimestamp != nil {\n\t\t\tqrStatisticsFcTimestamp = *o.StatisticsFcTimestamp\n\t\t}\n\t\tqStatisticsFcTimestamp := qrStatisticsFcTimestamp\n\t\tif qStatisticsFcTimestamp != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.fc.timestamp\", qStatisticsFcTimestamp); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsIopsRawOther != nil {\n\n\t\t// query param statistics.iops_raw.other\n\t\tvar qrStatisticsIopsRawOther int64\n\n\t\tif o.StatisticsIopsRawOther != nil {\n\t\t\tqrStatisticsIopsRawOther = *o.StatisticsIopsRawOther\n\t\t}\n\t\tqStatisticsIopsRawOther := swag.FormatInt64(qrStatisticsIopsRawOther)\n\t\tif qStatisticsIopsRawOther != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.iops_raw.other\", qStatisticsIopsRawOther); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsIopsRawRead != nil {\n\n\t\t// query param statistics.iops_raw.read\n\t\tvar qrStatisticsIopsRawRead int64\n\n\t\tif o.StatisticsIopsRawRead != nil {\n\t\t\tqrStatisticsIopsRawRead = *o.StatisticsIopsRawRead\n\t\t}\n\t\tqStatisticsIopsRawRead := swag.FormatInt64(qrStatisticsIopsRawRead)\n\t\tif qStatisticsIopsRawRead != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.iops_raw.read\", qStatisticsIopsRawRead); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsIopsRawTotal != nil {\n\n\t\t// query param statistics.iops_raw.total\n\t\tvar qrStatisticsIopsRawTotal int64\n\n\t\tif o.StatisticsIopsRawTotal != nil {\n\t\t\tqrStatisticsIopsRawTotal = *o.StatisticsIopsRawTotal\n\t\t}\n\t\tqStatisticsIopsRawTotal := swag.FormatInt64(qrStatisticsIopsRawTotal)\n\t\tif qStatisticsIopsRawTotal != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.iops_raw.total\", qStatisticsIopsRawTotal); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsIopsRawWrite != nil {\n\n\t\t// query param statistics.iops_raw.write\n\t\tvar qrStatisticsIopsRawWrite int64\n\n\t\tif o.StatisticsIopsRawWrite != nil {\n\t\t\tqrStatisticsIopsRawWrite = *o.StatisticsIopsRawWrite\n\t\t}\n\t\tqStatisticsIopsRawWrite := swag.FormatInt64(qrStatisticsIopsRawWrite)\n\t\tif qStatisticsIopsRawWrite != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.iops_raw.write\", qStatisticsIopsRawWrite); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsLatencyRawOther != nil {\n\n\t\t// query param statistics.latency_raw.other\n\t\tvar qrStatisticsLatencyRawOther int64\n\n\t\tif o.StatisticsLatencyRawOther != nil {\n\t\t\tqrStatisticsLatencyRawOther = *o.StatisticsLatencyRawOther\n\t\t}\n\t\tqStatisticsLatencyRawOther := swag.FormatInt64(qrStatisticsLatencyRawOther)\n\t\tif qStatisticsLatencyRawOther != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.latency_raw.other\", qStatisticsLatencyRawOther); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsLatencyRawRead != nil {\n\n\t\t// query param statistics.latency_raw.read\n\t\tvar qrStatisticsLatencyRawRead int64\n\n\t\tif o.StatisticsLatencyRawRead != nil {\n\t\t\tqrStatisticsLatencyRawRead = *o.StatisticsLatencyRawRead\n\t\t}\n\t\tqStatisticsLatencyRawRead := swag.FormatInt64(qrStatisticsLatencyRawRead)\n\t\tif qStatisticsLatencyRawRead != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.latency_raw.read\", qStatisticsLatencyRawRead); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsLatencyRawTotal != nil {\n\n\t\t// query param statistics.latency_raw.total\n\t\tvar qrStatisticsLatencyRawTotal int64\n\n\t\tif o.StatisticsLatencyRawTotal != nil {\n\t\t\tqrStatisticsLatencyRawTotal = *o.StatisticsLatencyRawTotal\n\t\t}\n\t\tqStatisticsLatencyRawTotal := swag.FormatInt64(qrStatisticsLatencyRawTotal)\n\t\tif qStatisticsLatencyRawTotal != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.latency_raw.total\", qStatisticsLatencyRawTotal); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsLatencyRawWrite != nil {\n\n\t\t// query param statistics.latency_raw.write\n\t\tvar qrStatisticsLatencyRawWrite int64\n\n\t\tif o.StatisticsLatencyRawWrite != nil {\n\t\t\tqrStatisticsLatencyRawWrite = *o.StatisticsLatencyRawWrite\n\t\t}\n\t\tqStatisticsLatencyRawWrite := swag.FormatInt64(qrStatisticsLatencyRawWrite)\n\t\tif qStatisticsLatencyRawWrite != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.latency_raw.write\", qStatisticsLatencyRawWrite); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsStatus != nil {\n\n\t\t// query param statistics.status\n\t\tvar qrStatisticsStatus string\n\n\t\tif o.StatisticsStatus != nil {\n\t\t\tqrStatisticsStatus = *o.StatisticsStatus\n\t\t}\n\t\tqStatisticsStatus := qrStatisticsStatus\n\t\tif qStatisticsStatus != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.status\", qStatisticsStatus); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsTCPIopsRawOther != nil {\n\n\t\t// query param statistics.tcp.iops_raw.other\n\t\tvar qrStatisticsTCPIopsRawOther int64\n\n\t\tif o.StatisticsTCPIopsRawOther != nil {\n\t\t\tqrStatisticsTCPIopsRawOther = *o.StatisticsTCPIopsRawOther\n\t\t}\n\t\tqStatisticsTCPIopsRawOther := swag.FormatInt64(qrStatisticsTCPIopsRawOther)\n\t\tif qStatisticsTCPIopsRawOther != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.tcp.iops_raw.other\", qStatisticsTCPIopsRawOther); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsTCPIopsRawRead != nil {\n\n\t\t// query param statistics.tcp.iops_raw.read\n\t\tvar qrStatisticsTCPIopsRawRead int64\n\n\t\tif o.StatisticsTCPIopsRawRead != nil {\n\t\t\tqrStatisticsTCPIopsRawRead = *o.StatisticsTCPIopsRawRead\n\t\t}\n\t\tqStatisticsTCPIopsRawRead := swag.FormatInt64(qrStatisticsTCPIopsRawRead)\n\t\tif qStatisticsTCPIopsRawRead != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.tcp.iops_raw.read\", qStatisticsTCPIopsRawRead); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsTCPIopsRawTotal != nil {\n\n\t\t// query param statistics.tcp.iops_raw.total\n\t\tvar qrStatisticsTCPIopsRawTotal int64\n\n\t\tif o.StatisticsTCPIopsRawTotal != nil {\n\t\t\tqrStatisticsTCPIopsRawTotal = *o.StatisticsTCPIopsRawTotal\n\t\t}\n\t\tqStatisticsTCPIopsRawTotal := swag.FormatInt64(qrStatisticsTCPIopsRawTotal)\n\t\tif qStatisticsTCPIopsRawTotal != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.tcp.iops_raw.total\", qStatisticsTCPIopsRawTotal); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsTCPIopsRawWrite != nil {\n\n\t\t// query param statistics.tcp.iops_raw.write\n\t\tvar qrStatisticsTCPIopsRawWrite int64\n\n\t\tif o.StatisticsTCPIopsRawWrite != nil {\n\t\t\tqrStatisticsTCPIopsRawWrite = *o.StatisticsTCPIopsRawWrite\n\t\t}\n\t\tqStatisticsTCPIopsRawWrite := swag.FormatInt64(qrStatisticsTCPIopsRawWrite)\n\t\tif qStatisticsTCPIopsRawWrite != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.tcp.iops_raw.write\", qStatisticsTCPIopsRawWrite); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsTCPLatencyRawOther != nil {\n\n\t\t// query param statistics.tcp.latency_raw.other\n\t\tvar qrStatisticsTCPLatencyRawOther int64\n\n\t\tif o.StatisticsTCPLatencyRawOther != nil {\n\t\t\tqrStatisticsTCPLatencyRawOther = *o.StatisticsTCPLatencyRawOther\n\t\t}\n\t\tqStatisticsTCPLatencyRawOther := swag.FormatInt64(qrStatisticsTCPLatencyRawOther)\n\t\tif qStatisticsTCPLatencyRawOther != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.tcp.latency_raw.other\", qStatisticsTCPLatencyRawOther); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsTCPLatencyRawRead != nil {\n\n\t\t// query param statistics.tcp.latency_raw.read\n\t\tvar qrStatisticsTCPLatencyRawRead int64\n\n\t\tif o.StatisticsTCPLatencyRawRead != nil {\n\t\t\tqrStatisticsTCPLatencyRawRead = *o.StatisticsTCPLatencyRawRead\n\t\t}\n\t\tqStatisticsTCPLatencyRawRead := swag.FormatInt64(qrStatisticsTCPLatencyRawRead)\n\t\tif qStatisticsTCPLatencyRawRead != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.tcp.latency_raw.read\", qStatisticsTCPLatencyRawRead); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsTCPLatencyRawTotal != nil {\n\n\t\t// query param statistics.tcp.latency_raw.total\n\t\tvar qrStatisticsTCPLatencyRawTotal int64\n\n\t\tif o.StatisticsTCPLatencyRawTotal != nil {\n\t\t\tqrStatisticsTCPLatencyRawTotal = *o.StatisticsTCPLatencyRawTotal\n\t\t}\n\t\tqStatisticsTCPLatencyRawTotal := swag.FormatInt64(qrStatisticsTCPLatencyRawTotal)\n\t\tif qStatisticsTCPLatencyRawTotal != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.tcp.latency_raw.total\", qStatisticsTCPLatencyRawTotal); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsTCPLatencyRawWrite != nil {\n\n\t\t// query param statistics.tcp.latency_raw.write\n\t\tvar qrStatisticsTCPLatencyRawWrite int64\n\n\t\tif o.StatisticsTCPLatencyRawWrite != nil {\n\t\t\tqrStatisticsTCPLatencyRawWrite = *o.StatisticsTCPLatencyRawWrite\n\t\t}\n\t\tqStatisticsTCPLatencyRawWrite := swag.FormatInt64(qrStatisticsTCPLatencyRawWrite)\n\t\tif qStatisticsTCPLatencyRawWrite != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.tcp.latency_raw.write\", qStatisticsTCPLatencyRawWrite); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsTCPStatus != nil {\n\n\t\t// query param statistics.tcp.status\n\t\tvar qrStatisticsTCPStatus string\n\n\t\tif o.StatisticsTCPStatus != nil {\n\t\t\tqrStatisticsTCPStatus = *o.StatisticsTCPStatus\n\t\t}\n\t\tqStatisticsTCPStatus := qrStatisticsTCPStatus\n\t\tif qStatisticsTCPStatus != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.tcp.status\", qStatisticsTCPStatus); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsTCPThroughputRawRead != nil {\n\n\t\t// query param statistics.tcp.throughput_raw.read\n\t\tvar qrStatisticsTCPThroughputRawRead int64\n\n\t\tif o.StatisticsTCPThroughputRawRead != nil {\n\t\t\tqrStatisticsTCPThroughputRawRead = *o.StatisticsTCPThroughputRawRead\n\t\t}\n\t\tqStatisticsTCPThroughputRawRead := swag.FormatInt64(qrStatisticsTCPThroughputRawRead)\n\t\tif qStatisticsTCPThroughputRawRead != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.tcp.throughput_raw.read\", qStatisticsTCPThroughputRawRead); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsTCPThroughputRawTotal != nil {\n\n\t\t// query param statistics.tcp.throughput_raw.total\n\t\tvar qrStatisticsTCPThroughputRawTotal int64\n\n\t\tif o.StatisticsTCPThroughputRawTotal != nil {\n\t\t\tqrStatisticsTCPThroughputRawTotal = *o.StatisticsTCPThroughputRawTotal\n\t\t}\n\t\tqStatisticsTCPThroughputRawTotal := swag.FormatInt64(qrStatisticsTCPThroughputRawTotal)\n\t\tif qStatisticsTCPThroughputRawTotal != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.tcp.throughput_raw.total\", qStatisticsTCPThroughputRawTotal); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsTCPThroughputRawWrite != nil {\n\n\t\t// query param statistics.tcp.throughput_raw.write\n\t\tvar qrStatisticsTCPThroughputRawWrite int64\n\n\t\tif o.StatisticsTCPThroughputRawWrite != nil {\n\t\t\tqrStatisticsTCPThroughputRawWrite = *o.StatisticsTCPThroughputRawWrite\n\t\t}\n\t\tqStatisticsTCPThroughputRawWrite := swag.FormatInt64(qrStatisticsTCPThroughputRawWrite)\n\t\tif qStatisticsTCPThroughputRawWrite != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.tcp.throughput_raw.write\", qStatisticsTCPThroughputRawWrite); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsTCPTimestamp != nil {\n\n\t\t// query param statistics.tcp.timestamp\n\t\tvar qrStatisticsTCPTimestamp string\n\n\t\tif o.StatisticsTCPTimestamp != nil {\n\t\t\tqrStatisticsTCPTimestamp = *o.StatisticsTCPTimestamp\n\t\t}\n\t\tqStatisticsTCPTimestamp := qrStatisticsTCPTimestamp\n\t\tif qStatisticsTCPTimestamp != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.tcp.timestamp\", qStatisticsTCPTimestamp); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsThroughputRawRead != nil {\n\n\t\t// query param statistics.throughput_raw.read\n\t\tvar qrStatisticsThroughputRawRead int64\n\n\t\tif o.StatisticsThroughputRawRead != nil {\n\t\t\tqrStatisticsThroughputRawRead = *o.StatisticsThroughputRawRead\n\t\t}\n\t\tqStatisticsThroughputRawRead := swag.FormatInt64(qrStatisticsThroughputRawRead)\n\t\tif qStatisticsThroughputRawRead != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.throughput_raw.read\", qStatisticsThroughputRawRead); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsThroughputRawTotal != nil {\n\n\t\t// query param statistics.throughput_raw.total\n\t\tvar qrStatisticsThroughputRawTotal int64\n\n\t\tif o.StatisticsThroughputRawTotal != nil {\n\t\t\tqrStatisticsThroughputRawTotal = *o.StatisticsThroughputRawTotal\n\t\t}\n\t\tqStatisticsThroughputRawTotal := swag.FormatInt64(qrStatisticsThroughputRawTotal)\n\t\tif qStatisticsThroughputRawTotal != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.throughput_raw.total\", qStatisticsThroughputRawTotal); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsThroughputRawWrite != nil {\n\n\t\t// query param statistics.throughput_raw.write\n\t\tvar qrStatisticsThroughputRawWrite int64\n\n\t\tif o.StatisticsThroughputRawWrite != nil {\n\t\t\tqrStatisticsThroughputRawWrite = *o.StatisticsThroughputRawWrite\n\t\t}\n\t\tqStatisticsThroughputRawWrite := swag.FormatInt64(qrStatisticsThroughputRawWrite)\n\t\tif qStatisticsThroughputRawWrite != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.throughput_raw.write\", qStatisticsThroughputRawWrite); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsTimestamp != nil {\n\n\t\t// query param statistics.timestamp\n\t\tvar qrStatisticsTimestamp string\n\n\t\tif o.StatisticsTimestamp != nil {\n\t\t\tqrStatisticsTimestamp = *o.StatisticsTimestamp\n\t\t}\n\t\tqStatisticsTimestamp := qrStatisticsTimestamp\n\t\tif qStatisticsTimestamp != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.timestamp\", qStatisticsTimestamp); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.SvmName != nil {\n\n\t\t// query param svm.name\n\t\tvar qrSvmName string\n\n\t\tif o.SvmName != nil {\n\t\t\tqrSvmName = *o.SvmName\n\t\t}\n\t\tqSvmName := qrSvmName\n\t\tif qSvmName != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"svm.name\", qSvmName); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.SvmUUID != nil {\n\n\t\t// query param svm.uuid\n\t\tvar qrSvmUUID string\n\n\t\tif o.SvmUUID != nil {\n\t\t\tqrSvmUUID = *o.SvmUUID\n\t\t}\n\t\tqSvmUUID := qrSvmUUID\n\t\tif qSvmUUID != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"svm.uuid\", qSvmUUID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\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": "416d6d548da0296edde7a4670d0a51a8", "score": "0.6583228", "text": "func (o *UserCurrentPutStarParams) 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\t// path param owner\n\tif err := r.SetPathParam(\"owner\", o.Owner); err != nil {\n\t\treturn err\n\t}\n\n\t// path param repo\n\tif err := r.SetPathParam(\"repo\", o.Repo); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" } ]
e56dbee69f119e56ce8b6cdf9add03f8
UnmarshalJSON is the custom unmarshaler for MHSMPrivateLinkResource struct.
[ { "docid": "b3e773d7ce80a77c114c91eebc3ef5e3", "score": "0.8470675", "text": "func (mplr *MHSMPrivateLinkResource) UnmarshalJSON(body []byte) error {\n\tvar m map[string]*json.RawMessage\n\terr := json.Unmarshal(body, &m)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor k, v := range m {\n\t\tswitch k {\n\t\tcase \"properties\":\n\t\t\tif v != nil {\n\t\t\t\tvar mHSMPrivateLinkResourceProperties MHSMPrivateLinkResourceProperties\n\t\t\t\terr = json.Unmarshal(*v, &mHSMPrivateLinkResourceProperties)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tmplr.MHSMPrivateLinkResourceProperties = &mHSMPrivateLinkResourceProperties\n\t\t\t}\n\t\tcase \"id\":\n\t\t\tif v != nil {\n\t\t\t\tvar ID string\n\t\t\t\terr = json.Unmarshal(*v, &ID)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tmplr.ID = &ID\n\t\t\t}\n\t\tcase \"name\":\n\t\t\tif v != nil {\n\t\t\t\tvar name string\n\t\t\t\terr = json.Unmarshal(*v, &name)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tmplr.Name = &name\n\t\t\t}\n\t\tcase \"type\":\n\t\t\tif v != nil {\n\t\t\t\tvar typeVar string\n\t\t\t\terr = json.Unmarshal(*v, &typeVar)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tmplr.Type = &typeVar\n\t\t\t}\n\t\tcase \"location\":\n\t\t\tif v != nil {\n\t\t\t\tvar location string\n\t\t\t\terr = json.Unmarshal(*v, &location)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tmplr.Location = &location\n\t\t\t}\n\t\tcase \"sku\":\n\t\t\tif v != nil {\n\t\t\t\tvar sku ManagedHsmSku\n\t\t\t\terr = json.Unmarshal(*v, &sku)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tmplr.Sku = &sku\n\t\t\t}\n\t\tcase \"tags\":\n\t\t\tif v != nil {\n\t\t\t\tvar tags map[string]*string\n\t\t\t\terr = json.Unmarshal(*v, &tags)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tmplr.Tags = tags\n\t\t\t}\n\t\tcase \"systemData\":\n\t\t\tif v != nil {\n\t\t\t\tvar systemData SystemData\n\t\t\t\terr = json.Unmarshal(*v, &systemData)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tmplr.SystemData = &systemData\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" } ]
[ { "docid": "ace79e42d65d6428868431e40ba8b846", "score": "0.7804905", "text": "func (p *PrivateLinkResource) 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\", p, 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\", &p.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &p.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &p.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"systemData\":\n\t\t\terr = unpopulate(val, \"SystemData\", &p.SystemData)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &p.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", p, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ace79e42d65d6428868431e40ba8b846", "score": "0.7804905", "text": "func (p *PrivateLinkResource) 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\", p, 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\", &p.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &p.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &p.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"systemData\":\n\t\t\terr = unpopulate(val, \"SystemData\", &p.SystemData)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &p.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", p, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "483b4d8c2e6a3ccde651c29c82ffcb42", "score": "0.77645594", "text": "func (p *PrivateLinkResource) 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\", p, 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\", &p.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &p.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &p.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &p.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", p, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6db8e9d7b7cb3e7394c08b2dc1cd9fd3", "score": "0.7673361", "text": "func (plr *PrivateLinkResource) UnmarshalJSON(body []byte) error {\n\tvar m map[string]*json.RawMessage\n\terr := json.Unmarshal(body, &m)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor k, v := range m {\n\t\tswitch k {\n\t\tcase \"properties\":\n\t\t\tif v != nil {\n\t\t\t\tvar privateLinkResourceProperties PrivateLinkResourceProperties\n\t\t\t\terr = json.Unmarshal(*v, &privateLinkResourceProperties)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tplr.PrivateLinkResourceProperties = &privateLinkResourceProperties\n\t\t\t}\n\t\tcase \"id\":\n\t\t\tif v != nil {\n\t\t\t\tvar ID string\n\t\t\t\terr = json.Unmarshal(*v, &ID)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tplr.ID = &ID\n\t\t\t}\n\t\tcase \"name\":\n\t\t\tif v != nil {\n\t\t\t\tvar name string\n\t\t\t\terr = json.Unmarshal(*v, &name)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tplr.Name = &name\n\t\t\t}\n\t\tcase \"type\":\n\t\t\tif v != nil {\n\t\t\t\tvar typeVar string\n\t\t\t\terr = json.Unmarshal(*v, &typeVar)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tplr.Type = &typeVar\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6db8e9d7b7cb3e7394c08b2dc1cd9fd3", "score": "0.7673361", "text": "func (plr *PrivateLinkResource) UnmarshalJSON(body []byte) error {\n\tvar m map[string]*json.RawMessage\n\terr := json.Unmarshal(body, &m)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor k, v := range m {\n\t\tswitch k {\n\t\tcase \"properties\":\n\t\t\tif v != nil {\n\t\t\t\tvar privateLinkResourceProperties PrivateLinkResourceProperties\n\t\t\t\terr = json.Unmarshal(*v, &privateLinkResourceProperties)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tplr.PrivateLinkResourceProperties = &privateLinkResourceProperties\n\t\t\t}\n\t\tcase \"id\":\n\t\t\tif v != nil {\n\t\t\t\tvar ID string\n\t\t\t\terr = json.Unmarshal(*v, &ID)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tplr.ID = &ID\n\t\t\t}\n\t\tcase \"name\":\n\t\t\tif v != nil {\n\t\t\t\tvar name string\n\t\t\t\terr = json.Unmarshal(*v, &name)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tplr.Name = &name\n\t\t\t}\n\t\tcase \"type\":\n\t\t\tif v != nil {\n\t\t\t\tvar typeVar string\n\t\t\t\terr = json.Unmarshal(*v, &typeVar)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tplr.Type = &typeVar\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6db8e9d7b7cb3e7394c08b2dc1cd9fd3", "score": "0.7673361", "text": "func (plr *PrivateLinkResource) UnmarshalJSON(body []byte) error {\n\tvar m map[string]*json.RawMessage\n\terr := json.Unmarshal(body, &m)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor k, v := range m {\n\t\tswitch k {\n\t\tcase \"properties\":\n\t\t\tif v != nil {\n\t\t\t\tvar privateLinkResourceProperties PrivateLinkResourceProperties\n\t\t\t\terr = json.Unmarshal(*v, &privateLinkResourceProperties)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tplr.PrivateLinkResourceProperties = &privateLinkResourceProperties\n\t\t\t}\n\t\tcase \"id\":\n\t\t\tif v != nil {\n\t\t\t\tvar ID string\n\t\t\t\terr = json.Unmarshal(*v, &ID)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tplr.ID = &ID\n\t\t\t}\n\t\tcase \"name\":\n\t\t\tif v != nil {\n\t\t\t\tvar name string\n\t\t\t\terr = json.Unmarshal(*v, &name)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tplr.Name = &name\n\t\t\t}\n\t\tcase \"type\":\n\t\t\tif v != nil {\n\t\t\t\tvar typeVar string\n\t\t\t\terr = json.Unmarshal(*v, &typeVar)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tplr.Type = &typeVar\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6db8e9d7b7cb3e7394c08b2dc1cd9fd3", "score": "0.7673361", "text": "func (plr *PrivateLinkResource) UnmarshalJSON(body []byte) error {\n\tvar m map[string]*json.RawMessage\n\terr := json.Unmarshal(body, &m)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor k, v := range m {\n\t\tswitch k {\n\t\tcase \"properties\":\n\t\t\tif v != nil {\n\t\t\t\tvar privateLinkResourceProperties PrivateLinkResourceProperties\n\t\t\t\terr = json.Unmarshal(*v, &privateLinkResourceProperties)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tplr.PrivateLinkResourceProperties = &privateLinkResourceProperties\n\t\t\t}\n\t\tcase \"id\":\n\t\t\tif v != nil {\n\t\t\t\tvar ID string\n\t\t\t\terr = json.Unmarshal(*v, &ID)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tplr.ID = &ID\n\t\t\t}\n\t\tcase \"name\":\n\t\t\tif v != nil {\n\t\t\t\tvar name string\n\t\t\t\terr = json.Unmarshal(*v, &name)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tplr.Name = &name\n\t\t\t}\n\t\tcase \"type\":\n\t\t\tif v != nil {\n\t\t\t\tvar typeVar string\n\t\t\t\terr = json.Unmarshal(*v, &typeVar)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tplr.Type = &typeVar\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "05cb84f33e197122964decb15bad6981", "score": "0.7630503", "text": "func (plr *PrivateLinkResource) UnmarshalJSON(body []byte) error {\n\tvar m map[string]*json.RawMessage\n\terr := json.Unmarshal(body, &m)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor k, v := range m {\n\t\tswitch k {\n\t\tcase \"properties\":\n\t\t\tif v != nil {\n\t\t\t\tvar privateLinkResourceProperties PrivateLinkResourceProperties\n\t\t\t\terr = json.Unmarshal(*v, &privateLinkResourceProperties)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tplr.PrivateLinkResourceProperties = &privateLinkResourceProperties\n\t\t\t}\n\t\tcase \"id\":\n\t\t\tif v != nil {\n\t\t\t\tvar ID string\n\t\t\t\terr = json.Unmarshal(*v, &ID)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tplr.ID = &ID\n\t\t\t}\n\t\tcase \"name\":\n\t\t\tif v != nil {\n\t\t\t\tvar name string\n\t\t\t\terr = json.Unmarshal(*v, &name)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tplr.Name = &name\n\t\t\t}\n\t\tcase \"location\":\n\t\t\tif v != nil {\n\t\t\t\tvar location string\n\t\t\t\terr = json.Unmarshal(*v, &location)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tplr.Location = &location\n\t\t\t}\n\t\tcase \"type\":\n\t\t\tif v != nil {\n\t\t\t\tvar typeVar string\n\t\t\t\terr = json.Unmarshal(*v, &typeVar)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tplr.Type = &typeVar\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "44891af004de3a6b9c5b75a6ff1f9a54", "score": "0.76011515", "text": "func (plr *PrivateLinkResource) UnmarshalJSON(body []byte) error {\n\tvar m map[string]*json.RawMessage\n\terr := json.Unmarshal(body, &m)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor k, v := range m {\n\t\tswitch k {\n\t\tcase \"properties\":\n\t\t\tif v != nil {\n\t\t\t\tvar privateLinkResourceProperties PrivateLinkResourceProperties\n\t\t\t\terr = json.Unmarshal(*v, &privateLinkResourceProperties)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tplr.PrivateLinkResourceProperties = &privateLinkResourceProperties\n\t\t\t}\n\t\tcase \"id\":\n\t\t\tif v != nil {\n\t\t\t\tvar ID string\n\t\t\t\terr = json.Unmarshal(*v, &ID)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tplr.ID = &ID\n\t\t\t}\n\t\tcase \"name\":\n\t\t\tif v != nil {\n\t\t\t\tvar name string\n\t\t\t\terr = json.Unmarshal(*v, &name)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tplr.Name = &name\n\t\t\t}\n\t\tcase \"type\":\n\t\t\tif v != nil {\n\t\t\t\tvar typeVar string\n\t\t\t\terr = json.Unmarshal(*v, &typeVar)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tplr.Type = &typeVar\n\t\t\t}\n\t\tcase \"location\":\n\t\t\tif v != nil {\n\t\t\t\tvar location string\n\t\t\t\terr = json.Unmarshal(*v, &location)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tplr.Location = &location\n\t\t\t}\n\t\tcase \"tags\":\n\t\t\tif v != nil {\n\t\t\t\tvar tags map[string]*string\n\t\t\t\terr = json.Unmarshal(*v, &tags)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tplr.Tags = tags\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "454f8507dc3cfd439d5dfe5ca0556219", "score": "0.73369896", "text": "func (p *PrivateLinkResourceDescription) 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\", p, 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\", &p.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &p.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &p.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"systemData\":\n\t\t\terr = unpopulate(val, \"SystemData\", &p.SystemData)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &p.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", p, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4f1d276f93f91bfc80324943336c0b86", "score": "0.7268583", "text": "func (p *PrivateLinkResourceProperties) 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\", p, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"groupId\":\n\t\t\terr = unpopulate(val, \"GroupID\", &p.GroupID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"requiredMembers\":\n\t\t\terr = unpopulate(val, \"RequiredMembers\", &p.RequiredMembers)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"requiredZoneNames\":\n\t\t\terr = unpopulate(val, \"RequiredZoneNames\", &p.RequiredZoneNames)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", p, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4f1d276f93f91bfc80324943336c0b86", "score": "0.7268583", "text": "func (p *PrivateLinkResourceProperties) 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\", p, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"groupId\":\n\t\t\terr = unpopulate(val, \"GroupID\", &p.GroupID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"requiredMembers\":\n\t\t\terr = unpopulate(val, \"RequiredMembers\", &p.RequiredMembers)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"requiredZoneNames\":\n\t\t\terr = unpopulate(val, \"RequiredZoneNames\", &p.RequiredZoneNames)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", p, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4f1d276f93f91bfc80324943336c0b86", "score": "0.7268583", "text": "func (p *PrivateLinkResourceProperties) 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\", p, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"groupId\":\n\t\t\terr = unpopulate(val, \"GroupID\", &p.GroupID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"requiredMembers\":\n\t\t\terr = unpopulate(val, \"RequiredMembers\", &p.RequiredMembers)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"requiredZoneNames\":\n\t\t\terr = unpopulate(val, \"RequiredZoneNames\", &p.RequiredZoneNames)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", p, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ff1dc12026ba74d306ecc247d8853451", "score": "0.69863886", "text": "func (plrd *PrivateLinkResourceDescription) UnmarshalJSON(body []byte) error {\n\tvar m map[string]*json.RawMessage\n\terr := json.Unmarshal(body, &m)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor k, v := range m {\n\t\tswitch k {\n\t\tcase \"systemData\":\n\t\t\tif v != nil {\n\t\t\t\tvar systemData SystemData\n\t\t\t\terr = json.Unmarshal(*v, &systemData)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tplrd.SystemData = &systemData\n\t\t\t}\n\t\tcase \"properties\":\n\t\t\tif v != nil {\n\t\t\t\tvar privateLinkResourceProperties PrivateLinkResourceProperties\n\t\t\t\terr = json.Unmarshal(*v, &privateLinkResourceProperties)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tplrd.PrivateLinkResourceProperties = &privateLinkResourceProperties\n\t\t\t}\n\t\tcase \"id\":\n\t\t\tif v != nil {\n\t\t\t\tvar ID string\n\t\t\t\terr = json.Unmarshal(*v, &ID)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tplrd.ID = &ID\n\t\t\t}\n\t\tcase \"name\":\n\t\t\tif v != nil {\n\t\t\t\tvar name string\n\t\t\t\terr = json.Unmarshal(*v, &name)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tplrd.Name = &name\n\t\t\t}\n\t\tcase \"type\":\n\t\t\tif v != nil {\n\t\t\t\tvar typeVar string\n\t\t\t\terr = json.Unmarshal(*v, &typeVar)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tplrd.Type = &typeVar\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ec7af33c21e498a30d8d896933a361e5", "score": "0.67911637", "text": "func (p *PrivateLinkResourceListResult) 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\", p, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"nextLink\":\n\t\t\terr = unpopulate(val, \"NextLink\", &p.NextLink)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"value\":\n\t\t\terr = unpopulate(val, \"Value\", &p.Value)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", p, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8851999e9a4cfa5a639e9b31d085808e", "score": "0.655", "text": "func (p *PrivateLinkResourceListResult) 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\", p, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"value\":\n\t\t\terr = unpopulate(val, \"Value\", &p.Value)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", p, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "be9b78ceee50afcc1195e73da7054368", "score": "0.64352137", "text": "func (mpec *MHSMPrivateEndpointConnection) UnmarshalJSON(body []byte) error {\n\tvar m map[string]*json.RawMessage\n\terr := json.Unmarshal(body, &m)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor k, v := range m {\n\t\tswitch k {\n\t\tcase \"properties\":\n\t\t\tif v != nil {\n\t\t\t\tvar mHSMPrivateEndpointConnectionProperties MHSMPrivateEndpointConnectionProperties\n\t\t\t\terr = json.Unmarshal(*v, &mHSMPrivateEndpointConnectionProperties)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tmpec.MHSMPrivateEndpointConnectionProperties = &mHSMPrivateEndpointConnectionProperties\n\t\t\t}\n\t\tcase \"etag\":\n\t\t\tif v != nil {\n\t\t\t\tvar etag string\n\t\t\t\terr = json.Unmarshal(*v, &etag)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tmpec.Etag = &etag\n\t\t\t}\n\t\tcase \"id\":\n\t\t\tif v != nil {\n\t\t\t\tvar ID string\n\t\t\t\terr = json.Unmarshal(*v, &ID)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tmpec.ID = &ID\n\t\t\t}\n\t\tcase \"name\":\n\t\t\tif v != nil {\n\t\t\t\tvar name string\n\t\t\t\terr = json.Unmarshal(*v, &name)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tmpec.Name = &name\n\t\t\t}\n\t\tcase \"type\":\n\t\t\tif v != nil {\n\t\t\t\tvar typeVar string\n\t\t\t\terr = json.Unmarshal(*v, &typeVar)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tmpec.Type = &typeVar\n\t\t\t}\n\t\tcase \"location\":\n\t\t\tif v != nil {\n\t\t\t\tvar location string\n\t\t\t\terr = json.Unmarshal(*v, &location)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tmpec.Location = &location\n\t\t\t}\n\t\tcase \"sku\":\n\t\t\tif v != nil {\n\t\t\t\tvar sku ManagedHsmSku\n\t\t\t\terr = json.Unmarshal(*v, &sku)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tmpec.Sku = &sku\n\t\t\t}\n\t\tcase \"tags\":\n\t\t\tif v != nil {\n\t\t\t\tvar tags map[string]*string\n\t\t\t\terr = json.Unmarshal(*v, &tags)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tmpec.Tags = tags\n\t\t\t}\n\t\tcase \"systemData\":\n\t\t\tif v != nil {\n\t\t\t\tvar systemData SystemData\n\t\t\t\terr = json.Unmarshal(*v, &systemData)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tmpec.SystemData = &systemData\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9ae88e802ab8cd74db0d4a2fdb181aba", "score": "0.641219", "text": "func (mpeci *MHSMPrivateEndpointConnectionItem) UnmarshalJSON(body []byte) error {\n\tvar m map[string]*json.RawMessage\n\terr := json.Unmarshal(body, &m)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor k, v := range m {\n\t\tswitch k {\n\t\tcase \"properties\":\n\t\t\tif v != nil {\n\t\t\t\tvar mHSMPrivateEndpointConnectionProperties MHSMPrivateEndpointConnectionProperties\n\t\t\t\terr = json.Unmarshal(*v, &mHSMPrivateEndpointConnectionProperties)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tmpeci.MHSMPrivateEndpointConnectionProperties = &mHSMPrivateEndpointConnectionProperties\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6dfa69fbd98a395139418490c12949c8", "score": "0.63163775", "text": "func (v *VirtualNetworkLinkSubResourceProperties) 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\", v, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"virtualNetworkLink\":\n\t\t\terr = unpopulate(val, \"VirtualNetworkLink\", &v.VirtualNetworkLink)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", v, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "834172ecce572f5e6de2a2344debbef7", "score": "0.6294079", "text": "func (resources ResourceLinks) UnmarshalJSON(data []byte) error {\n\tvar ccResourceLinks struct {\n\t\tLinks map[string]APILink `json:\"links\"`\n\t}\n\terr := cloudcontroller.DecodeJSON(data, &ccResourceLinks)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor key, val := range ccResourceLinks.Links {\n\t\tresources[key] = val\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "0f1d377f863ff35fa6f155dec9b51399", "score": "0.628336", "text": "func (p *PrivateLinkResourceListResultDescription) 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\", p, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"value\":\n\t\t\terr = unpopulate(val, \"Value\", &p.Value)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", p, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "69620c4a0170801167888980265730f9", "score": "0.62173826", "text": "func (mplr MHSMPrivateLinkResource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif mplr.MHSMPrivateLinkResourceProperties != nil {\n\t\tobjectMap[\"properties\"] = mplr.MHSMPrivateLinkResourceProperties\n\t}\n\tif mplr.Location != nil {\n\t\tobjectMap[\"location\"] = mplr.Location\n\t}\n\tif mplr.Sku != nil {\n\t\tobjectMap[\"sku\"] = mplr.Sku\n\t}\n\tif mplr.Tags != nil {\n\t\tobjectMap[\"tags\"] = mplr.Tags\n\t}\n\tif mplr.SystemData != nil {\n\t\tobjectMap[\"systemData\"] = mplr.SystemData\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "1a7ed898294edafc76ab4e4ede11fc31", "score": "0.62022084", "text": "func (cs *CredentialSpecResource) UnmarshalJSON(b []byte) error {\n\treturn errors.New(\"not implemented\")\n}", "title": "" }, { "docid": "8994a9be2a5d8450d26549b3d7c961e1", "score": "0.59922063", "text": "func (l *Link) UnmarshalJSON(payload []byte) error {\n\t// Links may be null in certain cases, mainly noted in the JSONAPI spec\n\t// with pagination links (http://jsonapi.org/format/#fetching-pagination).\n\tif len(payload) == 4 && string(payload) == \"null\" {\n\t\treturn nil\n\t}\n\n\tif bytes.HasPrefix(payload, stringSuffix) {\n\t\treturn json.Unmarshal(payload, &l.Href)\n\t}\n\n\tif bytes.HasPrefix(payload, objectSuffix) {\n\t\tobj := make(map[string]interface{})\n\t\terr := json.Unmarshal(payload, &obj)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tvar ok bool\n\t\tl.Href, ok = obj[\"href\"].(string)\n\t\tif !ok {\n\t\t\treturn errors.New(`link object expects a \"href\" key`)\n\t\t}\n\n\t\tl.Meta, _ = obj[\"meta\"].(map[string]interface{})\n\t\treturn nil\n\t}\n\n\treturn errors.New(\"expected a JSON encoded string or object\")\n}", "title": "" }, { "docid": "82f7b1b5fbcf7300eab4dd4653ada108", "score": "0.59560436", "text": "func (link *Link) UnmarshalJSON(data []byte) error {\n\treturn jsoninfo.UnmarshalStrictStruct(data, link)\n}", "title": "" }, { "docid": "375e127f35789ca2cadf00fa9bba13b1", "score": "0.58420974", "text": "func (s *StaticSiteUserInvitationResponseResourceProperties) 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\", s, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"expiresOn\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"ExpiresOn\", &s.ExpiresOn)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"invitationUrl\":\n\t\t\terr = unpopulate(val, \"InvitationURL\", &s.InvitationURL)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", s, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "14e85827a85bb1a95b12c0e518c069fb", "score": "0.5753998", "text": "func (r *Resource) UnmarshalJSON(data []byte) error {\n\tres := Resource{}\n\tjsonRes := &jsonResource{}\n\tif err := json.Unmarshal(data, &jsonRes); err != nil {\n\t\treturn err\n\t}\n\n\tres.ObjectMeta = jsonRes.ObjectMeta\n\tres.Relation = jsonRes.Relation\n\tacc, err := UnmarshalAccessAccessor(jsonRes.Access)\n\tif err != nil {\n\t\treturn err\n\t}\n\tres.Access = acc\n\n\tvar resourceJSON map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &resourceJSON); err != nil {\n\t\treturn err\n\t}\n\t// remove already parsed attributes\n\tdelete(resourceJSON, \"access\")\n\tdelete(resourceJSON, \"name\")\n\tdelete(resourceJSON, \"version\")\n\tdelete(resourceJSON, \"relation\")\n\n\ttypedObjectJSONBytes, err := json.Marshal(resourceJSON)\n\tif err != nil {\n\t\treturn err\n\t}\n\tres.TypedObjectAccessor, err = UnmarshalTypedObjectAccessor(typedObjectJSONBytes, KnownTypes{}, customCodec, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*r = res\n\treturn nil\n}", "title": "" }, { "docid": "07aac3121c92b1ea13d28928ac2b3a5c", "score": "0.574159", "text": "func UnmarshalAssociatedResource(m map[string]json.RawMessage, result interface{}) (err error) {\n\tobj := new(AssociatedResource)\n\terr = core.UnmarshalPrimitive(m, \"id\", &obj.ID)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"vault\", &obj.Vault, UnmarshalVaultReference)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"managed_key\", &obj.ManagedKey, UnmarshalManagedKeyReference)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"referenced_keystore\", &obj.ReferencedKeystore, UnmarshalTargetKeystoreReference)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"key_id_in_keystore\", &obj.KeyIdInKeystore)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"name\", &obj.Name)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"type\", &obj.Type)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"com_ibm_cloud_kms_registration\", &obj.ComIbmCloudKmsRegistration, UnmarshalIbmCloudKmsRegistration)\n\tif err != nil {\n\t\treturn\n\t}\n\treflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))\n\treturn\n}", "title": "" }, { "docid": "c4b206cd944ff8fd6405e4a6bfb6c35d", "score": "0.57115686", "text": "func (privKey *PrivKey) UnmarshalJSON(data []byte) error {\n\tstr := \"\"\n\tif err := json.Unmarshal(data, &str); err != nil {\n\t\treturn err\n\t}\n\tbuf, err := base64.RawURLEncoding.DecodeString(str)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, _, err = privKey.Unmarshal(buf, surge.MaxBytes)\n\treturn err\n}", "title": "" }, { "docid": "efb5f73a8a94d7cb1b9d4c2448818f90", "score": "0.5691024", "text": "func (p *PrivateLinkServiceConnectionState) 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\", p, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"actionsRequired\":\n\t\t\terr = unpopulate(val, \"ActionsRequired\", &p.ActionsRequired)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"description\":\n\t\t\terr = unpopulate(val, \"Description\", &p.Description)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"status\":\n\t\t\terr = unpopulate(val, \"Status\", &p.Status)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", p, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "efb5f73a8a94d7cb1b9d4c2448818f90", "score": "0.5691024", "text": "func (p *PrivateLinkServiceConnectionState) 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\", p, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"actionsRequired\":\n\t\t\terr = unpopulate(val, \"ActionsRequired\", &p.ActionsRequired)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"description\":\n\t\t\terr = unpopulate(val, \"Description\", &p.Description)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"status\":\n\t\t\terr = unpopulate(val, \"Status\", &p.Status)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", p, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "efb5f73a8a94d7cb1b9d4c2448818f90", "score": "0.5691024", "text": "func (p *PrivateLinkServiceConnectionState) 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\", p, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"actionsRequired\":\n\t\t\terr = unpopulate(val, \"ActionsRequired\", &p.ActionsRequired)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"description\":\n\t\t\terr = unpopulate(val, \"Description\", &p.Description)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"status\":\n\t\t\terr = unpopulate(val, \"Status\", &p.Status)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", p, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9166113bae8c680b035217eeef06a19d", "score": "0.56600565", "text": "func (linkage *ResourceLinkage) UnmarshalJSON(buf []byte) error {\n\tif len(buf) == 0 {\n\t\treturn nil\n\t}\n\tif buf[0] == '[' {\n\t\treturn json.Unmarshal(buf, &linkage.ToMany)\n\t}\n\treturn json.Unmarshal(buf, &linkage.ToOne)\n}", "title": "" }, { "docid": "524f1fb62dedd247bf3669080647f4c2", "score": "0.5658558", "text": "func (r *Resource) UnmarshalJSON(b []byte) error {\n\tres := make(map[string]json.RawMessage)\n\terr := json.Unmarshal(b, &res)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Verify both fields set in the resource JSON\n\tpattern, patternExists := res[\"pattern\"]\n\tname, nameExists := res[\"name\"]\n\tif !patternExists {\n\t\treturn fmt.Errorf(\"resources must have a 'pattern' field set\")\n\t}\n\tif !nameExists {\n\t\treturn fmt.Errorf(\"resources must have a 'name' field set\")\n\t}\n\n\t// Set r.Pattern from the resource JSON\n\terr = json.Unmarshal(pattern, &r.Pattern)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Set r.Name from the resource JSON\n\terr = json.Unmarshal(name, &r.Name)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "08c41cf4fde3ab31e064801c0baa1e07", "score": "0.56482226", "text": "func (r *ResourceReference) 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\", r, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"dnsResources\":\n\t\t\terr = unpopulate(val, \"DNSResources\", &r.DNSResources)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"targetResource\":\n\t\t\terr = unpopulate(val, \"TargetResource\", &r.TargetResource)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", r, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5fd0533cd9d0a062d467028536faa116", "score": "0.56264645", "text": "func (future *MHSMPrivateEndpointConnectionsDeleteFuture) UnmarshalJSON(body []byte) error {\n\tvar azFuture azure.Future\n\tif err := json.Unmarshal(body, &azFuture); err != nil {\n\t\treturn err\n\t}\n\tfuture.FutureAPI = &azFuture\n\tfuture.Result = future.result\n\treturn nil\n}", "title": "" }, { "docid": "753cafab1b982d034ecedb65cc18ca11", "score": "0.55802345", "text": "func (s *SnapshotResourceList) 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\", s, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"nextLink\":\n\t\t\terr = unpopulate(val, \"NextLink\", &s.NextLink)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"value\":\n\t\t\terr = unpopulate(val, \"Value\", &s.Value)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", s, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "130e0357db4ce43f9f6870922da9210b", "score": "0.5567244", "text": "func (s *SnapshotResource) 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\", s, 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\", &s.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &s.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &s.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"systemData\":\n\t\t\terr = unpopulate(val, \"SystemData\", &s.SystemData)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &s.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", s, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a7ed79bc9c6166883d53f4534c71f7ef", "score": "0.55654895", "text": "func (ld *LinkData) UnmarshalJSON(d []byte) error {\n\tser := &struct {\n\t\tLinkID int `json:\"linkId\"`\n\t\tState int `json:\"state\"`\n\t}{}\n\n\tif err := json.Unmarshal(d, ser); err != nil {\n\t\treturn err\n\t}\n\n\tld.state = ser.State\n\tld.linkID = ser.LinkID\n\n\treturn nil\n}", "title": "" }, { "docid": "d57ab23f29d9291a20797a2a21fb59e1", "score": "0.556492", "text": "func (p *PrivateKey) UnmarshalJSON(data []byte) error {\n\tunquoted, err := strconv.Unquote(string(data))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unquoting string: %w\", err)\n\t}\n\n\tder, _ := pem.Decode([]byte(unquoted))\n\tif der == nil {\n\t\treturn fmt.Errorf(\"decoding PEM format\")\n\t}\n\n\tif err := parsePrivateKey(der.Bytes); err != nil {\n\t\treturn fmt.Errorf(\"parsing private key: %w\", err)\n\t}\n\n\t*p = PrivateKey(unquoted)\n\n\treturn nil\n}", "title": "" }, { "docid": "ad0513e7e0dfde33e3cbc298238cba1d", "score": "0.55209273", "text": "func UnmarshalResource(m map[string]json.RawMessage, result interface{}) (err error) {\n\tobj := new(Resource)\n\terr = core.UnmarshalPrimitive(m, \"type\", &obj.Type)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"value\", &obj.Value)\n\tif err != nil {\n\t\treturn\n\t}\n\treflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))\n\treturn\n}", "title": "" }, { "docid": "bffa094103351a9a8be124dcacb87ffe", "score": "0.5513105", "text": "func (v *SharedStorageURLWithMetadata) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonC5a4559bDecodeGithubComChromedpCdprotoStorage10(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "0e0023f246d554eadbd9b388f27e5dad", "score": "0.5510792", "text": "func (this *AuthorizationPolicy_ExtensionProvider) UnmarshalJSON(b []byte) error {\n\treturn AuthorizationPolicyUnmarshaler.Unmarshal(bytes.NewReader(b), this)\n}", "title": "" }, { "docid": "ecf059816f1c99f2dfd20bc21c2a5b02", "score": "0.5501438", "text": "func (cs *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*cs = CompositionService(t.temp)\n\tcs.resourceBlocks = string(t.ResourceBlocks)\n\tcs.resourceZones = string(t.ResourceZones)\n\n\treturn nil\n}", "title": "" }, { "docid": "f88bfd63c5084d0cec1cf4e9e361d4bd", "score": "0.5501074", "text": "func (s *ServerGroupPropertiesPrivateDNSZoneArguments) 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\", s, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"privateDnsZoneArmResourceId\":\n\t\t\terr = unpopulate(val, \"PrivateDNSZoneArmResourceID\", &s.PrivateDNSZoneArmResourceID)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", s, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "db76c1ecf3d91e1fd8c6774d74037c2a", "score": "0.5493243", "text": "func (s *StaticSiteUserProvidedFunctionAppARMResourceProperties) 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\", s, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"createdOn\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"CreatedOn\", &s.CreatedOn)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"functionAppRegion\":\n\t\t\terr = unpopulate(val, \"FunctionAppRegion\", &s.FunctionAppRegion)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"functionAppResourceId\":\n\t\t\terr = unpopulate(val, \"FunctionAppResourceID\", &s.FunctionAppResourceID)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", s, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5d33a9b8a400330f69662c5974ac7e62", "score": "0.5487985", "text": "func (f *FhirServiceAccessPolicyEntry) 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 \"objectId\":\n\t\t\terr = unpopulate(val, \"ObjectID\", &f.ObjectID)\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": "5bda85ab31574830a558b63b11574f40", "score": "0.5484542", "text": "func (f *FhirServicePatchResource) 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 \"identity\":\n\t\t\terr = unpopulate(val, \"Identity\", &f.Identity)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"tags\":\n\t\t\terr = unpopulate(val, \"Tags\", &f.Tags)\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": "e9fd159c55868c7c438f61c2d3ed0c22", "score": "0.54837424", "text": "func (r *Resource) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\treturn r.unmarshalInternal(rawMsg)\n}", "title": "" }, { "docid": "8a3f80caf1603f07d6f7bf90eecd1950", "score": "0.5466673", "text": "func (r *UnknownResource) UnmarshalJSON(data []byte) (err error) {\n\tif err = json.Unmarshal(data, &r.ResourceHeader); err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\tif err = r.Raw.UnmarshalJSON(data); err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "378b8c0cf45675c3348eb257fc55c07a", "score": "0.545369", "text": "func (v *EventLink) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonD2b7633eDecodeDiplomaProjectApplicationModels29(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "a5ab71b8f26f9d03d22f91e624f5b769", "score": "0.5441163", "text": "func (p *ProxyResource) 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\", p, 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\", &p.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &p.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"systemData\":\n\t\t\terr = unpopulate(val, \"SystemData\", &p.SystemData)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &p.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", p, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "40a4851990ceca12f373939bd9c99b45", "score": "0.54315", "text": "func (x *PrivKey) UnmarshalJSON(b []byte) error {\n\ts := struct {\n\t\tMsgSeed []byte\n\t\tWotsSeed []byte\n\t\tPubSeed []byte\n\t\tRoot []byte\n\t}{}\n\terr := json.Unmarshal(b, &s)\n\tx.msgPRF = newPRF(s.MsgSeed)\n\tx.wotsPRF = newPRF(s.WotsSeed)\n\tx.pubPRF = newPRF(s.PubSeed)\n\tx.root = s.Root\n\treturn err\n}", "title": "" }, { "docid": "c6630e5e578f035737ad05ac96d42545", "score": "0.5414025", "text": "func (r *ResourceProviderConfig) UnmarshalJSON(data []byte) error {\n\tif err := union.Unmarshal(data, r); err != nil {\n\t\treturn err\n\t}\n\ttype DefaultParser *ResourceProviderConfig\n\treturn errors.Wrap(json.Unmarshal(data, DefaultParser(r)), \"failed to parse resource provider\")\n}", "title": "" }, { "docid": "6b3cf17b151d237d21f52cee3f3ee848", "score": "0.54063106", "text": "func (r *Resource) 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\", r, 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\", &r.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &r.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"systemData\":\n\t\t\terr = unpopulate(val, \"SystemData\", &r.SystemData)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &r.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", r, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6b3cf17b151d237d21f52cee3f3ee848", "score": "0.54063106", "text": "func (r *Resource) 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\", r, 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\", &r.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &r.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"systemData\":\n\t\t\terr = unpopulate(val, \"SystemData\", &r.SystemData)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &r.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", r, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "35a10b839fc8a0e70f83e84c31172b6c", "score": "0.5402689", "text": "func (s *SubResourceListResult) 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\", s, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"nextLink\":\n\t\t\terr = unpopulate(val, \"NextLink\", &s.NextLink)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"value\":\n\t\t\terr = unpopulate(val, \"Value\", &s.Value)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", s, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a42782b6a1b59e58172874ffc9b56efb", "score": "0.5402223", "text": "func (c *CveLink) 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\", c, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"href\":\n\t\t\terr = unpopulate(val, \"Href\", &c.Href)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"label\":\n\t\t\terr = unpopulate(val, \"Label\", &c.Label)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", c, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8699af584197a6bf5ea90e39cc35a45c", "score": "0.5398894", "text": "func (d *DicomServicePatchResource) 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\", d, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"identity\":\n\t\t\terr = unpopulate(val, \"Identity\", &d.Identity)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"tags\":\n\t\t\terr = unpopulate(val, \"Tags\", &d.Tags)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", d, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3e509c132abf3c57df314c03f65bf425", "score": "0.539299", "text": "func (v *VirtualNetworkLink) 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\", v, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"etag\":\n\t\t\terr = unpopulate(val, \"Etag\", &v.Etag)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"id\":\n\t\t\terr = unpopulate(val, \"ID\", &v.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &v.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &v.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"systemData\":\n\t\t\terr = unpopulate(val, \"SystemData\", &v.SystemData)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &v.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", v, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6c0c41892704f26d369867e3a49d1269", "score": "0.5387478", "text": "func (v *VirtualNetworkLinkProperties) 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\", v, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"metadata\":\n\t\t\terr = unpopulate(val, \"Metadata\", &v.Metadata)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"provisioningState\":\n\t\t\terr = unpopulate(val, \"ProvisioningState\", &v.ProvisioningState)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"virtualNetwork\":\n\t\t\terr = unpopulate(val, \"VirtualNetwork\", &v.VirtualNetwork)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", v, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2574d4fa0f76f6835fb847045e37cbbd", "score": "0.5386624", "text": "func (r *Resource) 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\", r, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"etag\":\n\t\t\terr = unpopulate(val, \"Etag\", &r.Etag)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"id\":\n\t\t\terr = unpopulate(val, \"ID\", &r.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"location\":\n\t\t\terr = unpopulate(val, \"Location\", &r.Location)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &r.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"systemData\":\n\t\t\terr = unpopulate(val, \"SystemData\", &r.SystemData)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"tags\":\n\t\t\terr = unpopulate(val, \"Tags\", &r.Tags)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &r.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", r, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b6b57e573baf2074f2c331a9a2643e28", "score": "0.5378309", "text": "func (s *SubResource) 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\", s, 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\", &s.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\", s, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b6b57e573baf2074f2c331a9a2643e28", "score": "0.5378309", "text": "func (s *SubResource) 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\", s, 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\", &s.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\", s, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4bc90d2bb07b435e6bc6c2e336388695", "score": "0.5371555", "text": "func (p *ProxyResource) 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\", p, 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\", &p.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &p.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &p.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", p, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4bc90d2bb07b435e6bc6c2e336388695", "score": "0.5371555", "text": "func (p *ProxyResource) 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\", p, 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\", &p.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &p.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &p.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", p, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "449f667a7cce84b617389cde1952c9f1", "score": "0.5362546", "text": "func (r *ResourceMetadata) 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\", r, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"resourceId\":\n\t\t\terr = unpopulate(val, \"ResourceID\", &r.ResourceID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"resourceKind\":\n\t\t\terr = unpopulate(val, \"ResourceKind\", &r.ResourceKind)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"resourceName\":\n\t\t\terr = unpopulate(val, \"ResourceName\", &r.ResourceName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"resourceType\":\n\t\t\terr = unpopulate(val, \"ResourceType\", &r.ResourceType)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"tags\":\n\t\t\terr = unpopulate(val, \"Tags\", &r.Tags)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", r, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "68013989c24b02741c953c243499a994", "score": "0.5355529", "text": "func (v *VirtualNetworkLinkPatchProperties) 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\", v, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"metadata\":\n\t\t\terr = unpopulate(val, \"Metadata\", &v.Metadata)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", v, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "25327780711c7c91591e626e29a52102", "score": "0.53545046", "text": "func (fileshare *FileShare) UnmarshalJSON(b []byte) error {\n\ttype temp FileShare\n\ttype links struct {\n\t\tClassOfService common.Link\n\t\tFileSystem common.Link\n\t}\n\tvar t struct {\n\t\ttemp\n\t\tLinks links\n\t\tEthernetInterfaces 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*fileshare = FileShare(t.temp)\n\tfileshare.classOfService = t.Links.ClassOfService.String()\n\tfileshare.fileSystem = t.Links.FileSystem.String()\n\tfileshare.ethernetInterfaces = t.EthernetInterfaces.String()\n\n\t// This is a read/write object, so we need to save the raw object data for later\n\tfileshare.rawData = b\n\n\treturn nil\n}", "title": "" }, { "docid": "f6115a91005197c05b82e2cd70ed3f4c", "score": "0.53518087", "text": "func (c *ComputeResource) 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\", c, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"memoryInGB\":\n\t\t\terr = unpopulate(val, \"MemoryInGB\", &c.MemoryInGB)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"processorCount\":\n\t\t\terr = unpopulate(val, \"ProcessorCount\", &c.ProcessorCount)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", c, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "127905d0163c4c7049832c152a8a7e28", "score": "0.53337055", "text": "func (r *ResourceReferenceResult) 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\", r, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &r.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", r, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f6df94078cc417efdff0d874e29b4419", "score": "0.5333538", "text": "func (r *Resource) 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\", r, 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\", &r.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &r.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &r.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", r, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f6df94078cc417efdff0d874e29b4419", "score": "0.5333538", "text": "func (r *Resource) 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\", r, 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\", &r.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &r.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &r.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", r, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f6df94078cc417efdff0d874e29b4419", "score": "0.5333538", "text": "func (r *Resource) 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\", r, 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\", &r.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &r.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &r.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", r, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f6df94078cc417efdff0d874e29b4419", "score": "0.5333538", "text": "func (r *Resource) 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\", r, 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\", &r.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &r.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &r.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", r, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f6df94078cc417efdff0d874e29b4419", "score": "0.5333538", "text": "func (r *Resource) 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\", r, 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\", &r.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &r.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &r.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", r, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fcf42e8b192fe072a3024d053aab59ef", "score": "0.53187084", "text": "func (v *VirtualNetworkLinkPatch) 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\", v, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &v.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", v, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "161be21080bbf531b8e16848baaada50", "score": "0.5318419", "text": "func (u *UnknownResource) UnmarshalJSON(raw []byte) error {\n\tvar h ResourceHeader\n\tif err := json.Unmarshal(raw, &h); err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\tu.Raw = make([]byte, len(raw))\n\tu.ResourceHeader = h\n\tcopy(u.Raw, raw)\n\treturn nil\n}", "title": "" }, { "docid": "910e3ab70ee4117e35212b114844f0c3", "score": "0.53066814", "text": "func (a *GetObjectByHeapObjectIDReply) UnmarshalJSON(b []byte) error {\n\ttype Copy GetObjectByHeapObjectIDReply\n\tc := &Copy{}\n\terr := json.Unmarshal(b, c)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*a = GetObjectByHeapObjectIDReply(*c)\n\treturn nil\n}", "title": "" }, { "docid": "f4e91bccd06294b6a11ccd762ecc49b6", "score": "0.530582", "text": "func (mir *MetadataItemRole) UnmarshalJSON(data []byte) (err error) {\n\ttype Shadow MetadataItemRole\n\ttmp := struct {\n\t\tThumb string `json:\"thumb\"`\n\t\t*Shadow\n\t}{\n\t\tShadow: (*Shadow)(mir),\n\t}\n\tif err = json.Unmarshal(data, &tmp); err != nil {\n\t\treturn\n\t}\n\tif tmp.Thumb != \"\" {\n\t\tif mir.Thumb, err = url.Parse(tmp.Thumb); err != nil {\n\t\t\terr = fmt.Errorf(\"can't parse MetadataItemRole thumb as URL: %w\", err)\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "37c19363d5c8885eac09b57102afbd6d", "score": "0.5300973", "text": "func (p *PrivateEndpointConnectionProperties) 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\", p, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"privateEndpoint\":\n\t\t\terr = unpopulate(val, \"PrivateEndpoint\", &p.PrivateEndpoint)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"privateLinkServiceConnectionState\":\n\t\t\terr = unpopulate(val, \"PrivateLinkServiceConnectionState\", &p.PrivateLinkServiceConnectionState)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"provisioningState\":\n\t\t\terr = unpopulate(val, \"ProvisioningState\", &p.ProvisioningState)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", p, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ed87450f91fe7678e7a333bb0ec37044", "score": "0.5299692", "text": "func (r *ResourceItem) 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\", r, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"resourceGroup\":\n\t\t\terr = unpopulate(val, \"ResourceGroup\", &r.ResourceGroup)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"resourceId\":\n\t\t\terr = unpopulate(val, \"ResourceID\", &r.ResourceID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"resourceType\":\n\t\t\terr = unpopulate(val, \"ResourceType\", &r.ResourceType)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"subscriptionId\":\n\t\t\terr = unpopulate(val, \"SubscriptionID\", &r.SubscriptionID)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", r, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a021e549dd8d9185050ab6702a825043", "score": "0.52988195", "text": "func UnmarshalSyndicationResource(m map[string]json.RawMessage, result interface{}) (err error) {\n\tobj := new(SyndicationResource)\n\terr = core.UnmarshalPrimitive(m, \"remove_related_components\", &obj.RemoveRelatedComponents)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"clusters\", &obj.Clusters, UnmarshalSyndicationCluster)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"history\", &obj.History, UnmarshalSyndicationHistory)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"authorization\", &obj.Authorization, UnmarshalSyndicationAuthorization)\n\tif err != nil {\n\t\treturn\n\t}\n\treflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))\n\treturn\n}", "title": "" }, { "docid": "75d0f2536cd3bd85a42827ad935cf2bc", "score": "0.5295238", "text": "func (r *Share) UnmarshalJSON(b []byte) error {\n\ttype tmp Share\n\tvar s struct {\n\t\ttmp\n\t\tCreatedAt golangsdk.JSONRFC3339MilliNoZ `json:\"created_at\"`\n\t\tUpdatedAt golangsdk.JSONRFC3339MilliNoZ `json:\"updated_at\"`\n\t\tDeletedAt golangsdk.JSONRFC3339MilliNoZ `json:\"deleted_at\"`\n\t}\n\terr := json.Unmarshal(b, &s)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*r = Share(s.tmp)\n\n\tr.CreatedAt = time.Time(s.CreatedAt)\n\tr.UpdatedAt = time.Time(s.UpdatedAt)\n\tr.DeletedAt = time.Time(s.DeletedAt)\n\n\treturn nil\n}", "title": "" }, { "docid": "1a20ea48d4044cf62d2ede124f2a8953", "score": "0.5288523", "text": "func (r *Resource) 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\", r, 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\", &r.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"location\":\n\t\t\terr = unpopulate(val, \"Location\", &r.Location)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &r.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"tags\":\n\t\t\terr = unpopulate(val, \"Tags\", &r.Tags)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &r.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", r, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8fc83fab6458cea6fad5b79c60068f0e", "score": "0.52840316", "text": "func (m *AzureKeyVaultPermission) UnmarshalJSON(raw []byte) error {\n\t// AO0\n\tvar aO0 AzureResourcePermission\n\tif err := swag.ReadJSON(raw, &aO0); err != nil {\n\t\treturn err\n\t}\n\tm.AzureResourcePermission = aO0\n\n\t// now for regular properties\n\tvar propsAzureKeyVaultPermission struct {\n\t\tVault string `json:\"vault,omitempty\"`\n\t}\n\tif err := swag.ReadJSON(raw, &propsAzureKeyVaultPermission); err != nil {\n\t\treturn err\n\t}\n\tm.Vault = propsAzureKeyVaultPermission.Vault\n\n\treturn nil\n}", "title": "" }, { "docid": "4fef0580e757505e69b543d7a5d7139d", "score": "0.52734184", "text": "func (s *ServiceAccessPolicyEntry) 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\", s, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"objectId\":\n\t\t\terr = unpopulate(val, \"ObjectID\", &s.ObjectID)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", s, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f299b4b3cf8b131f3d874413b5d5b864", "score": "0.5266934", "text": "func (i *IotConnectorPatchResource) 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\", i, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"identity\":\n\t\t\terr = unpopulate(val, \"Identity\", &i.Identity)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"tags\":\n\t\t\terr = unpopulate(val, \"Tags\", &i.Tags)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", i, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3a613431c990f2569cf55ddf58f1400c", "score": "0.52650595", "text": "func (g *GenericResourceExpanded) 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\", g, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"changedTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"ChangedTime\", &g.ChangedTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"createdTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"CreatedTime\", &g.CreatedTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"extendedLocation\":\n\t\t\terr = unpopulate(val, \"ExtendedLocation\", &g.ExtendedLocation)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"id\":\n\t\t\terr = unpopulate(val, \"ID\", &g.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"identity\":\n\t\t\terr = unpopulate(val, \"Identity\", &g.Identity)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"kind\":\n\t\t\terr = unpopulate(val, \"Kind\", &g.Kind)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"location\":\n\t\t\terr = unpopulate(val, \"Location\", &g.Location)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"managedBy\":\n\t\t\terr = unpopulate(val, \"ManagedBy\", &g.ManagedBy)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &g.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"plan\":\n\t\t\terr = unpopulate(val, \"Plan\", &g.Plan)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &g.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"provisioningState\":\n\t\t\terr = unpopulate(val, \"ProvisioningState\", &g.ProvisioningState)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"sku\":\n\t\t\terr = unpopulate(val, \"SKU\", &g.SKU)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"tags\":\n\t\t\terr = unpopulate(val, \"Tags\", &g.Tags)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &g.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", g, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d6dda07e6524ef2f931789476d2ddb80", "score": "0.52413243", "text": "func (p *PrivateEndpointConnectionProperties) 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\", p, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"groupIds\":\n\t\t\terr = unpopulate(val, \"GroupIDs\", &p.GroupIDs)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"privateEndpoint\":\n\t\t\terr = unpopulate(val, \"PrivateEndpoint\", &p.PrivateEndpoint)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"privateLinkServiceConnectionState\":\n\t\t\terr = unpopulate(val, \"PrivateLinkServiceConnectionState\", &p.PrivateLinkServiceConnectionState)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"provisioningState\":\n\t\t\terr = unpopulate(val, \"ProvisioningState\", &p.ProvisioningState)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", p, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d6dda07e6524ef2f931789476d2ddb80", "score": "0.52413243", "text": "func (p *PrivateEndpointConnectionProperties) 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\", p, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"groupIds\":\n\t\t\terr = unpopulate(val, \"GroupIDs\", &p.GroupIDs)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"privateEndpoint\":\n\t\t\terr = unpopulate(val, \"PrivateEndpoint\", &p.PrivateEndpoint)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"privateLinkServiceConnectionState\":\n\t\t\terr = unpopulate(val, \"PrivateLinkServiceConnectionState\", &p.PrivateLinkServiceConnectionState)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"provisioningState\":\n\t\t\terr = unpopulate(val, \"ProvisioningState\", &p.ProvisioningState)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", p, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "70cdf89b894a3c4088478fe69f040a7e", "score": "0.5233494", "text": "func (p *PrivateEndpointConnectionListResult) 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\", p, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"nextLink\":\n\t\t\terr = unpopulate(val, \"NextLink\", &p.NextLink)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"value\":\n\t\t\terr = unpopulate(val, \"Value\", &p.Value)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", p, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "04b519f7ca7e8eb26591ed344f1f4f16", "score": "0.5227117", "text": "func (i *InvoiceSectionListWithCreateSubPermissionResult) 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\", i, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"nextLink\":\n\t\t\terr = unpopulate(val, \"NextLink\", &i.NextLink)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"value\":\n\t\t\terr = unpopulate(val, \"Value\", &i.Value)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", i, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "90642841c2141168651d7dd08e585fd0", "score": "0.52259755", "text": "func (m *ImageSourceViaObjectStorageURIDetails) UnmarshalJSON(raw []byte) error {\n\tvar data struct {\n\t\tSourceType string `json:\"sourceType\"`\n\n\t\t// The Object Storage Service URL for the image.\n\t\t// Required: true\n\t\tSourceURI *string `json:\"sourceUri\"`\n\t}\n\n\tbuf := bytes.NewBuffer(raw)\n\tdec := json.NewDecoder(buf)\n\tdec.UseNumber()\n\n\tif err := dec.Decode(&data); err != nil {\n\t\treturn err\n\t}\n\n\tm.SourceURI = data.SourceURI\n\n\treturn nil\n}", "title": "" }, { "docid": "2e1aa83e8f54e7daa04d94fa46af6937", "score": "0.5225816", "text": "func (r *ResourceIdentity) 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\", r, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"principalId\":\n\t\t\terr = unpopulate(val, \"PrincipalID\", &r.PrincipalID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"tenantId\":\n\t\t\terr = unpopulate(val, \"TenantID\", &r.TenantID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &r.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", r, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b260df8533e8b4211120c55238af2e52", "score": "0.52115184", "text": "func PrivateLinkResource_ARMGenerator() gopter.Gen {\n\tif privateLinkResource_ARMGenerator != nil {\n\t\treturn privateLinkResource_ARMGenerator\n\t}\n\n\tgenerators := make(map[string]gopter.Gen)\n\tAddIndependentPropertyGeneratorsForPrivateLinkResource_ARM(generators)\n\tprivateLinkResource_ARMGenerator = gen.Struct(reflect.TypeOf(PrivateLinkResource_ARM{}), generators)\n\n\treturn privateLinkResource_ARMGenerator\n}", "title": "" }, { "docid": "13c709fa442a8c642526fab15beddb78", "score": "0.5206184", "text": "func (this *Rule) UnmarshalJSON(b []byte) error {\n\treturn AuthorizationPolicyUnmarshaler.Unmarshal(bytes.NewReader(b), this)\n}", "title": "" }, { "docid": "452437f39b044c5b42b1baf15322d18d", "score": "0.52025354", "text": "func (s *SharePermission) 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\", s, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"permission\":\n\t\t\terr = unpopulate(val, \"Permission\", &s.Permission)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", s, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7161d8a387b54fe4ffaa282c44cec736", "score": "0.5202201", "text": "func (p *PageOfDataControllerResource) 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\", p, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"nextLink\":\n\t\t\terr = unpopulate(val, \"NextLink\", &p.NextLink)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"value\":\n\t\t\terr = unpopulate(val, \"Value\", &p.Value)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", p, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6f099a51df19fdee30cbb80e0d33377d", "score": "0.519128", "text": "func (cr *CertificateResource) UnmarshalJSON(body []byte) error {\n\tvar m map[string]*json.RawMessage\n\terr := json.Unmarshal(body, &m)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor k, v := range m {\n\t\tswitch k {\n\t\tcase \"properties\":\n\t\t\tif v != nil {\n\t\t\t\tproperties, err := unmarshalBasicCertificateProperties(*v)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tcr.Properties = properties\n\t\t\t}\n\t\tcase \"id\":\n\t\t\tif v != nil {\n\t\t\t\tvar ID string\n\t\t\t\terr = json.Unmarshal(*v, &ID)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tcr.ID = &ID\n\t\t\t}\n\t\tcase \"name\":\n\t\t\tif v != nil {\n\t\t\t\tvar name string\n\t\t\t\terr = json.Unmarshal(*v, &name)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tcr.Name = &name\n\t\t\t}\n\t\tcase \"type\":\n\t\t\tif v != nil {\n\t\t\t\tvar typeVar string\n\t\t\t\terr = json.Unmarshal(*v, &typeVar)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tcr.Type = &typeVar\n\t\t\t}\n\t\tcase \"systemData\":\n\t\t\tif v != nil {\n\t\t\t\tvar systemData SystemData\n\t\t\t\terr = json.Unmarshal(*v, &systemData)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tcr.SystemData = &systemData\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" } ]
d55e16239f5e0afbdcd5c52ea0f99cc0
/ Uzmcr generate a header with name uzmcr
[ { "docid": "b344890c4acabfb6fcfc07203d7d0b8c", "score": "0.54781055", "text": "func GetUzmcr(val string) string {\n\tuzmcr := 4\n\tssresp, err := strconv.Atoi(val)\n\tif err == nil {\n\t\trandomNumber := rand.Intn(100-1) + 1\n\t\tuzmcr = (4 * randomNumber) + ssresp\n\t}\n\treturn strconv.Itoa(uzmcr)\n}", "title": "" } ]
[ { "docid": "f95ebdb254eb802906f1e94ab10bf55e", "score": "0.61955464", "text": "func generateCMainHeader(gt *genTargets, genDir string) (err error) {\n\tfilename := filepath.Join(genDir, \"gml_gen.h\")\n\n\t// Create the file.\n\tf, err := os.Create(filename)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer func() {\n\t\tderr := f.Close()\n\t\tif derr != nil && err == nil {\n\t\t\terr = derr\n\t\t}\n\t}()\n\n\treturn cMainHeaderTmpl.Execute(f, gt)\n}", "title": "" }, { "docid": "63cff3ebf764309eea7a70fde55716df", "score": "0.61049104", "text": "func (hfs *HFileSystem) generateHeader() (header []byte) {\n\theader = make([]byte, 0)\n\ttmp32 := make([]byte, 4)\n\ttmp64 := make([]byte, 8)\n\n\t// byte Identifier\n\theader = append(header, []byte(FileSystemIdentifier)...)\n\n\t// byte Version\n\tbinary.BigEndian.PutUint32(tmp32, hfs.version)\n\theader = append(header, tmp32...)\n\n\t// blocksize, corresponds to BLOCKSIZE\n\tbinary.BigEndian.PutUint64(tmp64, uint64(hfs.blockSize))\n\theader = append(header, tmp64...)\n\n\t// number of blocks\n\tbinary.BigEndian.PutUint64(tmp64, uint64(hfs.blocks))\n\theader = append(header, tmp64...)\n\n\t// last written block\n\tbinary.BigEndian.PutUint64(tmp64, uint64(hfs.lastWrittenBlock))\n\theader = append(header, tmp64...)\n\n\t// file index size\n\tbinary.BigEndian.PutUint64(tmp64, uint64(hfs.fileIndexSize))\n\theader = append(header, tmp64...)\n\n\t//// *** why add this line ???\n\t//dataTmp := make([]byte, fs.blockSize-uint32(len(header)))\n\t//header = append(header, dataTmp...)\n\treturn\n}", "title": "" }, { "docid": "178b4153676d60c2dc38ecaff113d32e", "score": "0.60669535", "text": "func ReportHeader(ctx context.Context, rn, funcname string, ri *ReporterInfo) (string, error) {\n\ts := ri.Xbiz.P.Designation + \"\\n\"\n\tbu, err := rlib.GetBusinessUnitByDesignation(ctx, ri.Xbiz.P.Designation)\n\tif err != nil {\n\t\te := fmt.Errorf(\"%s: error getting BusinessUnit - %s\", funcname, err.Error())\n\t\treturn s, e\n\t}\n\tif bu.CoCode == 0 {\n\t\ts += bu.Name + \"\\n\\n\"\n\t} else {\n\t\tc, err := rlib.GetCompany(ctx, int64(bu.CoCode))\n\t\tif err != nil {\n\t\t\te := fmt.Errorf(\"%s: error getting Company - %s\\nBusinessUnit = %s, bu = %#v\", funcname, err.Error(), ri.Xbiz.P.Designation, bu)\n\t\t\treturn s, e\n\t\t}\n\t\ts += fmt.Sprintf(\"%s\\n\", c.LegalName)\n\t\ts += fmt.Sprintf(\"%s\\n\", c.Address)\n\t\tif len(c.Address2) > 0 {\n\t\t\ts += fmt.Sprintf(\"%s\\n\", c.Address2)\n\t\t}\n\t\ts += fmt.Sprintf(\"%s, %s %s %s\\n\\n\", c.City, c.State, c.PostalCode, c.Country)\n\t}\n\ts += rn\n\tif ri.BlankLineAfterRptName {\n\t\ts += \"\\n\"\n\t}\n\n\t// d2 := GetReporterInfoDisplayD2(ri)\n\t// rlib.Console(\"*** Report Header: d2 = %s\\n\", d2.Format(rlib.RRDATEREPORTFMT))\n\n\tif ri.RptHeaderD1 && ri.RptHeaderD2 {\n\t\ts += ri.D1.Format(rlib.RRDATEREPORTFMT) + \" - \" + ri.D2.Format(rlib.RRDATEREPORTFMT) + \"\\n\"\n\t} else if ri.RptHeaderD1 {\n\t\ts += ri.D1.Format(rlib.RRDATEREPORTFMT) + \"\\n\"\n\t} else if ri.RptHeaderD2 {\n\t\ts += ri.D2.Format(rlib.RRDATEREPORTFMT) + \"\\n\"\n\t}\n\ts += \"\\n\"\n\treturn s, nil\n}", "title": "" }, { "docid": "0609746033410b52b4b3e4f42ef84879", "score": "0.60560733", "text": "func BuildHeader(tokenType string, token string) string {\n\treturn fmt.Sprintf(\"Authorization: %s %s\", tokenType, token)\n}", "title": "" }, { "docid": "843b7800deeaeeacbaad1331ea486354", "score": "0.60405105", "text": "func (g *Generator) Header(source string) {\n\tg.Printf(\"// Code generated by github.com/anbillon/sqlbrick. DO NOT EDIT IT.\")\n\tg.NewLine()\n\tg.NewLine()\n\tif len(source) != 0 {\n\t\tg.Printf(fmt.Sprintf(\"// This file is generated from: %v\", source))\n\t\tg.NewLine()\n\t\tg.NewLine()\n\t}\n\tg.Printf(\"package \" + g.packageName)\n\tg.NewLine()\n}", "title": "" }, { "docid": "0dda4250cc3aa6525ca72290f002e34c", "score": "0.6028957", "text": "func DeriveResponseHeader(tokenRegistry TokenRegistry, model Model) (*documentpb.ResponseHeader, error) {\n\tcs, err := model.GetCollaborators()\n\tif err != nil {\n\t\treturn nil, errors.NewTypedError(ErrCollaborators, err)\n\t}\n\n\t// we ignore error here because it can happen when a model is first created but its not anchored yet\n\ta, _ := model.Author()\n\tauthor := a.String()\n\n\t// we ignore error here because it can happen when a model is first created but its not anchored yet\n\ttime := \"\"\n\tt, err := model.Timestamp()\n\tif err == nil {\n\t\ttime = t.UTC().String()\n\t}\n\n\tnfts := model.NFTs()\n\tcnfts, err := convertNFTs(tokenRegistry, nfts)\n\tif err != nil {\n\t\t// this could be a temporary failure, so we ignore but warn about the error\n\t\tlog.Warningf(\"errors encountered when trying to set nfts to the response: %v\", errors.NewTypedError(ErrNftNotFound, err))\n\t}\n\n\trcs, wcs := ToClientCollaboratorAccess(cs)\n\treturn &documentpb.ResponseHeader{\n\t\tDocumentId: hexutil.Encode(model.ID()),\n\t\tVersion: hexutil.Encode(model.CurrentVersion()),\n\t\tAuthor: author,\n\t\tCreatedAt: time,\n\t\tReadAccess: rcs,\n\t\tWriteAccess: wcs,\n\t\tNfts: cnfts,\n\t}, nil\n}", "title": "" }, { "docid": "a5ed279043ecf5216af96d8e925dd267", "score": "0.59539366", "text": "func GenerateASCIIHeader() string {\n\tbuffer := new(bytes.Buffer)\n\tbuffer.WriteString(\" __ \\n\")\n\tbuffer.WriteString(\" _ ______ ___ / /________ ___ \\n\")\n\tbuffer.WriteString(\" | | / / __ `__ \\\\/ / ___/ __ `__ \\\\\\n\")\n\tbuffer.WriteString(\" | |/ / / / / / / / /__/ / / / / /\\n\")\n\tbuffer.WriteString(\" |___/_/ /_/ /_/_/\\\\___/_/ /_/ /_/ \\n\")\n\tbuffer.WriteString(\" \\n\")\n\treturn buffer.String()\n}", "title": "" }, { "docid": "a4e20b96ba806834db1923da5adfcf69", "score": "0.5868039", "text": "func (f *Fs) headerGenerator(hostType string, namespace string, route string) map[string]string {\n\tif f.ns == \"\" {\n\t\treturn map[string]string{}\n\t}\n\treturn map[string]string{\n\t\t\"Dropbox-API-Path-Root\": `{\".tag\": \"namespace_id\", \"namespace_id\": \"` + f.ns + `\"}`,\n\t}\n}", "title": "" }, { "docid": "263bd751f81c2038a2e1f1979eb974d7", "score": "0.5860993", "text": "func tarHeaderTemplate() tar.Header {\n\t// Attempt to lookup the current user. Ignore errors because the default\n\t// zero values are reasonable.\n\tvar (\n\t\tuid int\n\t\tgid int\n\t\tuname string\n\t\tgname string\n\t)\n\tif currentUser, err := user.Current(); err == nil {\n\t\tuid, _ = strconv.Atoi(currentUser.Uid)\n\t\tgid, _ = strconv.Atoi(currentUser.Gid)\n\t\tuname = currentUser.Username\n\t\tif group, err := user.LookupGroupId(currentUser.Gid); err == nil {\n\t\t\tgname = group.Name\n\t\t}\n\t}\n\n\tnow := time.Now().UTC()\n\treturn tar.Header{\n\t\tUid: uid,\n\t\tGid: gid,\n\t\tUname: uname,\n\t\tGname: gname,\n\t\tModTime: now,\n\t\tAccessTime: now,\n\t\tChangeTime: now,\n\t}\n}", "title": "" }, { "docid": "f6c43836d7512a9ae6cd84e81283a1c8", "score": "0.58227617", "text": "func buildHeader(header restful.Header) spec.Header {\n\tresponseHeader := spec.Header{}\n\tresponseHeader.Type = header.Type\n\tresponseHeader.Description = header.Description\n\tresponseHeader.Format = header.Format\n\tresponseHeader.Default = header.Default\n\n\t// If type is \"array\" items field is required\n\tif header.Type == arrayType {\n\t\tresponseHeader.CollectionFormat = header.CollectionFormat\n\t\tresponseHeader.Items = buildHeadersItems(header.Items)\n\t}\n\n\treturn responseHeader\n}", "title": "" }, { "docid": "9dbc488ded07ae19eb5a4f1e7cf144ba", "score": "0.57905525", "text": "func Header(out io.StringWriter) {\n\tout.WriteString(\"ID Due Date Pri Description/Status\\n\")\n\tout.WriteString(terminal.HorizontalLine())\n\tout.WriteString(\"\\n\")\n}", "title": "" }, { "docid": "b98bb1ae248b997da8060d02a08bef66", "score": "0.5774866", "text": "func AuthorizationHeader(macaroon, discharge string) (string, error) {\n\tvar buf bytes.Buffer\n\n\troot, err := auth.MacaroonDeserialize(macaroon)\n\tif err != nil {\n\t\tlog.Printf(\"Error deserializing macaroon: %v\", err)\n\t\treturn \"\", err\n\t}\n\n\tdischargeMacaroon, err := auth.MacaroonDeserialize(discharge)\n\tif err != nil {\n\t\tlog.Printf(\"Error deserializing discharge: %v\", err)\n\t\treturn \"\", err\n\t}\n\n\tdischargeMacaroon.Bind(root.Signature())\n\n\tserializedMacaroon, err := auth.MacaroonSerialize(root)\n\tif err != nil {\n\t\tlog.Printf(\"Error serializing root macaroon: %v\", err)\n\t\treturn \"\", err\n\t}\n\tserializedDischarge, err := auth.MacaroonSerialize(dischargeMacaroon)\n\tif err != nil {\n\t\tlog.Printf(\"Error serializing discharge macaroon: %v\", err)\n\t\treturn \"\", err\n\t}\n\n\tfmt.Fprintf(&buf, `Macaroon root=\"%s\", discharge=\"%s\"`, serializedMacaroon, serializedDischarge)\n\treturn buf.String(), nil\n}", "title": "" }, { "docid": "76b9ab073a44fd9a9a4d3884230de532", "score": "0.57576376", "text": "func header(locale string) string {\n\tt := localisations[locale]\n\treturn fmt.Sprintf(headerFormatString, t.date, t.description, t.change)\n}", "title": "" }, { "docid": "ca47c2f446e2e5dccc84efbcf2ddd0d2", "score": "0.57172215", "text": "func cmdAuthHeaderRun(cmd *cobra.Command, args []string) {\n\ttoken := mustAuthCreateJWTToken()\n\tfmt.Printf(\"%s: %s%s\\n\", service.AuthorizationHeader, service.BearerPrefix, token)\n}", "title": "" }, { "docid": "4ee8bbf05d07483f3009f7f2ab966682", "score": "0.5708358", "text": "func revisionHeader(desc *revisionDesc) string {\n\theader := desc.revision.Name\n\tif desc.latestTraffic != nil && *desc.latestTraffic {\n\t\theader = fmt.Sprintf(\"@latest (%s)\", desc.revision.Name)\n\t} else if desc.latestReady {\n\t\theader = desc.revision.Name + \" (current @latest)\"\n\t} else if desc.latestCreated {\n\t\theader = desc.revision.Name + \" (latest created)\"\n\t}\n\tif desc.tag != \"\" {\n\t\theader = fmt.Sprintf(\"%s #%s\", header, desc.tag)\n\t}\n\treturn header + \" \" +\n\t\t\"[\" + strconv.Itoa(desc.configurationGeneration) + \"]\" +\n\t\t\" \" +\n\t\t\"(\" + commands.Age(desc.revision.CreationTimestamp.Time) + \")\"\n}", "title": "" }, { "docid": "eeeb40ac09038b9345f180142202651d", "score": "0.57040673", "text": "func (Service) Header(ns string) Header {\n\treturn Header{\n\t\tHeaderColumn{Name: \"NAMESPACE\"},\n\t\tHeaderColumn{Name: \"NAME\"},\n\t\tHeaderColumn{Name: \"TYPE\"},\n\t\tHeaderColumn{Name: \"CLUSTER-IP\"},\n\t\tHeaderColumn{Name: \"EXTERNAL-IP\"},\n\t\tHeaderColumn{Name: \"SELECTOR\", Wide: true},\n\t\tHeaderColumn{Name: \"PORTS\", Wide: false},\n\t\tHeaderColumn{Name: \"LABELS\", Wide: true},\n\t\tHeaderColumn{Name: \"VALID\", Wide: true},\n\t\tHeaderColumn{Name: \"AGE\", Time: true},\n\t}\n}", "title": "" }, { "docid": "9f81496cb9189c5df97cc068d6b1826e", "score": "0.5698714", "text": "func (Namespace) Header(string) Header {\n\treturn Header{\n\t\tHeaderColumn{Name: \"NAME\"},\n\t\tHeaderColumn{Name: \"STATUS\"},\n\t\tHeaderColumn{Name: \"LABELS\", Wide: true},\n\t\tHeaderColumn{Name: \"VALID\", Wide: true},\n\t\tHeaderColumn{Name: \"AGE\", Time: true},\n\t}\n}", "title": "" }, { "docid": "39285f6b5fd00291150ec086920a3bfb", "score": "0.56902725", "text": "func newHeader() Header {\n\treturn Header{\n\t\tMajor: 2,\n\t\tMinor: 0,\n\t}\n}", "title": "" }, { "docid": "693e157a2f6a5935e61005438a1c4a48", "score": "0.56872416", "text": "func makeHeader(bmnet wire.BitmessageNet, command string,\n\tpayloadLen uint32, checksum uint32) []byte {\n\n\t// The length of a bitmessage message header is 24 bytes.\n\t// 4 byte magic number of the bitmessage network + 12 byte command + 4 byte\n\t// payload length + 4 byte checksum.\n\tbuf := make([]byte, 24)\n\tbinary.BigEndian.PutUint32(buf, uint32(bmnet))\n\tcopy(buf[4:], []byte(command))\n\tbinary.BigEndian.PutUint32(buf[16:], payloadLen)\n\tbinary.BigEndian.PutUint32(buf[20:], checksum)\n\treturn buf\n}", "title": "" }, { "docid": "8291b442dd0cf20f70e3f80338b2d078", "score": "0.56831616", "text": "func (TxHeader) typ() string { return \"txheader\" }", "title": "" }, { "docid": "933b12bfdf77b47669dfb6c25f423e35", "score": "0.56750774", "text": "func (Deployment) Header(ns string) Header {\n\treturn Header{\n\t\tHeaderColumn{Name: \"NAMESPACE\"},\n\t\tHeaderColumn{Name: \"NAME\"},\n\t\tHeaderColumn{Name: \"READY\", Align: tview.AlignRight},\n\t\tHeaderColumn{Name: \"UP-TO-DATE\", Align: tview.AlignRight},\n\t\tHeaderColumn{Name: \"AVAILABLE\", Align: tview.AlignRight},\n\t\tHeaderColumn{Name: \"LABELS\", Wide: true},\n\t\tHeaderColumn{Name: \"VALID\", Wide: true},\n\t\tHeaderColumn{Name: \"AGE\", Time: true},\n\t}\n}", "title": "" }, { "docid": "38f6461e85c49c431890fad82c7b0362", "score": "0.5672204", "text": "func (g *Generator) generateHeader() {\n\tg.P(\"// Code generated by tetratelabs/protoc-gen-cobra.\")\n\tg.P(\"// source: \", g.file.Name)\n\tg.P(\"// DO NOT EDIT!\")\n\tg.P()\n\n\tname := g.file.PackageName()\n\n\tif g.file.index == 0 {\n\t\t// Generate package docs for the first file in the package.\n\t\tg.P(\"/*\")\n\t\tg.P(\"Package \", name, \" is a generated protocol buffer package.\")\n\t\tg.P()\n\t\tif loc, ok := g.file.comments[strconv.Itoa(packagePath)]; ok {\n\t\t\t// not using g.PrintComments because this is a /* */ comment block.\n\t\t\ttext := strings.TrimSuffix(loc.GetLeadingComments(), \"\\n\")\n\t\t\tfor _, line := range strings.Split(text, \"\\n\") {\n\t\t\t\tline = strings.TrimPrefix(line, \" \")\n\t\t\t\t// ensure we don't escape from the block comment\n\t\t\t\tline = strings.Replace(line, \"*/\", \"* /\", -1)\n\t\t\t\tg.P(line)\n\t\t\t}\n\t\t\tg.P()\n\t\t}\n\t\tvar cmds []string\n\t\tg.P(\"It is generated from these files:\")\n\t\tnames := make([]string, 0, len(g.genFiles))\n\t\tfor _, f := range g.genFiles {\n\t\t\tnames = append(names, *f.Name)\n\t\t}\n\n\t\tfor _, n := range names {\n\t\t\tfor _, f := range g.genFiles {\n\t\t\t\tif *f.Name == n {\n\t\t\t\t\tg.P(\"\\t\", f.Name)\n\t\t\t\t\tfor _, msg := range f.desc {\n\t\t\t\t\t\tif msg.parent != nil {\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tfor _, service := range f.Service {\n\t\t\t\t\t\torigServName := service.GetName()\n\t\t\t\t\t\tservName := CamelCase(origServName)\n\t\t\t\t\t\tcmds = append(cmds, servName+\"ClientCommand\")\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\n\t\tg.P()\n\t\tg.P(\"It has these top-level commands:\")\n\t\tfor _, cmd := range cmds {\n\t\t\tg.P(\"\\t\", cmd)\n\t\t}\n\t\tg.P(\"*/\")\n\t\tg.P() // This is to not conflict with grpc pkg doc.\n\t}\n\n\tg.P(\"package \", name)\n\tg.P()\n}", "title": "" }, { "docid": "cfe32fbd546c252c462bbd33d4b06a79", "score": "0.56690836", "text": "func makeTmConfigHeader(cmd *cobra.Command, addedLead string, isPacked bool) *sectionHeader {\n\treturn &sectionHeader{\n\t\tlead: \"Tendermint Config\",\n\t\taddedLead: addedLead,\n\t\tfilename: provconfig.GetFullPathToTmConf(cmd),\n\t\tisPacked: isPacked,\n\t\tenv: true,\n\t}\n}", "title": "" }, { "docid": "9a3d88f72ef76636b496acf0294b0a74", "score": "0.56590897", "text": "func (c tapClient) Header() (metadata.MD, error) { return nil, nil }", "title": "" }, { "docid": "d1102d32cc90c17c41917a89ff3103ec", "score": "0.56410176", "text": "func (c1 *Custom6) Header(t *storage.TempFile) error {\n\treturn nil\n}", "title": "" }, { "docid": "4c1b1e750ea45a64ad91253300c5e41e", "score": "0.5613961", "text": "func CreateHeader(command string, payload []byte, config *config.NodeConfig) []byte {\n\n\theader := make([]byte, 24)\n\n\t// https://developer.bitcoin.org/glossary.html#term-Start-string\n\tbinary.BigEndian.PutUint32(header, networkToStartString(config.GetNetwork()))\n\tcopy(header[4:16], []byte(command))\n\tbinary.BigEndian.PutUint32(header[16:20], uint32(len(payload)))\n\tchecksum := crypto.DoubleSha(payload)\n\n\tcopy(header[20:], checksum)\n\treturn header\n}", "title": "" }, { "docid": "e7ac33aca6385fa6f5550e7d406c9e97", "score": "0.5583711", "text": "func Header(s string) string {\n\treturn au.Blue(s).String()\n}", "title": "" }, { "docid": "57e71fed58f2fc2a43d7008fa0026e8c", "score": "0.5579532", "text": "func remove_header() {\n\n}", "title": "" }, { "docid": "930f031d710c62b9fd5fedce051ba0c0", "score": "0.5577133", "text": "func (r renderer) Header(out *bytes.Buffer, text func() bool, level int, id string) {}", "title": "" }, { "docid": "fcf8742fc41ce8b187b41c76eb34336c", "score": "0.5575471", "text": "func setHeaders(w http.ResponseWriter, h http.Header, u *users.User) {\n\tw.Header().Set(\"Docker-Distribution-Api-Version\", \"registry/2.0\")\n\tfor k, v := range h {\n\t\tif strings.ToLower(k) == \"content-length\" {\n\t\t\tcontinue\n\t\t}\n\t\tw.Header().Set(k, strings.Join(v, \",\"))\n\t}\n}", "title": "" }, { "docid": "4884945725405ca83fc85b5a8f069933", "score": "0.55605584", "text": "func CreateTableHeaderFromQueryResult(result []model.Hardware) []string {\n\t//Title: \"#\", \"OBJECT-ID\", \"USER\", \"TYPE\", \"SPECIFICATION\", \"LOCATION\", \"IP\", \"MAC\"\n\tvar tableHeader []string\n\ttableHeader = append(tableHeader, \" #\") //Adding # for the index\n\tvalue := reflect.Indirect(reflect.ValueOf(result[0]))\n\tfor i := 0; i < value.Type().NumField(); i++ {\n\t\ttableHeader = append(tableHeader, value.Type().Field(i).Name) //adding each variable Name to the Table Header\n\t}\n\n\treturn tableHeader\n}", "title": "" }, { "docid": "39ed0fb2e72fe2659a87bcbf778a86dd", "score": "0.55604655", "text": "func buildMessageHeader(msg Message, len int) (*messageHeader, error) {\n\theader := &messageHeader{\n\t\tMagic: 0,\n\t\tMsgType: msg.MsgType(),\n\t\tLength: uint32(len),\n\t}\n\treturn header, nil\n}", "title": "" }, { "docid": "0ea28a2c623f01309ea44dbecc56b6fb", "score": "0.55408174", "text": "func (lens Lens) Header(artifacts []api.Artifact, resourceDir string, config json.RawMessage, spyglassConfig config.Spyglass) string {\n\tt, err := template.ParseFiles(filepath.Join(resourceDir, \"template.html\"))\n\tif err != nil {\n\t\treturn fmt.Sprintf(\"<!-- FAILED LOADING HEADER: %v -->\", err)\n\t}\n\tvar buf bytes.Buffer\n\tif err := t.ExecuteTemplate(&buf, \"header\", nil); err != nil {\n\t\treturn fmt.Sprintf(\"<!-- FAILED EXECUTING HEADER TEMPLATE: %v -->\", err)\n\t}\n\treturn buf.String()\n}", "title": "" }, { "docid": "77b17f2696a0a2210753078e219511c3", "score": "0.553791", "text": "func (t *Twitter) generateOAuthHeader(m *RestMethod) string {\n\tbase := t.generateSignatureBase(m)\n\tsig := t.generateOAuthSignature(base)\n\n\tm.Params[\"oauth_signature\"] = sig\n\n\tsortedKeys := sortMapKeys(m.Params)\n\n\ti := 0\n\tvar params = make([]string, len(m.Params))\n\tfor _, v := range sortedKeys {\n\t\tif v[:6] == \"oauth_\" {\n\t\t\tparams[i] = fmt.Sprintf(`%s=\"%s\"`, v, encode(m.Params[v]))\n\t\t\ti++\n\t\t}\n\t}\n\n\treturn \"OAuth \" + strings.Join(params[:i], \", \")\n}", "title": "" }, { "docid": "752aa13502534bb9bf83eeac656e09c7", "score": "0.55312073", "text": "func makeClientConfigHeader(cmd *cobra.Command, addedLead string, isPacked bool) *sectionHeader {\n\treturn &sectionHeader{\n\t\tlead: \"Client Config\",\n\t\taddedLead: addedLead,\n\t\tfilename: provconfig.GetFullPathToClientConf(cmd),\n\t\tisPacked: isPacked,\n\t\tenv: true,\n\t}\n}", "title": "" }, { "docid": "028e656dbafa5071e7dea257f163a55f", "score": "0.5518004", "text": "func writeMIMEHeader(wr io.Writer, hdr textproto.MIMEHeader) (err error) {\n // write headers\n for k, vals := range(hdr) {\n for _, val := range(vals) {\n _, err = io.WriteString(wr, fmt.Sprintf(\"%s: %s\\n\", k, val))\n }\n }\n // end of headers\n _, err = io.WriteString(wr, \"\\n\")\n return\n}", "title": "" }, { "docid": "8de9c0422fbbf001465821e607ff87cc", "score": "0.55004907", "text": "func GenerateOptionalHeader(b []byte) (oh OptionalHeader) {\n\tbr := bytes.NewReader(b)\n\n\toh = parseAsOptionalHeader(br)\n\n\treturn\n}", "title": "" }, { "docid": "7433fb77945c9451738a8279faf02133", "score": "0.54983795", "text": "func writeStatHeader() []byte {\n\t// This is predefined from AMZ protocol found here:\n\t// https://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectSELECTContent.html\n\tvar currentMessage = &bytes.Buffer{}\n\t// header name\n\tcurrentMessage.Write(encodeHeaderStringName(\":event-type\"))\n\t// header type\n\tcurrentMessage.Write(encodeNumber(7, 1))\n\t// header value and header value length\n\tcurrentMessage.Write(encodeHeaderStringValue(\"Stats\"))\n\t// Creation of the Header for Content-Type \t// 13 -content-type -7 -8\n\t// \"text/xml\"\n\t// header name\n\tcurrentMessage.Write(encodeHeaderStringName(\":content-type\"))\n\t// header type\n\tcurrentMessage.Write(encodeNumber(7, 1))\n\t// header value and header value length\n\tcurrentMessage.Write(encodeHeaderStringValue(\"text/xml\"))\n\n\t// Creation of the Header for message-type 13 -message-type -7 5 \"event\"\n\tcurrentMessage.Write(encodeHeaderStringName(\":message-type\"))\n\t// header type\n\tcurrentMessage.Write(encodeNumber(7, 1))\n\t// header value and header value length\n\tcurrentMessage.Write(encodeHeaderStringValue(\"event\"))\n\treturn currentMessage.Bytes()\n\n}", "title": "" }, { "docid": "125c10caf2797964b32054e9894e651e", "score": "0.54860765", "text": "func Make(h *Header, body []byte) []byte {\n\tb := new(bytes.Buffer)\n\tprintHeader(b, \"Date\", h.Time.String())\n\tprintHeader(b, \"From\", h.From)\n\tprintHeader(b, \"To\", h.To)\n\tif h.Cc != \"\" {\n\t\tprintHeader(b, \"CC\", h.Cc)\n\t}\n\tif h.Bcc != \"\" {\n\t\tprintHeader(b, \"BCC\", h.Bcc)\n\t}\n\tprintHeader(b, \"Subject\", h.Subject)\n\tprintHeader(b, \"MIME-Version\", \"1.0;\")\n\tprintHeader(b, \"Content-Type\", `text/html; charset=\"UTF-8\"`)\n\tfmt.Fprint(b, \"\\r\\n\")\n\tb.Write(body)\n\treturn b.Bytes()\n}", "title": "" }, { "docid": "85c4d82bfa618736a2e80a44c556f08d", "score": "0.5471336", "text": "func writeContHeader() []byte {\n\t// This is predefined from AMZ protocol found here:\n\t// https://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectSELECTContent.html\n\tvar currentMessage = &bytes.Buffer{}\n\t// header name\n\tcurrentMessage.Write(encodeHeaderStringName(\":event-type\"))\n\t// header type\n\tcurrentMessage.Write(encodeNumber(7, 1))\n\t// header value and header value length\n\tcurrentMessage.Write(encodeHeaderStringValue(\"Cont\"))\n\n\t// Creation of the Header for message-type 13 -message-type -7 5 \"event\"\n\t// header name\n\tcurrentMessage.Write(encodeHeaderStringName(\":message-type\"))\n\t// header type\n\tcurrentMessage.Write(encodeNumber(7, 1))\n\t// header value and header value length\n\tcurrentMessage.Write(encodeHeaderStringValue(\"event\"))\n\treturn currentMessage.Bytes()\n\n}", "title": "" }, { "docid": "bad3b4c8794e72daa35b8b7e0db2b843", "score": "0.54600954", "text": "func GHeader() *pb.Header {\n\th := &pb.Header{}\n\th.Logid = Glogid()\n\treturn h\n}", "title": "" }, { "docid": "981cef22831bbca87092de166db168a4", "score": "0.5453201", "text": "func authHeader(apiKey string) string {\n\treturn fmt.Sprintf(\"key=%v\", apiKey)\n}", "title": "" }, { "docid": "3e6f93cbe6cb119e78e139d063e95ac8", "score": "0.5435843", "text": "func TableReportHeader(ctx context.Context, tbl *gotable.Table, rn, funcname string, ri *ReporterInfo) error {\n\ttbl.SetTitle(ri.Xbiz.P.Designation + \" \" + rn)\n\n\tvar s string\n\td2 := GetReporterInfoDisplayD2(ri)\n\t// rlib.Console(\"*** Table Report Header: d2 = %s\\n\", d2.Format(rlib.RRDATEREPORTFMT))\n\tif ri.RptHeaderD1 && ri.RptHeaderD2 {\n\t\ts = ri.D1.Format(rlib.RRDATEREPORTFMT) + \" - \" + d2.Format(rlib.RRDATEREPORTFMT)\n\t} else if ri.RptHeaderD1 {\n\t\ts = ri.D1.Format(rlib.RRDATEREPORTFMT)\n\t} else if ri.RptHeaderD2 {\n\t\ts = d2.Format(rlib.RRDATEREPORTFMT)\n\t}\n\ttbl.SetSection1(s)\n\n\tvar s1 string\n\tbu, err := rlib.GetBusinessUnitByDesignation(ctx, ri.Xbiz.P.Designation)\n\tif err != nil {\n\t\te := fmt.Errorf(\"%s: error getting BusinessUnit - %s\", funcname, err.Error())\n\t\ttbl.SetSection3(e.Error())\n\t\treturn e\n\t}\n\tif bu.CoCode == 0 {\n\t\ts1 = bu.Name + \"\\n\\n\"\n\t} else {\n\t\tc, err := rlib.GetCompany(ctx, int64(bu.CoCode))\n\t\tif err != nil {\n\t\t\te := fmt.Errorf(\"%s: error getting Company - %s\\nBusinessUnit = %s, bu = %#v\", funcname, err.Error(), ri.Xbiz.P.Designation, bu)\n\t\t\ttbl.SetSection3(e.Error())\n\t\t\treturn e\n\t\t}\n\t\ts1 += fmt.Sprintf(\"%s\\n\", c.LegalName)\n\t\ts1 += fmt.Sprintf(\"%s\\n\", c.Address)\n\t\tif len(c.Address2) > 0 {\n\t\t\ts1 += fmt.Sprintf(\"%s\\n\", c.Address2)\n\t\t}\n\t\ts1 += fmt.Sprintf(\"%s, %s %s %s\\n\\n\", c.City, c.State, c.PostalCode, c.Country)\n\t}\n\t// TODO: handle blank line thing for html???\n\tif ri.BlankLineAfterRptName {\n\t\ts1 += \"\\n\"\n\t}\n\ttbl.SetSection2(s1)\n\n\treturn nil\n}", "title": "" }, { "docid": "47261563153253938930b459007bdb01", "score": "0.54350775", "text": "func printOutputHeader() {\n\tfmt.Println(\"\")\n\tfmt.Println(\"FreeTAXII - STIX Table Creator\")\n\tfmt.Println(\"Copyright: Bret Jordan\")\n\tfmt.Println(\"Version:\", Version)\n\tif Build != \"\" {\n\t\tfmt.Println(\"Build:\", Build)\n\t}\n\tfmt.Println(\"\")\n}", "title": "" }, { "docid": "abebeec0ca8fb5064b8eb24cf7b42c6e", "score": "0.5431817", "text": "func Header(auth bool, rcode int) MsgOpt {\n\treturn func(m *dns.Msg) {\n\t\tm.Authoritative = auth\n\t\tm.Response = true\n\t\tm.Rcode = rcode\n\t\tm.Compress = true\n\t}\n}", "title": "" }, { "docid": "0e670b7772daa6cc22eff6471adcc07f", "score": "0.5425127", "text": "func (RoleBinding) Header(ns string) Header {\n\tvar h Header\n\tif client.IsAllNamespaces(ns) {\n\t\th = append(h, HeaderColumn{Name: \"NAMESPACE\"})\n\t}\n\n\treturn append(h,\n\t\tHeaderColumn{Name: \"NAME\"},\n\t\tHeaderColumn{Name: \"ROLE\"},\n\t\tHeaderColumn{Name: \"KIND\"},\n\t\tHeaderColumn{Name: \"SUBJECTS\"},\n\t\tHeaderColumn{Name: \"LABELS\", Wide: true},\n\t\tHeaderColumn{Name: \"VALID\", Wide: true},\n\t\tHeaderColumn{Name: \"AGE\", Time: true},\n\t)\n}", "title": "" }, { "docid": "f83e848f2a2458d2b4799386d0be203e", "score": "0.53996", "text": "func deriveHeader(v interface{}) Header {\n\tout := make(Header, 0)\n\tval := reflect.ValueOf(v)\n\ttyp := reflect.TypeOf(v)\n\n\tif typ.Kind() == reflect.Slice {\n\t\tval = reflect.New(typ.Elem()).Elem()\n\t}\n\n\tfor i := 0; i < val.NumField(); i++ {\n\t\tf := val.Type().Field(i)\n\t\tif fieldReadable(v, f) {\n\t\t\tout = append(out, f.Name)\n\t\t}\n\t}\n\treturn out\n}", "title": "" }, { "docid": "56ae60d03a0c3a03ac3de7b9884e88d1", "score": "0.53952926", "text": "func createTestHeader(t *testing.T, txType common.HeaderType, channelId string, creator []byte, useGoodTxid bool) (*common.Header, error) {\n\tnonce := []byte(\"nonce-abc-12345\")\n\n\t// useGoodTxid is used to for testing purpose. When it is true, we use a bad value for txid\n\ttxid := \"bad\"\n\tif useGoodTxid {\n\t\ttxid = protoutil.ComputeTxID(nonce, creator)\n\t}\n\n\tchdr := &common.ChannelHeader{\n\t\tType: int32(txType),\n\t\tChannelId: channelId,\n\t\tTxId: txid,\n\t\tEpoch: uint64(0),\n\t}\n\n\tshdr := &common.SignatureHeader{\n\t\tCreator: creator,\n\t\tNonce: nonce,\n\t}\n\n\treturn &common.Header{\n\t\tChannelHeader: protoMarshal(t, chdr),\n\t\tSignatureHeader: protoMarshal(t, shdr),\n\t}, nil\n}", "title": "" }, { "docid": "9af2e800235ee515adec3e92916d2c3f", "score": "0.5374939", "text": "func (msg *Message) writeHeader(buffer *bytes.Buffer) {\n\tfor key, values := range msg.Headers {\n\t\tfor _, keyval := range values {\n\t\t\tio.WriteString(buffer, key)\n\t\t\tio.WriteString(buffer, \": \")\n\t\t\tswitch {\n\t\t\tcase key == \"Content-Type\" || key == \"Content-Disposition\":\n\t\t\t\tbuffer.Write([]byte(keyval))\n\t\t\tdefault:\n\t\t\t\tbuffer.Write([]byte(mime.QEncoding.Encode(\"UTF-8\", keyval)))\n\t\t\t}\n\t\t\tio.WriteString(buffer, \"\\r\\n\")\n\t\t}\n\t}\n\tio.WriteString(buffer, \"\\r\\n\")\n}", "title": "" }, { "docid": "cc1872f3917635c7156198e7bf8b5157", "score": "0.5365858", "text": "func (c1 *Custom1) Header(t *storage.TempFile) error {\n\treturn nil\n}", "title": "" }, { "docid": "b4f40cb76f290037a05b0174cd2bae55", "score": "0.5365777", "text": "func NewHeader(header *low.Header) *Header {\n\th := new(Header)\n\th.low = header\n\th.Extensions = high.ExtractExtensions(header.Extensions)\n\tif !header.Type.IsEmpty() {\n\t\th.Type = header.Type.Value\n\t}\n\tif !header.Format.IsEmpty() {\n\t\th.Format = header.Type.Value\n\t}\n\tif !header.Description.IsEmpty() {\n\t\th.Description = header.Description.Value\n\t}\n\tif !header.Items.IsEmpty() {\n\t\th.Items = NewItems(header.Items.Value)\n\t}\n\tif !header.CollectionFormat.IsEmpty() {\n\t\th.CollectionFormat = header.CollectionFormat.Value\n\t}\n\tif !header.Default.IsEmpty() {\n\t\th.Default = header.Default.Value\n\t}\n\tif !header.Maximum.IsEmpty() {\n\t\th.Maximum = header.Maximum.Value\n\t}\n\tif !header.ExclusiveMaximum.IsEmpty() {\n\t\th.ExclusiveMaximum = header.ExclusiveMaximum.Value\n\t}\n\tif !header.Minimum.IsEmpty() {\n\t\th.Minimum = header.Minimum.Value\n\t}\n\tif !header.ExclusiveMinimum.Value {\n\t\th.ExclusiveMinimum = header.ExclusiveMinimum.Value\n\t}\n\tif !header.MaxLength.IsEmpty() {\n\t\th.MaxLength = header.MaxLength.Value\n\t}\n\tif !header.MinLength.IsEmpty() {\n\t\th.MinLength = header.MinLength.Value\n\t}\n\tif !header.Pattern.IsEmpty() {\n\t\th.Pattern = header.Pattern.Value\n\t}\n\tif !header.MinItems.IsEmpty() {\n\t\th.MinItems = header.MinItems.Value\n\t}\n\tif !header.MaxItems.IsEmpty() {\n\t\th.MaxItems = header.MaxItems.Value\n\t}\n\tif !header.UniqueItems.IsEmpty() {\n\t\th.UniqueItems = header.UniqueItems.IsEmpty()\n\t}\n\tif !header.Enum.IsEmpty() {\n\t\tvar enums []any\n\t\tfor e := range header.Enum.Value {\n\t\t\tenums = append(enums, header.Enum.Value[e].Value)\n\t\t}\n\t\th.Enum = enums\n\t}\n\tif !header.MultipleOf.IsEmpty() {\n\t\th.MultipleOf = header.MultipleOf.Value\n\t}\n\treturn h\n}", "title": "" }, { "docid": "1b74b19e09828a8f324667294ccea9dc", "score": "0.53622407", "text": "func (lens Lens) Header(artifacts []lenses.Artifact, resourceDir string) string {\n\tt, err := template.ParseFiles(filepath.Join(resourceDir, \"template.html\"))\n\tif err != nil {\n\t\treturn fmt.Sprintf(\"<!-- FAILED LOADING HEADER: %v -->\", err)\n\t}\n\tvar buf bytes.Buffer\n\tif err := t.ExecuteTemplate(&buf, \"header\", nil); err != nil {\n\t\treturn fmt.Sprintf(\"<!-- FAILED EXECUTING HEADER TEMPLATE: %v -->\", err)\n\t}\n\treturn buf.String()\n}", "title": "" }, { "docid": "1dc0ed860cacd1e3d6e3ad745ea64dad", "score": "0.5360368", "text": "func showHeader() {\n\theader := fmt.Sprintf(\"pivot version %s\", version)\n\t// If we have a commit hash then add it to the program header\n\tif commitHash != \"\" {\n\t\theader = fmt.Sprintf(\"%s (%s)\", header, commitHash)\n\t}\n\tfmt.Println(header)\n}", "title": "" }, { "docid": "09c97dd0379492de4662d9f2853813a1", "score": "0.53590536", "text": "func WriterCreateHeader(w *zip.Writer, fh *zip.FileHeader,) (io.Writer, error)", "title": "" }, { "docid": "bf99bb8ab64676ba89516a6dd58d0d5f", "score": "0.53531975", "text": "func GenerateHRI(prefix string) string {\n\tif prefix == \"\" {\n\t\tprefix = \"HRI\"\n\t}\n\n\tdatePart := time.Now().Format(hriDatePartFormat)\n\trandPart := RandomString(hriRandPartLength, CharsetUppercase)\n\n\treturn strings.ToUpper(prefix) + \"-\" + datePart + \"-\" + randPart\n}", "title": "" }, { "docid": "82ecbfbc4bd397cb196a7227d424b24e", "score": "0.5351167", "text": "func NewHeader() *Header {\n\tvar result Header\n\tresult.File.ID = 0x46464952\n\tresult.File.Format = 0x45564157\n\tresult.Format.ID = 0x20746d66\n\tresult.Format.Size = 0x10\n\tresult.Format.AudioFormat = 1\n\tresult.Data.ID = 0x61746164\n\treturn &result\n}", "title": "" }, { "docid": "93dbfc24708029bf2cc8d5fac10c1d68", "score": "0.5349015", "text": "func Header(header string) THeader {\n\treturn THeader{header}\n}", "title": "" }, { "docid": "1cf8ded5902214822d762a25e9fb2b16", "score": "0.5348742", "text": "func getDummyHeader(i int) []byte {\n\thdr := []byte{1, 0, 0, 0, 0, 0, 0, 0}\n\thdr[i] = 10\n\treturn hdr\n}", "title": "" }, { "docid": "45431790850a3910ec400b9c989fa2b1", "score": "0.53432053", "text": "func (*CMsgAddHeader) Descriptor() ([]byte, []int) {\n\treturn file_steam_htmlmessages_proto_rawDescGZIP(), []int{19}\n}", "title": "" }, { "docid": "b2c649643295c7936ed3c057092fce71", "score": "0.5330186", "text": "func metaIntoHeaders(md metadata.MD, h http.Header) error {\n\tfor k, vs := range md {\n\t\tcanon := http.CanonicalHeaderKey(k)\n\t\tif isReservedMetadataKey(canon) {\n\t\t\treturn errors.Reason(\"using reserved metadata key %q\", k).Err()\n\t\t}\n\t\tif !strings.HasSuffix(canon, \"-Bin\") {\n\t\t\th[canon] = append(h[canon], vs...)\n\t\t} else {\n\t\t\tfor _, v := range vs {\n\t\t\t\th[canon] = append(h[canon], base64.StdEncoding.EncodeToString([]byte(v)))\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d8b0fa4942ee1bfd27cf4ba4110c2349", "score": "0.53289735", "text": "func (a *AWSSigv4) CreateAuthorizationHeader(keyid, secret string) string {\n\t_, shs := a.createCanonicalHeaders()\n\n\tsigkey := a.createSignatureKey(secret)\n\tcs := a.createCredentialScope()\n\tcr := a.createCanonicalRequest()\n\tsigstr := a.createStringToSign(cs, cr)\n\n\tsig := a.createSignature(string(sigkey), sigstr)\n\n\tauthheader := a.Algorithm + \" \"\n\tauthheader += \"Credential=\" + keyid + \"/\"\n\tauthheader += a.createCredentialScope() + \", \"\n\tauthheader += \"SignedHeaders=\" + shs + \", \"\n\tauthheader += \"Signature=\" + sig\n\n\treturn authheader\n}", "title": "" }, { "docid": "7f1cf3af3b8439596d7a990506aa37b9", "score": "0.532326", "text": "func (o ApiSubscriptionKeyParameterNamesOutput) Header() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ApiSubscriptionKeyParameterNames) string { return v.Header }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "fb94593fd535d69df722125448b510bf", "score": "0.53214794", "text": "func HTTPHeader(len int) []byte {\n\theader := \"POST /GEN/TPFA HTTP/1.0\"\n\treturn []byte(header)\n}", "title": "" }, { "docid": "fc384f8d1aef7bf063d65ec2a49b584e", "score": "0.5310298", "text": "func NewHeader(h *block.Header, chain blockchainer.Blockchainer) Header {\n\tres := Header{\n\t\tHeader: *h,\n\t\tBlockMetadata: BlockMetadata{\n\t\t\tSize: io.GetVarSize(h),\n\t\t\tConfirmations: chain.BlockHeight() - h.Index + 1,\n\t\t},\n\t}\n\n\thash := chain.GetHeaderHash(int(h.Index) + 1)\n\tif !hash.Equals(util.Uint256{}) {\n\t\tres.NextBlockHash = &hash\n\t}\n\treturn res\n}", "title": "" }, { "docid": "dacb33379348a0233bc126f572ebe1ee", "score": "0.5308824", "text": "func (dr *DownloadRange) BuildRangeHeader() string {\n\treturn fmt.Sprintf(\n\t\t\"bytes=%s-%s\",\n\t\tstrconv.Itoa(dr.Start),\n\t\tstrconv.Itoa((dr.End)-1),\n\t)\n}", "title": "" }, { "docid": "6c9ba50daf3b7715e214cc8cd57edf0a", "score": "0.5306585", "text": "func FprintHeader(file *os.File, title string) {\n\tfmt.Fprintf(file,\n\t\t\"<!doctype html>\\n\"+\n\t\t\t\"<html lang=\\\"%s\\\">\\n\"+\n\t\t\t\"<head>\\n\"+\n\t\t\t\" <meta charset=\\\"utf-8\\\">\\n\"+\n\t\t\t\" <title>%s</title>\\n\"+\n\t\t\t\" <meta name=\\\"description\\\" content=\\\"%s\\\">\\n\"+\n\t\t\t\" <meta name=\\\"author\\\" content=\\\"%s\\\">\\n\"+\n\t\t\t\" <link href=\\\"https://fonts.googleapis.com/css?family=Roboto\\\" rel=\\\"stylesheet\\\">\\n\"+\n\t\t\t\" <style>\\n\"+\n\t\t\t\" body {\\n\"+\n\t\t\t\" font-family: 'Roboto', sans-serif;\\n\"+\n\t\t\t\" font-size: 18px\\n\"+\n\t\t\t\" }\\n\"+\n\t\t\t\" </style>\\n\"+\n\t\t\t\" <script type=\\\"text/javascript\\\" async\\n\"+\n\t\t\t\" src=\\\"https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML\\\">\\n\"+\n\t\t\t\" </script>\\n\"+\n\t\t\t\"</head>\\n\"+\n\t\t\t\"<body>\\n\\n\",\n\t\tLang, title, Description, Author)\n}", "title": "" }, { "docid": "536e9d517d09ff73e583a85c07cd4ca3", "score": "0.53059745", "text": "func (r *txtRenderer) RenderHeader(w io.Writer, ast *blackfriday.Node) {}", "title": "" }, { "docid": "d10b7409627f58dd4f6fd9b33cf4d369", "score": "0.53018916", "text": "func (wc *WaveCredentials) GeneratePeerHeader(ns []byte, cert []byte) ([]byte, error) {\n\thdr := bytes.Buffer{}\n\tif len(wc.perspectiveHash) != 34 {\n\t\tpanic(wc.perspectiveHash)\n\t}\n\t//First: 34 byte entity hash\n\thdr.Write(wc.perspectiveHash)\n\t//Second: signature of cert\n\tsigresp, err := wc.wave.Sign(context.Background(), &pb.SignParams{\n\t\tPerspective: wc.perspective,\n\t\tContent: cert,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif sigresp.Error != nil {\n\t\treturn nil, errors.New(sigresp.Error.Message)\n\t}\n\tsiglen := make([]byte, 2)\n\tsig := sigresp.Signature\n\tbinary.LittleEndian.PutUint16(siglen, uint16(len(sig)))\n\thdr.Write(siglen)\n\thdr.Write(sig)\n\n\t//Third: the namespace proof for this namespace\n\tprooflen := make([]byte, 4)\n\tbinary.LittleEndian.PutUint32(prooflen, uint32(len(wc.proof)))\n\thdr.Write(prooflen)\n\thdr.Write(wc.proof)\n\treturn hdr.Bytes(), nil\n}", "title": "" }, { "docid": "2e2ee5ba777f08565ab151b21139b8d8", "score": "0.5301069", "text": "func MakeBinaryHeader(\n\tc Config, nHalo int, textHeader, textNames []byte,\n) nbio.BinHHeader {\n\treturn nbio.BinHHeader{\n\t\tHaloes: int64(nHalo),\n\t\tColumns: c.Columns,\n\t\tMassColumn: c.MassColumn,\n\t\tIntColumns: int64(len(c.IntColumns)), \n\t\tNamesLength: int64(len(textNames)),\n\t\tTextHeaderLength: int64(len(textHeader)),\n\t}\n}", "title": "" }, { "docid": "a8c4bf6b723f1d0b482d6d2628d66b6f", "score": "0.5296064", "text": "func SerializeMetadataHeader(meta map[string]string) string {\n header := \"\"\n for key, value := range meta {\n valueBase64 := base64.StdEncoding.EncodeToString([]byte(value))\n header += key + \" \" + valueBase64 + \",\"\n }\n\n // Remove trailing comma\n if len(header) > 0 {\n header = header[:len(header)-1]\n }\n\n return header\n}", "title": "" }, { "docid": "c5f0e4d326cc2891117da5c7dc56ad4a", "score": "0.52857196", "text": "func headerWithNoFileMetaInformationGroupLength() (*headerData, error) {\n\theaderData := new(headerData)\n\n\telements := []*Element{\n\t\tmustNewElement(tag.MediaStorageSOPClassUID, []string{\"SecondaryCapture\"}),\n\t\tmustNewElement(tag.MediaStorageSOPInstanceUID, []string{\"1.3.6.1.4.1.35190.4.1.20210608.607733549593\"}),\n\t\tmustNewElement(tag.TransferSyntaxUID, []string{\"=RLELossless\"}),\n\t\tmustNewElement(tag.ImplementationClassUID, []string{\"1.6.6.1.4.1.9590.100.1.0.100.4.0\"}),\n\t\tmustNewElement(tag.SOPInstanceUID, []string{\"1.3.6.1.4.1.35190.4.1.20210608.607733549593\"}),\n\t}\n\tdata, err := writeElements(elements)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Construct valid DICOM header preamble.\n\tmagicWord := []byte(\"DICM\")\n\tpreamble := make([]byte, 128)\n\tpreamble = append(preamble, magicWord...)\n\theaderBytes := append(preamble, data...)\n\theaderData.HeaderBytes = bytes.NewBuffer(headerBytes)\n\theaderData.Elements = elements[0 : len(elements)-1]\n\treturn headerData, nil\n}", "title": "" }, { "docid": "45db6815ba3925e2fe8e7ff9a4d31b8d", "score": "0.5284362", "text": "func (*CHTMLHeader) Descriptor() ([]byte, []int) {\n\treturn file_steam_htmlmessages_proto_rawDescGZIP(), []int{43}\n}", "title": "" }, { "docid": "2bebefbf317bbdd95607ecd2adc3f623", "score": "0.5273781", "text": "func headerWithFileMetaInformationGroupLength() (*headerData, error) {\n\theaderData := new(headerData)\n\n\tsopInstanceUidElement := mustNewElement(tag.SOPInstanceUID, []string{\"1.3.6.1.4.1.35190.4.1.20210608.607733549593\"})\n\telements := []*Element{\n\t\tmustNewElement(tag.FileMetaInformationVersion, []byte{0x00, 0x01}),\n\t\tmustNewElement(tag.MediaStorageSOPClassUID, []string{\"1.2.276.0.7230010.3.1.0.1\"}),\n\t\tmustNewElement(tag.MediaStorageSOPInstanceUID, []string{\"1.3.6.1.4.1.35190.4.1.20210608.607733549593\"}),\n\t\tmustNewElement(tag.TransferSyntaxUID, []string{\"=RLELossless\"}),\n\t\tmustNewElement(tag.ImplementationClassUID, []string{\"1.2.276.0.7230010.3.0.3.6.7\"}),\n\t\tmustNewElement(tag.ImplementationVersionName, []string{\"OFFIS_DCMTK_367\"}),\n\t}\n\tdataHeader, err := writeElements(elements)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfileMetaInfoElement := mustNewElement(tag.FileMetaInformationGroupLength, []int{len(dataHeader)})\n\tdataFileMetaInfo, err := writeElements([]*Element{fileMetaInfoElement})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdataSopInstanceUid, err := writeElements([]*Element{sopInstanceUidElement})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdata := append(dataFileMetaInfo, dataHeader...)\n\tdata = append(data, dataSopInstanceUid...)\n\n\t// Construct valid DICOM header preamble.\n\tmagicWord := []byte(\"DICM\")\n\tpreamble := make([]byte, 128)\n\tpreamble = append(preamble, magicWord...)\n\theaderBytes := append(preamble, data...)\n\theaderData.HeaderBytes = bytes.NewBuffer(headerBytes)\n\theaderData.Elements = append([]*Element{fileMetaInfoElement}, elements...)\n\treturn headerData, nil\n}", "title": "" }, { "docid": "27f04ef39e66886384493bfce28d9ba7", "score": "0.5264915", "text": "func Header(summary *string) string {\n\tif summary == nil || len(*summary) == 0 {\n\t\treturn \"<details>\\n\\n```\"\n\t}\n\n\treturn fmt.Sprintf(\"<details><summary>%s</summary>\\n\\n```\", *summary)\n}", "title": "" }, { "docid": "49dd495f8153aeda78055e8aba1c2558", "score": "0.5255881", "text": "func NewHeader(level int, text string) Element {\n\tif level < 1 {\n\t\tlevel = 1\n\t} else if level > 6 {\n\t\tlevel = 6\n\t}\n\n\ttag := fmt.Sprintf(\"h%d\", level)\n\theader := NewTagElement(tag)\n\theader.Add(NewTextElement(text))\n\n\treturn header\n}", "title": "" }, { "docid": "5594146bb4c2d8c5d1e2bcc1551b5129", "score": "0.5252113", "text": "func printOutputHeader() {\n\tfmt.Println(\"\")\n\tfmt.Println(\"FreeTAXII Server\")\n\tfmt.Println(\"Copyright, Bret Jordan\")\n\tfmt.Println(\"Version:\", sVersion)\n\tfmt.Println(\"\")\n}", "title": "" }, { "docid": "1bf5f955119be35b1cf7ddb6b9cf154e", "score": "0.5251545", "text": "func (t *trs80) writeHeader() {\n\th := t.pb.Header\n\tt.writeIntLn(h.Unknown0)\n\tt.writeIntLn(h.NumItems - 1) // adjustment intended\n\tt.writeIntLn(h.NumActions - 1) // adjustment intended\n\tt.writeIntLn(h.NumWords - 1) // adjustment intended\n\tt.writeIntLn(h.NumRooms - 1) // adjustment intended\n\tt.writeIntLn(h.MaxInventory)\n\tt.writeIntLn(h.StartingRoom)\n\tt.writeIntLn(h.NumTreasures)\n\tt.writeIntLn(h.WordLength)\n\tt.writeIntLn(h.LightDuration)\n\tt.writeIntLn(h.NumMessages - 1) // adjustment intended\n\tt.writeIntLn(h.TreasureRoom)\n}", "title": "" }, { "docid": "89449dadd5eecd71ac53837199f82ca8", "score": "0.523778", "text": "func (o BackendCredentialsOutput) Header() pulumi.StringMapOutput {\n\treturn o.ApplyT(func(v BackendCredentials) map[string]string { return v.Header }).(pulumi.StringMapOutput)\n}", "title": "" }, { "docid": "d25050f4ede21d3d22683f1ef0ae286c", "score": "0.5225586", "text": "func convertHeader(h cmtprototypes.Header) Header {\n\treturn Header{\n\t\tVersion: h.Version,\n\t\tChainID: h.ChainID,\n\t\tHeight: h.Height,\n\t\tTime: h.Time,\n\t\tLastBlockId: h.LastBlockId,\n\t\tValidatorsHash: h.ValidatorsHash,\n\t\tNextValidatorsHash: h.NextValidatorsHash,\n\t\tConsensusHash: h.ConsensusHash,\n\t\tAppHash: h.AppHash,\n\t\tDataHash: h.DataHash,\n\t\tEvidenceHash: h.EvidenceHash,\n\t\tLastResultsHash: h.LastResultsHash,\n\t\tLastCommitHash: h.LastCommitHash,\n\t\tProposerAddress: sdk.ConsAddress(h.ProposerAddress).String(),\n\t}\n}", "title": "" }, { "docid": "29502b8bd09302ab28fb95d94935e170", "score": "0.5214569", "text": "func writeRecordHeader() []byte {\n\t// This is predefined from AMZ protocol found here:\n\t// https://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectSELECTContent.html\n\tvar currentMessage = &bytes.Buffer{}\n\t// 11 -event type - 7 - 7 \"Records\"\n\t// header name\n\tcurrentMessage.Write(encodeHeaderStringName(\":event-type\"))\n\t// header type\n\tcurrentMessage.Write(encodeNumber(7, 1))\n\t// header value and header value length\n\tcurrentMessage.Write(encodeHeaderStringValue(\"Records\"))\n\t// Creation of the Header for Content-Type \t// 13 -content-type -7 -24\n\t// \"application/octet-stream\"\n\t// header name\n\tcurrentMessage.Write(encodeHeaderStringName(\":content-type\"))\n\t// header type\n\tcurrentMessage.Write(encodeNumber(7, 1))\n\t// header value and header value length\n\tcurrentMessage.Write(encodeHeaderStringValue(\"application/octet-stream\"))\n\t// Creation of the Header for message-type 13 -message-type -7 5 \"event\"\n\t// header name\n\tcurrentMessage.Write(encodeHeaderStringName(\":message-type\"))\n\t// header type\n\tcurrentMessage.Write(encodeNumber(7, 1))\n\t// header value and header value length\n\tcurrentMessage.Write(encodeHeaderStringValue(\"event\"))\n\treturn currentMessage.Bytes()\n}", "title": "" }, { "docid": "a9bd9a305579d8ac9579fa62221f2035", "score": "0.5201095", "text": "func PrintHeader() {\n\tsyncrLogo := figure.NewFigure(\"SYNCR\", \"\", true)\n\tsyncrLogo.Print()\n\tfmt.Println()\n\n\t// copyright + license information\n\tfmt.Println(\"Syncr by Mingjie Jiang <github.com/itsmingjie>\")\n\tfmt.Println(\"Version \", VER)\n\tfmt.Println(\"Licensed under the Apache License, Version 2.0\")\n\tfmt.Println()\n\n\t// instructions\n\tfmt.Println(\"Drag the source/target folders into this window\")\n\tfmt.Println(\"And press [Enter] to confirm\")\n\tfmt.Println(\"To terminate Syncr, press [CTRL] + [C]\")\n\tfmt.Println()\n}", "title": "" }, { "docid": "dd41b1239c79a0c2eab6702603110ebd", "score": "0.5193545", "text": "func (o BackendServiceCdnPolicyBypassCacheOnRequestHeaderOutput) HeaderName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v BackendServiceCdnPolicyBypassCacheOnRequestHeader) *string { return v.HeaderName }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "f0e2a1eae6387b4e1f048844f55d2759", "score": "0.5192918", "text": "func header() (*template.Template, error) {\n\ttpl := `<head>\n <title>{{ . }}</title>\n <!-- Bootstrap CSS -->\n <link href=\"https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css\" rel=\"stylesheet\" integrity=\"sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T\" crossorigin=\"anonymous\">\n</head>`\n\n\tt := template.New(\"header\")\n\treturn t.Parse(tpl)\n}", "title": "" }, { "docid": "77211c5a64da2aaa354625237bf54138", "score": "0.5190394", "text": "func (r *roffRenderer) RenderHeader(w io.Writer, ast *blackfriday.Node) {\n\t// disable hyphenation\n\tout(w, \".nh\\n\")\n}", "title": "" }, { "docid": "523eabbee4459560fbf7b438a14a01cb", "score": "0.5177433", "text": "func Header(attrs []htmlgo.Attribute, children ...HTML) HTML {\n\treturn &htmlgo.Tree{Tag: \"header\", Attributes: attrs, Children: children}\n}", "title": "" }, { "docid": "f006ec99336c636485ab0d07e20c8d58", "score": "0.5175714", "text": "func drawHeader(s tcell.Screen) {\n\tcontent := \"Current directory: \" + directory.Name\n\tcolourRow(s, footerStyle, 0)\n\tputln(s, footerStyle, content, 0)\n}", "title": "" }, { "docid": "1318dd34d89c9e480c038779b84ff106", "score": "0.5170226", "text": "func MakeChannelHeader(headerType cb.HeaderType, version int32, chainID string, epoch uint64) *cb.ChannelHeader {\n\treturn &cb.ChannelHeader{\n\t\tType: int32(headerType),\n\t\tVersion: version,\n\t\tTimestamp: &timestamp.Timestamp{\n\t\t\tSeconds: time.Now().Unix(),\n\t\t\tNanos: 0,\n\t\t},\n\t\tChannelId: chainID,\n\t\tEpoch: epoch,\n\t}\n}", "title": "" }, { "docid": "d1ac3f0a672ea7b2bf72dd8ec86db007", "score": "0.5166591", "text": "func (c *Call) Header(k string) string {\n\tif c == nil {\n\t\treturn \"\"\n\t}\n\n\tif v, ok := c.md.Headers().Get(k); ok {\n\t\treturn v\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "adf3106263b6b37fa35f2d216249b895", "score": "0.5165439", "text": "func (r *PrivateRR) Header() *RR_Header { return &r.Hdr }", "title": "" }, { "docid": "86cad2ebde78aa1cab33c5ef3a05631d", "score": "0.5163894", "text": "func NewHeaders()(*Headers) {\n m := &Headers{\n }\n m.backingStore = ie8677ce2c7e1b4c22e9c3827ecd078d41185424dd9eeb92b7d971ed2d49a392e.BackingStoreFactoryInstance();\n m.SetAdditionalData(make(map[string]any))\n return m\n}", "title": "" }, { "docid": "0b5f1b1a14d52113c2941f42d94544e7", "score": "0.51539207", "text": "func addStdHeaders(headers http.Header) http.Header {\n\theaders.Set(\"Accept-Encoding\", \"gzip\")\n\t// So that I can have a static id for tests.\n\tif testID != \"\" {\n\t\theaders.Set(\"client-request-id\", testID)\n\t\theaders.Set(\"Return-Client-Request-Id\", \"false\")\n\t} else {\n\t\theaders.Set(\"client-request-id\", uuid.New().String())\n\t\theaders.Set(\"Return-Client-Request-Id\", \"false\")\n\t}\n\theaders.Set(\"x-client-sku\", \"MSAL.Go\")\n\theaders.Set(\"x-client-os\", runtime.GOOS)\n\theaders.Set(\"x-client-cpu\", runtime.GOARCH)\n\theaders.Set(\"x-client-ver\", version.Version)\n\treturn headers\n}", "title": "" }, { "docid": "81d106587041697c78067ca48f8baded", "score": "0.51515055", "text": "func (c streamClient) Header() (metadata.MD, error) { return nil, nil }", "title": "" }, { "docid": "5b4218967175ebb0f929202fe60b89b8", "score": "0.5150902", "text": "func (o BackendCredentialsPtrOutput) Header() pulumi.StringMapOutput {\n\treturn o.ApplyT(func(v *BackendCredentials) map[string]string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Header\n\t}).(pulumi.StringMapOutput)\n}", "title": "" }, { "docid": "e373d098baa517f3800e5d36adf0af01", "score": "0.5150801", "text": "func PrefixHeader(hash []byte, sigType SignatureType) []byte {\n\tswitch sigType {\n\tcase SignatureType_TRON:\n\t\treturn ssha.SoliditySHA3(\n\t\t\tssha.String(\"\\x19TRON Signed Message:\\n32\"),\n\t\t\thash,\n\t\t)\n\t}\n\treturn hash\n}", "title": "" }, { "docid": "380d28c9a02a51b9fa51a2b6626ff447", "score": "0.5147281", "text": "func RRHeader(name string, rrtype uint16, ttl uint32) dns.RR_Header {\n\treturn dns.RR_Header{\n\t\tName: name,\n\t\tRrtype: rrtype,\n\t\tClass: dns.ClassINET,\n\t\tTtl: ttl,\n\t}\n}", "title": "" }, { "docid": "422bbe14c3d9e92ed50a1f289105d998", "score": "0.5145849", "text": "func PrintHeader(header string) {\r\n\tfmt.Println(header)\r\n\tfmt.Println(strings.Repeat(\"-\", len(header)))\r\n}", "title": "" }, { "docid": "6848fc34c4509d01c1ca0e565b0f53bf", "score": "0.5143352", "text": "func (o BackendBucketCdnPolicyBypassCacheOnRequestHeaderOutput) HeaderName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v BackendBucketCdnPolicyBypassCacheOnRequestHeader) *string { return v.HeaderName }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "4ab1f74aa175bf79346f3c607f481142", "score": "0.513768", "text": "func StrHeader(fullLen int, fill string, str string) (hdrStr string) {\n\tvar ln, lfLen, rtLen int\n\tif fill == \"\" {\n\t\tfill = \"-\"\n\t} else {\n\t\tfill = fill[:1]\n\t}\n\tln = len(str)\n\tif ln+4 < fullLen {\n\t\tlfLen = (fullLen - ln) / 2\n\t\trtLen = fullLen - ln - lfLen\n\t} else {\n\t\tlfLen = 2\n\t\trtLen = 2\n\t}\n\thdrStr = fmt.Sprintf(\"%s%s%s\", strings.Repeat(fill, lfLen), str, strings.Repeat(fill, rtLen))\n\treturn\n}", "title": "" }, { "docid": "b74e970f737c1dd357924aa6329bd95e", "score": "0.5132886", "text": "func headersServBefMay() [][]string {\n\tvar csvFinal [][]string\n\theaders := []string{\"name\", \"role\", \"workplace\", \"wage\", \"personalBenefits\", \"positionOfTrust\",\n\t\t\"perks\", \"eventualBenefits\", \"totalIncome\", \"prevContribution\", \"incomeTax\",\n\t\t\"othersDisc\", \"ceilRetention\", \"totalDisc\", \"incomeFinal\", \"daily\"}\n\treturn append(csvFinal, headers)\n}", "title": "" }, { "docid": "3dceb5a72e53d9dc6e193d68e4b93702", "score": "0.5127032", "text": "func execmMIMEHeaderAdd(_ int, p *gop.Context) {\n\targs := p.GetArgs(3)\n\targs[0].(textproto.MIMEHeader).Add(args[1].(string), args[2].(string))\n}", "title": "" } ]
03f63504749bbe2f8fd2f8d6546b2af9
GetOrCreateLinkDelay retrieves the value of the LinkDelay field or returns the existing field if it already exists.
[ { "docid": "8666f9321cf45b3d5b45cd5901fa97bb", "score": "0.82095474", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv) GetOrCreateLinkDelay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_LinkDelay {\n\tif t.LinkDelay != nil {\n\t\treturn t.LinkDelay\n\t}\n\tt.LinkDelay = &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_LinkDelay{}\n\treturn t.LinkDelay\n}", "title": "" } ]
[ { "docid": "4e0271f53b73b16603af0df3ce99f163", "score": "0.8324656", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv) GetOrCreateLinkDelay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_LinkDelay {\n\tif t.LinkDelay != nil {\n\t\treturn t.LinkDelay\n\t}\n\tt.LinkDelay = &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_LinkDelay{}\n\treturn t.LinkDelay\n}", "title": "" }, { "docid": "c9eb8c15084fb5e5045395f6ec00e1af", "score": "0.83172417", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv) GetOrCreateLinkDelay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelay {\n\tif t.LinkDelay != nil {\n\t\treturn t.LinkDelay\n\t}\n\tt.LinkDelay = &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelay{}\n\treturn t.LinkDelay\n}", "title": "" }, { "docid": "33c53b181f1de7c4ec5b6a8a5d4ff35a", "score": "0.8292875", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv) GetOrCreateLinkDelay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelay {\n\tif t.LinkDelay != nil {\n\t\treturn t.LinkDelay\n\t}\n\tt.LinkDelay = &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelay{}\n\treturn t.LinkDelay\n}", "title": "" }, { "docid": "784fdfc63da9d7ea47dd04b4fa852fe1", "score": "0.7130255", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv) GetOrCreateLinkDelayVariation() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_LinkDelayVariation {\n\tif t.LinkDelayVariation != nil {\n\t\treturn t.LinkDelayVariation\n\t}\n\tt.LinkDelayVariation = &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_LinkDelayVariation{}\n\treturn t.LinkDelayVariation\n}", "title": "" }, { "docid": "ac77d6bc4a7b919b97fc8eda856e7deb", "score": "0.7113886", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_Ipv4ExternalReachability_Prefix) GetOrCreateDelayMetric() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_Ipv4ExternalReachability_Prefix_DelayMetric {\n\tif t.DelayMetric != nil {\n\t\treturn t.DelayMetric\n\t}\n\tt.DelayMetric = &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_Ipv4ExternalReachability_Prefix_DelayMetric{}\n\treturn t.DelayMetric\n}", "title": "" }, { "docid": "63de4f9934cd53948be1745d65406c83", "score": "0.7103199", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsReachability_Neighbor) GetOrCreateDelayMetric() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsReachability_Neighbor_DelayMetric {\n\tif t.DelayMetric != nil {\n\t\treturn t.DelayMetric\n\t}\n\tt.DelayMetric = &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsReachability_Neighbor_DelayMetric{}\n\treturn t.DelayMetric\n}", "title": "" }, { "docid": "c256d8228810434b0abf6315131c839e", "score": "0.7045746", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv) GetOrCreateLinkDelayVariation() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelayVariation {\n\tif t.LinkDelayVariation != nil {\n\t\treturn t.LinkDelayVariation\n\t}\n\tt.LinkDelayVariation = &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelayVariation{}\n\treturn t.LinkDelayVariation\n}", "title": "" }, { "docid": "0b399601a3ed767758e14301b02ee9f9", "score": "0.70337886", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv) GetOrCreateMinMaxLinkDelay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_MinMaxLinkDelay {\n\tif t.MinMaxLinkDelay != nil {\n\t\treturn t.MinMaxLinkDelay\n\t}\n\tt.MinMaxLinkDelay = &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_MinMaxLinkDelay{}\n\treturn t.MinMaxLinkDelay\n}", "title": "" }, { "docid": "b26f14ca9a86668078f2f61a9617841c", "score": "0.7030271", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv) GetOrCreateLinkDelayVariation() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelayVariation {\n\tif t.LinkDelayVariation != nil {\n\t\treturn t.LinkDelayVariation\n\t}\n\tt.LinkDelayVariation = &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelayVariation{}\n\treturn t.LinkDelayVariation\n}", "title": "" }, { "docid": "ceaa21617e977fd7e3bd99afd20ba374", "score": "0.6971658", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv) GetOrCreateMinMaxLinkDelay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_MinMaxLinkDelay {\n\tif t.MinMaxLinkDelay != nil {\n\t\treturn t.MinMaxLinkDelay\n\t}\n\tt.MinMaxLinkDelay = &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_MinMaxLinkDelay{}\n\treturn t.MinMaxLinkDelay\n}", "title": "" }, { "docid": "4dfe6b2036e1a13d409f4cb0e2008948", "score": "0.69424516", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_Ipv4InternalReachability_Prefix) GetOrCreateDelayMetric() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_Ipv4InternalReachability_Prefix_DelayMetric {\n\tif t.DelayMetric != nil {\n\t\treturn t.DelayMetric\n\t}\n\tt.DelayMetric = &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_Ipv4InternalReachability_Prefix_DelayMetric{}\n\treturn t.DelayMetric\n}", "title": "" }, { "docid": "3493dc63d3e45e4ad98187284767ace2", "score": "0.6926242", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv) GetOrCreateLinkDelayVariation() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_LinkDelayVariation {\n\tif t.LinkDelayVariation != nil {\n\t\treturn t.LinkDelayVariation\n\t}\n\tt.LinkDelayVariation = &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_LinkDelayVariation{}\n\treturn t.LinkDelayVariation\n}", "title": "" }, { "docid": "d105ecb2634b22091059d6a1d16df11c", "score": "0.6918445", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv) GetOrCreateMinMaxLinkDelay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_MinMaxLinkDelay {\n\tif t.MinMaxLinkDelay != nil {\n\t\treturn t.MinMaxLinkDelay\n\t}\n\tt.MinMaxLinkDelay = &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_MinMaxLinkDelay{}\n\treturn t.MinMaxLinkDelay\n}", "title": "" }, { "docid": "aca4617988f740b002fd371335ec2605", "score": "0.6897815", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv) GetLinkDelay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelay {\n\tif t != nil && t.LinkDelay != nil {\n\t\treturn t.LinkDelay\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "dee7ff5e74ef3a0cc1649a3eec6e4dae", "score": "0.6893084", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv) GetLinkDelay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelay {\n\tif t != nil && t.LinkDelay != nil {\n\t\treturn t.LinkDelay\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ae3968e6716ee060ec9abe814897824e", "score": "0.6856432", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv) GetLinkDelay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_LinkDelay {\n\tif t != nil && t.LinkDelay != nil {\n\t\treturn t.LinkDelay\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "39a88460f465c04d81cc63361e352e30", "score": "0.68456125", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelay) GetDelay() uint32 {\n\tif t == nil || t.Delay == nil {\n\t\treturn 0\n\t}\n\treturn *t.Delay\n}", "title": "" }, { "docid": "c16d4841a946aa5d5f295171d0f87124", "score": "0.68268555", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv) GetOrCreateMinMaxLinkDelay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_MinMaxLinkDelay {\n\tif t.MinMaxLinkDelay != nil {\n\t\treturn t.MinMaxLinkDelay\n\t}\n\tt.MinMaxLinkDelay = &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_MinMaxLinkDelay{}\n\treturn t.MinMaxLinkDelay\n}", "title": "" }, { "docid": "8c29e6b080a5b2f2c65f0ed024243048", "score": "0.6825732", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv) GetLinkDelay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_LinkDelay {\n\tif t != nil && t.LinkDelay != nil {\n\t\treturn t.LinkDelay\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b8dca0705a675197acf62b0e5e14b0a5", "score": "0.68167603", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelay) GetDelay() uint32 {\n\tif t == nil || t.Delay == nil {\n\t\treturn 0\n\t}\n\treturn *t.Delay\n}", "title": "" }, { "docid": "b483946b9827ec55d95ee936fd133db2", "score": "0.6796679", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_LinkDelay) GetDelay() uint32 {\n\tif t == nil || t.Delay == nil {\n\t\treturn 0\n\t}\n\treturn *t.Delay\n}", "title": "" }, { "docid": "0f68776bef97bb75f948c49b68ab9db6", "score": "0.6740019", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_LinkDelay) GetDelay() uint32 {\n\tif t == nil || t.Delay == nil {\n\t\treturn 0\n\t}\n\treturn *t.Delay\n}", "title": "" }, { "docid": "5d31d1dd1db8aa40c3341f9dd1090820", "score": "0.6460996", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelayVariation) GetDelay() uint32 {\n\tif t == nil || t.Delay == nil {\n\t\treturn 0\n\t}\n\treturn *t.Delay\n}", "title": "" }, { "docid": "d785ecef7d44dccc05a3a7337825b9e1", "score": "0.64378905", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_LinkDelayVariation) GetDelay() uint32 {\n\tif t == nil || t.Delay == nil {\n\t\treturn 0\n\t}\n\treturn *t.Delay\n}", "title": "" }, { "docid": "795a1968ce2d5232756108e0d79510ba", "score": "0.64276123", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelayVariation) GetDelay() uint32 {\n\tif t == nil || t.Delay == nil {\n\t\treturn 0\n\t}\n\treturn *t.Delay\n}", "title": "" }, { "docid": "b01acf96273bf76dfc3de6de6e03d8d7", "score": "0.63681334", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_LinkDelayVariation) GetDelay() uint32 {\n\tif t == nil || t.Delay == nil {\n\t\treturn 0\n\t}\n\treturn *t.Delay\n}", "title": "" }, { "docid": "20b27f0d9dcbf665a6b8fb900a7af894", "score": "0.6243586", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_MinMaxLinkDelay) GetMaxDelay() uint32 {\n\tif t == nil || t.MaxDelay == nil {\n\t\treturn 0\n\t}\n\treturn *t.MaxDelay\n}", "title": "" }, { "docid": "514bda8e34e81e33e180141f598fcf5b", "score": "0.6221549", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_MinMaxLinkDelay) GetMaxDelay() uint32 {\n\tif t == nil || t.MaxDelay == nil {\n\t\treturn 0\n\t}\n\treturn *t.MaxDelay\n}", "title": "" }, { "docid": "930868f1c5326a8ee098a164bec8654e", "score": "0.6212548", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_MinMaxLinkDelay) GetMaxDelay() uint32 {\n\tif t == nil || t.MaxDelay == nil {\n\t\treturn 0\n\t}\n\treturn *t.MaxDelay\n}", "title": "" }, { "docid": "17cd47fb906dc564dd51a83615bdd6f3", "score": "0.61758", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv) GetLinkDelayVariation() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_LinkDelayVariation {\n\tif t != nil && t.LinkDelayVariation != nil {\n\t\treturn t.LinkDelayVariation\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d37ea8611a5a35449e263b8e67f18111", "score": "0.6171607", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_MinMaxLinkDelay) GetMaxDelay() uint32 {\n\tif t == nil || t.MaxDelay == nil {\n\t\treturn 0\n\t}\n\treturn *t.MaxDelay\n}", "title": "" }, { "docid": "3a60ee32c1de265d048a1c017b5fd70c", "score": "0.6062447", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv) GetLinkDelayVariation() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelayVariation {\n\tif t != nil && t.LinkDelayVariation != nil {\n\t\treturn t.LinkDelayVariation\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8cdfca8a6e136141c3173ac2b29a697f", "score": "0.60545605", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv) GetLinkDelayVariation() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelayVariation {\n\tif t != nil && t.LinkDelayVariation != nil {\n\t\treturn t.LinkDelayVariation\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "00220a51c8d804fd88df85de40dbf219", "score": "0.59853643", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv) GetLinkDelayVariation() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_LinkDelayVariation {\n\tif t != nil && t.LinkDelayVariation != nil {\n\t\treturn t.LinkDelayVariation\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "19750bf99c7061c019ee2c1f4807667f", "score": "0.59492356", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_MinMaxLinkDelay) GetMinDelay() uint32 {\n\tif t == nil || t.MinDelay == nil {\n\t\treturn 0\n\t}\n\treturn *t.MinDelay\n}", "title": "" }, { "docid": "1bbf93ac37b437080c074ac4b0aebc06", "score": "0.59340733", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_MinMaxLinkDelay) GetMinDelay() uint32 {\n\tif t == nil || t.MinDelay == nil {\n\t\treturn 0\n\t}\n\treturn *t.MinDelay\n}", "title": "" }, { "docid": "2ee1ac92ff15256757157c25fcaff960", "score": "0.591244", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_MinMaxLinkDelay) GetMinDelay() uint32 {\n\tif t == nil || t.MinDelay == nil {\n\t\treturn 0\n\t}\n\treturn *t.MinDelay\n}", "title": "" }, { "docid": "27e1711e7095a7adee139e931aa4df33", "score": "0.586648", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_MinMaxLinkDelay) GetMinDelay() uint32 {\n\tif t == nil || t.MinDelay == nil {\n\t\treturn 0\n\t}\n\treturn *t.MinDelay\n}", "title": "" }, { "docid": "25bac5706e76d1c5e71c82a36d794190", "score": "0.5798517", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsReachability_Neighbor) GetDelayMetric() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsReachability_Neighbor_DelayMetric {\n\tif t != nil && t.DelayMetric != nil {\n\t\treturn t.DelayMetric\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "62a7412e03b3f20d6a33e62205985100", "score": "0.57704437", "text": "func StaticDelay(d time.Duration) DelayFunc {\n\treturn func(string) time.Duration { return d }\n}", "title": "" }, { "docid": "78f480e767fa807c1664cddf61d84c4d", "score": "0.5739435", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv) GetMinMaxLinkDelay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_MinMaxLinkDelay {\n\tif t != nil && t.MinMaxLinkDelay != nil {\n\t\treturn t.MinMaxLinkDelay\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c0d55ec365c080b2a47ec93457edd3e0", "score": "0.5719036", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_Ipv4ExternalReachability_Prefix) GetDelayMetric() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_Ipv4ExternalReachability_Prefix_DelayMetric {\n\tif t != nil && t.DelayMetric != nil {\n\t\treturn t.DelayMetric\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0640a8254bf39fcfd478478cc8bc351f", "score": "0.5682624", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv) GetMinMaxLinkDelay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_MinMaxLinkDelay {\n\tif t != nil && t.MinMaxLinkDelay != nil {\n\t\treturn t.MinMaxLinkDelay\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a49a6a8258f36435ea753d85f7d2bd0d", "score": "0.56530154", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv) GetMinMaxLinkDelay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_MinMaxLinkDelay {\n\tif t != nil && t.MinMaxLinkDelay != nil {\n\t\treturn t.MinMaxLinkDelay\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4b1dc3c3e8ce26a4db7235ff819992d3", "score": "0.5594679", "text": "func NewDelay(opts []string) (Delay, error) {\n\tif len(opts) == 0 {\n\t\treturn Delay{}, ErrNoArgs\n\t}\n\n\tms, err := strconv.ParseInt(strings.TrimSpace(opts[0]), 10, 64)\n\tif err != nil {\n\t\treturn Delay{}, ErrBadArg\n\t}\n\n\treturn Delay{Interval: ms}, nil\n}", "title": "" }, { "docid": "102e65b813a0dbb13fce7b53bc572bb7", "score": "0.5579199", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv) GetMinMaxLinkDelay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_MinMaxLinkDelay {\n\tif t != nil && t.MinMaxLinkDelay != nil {\n\t\treturn t.MinMaxLinkDelay\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0797664d665e375a253429f2f5b1d716", "score": "0.5554169", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_Ipv4InternalReachability_Prefix) GetDelayMetric() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_Ipv4InternalReachability_Prefix_DelayMetric {\n\tif t != nil && t.DelayMetric != nil {\n\t\treturn t.DelayMetric\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "909dab44d1929e3e422974165e0dc85b", "score": "0.55280924", "text": "func (o GrpcRouteRuleActionFaultInjectionPolicyPtrOutput) Delay() GrpcRouteRuleActionFaultInjectionPolicyDelayPtrOutput {\n\treturn o.ApplyT(func(v *GrpcRouteRuleActionFaultInjectionPolicy) *GrpcRouteRuleActionFaultInjectionPolicyDelay {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Delay\n\t}).(GrpcRouteRuleActionFaultInjectionPolicyDelayPtrOutput)\n}", "title": "" }, { "docid": "00e01796b3a8bc6de3e14f5e966dc396", "score": "0.5512197", "text": "func NewDelay() Producer {\n\ta := new(delay)\n\ta.name = Delay\n\treturn Producer(a)\n}", "title": "" }, { "docid": "deeb1b0d2f33f1a02e2cce3d66bdecec", "score": "0.549879", "text": "func (o HttpRouteRuleActionFaultInjectionPolicyPtrOutput) Delay() HttpRouteRuleActionFaultInjectionPolicyDelayPtrOutput {\n\treturn o.ApplyT(func(v *HttpRouteRuleActionFaultInjectionPolicy) *HttpRouteRuleActionFaultInjectionPolicyDelay {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Delay\n\t}).(HttpRouteRuleActionFaultInjectionPolicyDelayPtrOutput)\n}", "title": "" }, { "docid": "bbefdc4d7d988f729e9f52257e8d061a", "score": "0.54370147", "text": "func (o GrpcRouteRuleActionFaultInjectionPolicyOutput) Delay() GrpcRouteRuleActionFaultInjectionPolicyDelayPtrOutput {\n\treturn o.ApplyT(func(v GrpcRouteRuleActionFaultInjectionPolicy) *GrpcRouteRuleActionFaultInjectionPolicyDelay {\n\t\treturn v.Delay\n\t}).(GrpcRouteRuleActionFaultInjectionPolicyDelayPtrOutput)\n}", "title": "" }, { "docid": "b8940623498e18e861b75f6374265013", "score": "0.5417888", "text": "func (o HttpRouteRuleActionFaultInjectionPolicyOutput) Delay() HttpRouteRuleActionFaultInjectionPolicyDelayPtrOutput {\n\treturn o.ApplyT(func(v HttpRouteRuleActionFaultInjectionPolicy) *HttpRouteRuleActionFaultInjectionPolicyDelay {\n\t\treturn v.Delay\n\t}).(HttpRouteRuleActionFaultInjectionPolicyDelayPtrOutput)\n}", "title": "" }, { "docid": "bec011c19ad44519a6d5aa111958d9db", "score": "0.5360311", "text": "func (t *NetworkInstance_Protocol_Isis_Global_LspBit_OverloadBit_ResetTrigger) GetDelay() uint16 {\n\tif t == nil || t.Delay == nil {\n\t\treturn 0\n\t}\n\treturn *t.Delay\n}", "title": "" }, { "docid": "40a4496ee3c7b5797a4f060cfb1fa516", "score": "0.52562857", "text": "func (h *Host) Delay() time.Duration {\n\treturn time.Duration(h.TimeDelay)\n}", "title": "" }, { "docid": "eb440692ca3fcf4dd3b5fd94f99c297e", "score": "0.5232661", "text": "func (h Helper) Delay() time.Duration {\n\treturn time.Duration(h.Frames[h.index].delay) * (time.Second / 100)\n}", "title": "" }, { "docid": "f677bb747857b8cf41e8e0c39924e505", "score": "0.52027905", "text": "func (o GrpcRouteRuleActionFaultInjectionPolicyDelayPtrOutput) FixedDelay() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *GrpcRouteRuleActionFaultInjectionPolicyDelay) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.FixedDelay\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "933afca6d75c9b7b72269148840a1c52", "score": "0.51954865", "text": "func (c *cronDelay) Delay(interval int64) *Job {\n\treturn newDelayJob(interval)\n}", "title": "" }, { "docid": "61f9da1ea840281666df797b357e5a3a", "score": "0.51872945", "text": "func (r *Reservation) Delay() time.Duration {\n\treturn r.DelayFrom(time.Now())\n}", "title": "" }, { "docid": "62e2a27a82a3ac512c8ee5e0cd226b59", "score": "0.51605624", "text": "func (c *Context) GetDelay(b int64) int64 {\n\treturn int64(C.swr_get_delay((*C.struct_SwrContext)(c), C.int64_t(b)))\n}", "title": "" }, { "docid": "c19132ddf7bb7d40d8a7cec6e60aa10f", "score": "0.5157019", "text": "func (o HttpRouteRuleActionFaultInjectionPolicyDelayPtrOutput) FixedDelay() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *HttpRouteRuleActionFaultInjectionPolicyDelay) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.FixedDelay\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "d81a93ddcb75d058c5e8b3aa5e3ca6eb", "score": "0.5074023", "text": "func (job *OnceJob) Delay(delay time.Duration) *OnceJob {\n\tjob.delay = delay\n\tjob.expectedScheduledTime = time.Now().Add(delay).Truncate(time.Second)\n\treturn job\n}", "title": "" }, { "docid": "87f21994c075d42c6020ecda5090256e", "score": "0.5018043", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv) GetOrCreateLinkLoss() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkLoss {\n\tif t.LinkLoss != nil {\n\t\treturn t.LinkLoss\n\t}\n\tt.LinkLoss = &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkLoss{}\n\treturn t.LinkLoss\n}", "title": "" }, { "docid": "a6192052c50b8932dcd013dd59ec0b66", "score": "0.50133014", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv) GetOrCreateLinkLoss() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_LinkLoss {\n\tif t.LinkLoss != nil {\n\t\treturn t.LinkLoss\n\t}\n\tt.LinkLoss = &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_LinkLoss{}\n\treturn t.LinkLoss\n}", "title": "" }, { "docid": "e1217ffd57cad7fa66bdb51a2a67b485", "score": "0.5008656", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv) GetOrCreateLinkLoss() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkLoss {\n\tif t.LinkLoss != nil {\n\t\treturn t.LinkLoss\n\t}\n\tt.LinkLoss = &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkLoss{}\n\treturn t.LinkLoss\n}", "title": "" }, { "docid": "e28e43e83094caa3dc2bb4d12c5b8a7d", "score": "0.50011", "text": "func computeBackoffDelay(req Request) time.Duration {\n\td := 200 * time.Millisecond\n\td += (time.Duration(rand.Intn(100)) * time.Millisecond)\n\td += req.GetRetryTime()\n\treturn d\n}", "title": "" }, { "docid": "fb590e0db950904b56e99644231cdd6f", "score": "0.49957693", "text": "func (o *MonitorDatabaseValue) GetDelayTimeSec() float64 {\n\treturn o.DelayTimeSec\n}", "title": "" }, { "docid": "9058e57402b1e63c7ebac79e09067933", "score": "0.49949467", "text": "func (t *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_TrafficEngineering_Tlv) GetOrCreateLink() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_TrafficEngineering_Tlv_Link {\n\tif t.Link != nil {\n\t\treturn t.Link\n\t}\n\tt.Link = &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_TrafficEngineering_Tlv_Link{}\n\treturn t.Link\n}", "title": "" }, { "docid": "c7e351679b11bcee855e80fe9738c03c", "score": "0.49688932", "text": "func (o GrpcRouteRuleActionFaultInjectionPolicyDelayOutput) FixedDelay() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v GrpcRouteRuleActionFaultInjectionPolicyDelay) *string { return v.FixedDelay }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "ae1db0d0020c62b956cfe90ba8c8244f", "score": "0.4940754", "text": "func (o HttpRouteRuleActionFaultInjectionPolicyDelayOutput) FixedDelay() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v HttpRouteRuleActionFaultInjectionPolicyDelay) *string { return v.FixedDelay }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "7426126e9d8fea094bcd07002b996027", "score": "0.4926166", "text": "func (s *CreateNetworkProfileInput) SetDownlinkDelayMs(v int64) *CreateNetworkProfileInput {\n\ts.DownlinkDelayMs = &v\n\treturn s\n}", "title": "" }, { "docid": "bc0ef3d362969884f41c147fac582333", "score": "0.49198923", "text": "func (d DelayInfo) Delayed() DelayInfo {\n\treturn d\n}", "title": "" }, { "docid": "ea41558f9b7e701017d352edee5a5d3a", "score": "0.4901719", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv) GetOrCreateLinkLoss() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_LinkLoss {\n\tif t.LinkLoss != nil {\n\t\treturn t.LinkLoss\n\t}\n\tt.LinkLoss = &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_LinkLoss{}\n\treturn t.LinkLoss\n}", "title": "" }, { "docid": "779df22739e1135e1faedcf1e68440fa", "score": "0.48883644", "text": "func (s *NetworkProfile) SetUplinkDelayMs(v int64) *NetworkProfile {\n\ts.UplinkDelayMs = &v\n\treturn s\n}", "title": "" }, { "docid": "a9b750f453acc5b49c3cfe78d5fb0966", "score": "0.4886727", "text": "func WithDelay(d time.Duration) TaskOpt {\n\treturn &withDelay{d, time.Now()}\n}", "title": "" }, { "docid": "07ab8a621f2aa00e526cac74b451371f", "score": "0.48782358", "text": "func (c *Cron) DelayAdd(ctx context.Context, delay time.Duration, pattern string, job JobFunc, name ...string) {\n\tgtimer.AddOnce(ctx, delay, func(ctx context.Context) {\n\t\tif _, err := c.Add(ctx, pattern, job, name...); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t})\n}", "title": "" }, { "docid": "8f78bb57372cd4ea7985f37a1c1be438", "score": "0.4873808", "text": "func (_this *DelayNode) DelayTime() *AudioParam {\n\tvar ret *AudioParam\n\tvalue := _this.Value_JS.Get(\"delayTime\")\n\tret = AudioParamFromJS(value)\n\treturn ret\n}", "title": "" }, { "docid": "05f2a79e4d6ec57137215ff66cd40d11", "score": "0.48703936", "text": "func (t *NetworkInstance_Mpls_SignalingProtocols_Ldp) GetOrCreateTargeted() *NetworkInstance_Mpls_SignalingProtocols_Ldp_Targeted {\n\tif t.Targeted != nil {\n\t\treturn t.Targeted\n\t}\n\tt.Targeted = &NetworkInstance_Mpls_SignalingProtocols_Ldp_Targeted{}\n\treturn t.Targeted\n}", "title": "" }, { "docid": "0708eacbeddb7987e8d6bbf8b3debf48", "score": "0.48703757", "text": "func (o *Options) GetNewHostDelay() int {\n\tif o == nil || o.NewHostDelay == nil {\n\t\treturn 0\n\t}\n\treturn *o.NewHostDelay\n}", "title": "" }, { "docid": "e75ffbd3d39721bd63e8567ee39b122d", "score": "0.48389074", "text": "func (o *GSLBCreateRequest) GetDelayLoop() int {\n\tif o.DelayLoop == 0 {\n\t\treturn 10\n\t}\n\treturn o.DelayLoop\n}", "title": "" }, { "docid": "7936d6902f01a853fbe36e838473977b", "score": "0.4834887", "text": "func DelayAdd(delay time.Duration, interval time.Duration, job JobFunc) {\n\tdefaultTimer.DelayAdd(delay, interval, job)\n}", "title": "" }, { "docid": "cc02be1a276f3aefcc4b0ba5300e9fad", "score": "0.4829781", "text": "func (s *UpdateNetworkProfileInput) SetDownlinkDelayMs(v int64) *UpdateNetworkProfileInput {\n\ts.DownlinkDelayMs = &v\n\treturn s\n}", "title": "" }, { "docid": "dbb726c11e62784e010a13e02dafaf04", "score": "0.4828537", "text": "func (o GroupInstanceRefreshPreferencesPtrOutput) CheckpointDelay() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *GroupInstanceRefreshPreferences) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.CheckpointDelay\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "e1c5edc908ce7d8edc4831f36483e960", "score": "0.48258638", "text": "func (o *SimpleMonitorCreateRequest) GetDelayLoop() int {\n\tif o.DelayLoop == 0 {\n\t\treturn 60\n\t}\n\treturn o.DelayLoop\n}", "title": "" }, { "docid": "d45eaa06215dd5e6d7ffd8b5ef1baa38", "score": "0.48206872", "text": "func (t *NetworkInstance_Mpls_SignalingProtocols) GetOrCreateLdp() *NetworkInstance_Mpls_SignalingProtocols_Ldp {\n\tif t.Ldp != nil {\n\t\treturn t.Ldp\n\t}\n\tt.Ldp = &NetworkInstance_Mpls_SignalingProtocols_Ldp{}\n\treturn t.Ldp\n}", "title": "" }, { "docid": "2990315355548ee60480cae2156efa50", "score": "0.47895396", "text": "func (o GroupInstanceRefreshPreferencesOutput) CheckpointDelay() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v GroupInstanceRefreshPreferences) *string { return v.CheckpointDelay }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "f83a990bb2810fbb2c1139881a2519c4", "score": "0.4779899", "text": "func (t *NetworkInstance_Mpls_Lsps_UnconstrainedPath_PathSetupProtocol) GetOrCreateLdp() *NetworkInstance_Mpls_Lsps_UnconstrainedPath_PathSetupProtocol_Ldp {\n\tif t.Ldp != nil {\n\t\treturn t.Ldp\n\t}\n\tt.Ldp = &NetworkInstance_Mpls_Lsps_UnconstrainedPath_PathSetupProtocol_Ldp{}\n\treturn t.Ldp\n}", "title": "" }, { "docid": "45a674bb1a80698467aa42a329eb205a", "score": "0.47791412", "text": "func (t *NetworkInstance_Protocol_Ospfv2_Global_Timers_LsaGeneration) GetMaximumDelay() uint32 {\n\tif t == nil || t.MaximumDelay == nil {\n\t\treturn 0\n\t}\n\treturn *t.MaximumDelay\n}", "title": "" }, { "docid": "3a6729e54361d56a772a09de5c00a110", "score": "0.4771255", "text": "func (j *Job) GetDelayTimeFromNow() time.Time {\n\treturn time.Now().Add(time.Duration(j.Delay))\n}", "title": "" }, { "docid": "16bf0303bc31075dbae17e9d995cb2a2", "score": "0.47632086", "text": "func (o ListChartOutput) MaxDelay() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *ListChart) pulumi.IntPtrOutput { return v.MaxDelay }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "7f84cd62326f89760431e62db27ecf00", "score": "0.47613055", "text": "func (c Config) GasUpdaterBlockDelay() uint16 {\n\tif c.viper.IsSet(EnvVarName(\"GasUpdaterBlockDelay\")) {\n\t\treturn uint16(c.viper.GetUint32(EnvVarName(\"GasUpdaterBlockDelay\")))\n\t}\n\treturn chainSpecificConfig(c).GasUpdaterBlockDelay\n}", "title": "" }, { "docid": "4a35a42f307fdd1900cf0e9d03fd1aab", "score": "0.4759825", "text": "func (l *Loader) RetryDelay() time.Duration {\n\treturn l.cfg.RetryDelay\n}", "title": "" }, { "docid": "4e7080bff378280f0cdaee6e64673303", "score": "0.4725936", "text": "func DelayAddSingleton(delay time.Duration, interval time.Duration, job JobFunc) {\n\tdefaultTimer.DelayAddSingleton(delay, interval, job)\n}", "title": "" }, { "docid": "19c2ff9a0d8ea054e94353665358cf84", "score": "0.47161716", "text": "func (s *NetworkProfile) SetDownlinkDelayMs(v int64) *NetworkProfile {\n\ts.DownlinkDelayMs = &v\n\treturn s\n}", "title": "" }, { "docid": "10c947b4b53c63ccaef7d1f75fd4fbba", "score": "0.4714549", "text": "func ExampleDelay() {\n\tdelay := Delay(\n\t\tExponential(2),\n\t\tBoundedMax(10),\n\t)\n\td := time.Duration(1)\n\tfor i := 0; i < 6; i++ {\n\t\tfmt.Println(d)\n\t\td = delay(d)\n\t}\n\t// Output:\n\t// 1ns\n\t// 2ns\n\t// 4ns\n\t// 8ns\n\t// 10ns\n\t// 10ns\n}", "title": "" }, { "docid": "41a45a04fa924fdfb895165f524fec2e", "score": "0.4705535", "text": "func (t *Device) GetOrCreateLldp() *Lldp {\n\tif t.Lldp != nil {\n\t\treturn t.Lldp\n\t}\n\tt.Lldp = &Lldp{}\n\treturn t.Lldp\n}", "title": "" }, { "docid": "540b89d64866646948e40b9adda5d610", "score": "0.4695961", "text": "func (s *CreateNetworkProfileInput) SetUplinkDelayMs(v int64) *CreateNetworkProfileInput {\n\ts.UplinkDelayMs = &v\n\treturn s\n}", "title": "" }, { "docid": "5c75a90d90e0dd92a5c067d524a64fc4", "score": "0.46943477", "text": "func (p *Backoff) Get(id string) time.Duration {\n\tp.RLock()\n\tdefer p.RUnlock()\n\tvar delay time.Duration\n\tentry, ok := p.perItemBackoff[id]\n\tif ok {\n\t\tdelay = entry.backoff\n\t}\n\treturn delay\n}", "title": "" }, { "docid": "ed21ac398555e39041014e408e7bc027", "score": "0.46925983", "text": "func Delay(duration time.Duration, s Stream) Stream {\n\treturn &delay{time.NewTimer(duration), s}\n}", "title": "" }, { "docid": "af80010c9ac5e373df1508451a91569d", "score": "0.46911082", "text": "func (c *Cache) DoDelay(delay time.Duration, f func() (interface{}, error)) (v interface{}, err error) {\n\tt0 := time.Now()\n\tc.m.Lock()\n\tdefer c.m.Unlock()\n\n\t// If c.t is newer, return cached value\n\t// We can't use `>=` because some system may produce exactly same time for multiple times.\n\tif c.t.Sub(t0) > 0 {\n\t\treturn c.res, c.err\n\t}\n\tif delay > 0 {\n\t\ttime.Sleep(delay)\n\t}\n\n\tc.t = time.Now()\n\tc.res, c.err = f()\n\treturn c.res, c.err\n}", "title": "" }, { "docid": "56ba874b60cdb9e4e68fb44d7da7efce", "score": "0.4688937", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv) GetOrCreateLinkProtectionType() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_LinkProtectionType {\n\tif t.LinkProtectionType != nil {\n\t\treturn t.LinkProtectionType\n\t}\n\tt.LinkProtectionType = &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_LinkProtectionType{}\n\treturn t.LinkProtectionType\n}", "title": "" } ]
d68bcfc37af2bfdbf2805a2c7528469c
go:linkname PkgNameString types.sub_pkgnamestring go:noescape
[ { "docid": "a6e2d38622514b65841e94813cf48ea1", "score": "0.6218007", "text": "func PkgNameString(obj *types.PkgName,) string", "title": "" } ]
[ { "docid": "7c318606c1f30e62a9fe863f2af2fd90", "score": "0.67946476", "text": "func PackageName(pkg *types.Package,) string", "title": "" }, { "docid": "7850f067d355933f08015e3a584ee4ae", "score": "0.62116647", "text": "func PackageString(pkg *types.Package,) string", "title": "" }, { "docid": "24bdfd315ec53ad091740ba156f1b6d2", "score": "0.6120292", "text": "func PkgNameName(obj *types.PkgName,) string", "title": "" }, { "docid": "42cb3d354c3237603413b8259bcfcd04", "score": "0.60941875", "text": "func PkgNamePkg(obj *types.PkgName,) *types.Package", "title": "" }, { "docid": "620d147ef5ef6c51a0060087cbc7c0d7", "score": "0.6087359", "text": "func package_name(rel_path []byte) []byte {\n\tvar buffer []byte = noarch.Strdup(rel_path)\n\tvar filename []byte = __xpg_basename(buffer)\n\t// trim the .c extension\n\tfilename[noarch.Strlen(filename)-int32(2)] = byte(0)\n\tvar c []byte\n\tfor c = filename; int32(c[0]) != 0; func() []byte {\n\t\ttempVarUnary := c\n\t\tdefer func() {\n\t\t\tc = c[0+1:]\n\t\t}()\n\t\treturn tempVarUnary\n\t}() {\n\t\tswitch int32(c[0]) {\n\t\tcase '.':\n\t\t\tfallthrough\n\t\tcase '-':\n\t\t\tfallthrough\n\t\tcase ' ':\n\t\t\tc[0] = '_'\n\t\tdefault:\n\t\t\tbreak\n\t\t}\n\t}\n\tvar name []byte = noarch.Strdup(filename)\n\t_ = buffer\n\treturn name\n}", "title": "" }, { "docid": "55c359fa10c897ab80f89cf90baf0b92", "score": "0.6016958", "text": "func PackageNameOnly(typeName string) string {\n\tdotted := DescriptorToDot(typeName)\n\n\tend := strings.LastIndexByte(dotted, '.')\n\tif end < 0 {\n\t\t// lives in default package\n\t\treturn \"\"\n\t}\n\n\treturn dotted[:end]\n}", "title": "" }, { "docid": "af963d3d5a59a3f8f034cacee6561bcc", "score": "0.5988079", "text": "func (c *common) PackageName() string { return uniquePackageOf(c.file) }", "title": "" }, { "docid": "5e0485ea670444b34947ca063bdd1eb4", "score": "0.5883985", "text": "func packageName(name string) string {\n\tm := pkgRE.FindStringSubmatch(name)\n\tif m == nil {\n\t\treturn \"\"\n\t}\n\treturn m[1]\n}", "title": "" }, { "docid": "8c69d16eebc5a3b5a106dc9550e9af7e", "score": "0.5828766", "text": "func NewPkgName(pos token.Pos, pkg *types.Package, name string, imported *types.Package,) *types.PkgName", "title": "" }, { "docid": "2cacfa8c73936b374da0a188c3acfd57", "score": "0.5788988", "text": "func PackageName() string {\n\tpkg, _ := packageAndFunc(3)\n\treturn pkg\n}", "title": "" }, { "docid": "201b1b381967b0be361e805bac0982e9", "score": "0.5787101", "text": "func PkgNameId(obj *types.PkgName,) string", "title": "" }, { "docid": "8e99fdcc54e800a416eca42107d175e5", "score": "0.57844627", "text": "func LabelPkg(obj *types.Label,) *types.Package", "title": "" }, { "docid": "f7d078d342cdd14cdca961cc69870f5b", "score": "0.57456213", "text": "func Name() string {\n\treturn SubModuleName\n}", "title": "" }, { "docid": "68f559119fdd1e95c20492b73bed7d5c", "score": "0.57034993", "text": "func mapPackage(s string) string {\n\tif stutterPackage {\n\t\ts += \"/\" + path.Base(s)\n\t}\n\treturn newPackageBase + s\n}", "title": "" }, { "docid": "985d5201d0fa273625b95eb9a6cc97d6", "score": "0.57014954", "text": "func PkgNameImported(obj *types.PkgName,) *types.Package", "title": "" }, { "docid": "9bb4cca8ced3abbd6211eac35db0cc45", "score": "0.56750935", "text": "func pkgPathToName(pkgPath string) string {\n\treturn strings.Replace(pkgPath, \"/\", \".\", -1)\n}", "title": "" }, { "docid": "a98078ba4b9d0fc72ce55032c976f9be", "score": "0.5600764", "text": "func parsePackage(name string) (parent, pck, substr string) {\n\tif len(name) == 0 {\n\t\treturn\n\t}\n\tvar split []string\n\t// substr\n\tsplit = strings.Split(name, \"/\")\n\tsplit = strings.Split(split[len(split)-1], \".\")\n\tif len(split) > 1 {\n\t\tsubstr = split[len(split)-1]\n\t\tname = strings.TrimSuffix(name, \".\"+substr)\n\t}\n\tsplit = strings.Split(name, \"/\")\n\n\t// pck\n\tpck = split[len(split)-1]\n\n\t// parent\n\tif len(split) > 1 {\n\t\tparent = strings.TrimSuffix(name, \"/\"+pck)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "676947666135c99b5a11c4d0f6adb3aa", "score": "0.55961657", "text": "func TypeNamePkg(obj *types.TypeName,) *types.Package", "title": "" }, { "docid": "cb3dbeaa6ea60ce559187ce6907336f0", "score": "0.5511874", "text": "func writePackageName(out *bytes.Buffer, pkgName string) {\n\t_, _ = fmt.Fprintf(out, \"package %s\\n\\n\", pkgName)\n}", "title": "" }, { "docid": "51fde76e4225e5e6ecd251bb26418e09", "score": "0.55109006", "text": "func main() {\n\tfmt.Println(\"Importing something.\")\n\n\tfmt.Println(\"if it's in the same package, just go.\")\n\n\ts1 := Something{\"wicked this way\"}\n\n\tfmt.Println(s1.name)\n}", "title": "" }, { "docid": "6bd3143290ed970af8ea14b67fcb55dd", "score": "0.545471", "text": "func (r Resource) PackageName() string {\n\tif r.Group == \"\" {\n\t\treturn safeImport(r.Domain)\n\t}\n\n\treturn safeImport(r.Group)\n}", "title": "" }, { "docid": "5cbd92ce9cb378d899b66f165d3cc285", "score": "0.5392879", "text": "func (b *Buffer) cleanPkg(name string) string {\n\tif strings.HasSuffix(name, \"-go\") {\n\t\tname = name[0 : len(name)-3]\n\t}\n\tindex := strings.LastIndex(name, \"-\")\n\tif index > 0 {\n\t\tname = name[index+1:]\n\t}\n\treturn name\n}", "title": "" }, { "docid": "1050172b56e128de8ad4545e347a235f", "score": "0.5376659", "text": "func Id(pkg *types.Package, name string) string", "title": "" }, { "docid": "4eb536514cc77f2c40125df67a3a2c6c", "score": "0.5375451", "text": "func GoPackageTypeName(t design.DataType, required []string, versioned bool, defPkg string, tabs int) string {\n\tswitch actual := t.(type) {\n\tcase design.Primitive:\n\t\treturn GoNativeType(t)\n\tcase *design.Array:\n\t\treturn \"[]\" + GoPackageTypeRef(actual.ElemType.Type, actual.ElemType.AllRequired(), versioned, defPkg, tabs+1)\n\tcase design.Object:\n\t\tatt := &design.AttributeDefinition{Type: actual}\n\t\tif len(required) > 0 {\n\t\t\trequiredVal := &dslengine.RequiredValidationDefinition{Names: required}\n\t\t\tatt.Validations = append(att.Validations, requiredVal)\n\t\t}\n\t\treturn GoTypeDef(att, versioned, defPkg, tabs, false)\n\tcase *design.Hash:\n\t\treturn fmt.Sprintf(\n\t\t\t\"map[%s]%s\",\n\t\t\tGoPackageTypeRef(actual.KeyType.Type, actual.KeyType.AllRequired(), versioned, defPkg, tabs+1),\n\t\t\tGoPackageTypeRef(actual.ElemType.Type, actual.ElemType.AllRequired(), versioned, defPkg, tabs+1),\n\t\t)\n\tcase *design.UserTypeDefinition:\n\t\tpkgPrefix := PackagePrefix(actual, versioned, defPkg)\n\t\treturn pkgPrefix + Goify(actual.TypeName, true)\n\tcase *design.MediaTypeDefinition:\n\t\tpkgPrefix := PackagePrefix(actual.UserTypeDefinition, versioned, defPkg)\n\t\treturn pkgPrefix + Goify(actual.TypeName, true)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"goa bug: unknown type %#v\", actual))\n\t}\n}", "title": "" }, { "docid": "95e067f6e5ec9af3c86635d12ceb2a02", "score": "0.53458405", "text": "func NameOf(pkg *types.Package) string {\n\tif name, ok := names[pkg.Path()]; ok {\n\t\treturn name\n\t}\n\n\tpkgname := Qualify(pkg)\n\tdir, file := path.Split(pkg.Path())\nCheck:\n\tfor _, othername := range names {\n\t\tif othername == pkgname {\n\t\t\tdir, file = path.Split(dir)\n\t\t\tpkgname = fmt.Sprintf(\"%s.%s\", file, pkgname)\n\t\t\tgoto Check\n\t\t}\n\t}\n\n\tnames[pkg.Path()] = pkgname\n\n\treturn pkgname\n}", "title": "" }, { "docid": "59f10b2c21defab036aef920b44f1b21", "score": "0.53434634", "text": "func (t *Type) Ext(curPkg string) string {\n\tif t.Package() != \"\" && t.Package() != curPkg {\n\t\treturn t.Package() + \".\" + t.Name\n\t}\n\treturn t.Name\n}", "title": "" }, { "docid": "03a0e79be2b71d25487cde1f15a37921", "score": "0.5337581", "text": "func Qualify(pkg *types.Package) string {\n\treturn pkg.Name()\n}", "title": "" }, { "docid": "1bcf54b8b120629ba5b051b33502efc7", "score": "0.5288517", "text": "func name(typ string, suf string, exported bool) string {\n\tif exported {\n\t\ttyp = strings.Title(typ)\n\t}\n\treturn typ + suf\n}", "title": "" }, { "docid": "de7c5cbd1d125ac909351ea523d6de8d", "score": "0.52845466", "text": "func subscriberName(sub Subscriber) string {\n\ttyp := reflect.TypeOf(sub)\n\tif typ.Kind() == reflect.Ptr {\n\t\ttyp = typ.Elem()\n\t}\n\treturn fmt.Sprintf(\"%s.%s\", strings.TrimPrefix(typ.PkgPath(), \"github.com/tilt-dev/tilt/internal/\"), typ.Name())\n}", "title": "" }, { "docid": "d34b5762aadb5018cc96089098dad634", "score": "0.5266724", "text": "func fieldPackage(typeName string) string {\n\treturn strings.Trim(typeName[:strings.LastIndex(typeName, \".\")], \".\")\n}", "title": "" }, { "docid": "d1d8d372414ef6568aed182c4a5cce0f", "score": "0.52505976", "text": "func trimPackage(ident, pkg string) string {\n\treturn strings.TrimPrefix(ident, pkg+\".\")\n}", "title": "" }, { "docid": "d1d8d372414ef6568aed182c4a5cce0f", "score": "0.52505976", "text": "func trimPackage(ident, pkg string) string {\n\treturn strings.TrimPrefix(ident, pkg+\".\")\n}", "title": "" }, { "docid": "308bf3086b79d683da412dbcff538301", "score": "0.52125305", "text": "func resolvePackageName(p string) (string, error) {\n\tp, err := filepath.Abs(p)\n\tif err == nil {\n\t\tp = filepath.Base(p)\n\t\t_, err = format.Source([]byte(\"package \" + p))\n\t}\n\tif err != nil {\n\t\treturn \"\", errors.New(\"invalid package name \" + p)\n\t}\n\treturn p, nil\n}", "title": "" }, { "docid": "f628cec19240cb8c6dc914ec2286d685", "score": "0.5209837", "text": "func sanitizePackageName(pkgName string) string {\n\tpkgName = strings.Replace(pkgName, \".\", \"_\", -1)\n\tpkgName = strings.Replace(pkgName, \"-\", \"_\", -1)\n\treturn pkgName\n}", "title": "" }, { "docid": "96cd32ec747594ff5e04ec1cfce42f69", "score": "0.5207334", "text": "func (*stringLib) LibraryName() string {\n\treturn \"cel.lib.ext.strings\"\n}", "title": "" }, { "docid": "85e5e672a19d761da669e2c223f6c5ae", "score": "0.52046907", "text": "func (info CallerInfo) PackageName() string {\n\tpkg, _, _ := info.Meta()\n\treturn pkg\n}", "title": "" }, { "docid": "cba7bd8e195d4fa1b3c1c685203f9cc1", "score": "0.52031505", "text": "func TestImportPackageName2(t *testing.T) {\n\tfsys := fstest.Files{\n\t\t\"main.go\": `package main; import ( \"a.b/p\"; \"a.b/p\" ); func main() { }`,\n\t}\n\toptions := &scriggo.BuildOptions{\n\t\tPackages: native.Packages{\n\t\t\t\"a.b/p\": native.Package{Name: \"$\"},\n\t\t},\n\t}\n\t_, err := scriggo.Build(fsys, options)\n\tif err == nil {\n\t\tt.Fatalf(\"expected error, got no error\")\n\t}\n\tif err, ok := err.(*scriggo.BuildError); ok {\n\t\tconst expected = \"imported and not used: \\\"a.b/p\\\"\"\n\t\tif msg := err.Message(); msg == \"\" {\n\t\t\tt.Fatalf(\"expected error %q, got no error\", expected)\n\t\t} else if msg != expected {\n\t\t\tt.Fatalf(\"expected error %q, got error %q\", expected, msg)\n\t\t}\n\t} else {\n\t\tt.Fatalf(\"expected a *scriggo.BuildError, got %T\", err)\n\t}\n}", "title": "" }, { "docid": "6e5992b229cafc1238241c6dfc8bd650", "score": "0.5199663", "text": "func (suite TestSuite) PackageName() string {\n\tif strings.HasPrefix(suite.Dir, \".\") {\n\t\treturn \"\"\n\t}\n\n\treturn strings.Replace(filepath.ToSlash(suite.Dir), \"/\", \".\", -1)\n}", "title": "" }, { "docid": "f846a0a3062d0e34f9dfb7333b98aa74", "score": "0.51876247", "text": "func (pac *Package) globalName(o gcc.Named) string {\n\tif pac.fileIds.Has(o.File()) && pac.hasPrefix(o.CName()) {\n\t\treturn pac.localName(o)\n\t}\n\tfor _, inc := range pac.Included {\n\t\tif goName := inc.globalName(o); goName != \"\" && !contains(goName, \".\") {\n\t\t\treturn joins(inc.PacName, \".\", goName)\n\t\t}\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "5a8a3cee3e1a3a14a6a6c784422b76a8", "score": "0.5184843", "text": "func getSubinstallationNameByReference(refs []lsv1alpha1.NamedObjectReference, namespace, name string) (string, bool) {\n\tfor _, ref := range refs {\n\t\tif ref.Reference.Namespace == namespace && ref.Reference.Name == name {\n\t\t\treturn ref.Name, true\n\t\t}\n\t}\n\treturn \"\", false\n}", "title": "" }, { "docid": "2b4d078c308a11f27ba00738bb13612c", "score": "0.51721245", "text": "func (p *Package) Link() string {\n\treturn strings.Replace(p.Path, \"/\", \"-\", -1)\n}", "title": "" }, { "docid": "d849845eb5b101290e70e28bf41f21d6", "score": "0.51649505", "text": "func name(dir string) string {\n\t// keep a 1:1 relationship between module locations and names\n\treturn strings.Replace(dir, \"/\", \"_\", -1)\n}", "title": "" }, { "docid": "b621200a75d00d88824f286d26ecf0cd", "score": "0.5145543", "text": "func TestRenamePackageWithConflicts(t *testing.T) {\n\ttestenv.NeedsGo1Point(t, 17)\n\tconst files = `\n-- go.mod --\nmodule mod.com\n\ngo 1.18\n-- lib/a.go --\npackage lib\n\nconst A = 1\n\n-- lib/nested/a.go --\npackage nested\n\nconst B = 1\n\n-- lib/x/a.go --\npackage nested1\n\nconst C = 1\n\n-- main.go --\npackage main\n\nimport (\n\t\"mod.com/lib\"\n\t\"mod.com/lib/nested\"\n\tnested1 \"mod.com/lib/x\"\n)\n\nfunc main() {\n\tprintln(\"Hello\")\n}\n`\n\tRun(t, files, func(t *testing.T, env *Env) {\n\t\tenv.OpenFile(\"lib/a.go\")\n\t\tenv.Rename(env.RegexpSearch(\"lib/a.go\", \"lib\"), \"nested\")\n\n\t\t// Check if the new package name exists.\n\t\tenv.RegexpSearch(\"nested/a.go\", \"package nested\")\n\t\tenv.RegexpSearch(\"main.go\", `nested2 \"mod.com/nested\"`)\n\t\tenv.RegexpSearch(\"main.go\", \"mod.com/nested/nested\")\n\t\tenv.RegexpSearch(\"main.go\", `nested1 \"mod.com/nested/x\"`)\n\t})\n}", "title": "" }, { "docid": "cecbd559911837e3194bd4363c15d12b", "score": "0.5106026", "text": "func BuiltinPkg(obj *types.Builtin,) *types.Package", "title": "" }, { "docid": "fd832a392a6a30019a3f5efbca81dc23", "score": "0.5101535", "text": "func ccModuleName(mctx android.TopDownMutatorContext, name string) string {\n\tvar dep android.Module\n\n\tmctx.VisitDirectDeps(func(m android.Module) {\n\t\tif m.Name() == name {\n\t\t\tdep = m\n\t\t}\n\t})\n\n\tif dep == nil {\n\t\tpanic(fmt.Errorf(\"%s has no dependency '%s'\", mctx.ModuleName(), name))\n\t}\n\n\tif l, ok := getLibrary(dep); ok {\n\t\treturn l.shortName()\n\t}\n\n\t// Most cases should match the getLibrary() check above, but generated libraries,\n\t// etc, do not, and they also do not require using shortName() (because of not\n\t// being target-specific), so just use the original build.bp name.\n\treturn dep.Name()\n}", "title": "" }, { "docid": "f82ba47eccf203373df3c5ed0bcfba60", "score": "0.5100008", "text": "func aliasLibTypeImportPath(path string) string {\n\telems := strings.Split(path, \"/\")\n\tn := len(elems)\n\n\treturn fmt.Sprintf(`%v_%v \"%v\"`, elems[n-2], elems[n-1], path)\n}", "title": "" }, { "docid": "d2f0bb882ffdde614067a44e4ce72307", "score": "0.50947267", "text": "func (g *Generator) TypeNameWithPackage(obj Object) string {\n\treturn obj.PackageName() + CamelCaseSlice(obj.TypeName())\n}", "title": "" }, { "docid": "0d8671f0f510ce5e34ae20f225e99228", "score": "0.50938225", "text": "func PackagePath(pkg *types.Package,) string", "title": "" }, { "docid": "06ea5e4ec5d1c6bb43ea1048ee48cd3b", "score": "0.50673884", "text": "func ConstPkg(obj *types.Const,) *types.Package", "title": "" }, { "docid": "3279439a15bddd7e0b242d79c87965a0", "score": "0.5052925", "text": "func cdxSourceName(namespace string) string {\n\treturn strings.ReplaceAll(namespace, \":\", \"-\")\n}", "title": "" }, { "docid": "8ae1fb3edf9c93431bae627c8b38628a", "score": "0.5049835", "text": "func packageIdentityName(f *descriptor.FileDescriptorProto) string {\n\tif f.Options != nil && f.Options.GoPackage != nil {\n\t\tgopkg := f.Options.GetGoPackage()\n\t\tidx := strings.LastIndex(gopkg, \"/\")\n\t\tif idx < 0 {\n\t\t\tgopkg = gopkg[idx+1:]\n\t\t}\n\n\t\tgopkg = gopkg[idx+1:]\n\t\t// package name is overrided with the string after the\n\t\t// ';' character\n\t\tsc := strings.IndexByte(gopkg, ';')\n\t\tif sc < 0 {\n\t\t\treturn sanitizePackageName(gopkg)\n\n\t\t}\n\t\treturn sanitizePackageName(gopkg[sc+1:])\n\t}\n\n\tif f.Package == nil {\n\t\tbase := filepath.Base(f.GetName())\n\t\text := filepath.Ext(base)\n\t\treturn strings.TrimSuffix(base, ext)\n\t}\n\treturn f.GetPackage()\n}", "title": "" }, { "docid": "b76058d62929e62618faf675ad562dae", "score": "0.5046528", "text": "func (s *VarlinkInterface) VarlinkGetName() string {\n\treturn `io.projectatomic.podman`\n}", "title": "" }, { "docid": "591b13be2fb63ae4628b81f408131049", "score": "0.5027425", "text": "func IsSubPackage(p string, rootPackage string) bool {\n\treturn strings.HasPrefix(p, rootPackage) && !strings.Contains(p, \"/vendor/\")\n}", "title": "" }, { "docid": "70448bacc0c608f648edd58e27b45317", "score": "0.5027251", "text": "func (k *Apk) PackageName() string {\n\treturn k.manifest.Package.MustString()\n}", "title": "" }, { "docid": "b5655fa760f51f34dce6b5566f3f2d36", "score": "0.50142014", "text": "func PkgNameParent(obj *types.PkgName,) *types.Scope", "title": "" }, { "docid": "72b50bb8133ada2089152be61b21cc0d", "score": "0.50138223", "text": "func NormalizePackageName(name string) string {\n\treturn strings.ToLower(normalizationRe.ReplaceAllString(name, \"-\"))\n}", "title": "" }, { "docid": "008725c6e52633610fd5b55370c3ea1e", "score": "0.5009549", "text": "func (p *lib) Link() *link8.Pkg { return p.Pkg }", "title": "" }, { "docid": "3fc2e38cf30fd0cdd188173a899cf4d3", "score": "0.50004977", "text": "func RelativeTo(pkg *types.Package,) types.Qualifier", "title": "" }, { "docid": "6e8dba90e39af01bb6326eab6e705d7d", "score": "0.4990477", "text": "func getPackageName(f string) string {\n\tfor {\n\t\tlastPeriod := strings.LastIndex(f, \".\")\n\t\tlastSlash := strings.LastIndex(f, \"/\")\n\t\tif lastPeriod > lastSlash {\n\t\t\tf = f[:lastPeriod]\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn f\n}", "title": "" }, { "docid": "6e8dba90e39af01bb6326eab6e705d7d", "score": "0.4990477", "text": "func getPackageName(f string) string {\n\tfor {\n\t\tlastPeriod := strings.LastIndex(f, \".\")\n\t\tlastSlash := strings.LastIndex(f, \"/\")\n\t\tif lastPeriod > lastSlash {\n\t\t\tf = f[:lastPeriod]\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn f\n}", "title": "" }, { "docid": "6e8dba90e39af01bb6326eab6e705d7d", "score": "0.4990477", "text": "func getPackageName(f string) string {\n\tfor {\n\t\tlastPeriod := strings.LastIndex(f, \".\")\n\t\tlastSlash := strings.LastIndex(f, \"/\")\n\t\tif lastPeriod > lastSlash {\n\t\t\tf = f[:lastPeriod]\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn f\n}", "title": "" }, { "docid": "6e8dba90e39af01bb6326eab6e705d7d", "score": "0.4990477", "text": "func getPackageName(f string) string {\n\tfor {\n\t\tlastPeriod := strings.LastIndex(f, \".\")\n\t\tlastSlash := strings.LastIndex(f, \"/\")\n\t\tif lastPeriod > lastSlash {\n\t\t\tf = f[:lastPeriod]\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn f\n}", "title": "" }, { "docid": "0520d84881572929d15623512a47eabd", "score": "0.49864897", "text": "func remapSubmodule(name, url string) *exec.Cmd {\n\tname = fmt.Sprintf(\"submodule.%s.url\", name)\n\treturn exec.Command(\n\t\t\"git\",\n\t\t\"config\",\n\t\t\"--global\",\n\t\tname,\n\t\turl,\n\t)\n}", "title": "" }, { "docid": "d6db1d5539f612b62398832321a61d8a", "score": "0.49843687", "text": "func (t *apiType) Link() string {\n\tt = t.deref() // dereference kind=Pointer\n\n\tif t.Kind == types.Builtin {\n\t\treturn \"\"\n\t}\n\n\tif t.isLocal() {\n\t\treturn \"#\" + t.Anchor()\n\t}\n\n\tvar arrIndex = func(a []string, i int) string {\n\t\ts := a[(len(a)+i)%len(a)]\n\t\tif s == \"authentication\" {\n\t\t\ts = \"authentication-k8s-io\"\n\t\t}\n\t\treturn s\n\t}\n\n\t// types like k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta,\n\t// k8s.io/api/core/v1.Container, k8s.io/api/autoscaling/v1.CrossVersionObjectReference,\n\t// github.com/knative/build/pkg/apis/build/v1alpha1.BuildSpec\n\tif t.Kind == types.Struct || t.Kind == types.Pointer || t.Kind == types.Interface || t.Kind == types.Alias {\n\t\t// gives {{ ImportPath.Identifier }} for type\n\t\tid := t.typeId()\n\t\t// to parse [meta, v1] from \"k8s.io/apimachinery/pkg/apis/meta/v1\"\n\t\tsegments := strings.Split(t.Name.Package, \"/\")\n\n\t\tfor _, v := range config.ExternalPackages {\n\t\t\tr, err := regexp.Compile(v.Match)\n\t\t\tif err != nil {\n\t\t\t\tklog.Errorf(\"Pattern %q failed to compile: %+v\", v.Match, err)\n\t\t\t\treturn \"\"\n\t\t\t}\n\t\t\t// The type identifier is identified as a type from an \"external\" package\n\t\t\tif r.MatchString(id) {\n\t\t\t\ttpl, err := texttemplate.New(\"\").Funcs(map[string]interface{}{\n\t\t\t\t\t\"lower\": strings.ToLower,\n\t\t\t\t\t\"arrIndex\": arrIndex,\n\t\t\t\t}).Parse(v.Target)\n\n\t\t\t\tif err != nil {\n\t\t\t\t\tklog.Errorf(\"Failed to parse the 'target': %s\", v.Target)\n\t\t\t\t\treturn \"\"\n\t\t\t\t}\n\n\t\t\t\tvar b bytes.Buffer\n\t\t\t\terr = tpl.Execute(&b, map[string]interface{}{\n\t\t\t\t\t\"TypeIdentifier\": t.Name.Name,\n\t\t\t\t\t\"PackagePath\": t.Name.Package,\n\t\t\t\t\t\"PackageSegments\": segments,\n\t\t\t\t})\n\t\t\t\tif err != nil {\n\t\t\t\t\tklog.Errorf(\"Failed to execute template: %+v\", err)\n\t\t\t\t\treturn \"\"\n\t\t\t\t}\n\t\t\t\treturn b.String()\n\t\t\t}\n\t\t}\n\n\t\t// We are here if the type identifier for the type is not listed as an\n\t\t// external one. This means we have to parse it.\n\t\tklog.Errorf(\"External link source for '%s.%s' is not found.\", t.Name.Package, t.Name.Name)\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "7ba4d2433b1d89767abdcb49bdf71920", "score": "0.49800447", "text": "func (i *Imports) QualName(info TypeInfo) string {\n\tif info.BuiltIn() || info.GoPath == i.currentGoPath {\n\t\treturn info.Name\n\t}\n\tqual := path.Base(info.GoPath)\n\tif alias := i.aliases[info.GoPath]; alias != \"\" {\n\t\tqual = alias\n\t}\n\treturn fmt.Sprintf(\"%s.%s\", qual, info.Name)\n}", "title": "" }, { "docid": "17a1d34a6ab464cc422915da9712fc8a", "score": "0.49746582", "text": "func (pp *parsedPackage) lookupPackageImportPath(typeName, pkgName string) string {\n\tfile := pp.lookupTypeFile(typeName)\n\tfor _, imp := range file.Imports {\n\t\tif imp.Name != nil && imp.Name.Name == pkgName || imp.Name == nil && (parseStringLiteral(imp.Path.Value) == pkgName || strings.HasSuffix(parseStringLiteral(imp.Path.Value), \"/\"+pkgName)) {\n\t\t\treturn parseStringLiteral(imp.Path.Value)\n\t\t}\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "d7c01511333e47f7166e294b3539cffd", "score": "0.4967384", "text": "func VarPkg(obj *types.Var,) *types.Package", "title": "" }, { "docid": "6ed4c1bcf3aec2849c70e6667139d9f8", "score": "0.4965444", "text": "func packageFuncName(pc uintptr) (packageName string, funcName string) {\n\tif f := runtime.FuncForPC(pc); f != nil {\n\t\tfuncName = f.Name()\n\t\tif ind := strings.LastIndex(funcName, \"/\"); ind > 0 {\n\t\t\tpackageName += funcName[:ind+1]\n\t\t\tfuncName = funcName[ind+1:]\n\t\t}\n\t\tif ind := strings.Index(funcName, \".\"); ind > 0 {\n\t\t\tpackageName += funcName[:ind]\n\t\t\tfuncName = funcName[ind+1:]\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "f7985068eb802a885b8d1bb757c60a7f", "score": "0.49579662", "text": "func duckPkgver(s string) PkgVer {\n\tlen := len(s)\n\tif i := strings.LastIndexByte(s, '-'); i != -1 {\n\t\t// if it contains _, it quacks like a version\n\t\trev := strings.LastIndexByte(s[i+1:], '_')\n\t\tif i == len || rev == -1 || i+1+rev+1 == len || !onlyDigits(s[i+1+rev+1:]) {\n\t\t\treturn PkgVer{Name: s}\n\t\t}\n\t\treturn PkgVer{Name: s[:i], Version: s[i+1:]}\n\t}\n\treturn PkgVer{Name: s}\n}", "title": "" }, { "docid": "e63dcb4c345f835d4ebdb802cbd0e88b", "score": "0.49512547", "text": "func nameify(rawName string) string {\n\treturn strings.Replace(strings.Replace(strings.Replace(strings.TrimSuffix(removeHL7Prefix(rawName), \".CONTENT\"), \".\", \"_\", -1), \"-\", \"_\", -1), \"__\", \"_\", -1)\n}", "title": "" }, { "docid": "5da083fd7d7af8b92ce615090342f7e1", "score": "0.49405137", "text": "func typeDescIdent(p *types.Package, t types.Type) (string, error) {\n\tswitch t := t.(type) {\n\tcase *types.Basic:\n\t\treturn exported(t.Name()), nil\n\tcase *types.Pointer:\n\t\tnamed, ok := t.Elem().(*types.Named)\n\t\tif !ok {\n\t\t\tbreak\n\t\t}\n\t\ts := exported(named.Obj().Name())\n\t\tif named.Obj().Pkg().Path() == p.Path() {\n\t\t\treturn s, nil\n\t\t} else {\n\t\t\treturn exported(named.Obj().Pkg().Name()) + s, nil\n\t\t}\n\tcase *types.Slice:\n\t\tbasic, ok := t.Elem().(*types.Basic)\n\t\tif !ok {\n\t\t\tbreak\n\t\t}\n\t\treturn \"SliceOf\" + exported(basic.Name()), nil\n\t}\n\treturn \"\", fmt.Errorf(\"cannot convert %v to a local name\", t)\n}", "title": "" }, { "docid": "0e697d5df652d49b64ceeab3caa90834", "score": "0.49340516", "text": "func getFullName(typ reflect.Type) string {\n\treturn typ.PkgPath() + \".\" + typ.Name()\n}", "title": "" }, { "docid": "0e697d5df652d49b64ceeab3caa90834", "score": "0.49340516", "text": "func getFullName(typ reflect.Type) string {\n\treturn typ.PkgPath() + \".\" + typ.Name()\n}", "title": "" }, { "docid": "8ee0bcf801a6b159d723e7e1185a8c4a", "score": "0.49285227", "text": "func (protoLib) LibraryName() string {\n\treturn \"cel.lib.ext.protos\"\n}", "title": "" }, { "docid": "49f175f098c4fdd7b3cf2272802d42f2", "score": "0.49224332", "text": "func importName(s *ast.ImportSpec) string {\n\tif s.Name == nil {\n\t\treturn \"\"\n\t}\n\treturn s.Name.Name\n}", "title": "" }, { "docid": "49f175f098c4fdd7b3cf2272802d42f2", "score": "0.49224332", "text": "func importName(s *ast.ImportSpec) string {\n\tif s.Name == nil {\n\t\treturn \"\"\n\t}\n\treturn s.Name.Name\n}", "title": "" }, { "docid": "49f175f098c4fdd7b3cf2272802d42f2", "score": "0.49224332", "text": "func importName(s *ast.ImportSpec) string {\n\tif s.Name == nil {\n\t\treturn \"\"\n\t}\n\treturn s.Name.Name\n}", "title": "" }, { "docid": "9cecdb2e06177f7feeab1cc209bc0a2b", "score": "0.4912903", "text": "func Name(prog *loader.Program) {\n\tsize := len(prog.AllPackages)\n\tnames = make(map[string]string, size)\n\tfor _, pkginfo := range prog.AllPackages {\n\t\tNameOf(pkginfo.Pkg)\n\t}\n}", "title": "" }, { "docid": "0e0b1394ce406d2c0afdc07775021804", "score": "0.49059805", "text": "func PackagePrefix(ut *design.UserTypeDefinition, versioned bool, pkg string) string {\n\tif !versioned {\n\t\t// If the version is the default version then the user type is in the same package\n\t\t// (otherwise the DSL would not be valid).\n\t\treturn \"\"\n\t}\n\tif len(ut.APIVersions) == 0 {\n\t\t// If the type is not versioned but we are accessing it from the non-default version\n\t\t// then we need to qualify it with the default version package.\n\t\treturn pkg + \".\"\n\t}\n\t// If the type is versioned then we must be accessing it from the current version\n\t// (unversioned definitions cannot use versioned definitions)\n\treturn \"\"\n}", "title": "" }, { "docid": "0bd2284296eb97bb2a5d86260200723c", "score": "0.4900387", "text": "func getPackage() string {\n\tp, err := build.Default.Import(\".\", \".\", build.ImportMode(0))\n\tif err != nil {\n\t\tlog.Fatalf(\"Could not identify package: %v\", err)\n\t}\n\treturn p.Name\n}", "title": "" }, { "docid": "511c1229778ffae9e5db0f1284276316", "score": "0.48819172", "text": "func PackageForKind(kind int) string {\n\tfor _, item := range TypeDeclarations {\n\t\tif item.Kind.kind == kind {\n\t\t\t// If this is a pointer type, skip the pointer token\n\t\t\tif item.Tokens[0] == \"*\" {\n\t\t\t\treturn item.Tokens[1]\n\t\t\t}\n\n\t\t\treturn item.Tokens[0]\n\t\t}\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "ffa9d9b1a3543f88387059316fd7741d", "score": "0.48582074", "text": "func GenerateImportAs(pkg, version string) string {\n\tp := strings.Split(pkg, \"/\")\n\treturn p[len(p)-1] + version\n}", "title": "" }, { "docid": "0956639b6d903e087d70c71e0758335b", "score": "0.48525074", "text": "func getPackageDisplayName(title string) string {\n\t// If title not found in titleLookup map, default back to title given.\n\tif val, ok := titleLookup(title); ok {\n\t\treturn val\n\t}\n\treturn title\n}", "title": "" }, { "docid": "75d025af69c3c235fc7e47534f8dbd1a", "score": "0.48449093", "text": "func (d *FileDescriptor) PackageName() string { return uniquePackageOf(d.FileDescriptorProto) }", "title": "" }, { "docid": "055ddc6518e76688d7f6e4203f62394e", "score": "0.48446777", "text": "func goLibPackageDir(name, filename string) string {\n\tdir := filepath.Join(filepath.Dir(filename), name)\n\n\t// escape last dir element\n\telems := strings.Split(dir, \"/\")\n\telems[len(elems)-1] = commons.NormalizeIdentifier(elems[len(elems)-1])\n\treturn strings.Join(elems, \"/\")\n}", "title": "" }, { "docid": "71b07024cb57a6bb65a8afcb261549cb", "score": "0.48387012", "text": "func GetLongTypeName(i interface{}) (r string) {\n\tif i == nil {\n\t\treturn\n\t}\n\tv := reflect.ValueOf(i)\n\tfor v.Kind() == reflect.Ptr && !v.IsZero() {\n\t\tr += \"*\"\n\t\tv = v.Elem()\n\t}\n\tif s := v.Type().PkgPath(); s != \"\" {\n\t\tr += s + \"/\"\n\t}\n\tr += v.Type().String()\n\treturn\n}", "title": "" }, { "docid": "6f97bd83f9f234423e7067e9b8a0b2a9", "score": "0.4838182", "text": "func addNs(src string, nsToAdd string) string {\n\tif strings.Contains(src, \"/\") {\n\t\treturn src\n\t}\n\treturn nsToAdd + src\n}", "title": "" }, { "docid": "634e2604df02757373c907f5a26edcda", "score": "0.48369768", "text": "func (m *Module) nextStrName() string {\n\tstrName := fmt.Sprintf(\"str_%04d\", m.curStrNum)\n\tif m.skipPkgPrefix() {\n\t\t// Use fully qualified name if not in `main` package.\n\t\tstrName = fmt.Sprintf(\"%s.%s\", m.goPkg.Pkg.Path(), strName)\n\t}\n\tm.curStrNum++\n\treturn strName\n}", "title": "" }, { "docid": "3703404d29c5dcf09631048086806d21", "score": "0.48271534", "text": "func asGoVersion(s string) string {\n\tif goVersionRx.MatchString(s) {\n\t\treturn strings.Replace(s, \"_\", \".\", 1)\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "e5bdff1a020d49bcfd6e27d7d93f5c49", "score": "0.48172134", "text": "func (s *BasePlSqlParserListener) EnterPackage_name(ctx *Package_nameContext) {}", "title": "" }, { "docid": "5506e7ef061a50570b0f1812670a89bd", "score": "0.4801272", "text": "func PkgNameExported(obj *types.PkgName,) bool", "title": "" }, { "docid": "b463c4b57e4a16b3dbc2cd430652877e", "score": "0.47906896", "text": "func (p Package) Name() string {\n\treturn p.name\n}", "title": "" }, { "docid": "3f90370f8feb5bfa3901ef3b803c1e45", "score": "0.47874737", "text": "func (p *apiPackage) DisplayName() string {\n\treturn fmt.Sprintf(\"%s/%s\", p.apiGroup, p.apiVersion)\n}", "title": "" }, { "docid": "1d05984f98fa18487696b3af504aaccd", "score": "0.4786405", "text": "func goTypeName(u useSrc, e ast.Expr) string {\n\tswitch t := e.(type) {\n\tcase *ast.Ident:\n\t\treturn t.Name\n\tcase *ast.ArrayType:\n\t\treturn \"[]\" + goTypeName(u, t.Elt)\n\tcase *ast.Ellipsis:\n\t\t// Ellipsis parameters to a function must be passed as an array, so document it that way.\n\t\treturn \"[]\" + goTypeName(u, t.Elt)\n\tcase *ast.MapType:\n\t\treturn fmt.Sprintf(\"map[%s]%s\", goTypeName(u, t.Key), goTypeName(u, t.Value))\n\tcase *ast.InterfaceType:\n\t\treturn \"interface{}\"\n\tcase *ast.StarExpr:\n\t\treturn \"*\" + goTypeName(u, t.X)\n\tcase *ast.SelectorExpr:\n\t\tpackageIdent, ok := t.X.(*ast.Ident)\n\t\tif !ok {\n\t\t\tu.Fatalf(t.Pos(), \"unexpected non-ident for SelectorExpr.X\")\n\t\t}\n\t\tpkgName := packageIdent.Name\n\t\ttypeName := t.Sel.Name\n\n\t\timportPath := u.lookupPackageImportPath(pkgName)\n\t\tif importPath != \"\" {\n\t\t\treturn fmt.Sprintf(\"%s.%s\", importPath, typeName)\n\t\t}\n\t\treturn fmt.Sprintf(\"%s.%s\", pkgName, typeName)\n\t\t// todo: give proper error message for *ast.StructType\n\t}\n\tu.Fatalf(e.Pos(), \"unimplemented ast.Expr %#v in goTypeName\", e)\n\treturn \"\"\n}", "title": "" }, { "docid": "6cab0809df645299bf69419183f3916f", "score": "0.4778421", "text": "func groupName(gopkg *types.Package) string {\n\tp := gopkg.Constants[\"GroupName\"]\n\tif p != nil {\n\t\treturn *p.ConstValue\n\t}\n\tm := types.ExtractCommentTags(\"+\", gopkg.Comments)\n\tv := m[\"groupName\"]\n\tif len(v) == 1 {\n\t\treturn v[0]\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "138fc68d38fb41aab04942025ec937cc", "score": "0.47689056", "text": "func Test_gola_GoName_(t *testing.T) {\n\tTBegin(t)\n\t// GoName_(s string) string\n\t//\n\t//X \t// <traceCall>\n\t//X \tvar ret = Trim(s, SPACES)\n\t//X \tif len(ret) == 0 {\n\t//X \t\treturn \"\"\n\t//X \t}\n\t//X \tif Contains(ret, \"_\") {\n\t//X \t\tret = Replace(ret, \"_\", \" \", -1)\n\t//X \t}\n\t//X \tret = TitleCase(ret)\n\t//X \tif ContainsI(ret, \"id\") {\n\t//X \t\tret = ReplaceWord(ret, \"id\", \"ID\", IgnoreCase)\n\t//X \t}\n\t//X \tif Contains(ret, \" \") {\n\t//X \t\tret = Replace(ret, \" \", \"\", -1)\n\t//X \t}\n\t//X \treturn ret\n}", "title": "" }, { "docid": "cfe6ca82fb8496e0102415cb46ba318b", "score": "0.4766944", "text": "func (p *Package) SubDir() string {\r\n\treturn p.subDir\r\n}", "title": "" }, { "docid": "733dbc844e53a123f4af9a69efd1b0a5", "score": "0.47652104", "text": "func libraryKey(groupName, driverName string) string {\n\treturn strings.ToLower(groupName) + NameSeparator + strings.ToLower(driverName)\n}", "title": "" }, { "docid": "be7af78619ef36a1ae5f893063431395", "score": "0.47535896", "text": "func packageName(path string) (string, error) {\n\tfset := token.NewFileSet()\n\n\t// parse the go soure file, but only the package clause\n\tastFile, err := parser.ParseDir(fset, path, nil, parser.PackageClauseOnly)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tpackageName := \"\"\n\tfor _, pack := range astFile {\n\t\tif pack.Name == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tpackageName = pack.Name\n\t\tbreak\n\t}\n\tif packageName == \"\" {\n\t\treturn \"\", fmt.Errorf(\"could not read package name from given dir\")\n\t}\n\n\treturn packageName, nil\n}", "title": "" }, { "docid": "2ed92ca85b46563f14a5923b29c804bd", "score": "0.47522578", "text": "func (p *pkg) Name() string {\n\tif p == nil {\n\t\treturn \"\"\n\t}\n\treturn p.name\n}", "title": "" } ]
916945359c87e74da823e94de5357b8c
Delete: Deletes the specified intent and its direct or indirect followup intents.
[ { "docid": "6d795766781db542121afdef4d1c4f11", "score": "0.48043945", "text": "func (r *ProjectsAgentIntentsService) Delete(name string) *ProjectsAgentIntentsDeleteCall {\n\tc := &ProjectsAgentIntentsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.name = name\n\treturn c\n}", "title": "" } ]
[ { "docid": "fd9212eae477f0256260ebd0072e74fa", "score": "0.6381154", "text": "func DeleteIntent(projectID, intentID string) error {\n\tctx := context.Background()\n\n\tintentsClient, clientErr := dialogflow.NewIntentsClient(ctx)\n\tif clientErr != nil {\n\t\treturn clientErr\n\t}\n\tdefer intentsClient.Close()\n\n\tif projectID == \"\" || intentID == \"\" {\n\t\treturn errors.New(fmt.Sprintf(\"Received empty project (%s) or intent (%s)\", projectID, intentID))\n\t}\n\n\ttargetPath := fmt.Sprintf(\"projects/%s/agent/intents/%s\", projectID, intentID)\n\n\trequest := dialogflowpb.DeleteIntentRequest{Name: targetPath}\n\n\trequestErr := intentsClient.DeleteIntent(ctx, &request)\n\tif requestErr != nil {\n\t\treturn requestErr\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ecfc463a5ab5f8c1f65c9ca27a8ac83d", "score": "0.58971715", "text": "func (a *Activity) Delete() error {\n\treq, err := a.c.newRequest(\"DELETE\", a.URL(), nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif err := a.c.doRequest(req, nil); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3ae95bf01db287101cc26bbc5757d74e", "score": "0.56543803", "text": "func ExampleProtectionIntentClient_Delete() {\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 := armrecoveryservicesbackup.NewClientFactory(\"<subscription-id>\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\t_, err = clientFactory.NewProtectionIntentClient().Delete(ctx, \"myVault\", \"myRG\", \"Azure\", \"249D9B07-D2EF-4202-AA64-65F35418564E\", nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to finish the request: %v\", err)\n\t}\n}", "title": "" }, { "docid": "f8f02bd933edaeebaf7cb865518e8bc8", "score": "0.5613585", "text": "func (c *AppIntentClient) DeleteAppIntent(ai string, p string, ca string, v string, i string, digName string) error {\n\tk := AppIntentKey{\n\t\tName: ai,\n\t\tProject: p,\n\t\tCompositeApp: ca,\n\t\tVersion: v,\n\t\tIntent: i,\n\t\tDeploymentIntentGroupName: digName,\n\t}\n\n\terr := db.DBconn.Remove(c.storeName, k)\n\tif err != nil {\n\t\treturn pkgerrors.Wrap(err, \"Delete Project entry;\")\n\t}\n\treturn nil\n\n}", "title": "" }, { "docid": "beda116dc2b434823c286c9c768f55a1", "score": "0.5403556", "text": "func RemoveFollow(w http.ResponseWriter, r *http.Request) {\n\tID := r.URL.Query().Get(\"id\")\n\n\tvar t models.Relation\n\tt.UserID = IDUser\n\tt.UserRelationID = ID\n\n\tstatus, err := bd.DeleteFollow(t)\n\tif err != nil {\n\t\thttp.Error(w, \"An error occurred while trying to delete the relationship \"+err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\tif !status {\n\t\thttp.Error(w, \"Could not delete relationship\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusCreated)\n}", "title": "" }, { "docid": "8f24abe4ea94ac0306018d1ef7d60dad", "score": "0.5304652", "text": "func (u *App) Delete(c echo.Context, id string) error {\n\tif err := u.rbac.EnforceRole(c, model.SupportRole); err != nil {\n\t\treturn err\n\t}\n\n\told, err := u.udb.View(u.db, id)\n\tif err = zaplog.ZLog(err); err != nil {\n\t\treturn err\n\t}\n\n\tif err = u.rbac.EnforceUser(c, old.Admin); err != nil {\n\t\treturn err\n\t}\n\n\tif old.Status != model.StatusConcludedAppointment && old.Status != model.StatusCanceled {\n\t\treturn zaplog.ZLog(fmt.Errorf(\"Não é possível eliminar audiências activas. Cancele ou conclua primeiro.\"))\n\t}\n\n\treturn u.udb.Delete(u.db, id)\n}", "title": "" }, { "docid": "53e568f82d602d23543ae1d398b22e3b", "score": "0.53014433", "text": "func (f *FollowersService) Unfollow(uri *Hyperlink, params M) (success bool, result *Result) {\n\tif uri == nil {\n\t\turi = &CurrentFollowingUrl // Default url\n\t}\n\n\turl, err := uri.Expand(params)\n\tif err != nil {\n\t\treturn false, &Result{Err: err}\n\t}\n\n\tresult = f.client.delete(url, nil, nil)\n\tsuccess = (result.Response.StatusCode == 204)\n\treturn\n}", "title": "" }, { "docid": "e00167dcb2a9db20112972a12ff646de", "score": "0.5295175", "text": "func Activity_delete(){\r\n\r\n\t// DELETE \t/activity/{id}.json\r\n}", "title": "" }, { "docid": "7c6b8b04bc948a8d24d088991a4d3c7e", "score": "0.5210188", "text": "func (o *FeatureRelationshipPub) Delete(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"chado: no FeatureRelationshipPub provided for delete\")\n\t}\n\n\tif err := o.doBeforeDeleteHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\targs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), featureRelationshipPubPrimaryKeyMapping)\n\tsql := \"DELETE FROM \\\"feature_relationship_pub\\\" WHERE \\\"feature_relationship_pub_id\\\"=$1\"\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args...)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"chado: unable to delete from feature_relationship_pub\")\n\t}\n\n\tif err := o.doAfterDeleteHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "eef5608b941c1444ea8ed07e2965782d", "score": "0.5200667", "text": "func (pm *ProfileMentioned) Delete(db XODB) error {\n\tvar err error\n\n\t// if doesn't exist, bail\n\tif !pm._exists {\n\t\treturn nil\n\t}\n\n\t// if deleted, bail\n\tif pm._deleted {\n\t\treturn nil\n\t}\n\n\t// sql query\n\tconst sqlstr = `DELETE FROM sun.profile_mentioned WHERE Id = ?`\n\n\t// run query\n\tif LogTableSqlReq.ProfileMentioned {\n\t\tXOLog(sqlstr, pm.Id)\n\t}\n\t_, err = db.Exec(sqlstr, pm.Id)\n\tif err != nil {\n\t\tif LogTableSqlReq.ProfileMentioned {\n\t\t\tXOLogErr(err)\n\t\t}\n\t\treturn err\n\t}\n\n\t// set deleted\n\tpm._deleted = true\n\n\tOnProfileMentioned_AfterDelete(pm)\n\n\treturn nil\n}", "title": "" }, { "docid": "29cd3af287548afdad61ccf29c3a9f3d", "score": "0.5196937", "text": "func (a *AnswerOption) Delete() error {\n\terr := handler.Unscoped().Delete(a).Error\n\treturn err\n}", "title": "" }, { "docid": "21aecc1750fa3c3aa8e16e5c47ed7048", "score": "0.51744735", "text": "func DeleteAchievement(request events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) {\n\tfmt.Println(\"Getting Achievements\")\n\n\treturn events.APIGatewayProxyResponse{\n\t\tBody: \"Delete Request!\",\n\t\tStatusCode: 200,\n\t}, nil\n}", "title": "" }, { "docid": "85be446bd45bdf46b862f64418f4dfed", "score": "0.5170379", "text": "func (activity *ActivityConsumeAnime) Delete() error {\n\tDB.Delete(\"ActivityConsumeAnime\", activity.ID)\n\treturn nil\n}", "title": "" }, { "docid": "0b76404f85b2fa1d3f721794ae21b6a9", "score": "0.51633775", "text": "func (repository Users) Unfollow(userID, followerID uint64) error {\n\tstatement, err := repository.db.Prepare(\n\t\t\"DELETE FROM followers WHERE user_id = ? AND follower_id = ?\",\n\t)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer statement.Close()\n\n\tif _, err = statement.Exec(userID, followerID); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "4cade164837377f92af0d409ee258dd0", "score": "0.51529884", "text": "func (m *B2xUserFlowsItemApiConnectorConfigurationPostFederationSignupRefRequestBuilder) Delete(ctx context.Context, requestConfiguration *B2xUserFlowsItemApiConnectorConfigurationPostFederationSignupRefRequestBuilderDeleteRequestConfiguration)(error) {\n requestInfo, err := m.ToDeleteRequestInformation(ctx, requestConfiguration);\n if err != nil {\n return err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n err = m.BaseRequestBuilder.RequestAdapter.SendNoContent(ctx, requestInfo, errorMapping)\n if err != nil {\n return err\n }\n return nil\n}", "title": "" }, { "docid": "b6e1dadb19250c2fd43645ff1cb81341", "score": "0.5142692", "text": "func (s *Store) IntentionDelete(idx uint64, id string) error {\n\ttx := s.db.Txn(true)\n\tdefer tx.Abort()\n\n\tif err := s.intentionDeleteTxn(tx, idx, id); err != nil {\n\t\treturn fmt.Errorf(\"failed intention delete: %s\", err)\n\t}\n\n\ttx.Commit()\n\treturn nil\n}", "title": "" }, { "docid": "b5bfc6f2b3f1d28db02f3e8589228bf5", "score": "0.51371634", "text": "func Delete(href Href) *Call {\n\treturn newCall(\"DELETE\", href, nil, nil, nil)\n}", "title": "" }, { "docid": "a74d747c22689abe83bbff435723c347", "score": "0.5095707", "text": "func Delete(ctx aero.Context) error {\n\tuser := arn.GetUserFromContext(ctx)\n\n\tif user == nil {\n\t\treturn ctx.Error(http.StatusUnauthorized, \"Not logged in\")\n\t}\n\n\tanimeList := user.AnimeList()\n\tanimeList.Lock()\n\tanimeList.Items = nil\n\tanimeList.Unlock()\n\n\treturn ctx.String(\"ok\")\n}", "title": "" }, { "docid": "80ec0254fbf986d079dbbfcbeb094b0f", "score": "0.5062428", "text": "func (b *Bot) DeleteBot() {\n\tv := url.Values{}\n\tv.Set(\"csrf_token\", b.csrfToken2)\n\tv.Set(\"agree\", \"on\")\n\trequest, _ := http.NewRequest(\"POST\", fmt.Sprintf(\"https://admin-official.line.me/%v/resign/\", b.BotId), strings.NewReader(v.Encode()))\n\trequest.Header.Set(\"Content-Type\", \"application/x-www-form-urlencoded\")\n\trequest.Header.Set(\"Upgrade-Insecure-Requests\", \"1\")\n\tresponse, _ := b.client.Do(request)\n\tdefer response.Body.Close()\n}", "title": "" }, { "docid": "0efaa12a5a799f41740ed55c89297b30", "score": "0.50446993", "text": "func (r *SharedInsightRequest) Delete(ctx context.Context) error {\n\treturn r.JSONRequest(ctx, \"DELETE\", \"\", nil, nil)\n}", "title": "" }, { "docid": "38893b6a1926d6a8b6800b8d5ee3d762", "score": "0.50385827", "text": "func (m *MSTeamsPayload) Delete(p *api.DeletePayload) (api.Payloader, error) {\n\t// deleted tag/branch\n\trefName := git.RefName(p.Ref).ShortName()\n\ttitle := fmt.Sprintf(\"[%s] %s %s deleted\", p.Repo.FullName, p.RefType, refName)\n\n\treturn createMSTeamsPayload(\n\t\tp.Repo,\n\t\tp.Sender,\n\t\ttitle,\n\t\t\"\",\n\t\tp.Repo.HTMLURL+\"/src/\"+util.PathEscapeSegments(refName),\n\t\tyellowColor,\n\t\t&MSTeamsFact{fmt.Sprintf(\"%s:\", p.RefType), refName},\n\t), nil\n}", "title": "" }, { "docid": "8c9de2f0aa010cd4d77a6690273e5deb", "score": "0.50367886", "text": "func (xa *XAtt) Delete(db XODB) error {\n\tvar err error\n\n\t// if doesn't exist, bail\n\tif !xa._exists {\n\t\treturn nil\n\t}\n\n\t// if deleted, bail\n\tif xa._deleted {\n\t\treturn nil\n\t}\n\n\t// sql query\n\tconst sqlstr = `DELETE FROM x_showroom.x_att WHERE id = ?`\n\n\t// run query\n\tXOLog(sqlstr, xa.ID)\n\t_, err = db.Exec(sqlstr, xa.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// set deleted\n\txa._deleted = true\n\n\treturn nil\n}", "title": "" }, { "docid": "f7ccb7593bb4510b5edf4dd6797dab2c", "score": "0.50245655", "text": "func deleteManifest(w http.ResponseWriter, req *http.Request) {\n\trepository := router.Param(req.Context(), \":splat\")\n\treference := router.Param(req.Context(), \":reference\")\n\t// v2 doesn't support delete by tag\n\t// add parse digest here is to return ErrDigestInvalidFormat before GetByReference throws an NOT_FOUND(404)\n\t// Do not add the logic into GetByReference as it's a shared method for PUT/GET/DELETE/Internal call,\n\t// and NOT_FOUND satisfy PUT/GET/Internal call.\n\tif _, err := digest.Parse(reference); err != nil {\n\t\tlib_http.SendError(w, errors.Wrapf(err, \"unsupported digest %s\", reference).WithCode(errors.UNSUPPORTED))\n\t\treturn\n\t}\n\tart, err := artifact.Ctl.GetByReference(req.Context(), repository, reference, nil)\n\tif err != nil {\n\t\tlib_http.SendError(w, err)\n\t\treturn\n\t}\n\tif err = artifact.Ctl.Delete(req.Context(), art.ID); err != nil {\n\t\tlib_http.SendError(w, err)\n\t\treturn\n\t}\n\tw.WriteHeader(http.StatusAccepted)\n\n\t// clean cache if enabled\n\tif config.CacheEnabled() {\n\t\tif err = pkg.ManifestMgr.Delete(req.Context(), art.Digest); err != nil {\n\t\t\tlog.Errorf(\"failed to delete manifest cache: %v\", err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "af1bd1dc39d7c478f87472a9af20512e", "score": "0.5023659", "text": "func (c *SignatoriesController) Delete(ctx *app.DeleteSignatoriesContext) error {\n\t// SignatoriesController_Delete: start_implement\n\n\t// Put your logic here\n\n\t// SignatoriesController_Delete: end_implement\n\tres := &app.Message{}\n\treturn ctx.OK(res)\n}", "title": "" }, { "docid": "765258e50878eea1333240b9fc951cb3", "score": "0.5014391", "text": "func (d *ArpDescriptor) Delete(key string, arp *l3.ARPEntry, metadata interface{}) error {\n\tif err := d.arpHandler.VppDelArp(arp); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b98558a699daf045ea36f644797341e6", "score": "0.49672285", "text": "func FollowDestroyHandler(w http.ResponseWriter, r *http.Request) {\n\tswitch r.Method {\n\tcase \"POST\":\n\t\treqMessage := handlermodels.FollowRequest{}\n\t\tbody, err := ioutil.ReadAll(r.Body)\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t\terr = json.Unmarshal(body, &reqMessage)\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t\t//Get user id of the session\n\t\t// ctx, cancel := context.WithTimeout(context.Background(), time.Second)\n\t\t// defer cancel()\n\t\t// cookie, err := r.Cookie(\"sessionId\")\n\t\t// // if err != nil || cookie.Value != \"\" {\n\t\t// token, _ := url.QueryUnescape(cookie.Value)\n\t\t// user, err := AuthClient.GetUserId(ctx, &authpb.AuthToken{Token: token})\n\t\t// // }\n\n\t\t//application.UnFollowUser(user.UserId, reqMessage.UserId)\n\t\tuser := r.Context().Value(\"user\").(*authpb.UserId)\n\t\t_, err = UserServiceClient.UnFollowUser(r.Context(), &userpb.UnFollowRequest{UserId: user.UserId, FollowUserId: reqMessage.UserId})\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tAPIResponse(w, r, 200, \"User unfollowed\", make(map[string]string)) // send data to client side\n\tdefault:\n\t\thttp.Error(w, \"Only POST allowed\", http.StatusMethodNotAllowed)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "38f9c0e6178c25af2f27b9914571c80d", "score": "0.49642915", "text": "func (ms *Share) Delete() (err error) {\n\tdefer fail.OnPanic(&err)()\n\n\tif ms == nil {\n\t\treturn fail.InvalidInstanceError()\n\t}\n\tif ms.item == nil {\n\t\treturn fail.InvalidInstanceContentError(\"ms.item\", \"cannot be nil\")\n\t}\n\terr = ms.item.DeleteFrom(ByIDFolderName, *ms.id)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn ms.item.DeleteFrom(ByNameFolderName, *ms.name)\n}", "title": "" }, { "docid": "b4600d77964b7dcb70e346f7c3c1a682", "score": "0.4957632", "text": "func (r *AgreementAcceptanceRequest) Delete(ctx context.Context) error {\n\treturn r.JSONRequest(ctx, \"DELETE\", \"\", nil, nil)\n}", "title": "" }, { "docid": "a5b513ef18bfaecd7887012f09dc939b", "score": "0.4921503", "text": "func (r *ThreatAssessmentResultRequest) Delete(ctx context.Context) error {\n\treturn r.JSONRequest(ctx, \"DELETE\", \"\", nil, nil)\n}", "title": "" }, { "docid": "83ce46be93b22ab5d81be1c04b6f224c", "score": "0.4916418", "text": "func (o *CatchUp) Delete(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no CatchUp provided for delete\")\n\t}\n\n\tif err := o.doBeforeDeleteHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\targs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), catchUpPrimaryKeyMapping)\n\tsql := \"DELETE FROM `catch_up` WHERE `id`=?\"\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args...)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to delete from catch_up\")\n\t}\n\n\tif err := o.doAfterDeleteHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "038cdb79ee281feafb72509fcc856719", "score": "0.4912314", "text": "func (ps *personSqac) Delete(person *Person) error {\n\treturn ps.handle.Delete(person)\n}", "title": "" }, { "docid": "f8f454997274c0b9e036a45891d04bb5", "score": "0.49105024", "text": "func (a *ASA) Delete(endpoint string) (err error) {\n\t_, err = a.request(endpoint, apiDELETE, nil)\n\treturn err\n}", "title": "" }, { "docid": "f8698039fb0aaadc428a7e813dd8af20", "score": "0.4906433", "text": "func (this *Twitter) Unfollow(followerId int, followeeId int) {\n\tuser := this.users[followerId-1]\n\tdelete(user.followeeIds, followeeId)\n}", "title": "" }, { "docid": "e019bbd9b38de0e4a691ea1286077ee9", "score": "0.49051172", "text": "func (r *TargetedManagedAppProtectionRequest) Delete(ctx context.Context) error {\n\treturn r.JSONRequest(ctx, \"DELETE\", \"\", nil, nil)\n}", "title": "" }, { "docid": "72c4a9aa6dbd6be44bad20886970bc33", "score": "0.4904113", "text": "func (r *PrivilegedApprovalRequest) Delete(ctx context.Context) error {\n\treturn r.JSONRequest(ctx, \"DELETE\", \"\", nil, nil)\n}", "title": "" }, { "docid": "b18ecdca9695fe4e169459ece8b7374b", "score": "0.49015224", "text": "func DeleteFavoriteRecipe(req *http.Request) error {\n\tuserID := req.URL.Query().Get(\"user_id\")\n\trecipeID := req.URL.Query().Get(\"recipe_id\")\n\n\tctx := appengine.NewContext(req)\n\tclient := urlfetch.Client(ctx)\n\tf := firego.New(fireURL, client)\n\n\tf.Auth(fireToken)\n\n\terr := f.Child(\"users/\" + userID + \"/favorites/\" + recipeID).Remove()\n\treturn err\n}", "title": "" }, { "docid": "81b664615333ced1b92274e26b21f29e", "score": "0.48874012", "text": "func (f *Favorites) Delete(ctx context.Context, fav favorites.Folder) error {\n\tf.muShutdown.RLock()\n\tdefer f.muShutdown.RUnlock()\n\n\tif f.disabled {\n\t\treturn nil\n\t}\n\tif f.shutdown {\n\t\treturn data.ShutdownHappenedError{}\n\t}\n\treturn f.sendReq(ctx, &favReq{\n\t\tctx: ctx,\n\t\ttoDel: []favorites.Folder{fav},\n\t\tdone: make(chan struct{}),\n\t})\n}", "title": "" }, { "docid": "6dd8c819ac35cc0a35fb813635271c19", "score": "0.48820013", "text": "func (a *App) Delete(pattern string, target Target) error {\n\treturn a.addRoute(pattern, \"DELETE\", target)\n}", "title": "" }, { "docid": "b2fd4c8549431d9356e17b74f585fa4a", "score": "0.48773602", "text": "func (this *Twitter) Unfollow(followerId int, followeeId int) {\n\n}", "title": "" }, { "docid": "547f5bf01f37b995df71bfe0d4a77734", "score": "0.4861976", "text": "func (s *IncidentsService) Delete(id int) (*Response, error) {\n\tu := fmt.Sprintf(\"api/v1/incidents/%d\", id)\n\n\tresp, err := s.client.Call(\"DELETE\", u, nil, nil)\n\treturn resp, err\n}", "title": "" }, { "docid": "bbfceea8bd5421260c11ffcd6fbc0369", "score": "0.48540986", "text": "func (client GatewaysClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),\n\t\tautorest.ByClosing())\n\tresult.Response = resp\n\treturn\n}", "title": "" }, { "docid": "4d64a95299eb284e1535ad7822e5f92a", "score": "0.48515552", "text": "func (us *UserService) Delete(email string) error {\n\tactiveUser, _ := us.ActiveUserService.GetByEmail(email)\n\tif activeUser != nil {\n\t\treturn NewErrorAttemptDeleteActiveUser(email)\n\t}\n\terr := us.InvitationService.Revoke(email)\n\tif err != nil {\n\t\treturn NewNetworkError(err)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "7f9223c6a2a023832a1db9b5980b8197", "score": "0.4836411", "text": "func (svc *RegistryServiceOp) DeleteManifest(ctx context.Context, registry, repository, digest string) (*Response, error) {\n\tpath := fmt.Sprintf(\"%s/%s/repositories/%s/digests/%s\", registryPath, registry, url.PathEscape(repository), digest)\n\treq, err := svc.client.NewRequest(ctx, http.MethodDelete, path, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresp, err := svc.client.Do(ctx, req, nil)\n\tif err != nil {\n\t\treturn resp, err\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "d791dcc706abd477d53b2c74ca7b9105", "score": "0.482784", "text": "func (c *Conn) Delete(f Flow) error {\n\n\tattrs, err := f.marshal()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Default to IPv4, set netlink protocol family to IPv6 if orig/reply is IPv6.\n\tpf := netfilter.ProtoIPv4\n\tif f.TupleOrig.IP.IsIPv6() && f.TupleReply.IP.IsIPv6() {\n\t\tpf = netfilter.ProtoIPv6\n\t}\n\n\treq, err := netfilter.MarshalNetlink(\n\t\tnetfilter.Header{\n\t\t\tSubsystemID: netfilter.NFSubsysCTNetlink,\n\t\t\tMessageType: netfilter.MessageType(ctDelete),\n\t\t\tFamily: pf,\n\t\t\tFlags: netlink.HeaderFlagsRequest | netlink.HeaderFlagsAcknowledge,\n\t\t}, attrs)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = c.conn.Query(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b526bebb1fb9900281f27d2719ac8b70", "score": "0.48230815", "text": "func (a *App) DELETE(path string, action Action, middleware ...Middleware) {\n\ta.Handle(\"DELETE\", path, a.renderAction(a.middlewarePipeline(action, middleware...)))\n}", "title": "" }, { "docid": "56529343224705668aca0509ed60ba8a", "score": "0.48215473", "text": "func RemoveFollow(unfollow apmodels.ActivityPubActor) error {\n\tlog.Traceln(\"Removing\", unfollow.ActorIri, \"as a follower.\")\n\treturn removeFollow(unfollow.ActorIri)\n}", "title": "" }, { "docid": "fee5cd0f2620626729a994eb12f41d1b", "score": "0.48182443", "text": "func (this *Twitter) Unfollow(followerId int, followeeId int) {\n\tif followeeId == followerId {\n\t\treturn\n\t}\n\tdelete(this.userFollow[followerId], followeeId)\n}", "title": "" }, { "docid": "07b238a4f3bb0bce42af916f1184e9dd", "score": "0.48180446", "text": "func (a *Cmd) Delete(resources []*unstructured.Unstructured) error {\n\ta.Deleter.Resources = resources\n\t_, err := a.Deleter.Do()\n\treturn err\n}", "title": "" }, { "docid": "d5178f32b6b94455a16b7b7f186b929f", "score": "0.4816829", "text": "func (uc UserCommand) Delete() error {\n\treturn database.BotStorage.Delete(bucketName, uc.Name)\n}", "title": "" }, { "docid": "74c3ea27270326a642a295d70d480a19", "score": "0.48130304", "text": "func deleteCmd(in, out *medium) error {\n\t// take input routes:\n\troutes, err := loadRoutesChecked(in)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// delete them:\n\treturn deleteAllIf(routes, out, any)\n}", "title": "" }, { "docid": "7a59ecd3e77b2ab9b02ebb7464bc7ae8", "score": "0.48102468", "text": "func (s *targetCRUD) Delete(arg ...crud.Arg) (crud.Arg, error) {\n\tevent := eventFromArg(arg[0])\n\ttarget := targetFromStuct(event)\n\terr := s.client.Targets.Delete(nil, target.Upstream.ID, target.ID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn target, nil\n}", "title": "" }, { "docid": "50d4ec2435bf4505a75b9d6a51bcf5bb", "score": "0.48083112", "text": "func (r *SharedDriveItemRequest) Delete(ctx context.Context) error {\n\treturn r.JSONRequest(ctx, \"DELETE\", \"\", nil, nil)\n}", "title": "" }, { "docid": "a398ffcd17d34f5b9cd8e270e70f1b41", "score": "0.47990584", "text": "func (o *EarthquakeActivity) Delete(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif o == nil {\n\t\treturn 0, errors.New(\"models: no EarthquakeActivity provided for delete\")\n\t}\n\n\tif err := o.doBeforeDeleteHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\n\targs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), earthquakeActivityPrimaryKeyMapping)\n\tsql := \"DELETE FROM `EarthquakeActivity` WHERE `id`=?\"\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args...)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete from EarthquakeActivity\")\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 delete for EarthquakeActivity\")\n\t}\n\n\tif err := o.doAfterDeleteHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn rowsAff, nil\n}", "title": "" }, { "docid": "b29b996b0e37286b52feef3b7d71a4ad", "score": "0.47963476", "text": "func (client UserClient) Delete(ctx context.Context, apimBaseURL string, UID string, ifMatch string, deleteSubscriptions string, notify string) (result autorest.Response, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/UserClient.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\tif err := validation.Validate([]validation.Validation{\n\t\t{TargetValue: UID,\n\t\t\tConstraints: []validation.Constraint{{Target: \"UID\", Name: validation.MaxLength, Rule: 256, Chain: nil},\n\t\t\t\t{Target: \"UID\", Name: validation.MinLength, Rule: 1, Chain: nil},\n\t\t\t\t{Target: \"UID\", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil {\n\t\treturn result, validation.NewError(\"apimanagement.UserClient\", \"Delete\", err.Error())\n\t}\n\n\treq, err := client.DeletePreparer(ctx, apimBaseURL, UID, ifMatch, deleteSubscriptions, notify)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"apimanagement.UserClient\", \"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, \"apimanagement.UserClient\", \"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, \"apimanagement.UserClient\", \"Delete\", resp, \"Failure responding to request\")\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "cc46a73c513b25b62d346d18b27684e0", "score": "0.47961912", "text": "func (inst *Attachment) Delete() error {\n\tif inst.attachmentModel == nil {\n\t\treturn query.ErrModelNotSet\n\t}\n\n\t_, err := inst.attachmentModel.DeleteById(inst.Id.Int64)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9d91d27fb525e062f8c6f862ef4a3df1", "score": "0.47956535", "text": "func ActivityDelete(w http.ResponseWriter, r *http.Request) {\n vars := mux.Vars(r)\n activityId, _ := strconv.Atoi(vars[\"activity_Id\"])\n\n business.DeleteActivity(activityId)\n\n w.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n w.WriteHeader(http.StatusOK)\n if err := json.NewEncoder(w).Encode(business.GetAllParents(activityId)); err != nil {\n \tpanic(err)\n \t}\n}", "title": "" }, { "docid": "96c0dcdf54ea9d15b4ad7e188f0d56f1", "score": "0.47940022", "text": "func ActionDel(c *cli.Context) {\n\tif len(c.Args()) != 1 {\n\t\tlog.Fatal(\"error: must specify an app id\")\n\t}\n\tapp := c.Args()[0]\n\n\tif !c.Bool(\"yes\") {\n\t\tvar reply string\n\t\tfmt.Fprintf(os.Stderr,\n\t\t\t\"Do you want to delete the application %q? [y/N] \", app)\n\t\tfmt.Scanln(&reply)\n\t\treply = strings.ToLower(reply)\n\t\tif reply != \"y\" && reply != \"yes\" {\n\t\t\tos.Exit(-1)\n\t\t}\n\t}\n\n\tif _, err := service.Service.AppDel(app); err != nil {\n\t\tlog.Fatalf(\"error: %v\", err)\n\t}\n\tlog.Printf(\"App deleted: '%s'\", app)\n}", "title": "" }, { "docid": "257640a0659420ce2fe68b2051ea9e5f", "score": "0.47934178", "text": "func (db *Context) DeleteActivity(id string) {\n\tfile := db.GetActivity(id)\n\tif file.ID != 0 {\n\t\tdb.Delete(file)\n\t}\n}", "title": "" }, { "docid": "e239b1464b6ba266fa5174e26ee26463", "score": "0.47881934", "text": "func (m *ActiontracesDAO) Delete(act ActionTrace) error {\n\terr := db.C(ACTCOLLECTION).Remove(&act)\n\treturn err\n}", "title": "" }, { "docid": "d805687eb418228b1e9028be9739224e", "score": "0.4784587", "text": "func (a *Client) DeleteFavoriteActivities(params *DeleteFavoriteActivitiesParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteFavoriteActivitiesOK, *DeleteFavoriteActivitiesNoContent, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewDeleteFavoriteActivitiesParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"deleteFavoriteActivities\",\n\t\tMethod: \"DELETE\",\n\t\tPathPattern: \"/1/user/-/activities/favorite/{activity-id}.json\",\n\t\tProducesMediaTypes: []string{\"application/x-www-form-urlencoded\"},\n\t\tConsumesMediaTypes: []string{\"\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &DeleteFavoriteActivitiesReader{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, nil, err\n\t}\n\tswitch value := result.(type) {\n\tcase *DeleteFavoriteActivitiesOK:\n\t\treturn value, nil, nil\n\tcase *DeleteFavoriteActivitiesNoContent:\n\t\treturn nil, value, nil\n\t}\n\treturn nil, nil, nil\n\n}", "title": "" }, { "docid": "841e7a24f0c1299f67c9a0fb59b304d1", "score": "0.4783054", "text": "func (p *PairsManager) Delete(a asset.Item) {\n\tp.m.Lock()\n\tdelete(p.Pairs, a)\n\tp.m.Unlock()\n}", "title": "" }, { "docid": "da61b1d3e166420082d1442e4f13b7f8", "score": "0.47753194", "text": "func (r *Req) Delete(url string, v ...interface{}) (*Resp, error) {\n\treturn r.Do(\"DELETE\", url, v...)\n}", "title": "" }, { "docid": "2623617e80c909dea5eac12bb9c92dcc", "score": "0.47701204", "text": "func (r *MySQLSavedItemsRepo) Delete(userID uint64, url string) error {\n\tquery := `DELETE FROM saved_items\n\t\t\t WHERE user_id = ? AND url = ?`\n\t_, err := r.db.Exec(query, userID, url)\n\treturn err\n}", "title": "" }, { "docid": "51f61acb64af8b2c7f05f20356590216", "score": "0.47654572", "text": "func (client AssessmentsClient) DeleteResponder(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": "b670bca5a50ec8cedfb411c076bf4b77", "score": "0.47650912", "text": "func (c *Client) Delete(url string) *Agent {\n\treturn c.createAgent(MethodDelete, url)\n}", "title": "" }, { "docid": "03931247fed6575e27a6c6e4ea9ddc53", "score": "0.47648823", "text": "func (activity *ActivityConsumeAnime) DeleteInContext(ctx aero.Context) error {\n\treturn activity.Delete()\n}", "title": "" }, { "docid": "5b1b443a9eb2e2a11a6d4795f3cbc366", "score": "0.47629744", "text": "func (c *ActivityClient) Delete() *ActivityDelete {\n\tmutation := newActivityMutation(c.config, OpDelete)\n\treturn &ActivityDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "c6c2db0e7ab0b7b3c43420269daadfeb", "score": "0.47615546", "text": "func (this *Twitter) Unfollow(followerId int, followeeId int) {\n\tfe := this.FM[followerId]\n\tidx := -1\n\tfor i := 0; i < len(fe); i++ {\n\t\tif fe[i] == followeeId {\n\t\t\tidx = i\n\t\t\tbreak\n\t\t}\n\t}\n\tif idx != -1 {\n\t\tfe = append(fe[0:idx], fe[idx+1:]...)\n\t\tthis.FM[followerId] = fe\n\t}\n}", "title": "" }, { "docid": "3830161eab45fd2f4bbea27524823314", "score": "0.4761254", "text": "func (r *ManagedAppPolicyRequest) Delete(ctx context.Context) error {\n\treturn r.JSONRequest(ctx, \"DELETE\", \"\", nil, nil)\n}", "title": "" }, { "docid": "e9f5eb32e66a18280c6c0cb1c05a9542", "score": "0.47597772", "text": "func (client UserClient) DeleteResponder(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, http.StatusNoContent),\n\t\tautorest.ByClosing())\n\tresult.Response = resp\n\treturn\n}", "title": "" }, { "docid": "3e034bd8888e7a3d553125a50ba67112", "score": "0.4759307", "text": "func Delete(req handler.Request, prevModel *Model, currentModel *Model) (handler.ProgressEvent, error) {\n\tresponse := makeRequest(&RequestInput{\n\t\tMethod: \"DELETE\",\n\t\tURL: APIEndpoint + \"/\" + aws.StringValue(currentModel.UID),\n\t\tBody: nil,\n\t\tAction: \"Delete\",\n\t})\n\treturn response, nil\n}", "title": "" }, { "docid": "7358b3a1b31d7726663918665bd058f0", "score": "0.47582498", "text": "func (c *Chain) Delete(rule Rule) error {\n\targs, err := rule.Marshal()\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = c.runCommand(deleteCommand, args...)\n\treturn err\n}", "title": "" }, { "docid": "f889062467c6ac0c5d97388948d8a1f2", "score": "0.4747718", "text": "func (example *Example) Delete(namespace string, path string) {\n\tfullPath := getFullPath(istioPath + path)\n\texample.steps = append(example.steps, newStepFile(namespace, fullPath, true))\n}", "title": "" }, { "docid": "b4f3ec6de58d4f4ca374a3e004e821e1", "score": "0.4740157", "text": "func (client BaseClient) DeleteSecretSender(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": "21d339ac52e03edbb0549fda0edc3f4b", "score": "0.47362307", "text": "func (c *PanoMatchList) Delete(dg, logfwd string, e ...interface{}) error {\n\tvar err error\n\n\tif len(e) == 0 {\n\t\treturn nil\n\t} else if logfwd == \"\" {\n\t\treturn fmt.Errorf(\"logfwd must be specified\")\n\t}\n\n\tnames := make([]string, len(e))\n\tfor i := range e {\n\t\tswitch v := e[i].(type) {\n\t\tcase string:\n\t\t\tnames[i] = v\n\t\tcase Entry:\n\t\t\tnames[i] = v.Name\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"Unknown type sent to delete: %s\", v)\n\t\t}\n\t}\n\tc.con.LogAction(\"(delete) %s: %v\", plural, names)\n\n\t// Remove the objects.\n\tpath := c.xpath(dg, logfwd, names)\n\t_, err = c.con.Delete(path, nil, nil)\n\treturn err\n}", "title": "" }, { "docid": "76eebd0a318c5d2b69377404bcb72931", "score": "0.4735027", "text": "func (r *localRepository) DeleteManifest(packageArn string, packageVersion string) error {\n\tmanifestFilePath := r.filePath(packageArn, packageVersion)\n\tif !fileutil.Exists(manifestFilePath) {\n\t\treturn nil\n\t}\n\n\treturn fileutil.DeleteFile(manifestFilePath)\n}", "title": "" }, { "docid": "8cf101e3de4309cefa172b98e9794bb7", "score": "0.4732208", "text": "func (s *Store) intentionDeleteTxn(tx *memdb.Txn, idx uint64, queryID string) error {\n\t// Pull the query.\n\twrapped, err := tx.First(intentionsTableName, \"id\", queryID)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed intention lookup: %s\", err)\n\t}\n\tif wrapped == nil {\n\t\treturn nil\n\t}\n\n\t// Delete the query and update the index.\n\tif err := tx.Delete(intentionsTableName, wrapped); err != nil {\n\t\treturn fmt.Errorf(\"failed intention delete: %s\", err)\n\t}\n\tif err := tx.Insert(\"index\", &IndexEntry{intentionsTableName, idx}); err != nil {\n\t\treturn fmt.Errorf(\"failed updating index: %s\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "5b6a2fb1d64d4949ccbdd5a881f06af9", "score": "0.47249693", "text": "func (broadcast *Broadcast) Unfollow(follower, followee, privKeyHex string, seq int64) error {\n\tmsg := model.UnfollowMsg{\n\t\tFollower: follower,\n\t\tFollowee: followee,\n\t}\n\treturn broadcast.broadcastTransaction(msg, privKeyHex, seq, \"\")\n}", "title": "" }, { "docid": "909b6908f8024dbf163765a243f4a98b", "score": "0.4724374", "text": "func (client AssessmentsClient) DeleteSender(req *http.Request) (*http.Response, error) {\n\treturn autorest.SendWithSender(client, req,\n\t\tazure.DoRetryWithRegistration(client.Client))\n}", "title": "" }, { "docid": "0fb4d21428ef7df6fa5060877752e263", "score": "0.4723548", "text": "func (m *OAuth2PermissionGrantItemRequestBuilder) Delete(ctx context.Context, requestConfiguration *OAuth2PermissionGrantItemRequestBuilderDeleteRequestConfiguration)(error) {\n requestInfo, err := m.CreateDeleteRequestInformation(ctx, requestConfiguration);\n if err != nil {\n return err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n err = m.requestAdapter.SendNoContentAsync(ctx, requestInfo, errorMapping)\n if err != nil {\n return err\n }\n return nil\n}", "title": "" }, { "docid": "75d84be559eb0b217dc8633236d4c702", "score": "0.47234717", "text": "func (s *Service) Delete(c context.Context, arg *model.ArgDelete) (err error) {\n\terr = s.client.Call(c, _delete, arg, _noRes)\n\treturn\n}", "title": "" }, { "docid": "bcfc994986faaeb16616c3991c72281d", "score": "0.4718767", "text": "func (m *ItemJoinedTeamsItemPrimaryChannelSharedWithTeamsSharedWithChannelTeamInfoItemRequestBuilder) Delete(ctx context.Context, requestConfiguration *ItemJoinedTeamsItemPrimaryChannelSharedWithTeamsSharedWithChannelTeamInfoItemRequestBuilderDeleteRequestConfiguration)(error) {\n requestInfo, err := m.ToDeleteRequestInformation(ctx, requestConfiguration);\n if err != nil {\n return err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n err = m.requestAdapter.SendNoContent(ctx, requestInfo, errorMapping)\n if err != nil {\n return err\n }\n return nil\n}", "title": "" }, { "docid": "c73d3c4e1267955c764d059788628913", "score": "0.4717991", "text": "func (s *Item) Delete(path string, fn http.HandlerFunc, c ...alice.Constructor) {\n\ts.record(\"DELETE\", path)\n\ts.r.Delete(path, alice.New(c...).ThenFunc(fn).(http.HandlerFunc))\n}", "title": "" }, { "docid": "eea38e989851e906782a21a9695862e8", "score": "0.47171295", "text": "func (k *Kubectl) DeleteManifest(ctx context.Context, manifest []byte) error {\n\targs := []string{\n\t\t\"kubectl\",\n\t\t\"delete\",\n\t\t\"-f\",\n\t\t\"-\",\n\t\t\"--ignore-not-found\",\n\t}\n\n\targs = append(args, k.buildCredentialArgs()...)\n\n\terr := backoff.Retry(\n\t\tfunc() error {\n\t\t\tcmd := exec.Command(args[0], args[1:]...)\n\t\t\tcmd.Stdin = bytes.NewBuffer(manifest)\n\t\t\t_, err := command.RunWithContext(ctx, cmd)\n\n\t\t\treturn handlePermanentErrors(err)\n\t\t},\n\t\tbackoff.WithContext(backoffStrategy, ctx),\n\t)\n\n\treturn err\n}", "title": "" }, { "docid": "390b19a8237c75fd31b3f3ecd59c03d1", "score": "0.47167087", "text": "func (m *Mini) DELETE(path string, handler http.HandlerFunc, middleware ...Middleware) {\n\tm.Handle(http.MethodDelete, path, handler, middleware...)\n}", "title": "" }, { "docid": "2b46095d827718d5a624324e27df60a3", "score": "0.47144294", "text": "func (o *Invitation) Delete(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif o == nil {\n\t\treturn 0, errors.New(\"record: no Invitation provided for delete\")\n\t}\n\n\tif err := o.doBeforeDeleteHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\n\targs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), invitationPrimaryKeyMapping)\n\tsql := \"DELETE FROM \\\"invitations\\\" WHERE \\\"id\\\"=$1\"\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args...)\n\t}\n\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"record: unable to delete from invitations\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"record: failed to get rows affected by delete for invitations\")\n\t}\n\n\tif err := o.doAfterDeleteHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn rowsAff, nil\n}", "title": "" }, { "docid": "cb1498bb76d8edc56c06c3814b72edc9", "score": "0.4705958", "text": "func (uic *UserInviteCode) Delete(c context.Context) (*UserInviteCode, error) {\n\terr := nds.Delete(c, uic.BaseKey(c, \"UserInviteCode\"))\n\tif err != nil {\n\t\tlog.Errorf(c, \"%v\", err)\n\t\treturn nil, err\n\t}\n\treturn uic, nil\n}", "title": "" }, { "docid": "a2b2e98d70f72e4eb2763d81c75ab970", "score": "0.47032803", "text": "func Delete(req handler.Request, prevModel *Model, currentModel *Model) (handler.ProgressEvent, error) {\n\treturn deleteOperation(req, prevModel, currentModel)\n}", "title": "" }, { "docid": "1a5cd9a5aaaad2b597e760e0a31866b6", "score": "0.4702455", "text": "func (r *Request) Delete(uri string, opts ...Options) (*Response, error) {\n\treturn r.Request(\"DELETE\", uri, opts...)\n}", "title": "" }, { "docid": "2705305c19a76046b4811c7e0d339c34", "score": "0.46933207", "text": "func (r *ResourceSpecificPermissionGrantRequest) Delete(ctx context.Context) error {\n\treturn r.JSONRequest(ctx, \"DELETE\", \"\", nil, nil)\n}", "title": "" }, { "docid": "dc2e4551c191767e8e162737fcc2f47f", "score": "0.46912646", "text": "func (r *PrivilegedSignupStatusRequest) Delete(ctx context.Context) error {\n\treturn r.JSONRequest(ctx, \"DELETE\", \"\", nil, nil)\n}", "title": "" }, { "docid": "f73bb89816389c5f95424358a539ad8e", "score": "0.4691035", "text": "func (u *user) Delete(w http.ResponseWriter, r *http.Request) {\n\tid := context.Get(r, binders.ID).(int)\n\n\tif err := u.service.Delete(id); err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t}\n}", "title": "" }, { "docid": "1182649ba60c647cbc711be22ff3212c", "score": "0.46898365", "text": "func (s *SavedItemsService) Delete(r *http.Request) (int, interface{}, error) {\n\t// gather the inputs from request\n\tid := context.Get(r, userIDKey).(uint64)\n\turl := r.URL.Query().Get(\"url\")\n\n\t// do work and respond\n\terr := s.repo.Delete(id, url)\n\tif err != nil {\n\t\treturn http.StatusInternalServerError, nil, err\n\t}\n\n\tserver.LogWithFields(r).Info(\"successfully deleted item\")\n\treturn http.StatusOK, jsonResponse{\"successfully deleted saved item\"}, nil\n}", "title": "" }, { "docid": "9977ed691920de9bed8d830c6fb80324", "score": "0.46896657", "text": "func DELETE(relativePath string, controller ControllerInterface) {\n\trouterObj.DELETE(relativePath, controller)\n}", "title": "" }, { "docid": "7aab95bb2aa4ba2f518b15074cbd1443", "score": "0.468947", "text": "func (r *TargetedManagedAppPolicyAssignmentRequest) Delete(ctx context.Context) error {\n\treturn r.JSONRequest(ctx, \"DELETE\", \"\", nil, nil)\n}", "title": "" }, { "docid": "921eb865b975781112afeb0f4b8632b6", "score": "0.46893674", "text": "func Delete(stub shim.ChaincodeStubInterface, args []string) peer.Response {\n\tfmt.Println(\"-- Starting account Delete\")\n\n\tvar err error\n\n\t// Input sanitation\n\tif args[0] == \"\" {\n\t\treturn shim.Error(\"Error: 1st argument must be a non-empty string\")\n\t}\n\t_, err = strconv.Atoi(args[0])\n\tif err != nil {\n\t\treturn shim.Error(\"Error: 1st argument must be a numeric string\")\n\t}\n\n\t// Mapping arg to variable\n\taccNumber := args[0]\n\n\t// Get Account state and check if it exists\n\taccountAsBytes, err := stub.GetState(\"ACC\" + accNumber)\n\tif err != nil {\n\t\treturn shim.Error(\"Error: Fail to get state of account: \" + accNumber)\n\t} else if accountAsBytes == nil {\n\t\treturn shim.Error(\"Error: Account \" + accNumber + \" does not exist!\")\n\t}\n\n\t// Remove the account from chaincode state\n\terr = stub.DelState(\"ACC\" + accNumber)\n\tif err != nil {\n\t\treturn shim.Error(\"Error: Failed to delete state:\" + err.Error())\n\t}\n\n\tfmt.Println(\"-- Ending account Delete\")\n\treturn shim.Success([]byte(\"Account deleted!\"))\n}", "title": "" }, { "docid": "191e12520a3cde0399439c0192502b52", "score": "0.46887204", "text": "func (afam *ActivityFactoryActivityMapping) Delete(ctx context.Context, key ...interface{}) error {\n\tvar err error\n\tvar dbConn *sql.DB\n\n\t// if deleted, bail\n\tif afam._deleted {\n\t\treturn nil\n\t}\n\n\ttx, err := components.M.GetConnFromCtx(ctx)\n\tif err != nil {\n\t\tdbConn, err = components.M.GetMasterConn()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\ttableName, err := GetActivityFactoryActivityMappingTableName(key...)\n\tif err != nil {\n\t\treturn err\n\t}\n\t//1\n\n\t// sql query with composite primary key\n\tsqlstr := `UPDATE ` + tableName + ` SET is_del = 1 WHERE id = ?`\n\n\t// run query\n\tutils.GetTraceLog(ctx).Debug(\"DB\", zap.String(\"SQL\", fmt.Sprint(sqlstr, afam.ID)))\n\tif tx != nil {\n\t\t_, err = tx.Exec(sqlstr, afam.ID)\n\t} else {\n\t\t_, err = dbConn.Exec(sqlstr, afam.ID)\n\t}\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// set deleted\n\tafam._deleted = true\n\n\treturn nil\n}", "title": "" }, { "docid": "ad39b13d5dcd83b23351c710c53caae1", "score": "0.46859622", "text": "func (client GatewaysClient) DeleteSender(req *http.Request) (future GatewaysDeleteFuture, err error) {\n\tvar resp *http.Response\n\tfuture.FutureAPI = &azure.Future{}\n\tresp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))\n\tif err != nil {\n\t\treturn\n\t}\n\tvar azf azure.Future\n\tazf, err = azure.NewFutureFromResponse(resp)\n\tfuture.FutureAPI = &azf\n\tfuture.Result = future.result\n\treturn\n}", "title": "" }, { "docid": "a07738b5fd241149cd859d138765686d", "score": "0.46850142", "text": "func (_e *Proxy_Expecter) Delete(ctx interface{}, request interface{}) *Proxy_Delete_Call {\n\treturn &Proxy_Delete_Call{Call: _e.mock.On(\"Delete\", ctx, request)}\n}", "title": "" }, { "docid": "8d2805091c93f234cc14c2a405d8d29b", "score": "0.46826148", "text": "func (repo *Repository) Delete(ctx context.Context, claims auth.Claims, req DeleteRequest) error {\n\tspan, ctx := tracer.StartSpanFromContext(ctx, \"internal.deposit.Delete\")\n\tdefer span.Finish()\n\n\t// Validate the request.\n\tv := webcontext.Validator()\n\terr := v.Struct(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif claims.Audience == \"\" {\n\t\treturn errors.WithStack(ErrForbidden)\n\t}\n\t// Admin users can update Categories they have access to.\n\tif !claims.HasRole(auth.RoleAdmin) {\n\t\treturn errors.WithStack(ErrForbidden)\n\t}\n\n\t_, err = models.Deposits(models.DepositWhere.ID.EQ(req.ID)).DeleteAll(ctx, repo.DbConn)\n\tif err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\n\treturn nil\n}", "title": "" } ]
6e25b304f1b641cd7fd992fa62809466
print table declarations in console (debugging)
[ { "docid": "add98d36ac9079a4483d1c9122ec72f7", "score": "0.65362394", "text": "func (t *Table) Print() {\n\tvar level int\n\tfor level <= t.level {\n\t\tfor k, v := range t.table[level] {\n\t\t\tfmt.Printf(\"level: %d, name: %s, type: %d\\n\", level, k, v.expression)\n\t\t}\n\t\tlevel++\n\t}\n}", "title": "" } ]
[ { "docid": "f0ef60239a5e086f9bfa9c838a1e318b", "score": "0.7098208", "text": "func printTable() {\n\t/*\n\t\tPrepare the table format depending on the length of the longest port name\n\t*/\n\tformat := fmt.Sprintf(\"%%%ds\\t%%s\\t%%.2f\\n\", maxLength)\n\n\t/*\n\t\tPrint the table\n\t*/\n\tfor _, v := range macs {\n\t\tfmt.Printf(format, v.Port, v.Mac, v.Age)\n\t}\n}", "title": "" }, { "docid": "b308b13e4a3c5dda43fb3377bdde179a", "score": "0.7091962", "text": "func (c CLI) PrintTable(header []string, values [][]string) {\n}", "title": "" }, { "docid": "33616b7c83ca22badb29fcbb749edb51", "score": "0.6923557", "text": "func tableStart(){\n\tfmt.Println(\"+-----+---------------+---------------+----------+------------------+------------------+------------------+\")\n\tfmt.Println(\"| ID | Nachname | Vorname | Alter | Lernbegleiter | QPA | Projekt |\")\n\tfmt.Println(\"+-----+---------------+---------------+----------+------------------+------------------+------------------+\")\n}", "title": "" }, { "docid": "6089bcf308232455d0839d360f50291d", "score": "0.66358155", "text": "func PrintTable(objects []interface{}, headers []string) {\n\t// Print result table\n\ttable := tablewriter.NewWriter(os.Stdout)\n\ttable.SetHeader(headers)\n\tfor _, object := range objects {\n\t\tt := reflect.TypeOf(object)\n\t\tfmt.Println(t)\n\t\t// var o t\n\t\t// mapstructure.Decode(object, &t)\n\t\t// var values []string\n\t\t// for _, header := range headers {\n\t\t// \tappend(values, object.(*t).header)\n\t\t// }\n\t\t// \ttable.Append([]string{c.ID, c.Name, c.Project})\n\t}\n\ttable.Render()\n}", "title": "" }, { "docid": "626b0e8db30b7bc65a543569deec6525", "score": "0.6594545", "text": "func printTable(net Net, ixLan [][]string) {\n\tprintln(\"The data provided from www.peeringdb.com\")\n\ttable := tablewriter.NewWriter(os.Stdout)\n\ttable.SetHeader([]string{\"Name\", \"Traffic\", \"Type\", \"Web site\", \"Note\"})\n\ttable.Append([]string{net.Name, net.Traffic, net.InfoType, net.WWW, net.Note})\n\ttable.Render()\n\ttable = tablewriter.NewWriter(os.Stdout)\n\ttable.SetHeader([]string{\"Name\", \"Status\", \"Speed\", \"IPv4 Addr\", \"IPv6 Addr\"})\n\tfor _, v := range ixLan {\n\t\ttable.Append(v)\n\t}\n\ttable.Render()\n}", "title": "" }, { "docid": "9285f50ca2e0298fce8e8c3a34a026f3", "score": "0.65373987", "text": "func _89printSchemaLine(tls crt.TLS, _out uintptr /* *TFILE = S_IO_FILE */, _z uintptr /* *int8 */, _zTail uintptr /* *int8 */) {\n\tif Xsqlite3_strglob(tls, ts+12289 /* \"CREATE TABLE ['\\\"]*\" */, _z) != int32(0) {\n\t\tgoto _1\n\t}\n\n\tcrt.Xfprintf(tls, _out, ts+12308 /* \"CREATE TABLE IF NOT EXISTS %s%s\" */, _z+uintptr(13), _zTail)\n\tgoto _2\n\n_1:\n\tcrt.Xfprintf(tls, _out, ts+8770 /* \"%s%s\" */, _z, _zTail)\n_2:\n}", "title": "" }, { "docid": "c3955c2d5dedbdd1d4481bca679fb020", "score": "0.6503273", "text": "func (p *Printer) PrintTable() *bytes.Buffer {\n\tb := new(bytes.Buffer)\n\n\tformatColumns := []string{}\n\tfor _, column := range p.SourceColumns {\n\t\tformatColumn := resizeString(column, p.ColumsWidth[column])\n\t\tformatColumns = append(formatColumns, formatColumn)\n\n\t}\n\n\tfor _, formatColumn := range formatColumns {\n\t\tb.WriteString(formatColumn)\n\t\tb.WriteString(\"\\t\")\n\n\t}\n\n\tb.WriteString(\"\\n\")\n\n\tfor _, row := range p.Data {\n\t\tfor _, column := range p.SourceColumns {\n\t\t\trecord := row[column]\n\t\t\tformattedRecord := resizeString(record, p.ColumsWidth[column])\n\t\t\tb.WriteString(formattedRecord)\n\t\t\tb.WriteString(\"\\t\")\n\n\t\t}\n\t\tb.WriteString(\"\\n\")\n\n\t}\n\n\treturn b\n\n}", "title": "" }, { "docid": "53c25b99bfd5d2baef347ec28b03d4b7", "score": "0.63771945", "text": "func (c *Handler) PrintTable() {\n\tc.table.printTable()\n}", "title": "" }, { "docid": "db47a76c8f80eb6d94ce224a07193f2b", "score": "0.636248", "text": "func printTable(obj interface{}) {\n\tvar table []map[string]string\n\tjsonBytes, err := json.Marshal(obj)\n\tif err == nil {\n\t\terr = json.Unmarshal(jsonBytes, &table)\n\t}\n\tif err != nil {\n\t\tlogrus.Fatal(err)\n\t}\n\n\tcolumns := map[string]int{}\n\tfor _, row := range table {\n\t\tfor k, v := range row {\n\t\t\tif len(v) > columns[k] {\n\t\t\t\tcolumns[k] = len(v)\n\t\t\t}\n\t\t}\n\t}\n\tvar sorted []string\n\tfor k := range columns {\n\t\tsorted = append(sorted, k)\n\t}\n\tsort.Strings(sorted)\n\n\tfor _, col := range sorted {\n\t\tfmt.Printf(\"%-\"+strconv.Itoa(columns[col])+\"s \", col)\n\t}\n\n\tfmt.Print(\"\\n\")\n\tfor _, col := range sorted {\n\t\tfor i := 0; i < columns[col]; i++ {\n\t\t\tfmt.Print(\"-\")\n\t\t}\n\t\tfmt.Print(\" \")\n\t}\n\tfmt.Print(\"\\n\")\n\n\tfor _, row := range table {\n\t\tfor _, col := range sorted {\n\t\t\tfmt.Printf(\"%-\"+strconv.Itoa(columns[col])+\"s \", row[col])\n\t\t}\n\t\tfmt.Print(\"\\n\")\n\t}\n}", "title": "" }, { "docid": "d7fd148343ff19bf3eb0d166f2650720", "score": "0.6348263", "text": "func printTable(rt *unicode.RangeTable, omitTypeLitteral bool) string {\n\tw := new(bytes.Buffer)\n\tif omitTypeLitteral {\n\t\tfmt.Fprintln(w, \"{\")\n\t} else {\n\t\tfmt.Fprintln(w, \"&unicode.RangeTable{\")\n\t}\n\tif len(rt.R16) > 0 {\n\t\tfmt.Fprintln(w, \"\\tR16: []unicode.Range16{\")\n\t\tfor _, r := range rt.R16 {\n\t\t\tfmt.Fprintf(w, \"\\t\\t{Lo:%#04x, Hi:%#04x, Stride:%d},\\n\", r.Lo, r.Hi, r.Stride)\n\t\t}\n\t\tfmt.Fprintln(w, \"\\t},\")\n\t}\n\tif len(rt.R32) > 0 {\n\t\tfmt.Fprintln(w, \"\\tR32: []unicode.Range32{\")\n\t\tfor _, r := range rt.R32 {\n\t\t\tfmt.Fprintf(w, \"\\t\\t{Lo:%#x, Hi:%#x,Stride:%d},\\n\", r.Lo, r.Hi, r.Stride)\n\t\t}\n\t\tfmt.Fprintln(w, \"\\t},\")\n\t}\n\tif rt.LatinOffset > 0 {\n\t\tfmt.Fprintf(w, \"\\tLatinOffset: %d,\\n\", rt.LatinOffset)\n\t}\n\tfmt.Fprintf(w, \"}\")\n\treturn w.String()\n}", "title": "" }, { "docid": "b77d0fb4db05e810904a37bb5f638cbb", "score": "0.62514204", "text": "func (t *tablePrinter) printTable(data *collector.Observation,\n\tmoveUpCount int) int {\n\tfor i := 0; i < moveUpCount; i++ {\n\t\tt.moveUp()\n\t\tt.eraseCurrentLine()\n\t}\n\tlinePrintCount := 0\n\n\tcolor, setColor := colorForTableStatus(data.AggregateStatus)\n\tvar aggStatusText string\n\tif setColor {\n\t\taggStatusText = sPrintWithColor(color, data.AggregateStatus.String())\n\t} else {\n\t\taggStatusText = data.AggregateStatus.String()\n\t}\n\tt.printOrDie(\"Aggregate status: %s\\n\", aggStatusText)\n\tlinePrintCount++\n\n\tfor i, column := range columns {\n\t\tformat := fmt.Sprintf(\"%%-%ds\", column.width)\n\t\tt.printOrDie(format, column.header)\n\t\tif i == len(columns)-1 {\n\t\t\tt.printOrDie(\"\\n\")\n\t\t\tlinePrintCount++\n\t\t} else {\n\t\t\tt.printOrDie(\" \")\n\t\t}\n\t}\n\n\tfor _, resource := range data.ResourceStatuses {\n\t\tfor i, column := range columns {\n\t\t\twritten, err := column.printContent(t.w, column.width, resource)\n\t\t\tif err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t\tremainingSpace := column.width - written\n\t\t\tt.printOrDie(strings.Repeat(\" \", remainingSpace))\n\t\t\tif i == len(columns)-1 {\n\t\t\t\tt.printOrDie(\"\\n\")\n\t\t\t\tlinePrintCount++\n\t\t\t} else {\n\t\t\t\tt.printOrDie(\" \")\n\t\t\t}\n\t\t}\n\n\t\tlinePrintCount += t.printSubTable(resource.GeneratedResources, \"\")\n\t}\n\n\treturn linePrintCount\n}", "title": "" }, { "docid": "63a38e19435c3516e602de84b24b7b3e", "score": "0.6201597", "text": "func (m *Mock) ShowTable(schema, table string) (sc adapters.Scanner) {\n\treturn\n}", "title": "" }, { "docid": "a4152cfa5adff902c3522824ed6e8266", "score": "0.619044", "text": "func (o *OutputConf) PrintTable(pager *Pager) error {\n\tw := o.getWriter()\n\tdefer w.Flush()\n\t// add JSON object handler\n\tpager.SetObjectHandler(func(j util.JSONResponse) error {\n\t\t// copy a reseted cursor\n\t\tc, err := j.Cursor().New()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// complete JSON document must be processed\n\t\tdefer func() {\n\t\t\t_ = c.End()\n\t\t\tif o.Flush {\n\t\t\t\tw.Flush()\n\t\t\t}\n\t\t}()\n\t\t// create the new iterator for the copied cursor\n\t\ti, err := o.tf.Iterator(c)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// print table body (w is the reason for lamda func)\n\t\treturn o.streamTableBody(i, w)\n\t})\n\t// print the header\n\tif err := o.streamTableHeader(w); err != nil {\n\t\treturn err\n\t}\n\t// print the table body\n\tif o.Paging {\n\t\treturn pager.Run()\n\t}\n\treturn pager.RunOnce()\n}", "title": "" }, { "docid": "338a81f192ff512f8cc9f2b5cccc4b39", "score": "0.61220926", "text": "func (tb *Table) String() string {\n\trv := fmt.Sprintf(\"type %s struct {\\n\", utils.CamelCase(tb.Name))\n\tfor _, v := range tb.Columns {\n\t\trv += v.String() + \"\\n\"\n\t}\n\trv += \"}\\n\"\n\treturn rv\n}", "title": "" }, { "docid": "6a622d6575357625ead0c563d3fff69a", "score": "0.6121249", "text": "func (t *Table) Print() error {\n\ttotalWidth := int64(0)\n\tformat := \"\"\n\tfor i, w := range t.widths {\n\t\tmargin := 2\n\t\tif i == len(t.widths)-1 {\n\t\t\t// Don't add margin for the last column\n\t\t\tmargin = 0\n\t\t}\n\t\tformat += \"%\" + strconv.FormatInt(w, 10) + \"s\" + strings.Repeat(\" \", margin)\n\t\ttotalWidth += int64(math.Abs(float64(w))) + int64(margin)\n\t}\n\n\t// print header\n\tif _, err := fmt.Fprintf(t.writer, format+\"\\n\", ifaceify(t.headers)...); err != nil {\n\t\treturn err\n\t}\n\tif _, err := fmt.Fprintf(t.writer, strings.Repeat(\"-\", int(totalWidth))+\"\\n\"); err != nil {\n\t\treturn err\n\t}\n\n\t// print rows\n\tfor _, row := range t.rows {\n\t\tif _, err := fmt.Fprintf(t.writer, format+\"\\n\", row...); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif len(t.rows) == 0 {\n\t\tif _, err := fmt.Fprintf(t.writer, t.emptyText+\"\\n\"); err != nil {\n\t\t\treturn err\n\t\t}\n\t} else if len(t.summary) > 0 {\n\t\tt.PrintSummary()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3d50a2fda25935122800f2913e420309", "score": "0.6105382", "text": "func (d *PgDesc) Tables(w io.Writer, tabtypes string, pattern string, verbose bool, showSystem bool) error {\n\n\tvar showTables bool = strchr(tabtypes, 't') != NULL\n\tvar showIndexes bool = strchr(tabtypes, 'i') != NULL\n\tvar showViews bool = strchr(tabtypes, 'v') != NULL\n\tvar showMatViews bool = strchr(tabtypes, 'm') != NULL\n\tvar showSeq bool = strchr(tabtypes, 's') != NULL\n\tvar showForeign bool = strchr(tabtypes, 'E') != NULL\n\n\t// PQExpBufferData buf;\n\t// PGresult *res;\n\t// printQueryOpt myopt = pset.popt;\n\t// static const bool translate_columns[] = {false, false, true, false, false, false, false};\n\n\t/* If tabtypes is empty, we default to \\dtvmsE (but see also command.c) */\n\tif !(showTables || showIndexes || showViews || showMatViews || showSeq || showForeign) {\n\t\tshowTables, showViews, showMatViews, showSeq, showForeign = true, true, true, true, true\n\t}\n\n\t// initPQExpBuffer(w);\n\n\t/*\n\t * Note: as of Pg 8.2, we no longer use relkind 's' (special), but we keep\n\t * it here for backwards compatibility.\n\t */\n\tfmt.Fprintf(w,\n\t\t\"SELECT n.nspname as \\\"%s\\\",\\n\"+\n\t\t\t\" c.relname as \\\"%s\\\",\\n\"+\n\t\t\t\" CASE c.relkind\"+\n\t\t\t\" WHEN '\"+string(RELKIND_RELATION)+\"' THEN '%s'\"+\n\t\t\t\" WHEN '\"+string(RELKIND_VIEW)+\"' THEN '%s'\"+\n\t\t\t\" WHEN '\"+string(RELKIND_MATVIEW)+\"' THEN '%s'\"+\n\t\t\t\" WHEN '\"+string(RELKIND_INDEX)+\"' THEN '%s'\"+\n\t\t\t\" WHEN '\"+string(RELKIND_SEQUENCE)+\"' THEN '%s'\"+\n\t\t\t\" WHEN 's' THEN '%s'\"+\n\t\t\t\" WHEN '\"+string(RELKIND_FOREIGN_TABLE)+\"' THEN '%s'\"+\n\t\t\t\" WHEN '\"+string(RELKIND_PARTITIONED_TABLE)+\"' THEN '%s'\"+\n\t\t\t\" WHEN '\"+string(RELKIND_PARTITIONED_INDEX)+\"' THEN '%s'\"+\n\t\t\t\" END as \\\"%s\\\",\\n\"+\n\t\t\t\" pg_catalog.pg_get_userbyid(c.relowner) as \\\"%s\\\"\",\n\t\tGettextNoop(\"Schema\"),\n\t\tGettextNoop(\"Name\"),\n\t\tGettextNoop(\"table\"),\n\t\tGettextNoop(\"view\"),\n\t\tGettextNoop(\"materialized view\"),\n\t\tGettextNoop(\"index\"),\n\t\tGettextNoop(\"sequence\"),\n\t\tGettextNoop(\"special\"),\n\t\tGettextNoop(\"foreign table\"),\n\t\tGettextNoop(\"partitioned table\"),\n\t\tGettextNoop(\"partitioned index\"),\n\t\tGettextNoop(\"Type\"),\n\t\tGettextNoop(\"Owner\"))\n\n\tif showIndexes {\n\t\tfmt.Fprintf(w,\n\t\t\t\",\\n c2.relname as \\\"%s\\\"\",\n\t\t\tGettextNoop(\"Table\"))\n\t}\n\n\tif verbose {\n\t\t/*\n\t\t * As of PostgreSQL 9.0, use pg_table_size() to show a more accurate\n\t\t * size of a table, including FSM, VM and TOAST tables.\n\t\t */\n\t\tif d.version >= 90000 {\n\t\t\tfmt.Fprintf(w,\n\t\t\t\t\",\\n pg_catalog.pg_size_pretty(pg_catalog.pg_table_size(c.oid)) as \\\"%s\\\"\",\n\t\t\t\tGettextNoop(\"Size\"))\n\t\t} else if d.version >= 80100 {\n\t\t\tfmt.Fprintf(w,\n\t\t\t\t\",\\n pg_catalog.pg_size_pretty(pg_catalog.pg_relation_size(c.oid)) as \\\"%s\\\"\",\n\t\t\t\tGettextNoop(\"Size\"))\n\t\t}\n\n\t\tfmt.Fprintf(w,\n\t\t\t\",\\n pg_catalog.obj_description(c.oid, 'pg_class') as \\\"%s\\\"\",\n\t\t\tGettextNoop(\"Description\"))\n\t}\n\n\tfmt.Fprint(w,\n\t\t\"\\nFROM pg_catalog.pg_class c\"+\n\t\t\t\"\\n LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace\")\n\tif showIndexes {\n\t\tfmt.Fprint(w,\n\t\t\t\"\\n LEFT JOIN pg_catalog.pg_index i ON i.indexrelid = c.oid\"+\n\t\t\t\t\"\\n LEFT JOIN pg_catalog.pg_class c2 ON i.indrelid = c2.oid\")\n\t}\n\n\tfmt.Fprint(w, \"\\nWHERE c.relkind IN (\")\n\tif showTables {\n\t\tfmt.Fprint(w, \"'\"+string(RELKIND_RELATION)+\"',\"+\n\t\t\t\"'\"+string(RELKIND_PARTITIONED_TABLE)+\"',\")\n\t}\n\tif showViews {\n\t\tfmt.Fprint(w, \"'\"+string(RELKIND_VIEW)+\"',\")\n\t}\n\tif showMatViews {\n\t\tfmt.Fprint(w, \"'\"+string(RELKIND_MATVIEW)+\"',\")\n\t}\n\tif showIndexes {\n\t\tfmt.Fprint(w, \"'\"+string(RELKIND_INDEX)+\"',\"+\n\t\t\t\"'\"+string(RELKIND_PARTITIONED_INDEX)+\"',\")\n\t}\n\tif showSeq {\n\t\tfmt.Fprint(w, \"'\"+string(RELKIND_SEQUENCE)+\"',\")\n\t}\n\tif showSystem || pattern != NULL {\n\t\tfmt.Fprint(w, \"'s',\") /* was RELKIND_SPECIAL */\n\t}\n\tif showForeign {\n\t\tfmt.Fprint(w, \"'\"+string(RELKIND_FOREIGN_TABLE)+\"',\")\n\t}\n\n\tfmt.Fprint(w, \"''\") /* dummy */\n\tfmt.Fprint(w, \")\\n\")\n\n\tif !showSystem && pattern != NULL {\n\t\tfmt.Fprint(w, \" AND n.nspname <> 'pg_catalog'\\n\"+\n\t\t\t\" AND n.nspname <> 'information_schema'\\n\")\n\t}\n\n\t/*\n\t * TOAST objects are suppressed unconditionally. Since we don't provide\n\t * any way to select RELKIND_TOASTVALUE above, we would never show toast\n\t * tables in any case; it seems a bit confusing to allow their indexes to\n\t * be shown. Use plain \\d if you really need to look at a TOAST\n\t * table/index.\n\t */\n\tfmt.Fprint(w, \" AND n.nspname !~ '^pg_toast'\\n\")\n\n\tprocessSQLNamePattern(w, pattern, true, false,\n\t\t\"n.nspname\", \"c.relname\", NULL,\n\t\t\"pg_catalog.pg_table_is_visible(c.oid)\")\n\n\tfmt.Fprint(w, \"ORDER BY 1,2;\")\n\n\t// res = PSQLexec(buf.data);\n\t// termPQExpBuffer(w);\n\t// if (!res)\n\t// return false;\n\n\t// /*\n\t// * Most functions in this file are content to print an empty table when\n\t// * there are no matching objects. We intentionally deviate from that\n\t// * here, but only in !quiet mode, for historical reasons.\n\t// */\n\t// if (PQntuples(res) == 0 && !pset.quiet) {\n\t// \tif (pattern != NULL)\n\t// \t\treturn fmt.Errorf(\"Did not find any relation named \\\"%s\\\".\\n\",\n\t// \t\t\t\t pattern);\n\t// \telse\n\t// \t\treturn fmt.Errorf(\"Did not find any relations.\\n\");\n\t// }\n\t// else\n\t// {\n\t// \tmyopt.nullPrint = NULL;\n\t// \tmyopt.title = _(\"List of relations\");\n\t// \tmyopt.translate_header = true;\n\t// \tmyopt.translate_columns = translate_columns;\n\t// \tmyopt.n_translate_columns = lengthof(translate_columns);\n\n\t// \tprintQuery(res, &myopt, pset.queryFout, false, pset.logfile);\n\t// }\n\n\t// PQclear(res);\n\t// return true;\n\treturn nil\n}", "title": "" }, { "docid": "fd50b853d66ae15f2d88b85914f828c3", "score": "0.6082674", "text": "func (stx *CoreSyntax) Table(rows ...[]string) string {\n\tvar r []string\n\tfor _, row := range rows {\n\t\tr = append(r, strings.Join(row, \" | \"))\n\t}\n\treturn strings.Join(r, \"\\n\")\n}", "title": "" }, { "docid": "8968dcb77b66fc82fb7e73fa698b6215", "score": "0.6068999", "text": "func (prettyPrinter *PrettyPrinter) printResultTable() {\n\tfor _, method := range prettyPrinter.methods {\n\t\tprettyPrinter.log(\" %-10s\", method)\n\t\tfor _, origin := range prettyPrinter.origins {\n\t\t\tprettyPrinter.log(\" %-4s\", prettyPrinter.results[method][origin])\n\t\t}\n\t\tprettyPrinter.log(\"\\n\")\n\t}\n}", "title": "" }, { "docid": "79df2134818b42503d9111d9cf2d71b7", "score": "0.6064713", "text": "func (ct CreateTable) PrintCreateTable(config Config) string {\n\tvar col []string\n\tvar colComment []string\n\tvar keys []string\n\tfor i, cn := range ct.ColNames {\n\t\ts, c := ct.ColDefs[cn].PrintColumnDef(config)\n\t\ts = \"\\n \" + s\n\t\tif i < len(ct.ColNames)-1 {\n\t\t\ts += \",\"\n\t\t} else {\n\t\t\ts += \" \"\n\t\t}\n\t\tcol = append(col, s)\n\t\tcolComment = append(colComment, c)\n\t}\n\tn := maxStringLength(col)\n\tvar cols string\n\tfor i, c := range col {\n\t\tcols += c\n\t\tif config.Comments && len(colComment[i]) > 0 {\n\t\t\tcols += strings.Repeat(\" \", n-len(c)) + \" -- \" + colComment[i]\n\t\t}\n\t}\n\tfor _, p := range ct.Pks {\n\t\tkeys = append(keys, p.PrintIndexKey(config))\n\t}\n\tvar tableComment string\n\tif config.Comments && len(ct.Comment) > 0 {\n\t\ttableComment = \"--\\n-- \" + ct.Comment + \"\\n--\\n\"\n\t}\n\tvar interleave string\n\tif ct.Parent != \"\" {\n\t\tinterleave = \",\\nINTERLEAVE IN PARENT \" + config.quote(ct.Parent)\n\t}\n\treturn fmt.Sprintf(\"%sCREATE TABLE %s (%s\\n) PRIMARY KEY (%s)%s\", tableComment, config.quote(ct.Name), cols, strings.Join(keys, \", \"), interleave)\n}", "title": "" }, { "docid": "cf2bea30db0abe366f1d50102fcd7a52", "score": "0.605759", "text": "func tableEnd(){\n\tfmt.Println(\"+-----+---------------+---------------+----------+------------------+------------------+------------------+\")\n}", "title": "" }, { "docid": "2622d5f14797b43f3a1cebf7179f8175", "score": "0.60568553", "text": "func printFingerTable() {\n fmt.Println(\" -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ \")\n fmt.Printf(\" Finger table (unordered) for this node: %d\\n\", identifier)\n fmt.Println(\" -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ \")\n fmt.Printf(\"| ID | VAL |\\n\")\n\n // Runs up to size m.\n for id := range ftab {\n fmt.Printf(\"| %3d | %9s |\\n\", id, ftab[id])\n }\n fmt.Println(\" -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ \")\n}", "title": "" }, { "docid": "7c1ad1cdc84c2806808d91d145ea860e", "score": "0.60129964", "text": "func (p *planner) showCreateTable(\n\tctx context.Context,\n\ttn *tree.Name,\n\tdbPrefix string,\n\tdesc *sqlbase.TableDescriptor,\n\tlCtx *internalLookupCtx,\n) (string, error) {\n\ta := &sqlbase.DatumAlloc{}\n\n\tf := tree.NewFmtCtxWithBuf(tree.FmtSimple)\n\tf.WriteString(\"CREATE TABLE \")\n\tf.FormatNode(tn)\n\tf.WriteString(\" (\")\n\tprimaryKeyIsOnVisibleColumn := false\n\tfor i, col := range desc.VisibleColumns() {\n\t\tif i != 0 {\n\t\t\tf.WriteString(\",\")\n\t\t}\n\t\tf.WriteString(\"\\n\\t\")\n\t\tf.WriteString(col.SQLString())\n\t\tif desc.IsPhysicalTable() && desc.PrimaryIndex.ColumnIDs[0] == col.ID {\n\t\t\t// Only set primaryKeyIsOnVisibleColumn to true if the primary key\n\t\t\t// is on a visible column (not rowid).\n\t\t\tprimaryKeyIsOnVisibleColumn = true\n\t\t}\n\t}\n\tif primaryKeyIsOnVisibleColumn {\n\t\tf.WriteString(\",\\n\\tCONSTRAINT \")\n\t\tformatQuoteNames(f.Buffer, desc.PrimaryIndex.Name)\n\t\tf.WriteString(\" \")\n\t\tf.WriteString(desc.PrimaryKeyString())\n\t}\n\tallIdx := append(desc.Indexes, desc.PrimaryIndex)\n\tfor i := range allIdx {\n\t\tidx := &allIdx[i]\n\t\tif fk := &idx.ForeignKey; fk.IsSet() {\n\t\t\tf.WriteString(\",\\n\\tCONSTRAINT \")\n\t\t\tf.FormatNameP(&fk.Name)\n\t\t\tf.WriteString(\" \")\n\t\t\tif err := p.printForeignKeyConstraint(ctx, f.Buffer, dbPrefix, idx, lCtx); err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t}\n\t\tif idx.ID != desc.PrimaryIndex.ID {\n\t\t\t// Showing the primary index is handled above.\n\t\t\tf.WriteString(\",\\n\\t\")\n\t\t\tf.WriteString(idx.SQLString(\"\"))\n\t\t\t// Showing the INTERLEAVE and PARTITION BY for the primary index are\n\t\t\t// handled last.\n\t\t\tif err := p.showCreateInterleave(ctx, idx, f.Buffer, dbPrefix, lCtx); err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t\tif err := ShowCreatePartitioning(\n\t\t\t\ta, desc, idx, &idx.Partitioning, f.Buffer, 1 /* indent */, 0, /* colOffset */\n\t\t\t); err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t}\n\t}\n\n\tfor _, fam := range desc.Families {\n\t\tactiveColumnNames := make([]string, 0, len(fam.ColumnNames))\n\t\tfor i, colID := range fam.ColumnIDs {\n\t\t\tif _, err := desc.FindActiveColumnByID(colID); err == nil {\n\t\t\t\tactiveColumnNames = append(activeColumnNames, fam.ColumnNames[i])\n\t\t\t}\n\t\t}\n\t\tf.WriteString(\",\\n\\tFAMILY \")\n\t\tformatQuoteNames(f.Buffer, fam.Name)\n\t\tf.WriteString(\" (\")\n\t\tformatQuoteNames(f.Buffer, activeColumnNames...)\n\t\tf.WriteString(\")\")\n\t}\n\n\tfor _, e := range desc.Checks {\n\t\tf.WriteString(\",\\n\\t\")\n\t\tif len(e.Name) > 0 {\n\t\t\tf.WriteString(\"CONSTRAINT \")\n\t\t\tformatQuoteNames(f.Buffer, e.Name)\n\t\t\tf.WriteString(\" \")\n\t\t}\n\t\tf.WriteString(\"CHECK (\")\n\t\tf.WriteString(e.Expr)\n\t\tf.WriteString(\")\")\n\t}\n\n\tf.WriteString(\"\\n)\")\n\n\tif err := p.showCreateInterleave(ctx, &desc.PrimaryIndex, f.Buffer, dbPrefix, lCtx); err != nil {\n\t\treturn \"\", err\n\t}\n\tif err := ShowCreatePartitioning(\n\t\ta, desc, &desc.PrimaryIndex, &desc.PrimaryIndex.Partitioning, f.Buffer, 0 /* indent */, 0, /* colOffset */\n\t); err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn f.CloseAndGetString(), nil\n}", "title": "" }, { "docid": "a959c75234dcff0ff695b25fafb322e5", "score": "0.5974101", "text": "func (ft *FreqTable) Print() {\n\tfor prefix, freqs := range ft.table {\n\t\tfmt.Print(prefix, \" | \")\n\t\tfor suffix, count := range freqs {\n\t\t\tfmt.Print(suffix, \" \", count, \", \")\n\t\t}\n\t\tfmt.Println(\"\")\n\t}\n}", "title": "" }, { "docid": "49c3c2c04296d42ca0badb3e68c6d5b1", "score": "0.59661376", "text": "func (s *Schema) Verbose() {\n\tfmt.Printf(\"Name : %v\\n\", s.name)\n\tfmt.Printf(\"PrimaryKeys : %v\\n\", s.primaryKeys)\n\tfmt.Printf(\"Unique : %v\\n\", s.uniques)\n\tfmt.Printf(\"Indexes : %v\\n\", s.indexes)\n\tfmt.Printf(\"References : [\\n\")\n\tfor _, v := range s.references {\n\t\tfmt.Println(\" {\")\n\t\tv.Verbose()\n\t\tfmt.Println(\" }\")\n\t}\n\tfmt.Println(\"]\")\n\tfmt.Println(\"----------------------------------------\")\n\tfor _, v := range s.columns {\n\t\tv.Verbose()\n\t\tfmt.Println(\"........................................\")\n\t}\n}", "title": "" }, { "docid": "fe80e4d863b22cd4b00686347157fba6", "score": "0.5928902", "text": "func (t *Table) Print() {\n\tvalue := color.New(color.Bold)\n\tmaxLen := t.maxKeyLen()\n\tf, ok := t.console.RootFrame().OffsetLeftWithMinWidth( /* maxLen + len(\": \") */ maxLen+2, 40)\n\t// If the terminal is too narrow, we should use a compacted format for printing, like:\n\t// Key:\n\t// <Value>\n\tif !ok {\n\t\t// No padding keys if we use the two-line style for printing.\n\t\tmaxLen = 0\n\t}\n\tfor _, item := range t.items {\n\t\tt.console.Printf(\"%*s: \", maxLen, item[0])\n\t\tvs := NewPrettyString(value.Sprint(item[1]))\n\t\tif !ok {\n\t\t\t// If the terminal is too narrow to hold the line,\n\t\t\t// print the information to next line directly.\n\t\t\tt.console.Println()\n\t\t}\n\t\tf.Print(vs)\n\t\tt.console.Println()\n\t}\n}", "title": "" }, { "docid": "458a32fbbee6a0c952225a86ecb4d1c0", "score": "0.5915501", "text": "func BuildPrintableTable(colNames []string, rows [][]interface{}) *tm.Table {\n\ttable := tm.NewTable(0, 10, 5, ' ', 0)\n\n\tfmt.Fprintf(table, buildRowString(colNames))\n\n\tvar pattern bytes.Buffer\n\tfor i := 0; i < len(colNames); i++ {\n\t\tif i < len(colNames)-1 {\n\t\t\tpattern.WriteString(\"%s\\t\")\n\t\t} else {\n\t\t\tpattern.WriteString(\"%s\\n\")\n\t\t}\n\t}\n\n\tfor _, row := range rows {\n\t\tfmt.Fprintf(table, pattern.String(), row...)\n\t}\n\n\treturn table\n}", "title": "" }, { "docid": "1ef6ec0e147bed9958f7684baef0e435", "score": "0.5904924", "text": "func (db *CustomerDB) PrintFields() {\n\tfor _, f := range db.table.Fields() {\n\t\tfmt.Printf(\"%s length=%d type=%c\\n\", f.Name(), f.Length(), f.FieldType())\n\t}\n}", "title": "" }, { "docid": "109b14bdeb34293b4f5a8e0e1d7da084", "score": "0.5902579", "text": "func (d *PgDesc) TableDetails(w io.Writer, pattern string, verbose bool, showSystem bool) error {\n\n\t// PQExpBufferData buf;\n\t// PGresult *res;\n\t// int\t\t\ti;\n\n\t// initPQExpBuffer(w);\n\n\tfmt.Fprintf(w,\n\t\t\"SELECT c.oid,\\n\"+\n\t\t\t\" n.nspname,\\n\"+\n\t\t\t\" c.relname\\n\"+\n\t\t\t\"FROM pg_catalog.pg_class c\\n\"+\n\t\t\t\" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace\\n\")\n\n\tif !showSystem && pattern != NULL {\n\t\tfmt.Fprint(w, \"WHERE n.nspname <> 'pg_catalog'\\n\"+\n\t\t\t\" AND n.nspname <> 'information_schema'\\n\")\n\t}\n\n\tprocessSQLNamePattern(w, pattern, !showSystem && pattern != NULL, false,\n\t\t\"n.nspname\", \"c.relname\", NULL,\n\t\t\"pg_catalog.pg_table_is_visible(c.oid)\")\n\n\tfmt.Fprint(w, \"ORDER BY 2, 3;\")\n\n\t// res = PSQLexec(buf.data);\n\t// termPQExpBuffer(w);\n\t// if (!res)\n\t// return false;\n\n\t// if (PQntuples(res) == 0) {\n\t// \tif (!pset.quiet) {\n\t// \t\tif (pattern != NULL)\n\t// \t\t\treturn fmt.Errorf(\"Did not find any relation named \\\"%s\\\".\\n\",\n\t// \t\t\t\t\t pattern);\n\t// \t\telse\n\t// \t\t\treturn fmt.Errorf(\"Did not find any relations.\\n\");\n\t// \t}\n\t// \tPQclear(res);\n\t// return false;\n\t// }\n\t// for i := 0; i < PQntuples(res); i++ {\n\t// \tconst char *oid;\n\t// \tconst char *nspname;\n\t// \tconst char *relname;\n\n\t// \toid = PQgetvalue(res, i, 0);\n\t// \tnspname = PQgetvalue(res, i, 1);\n\t// \trelname = PQgetvalue(res, i, 2);\n\n\t// \tif (!describeOneTableDetails(nspname, relname, oid, verbose)) {\n\t// \t\tPQclear(res);\n\t// return false;\n\t// \t}\n\t// \tif (cancel_pressed) {\n\t// \t\tPQclear(res);\n\t// return false;\n\t// \t}\n\t// }\n\n\t// PQclear(res);\n\t// return true;\n\treturn nil\n}", "title": "" }, { "docid": "668a1daa6ccd6fd1282c47b1406a2584", "score": "0.586222", "text": "func PrintTable(printOut []manufacturer, users []counterSlice) {\n\tfmt.Println(\"-----------------------------Pradiniai Duomenys------------------------------\")\n\tfor _, element := range printOut {\n\t\tfmt.Println(element.name)\n\t\tfmt.Println(\"-----------------------------------------------------------------------------\")\n\t\tfmt.Printf(\"%20v %45v %10v\\n\", \"Modelio Pavadinimas\", \"Kiekis\", \"Kaina\")\n\t\tfor i, modelis := range element.models {\n\t\t\tfmt.Printf(\"%2s %17s %45d %10.2f\\n\", strconv.Itoa(i+1)+\")\", modelis.name, modelis.quantity, modelis.price)\n\t\t}\n\t\tfmt.Println(\"-----------------------------------------------------------------------------\")\n\t}\n\tfmt.Println(\"------------------------------------Users------------------------------------\")\n\tfor i, element := range users {\n\t\tfmt.Printf(\"%s %d\\n\", \"User Nr.\", i)\n\t\tfmt.Println(\"------------\")\n\t\tfmt.Println(\"Price Count\")\n\t\tfor _, user := range element {\n\t\t\tfmt.Printf(\"%5.2f %5d\\n\", user.price, user.count)\n\t\t}\n\t\tfmt.Println(\"------------\")\n\t}\n}", "title": "" }, { "docid": "248ec821227ff507500faf5e92b87e3f", "score": "0.5832653", "text": "func outputPf(name string, prefixList *[]string) {\n fmt.Printf(\"table <%s> {\", name);\n for i := 0; i < len(*prefixList); i++ {\n fmt.Printf(\" %s\", (*prefixList)[i]);\n }\n fmt.Printf(\" }\\n\");\n fmt.Printf(\"block drop in quick from { <%s> } to any\\n\", name);\n fmt.Printf(\"block drop out quick from any to { <%s> }\\n\", name);\n}", "title": "" }, { "docid": "bfa80b8ceaddf8b22d053cc0a6eb44e9", "score": "0.5812677", "text": "func printCols(cols []interface{}) {\n\tlog.Printf(\"columns:\")\n\tfor i, field := range cols {\n\t\tlog.Printf(\"%2d %-250s\", i, field)\n\t}\n}", "title": "" }, { "docid": "71f2021afdc38a6f1e540182a3ecb7c8", "score": "0.57954675", "text": "func printBenchmarkTable(results benchmarkData, iterations int) {\n\tvar keys benchmarkSets\n\tfor key := range results {\n\t\tkeys = append(keys, key)\n\t}\n\tsort.Sort(keys)\n\n\tclearConsole()\n\n\tfmt.Println(\"Running benchmark...\")\n\n\ttable := tablewriter.NewWriter(os.Stdout)\n\ttableHeader := []string{\n\t\t\"Threads\",\n\t\t\"Buffer\",\n\t\t\"Average\",\n\t}\n\tfor i := 1; i <= iterations; i++ {\n\t\ttableHeader = append(tableHeader, fmt.Sprintf(\"Run %d\", i))\n\t}\n\ttable.SetHeader(tableHeader)\n\n\tfor _, set := range keys {\n\t\tresult := results[set]\n\t\tthisRow := []string{\n\t\t\tfmt.Sprintf(\"%d\", set.Threads),\n\t\t\tfmt.Sprintf(\"%d\", set.Buffers),\n\t\t\tfmt.Sprintf(\"%v\", result.Average),\n\t\t}\n\t\tfor _, t := range result.Results {\n\t\t\tthisRow = append(thisRow, fmt.Sprintf(\"%v\", t))\n\t\t}\n\t\ttable.Append(thisRow)\n\t}\n\ttable.Render()\n}", "title": "" }, { "docid": "2a2cb8b90eaedb4b62be28ccb67dd002", "score": "0.5795001", "text": "func (d Diff) Print() string {\n\treturn FormatOperation(fmt.Sprintf(\"Table: [%s] Field: [%s] Property: [%s] Value: [%#v]\", d.Table, d.Field, d.Property, d.Value), d.Op)\n}", "title": "" }, { "docid": "5c33e871f5237ee13f6fc4bfafcaf799", "score": "0.5793167", "text": "func printFileTable() {\n fmt.Println(\" -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ \")\n fmt.Printf(\" File table (unordered) for this node: %d\\n\", myIdentifier)\n fmt.Println(\" -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ \")\n fmt.Printf(\"| ID | VAL |\\n\")\n fileLocker.RLock()\n defer fileLocker.RUnlock()\n\n // Runs up to size m.\n for id := range fileLocker.fileTable {\n fmt.Printf(\"| %3d | %10s |\\n\", id, fileLocker.fileTable[id])\n }\n fmt.Println(\" -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ \")\n}", "title": "" }, { "docid": "c6fd41fc85768716d5cf2c44df9e4d9b", "score": "0.57613146", "text": "func (p *Printer) PrintTable(header TableHeader, data [][]string) error {\n\tvar table [][]string\n\n\tswitch header {\n\tcase ArtifactSearch:\n\t\ttable = [][]string{{\"INDEX\", \"ARTIFACT\", \"TYPE\", \"REGISTRY\", \"REPOSITORY\"}}\n\tcase IndexList:\n\t\ttable = [][]string{{\"NAME\", \"URL\", \"ADDED\", \"UPDATED\"}}\n\tcase ArtifactInfo:\n\t\ttable = [][]string{{\"REF\", \"TAGS\"}}\n\tdefault:\n\t\treturn fmt.Errorf(\"unsupported output table\")\n\t}\n\n\ttable = append(table, data...)\n\n\treturn p.TablePrinter.WithData(table).Render()\n}", "title": "" }, { "docid": "f6534d595f1c4abbd86827a6bd4c6d07", "score": "0.5748528", "text": "func PrintHallTable() {\n\tfor {\n\t\tfor _, tableElement := range HallOrderTable {\n\t\t\tfmt.Println(\"Hall-Table: \" + string(tableElement.Command) + \" \" + tableElement.Direction + \" \" + strconv.Itoa(tableElement.Floor))\n\t\t}\n\t\ttime.Sleep(1 * time.Second)\n\t}\n}", "title": "" }, { "docid": "c9a93fb1f7467b6ff2ffde07f7a7610d", "score": "0.5748262", "text": "func (e *Executor) showCreateTable(ctx context.Context, tableName string) (string, error) {\n\tparsed := sqlparser.BuildParsedQuery(sqlShowCreateTable, tableName)\n\trs, err := e.execQuery(ctx, parsed.Query)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif len(rs.Rows) == 0 {\n\t\treturn \"\", nil\n\t}\n\trow := rs.Rows[0]\n\treturn row[1].ToString(), nil\n}", "title": "" }, { "docid": "73f74a4abc009157912414dafba9a44f", "score": "0.5740306", "text": "func (s *Schema) PrintSchema() {\n\tfor _, v := range s.fieldMap {\n\t\tfmt.Printf(\"field[Name = %s, Type = %s, Tag = %s]\\n\", v.name, v.ftype, v.tag)\n\t}\n}", "title": "" }, { "docid": "62630aae3644fa0eb002c834bc59888c", "score": "0.5724924", "text": "func (suite *BenchmarkSuite) Print() {\n\tfmt.Println(\"Function\\tSQL Boiler\\tPG\")\n\tfmt.Println(\"----------------------------------------\")\n\tfmt.Print(\"Insert:\\t\\t\")\n\tprintBenchmarks(suite.Insert)\n\n\tfmt.Print(\"\\nReadOne:\\t\")\n\tprintBenchmarks(suite.ReadOne)\n\n\tfmt.Print(\"\\nFetch in:\\t\")\n\tprintBenchmarks(suite.FetchIn)\n\n\tfmt.Println()\n}", "title": "" }, { "docid": "bd93d49079e02513e60dd35e9a5dcb28", "score": "0.56655276", "text": "func PrintReleasesTable(releases []ReleaseSpec) {\n\tif len(releases) == 0 {\n\t\treturn\n\t}\n\ttbl := uitable.New()\n\ttbl.MaxColWidth = 60\n\ttbl.AddRow(\"NAME\", \"VERSION\")\n\n\tfor _, r := range releases {\n\t\ttbl.AddRow(r.ChartName, r.ChartVersion)\n\t}\n\tfmt.Println(tbl.String())\n}", "title": "" }, { "docid": "51ba0b01c9e838633b3b9d3a1afbb1c6", "score": "0.5643228", "text": "func (p *planner) ShowCreateTable(ctx context.Context, n *tree.ShowCreateTable) (planNode, error) {\n\t// We make the check whether the name points to a table or not in\n\t// SQL, so as to avoid a double lookup (a first one to check if the\n\t// descriptor is of the right type, another to populate the\n\t// create_statements vtable).\n\t// The condition \"database_name IS NULL\" ensures that virtual tables are included.\n\tconst showCreateTableQuery = `\n SELECT %[3]s AS \"Table\",\n IFNULL(create_statement,\n crdb_internal.force_error('` + pgerror.CodeUndefinedTableError + `',\n %[3]s || ' is not a table')::string\n ) AS \"CreateTable\"\n FROM (SELECT create_statement FROM %[4]s.crdb_internal.create_statements\n WHERE (database_name IS NULL OR database_name = %[1]s)\n AND schema_name = %[5]s\n AND descriptor_name = %[2]s\n AND descriptor_type = 'table'\n UNION ALL VALUES (NULL) ORDER BY 1 DESC) LIMIT 1\n `\n\treturn p.showTableDetails(ctx, \"SHOW CREATE TABLE\", n.Table, showCreateTableQuery)\n}", "title": "" }, { "docid": "b6c38e9cb968f856c07e787c8edb87a2", "score": "0.5628984", "text": "func TableOutputShort(instanceTypeInfoSlice []*instancetypes.Details) []string {\n\tif len(instanceTypeInfoSlice) == 0 {\n\t\treturn nil\n\t}\n\tw := new(tabwriter.Writer)\n\tbuf := new(bytes.Buffer)\n\tw.Init(buf, 8, 8, 8, ' ', 0)\n\tdefer w.Flush()\n\n\theaders := []interface{}{\n\t\t\"Instance Type\",\n\t\t\"VCPUs\",\n\t\t\"Mem (GiB)\",\n\t}\n\tseparators := []interface{}{}\n\n\theaderFormat := \"\"\n\tfor _, header := range headers {\n\t\theaderFormat = headerFormat + \"%s\\t\"\n\t\tseparators = append(separators, strings.Repeat(\"-\", len(header.(string))))\n\t}\n\tfmt.Fprintf(w, headerFormat, headers...)\n\tfmt.Fprintf(w, \"\\n\"+headerFormat, separators...)\n\n\tfor _, instanceTypeInfo := range instanceTypeInfoSlice {\n\t\tfmt.Fprintf(w, \"\\n%s\\t%d\\t%s\\t\",\n\t\t\t*instanceTypeInfo.InstanceType,\n\t\t\t*instanceTypeInfo.VCpuInfo.DefaultVCpus,\n\t\t\tformatFloat(float64(*instanceTypeInfo.MemoryInfo.SizeInMiB)/1024.0),\n\t\t)\n\t}\n\tw.Flush()\n\treturn []string{buf.String()}\n}", "title": "" }, { "docid": "e6432c04cc2e4d13c93e63b9ef07d81e", "score": "0.56287026", "text": "func dispTable(header []string, data [][]string) {\r\n\ttable := tablewriter.NewWriter(os.Stdout)\r\n\ttable.SetHeader(header)\r\n\ttable.SetBorder(false)\r\n\ttable.SetAlignment(tablewriter.ALIGN_RIGHT)\r\n\ttable.AppendBulk(data)\r\n\ttable.Render()\r\n}", "title": "" }, { "docid": "790505249e134c398bdf4498f64e7e5d", "score": "0.5619419", "text": "func (r *Customizable) Table(out *bytes.Buffer, header []byte, body []byte, columnData []int) {\n\tr.TableHandler(out, header, body, columnData)\n}", "title": "" }, { "docid": "1b87b832017e6fa121e8301303d9795d", "score": "0.56180286", "text": "func PrintModulesTable(modules []model.Module) {\n\ttable := simpletable.New()\n\n\ttable.Header = &simpletable.Header{\n\t\tCells: []*simpletable.Cell{\n\t\t\t{Align: simpletable.AlignCenter, Text: \"MODULE\"},\n\t\t\t{Align: simpletable.AlignCenter, Text: \"REPOSITORY\"},\n\t\t\t{Align: simpletable.AlignCenter, Text: \"URL\"},\n\t\t},\n\t}\n\tcount := 0\n\n\tfor _, m := range modules {\n\t\trow := []*simpletable.Cell{\n\t\t\t{Text: m.Name},\n\t\t\t{Text: m.Owner + \"/\" + m.Repo},\n\t\t\t{Text: m.Url},\n\t\t}\n\t\ttable.Body.Cells = append(table.Body.Cells, row)\n\t\tcount++\n\t}\n\tfmt.Println(\"\\r\")\n\n\t// Table Footer\n\ttable.Footer = &simpletable.Footer{\n\t\tCells: []*simpletable.Cell{\n\t\t\t{Align: simpletable.AlignRight, Text: \"Total:\"},\n\t\t\t{Align: simpletable.AlignLeft, Span: len(table.Header.Cells) - 1, Text: fmt.Sprintf(\"%d\", count)},\n\t\t},\n\t}\n\n\t// Print table\n\ttable.SetStyle(simpletable.StyleDefault)\n\tfmt.Println(table.String())\n}", "title": "" }, { "docid": "6ec6425294f01a69a91f9e824f58dd4f", "score": "0.56060725", "text": "func (t *table) fprint(w io.Writer, name string) (n, size int, err error) {\n\tupdate := func(nn, sz int, e error) {\n\t\tn += nn\n\t\tif err == nil {\n\t\t\terr = e\n\t\t}\n\t\tsize += sz\n\t}\n\t// Write arrays needed for the structure.\n\tupdate(printColElems(w, t.ExpandElem, name+\"ExpandElem\"))\n\tupdate(printColElems(w, t.ContractElem, name+\"ContractElem\"))\n\tupdate(t.trie.printArrays(w, name))\n\tupdate(printArray(t.ContractTries, w, name))\n\n\tnn, e := fmt.Fprintf(w, \"// Total size of %sTable is %d bytes\\n\", name, size)\n\tupdate(nn, 0, e)\n\treturn\n}", "title": "" }, { "docid": "c10a4cf3f8224baa41cfb6d957c13b44", "score": "0.5594466", "text": "func (rt *RoutingTable) Print() {\n\tfmt.Printf(\"Routing Table, bs = %d, Max latency = %d\\n\", rt.bucketsize, rt.maxLatency)\n\trt.tabLock.RLock()\n\n\tfor i, b := range rt.buckets {\n\t\tfmt.Printf(\"\\tbucket: %d\\n\", i)\n\n\t\tfor e := b.list.Front(); e != nil; e = e.Next() {\n\t\t\tp := e.Value.(*PeerInfo).Id\n\t\t\tfmt.Printf(\"\\t\\t- %s %s\\n\", p.Pretty(), rt.metrics.LatencyEWMA(p).String())\n\t\t}\n\t}\n\trt.tabLock.RUnlock()\n}", "title": "" }, { "docid": "e139d9c1166e22dda134ac52b3e49e0d", "score": "0.55858636", "text": "func PrintTabularResult(w *tabwriter.Writer, columnsHeaders []string, rows [][]interface{}) {\n\theader := \"\"\n\tcolumnLength := len(columnsHeaders)\n\n\tfor i, columnHeader := range columnsHeaders {\n\t\ttab := \" \\t \"\n\t\tif columnLength == i+1 {\n\t\t\ttab = \" \"\n\t\t}\n\t\theader += strings.ToUpper(columnHeader) + tab\n\t}\n\tfmt.Fprintln(w, header)\n\n\tfor _, row := range rows {\n\t\trowStr := \"\"\n\t\tfor range row {\n\t\t\trowStr += \"%v \\t \"\n\t\t}\n\n\t\t// append empty values in columns without data to maintain tabbed formatting\n\t\tfor i := len(row); i < columnLength; i++ {\n\t\t\trowStr += \" \\t \"\n\t\t}\n\n\t\trowStr = strings.TrimSuffix(rowStr, \"\\t \")\n\t\tfmt.Fprintln(w, fmt.Sprintf(rowStr, row...))\n\t}\n\n\tw.Flush()\n}", "title": "" }, { "docid": "4eb173df81afd53c484db212e08aa746", "score": "0.5584281", "text": "func (d *dummy) print() {\n\tfmt.Println(\"+ + +\")\n\tfor _, k := range d.keys {\n\t\tfmt.Println(k)\n\t}\n\tfmt.Println(\"+ + +\")\n}", "title": "" }, { "docid": "4e4f5a7e0c6839b1d7fa73ecf7d969db", "score": "0.55803657", "text": "func main() {\n\tfmt.Println(\"Hash Tables\")\n}", "title": "" }, { "docid": "b75cf96664d81ec018f239d90debea30", "score": "0.5576352", "text": "func (q *Stats) Dump() {\n\tfmt.Println(fmt.Sprintf(\"%-20s => %s\\n%s\", \"Modified\", q.modified, q.SortIt()))\n}", "title": "" }, { "docid": "a6f3a6aa511d51ebec88e6f7c62197e2", "score": "0.5559695", "text": "func (t Tables) String() string {\n\tjt, _ := json.MarshalIndent(t, \" \", \" \") //nolint:errchkjson\n\treturn string(jt)\n}", "title": "" }, { "docid": "b6af8dbb222b7797440d46905b1a8cc5", "score": "0.554931", "text": "func Table(slice interface{}) string {\n\tcoln, colw, rows, err := parse(slice)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\ttable := table(coln, colw, rows, m[\"box-drawing\"])\n\treturn table\n}", "title": "" }, { "docid": "06e2b569c0cde42cd9ad909909a159a0", "score": "0.55451703", "text": "func Fprint(output io.Writer, db *sql.DB) error {\n\ttableMap, err := getTableMap(db)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif hasDatetimeColumn(tableMap) {\n\t\tif err := fprintln(output, importAST(\"time\")); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tnames := make([]string, 0, len(tableMap))\n\tfor name := range tableMap {\n\t\tnames = append(names, name)\n\t}\n\tsort.Strings(names)\n\td := &dialect.MySQL{}\n\tfor _, name := range names {\n\t\ts, err := makeStructAST(d, name, tableMap[name])\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfmt.Fprintln(output, commentPrefix+marker)\n\t\tif err := fprintln(output, s); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1235de535b8ecebf1ae61dcaa7d6febf", "score": "0.5538302", "text": "func (d *delegator) showTableDetails(\n\tname *tree.UnresolvedObjectName, query string,\n) (tree.Statement, error) {\n\t// We avoid the cache so that we can observe the details without\n\t// taking a lease, like other SHOW commands.\n\tflags := cat.Flags{AvoidDescriptorCaches: true, NoTableStats: true}\n\ttn := name.ToTableName()\n\tdataSource, resName, err := d.catalog.ResolveDataSource(d.ctx, flags, &tn)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif err := d.catalog.CheckAnyPrivilege(d.ctx, dataSource); err != nil {\n\t\treturn nil, err\n\t}\n\n\tfullQuery := fmt.Sprintf(query,\n\t\tlex.EscapeSQLString(resName.Catalog()),\n\t\tlex.EscapeSQLString(resName.Table()),\n\t\tlex.EscapeSQLString(resName.String()),\n\t\tresName.CatalogName.String(), // note: CatalogName.String() != Catalog()\n\t\tlex.EscapeSQLString(resName.Schema()),\n\t\tdataSource.PostgresDescriptorID(),\n\t)\n\n\treturn parse(fullQuery)\n}", "title": "" }, { "docid": "e1d9b8aa553c1c4d1a3092f5062fe7d6", "score": "0.5533248", "text": "func (d *DataStore) Print() {\n\tstr := \"%v\\t%v\\t%v\\t%v\\t%v\\t\\n\"\n\ttw := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)\n\n\tfmt.Fprintf(tw, str, \"ID\", \"Sheet ID\", \"Sheet Name\", \"Schema\", \"Name\")\n\tfmt.Fprintf(tw, str, \"--\", \"--------\", \"----------\", \"------\", \"----\")\n\n\tvar m Map\n\tfor i := 0; i < len(d.Maps); i++ {\n\t\tm = d.Maps[i]\n\t\tfmt.Fprintf(tw, str, i+1, m.SheetID, m.SheetName, m.Schema, m.Name)\n\t}\n\n\ttw.Flush()\n}", "title": "" }, { "docid": "ec836e351bfe609959860e971741b3d6", "score": "0.5525454", "text": "func printHeader(model *SimModel, fusion *FusionModel, info *AnalyzerInfo) {\n\tfmt.Printf(\"%s v%s ran on %s\\n\", info.Name, version.Tag, time.Now())\n\tif host, err := os.Hostname(); err == nil {\n\t\tfmt.Println(\"on \", host)\n\t}\n\tfmt.Println(\"\\n-------------- parameters --------------\")\n\tfmt.Println(\"number of pulses :\", model.NumPulses)\n\tif model.NumPulses > 1 {\n\t\tfmt.Println(\"ISI :\", model.IsiValue, \"s\")\n\t}\n\tif fusion.EnergyModel {\n\t\tfmt.Println(\"model : energy model\")\n\t\tfmt.Println(\"syt energy :\", fusion.SytEnergy)\n\t\tfmt.Println(\"y energy :\", fusion.YEnergy)\n\t} else {\n\t\tfmt.Println(\"model : deterministic model\")\n\t\tfmt.Println(\"number of active sites :\", fusion.NumActiveSites)\n\t}\n\tfmt.Println(\"-------------- data --------------------\")\n\tfmt.Println(\"\")\n}", "title": "" }, { "docid": "6fc0826a4f79e590fc69ba9f2f69829b", "score": "0.5521926", "text": "func (t *TableFormat) PrintSart() error {\n\tif !t.isPrepare {\n\t\tt.Prepare(os.Stdout)\n\t}\n\tif t.isPrepareBefore {\n\t\tfmt.Fprintln(t.writer, t.beforeMsg)\n\t}\n\tfmt.Fprintln(t.writer, t.topBanner)\n\n\t// fmt.Fprintln(t.writer, t.getRowString(t.Fields))\n\t// fmt.Fprintln(t.writer, t.midBanner)\n\tt.PrintHeads()\n\t// fmt.Fprintln(t.writer, t.midBanner)\n\treturn nil\n}", "title": "" }, { "docid": "ed02f1d56e591b457dbe6d80a51f825a", "score": "0.5520524", "text": "func (c *TestCommand) Table() ([][]string, error) {\n\tres := c.Called()\n\treturn res.Get(0).([][]string), res.Error(1)\n}", "title": "" }, { "docid": "a6992b8d80104fabb036f582ba62f953", "score": "0.5515984", "text": "func (t *Table) String() string {\n\treturn fmt.Sprintf(\"size: %d button: %d\\n%s\", t.Size, t.Button+1, t.Seats)\n}", "title": "" }, { "docid": "e4c8475d6c9ceeb4553fb6dd2b648d98", "score": "0.55012476", "text": "func (t *Table) String() string {\n\tcolumnWidths := calcColumnWidths(append(t.data, t.headers))\n\tsortOrder := calcSortOrder(t.data, t.columnSortPriority)\n\tformattedTable := formatHorizontalSeparator([]int{len(t.title)})\n\tformattedTable += formatRow([]interface{}{t.title}, []int{len(t.title)})\n\tformattedTable += formatHorizontalSeparator(columnWidths)\n\tformattedTable += formatRow(t.headers, columnWidths)\n\tformattedTable += formatHorizontalSeparator(columnWidths)\n\tfor i := 0; i < len(sortOrder); i++ {\n\t\tformattedTable += formatRow(t.data[sortOrder[i]], columnWidths)\n\t}\n\tformattedTable += formatHorizontalSeparator(columnWidths)\n\treturn formattedTable\n}", "title": "" }, { "docid": "54e028ae8b2178fb194f8eab612494d6", "score": "0.54960054", "text": "func Table(rows [][]Cell, rowSpacing, colSpacing int) string {\n\toutput := bytes.NewBufferString(\"{{table}}\")\n\tfor i, r := range rows {\n\t\tif i != 0 && rowSpacing > 0 {\n\t\t\toutput.WriteString(row([]Cell{\n\t\t\t\t{Align: Left, Content: strings.Repeat(\"\\n\", rowSpacing-1)},\n\t\t\t}, 0))\n\t\t}\n\t\toutput.WriteString(row(r, colSpacing))\n\t}\n\toutput.WriteString(\"{{/table}}\")\n\treturn output.String()\n}", "title": "" }, { "docid": "91f7e6bc7c11ee582f69695368ef07bc", "score": "0.54911053", "text": "func printFingerTable() {\n fmt.Println(\" -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ \")\n fmt.Printf(\" Finger table (unordered) for this node: %d\\n\", myIdentifier)\n fmt.Println(\" -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ \")\n fmt.Printf(\"| ID | VAL |\\n\")\n fingerLocker.RLock()\n defer fingerLocker.RUnlock()\n\n // Runs up to size m.\n for id := range fingerLocker.fingerTable {\n fmt.Printf(\"| %3d | %9s |\\n\", id, fingerLocker.fingerTable[id])\n }\n fmt.Println(\" -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ \")\n}", "title": "" }, { "docid": "7dc255efb48a2aff02cb2a6052f5ad10", "score": "0.54840004", "text": "func main() {\n\tvar bb bytes.Buffer\n\tfmt.Fprintf(&bb, header)\n\tbyName := make(map[string]uint64)\n\tbyNameValue := make(map[pairNameValue]uint64)\n\tfor index, entry := range staticTableEntries {\n\t\tid := uint64(index) + 1\n\t\tbyName[entry.Name] = id\n\t\tbyNameValue[pairNameValue{entry.Name, entry.Value}] = id\n\t}\n\t// Sort maps for deterministic generation.\n\tbyNameItems := sortByName(byName)\n\tbyNameValueItems := sortByNameValue(byNameValue)\n\n\tfor _, item := range byNameItems {\n\t\tfmt.Fprintf(&bb, \"\\\"%s\\\":%d,\\n\", item.name, item.id)\n\t}\n\tfmt.Fprintf(&bb, \"},\\n\")\n\tfmt.Fprintf(&bb, \"byNameValue: map[pairNameValue]uint64{\\n\")\n\tfor _, item := range byNameValueItems {\n\t\tfmt.Fprintf(&bb, \"%s:%d,\\n\", pairNameValueToString(item.pairNameValue), item.id)\n\t}\n\tfmt.Fprintf(&bb, \"},\\n\")\n\tfmt.Fprintf(&bb, \"ents: []HeaderField{\\n\")\n\tfor _, value := range staticTableEntries {\n\t\tfmt.Fprintf(&bb, \"%s,\\n\", headerFieldToString(value))\n\t}\n\tfmt.Fprintf(&bb, \"},\\n\")\n\tfmt.Fprintf(&bb, \"}\\n\")\n\tgenFile(\"static_table.go\", &bb)\n}", "title": "" }, { "docid": "eb284f0bb4e7a47bffcd50e3433d950e", "score": "0.54779613", "text": "func (tbl Table) GeneratePreviewTable(mds Modules) string {\n\ttbl.printer.SetHeader(tablePreviewHeader)\n\ttbl.printer.SetAutoMergeCells(true)\n\ttbl.printer.SetRowLine(true)\n\n\tfor _, md := range mds {\n\t\ttbl.addModulePreviewRows(md)\n\t}\n\ttbl.printer.Render()\n\n\treturn tbl.writer.String()\n}", "title": "" }, { "docid": "c73b0616c4fc83ad4399a1aeb7134878", "score": "0.5466074", "text": "func dumpTable(ctx context.Context, dEnv *env.DoltEnv, tblOpts *tableOptions, filePath string) errhand.VerboseError {\n\trd, err := mvdata.NewSqlEngineReader(ctx, dEnv, tblOpts.tableName)\n\tif err != nil {\n\t\treturn errhand.BuildDError(\"Error creating reader for %s.\", tblOpts.SrcName()).AddCause(err).Build()\n\t}\n\n\twr, err := getTableWriter(ctx, dEnv, tblOpts, rd.GetSchema(), filePath)\n\tif err != nil {\n\t\treturn errhand.BuildDError(\"Error creating writer for %s.\", tblOpts.SrcName()).AddCause(err).Build()\n\t}\n\n\tif tblOpts.schemaOnly {\n\t\t// table schema can be exported to only sql file.\n\t\tif sqlExpWr, ok := wr.(*sqlexport.SqlExportWriter); ok {\n\t\t\terr = sqlExpWr.WriteDropCreateOnly(ctx)\n\t\t} else {\n\t\t\terr = errhand.BuildDError(\"Cannot export table schemas to non-sql output file\").Build()\n\t\t}\n\t} else {\n\t\tpipeline := mvdata.NewDataMoverPipeline(ctx, rd, wr)\n\t\terr = pipeline.Execute()\n\t}\n\n\tif err != nil {\n\t\treturn errhand.BuildDError(\"Error with dumping %s.\", tblOpts.SrcName()).AddCause(err).Build()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "dc048476a99219bf1a36a7dfc148dd62", "score": "0.54510397", "text": "func Table(tbData [][]string) {\n\ttable := tablewriter.NewWriter(os.Stdout)\n\ttable.SetHeader([]string{\"Id\", \"Name\", \"Pid\", \"Status\", \"User\", \"Cpu\", \"Mem\", \"Date\"})\n\thColor := tablewriter.Colors{tablewriter.Bold, tablewriter.FgHiCyanColor}\n\ttable.SetHeaderColor(hColor, hColor, hColor, hColor, hColor, hColor, hColor, hColor)\n\n\tfor _, row := range tbData {\n\t\tswitch row[3] {\n\t\tcase \"running\":\n\t\t\ttable.Rich(row, []tablewriter.Colors{{tablewriter.FgHiYellowColor}, {tablewriter.FgHiWhiteColor}, {tablewriter.FgHiWhiteColor}, {tablewriter.Bold, tablewriter.FgHiGreenColor}, {}, {}, {}, {tablewriter.FgWhiteColor}})\n\t\tcase \"stopped\":\n\t\t\ttable.Rich(row, []tablewriter.Colors{{tablewriter.FgHiYellowColor}, {tablewriter.FgHiWhiteColor}, {tablewriter.FgHiWhiteColor}, {tablewriter.Bold, tablewriter.FgYellowColor}, {}, {}, {}, {tablewriter.FgWhiteColor}})\n\t\tcase \"failed\":\n\t\t\ttable.Rich(row, []tablewriter.Colors{{tablewriter.FgHiYellowColor}, {tablewriter.FgHiWhiteColor}, {tablewriter.FgHiWhiteColor}, {tablewriter.Bold, tablewriter.FgRedColor}, {}, {}, {}, {tablewriter.FgWhiteColor}})\n\t\tcase \"init\":\n\t\t\ttable.Rich(row, []tablewriter.Colors{{tablewriter.FgHiYellowColor}, {tablewriter.FgHiWhiteColor}, {tablewriter.FgHiWhiteColor}, {tablewriter.Bold}, {}, {}, {}, {tablewriter.FgWhiteColor}})\n\t\t}\n\t}\n\n\ttable.SetColumnAlignment([]int{tablewriter.ALIGN_CENTER, tablewriter.ALIGN_CENTER, tablewriter.ALIGN_CENTER, tablewriter.ALIGN_CENTER, tablewriter.ALIGN_CENTER, tablewriter.ALIGN_CENTER, tablewriter.ALIGN_CENTER, tablewriter.ALIGN_CENTER})\n\ttable.Render()\n}", "title": "" }, { "docid": "777aadd67246ab56e1df03c9c7539149", "score": "0.54360545", "text": "func PrintBoxDataTable(box entity.Box) {\n\tdata := []table.Row{\n\t\t{\"name\", box.Name},\n\t\t{\"IP\", box.IP},\n\t\t{\"description\", box.Description},\n\t\t{\"hostname\", box.Hostname},\n\t\t{\"os\", box.OS},\n\t\t{\"difficulty\", box.Difficulty},\n\t\t{\"active\", box.Active},\n\t\t{\"completed\", box.Completed},\n\t\t{\"added\", humanize.Time(box.Created)},\n\t\t{\"last updated\", humanize.Time(box.LastUpdated)},\n\t}\n\n\tutils.Spacer()\n\tgui.SideBySideTable(data, \"Red\")\n\tutils.Spacer()\n}", "title": "" }, { "docid": "995dad39ce9fced7509c50c781c76cc7", "score": "0.54325277", "text": "func (dt *DataTable) Print() {\n\tdt.RLock()\n\tdefer dt.RUnlock()\n\tfor _, col := range dt.columns {\n\t\tfmt.Printf(\"%s\\t\", col.name)\n\t}\n\tfmt.Println()\n\tfor _, row := range dt.data {\n\t\tfor _, cell := range row {\n\t\t\tswitch cell.(type) {\n\t\t\tcase time.Time:\n\t\t\t\tfmt.Printf(\"%s\\t\", cell.(time.Time).Format(timeLayout))\n\t\t\tdefault:\n\t\t\t\tfmt.Printf(\"%v\\t\", cell)\n\t\t\t}\n\t\t}\n\t\tfmt.Println()\n\t}\n}", "title": "" }, { "docid": "4fae625cde8080fbbdeb9f5550e8dd4e", "score": "0.542445", "text": "func (o ReferenceInputMssqlOutput) Table() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *ReferenceInputMssql) pulumi.StringPtrOutput { return v.Table }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "23ae78ed9a19203d0c07d28a8f6b0039", "score": "0.5390736", "text": "func (tbl *table) printrow(row ...interface{}) {\n\tvar rowstr = make([]string, len(row))\n\tfor i, c := range row {\n\t\trowstr[i] = fmt.Sprintf(\"%v\", c)\n\t}\n\tfmt.Fprintln(tbl.writer, strings.Join(rowstr, \"\\t\"))\n}", "title": "" }, { "docid": "9759204a238e6feb1fa953a202c5ebe7", "score": "0.5387972", "text": "func VimTablePrinter(specs *response.TenantSpecs, style ui.PrinterStyle) {\n\tt := table.NewWriter()\n\tt.SetOutputMirror(os.Stdout)\n\tt.AppendHeader(table.Row{\"#\", \"Cloud Owner\", \"Cloud Name\", \"Vim ID\", \"Tenant Name\", \"Type\", \"VIM API\"})\n\tfor i, c := range specs.Tenants {\n\t\tt.AppendRows([]table.Row{{i, specs.CloudOwner, specs.VimName, specs.VimId, c.Name, c.VimType, c.VimURL}})\n\t\tt.AppendSeparator()\n\t}\n\n\ttableStyle, ok := style.GetTableStyle().(table.Style)\n\tif ok {\n\t\tt.SetStyle(tableStyle)\n\t}\n\tt.Render()\n}", "title": "" }, { "docid": "4dd02a6504a616519825c0fa1ba7786a", "score": "0.53764665", "text": "func ExampleTable_2() {\n\n\tt, err := NewTable(\"l p{25}\")\n\tif err != nil {\n\t\tlog.Fatalln(\" NewTable: Fatal error!\")\n\t}\n\tt.AddRow(\"bug\", \"start a bug report\")\n\tt.AddRow(\"build\", \"compile packages and dependencies\")\n\tt.AddRow(\"clean\", \"remove object files and cached files\")\n\tt.AddRow(\"doc\", \"show documentation for package or symbol\")\n\tt.AddRow(\"env\", \"print Go environment information\")\n\tt.AddRow(\"fix\", \"update packages to use new APIs\")\n\tt.AddRow(\"...\", \"...\")\n\tt.AddRow(\"testflag\", \"testing flags\")\n\tt.AddRow(\"testfunc\", \"testing functions\")\n\tfmt.Printf(\"Output:\\n%v\", t)\n\t// Output:\n\t// Output:\n\t// bug start a bug report\n\t// build compile packages and\n\t// dependencies\n\t// clean remove object files and\n\t// cached files\n\t// doc show documentation for\n\t// package or symbol\n\t// env print Go environment\n\t// information\n\t// fix update packages to use\n\t// new APIs\n\t// ... ...\n\t// testflag testing flags\n\t// testfunc testing functions\n\t//\n}", "title": "" }, { "docid": "7672c7dc217f48e45a8353974f5d67ef", "score": "0.53685623", "text": "func VmwareDatastoreTablePrinter(specs *models.VMwareClusters, style ui.PrinterStyle) {\n\n\tt := table.NewWriter()\n\tt.SetOutputMirror(os.Stdout)\n\tt.AppendHeader(table.Row{\"#\", \"Cluster\", \"Name\", \"Type\", \"Capacity\", \"Free\", \"Accessible\"})\n\n\tfor _, c := range specs.Items {\n\t\tfor j, s := range c.Datastore {\n\t\t\tt.AppendRows([]table.Row{{j,\n\t\t\t\tc.Name, s.Name, s.Summary.Type, s.Summary.Capacity, s.Summary.FreeSpace, s.Summary.Accessible},\n\t\t\t})\n\t\t\tt.AppendSeparator()\n\t\t}\n\t}\n\n\ttableStyle, ok := style.GetTableStyle().(table.Style)\n\tif ok {\n\t\tt.SetStyle(tableStyle)\n\t}\n\tt.Render()\n}", "title": "" }, { "docid": "ccc537e438c85cb45d36a22066c70502", "score": "0.5362116", "text": "func (d *Client) DumpTable(w io.Writer, table string) error {\n\tif err := d.WriteHeader(w); err != nil {\n\t\treturn fmt.Errorf(\"failed to write header: %w\", err)\n\t}\n\n\tif err := d.writeTable(w, table); err != nil {\n\t\treturn fmt.Errorf(\"failed to write tables: %w\", err)\n\t}\n\n\tif err := d.WriteFooter(w); err != nil {\n\t\treturn fmt.Errorf(\"failed to write footer: %w\", err)\n\t}\n\n\tif err := d.WriteDumpCompleted(w); err != nil {\n\t\treturn fmt.Errorf(\"failed to write completed datetime: %w\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "33df403b3db6a70132181ca908e0ac3a", "score": "0.5359666", "text": "func printHeader(info bool) {\n\theaderNames := []string{\n\t\t\"Averages\",\n\t\t\"Score\",\n\t\t\"Trust\",\n\t}\n\n\tvar underlines []string\n\tfor _, headerName := range headerNames {\n\t\tunderlines = append(underlines, generateUnderlineFromHeader(headerName))\n\t}\n\n\t// Tabulate headers properly depending on column lengths.\n\tformat := tabulateFormat(headerFormat, headerNames[0], firstColumnLength+1)\n\tformat = tabulateFormat(format, headerNames[1], secondColumnLength)\n\tformat = tabulateFormat(format, underlines[0], firstColumnLength+1)\n\tformat = tabulateFormat(format, underlines[1], secondColumnLength)\n\n\t// Render the header.\n\tprintf(info,\n\t\tformat,\n\t\tstyle.Important(headerNames[0]), style.Important(headerNames[1]), style.Important(headerNames[2]),\n\t\tunderlines[0], underlines[1], underlines[2],\n\t)\n}", "title": "" }, { "docid": "e3efdec04999bdb141f9b86c1b12668a", "score": "0.5357284", "text": "func newtable(minwidth, tabwidth, padding int) *table {\n\tw := tabwriter.NewWriter(os.Stdout, minwidth, tabwidth, padding, '\\t', 0)\n\treturn &table{writer: w}\n}", "title": "" }, { "docid": "f8a7f2cb2f46650fdd61e0b5653def6b", "score": "0.535642", "text": "func DefaultTablePrinter(header string, rows []string, out io.Writer) {\n\tw := tabwriter.NewWriter(out, 0, 0, 3, ' ', tabwriter.TabIndent)\n\n\tif !pFlagNoHeader {\n\t\tfmt.Fprintln(w, header)\n\t}\n\n\tfor _, line := range rows {\n\t\tfmt.Fprintln(w, line)\n\t}\n\tw.Flush()\n}", "title": "" }, { "docid": "d4bca440aff741940f6da6e72077c8d6", "score": "0.53527135", "text": "func (t *Table) PrintSummary() error {\n\ttotalWidth := int64(0)\n\tformat := \"\"\n\tfor i, w := range t.widths {\n\t\tmargin := 2\n\t\tif i == len(t.widths)-1 {\n\t\t\t// Don't add margin for the last column\n\t\t\tmargin = 0\n\t\t}\n\t\tformat += \"%\" + strconv.FormatInt(w, 10) + \"s\" + strings.Repeat(\" \", margin)\n\t\ttotalWidth += int64(math.Abs(float64(w))) + int64(margin)\n\t}\n\n\t// print divider\n\tif _, err := fmt.Fprintf(t.writer, strings.Repeat(\"-\", int(totalWidth))+\"\\n\"); err != nil {\n\t\treturn err\n\t}\n\n\t// print summary\n\tif _, err := fmt.Fprintf(t.writer, format+\"\\n\", t.summary...); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a17a9b39c719a5c1eef5bc5317bdaa33", "score": "0.5348975", "text": "func (s *ProcessingStats) Table(w io.Writer) {\n\ttitleVals := s.toVals()\n\tdata := make([][]string, len(titleVals))\n\tfor i, tv := range titleVals {\n\t\tdata[i] = []string{tv.name, strconv.Itoa(int(tv.val))}\n\t}\n\n\ttable := tablewriter.NewWriter(w)\n\n\ttable.AppendBulk(data)\n\ttable.SetHeader([]string{\"\", s.Name})\n\ttable.SetBorder(false)\n\ttable.Render()\n}", "title": "" }, { "docid": "92b6115df3c5e68fe3b091bbcd2fe607", "score": "0.5340286", "text": "func (t *Table) String() string {\n\tjt, _ := json.MarshalIndent(t, \" \", \" \") //nolint:errchkjson\n\treturn string(jt)\n}", "title": "" }, { "docid": "c665c5a857c87bcf8d5621aee7046ef6", "score": "0.5339875", "text": "func (d *PgDesc) Tablespaces(w io.Writer, pattern string, verbose bool) error {\n\n\t// PQExpBufferData buf;\n\t// PGresult *res;\n\t// printQueryOpt myopt = pset.popt;\n\n\tif d.version < 80000 {\n\t\t// char sverbuf[32];\n\n\t\treturn fmt.Errorf(\"The server (version %s) does not support tablespaces.\\n\",\n\t\t\td.sversion)\n\t\t// return true;\n\t}\n\n\t// initPQExpBuffer(w);\n\n\tif d.version >= 90200 {\n\t\tfmt.Fprintf(w,\n\t\t\t\"SELECT spcname AS \\\"%s\\\",\\n\"+\n\t\t\t\t\" pg_catalog.pg_get_userbyid(spcowner) AS \\\"%s\\\",\\n\"+\n\t\t\t\t\" pg_catalog.pg_tablespace_location(oid) AS \\\"%s\\\"\",\n\t\t\tGettextNoop(\"Name\"),\n\t\t\tGettextNoop(\"Owner\"),\n\t\t\tGettextNoop(\"Location\"))\n\t} else {\n\t\tfmt.Fprintf(w,\n\t\t\t\"SELECT spcname AS \\\"%s\\\",\\n\"+\n\t\t\t\t\" pg_catalog.pg_get_userbyid(spcowner) AS \\\"%s\\\",\\n\"+\n\t\t\t\t\" spclocation AS \\\"%s\\\"\",\n\t\t\tGettextNoop(\"Name\"),\n\t\t\tGettextNoop(\"Owner\"),\n\t\t\tGettextNoop(\"Location\"))\n\t}\n\n\tif verbose {\n\t\tfmt.Fprint(w, \",\\n \")\n\t\td.printACLColumn(w, \"spcacl\")\n\t}\n\n\tif verbose && d.version >= 90000 {\n\t\tfmt.Fprintf(w,\n\t\t\t\",\\n spcoptions AS \\\"%s\\\"\",\n\t\t\tGettextNoop(\"Options\"))\n\t}\n\n\tif verbose && d.version >= 90200 {\n\t\tfmt.Fprintf(w,\n\t\t\t\",\\n pg_catalog.pg_size_pretty(pg_catalog.pg_tablespace_size(oid)) AS \\\"%s\\\"\",\n\t\t\tGettextNoop(\"Size\"))\n\t}\n\n\tif verbose && d.version >= 80200 {\n\t\tfmt.Fprintf(w,\n\t\t\t\",\\n pg_catalog.shobj_description(oid, 'pg_tablespace') AS \\\"%s\\\"\",\n\t\t\tGettextNoop(\"Description\"))\n\t}\n\n\tfmt.Fprint(w,\n\t\t\"\\nFROM pg_catalog.pg_tablespace\\n\")\n\n\tprocessSQLNamePattern(w, pattern, false, false,\n\t\tNULL, \"spcname\", NULL,\n\t\tNULL)\n\n\tfmt.Fprint(w, \"ORDER BY 1;\")\n\n\t// res = PSQLexec(buf.data);\n\t// termPQExpBuffer(w);\n\t// if (!res)\n\t// return false;\n\n\t// myopt.nullPrint = NULL;\n\t// myopt.title = _(\"List of tablespaces\");\n\t// myopt.translate_header = true;\n\n\t// printQuery(res, &myopt, pset.queryFout, false, pset.logfile);\n\n\t// PQclear(res);\n\t// return true;\n\treturn nil\n}", "title": "" }, { "docid": "15b4dba46130d9b3f9b49c5a0e568dea", "score": "0.5329746", "text": "func (t *TabWriter) Print(args ...interface{}) {\n\tt.PrintStrings(args2strings(args)...)\n}", "title": "" }, { "docid": "0f237f54f5aeb13a9f2ff711b2be29a4", "score": "0.5324714", "text": "func VmwareInventoryTablePrinter(specs *models.VMwareClusters, style ui.PrinterStyle) {\n\tt := table.NewWriter()\n\tt.SetOutputMirror(os.Stdout)\n\n\tt.AppendHeader(table.Row{\"#\", \"Name\", \"Type\", \"Num hosts\", \"Memory\",\n\t\t\"CPU\", \"Deployed\", \"Num Mgmt\", \"Num Clusters\"})\n\n\tt.SetColumnConfigs([]table.ColumnConfig{\n\t\t{Number: 1, AutoMerge: true},\n\t\t{Number: 2, AutoMerge: true},\n\t\t{Number: 3, AutoMerge: true},\n\t\t{Number: 4, AutoMerge: true},\n\t\t{Number: 5, Align: text.AlignCenter, AlignFooter: text.AlignCenter, AlignHeader: text.AlignCenter},\n\t\t{Number: 6, Align: text.AlignCenter, AlignFooter: text.AlignCenter, AlignHeader: text.AlignCenter},\n\t\t{Number: 7, Align: text.AlignCenter, AlignFooter: text.AlignCenter, AlignHeader: text.AlignCenter},\n\t\t{Number: 8, Align: text.AlignCenter, AlignFooter: text.AlignCenter, AlignHeader: text.AlignCenter},\n\t\t{Number: 9, Align: text.AlignCenter, AlignFooter: text.AlignCenter, AlignHeader: text.AlignCenter},\n\t})\n\n\tfor i, c := range specs.Items {\n\t\tt.AppendRows([]table.Row{{i, c.Name, c.EntityType, c.NumOfHosts, c.Memory,\n\t\t\tc.Cpu, c.K8ClusterDeployed, c.NumK8SMgmtClusterDeployed, c.NumK8SWorkloadClusterDeployed},\n\t\t})\n\t\tt.AppendSeparator()\n\t}\n\n\ttableStyle, ok := style.GetTableStyle().(table.Style)\n\tif ok {\n\t\tt.SetStyle(tableStyle)\n\t}\n\tt.Render()\n}", "title": "" }, { "docid": "fd893da9a0e01b7d466adfa9b9f4e654", "score": "0.53161293", "text": "func printData(database *sql.DB) {\n\tmleads := extractLeads(database)\n\tfor _, v := range mleads {\n\t\tfmt.Printf(\"%v\\n\", v)\n\t}\n}", "title": "" }, { "docid": "8fa12573822f43b057c943cb90600b80", "score": "0.53104436", "text": "func AsTable(f *os.File, data []*Data) {\n\tw := tabwriter.NewWriter(\n\t\tf, tableMinWidth, tabWidth, padding, ' ', tabwriter.AlignRight)\n\tfmt.Fprintln(w, \"Frame\\tH2/Ht\\tPeriod\\tStructure\\tDP\\tn\\tL\\t\")\n\tfor _, f := range data {\n\t\tfmt.Fprintf(\n\t\t\tw, \"%d\\t%s\\t%d\\t%d\\t%f\\t%f\\t%f\\t\\n\",\n\t\t\tf.Frame, f.Type, f.Period, f.StructNo, f.XMin, f.Alpha, f.L)\n\t}\n\tw.Flush()\n}", "title": "" }, { "docid": "41192c2c9668d7b6d42e6a0255a112ec", "score": "0.53048545", "text": "func TableOutputWide(instanceTypeInfoSlice []*instancetypes.Details) []string {\n\tif len(instanceTypeInfoSlice) == 0 {\n\t\treturn nil\n\t}\n\tw := new(tabwriter.Writer)\n\tbuf := new(bytes.Buffer)\n\tw.Init(buf, 8, 8, 2, ' ', 0)\n\tdefer w.Flush()\n\n\tcolumnDataStruct := wideColumnsData{}\n\theaders := []interface{}{}\n\tstructType := reflect.TypeOf(columnDataStruct)\n\tfor i := 0; i < structType.NumField(); i++ {\n\t\tcolumnHeader := structType.Field(i).Tag.Get(columnTag)\n\t\theaders = append(headers, columnHeader)\n\t}\n\tseparators := make([]interface{}, 0)\n\n\theaderFormat := \"\"\n\tfor _, header := range headers {\n\t\theaderFormat = headerFormat + \"%s\\t\"\n\t\tseparators = append(separators, strings.Repeat(\"-\", len(header.(string))))\n\t}\n\tfmt.Fprintf(w, headerFormat, headers...)\n\tfmt.Fprintf(w, \"\\n\"+headerFormat, separators...)\n\n\tcolumnsData := getWideColumnsData(instanceTypeInfoSlice)\n\n\tfor _, data := range columnsData {\n\t\tfmt.Fprintf(w, \"\\n%s\\t%d\\t%s\\t%s\\t%t\\t%t\\t%s\\t%s\\t%d\\t%d\\t%s\\t%s\\t%s\\t%s\\t\",\n\t\t\tdata.instanceName,\n\t\t\tdata.vcpu,\n\t\t\tdata.memory,\n\t\t\tdata.hypervisor,\n\t\t\tdata.currentGen,\n\t\t\tdata.hibernationSupport,\n\t\t\tdata.cpuArch,\n\t\t\tdata.networkPerformance,\n\t\t\tdata.eni,\n\t\t\tdata.gpu,\n\t\t\tdata.gpuMemory,\n\t\t\tdata.gpuInfo,\n\t\t\tdata.odPrice,\n\t\t\tdata.spotPrice,\n\t\t)\n\t}\n\tw.Flush()\n\treturn []string{buf.String()}\n}", "title": "" }, { "docid": "fb617b458da87eb6d4f9621291277041", "score": "0.5295553", "text": "func (me Table) String() string {\n\treturn \"<table>\" + me.Rows.String() + \"</table>\"\n}", "title": "" }, { "docid": "56aeaf3b79e94af3ee0c21b9aa40255e", "score": "0.52903426", "text": "func (t Table) String() string {\n\tvar s string\n\tswitch t {\n\tcase DefaultTable:\n\t\ts = \"default\"\n\tcase HyperTable:\n\t\ts = \"hyper\"\n\tcase HyperCacheTable:\n\t\ts = \"hypercache\"\n\tcase HistoryTable:\n\t\ts = \"history\"\n\tcase FSMStateTable:\n\t\ts = \"fsm\"\n\t}\n\treturn s\n}", "title": "" }, { "docid": "71c690c12348b53e964b355b4da4ad7f", "score": "0.5286042", "text": "func PrintTrainTimetable(id int64, model_ptr *Simulation_Model) {\n\tif model_ptr != nil {\n\t\ttrain_ptr := GetTrain(id, model_ptr)\n\t\tif train_ptr != nil {\n\t\t\tfmt.Println(\"Timetable for train:\" + strconv.FormatInt(train_ptr.id, 10))\n\t\t\tfmt.Println(\"platform\\tarrival\\tdeparture\")\n\t\t\tfor it := 0; it < len(train_ptr.history); it++ {\n\t\t\t\tth := train_ptr.history[it]\n\t\t\t\tif th.object_type == Type_Platform {\n\n\t\t\t\t\tt_arr := getRelativeTime(th.arrival, model_ptr)\n\t\t\t\t\tt_dep := getRelativeTime(th.departure, model_ptr)\n\t\t\t\t\tfmt.Println(strconv.FormatInt(th.object_id, 10) + \"\\t\" + TimeToString(t_arr) + \"\\t\" + TimeToString(t_dep))\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t} else {\n\t\t\tfmt.Println(\"Train not found!\")\n\t\t}\n\t} else {\n\t\tfmt.Println(\"Null model!\")\n\t}\n}", "title": "" }, { "docid": "fb49e978e2ca9abb1bbe24f32abd22c5", "score": "0.5278899", "text": "func tab_print(format string, tabs int, arg interface{}) {\n for i := 0; i < tabs; i++ {\n fmt.Printf(\"\\t\")\n }\n\n if (arg == nil) {\n fmt.Printf(format)\n } else {\n fmt.Printf(format, arg)\n }\n}", "title": "" }, { "docid": "cba0eb6011655ef12d048a36d7d5212d", "score": "0.5278532", "text": "func renderTable(tableLines []TableLine) {\n\tvar data [][]string\n\tfor _, line := range tableLines {\n\t\tstringLine := []string{line.networkPolicyName, line.policyType, line.namespace, line.pods, line.policyNamespace,\n\t\t\tline.policyPods, line.policyIpBlock, line.policyPort}\n\t\tdata = append(data, stringLine)\n\t}\n\n\ttable := tablewriter.NewWriter(os.Stdout)\n\ttable.SetHeader([]string{\"Network Policy\", \"Type\", \"Namespace\", \"Pods\", \"Namespaces Selector\", \"Pods Selector\",\n\t\t\"IP Block\", \"Ports\"})\n\ttable.SetAutoMergeCells(false)\n\ttable.SetRowLine(true)\n\ttable.SetAlignment(tablewriter.ALIGN_CENTER)\n\ttable.AppendBulk(data)\n\ttable.Render()\n}", "title": "" }, { "docid": "9c7520c82b3c6d77bccf7f38abf4c9bf", "score": "0.5278183", "text": "func tableContent(trainee Trainee){\n\tid := strconv.Itoa(trainee.ID)\n\tage := strconv.Itoa(trainee.Age)\n\tdataPoint := \"| \" + fillString(id, 4)\n\tdataPoint += \"| \" + fillString(trainee.Surname, 14)\n\tdataPoint += \"| \" + fillString(trainee.Name, 14)\n\tdataPoint += \"| \" + fillString(age, 9)\n\tdataPoint += \"| \" + fillString(trainee.TA, 17)\n\tdataPoint += \"| \" + fillString(trainee.QPA, 17)\n\tdataPoint += \"| \" + fillString(trainee.Project, 17) + \"|\"\n\tfmt.Println(dataPoint)\n}", "title": "" }, { "docid": "d607ba2590f14ea6ecf12fea13dae1c2", "score": "0.5271158", "text": "func (v *VM) Debug() {\n\t// table := tablewriter.NewWriter(v.DebugFD)\n\t// table.SetHeader([]string{\"Instruction #\", \"Value\", \"0\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"Stack\"})\n\t// table.Append([]string{\n\t// \tfmt.Sprintf(\"%d\", v.Pointer),\n\t// \tfmt.Sprintf(\"%d\", v.memory[v.Pointer]),\n\t// \tfmt.Sprintf(\"%d\", v.Registers[0]),\n\t// \tfmt.Sprintf(\"%d\", v.Registers[1]),\n\t// \tfmt.Sprintf(\"%d\", v.Registers[2]),\n\t// \tfmt.Sprintf(\"%d\", v.Registers[3]),\n\t// \tfmt.Sprintf(\"%d\", v.Registers[4]),\n\t// \tfmt.Sprintf(\"%d\", v.Registers[5]),\n\t// \tfmt.Sprintf(\"%d\", v.Registers[6]),\n\t// \tfmt.Sprintf(\"%d\", v.Registers[7]),\n\t// \tspew.Sprint(v.Stack),\n\t// })\n\t// table.Render()\n}", "title": "" }, { "docid": "526355a9604b09d6a74deacebfb65e3f", "score": "0.52652836", "text": "func (d *dbBaseOracle) ShowTablesQuery() string {\n\treturn \"SELECT TABLE_NAME FROM USER_TABLES\"\n}", "title": "" }, { "docid": "022fc1de708c972f87152e5ac234c573", "score": "0.5264952", "text": "func printVmList() error {\n\tlst, err := client.GetCloudVmList()\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\t//Get field lengths\n\tfields := map[string]int{\n\t\t\"Name\": 0,\n\t\t\"Host\": 0,\n\t\t\"State\": 0,\n\t\t\"ImagePath\": 0,\n\t}\n\tfor _, vm := range lst {\n\t\tif fields[\"Name\"] < len(vm.Name) {\n\t\t\tfields[\"Name\"] = len(vm.Name)\n\t\t}\n\t\tif fields[\"Host\"] < len(vm.Host) {\n\t\t\tfields[\"Host\"] = len(vm.Host)\n\t\t}\n\t\tif fields[\"State\"] < len(vm.State) {\n\t\t\tfields[\"State\"] = len(vm.State)\n\t\t}\n\t\tif fields[\"ImatePath\"] < len(vm.ImagePath) {\n\t\t\tfields[\"ImagePath\"] = len(vm.ImagePath)\n\t\t}\n\t}\n\t//headers\n\tvar line string = \"\"\n\tvar tmp string = \"\"\n\tfmt.Println(\"\")\n\ttmp = \"Name\"\n\tmakeLength(&tmp, fields[\"Name\"])\n\tline += tmp + \" \"\n\ttmp = \"Host\"\n\tmakeLength(&tmp, fields[\"Host\"])\n\tline += tmp + \" \"\n\ttmp = \"State\"\n\tmakeLength(&tmp, fields[\"State\"])\n\tline += tmp + \" \"\n\ttmp = \"ImagePath\"\n\tmakeLength(&tmp, fields[\"ImagePath\"])\n\tline += tmp\n\tfmt.Println(line)\n\t//underline\n\tfor i := 0; i < len(line); i++ {\n\t\tfmt.Printf(\"-\")\n\n\t}\n\t//table\n\tfmt.Printf(\"\\n\")\n\tfor _, vm := range lst {\n\t\tline = \"\"\n\t\tmakeLength(&vm.Name, fields[\"Name\"])\n\t\tmakeLength(&vm.Host, fields[\"Host\"])\n\t\tmakeLength(&vm.State, fields[\"State\"])\n\t\tmakeLength(&vm.ImagePath, fields[\"ImagePath\"])\n\t\tline += vm.Name + \" \"\n\t\tline += vm.Host + \" \"\n\t\tline += vm.State + \" \"\n\t\tline += vm.ImagePath + \" \"\n\t\tfmt.Println(line)\n\t}\n\tfmt.Println(\"\")\n\treturn nil\n}", "title": "" }, { "docid": "dd59a5d39b2a2febc75dade983c824a0", "score": "0.5254797", "text": "func (attr attrStruct) print(w *tabwriter.Writer, verbose bool, indent int, highlighteds []string, after int) {\n\tdebug := false\n\n\tif debug {\n\t\tif value, err := attr.ParentID.Value(); err == nil && value != nil {\n\t\t\tfmt.Fprintf(w, \"%s:%d\\t\", \"ParentID\", value)\n\t\t} else {\n\t\t\tfmt.Fprintf(w, \"%s:%s\\t\", \"ParentID\", novalue)\n\t\t}\n\n\t\tif value, err := attr.Name.Value(); err == nil && value != nil {\n\t\t\tfmt.Fprintf(w, \"%s:%s\\t\", \"Name\", value)\n\t\t} else {\n\t\t\tfmt.Fprintf(w, \"%s:%s\\t\", \"Name\", novalue)\n\t\t}\n\n\t\tif value, err := attr.ValueText.Value(); err == nil && value != nil {\n\t\t\tfmt.Fprintf(w, \"%s:%s\\t\", \"ValueText\", value)\n\t\t} else {\n\t\t\tfmt.Fprintf(w, \"%s:%s\\t\", \"ValueText\", novalue)\n\t\t}\n\n\t\tif attr.ValueBlob != nil {\n\t\t\tfmt.Fprintf(w, \"%s:%d\\t\", \"ValueBlob-len\", len(attr.ValueBlob))\n\t\t} else {\n\t\t\tfmt.Fprintf(w, \"%s:%s\\t\", \"ValueBlob-len\", novalue)\n\t\t}\n\t} else {\n\t\t// Last modifier:\n\t\t//fmt.Fprintf(w, \"%s\\t\", prettyAttr(\"at\", attr.prettyAt()))\n\n\t\t// Name:\n\t\t//fmt.Fprintf(w, \"%s\\t\", prettyAttr(\"name\", attr.getName()))\n\n\t\t// Value:\n\t\t//fmt.Printf(strings.Repeat(\" \", indent))\n\n\t\tif attr.getMark() == 0 {\n\t\t\tfmt.Fprintf(out, \"%s: %s\\n\", color(attr.getIdentifier(), \"yellow+b\"), attr.title())\n\t\t} else {\n\t\t\tif isOutputColored() {\n\t\t\t\tfmt.Fprintf(out, \"%s: %s\\n\", color(attr.getIdentifier(), \"green\"), color(attr.title(), \"default\"))\n\t\t\t} else {\n\t\t\t\tfmt.Fprintf(out, \"[%s]: %s\\n\", attr.getIdentifier(), attr.title())\n\t\t\t}\n\n\t\t}\n\t\tif len(highlighteds) > 0 {\n\t\t\tfmt.Fprintln(out, attr.prettyMatches(highlighteds, after))\n\t\t}\n\t}\n}", "title": "" }, { "docid": "489aebd8de7d760915c738bf30f4423e", "score": "0.5254504", "text": "func ExampleTable_17() {\n\n\tt, err := NewTable(\"\\033[38;2;160;10;10m| c \\033[38;2;10;160;10m| c \\033[38;2;80;80;160m| c \\033[38;2;160;80;40m|\\033[0m\", \"cb\")\n\tif err != nil {\n\t\tlog.Fatalln(\" NewTable: Fatal error!\")\n\t}\n\tt.AddRow(\"\\033[38;2;206;10;0mPlayer\\033[0m\", \"\\033[38;2;10;206;0mYear\\033[0m\", \"\\033[38;2;100;0;206mTournament\\033[0m\")\n\tt.AddSingleRule()\n\tt.AddRow(\"\\033[38;5;206mRafa Nadal\\033[0m\", \"2010\", \"French Open\\nWimbledon\\nUS Open\")\n\tt.AddSingleRule()\n\tt.AddRow(\"Roger Federer\", \"2007\", \"Australian Open\\nWimbledon\\nUS Open\")\n\tt.AddSingleRule()\n\n\tfmt.Printf(\"Output:\\n%v\", t)\n\t// Output:\n}", "title": "" }, { "docid": "77f2b2421b48621e774b47c203794b20", "score": "0.5252161", "text": "func (s *Streamer) Table(w io.Writer, header bool, config *TableConfig) error {\n\ttw, table := tabular(w, header, config)\n\tdefer tw.Flush()\n\treturn s.Stream(table)\n}", "title": "" }, { "docid": "ae89de6c5d125a6d6bc2ccc00a796fb3", "score": "0.5245433", "text": "func printConstraints(cons Constraints) {\n\twidth := 0\n\tfor _, ds := range cons {\n\t\tif len(ds) > width {\n\t\t\twidth = len(ds)\n\t\t}\n\t}\n\thsect := strings.Repeat(\"-\", 3*width)\n\thrule := hsect + \"+\" + hsect + \"+\" + hsect\n\tfor _, row := range rows {\n\t\tfor _, col := range cols {\n\t\t\tfmt.Print(center(cons[Square{row, col}].String(), width))\n\t\t\tif col == 3 || col == 6 {\n\t\t\t\tfmt.Print(\"|\")\n\t\t\t}\n\t\t}\n\t\tfmt.Print(\"\\n\")\n\t\tif row == 3 || row == 6 {\n\t\t\tfmt.Println(hrule)\n\t\t}\n\t}\n}", "title": "" } ]
a253d2a8a7fbb896b30cbc257af204ce
`aria2.forcePauseAll([secret])` This method is equal to calling aria2.forcePause() for every active/waiting download. This methods returns OK.
[ { "docid": "88652fc5baa093cbbf433d9bc2146b1a", "score": "0.7213956", "text": "func (c *client) ForcePauseAll() (ok string, err error) {\n\tparams := []string{}\n\tif c.token != \"\" {\n\t\tparams = append(params, \"token:\"+c.token)\n\t}\n\terr = c.Call(aria2ForcePauseAll, params, &ok)\n\treturn\n}", "title": "" } ]
[ { "docid": "f574fa594b74ff627a1e298117e58a93", "score": "0.7283405", "text": "func (c *client) PauseAll() (ok string, err error) {\n\tparams := []string{}\n\tif c.token != \"\" {\n\t\tparams = append(params, \"token:\"+c.token)\n\t}\n\terr = c.Call(aria2PauseAll, params, &ok)\n\treturn\n}", "title": "" }, { "docid": "40f0caf432c42d05e68a5e9bc10c4c2a", "score": "0.6625581", "text": "func (client *Client) PauseAll() (*http.Response, error) {\n\treturn client.get(\"command/pauseAll\", nil)\n}", "title": "" }, { "docid": "b9ead63fab61cba29ce4532f582ff6cf", "score": "0.6544214", "text": "func (id *Client) ForcePauseAll() (g string, err error) {\n\tid.Lock()\n\terr = Call(id.serverUrl, forcePauseAll, []interface{}{}, &g)\n\tid.Unlock()\n\treturn\n}", "title": "" }, { "docid": "8519cec936e789a31145c2313c0c0e60", "score": "0.6456134", "text": "func (id *Client) PauseAll() (g string, err error) {\n\tid.Lock()\n\terr = Call(id.serverUrl, pauseAll, []interface{}{}, &g)\n\tid.Unlock()\n\treturn\n}", "title": "" }, { "docid": "c8d777d161c977097447de1ff1fd20f9", "score": "0.576848", "text": "func (client *Client) PauseMultiple(infoHashList []string) (*http.Response, error) {\n\tparams := client.processInfoHashList(infoHashList)\n\treturn client.post(\"command/pauseAll\", params)\n}", "title": "" }, { "docid": "92e7b7e05454da1090e9b92f63aae086", "score": "0.56406355", "text": "func (c *Coordinator) Pause() {\n\tfor _, v := range c.vms {\n\t\tv.Pause()\n\t}\n}", "title": "" }, { "docid": "d192326d0fcffedf8cef92a7c736cbcb", "score": "0.5591185", "text": "func (c *client) UnpauseAll() (ok string, err error) {\n\tparams := []string{}\n\tif c.token != \"\" {\n\t\tparams = append(params, \"token:\"+c.token)\n\t}\n\terr = c.Call(aria2UnpauseAll, params, &ok)\n\treturn\n}", "title": "" }, { "docid": "e9a34fcf89d5cb0b2dbac82ae7c5cd85", "score": "0.5418446", "text": "func (m *MultiExecutor) Pause() {\n\tm.me.Pause()\n}", "title": "" }, { "docid": "bf37fac00215d50b44d837cf8fbce444", "score": "0.5395001", "text": "func (_EthCrossChainManager *EthCrossChainManagerTransactor) Pause(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _EthCrossChainManager.contract.Transact(opts, \"pause\")\n}", "title": "" }, { "docid": "7f9f6839c7a5e78cd46ea00258a944e2", "score": "0.53921705", "text": "func (_CardBattles *CardBattlesSession) Pause() (*types.Transaction, error) {\n\treturn _CardBattles.Contract.Pause(&_CardBattles.TransactOpts)\n}", "title": "" }, { "docid": "e56dd223bb9626aac81bc512b71292a6", "score": "0.53612924", "text": "func (id *Client) ForcePause(gid string) (g string, err error) {\n\tid.Lock()\n\terr = Call(id.serverUrl, forcePause, []interface{}{gid}, &g)\n\tid.Unlock()\n\treturn\n}", "title": "" }, { "docid": "d7524522dcd44085b45d80af58577548", "score": "0.5360597", "text": "func (jm *jobMgr) ConfirmAllTransfersScheduled() {\n\tatomic.StoreInt32(&jm.atomicAllTransfersScheduled, 1)\n}", "title": "" }, { "docid": "461f33a56cd3a1fe4ce7bb19bc22d3d6", "score": "0.535721", "text": "func (_EthCrossChainManager *EthCrossChainManagerSession) Pause() (*types.Transaction, error) {\n\treturn _EthCrossChainManager.Contract.Pause(&_EthCrossChainManager.TransactOpts)\n}", "title": "" }, { "docid": "c7f43cef4fe387b74b7dcaa6742485fd", "score": "0.5356782", "text": "func (_TrueUSD *TrueUSDTransactor) Pause(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _TrueUSD.contract.Transact(opts, \"pause\")\n}", "title": "" }, { "docid": "524acba5ca801e90cf9be0a1f29ba102", "score": "0.5351491", "text": "func (c *ConnectorManager) Pause(connectors []string) error {\n\tif len(connectors) == 0 {\n\t\treturn c.pauseAllConnectors()\n\t}\n\n\treturn c.pauseSpecifiedConnectors(connectors)\n}", "title": "" }, { "docid": "c0da48b71e6f8bb13947d87c5927f546", "score": "0.5347328", "text": "func (pc *MockAutoPartitionConsumer) Pause() {\n}", "title": "" }, { "docid": "7c3bd78550731fde1a3f8d14990e33d6", "score": "0.5333934", "text": "func (c *Debugger) SetSkipAllPauses(skip bool) (*gcdmessage.ChromeResponse, error) {\n\tparamRequest := make(map[string]interface{}, 1)\n\tparamRequest[\"skip\"] = skip\n\treturn gcdmessage.SendDefaultRequest(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: \"Debugger.setSkipAllPauses\", Params: paramRequest})\n}", "title": "" }, { "docid": "33e7590f594c5ef53d29c824742883cc", "score": "0.5330929", "text": "func (c *Debugger) SetSkipAllPauses(skipped bool) (*gcdmessage.ChromeResponse, error) {\n\tparamRequest := make(map[string]interface{}, 1)\n\tparamRequest[\"skipped\"] = skipped\n\treturn gcdmessage.SendDefaultRequest(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: \"Debugger.setSkipAllPauses\", Params: paramRequest})\n}", "title": "" }, { "docid": "c2de1193e475e6aaa0e2bb4fb6f71f31", "score": "0.5322711", "text": "func (_Marketplace *MarketplaceTransactor) Pause(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Marketplace.contract.Transact(opts, \"pause\")\n}", "title": "" }, { "docid": "ae30b4d54c3cb6012fe61ca7f9d71ed1", "score": "0.5321968", "text": "func Pause() {\n\tpauseChan <- struct{}{}\n\t<-pauseChanDone\n}", "title": "" }, { "docid": "5c3cf7fa2f3c8196292d035cdc2415c7", "score": "0.5321292", "text": "func (c *client) ForcePause(gid string) (g string, err error) {\n\tparams := make([]interface{}, 0, 2)\n\tif c.token != \"\" {\n\t\tparams = append(params, \"token:\"+c.token)\n\t}\n\tparams = append(params, gid)\n\terr = c.Call(aria2ForcePause, params, &g)\n\treturn\n}", "title": "" }, { "docid": "2257cb64e4bff1222d15d2888caaafd4", "score": "0.5319137", "text": "func (_CardBattles *CardBattlesTransactor) Pause(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _CardBattles.contract.Transact(opts, \"pause\")\n}", "title": "" }, { "docid": "8dd69c45463197cca811b6cf6e2dce16", "score": "0.5313361", "text": "func (t *TestModule) Pause() {\n\tt.pauses <- true\n}", "title": "" }, { "docid": "1b93e435141a6df0e0b025f4ab07bb41", "score": "0.5277784", "text": "func (_UpgradableECCM *UpgradableECCMTransactor) Pause(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _UpgradableECCM.contract.Transact(opts, \"pause\")\n}", "title": "" }, { "docid": "6bb980ab7fda7898661aff128b31b56d", "score": "0.52695024", "text": "func (_LifMarketValidationMechanism *LifMarketValidationMechanismTransactor) Pause(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _LifMarketValidationMechanism.contract.Transact(opts, \"pause\")\n}", "title": "" }, { "docid": "99223df40229a106bee468cb91e542e5", "score": "0.5268513", "text": "func (_IUpgradableECCM *IUpgradableECCMTransactor) Pause(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _IUpgradableECCM.contract.Transact(opts, \"pause\")\n}", "title": "" }, { "docid": "1a61ffda5ccaeb588cea5fdf78136e9a", "score": "0.5252255", "text": "func (_CardBattles *CardBattlesTransactorSession) Pause() (*types.Transaction, error) {\n\treturn _CardBattles.Contract.Pause(&_CardBattles.TransactOpts)\n}", "title": "" }, { "docid": "58b6093938b0f0188d209d68a0484956", "score": "0.5247017", "text": "func (e *export) Paused(resetAt time.Time) error {\n\te.mu.Lock()\n\tif e.paused {\n\t\te.mu.Unlock()\n\t\treturn nil\n\t}\n\te.paused = true\n\te.mu.Unlock()\n\te.pipe.Flush() // flush the pipe once we're paused to go ahead and send any pending data\n\tlog.Info(e.logger, \"paused\", \"reset\", resetAt, \"duration\", time.Until(resetAt))\n\tvar dt agent.IntegrationInstanceThrottledUntil\n\tsdk.ConvertTimeToDateModel(resetAt, &dt)\n\treturn e.updateIntegration(gql.Variables{\n\t\tagent.IntegrationInstanceModelThrottledColumn: true,\n\t\tagent.IntegrationInstanceModelThrottledUntilColumn: dt,\n\t\tagent.IntegrationInstanceModelUpdatedAtColumn: datetime.EpochNow(),\n\t})\n}", "title": "" }, { "docid": "22991b5c84efaf99f1cc8216ef018ec4", "score": "0.52403384", "text": "func (_EthCrossChainManager *EthCrossChainManagerTransactorSession) Pause() (*types.Transaction, error) {\n\treturn _EthCrossChainManager.Contract.Pause(&_EthCrossChainManager.TransactOpts)\n}", "title": "" }, { "docid": "d7af5e44d137dffd3f6962f153a99f6a", "score": "0.5228415", "text": "func (_Whbar *WhbarTransactor) Pause(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Whbar.contract.Transact(opts, \"pause\")\n}", "title": "" }, { "docid": "741f6e8c2d5010441037fa491d2cfb98", "score": "0.5219821", "text": "func (s *Service) ExecPause(req *SendPauseRequest) (*SendPauseReply, error) {\n\ttime.Sleep(10 * time.Hour)\n\treturn &SendPauseReply{}, nil\n}", "title": "" }, { "docid": "60e6b47c91cd76ea3e87b605852b4dba", "score": "0.5219535", "text": "func (j *Job) pause() {\n\tj.enabled = false\n}", "title": "" }, { "docid": "9e074bd54b21df02f673713f71c1eff8", "score": "0.5217362", "text": "func (_Marketplace *MarketplaceSession) Pause() (*types.Transaction, error) {\n\treturn _Marketplace.Contract.Pause(&_Marketplace.TransactOpts)\n}", "title": "" }, { "docid": "1229e7641f0923dcb523417a008da663", "score": "0.5181941", "text": "func (_AdminPausable *AdminPausableTransactor) Pause(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _AdminPausable.contract.Transact(opts, \"pause\")\n}", "title": "" }, { "docid": "e6efca21211fe8ff6ed6651c2a839b94", "score": "0.51712316", "text": "func (_TokenCashier *TokenCashierTransactor) Pause(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _TokenCashier.contract.Transact(opts, \"pause\")\n}", "title": "" }, { "docid": "99865d12366577413bb9fd6249b15802", "score": "0.51707166", "text": "func (_IUpgradableECCM *IUpgradableECCMSession) Pause() (*types.Transaction, error) {\n\treturn _IUpgradableECCM.Contract.Pause(&_IUpgradableECCM.TransactOpts)\n}", "title": "" }, { "docid": "5221b837f338c5836d64ce5f17fd58e4", "score": "0.51621974", "text": "func (_Whbar *WhbarSession) Pause() (*types.Transaction, error) {\n\treturn _Whbar.Contract.Pause(&_Whbar.TransactOpts)\n}", "title": "" }, { "docid": "3618856268279f0947d1667cd705db24", "score": "0.5161155", "text": "func (s *Spotify) Pause(status bool) error {\n\tstatusStr := \"true\"\n\tif !status {\n\t\tstatusStr = \"false\"\n\t}\n\n\tquery := map[string]string{\n\t\t\"pause\": statusStr,\n\t}\n\n\tif _, err := s.request(PAUSE_PATH, query); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "8885f217c139fd67aa894856219ca705", "score": "0.5157193", "text": "func (_ContractAccessControl *ContractAccessControlTransactor) Pause(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _ContractAccessControl.contract.Transact(opts, \"pause\")\n}", "title": "" }, { "docid": "d6212538737ccb1bf227c3c8efee806d", "score": "0.51561236", "text": "func (id *Client) UnpauseAll() (g string, err error) {\n\tid.Lock()\n\terr = Call(id.serverUrl, unpauseAll, []interface{}{}, &g)\n\tid.Unlock()\n\treturn\n}", "title": "" }, { "docid": "726dcda0417552623f04ba2c0328a9bc", "score": "0.51505524", "text": "func (_IEthCrossChainData *IEthCrossChainDataTransactor) Pause(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _IEthCrossChainData.contract.Transact(opts, \"pause\")\n}", "title": "" }, { "docid": "1d1a8893b51b0d6dd876bc89b40631ba", "score": "0.51449215", "text": "func (_ShadowToken *ShadowTokenTransactor) Pause(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _ShadowToken.contract.Transact(opts, \"pause\")\n}", "title": "" }, { "docid": "59cbef40d9907c150cd055edefe197f8", "score": "0.51447576", "text": "func (_CryptoCardsCore *CryptoCardsCoreTransactor) Pause(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _CryptoCardsCore.contract.Transact(opts, \"pause\")\n}", "title": "" }, { "docid": "772c119a084f41f394baf164fa40d4cc", "score": "0.5122218", "text": "func (suite *APIContainerPauseSuite) TestPauseUnpauseOk(c *check.C) {\n\t// must required\n\tcname := \"TestPauseUnpauseOk\"\n\tCreateBusyboxContainerOk(c, cname)\n\n\tStartContainerOk(c, cname)\n\n\tresp, err := request.Post(\"/containers/\" + cname + \"/pause\")\n\tc.Assert(err, check.IsNil)\n\tCheckRespStatus(c, resp, 204)\n\n\t// TODO: Add state check\n\n\tresp, err = request.Post(\"/containers/\" + cname + \"/unpause\")\n\tc.Assert(err, check.IsNil)\n\tCheckRespStatus(c, resp, 204)\n\n\tDelContainerForceMultyTime(c, cname)\n}", "title": "" }, { "docid": "a1a3ee671199cd22ee5b3c1321c88f61", "score": "0.51208943", "text": "func (e *autoconfig) Paused(resetAt time.Time) error {\n\te.mu.Lock()\n\tif e.paused {\n\t\te.mu.Unlock()\n\t\treturn nil\n\t}\n\te.paused = true\n\te.mu.Unlock()\n\te.pipe.Flush() // flush the pipe once we're paused to go ahead and send any pending data\n\tlog.Info(e.logger, \"paused\", \"reset\", resetAt, \"duration\", time.Until(resetAt))\n\tvar dt agent.IntegrationInstanceThrottledUntil\n\tsdk.ConvertTimeToDateModel(resetAt, &dt)\n\treturn e.updateIntegration(gql.Variables{\n\t\tagent.IntegrationInstanceModelThrottledColumn: true,\n\t\tagent.IntegrationInstanceModelThrottledUntilColumn: dt,\n\t\tagent.IntegrationInstanceModelUpdatedAtColumn: datetime.EpochNow(),\n\t})\n}", "title": "" }, { "docid": "232c3d56bee2a514f8e04df9fc2aa4fc", "score": "0.5120628", "text": "func (_IUpgradableECCM *IUpgradableECCMTransactorSession) Pause() (*types.Transaction, error) {\n\treturn _IUpgradableECCM.Contract.Pause(&_IUpgradableECCM.TransactOpts)\n}", "title": "" }, { "docid": "c74b8f50d9e21b63e34b1541b9cdf384", "score": "0.5115293", "text": "func (s *RealSession) Pause() (*Result, error) {\n\tparams := getAuthParams(s)\n\tparams.Set(\"pause\", \"true\")\n\n\tresult, err := getResult(\"/remote/pause.json\", params)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn result, nil\n}", "title": "" }, { "docid": "1c7c35c660ceff01e7a2ee38f5a16f5e", "score": "0.5114344", "text": "func (client *Client) Pause(infoHash string) (*http.Response, error) {\n\tparams := make(map[string]string)\n\tparams[\"hashes\"] = strings.ToLower(infoHash)\n\n\treturn client.get(endpointPause, params)\n}", "title": "" }, { "docid": "80ce7e1782a6b1eb37395790c1a856f1", "score": "0.5107271", "text": "func (_Marketplace *MarketplaceTransactorSession) Pause() (*types.Transaction, error) {\n\treturn _Marketplace.Contract.Pause(&_Marketplace.TransactOpts)\n}", "title": "" }, { "docid": "e8804b471ff3eba2f2b65e77f9307402", "score": "0.5106036", "text": "func TestPause(t *testing.T) {\n\tvar err error\n\n\tif _, ok := os.LookupEnv(\"TMP_TEST_EXEC\"); !ok {\n\t\tt.Skip(\"skipping (only useful for exec testing\")\n\t}\n\n\tvar f *os.File\n\n\tf, err = New(\"\", \"test-pause-\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tfmt.Fprintf(os.Stderr, \"%s\\n\", f.Name())\n\n\tc := make(chan bool)\n\t<-c\n}", "title": "" }, { "docid": "ce72ff50b94eada3655c3bebdd7501dd", "score": "0.5106031", "text": "func (_Pausable *PausableTransactor) Pause(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Pausable.contract.Transact(opts, \"pause\")\n}", "title": "" }, { "docid": "ce72ff50b94eada3655c3bebdd7501dd", "score": "0.51057696", "text": "func (_Pausable *PausableTransactor) Pause(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Pausable.contract.Transact(opts, \"pause\")\n}", "title": "" }, { "docid": "ce72ff50b94eada3655c3bebdd7501dd", "score": "0.51057696", "text": "func (_Pausable *PausableTransactor) Pause(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Pausable.contract.Transact(opts, \"pause\")\n}", "title": "" }, { "docid": "ce72ff50b94eada3655c3bebdd7501dd", "score": "0.51057696", "text": "func (_Pausable *PausableTransactor) Pause(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Pausable.contract.Transact(opts, \"pause\")\n}", "title": "" }, { "docid": "e4fd041f7bd551c1631089a9c99aca2f", "score": "0.5105093", "text": "func Pause(jobNames []string) error {\n\terr := Env()\n\tif nil != err {\n\t\treturn err\n\t}\n\n\terr = forwarderRedis.Init()\n\tif nil != err {\n\t\tfmt.Printf(\"forwarder.pause.Pause(): v%s Failed to init Redis: %v\\n\", forwarderCommon.PackageVersion, err)\n\t\treturn err\n\t}\n\n\tdefer forwarderRedis.Cleanup()\n\n\terr = forwarderRedis.SetInt64(\"IN_PAUSE\", int64(1))\n\tif nil != err {\n\t\treturn err\n\t}\n\n\t_, err = forwarderRedis.Expire(\"IN_PAUSE\", 60 * 60 * 6)\n\tif nil != err {\n\t\tforwarderRedis.Del(\"IN_PAUSE\")\n\t}\n\n\terr = forwarderDb.CreatePauseRows(nbrHash)\n\tif nil != err {\n\t\tforwarderDb.DeleteAllPauseRows()\n\t\tforwarderRedis.Del(\"IN_PAUSE\")\n\t\treturn err\n\t}\n\n\tctx := context.Background()\n\tcloudschedulerService, err := cloudscheduler.NewService(ctx)\n\tif err != nil {\n\t\tforwarderDb.DeleteAllPauseRows()\n\t\tforwarderRedis.Del(\"IN_PAUSE\")\n\t\treturn err\n\t}\n\n\tfor _, jobName := range jobNames {\n\t\tfmt.Printf(\"Jobname: %s\\n\", jobName)\n\t\tname := \"projects/\" + projectId + \"/locations/\" + gcpLocation + \"/jobs/\" + jobName\n\t\trb := &cloudscheduler.PauseJobRequest{\n\t\t\t// TODO: Add desired fields of the request body. ??? Meng has no idea\n\t\t}\n\n\t\tresp, err := cloudschedulerService.Projects.Locations.Jobs.Pause(name, rb).Context(ctx).Do()\n\t\tif err != nil {\n\t\t\tforwarderDb.DeleteAllPauseRows()\n\t\t\tforwarderRedis.Del(\"IN_PAUSE\")\n\t\t\treturn err\n\t\t}\n\n\t\tfmt.Printf(\"%#v\\n\", resp)\n\t}\n\n\tvar memUsage = forwarderStats.GetMemUsageStr()\n\tfmt.Printf(\"forwarder.pause.Pause() ok. v%s, Memstats: %s\\n\", forwarderCommon.PackageVersion, memUsage)\n\n\treturn nil\n}", "title": "" }, { "docid": "4afe9c8bcbb86482e0d5b0eb8660994f", "score": "0.5099707", "text": "func (self *TweenManager) _pauseAllI(args ...interface{}) {\n self.Object.Call(\"_pauseAll\", args)\n}", "title": "" }, { "docid": "e6b8f248d7fa42c352163589c72fa24d", "score": "0.50966996", "text": "func (_IEthCrossChainData *IEthCrossChainDataSession) Pause() (*types.Transaction, error) {\n\treturn _IEthCrossChainData.Contract.Pause(&_IEthCrossChainData.TransactOpts)\n}", "title": "" }, { "docid": "67f746fafd8624388c447ee5b2c39e65", "score": "0.5094853", "text": "func (prod *ProducerBase) PauseAllStreams(capacity int) {\n\tfor _, streamID := range prod.streams {\n\t\tstream := StreamRegistry.GetStream(streamID)\n\t\tstream.Pause(capacity)\n\t}\n}", "title": "" }, { "docid": "fc483ea5bf425a45a5b1170f83e91017", "score": "0.5092295", "text": "func (_UpgradableECCM *UpgradableECCMSession) Pause() (*types.Transaction, error) {\n\treturn _UpgradableECCM.Contract.Pause(&_UpgradableECCM.TransactOpts)\n}", "title": "" }, { "docid": "a6412630364a5e5eefa6482986ed9bef", "score": "0.50870204", "text": "func (_AdminPausable *AdminPausableSession) Pause() (*types.Transaction, error) {\n\treturn _AdminPausable.Contract.Pause(&_AdminPausable.TransactOpts)\n}", "title": "" }, { "docid": "556e87f9238f439215eb97b15eb2b755", "score": "0.50840724", "text": "func (s *Shelf) Pause() {\n\ts.paused = true\n}", "title": "" }, { "docid": "580010ff99b0ee9a460bf76851f0d29c", "score": "0.50824225", "text": "func (_TrueUSD *TrueUSDSession) Pause() (*types.Transaction, error) {\n\treturn _TrueUSD.Contract.Pause(&_TrueUSD.TransactOpts)\n}", "title": "" }, { "docid": "acfe24d9feb67af42aa6b6c8bd9317a4", "score": "0.5081035", "text": "func (_TrueUSD *TrueUSDTransactorSession) Pause() (*types.Transaction, error) {\n\treturn _TrueUSD.Contract.Pause(&_TrueUSD.TransactOpts)\n}", "title": "" }, { "docid": "acdfb754a9875f56b37525f168ba655f", "score": "0.5076507", "text": "func (sd *Sender) waitForAllConfirmations() {\n\tif sd.Config.VerboseSender {\n\t\tsd.logInfo(\"Waiting . . .\")\n\t}\n\tt0 := time.Now()\n\tfor {\n\t\ttime.Sleep(sd.Config.SendWaitInterval)\n\t\tif sd.DeliveredAllParts() {\n\t\t\tif sd.Config.VerboseSender {\n\t\t\t\tsd.logInfo(\"Delivered all packets\")\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\tsince := time.Since(t0)\n\t\tif since >= sd.Config.ReplyTimeout {\n\t\t\tsd.logInfo(\"Config.ReplyTimeout exceeded\",\n\t\t\t\tfmt.Sprintf(\"%0.1f\", since.Seconds()))\n\t\t\tbreak\n\t\t}\n\t}\n\tfor _, pk := range sd.packets {\n\t\tif pk.IsDelivered() {\n\t\t\tsd.stats.bytesDelivered += int64(len(pk.data))\n\t\t\tsd.stats.packetsDelivered++\n\t\t} else {\n\t\t\tsd.stats.bytesLost += int64(len(pk.data))\n\t\t\tsd.stats.packetsLost++\n\t\t}\n\t}\n\tif sd.Config.VerboseSender {\n\t\tsd.logInfo(\"Waited:\", time.Since(t0))\n\t}\n}", "title": "" }, { "docid": "0777a676e3310652ef485f7d7272e97b", "score": "0.507127", "text": "func (_CardBase *CardBaseTransactor) Pause(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _CardBase.contract.Transact(opts, \"pause\")\n}", "title": "" }, { "docid": "f144bbae10565e0f4b15acbef0abc3e8", "score": "0.5067027", "text": "func (_Whbar *WhbarTransactorSession) Pause() (*types.Transaction, error) {\n\treturn _Whbar.Contract.Pause(&_Whbar.TransactOpts)\n}", "title": "" }, { "docid": "d2f79b97639abb088625da9ff5feb613", "score": "0.5059708", "text": "func (e *Enumeration) Pause() {\n\te.pause <- struct{}{}\n}", "title": "" }, { "docid": "a5c2236a094766b1454edd2175520853", "score": "0.5052815", "text": "func (_UpgradableECCM *UpgradableECCMTransactorSession) Pause() (*types.Transaction, error) {\n\treturn _UpgradableECCM.Contract.Pause(&_UpgradableECCM.TransactOpts)\n}", "title": "" }, { "docid": "cbe753b98346ab486b5f930b8a29a02d", "score": "0.5049519", "text": "func (_EthCrossChainManager *EthCrossChainManagerCaller) Paused(opts *bind.CallOpts) (bool, error) {\n\tvar out []interface{}\n\terr := _EthCrossChainManager.contract.Call(opts, &out, \"paused\")\n\n\tif err != nil {\n\t\treturn *new(bool), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(bool)).(*bool)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "e7b0efbc59338588f18581ee511aaddb", "score": "0.5042812", "text": "func (pp *PermitPlugin) rejectAllPods() {\n\tpp.mutex.Lock()\n\tdefer pp.mutex.Unlock()\n\tpp.fh.IterateOverWaitingPods(func(wp framework.WaitingPod) { wp.Reject(pp.name, \"rejectAllPods\") })\n}", "title": "" }, { "docid": "223cc8043ab2865ab81f035a49b9680c", "score": "0.50408775", "text": "func (srv *StubbedRevalidator) ExpectPauseComplete() {\n\tsrv.expectComplete = true\n\tsrv.StubPauseComplete()\n}", "title": "" }, { "docid": "78f8c957876fee7b02f646872adb3cec", "score": "0.5031684", "text": "func (_IUpgradableECCM *IUpgradableECCMCaller) Paused(opts *bind.CallOpts) (bool, error) {\n\tvar out []interface{}\n\terr := _IUpgradableECCM.contract.Call(opts, &out, \"paused\")\n\n\tif err != nil {\n\t\treturn *new(bool), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(bool)).(*bool)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "6616186061e52a49f483b70d12c9eba1", "score": "0.50262004", "text": "func (_IEthCrossChainData *IEthCrossChainDataTransactorSession) Pause() (*types.Transaction, error) {\n\treturn _IEthCrossChainData.Contract.Pause(&_IEthCrossChainData.TransactOpts)\n}", "title": "" }, { "docid": "215e5e595f4320612c3f3db0c8a4a57e", "score": "0.5019867", "text": "func preemptall() bool {\n\tres := false\n\tfor _, _p_ := range allp {\n\t\tif _p_.status != _Prunning {\n\t\t\tcontinue\n\t\t}\n\t\tif preemptone(_p_) {\n\t\t\tres = true\n\t\t}\n\t}\n\treturn res\n}", "title": "" }, { "docid": "ab4a0e7df919db0eceef6e0b11cf805c", "score": "0.5013084", "text": "func (_Pausable *PausableSession) Pause() (*types.Transaction, error) {\n\treturn _Pausable.Contract.Pause(&_Pausable.TransactOpts)\n}", "title": "" }, { "docid": "ab4a0e7df919db0eceef6e0b11cf805c", "score": "0.5013084", "text": "func (_Pausable *PausableSession) Pause() (*types.Transaction, error) {\n\treturn _Pausable.Contract.Pause(&_Pausable.TransactOpts)\n}", "title": "" }, { "docid": "ab4a0e7df919db0eceef6e0b11cf805c", "score": "0.5013084", "text": "func (_Pausable *PausableSession) Pause() (*types.Transaction, error) {\n\treturn _Pausable.Contract.Pause(&_Pausable.TransactOpts)\n}", "title": "" }, { "docid": "ab4a0e7df919db0eceef6e0b11cf805c", "score": "0.5013084", "text": "func (_Pausable *PausableSession) Pause() (*types.Transaction, error) {\n\treturn _Pausable.Contract.Pause(&_Pausable.TransactOpts)\n}", "title": "" }, { "docid": "b38395783f80a1d73b782963e1470fcd", "score": "0.50083065", "text": "func (_UpgradableECCM *UpgradableECCMCaller) Paused(opts *bind.CallOpts) (bool, error) {\n\tvar out []interface{}\n\terr := _UpgradableECCM.contract.Call(opts, &out, \"paused\")\n\n\tif err != nil {\n\t\treturn *new(bool), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(bool)).(*bool)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "c0b613a1f217df2aa2a8049a17e2a981", "score": "0.5001989", "text": "func (_IncognitoProxy *IncognitoProxyTransactor) Pause(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _IncognitoProxy.contract.Transact(opts, \"pause\")\n}", "title": "" }, { "docid": "5fc8cee72403b451338835695bb061ee", "score": "0.5000787", "text": "func (_Rollup *RollupTransactor) Pause(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Rollup.contract.Transact(opts, \"pause\")\n}", "title": "" }, { "docid": "b7a456f616ef702f2a1da3cd76ad7b1f", "score": "0.4998662", "text": "func TestPause(t *testing.T) {\n\tj := setUpTest(t, \"TestPause\")\n\tdefer tearDownTest(t, j)\n\n\tworkUnits := map[string]map[string]interface{}{\"u\": {\"k\": \"v\"}}\n\tworkSpecName := setWorkSpec(t, j, WorkSpecData)\n\taddWorkUnits(t, j, workSpecName, workUnits)\n\n\tlistWorkUnits(t, j, workSpecName, gwuEverything, workUnits)\n\tcheckWorkUnitStatus(t, j, workSpecName, \"u\", jobserver.Available)\n\n\t// Pause the work spec\n\tok, msg, err := j.ControlWorkSpec(workSpecName, map[string]interface{}{\"status\": jobserver.Paused})\n\tif assert.NoError(t, err) {\n\t\tassert.True(t, ok)\n\t\tassert.Empty(t, msg)\n\t}\n\n\t// We should not get work now\n\tok, spec, unit, _ := getOneWork(t, j)\n\tassert.False(t, ok)\n\n\t// Resume the work spec\n\tok, msg, err = j.ControlWorkSpec(workSpecName, map[string]interface{}{\"status\": jobserver.Runnable})\n\tif assert.NoError(t, err) {\n\t\tassert.True(t, ok)\n\t\tassert.Empty(t, msg)\n\t}\n\n\t// We should the work unit back\n\tok, spec, unit, _ = getOneWork(t, j)\n\tif assert.True(t, ok) {\n\t\tassert.Equal(t, workSpecName, spec)\n\t\tassert.Equal(t, \"u\", unit)\n\t}\n}", "title": "" }, { "docid": "6fed7b56bfac514f92f25f7dc3ad22c9", "score": "0.49984017", "text": "func (_LifMarketValidationMechanism *LifMarketValidationMechanismTransactorSession) Pause() (*types.Transaction, error) {\n\treturn _LifMarketValidationMechanism.Contract.Pause(&_LifMarketValidationMechanism.TransactOpts)\n}", "title": "" }, { "docid": "a9524c6c9f87d6b0cf8e1e8d011aa8b9", "score": "0.49983492", "text": "func (tuning *TuningSetObject) Pause() error {\n\treturn sleep(tuning.Stepping.Pause)\n}", "title": "" }, { "docid": "cb458a60c24219d8aca56cdda5dafa97", "score": "0.4997426", "text": "func (s *Server) Pause(args stubs.Default, reply *stubs.Turn) error {\n\treply.Turn = s.distributor.currentTurn\n\ts.distributor.paused <- true\n\treturn nil\n}", "title": "" }, { "docid": "43c44a0468c817440013223286fddf85", "score": "0.4996152", "text": "func (_ShadowToken *ShadowTokenSession) Pause() (*types.Transaction, error) {\n\treturn _ShadowToken.Contract.Pause(&_ShadowToken.TransactOpts)\n}", "title": "" }, { "docid": "8fb692a17d7f33237264ed285a7f08c7", "score": "0.49948707", "text": "func (q *queue) pause() {\n\tq.lock.Lock()\n\tdefer q.lock.Unlock()\n\n\tq.paused = true\n}", "title": "" }, { "docid": "30dca96de5fae79b70a61f7d46bbba09", "score": "0.49914348", "text": "func (b *i3Bar) pause() {\n\tl.Log(\"Bar paused\")\n\tb.Lock()\n\tdefer b.Unlock()\n\tif b.paused {\n\t\treturn\n\t}\n\tb.paused = true\n\ttiming.Pause()\n\tb.emitDebugEvent(dEvtPaused, \"\")\n}", "title": "" }, { "docid": "bb3d88e2d228c653c61d204ac7feb24c", "score": "0.49867383", "text": "func (_ContractAccessControl *ContractAccessControlSession) Pause() (*types.Transaction, error) {\n\treturn _ContractAccessControl.Contract.Pause(&_ContractAccessControl.TransactOpts)\n}", "title": "" }, { "docid": "7514ab376b14341568a71ebf05a1969d", "score": "0.49866408", "text": "func (_LifMarketValidationMechanism *LifMarketValidationMechanismSession) Pause() (*types.Transaction, error) {\n\treturn _LifMarketValidationMechanism.Contract.Pause(&_LifMarketValidationMechanism.TransactOpts)\n}", "title": "" }, { "docid": "e5757c86d93ca5aba30aa54176de45a1", "score": "0.49738172", "text": "func (pool *ConsumerPool) Pause() {\n\tpool.mu.Lock()\n\tdefer pool.mu.Unlock()\n\n\tfor _, consumer := range pool.consumers {\n\t\tconsumer.Pause()\n\t}\n}", "title": "" }, { "docid": "01e327f2954da7c8abd06bc10221d657", "score": "0.49736184", "text": "func (_AdminPausable *AdminPausableTransactorSession) Pause() (*types.Transaction, error) {\n\treturn _AdminPausable.Contract.Pause(&_AdminPausable.TransactOpts)\n}", "title": "" }, { "docid": "b1c31a842dbd9a0a2f70876eebe213eb", "score": "0.49693075", "text": "func (_ContractAccessControl *ContractAccessControlTransactorSession) Pause() (*types.Transaction, error) {\n\treturn _ContractAccessControl.Contract.Pause(&_ContractAccessControl.TransactOpts)\n}", "title": "" }, { "docid": "7ddc0a5fddf7ce982390da217fbcf67a", "score": "0.49581844", "text": "func (_ShadowToken *ShadowTokenTransactorSession) Pause() (*types.Transaction, error) {\n\treturn _ShadowToken.Contract.Pause(&_ShadowToken.TransactOpts)\n}", "title": "" }, { "docid": "e67d8947ffdfc8d568322c4db1a5d828", "score": "0.4956829", "text": "func pauseExample() string {\n\treturn `$ pouch ps\nName ID Status Created Image Runtime\nfoo2 87259c Up 25 seconds 26 seconds ago registry.hub.docker.com/library/busybox:latest runc\nfoo1 77188c Up 46 seconds 47 seconds ago registry.hub.docker.com/library/busybox:latest runc\n$ pouch pause foo1 foo2\nfoo1\nfoo2\n$ pouch ps\nName ID Status Created Image Runtime\nfoo2 87259c Up 1 minute(paused) 1 minute ago registry.hub.docker.com/library/busybox:latest runc\nfoo1 77188c Up 1 minute(paused) 1 minute ago registry.hub.docker.com/library/busybox:latest runc`\n}", "title": "" }, { "docid": "45840d842be9b713209f27052ca8ad94", "score": "0.49563363", "text": "func (t *ticker) pause() error {\n\tt.pauseC <- struct{}{}\n\treturn nil\n}", "title": "" }, { "docid": "34a9ded0ffd1ddade0c333e9451e3442", "score": "0.49562696", "text": "func (_PausableToken *PausableTokenTransactor) Pause(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _PausableToken.contract.Transact(opts, \"pause\")\n}", "title": "" }, { "docid": "57fd7e5460952f86b41ac8400244902d", "score": "0.49553558", "text": "func pauseClients() {\n\tpause := model.Pause{}\n\tlog.LogPrinter(\"Deseja parar todos os clientes: (S/N)\")\n\tfmt.Scan(&pause.All)\n\n\tif strings.EqualFold(pause.All, \"N\") {\n\t\tlog.LogPrinter(\"Deseja parar todos de qual banco.\")\n\t\tlog.LogPrinter(\"1 - dboci2\")\n\t\tlog.LogPrinter(\"2 - dboci3\")\n\t\tlog.LogPrinter(\"3 - dbocit1\")\n\t\tfmt.Scan(&pause.DbName)\n\n\t\tpause.SetDbName()\n\t\tmodel.PauseTo(pause.DbName)\n\t} else {\n\t\tmodel.PauseAll()\n\t}\n\n}", "title": "" }, { "docid": "cbbecd09dcd89fd7d4dedf59d137bc9f", "score": "0.4951302", "text": "func (_CardMinting *CardMintingTransactor) Pause(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _CardMinting.contract.Transact(opts, \"pause\")\n}", "title": "" }, { "docid": "756a62959d3f6ef50cc600bcb58c1817", "score": "0.49281186", "text": "func (_TokenCashier *TokenCashierSession) Pause() (*types.Transaction, error) {\n\treturn _TokenCashier.Contract.Pause(&_TokenCashier.TransactOpts)\n}", "title": "" } ]
8a5a5cdf7eaaa0029cb448db6406b247
CreateTempDir generates a temp directory, based on the provided suffix. A typical generated path looks like /var/folders/abcd/abcdefg/A/1137975807/.
[ { "docid": "4973ed416ebc8a0662eabc361e11574d", "score": "0.7969347", "text": "func CreateTempDir(sfx string) (string, error) {\n\tvar suffix string\n\tif sfx != \"\" {\n\t\tsuffix = fmt.Sprintf(\"*-%s\", sfx)\n\t} else {\n\t\tsuffix = sfx\n\t}\n\tdir, err := os.MkdirTemp(\"\", suffix)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn dir, nil\n}", "title": "" } ]
[ { "docid": "cd19f878b5ef99ca3d338f73eed7428e", "score": "0.7076161", "text": "func CreateTempFile(sfx string) (string, error) {\n\tvar suffix string\n\tif sfx != \"\" {\n\t\tsuffix = fmt.Sprintf(\"*-%s\", sfx)\n\t} else {\n\t\tsuffix = sfx\n\t}\n\tf, err := os.CreateTemp(\"\", suffix)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif err := f.Close(); err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn f.Name(), nil\n}", "title": "" }, { "docid": "5ea86ebc8fdf7616f1d4d1de1c8894e9", "score": "0.6940686", "text": "func CreateTempDir(ctx context.Context, t *testing.T) string {\n\ttempDir, err := ioutil.TempDir(\"\", \"\")\n\tif err != nil {\n\t\tt.Fatalf(\"failed to create temp dir: %v\", err)\n\t}\n\n\treturn tempDir\n}", "title": "" }, { "docid": "303c37de4ffcd65bfeb33ef496b8c6ce", "score": "0.68633574", "text": "func CreateTempDir() (string, error) {\n\ttd, err := ioutil.TempDir(\"\", tmpDirPrefix)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn td, nil\n}", "title": "" }, { "docid": "ccf50f4adaf74a5a37bfa517d6e6e476", "score": "0.678897", "text": "func TempDir(dir, prefix string) (string, error) {\n\ttempDir, err := os.MkdirTemp(dir, prefix)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn longpath.AddPrefix(tempDir), nil\n}", "title": "" }, { "docid": "6b363d5b126f1f980d99e697e9c6d672", "score": "0.67796016", "text": "func makeTempDir(t *subcommandstest.TB, name string) string {\n\tprefix := \"dumbcas_\" + name + \"_\"\n\tlength := 8\n\ttempDir := os.TempDir()\n\n\tranPath := make([]rune, length)\n\tfor i := 0; i < length; i++ {\n\t\tranPath[i] = GetRandRune()\n\t}\n\ttempFull := filepath.Join(tempDir, prefix+string(ranPath))\n\tfor {\n\t\terr := os.Mkdir(tempFull, 0700)\n\t\tif os.IsExist(err) {\n\t\t\t// Add another random character.\n\t\t\tranPath = append(ranPath, GetRandRune())\n\t\t}\n\t\treturn tempFull\n\t}\n\tt.Assertf(false, \"Internal error\")\n\treturn \"\"\n}", "title": "" }, { "docid": "c012a606cf92d10c9982f3383605fd47", "score": "0.67584294", "text": "func CreateTempDir() (string, error) {\n\ttemp, err := ioutil.TempDir(\"/tmp\", \"crane-\")\n\tif err != nil {\n\t\te := fmt.Sprintf(\"Could not create temporary directory: %s\", err)\n\t\treturn \"\", errors.New(e)\n\t}\n\n\treturn temp, nil\n}", "title": "" }, { "docid": "2758f3b397c866c8c7692ae82f8f9d35", "score": "0.67406446", "text": "func createTmpDirWithFiles(dirSuffix, certSrc, keySrc, rootSrc string) (string, error) {\n\t// Create a temp directory. Passing an empty string for the first argument\n\t// uses the system temp directory.\n\tdir, err := ioutil.TempDir(\"\", dirSuffix)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"ioutil.TempDir() failed: %v\", err)\n\t}\n\n\tif err := createTmpFile(testdata.Path(certSrc), path.Join(dir, certFile)); err != nil {\n\t\treturn \"\", err\n\t}\n\tif err := createTmpFile(testdata.Path(keySrc), path.Join(dir, keyFile)); err != nil {\n\t\treturn \"\", err\n\t}\n\tif err := createTmpFile(testdata.Path(rootSrc), path.Join(dir, rootFile)); err != nil {\n\t\treturn \"\", err\n\t}\n\treturn dir, nil\n}", "title": "" }, { "docid": "9c39d549ff05d4ec2b70fa02be3874a0", "score": "0.6676377", "text": "func NewTempDir(dir, prefix string) (*TempDir, error) {\n\tp, err := ioutil.TempDir(dir, prefix)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &TempDir{Dir: p}, nil\n}", "title": "" }, { "docid": "62567168b01de9dec96a3743b6398954", "score": "0.6665998", "text": "func createTempFile(t *testing.T, size int64) string {\n\t// Create a temporary file\n\ttmpFile, err := ioutil.TempFile(os.TempDir(), \"prefix-\")\n\tif err != nil {\n\t\tlog.Fatal(\"Cannot create temporary file\", err)\n\t}\n\tdefer func() {\n\t\tcerr := tmpFile.Close()\n\t\tif cerr != nil && !errors.Is(cerr, os.ErrClosed) {\n\t\t\tlog.Fatal(\"Couldn't close temporary file %s: %v\", tmpFile.Name(), cerr)\n\t\t}\n\t}()\n\n\tif size <= 0 {\n\t\treturn tmpFile.Name()\n\t}\n\n\t// Fill with size bytes\n\t_, err = tmpFile.Seek(size-1, 0)\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to seek to %d bytes\", size)\n\t}\n\t_, err = tmpFile.Write([]byte{0})\n\tif err != nil {\n\t\tlog.Fatalf(\"Write to %s failed\", tmpFile.Name())\n\t}\n\terr = tmpFile.Close()\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to close %s\", tmpFile.Name())\n\t}\n\n\tt.Logf(\"Created temporary file %s (size: %d bytes)\", tmpFile.Name(), size)\n\n\treturn tmpFile.Name()\n}", "title": "" }, { "docid": "c839922a0dbd8d162e02426a28387982", "score": "0.6592064", "text": "func TempDir(t testing.TB) string {\n\tt.Helper()\n\n\tif IsRunningInSubprocess {\n\t\tdir, err := os.MkdirTemp(\"\", \"LandlockTestTempDir\")\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"os.MkdirTemp: %v\", err)\n\t\t}\n\t\treturn dir\n\t}\n\treturn t.TempDir()\n}", "title": "" }, { "docid": "f5ec43909a898506f91763b2b9773802", "score": "0.6515482", "text": "func TempDir(tb testing.TB, pattern string) (path string, err error) {\n\tpath, err = os.MkdirTemp(\"\", pattern)\n\tif err == nil {\n\t\tCleanup(tb, func() {\n\t\t\tos.RemoveAll(path)\n\t\t})\n\t}\n\treturn path, err\n}", "title": "" }, { "docid": "e8c60693c01414d859fb3c77d11d5ad2", "score": "0.6498334", "text": "func mkTmpDir(path string) (string, error) {\n\treturn ioutil.TempDir(\"\", path)\n}", "title": "" }, { "docid": "2ae41ec733e056b297ea24c024463912", "score": "0.6466927", "text": "func CreateTempFile(originalFilePath string) (*os.File, error) {\n\tfileName := filepath.Base(originalFilePath)\n\ttmpFileName := fmt.Sprintf(\"%s_%s\", tmpFileSuffix, fileName)\n\ttmpFilePath := strings.Replace(originalFilePath, fileName, tmpFileName, 1)\n\treturn os.Create(tmpFilePath)\n}", "title": "" }, { "docid": "3f3b45666925a97acdd9b93bea8a96f6", "score": "0.6466733", "text": "func CreateTempFile(pattern string) string {\n\ttmpfile, _ := ioutil.TempFile(\"\", pattern)\n\tdefer tmpfile.Close()\n\treturn tmpfile.Name()\n}", "title": "" }, { "docid": "2bc43cc01a504866b77ad096f54da60f", "score": "0.6465119", "text": "func TempDir(vfs avfs.VFS, dir, pattern string) (name string, err error) {\n\tif dir == \"\" {\n\t\tdir = vfs.GetTempDir()\n\t}\n\n\tprefix, suffix := prefixAndSuffix(pattern)\n\tnconflict := 0\n\n\tfor i := 0; i < 10000; i++ {\n\t\ttry := Join(dir, prefix+nextRandom()+suffix)\n\t\terr = vfs.Mkdir(try, 0o700)\n\n\t\tif vfs.IsExist(err) {\n\t\t\tnconflict++\n\t\t\tif nconflict > 10 {\n\t\t\t\trandmu.Lock()\n\t\t\t\trandno = reseed()\n\t\t\t\trandmu.Unlock()\n\t\t\t}\n\n\t\t\tcontinue\n\t\t}\n\n\t\tif vfs.IsNotExist(err) {\n\t\t\tif _, err1 := vfs.Stat(dir); vfs.IsNotExist(err) {\n\t\t\t\treturn \"\", err1\n\t\t\t}\n\t\t}\n\n\t\tif err == nil {\n\t\t\tname = try\n\t\t}\n\n\t\tbreak\n\t}\n\n\treturn //nolint:nakedret // Copied from standard library.\n}", "title": "" }, { "docid": "9a965c76bb68af2cd20beab67183c592", "score": "0.6426476", "text": "func CreateTempFile(ctx context.Context, dir, pattern string) (TempFile, error) {\n\treturn Default.CreateTempFile(ctx, dir, pattern)\n}", "title": "" }, { "docid": "48b6199e6ee445b28748be3f9e6ffa77", "score": "0.6425065", "text": "func (d *TempDir) TempDir(prefix string) (*TempDir, error) {\n\tp, err := ioutil.TempDir(d.Dir, prefix)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &TempDir{Dir: p}, nil\n}", "title": "" }, { "docid": "57ffb69896306886f516e5a8899a3ce2", "score": "0.6422004", "text": "func CreateTempDir() (FileSystem, error) {\n\tdir, err := ioutil.TempDir(\"\", \"tmpdir\")\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to create a temporary directory\")\n\t}\n\treturn &osFS{root: dir, tmp: true}, nil\n}", "title": "" }, { "docid": "ed31d3e5c88896c94523cc056a1d4b07", "score": "0.6407029", "text": "func (LocalFS) CreateTempFile(_ context.Context, dir, pattern string) (TempFile, error) {\n\treturn ioutil.TempFile(dir, pattern)\n}", "title": "" }, { "docid": "c19d04c1a2ffb94d618c3d10f82d7eee", "score": "0.6376821", "text": "func CreateDirectory(prefix string) (*Directory, error) {\n\tname, err := ioutil.TempDir(\"\", prefix+\"-\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Directory{\n\t\tName: name,\n\t}, nil\n}", "title": "" }, { "docid": "ff0a54d3fa1f49cc8a4248f5a0c52ba0", "score": "0.6310803", "text": "func CreateTempFile(dirname string, filename string) (*os.File, error) {\n\tfile, err := ioutil.TempFile(dirname, filename+\".*\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// DO NOT ADD defer here, it returns the file pointers to the caller\n\treturn file, nil\n}", "title": "" }, { "docid": "b1922f756239d7cc5445d54bc6c28f6c", "score": "0.6309821", "text": "func TempDir(name string) (string, error) {\n\t_, currentFileName, _, _ := runtime.Caller(0)\n\ttmpDir := filepath.Join(filepath.Dir(currentFileName), \"../../tmp\")\n\terr := os.MkdirAll(tmpDir, 0755)\n\tif err != nil {\n\t\treturn \"nil\", err\n\t}\n\ttmpRoot, err := ioutil.TempDir(tmpDir, \"reva-unit-tests-*-root\")\n\tif err != nil {\n\t\treturn \"nil\", err\n\t}\n\n\treturn tmpRoot, nil\n}", "title": "" }, { "docid": "197f587d23aa6d88726a81529fc6a1e4", "score": "0.62963605", "text": "func mkRandTmpDir(t *testing.T) string {\n\tvar buf bytes.Buffer\n\tfor i := 0; i < 10; i++ {\n\t\tcheckFatal(t, random.WriteRandomBytes(20, &buf))\n\t\trandStr := fmt.Sprintf(\"git-remote-ipfs-test-%x\", buf.String())\n\t\ttmpDir := filepath.Join(\"/\", os.TempDir(), randStr)\n\t\t_, err := os.Stat(tmpDir)\n\t\tif os.IsNotExist(err) {\n\t\t\tcheckFatal(t, os.MkdirAll(tmpDir, 0700))\n\t\t\tt.Logf(\"tmpDir created: %s\", tmpDir)\n\t\t\treturn tmpDir\n\t\t}\n\t\tbuf.Reset()\n\t}\n\tt.Fatal(\"couldnt find a tmpDir\")\n\treturn \"\"\n}", "title": "" }, { "docid": "fa5c61374a0cfc68bc4993c2d57d3989", "score": "0.6253338", "text": "func testTempDir(dir string, keepOld bool) string {\n\tdir = filepath.Join(os.TempDir(), dir)\n\tif !keepOld {\n\t\tif err := os.RemoveAll(dir); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}\n\terr := os.Mkdir(dir, 0700)\n\tif err != nil && !os.IsExist(err) {\n\t\tpanic(err)\n\t}\n\treturn dir\n}", "title": "" }, { "docid": "19a53d4d949ca22940a7624647d24e18", "score": "0.62035555", "text": "func TempDir(dir, prefix string) (string, func(), error) {\n\tpath, err := ioutil.TempDir(dir, prefix)\n\tif err != nil {\n\t\treturn \"\", nil, err\n\t}\n\treturn path, RemoveAllFunc(path), nil\n}", "title": "" }, { "docid": "ec61558a784fa574e98b38ef4d23a3d1", "score": "0.6183353", "text": "func TestTempDir(tb testing.TB) string {\n\ttb.Helper()\n\tname, err := os.MkdirTemp(\"\", \"mtail-test\")\n\tif err != nil {\n\t\ttb.Fatal(err)\n\t}\n\ttb.Cleanup(func() {\n\t\tif err := os.RemoveAll(name); err != nil {\n\t\t\ttb.Fatalf(\"os.RemoveAll(%s): %s\", name, err)\n\t\t}\n\t})\n\treturn name\n}", "title": "" }, { "docid": "7f11b23d3eeb58e9e3faea1269595dde", "score": "0.61662334", "text": "func WriteTempFile(prefix string, data []byte) (string, error) {\n\tfile, err := ioutil.TempFile(\"\", prefix)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer file.Close()\n\n\t_, err = io.Copy(file, bytes.NewReader(data))\n\tif err != nil {\n\t\treturn file.Name(), err\n\t}\n\treturn file.Name(), nil\n}", "title": "" }, { "docid": "2a91c5b8dbb73bb2100a73a79691fdd6", "score": "0.61625206", "text": "func tempfilename(t *testing.T, suffix string) string {\n\tfile := tempfile(t, suffix)\n\n\terr := file.Close()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\terr = os.Remove(file.Name())\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\treturn file.Name()\n}", "title": "" }, { "docid": "7192439bec217cb3bb56d722e673fd11", "score": "0.61548704", "text": "func TempDir(t sktest.TestingT) (string, func()) {\n\td, err := ioutil.TempDir(\"\", \"testutils\")\n\trequire.NoError(t, err)\n\treturn d, func() {\n\t\tRemoveAll(t, d)\n\t}\n}", "title": "" }, { "docid": "37a22a9f4a693e34d0fdc1aef0a13b67", "score": "0.61541015", "text": "func (stdFSManager) TempDir(dir, pattern string) (name string, err error) {\n\treturn ioutil.TempDir(dir, pattern)\n}", "title": "" }, { "docid": "18ab6dbe73b4428fa8bd083ca2ea5ee0", "score": "0.61469", "text": "func MakeTempFS(root, prefix string, files map[string]string) (rootDir string, cleanup func(), err error) {\n\n\trootDir, err = os.MkdirTemp(root, prefix)\n\n\tif err != nil {\n\t\treturn \"\", nil, err\n\t}\n\n\tcleanup = func() {\n\t\tos.RemoveAll(rootDir)\n\t}\n\n\tskipCleanup := false\n\n\t// Cleanup unless flag is unset. It will be unset if we succeed.\n\tdefer func() {\n\t\tif !skipCleanup {\n\t\t\tcleanup()\n\t\t}\n\t}()\n\n\tfor path, content := range files {\n\t\tdirname, filename := filepath.Split(path)\n\t\tdirPath := filepath.Join(rootDir, dirname)\n\t\tif err := os.MkdirAll(dirPath, 0777); err != nil {\n\t\t\treturn \"\", nil, err\n\t\t}\n\n\t\tf, err := os.Create(filepath.Join(dirPath, filename))\n\t\tif err != nil {\n\t\t\treturn \"\", nil, err\n\t\t}\n\n\t\tif _, err := f.WriteString(content); err != nil {\n\t\t\treturn \"\", nil, err\n\t\t}\n\t}\n\n\tskipCleanup = true\n\n\treturn rootDir, cleanup, nil\n}", "title": "" }, { "docid": "c25cbade4ea2b1774d6ec71cfd94c01d", "score": "0.6119147", "text": "func TempDir(t *testing.T) (string, func()) {\n\ttdir, err := ioutil.TempDir(\"\", testPrefix)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\treturn tdir, func() {\n\t\terr = os.RemoveAll(tdir)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "54811ff6582647c387ae863891620daa", "score": "0.6087538", "text": "func (UnsupportedWriter) CreateTempFile(_ context.Context, dir, pattern string) (TempFile, error) {\n\treturn nil, ErrNotSupported\n}", "title": "" }, { "docid": "9f275fb879941373775c3f1652221299", "score": "0.60481614", "text": "func newTempFile(dir, templ string) string {\n\ttempFile, err := ioutil.TempFile(dir, \"*_\"+templ)\n\tif err != nil {\n\t\tlog.Fatalf(\"unable to create temp file fo test. Error: %v\", err)\n\t}\n\tdefer tempFile.Close()\n\treturn tempFile.Name()\n}", "title": "" }, { "docid": "d5b264c2b72c6b15cf68809f7798dffb", "score": "0.6019747", "text": "func TempDirectory(t *testing.T) string {\n\tt.Helper()\n\n\td, err := GetInterestingTempDirectoryName()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tt.Cleanup(func() {\n\t\tif !t.Failed() {\n\t\t\tos.RemoveAll(d) // nolint:errcheck\n\t\t} else {\n\t\t\tt.Logf(\"temporary files left in %v\", d)\n\t\t}\n\t})\n\n\treturn d\n}", "title": "" }, { "docid": "92d8ec2657b0750a20dc0ec59626b73c", "score": "0.60143393", "text": "func createTempfileWithContents(t *testing.T, contents string, extension string) string {\n\tfile, err := os.CreateTemp(\"\", \"*.\"+extension)\n\tif err != nil {\n\t\tt.Fatalf(\"error creating tempfile: %s\", err)\n\t}\n\n\tfile.WriteString(contents)\n\tfile.Close()\n\n\treturn file.Name()\n}", "title": "" }, { "docid": "39f4c34ae06891b1c48fc7bddfd62388", "score": "0.5978219", "text": "func Tempdir(files map[string][]byte) (string, error) {\n\tdir, err := ioutil.TempDir(\"\", \"gopls-tempdir-\")\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tfor name, data := range files {\n\t\tif err := writeFileData(name, data, RelativeTo(dir)); err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"writing to tempdir: %w\", err)\n\t\t}\n\t}\n\treturn dir, nil\n}", "title": "" }, { "docid": "bd7a91b2f8ac2dbc2a1a67e30ebecd9e", "score": "0.5952565", "text": "func (vfs *MemFS) TempDir(dir, prefix string) (name string, err error) {\n\treturn vfsutils.TempDir(vfs, dir, prefix)\n}", "title": "" }, { "docid": "e1608958306d00e86b45ca699b729c84", "score": "0.5946799", "text": "func GetTempDir(prefix string) (string, errors.Error) {\n\treturn DefaultFileSystem.GetTempDir(prefix)\n}", "title": "" }, { "docid": "d0d12f050f42e534564875a59852be0e", "score": "0.59408575", "text": "func createTmpFile() *os.File {\n\tif _, err := os.Stat(\"/tmp\"); os.IsNotExist(err) {\n\t\tos.Mkdir(\"/tmp\", 0777)\n\t}\n\ttmpFile, errTmpFile := ioutil.TempFile(os.TempDir(), \"gpkg-\")\n\tif errTmpFile != nil {\n\t\tlog.Fatal(\"Cannot create temporary file\", errTmpFile)\n\t}\n\tlog.Println(\"Created temporary file: \" + tmpFile.Name())\n\treturn tmpFile\n}", "title": "" }, { "docid": "44598760aef710c746e0f68ca32d3b8e", "score": "0.591274", "text": "func mkTempFile(t *testing.T) *os.File {\n\tf, err := os.Create(filepath.Join(t.TempDir(), \"serial-test\"))\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tt.Cleanup(func() {\n\t\tif err := f.Close(); err != nil {\n\t\t\tt.Error(err)\n\t\t}\n\t})\n\treturn f\n}", "title": "" }, { "docid": "d19f6771a52a69e63bc8ab7ad8309e07", "score": "0.58954924", "text": "func getTempDir() (string, error) {\n\tif tempDir != \"\" {\n\t\treturn tempDir, nil\n\t}\n\n\tvar err error\n\n\ttemp, err = tmp.NewTemp()\n\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"Can't create directory for temporary data: %v\", err)\n\t}\n\n\ttempDir, err = temp.MkDir(\"bibop\")\n\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"Can't create directory for temporary data: %v\", err)\n\t}\n\n\treturn tempDir, nil\n}", "title": "" }, { "docid": "41e1bb23df85888992aee4204e80e67d", "score": "0.58899295", "text": "func MakeTempDir() (dir string, err error) {\n\tdir, err = ioutil.TempDir(\"\", \"\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\treturn dir, err\n}", "title": "" }, { "docid": "cd18c3f64b05bd508770fcf4a5c84c46", "score": "0.58736193", "text": "func tempfile(prefix string) string {\n\tf, err := ioutil.TempFile(\"\", prefix)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tif err := f.Close(); err != nil {\n\t\tpanic(err)\n\t}\n\tif err := os.Remove(f.Name()); err != nil {\n\t\tpanic(err)\n\t}\n\treturn f.Name()\n}", "title": "" }, { "docid": "9cb3efcbbe7f98546a01eba2cd06c968", "score": "0.5867828", "text": "func writeTempFile(s string, _ bool) (string, error) {\n\ttmpDir, err := ioutil.TempDir(\"\", \"ko\")\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tfile, err := ioutil.TempFile(tmpDir, \"out\")\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer file.Close()\n\tif _, err := file.WriteString(filepath.ToSlash(s)); err != nil {\n\t\treturn \"\", err\n\t}\n\treturn file.Name(), nil\n}", "title": "" }, { "docid": "1b5ad05f2328995c95689eaabbd887ef", "score": "0.585607", "text": "func createTempPackageDir(caseName string) (dir, pkg string) {\n\t// Figure out where the local source code for ogletest is.\n\tbuildPkg, err := build.Import(ogletestPkg, \"\", build.FindOnly)\n\tif err != nil {\n\t\tpanic(\"Finding ogletest tree: \" + err.Error())\n\t}\n\n\t// Create a temporary directory underneath this.\n\togletestPkgDir := buildPkg.Dir\n\tprefix := fmt.Sprintf(\"tmp-%s-\", caseName)\n\n\tdir, err = ioutil.TempDir(ogletestPkgDir, prefix)\n\tif err != nil {\n\t\tpanic(\"ioutil.TempDir: \" + err.Error())\n\t}\n\n\tpkg = path.Join(\"github.com/smartystreets/assertions/internal/ogletest\", dir[len(ogletestPkgDir):])\n\treturn\n}", "title": "" }, { "docid": "d0d02b33578148737fc35d0e5915bdf7", "score": "0.5849043", "text": "func getTempDir() (string, error) {\n\tcaller := filepath.Base(os.Args[0])\n\twd, _ := os.Getwd()\n\treturn ioutil.TempDir(wd, caller)\n}", "title": "" }, { "docid": "7ec1e476126e43893c11dd1b6f31723a", "score": "0.58191013", "text": "func tempDir(t *testing.T) (path string, cleanup func()) {\n\tt.Helper()\n\n\tconst tmpDirPrefix = \"event-router-tests\"\n\ttmpDir, err := ioutil.TempDir(\"\", tmpDirPrefix)\n\tif err != nil {\n\t\tt.Fatalf(\"could not create temporary directory: %v\", err)\n\t}\n\n\treturn tmpDir, func() {\n\t\terr = os.RemoveAll(tmpDir)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"could not remove temporary directory: %v\", err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e6596f95677b4631864332c67525ab12", "score": "0.5813639", "text": "func createTempFile(name, ext string) (*os.File, error) {\n\ttFile, err := ioutil.TempFile(\"./img/\", name)\n\tif err != nil {\n\t\tlog.Println(\"Failed to create temp file: \", err)\n\t\treturn nil, err\n\t}\n\tdefer os.Remove(tFile.Name())\n\tfile, err := os.Create(fmt.Sprintf(\"%s.%s\", tFile.Name(), ext))\n\tif err != nil {\n\t\tlog.Println(\"Failed to create file: \", err)\n\t\treturn nil, err\n\t}\n\treturn file, err\n}", "title": "" }, { "docid": "a5fe51304cb621f4e3d9eccd182aee64", "score": "0.5798866", "text": "func (c *OSCommand) CreateTempFile(filename, content string) (string, error) {\n\ttmpfile, err := ioutil.TempFile(\"\", filename)\n\tif err != nil {\n\t\tc.Log.Error(err)\n\t\treturn \"\", WrapError(err)\n\t}\n\n\tif _, err := tmpfile.WriteString(content); err != nil {\n\t\tc.Log.Error(err)\n\t\treturn \"\", WrapError(err)\n\t}\n\tif err := tmpfile.Close(); err != nil {\n\t\tc.Log.Error(err)\n\t\treturn \"\", WrapError(err)\n\t}\n\n\treturn tmpfile.Name(), nil\n}", "title": "" }, { "docid": "5fb90bd680f33e6c32d86d35d8667902", "score": "0.5794785", "text": "func SetUpTempDir(){\n _, err := os.Stat(STORAGE_PATH)\n if(!os.IsExist(err)){\n os.Mkdir(STORAGE_PATH, 0700)\n }\n}", "title": "" }, { "docid": "f371c95906d2ad1b312067144fc0131f", "score": "0.57613367", "text": "func TestDir(t *testing.T, dirPrefix string) string {\n\tt.Helper()\n\n\ttmp, err := ioutil.TempDir(\"\", dirPrefix)\n\tif err != nil {\n\t\tt.Fatalf(\"err: %v\", err)\n\t}\n\n\treturn tmp\n}", "title": "" }, { "docid": "1498a98afda6d0ccdae131bbdbf20f5b", "score": "0.57528776", "text": "func CreateTempFolderForKeptnContext(keptnContext string) error {\n\tpath := MonacoBaseFolder + keptnContext\n\tif _, err := os.Stat(path); os.IsNotExist(err) {\n\t\terrmkdir := os.Mkdir(path, 0755)\n\t\tif errmkdir != nil {\n\t\t\treturn errmkdir\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f8a5d1163ad4e3e987ecb8e49a8ba6e7", "score": "0.5745186", "text": "func createTempKubeConfigDir() error {\n\tconfigDir := GetConfigDir()\n\tkubeConfigDir := path.Join(configDir, \"tmp_kube_config\")\n\t_, err := os.Stat(kubeConfigDir)\n\tif os.IsNotExist(err) {\n\t\tif err := os.MkdirAll(kubeConfigDir, 0o755); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to create temp kubeconfig directory: %v\", err)\n\t\t}\n\t} else if err != nil {\n\t\treturn fmt.Errorf(\"failed to find temp kubeconfig dir %s: %v\", kubeConfigDir, err)\n\t}\n\t// Clear any leftover kubeconfigs from improper shutdowns\n\tif err := os.RemoveAll(kubeConfigDir); err != nil {\n\t\treturn fmt.Errorf(\"failed to clear old kubeconfigs: %v\", err)\n\t}\n\tif err := os.MkdirAll(kubeConfigDir, 0o755); err != nil {\n\t\treturn fmt.Errorf(\"failed to recreate temp kubeconfig directory: %v\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "12b334a62e261b2d91b1bbb2b8759272", "score": "0.5718252", "text": "func New(dir, prefix string) Operator {\n\tdir, err := ioutil.TempDir(dir, prefix)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfm := make(map[string]*TempFile)\n\treturn &TempDir{\n\t\tTempFiles: fm,\n\t\tPath: dir,\n\t}\n}", "title": "" }, { "docid": "e9af3cdaa8517d3a6395a6601835e908", "score": "0.57118213", "text": "func WriteTempFile(filename, data string) (filepath string, err error) {\n\tfilepath = TempDir() + string(os.PathSeparator) + filename\n\terr = ioutil.WriteFile(filepath, []byte(data), 0644)\n\treturn\n}", "title": "" }, { "docid": "a6eb05a6a1fc7443a72273e4c7589cd6", "score": "0.5697878", "text": "func tempfile(t *testing.T, suffix string) *os.File {\n\tfile, err := ioutil.TempFile(\"\", \"stdfd\"+suffix)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\treturn file\n}", "title": "" }, { "docid": "37683fed1bdc5f4be4d152e817434415", "score": "0.5693164", "text": "func TempFileName(dbname string, number uint64) string {\n\tif number <= 0 {\n\t\tdebug.Panic(\"tmpfile number should > 0\")\n\t}\n\treturn makeFileName(dbname, number, \"dbtmp\")\n}", "title": "" }, { "docid": "27581e8d53339c2ce19932500aab83f7", "score": "0.56748605", "text": "func (cmh *CertManagerHelper) writeTempFile(content string, prefix string) (*string, derrors.Error) {\n\ttmpfile, err := ioutil.TempFile(cmh.config.TempPath, prefix)\n\tif err != nil {\n\t\treturn nil, derrors.AsError(err, \"cannot create temporal file\")\n\t}\n\t_, err = tmpfile.Write([]byte(content))\n\tif err != nil {\n\t\treturn nil, derrors.AsError(err, \"cannot write temporal file\")\n\t}\n\terr = tmpfile.Close()\n\tif err != nil {\n\t\treturn nil, derrors.AsError(err, \"cannot close temporal file\")\n\t}\n\ttmpName := tmpfile.Name()\n\treturn &tmpName, nil\n}", "title": "" }, { "docid": "c67811e613fa6f6580901ac58f3340c8", "score": "0.56700444", "text": "func CreateTempEnv(t *testing.T, copyEncryptionKey bool) (cleanUp func()) {\n\ttmpDir, err := ioutil.TempDir(\"\", \"config_test\")\n\tassert.NoError(t, err)\n\toldHome := os.Getenv(coreutils.HomeDir)\n\tassert.NoError(t, os.Setenv(coreutils.HomeDir, tmpDir))\n\tcopyResources(t, certsConversionResources, tmpDir)\n\tif copyEncryptionKey {\n\t\tcopyResources(t, encryptionResources, tmpDir)\n\t}\n\treturn func() {\n\t\tos.RemoveAll(tmpDir)\n\t\tos.Setenv(coreutils.HomeDir, oldHome)\n\t}\n}", "title": "" }, { "docid": "0d4fbf04d3d57474ede4cd7e2425bbed", "score": "0.5668368", "text": "func CreateTempFile(content string, t *testing.T) *os.File {\n\ttmpfile, err := ioutil.TempFile(\"\", \"temp-quiz-test-file\")\n\tif err != nil {\n\t\tt.Errorf(\n\t\t\t\"could not create temp file '%s' because '%v'\\n\",\n\t\t\ttmpfile.Name(), err)\n\t}\n\n\terr = ioutil.WriteFile(tmpfile.Name(), []byte(content), 0644)\n\tif err != nil {\n\t\tt.Errorf(\n\t\t\t\"could not write '%v' to temp file '%s'\\n\",\n\t\t\tcontent, err)\n\t}\n\n\t_, err = tmpfile.Seek(0, 0)\n\tif err != nil {\n\t\tt.Errorf(\n\t\t\t\"could not seek to beginning of '%s' because '%v'\\n\",\n\t\t\ttmpfile.Name(), err)\n\t}\n\n\treturn tmpfile\n}", "title": "" }, { "docid": "0beb8ad400e355b55730016a16277761", "score": "0.5637108", "text": "func tempnam() string {\n\tb := make([]byte, 8)\n\trand.Read(b)\n\treturn fmt.Sprintf(\"/tmp/%x\", b)\n}", "title": "" }, { "docid": "80977e933f7f3c108d73ff8bae9bc33c", "score": "0.56226045", "text": "func CreateTmpFile(contents string) (string, error) {\n\ttmpfile, err := os.CreateTemp(\"\", \"epinio\")\n\tif err != nil {\n\t\treturn tmpfile.Name(), err\n\t}\n\tif _, err := tmpfile.Write([]byte(contents)); err != nil {\n\t\treturn tmpfile.Name(), err\n\t}\n\tif err := tmpfile.Close(); err != nil {\n\t\treturn tmpfile.Name(), err\n\t}\n\n\treturn tmpfile.Name(), nil\n}", "title": "" }, { "docid": "de8532ab20bc786a7514b0f43019e42c", "score": "0.5620507", "text": "func (td testDataDir) tempDir(tb testing.TB) (string, func()) {\n\ttb.Helper()\n\n\tpath, err := os.MkdirTemp(td.root, \"\")\n\tassert.OK(tb, err)\n\n\t// Log it to make debugging easier.\n\ttb.Logf(\"created tempdir at %s\", path)\n\n\treturn path, func() {\n\t\ttb.Helper()\n\n\t\terr := os.RemoveAll(path)\n\t\tassert.OK(tb, err)\n\t}\n}", "title": "" }, { "docid": "0861cc41df63ed0e7fc6017bcacabc06", "score": "0.56163776", "text": "func WithTempDir(prefix string, f func(tmpDir string) errors.Error) errors.Error {\n\treturn DefaultFileSystem.WithTempDir(prefix, f)\n}", "title": "" }, { "docid": "bbd056193dd993a14dbfba62c8e92d70", "score": "0.5596983", "text": "func GetTempFile(fileName string) string {\n\treturn filepath.Join(os.TempDir(), fileName)\n}", "title": "" }, { "docid": "ffc327afba8a4cc024748179fc681df8", "score": "0.55894256", "text": "func WriteKeyTempFile(namePrefix string, keyData []byte) (filename string, tmp *os.File, err error) {\n\thasher := sha256.New()\n\thasher.Write([]byte(namePrefix))\n\thash := base64.URLEncoding.EncodeToString(hasher.Sum(nil))\n\n\ttmpfile, err := ioutil.TempFile(\"\", \"go-vcs-\"+hash+\"-\")\n\tif err != nil {\n\t\treturn \"\", nil, err\n\t}\n\n\tfilename, err = writeKeyTempFile0(tmpfile, keyData)\n\treturn filename, tmpfile, err\n}", "title": "" }, { "docid": "ccfab5b1a94ed59a0a6672772054270d", "score": "0.55797464", "text": "func TempFile(prefix string) (string, error) {\n\tf, err := ioutil.TempFile(\"\", prefix)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to create temp file: %v\", err)\n\t}\n\tf.Close()\n\treturn f.Name(), nil\n}", "title": "" }, { "docid": "a6e1ce9b2565fcbb819cbfb6777308fb", "score": "0.55769426", "text": "func temporaryDirectoryPath(pathElements ...string) string {\n\treturn path.Join(append([]string{os.TempDir(), \"helm-s3\"}, pathElements...)...)\n}", "title": "" }, { "docid": "55d3045a31524fb6812a4187a870736c", "score": "0.5570474", "text": "func randomTempPath() string {\n\treturn os.TempDir() + string(os.PathSeparator) + uuid.New()\n}", "title": "" }, { "docid": "8d324f73ec1e5744bf945cbb634b2ef9", "score": "0.5564104", "text": "func TestMkdirTempBadDir(t *testing.T) {\n\tdir, err := MkdirTemp(\"\", \"MkdirTempBadDir\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdefer RemoveAll(dir)\n\n\tbadDir := filepath.Join(dir, \"not-exist\")\n\t_, err = MkdirTemp(badDir, \"foo\")\n\tif pe, ok := err.(*fs.PathError); !ok || !IsNotExist(err) || pe.Path != badDir {\n\t\tt.Errorf(\"TempDir error = %#v; want PathError for path %q satisifying IsNotExist\", err, badDir)\n\t}\n}", "title": "" }, { "docid": "668de0ddd350e649662e174a3bb9b3ba", "score": "0.5546271", "text": "func (pocket PocketDispatcher) CreateDir(src_filename string, jobid string) int {\n\tif jobid != \"\" {\n\t\tjobid = \"/\" + jobid\n\t}\n\n\tif src_filename != \"\" {\n\t\tsrc_filename = jobid + \"/\" + src_filename\n\t} else {\n\t\tsrc_filename = jobid\n\t}\t\n\n\treturn pocket.MakeDir(src_filename)\n}", "title": "" }, { "docid": "69a23da7d2f82990ae22fc17b71a6906", "score": "0.5534606", "text": "func (db *impl) getTempDir() (dir string, err error) {\n\troot := db.opts.GetRootTempDir()\n\tif err = os.MkdirAll(root, tempDirMode); err != nil && !os.IsExist(err) {\n\t\treturn\n\t}\n\tdir, err = ioutil.TempDir(root, tempDirPrefix)\n\tif !strings.HasSuffix(dir, PathSeparator) {\n\t\tdir += PathSeparator\n\t}\n\treturn\n}", "title": "" }, { "docid": "9b42042fa19650681e7f9ab41522631d", "score": "0.5530346", "text": "func TempDir() (string, error) {\n\treturn ioutil.TempDir(\"\", \"\")\n}", "title": "" }, { "docid": "4047a812cf777742823d642f62cdf2af", "score": "0.55226415", "text": "func createTimePath(outputPath string, t time.Time) (string, error) {\n\tdir := outputPath + \"/\" + t.Format(\"2006/01/02\") + \"/\"\n\terr := os.MkdirAll(dir, 0777)\n\treturn dir, err\n}", "title": "" }, { "docid": "7317e8a35bd72b8df3dac25d4765f5a8", "score": "0.5507271", "text": "func TempDirInDir(tb testing.TB, dir string, pattern string) (path string, err error) {\n\tpath, err = os.MkdirTemp(dir, pattern)\n\tif err == nil {\n\t\tCleanup(tb, func() {\n\t\t\tos.RemoveAll(path)\n\t\t})\n\t}\n\treturn path, err\n}", "title": "" }, { "docid": "c7d7f90dfd858e6f2c353fedfa48df9c", "score": "0.5503459", "text": "func WithTempDir(t *testing.T, prefix string, fn func(string) error) error {\n\ttd := filesystem.TempDir{\n\t\tPrefix: prefix,\n\t\tCleanupErrFunc: func(tdir string, err error) {\n\t\t\tt.Errorf(\"failed to remove temporary directory [%s]: %s\", tdir, err)\n\t\t},\n\t}\n\treturn td.With(fn)\n}", "title": "" }, { "docid": "ed468d6650062d582082684655fb2bb7", "score": "0.5502404", "text": "func getTempDirPath() (string, error) {\n\ttempDir := os.TempDir()\n\t_, err := os.Stat(tempDir)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn tempDir, nil\n}", "title": "" }, { "docid": "18c25f654c4e28f1a21005d0125db4ce", "score": "0.5498112", "text": "func TempFile(dir, prefix string) (f *os.File, err error) {\n\treturn ioutil.TempFile(dir, prefix)\n}", "title": "" }, { "docid": "daea4d4b5df9ba6aa0dec120af8b2132", "score": "0.54881763", "text": "func newDir(t *testing.T) (string, func()) {\n\tt.Helper()\n\n\tdir, err := ioutil.TempDir(\"\", \"dqlite-replication-test-\")\n\tassert.NoError(t, err)\n\n\tcleanup := func() {\n\t\t_, err := os.Stat(dir)\n\t\tif err != nil {\n\t\t\tassert.True(t, os.IsNotExist(err))\n\t\t} else {\n\t\t\tassert.NoError(t, os.RemoveAll(dir))\n\t\t}\n\t}\n\n\treturn dir, cleanup\n}", "title": "" }, { "docid": "3b265a9d9367d4c4851ac19f07d252ff", "score": "0.5482622", "text": "func mktempFile(dir string) (func(), string, error) {\n\tfile, err := ioutil.TempFile(dir, \"repo.*\")\n\treturn func() {\n\t\tif err := os.Remove(file.Name()); err != nil {\n\t\t\tlogrus.Fatal(err)\n\t\t}\n\t}, file.Name(), err\n}", "title": "" }, { "docid": "be240af8be752d720d3306c47833c464", "score": "0.5471391", "text": "func (d *TempDir) TempFile(prefix string) (*os.File, error) {\n\treturn ioutil.TempFile(d.Dir, prefix)\n}", "title": "" }, { "docid": "7b8f495cf956e7373dd4c3dfe5f3c052", "score": "0.5466972", "text": "func tmpFileName(t *testing.T) string {\n\ttf, err := ioutil.TempFile(\"\", \"go-test-reopen-file-*\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\t_ = tf.Close()\n\treturn t.Name()\n}", "title": "" }, { "docid": "a229a62f2001b8a0ed6a6c6630c64e37", "score": "0.54608846", "text": "func tempfilename(t *testing.T) string {\n\tfile, err := ioutil.TempFile(\"\", \"pidfile-test\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\terr = file.Close()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\terr = os.Remove(file.Name())\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\treturn file.Name()\n}", "title": "" }, { "docid": "83fa4d3d69ab445088daf818e05384e9", "score": "0.54359037", "text": "func CreateDirectory(dir string) error {\n\tdirs := []string{\n\t\tdir,\n\t\tfilepath.Join(dir, \"data\"),\n\t\tfilepath.Join(dir, \"quarantine\"),\n\t}\n\tfor _, d := range dirs {\n\t\terr := os.Mkdir(d, 0777)\n\t\tif err != nil && !os.IsExist(err) {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tf, err := os.OpenFile(filepath.Join(dir, \"uuid\"),\n\t\tos.O_WRONLY|os.O_CREATE|os.O_EXCL, 0666)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = f.Write([]byte(uuid.Fmt(uuid.Gen4())))\n\tif err != nil {\n\t\tf.Close()\n\t\treturn err\n\t}\n\n\treturn f.Close()\n}", "title": "" }, { "docid": "6c33e1c31da3195094d8fa1f50a73513", "score": "0.54226255", "text": "func TempPath(pathInTmp string) string {\n\tpathInTmp = strings.Replace(pathInTmp, \"*\", strconv.Itoa(rand.Int()), 1)\n\treturn filepath.Join(tempDir, pathInTmp)\n}", "title": "" }, { "docid": "567b86e5095cc810d5aee2507412bdac", "score": "0.54208684", "text": "func RandTempPath() string {\n\treturn filepath.Join(os.TempDir(), RandFileName())\n}", "title": "" }, { "docid": "8f705da6bd581924a403f233fe3ef346", "score": "0.54121345", "text": "func downloadToTempFile(fileUrl string) string {\n\treader, err := downloadURL(fileUrl)\n\tutil.CheckErr(err, fmt.Sprintf(\"download from url: %v\", fileUrl))\n\tdefer reader.Close()\n\n\ttmpDir, err := utils.GetTempDir()\n\tutil.CheckErr(err, \"create temp directory\")\n\n\ttmpFilename := uuid.NewV4().String()\n\tdestination := filepath.Join(tmpDir, tmpFilename)\n\terr = os.Mkdir(tmpDir, 0744)\n\tutil.CheckErr(err, \"create temp directory\")\n\n\terr = writeArchiveToFile(destination, reader)\n\tutil.CheckErr(err, \"write archive to file\")\n\n\treturn destination\n}", "title": "" }, { "docid": "61d2b50579d61f3a5e98ae5ecd0f1a1c", "score": "0.540956", "text": "func WriteTempFile(name string, data []byte, perm os.FileMode) (string, error) {\n\t// create hidden file in user's home dir to ensure no other users have write access\n\ttmpFile, err := ioutil.TempFile(HomeDir(), fmt.Sprintf(\".%s.\", name))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tLogDebug(fmt.Sprintf(\"Writing to temp file %s\", tmpFile.Name()))\n\tif _, err := tmpFile.Write(data); err != nil {\n\t\treturn \"\", err\n\t}\n\n\ttmpFileName := tmpFile.Name()\n\tif err := tmpFile.Close(); err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif err := os.Chmod(tmpFileName, perm); err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn tmpFileName, nil\n}", "title": "" }, { "docid": "0a7c768317cfa13f813009c97fbdc993", "score": "0.54061884", "text": "func createWorkingDir(testName, testDataPath string) (string, func(), error) {\n\twd, err := os.Getwd()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tworkingPath := path.Join(wd, \"testdata\", \".working\")\n\tif _, err := os.Stat(workingPath); os.IsNotExist(err) {\n\t\tos.Mkdir(workingPath, os.ModePerm)\n\t}\n\tworkingDir, err := ioutil.TempDir(workingPath, testName)\n\tif err != nil {\n\t\treturn \"\", func() {}, err\n\t}\n\tcopyFolder(testDataPath, workingDir)\n\treturn workingDir, func() {\n\t\tos.RemoveAll(workingDir)\n\t}, nil\n}", "title": "" }, { "docid": "984ebddce069e322a1d7c37495e33b4c", "score": "0.54022884", "text": "func prepareTempDirectory() (string, string, error) {\n\t// Creating a temp directory and remove it after the test:\n\trootPath, err := ioutil.TempDir(\"\", \"test\")\n\tdefer os.RemoveAll(rootPath)\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\t// Create a path in the temp directory, the following path to a folder will not exist:\n\tnotExistingFolderPath := path.Join(rootPath, \"testDirectory\")\n\treturn notExistingFolderPath, rootPath, nil\n}", "title": "" }, { "docid": "984ebddce069e322a1d7c37495e33b4c", "score": "0.54022884", "text": "func prepareTempDirectory() (string, string, error) {\n\t// Creating a temp directory and remove it after the test:\n\trootPath, err := ioutil.TempDir(\"\", \"test\")\n\tdefer os.RemoveAll(rootPath)\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\t// Create a path in the temp directory, the following path to a folder will not exist:\n\tnotExistingFolderPath := path.Join(rootPath, \"testDirectory\")\n\treturn notExistingFolderPath, rootPath, nil\n}", "title": "" }, { "docid": "7cbbd43a1079fcb281f823d8f6efb005", "score": "0.5389852", "text": "func CopyToTemporaryDirectory(t *testing.T, src string) (string, func()) {\n\tnewPath, err := ioutil.TempDir(\"\", \"*\")\n\tif err != nil {\n\t\tt.Fatalf(\"Failed to create temporary directory %s\", err.Error())\n\t}\n\n\tif err = copy.Copy(src, newPath); err != nil {\n\t\tt.Fatalf(\"Failed to copy contents from %s to %s %s\", src, newPath, err.Error())\n\t}\n\n\tcleanup := func() {\n\t\terr := os.RemoveAll(newPath)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Failed to cleanup data %s\", err.Error())\n\t\t}\n\t}\n\n\treturn newPath, cleanup\n}", "title": "" }, { "docid": "151fadfe466bc4332c2ae9afbbc045dc", "score": "0.53751546", "text": "func TempDirConfig(conf config.Config) config.Config {\n\tos.Mkdir(\"./test_tmp\", os.ModePerm)\n\tf, _ := ioutil.TempDir(\"./test_tmp\", \"funnel-test-\")\n\tconf.Scheduler.Node.WorkDir = f\n\tconf.Worker.WorkDir = f\n\tconf.Server.Databases.BoltDB.Path = path.Join(f, \"funnel.db\")\n\treturn conf\n}", "title": "" }, { "docid": "39d41ef40ca6f6979499659d361472cd", "score": "0.53336316", "text": "func (s *XLSuite) makeOneNamedTestDirectory(c *C, rng *xr.PRNG,\n\tname string, depth, width int) string {\n\n\tname = strings.TrimSpace(name)\n\tdirPath := fmt.Sprintf(\"tmp/%s\", name)\n\tif strings.Contains(dirPath, \"..\") {\n\t\tmsg := fmt.Sprintf(\"directory name '%s' contains a double-dot\\n\", name)\n\t\tpanic(msg)\n\t}\n\terr := os.RemoveAll(dirPath)\n\tc.Assert(err, IsNil)\n\t// max/minLen\n\trng.NextDataDir(dirPath, depth, width, 32, 1)\n\treturn dirPath\n}", "title": "" }, { "docid": "08781012946599caa41ba5317d7da832", "score": "0.53294826", "text": "func TempFile(t *testing.T, prefix string) *os.File {\n\tf, err := ioutil.TempFile(\"\", prefix)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\treturn f\n}", "title": "" }, { "docid": "d96725f4908d503d25fcae3e51caa860", "score": "0.5328579", "text": "func setupTmpHomeWithCredentials() (string, error) {\n\ttmpDuffleHome, err := ioutil.TempDir(\"\", \"dufflehome\")\n\tif err != nil {\n\t\treturn tmpDuffleHome, err\n\t}\n\n\tcredentialsDir := filepath.Join(tmpDuffleHome, \"credentials\")\n\tif err := os.MkdirAll(filepath.Join(tmpDuffleHome, \"credentials\"), 0755); err != nil {\n\t\treturn tmpDuffleHome, err\n\t}\n\tif err := setupCredentialsDir(credentialsDir); err != nil {\n\t\treturn tmpDuffleHome, err\n\t}\n\n\treturn tmpDuffleHome, nil\n}", "title": "" }, { "docid": "298336ff2db0117deeabf95788999479", "score": "0.528266", "text": "func (d *TempDir) FixedDir(name string) (*TempDir, error) {\n\tif strings.ContainsRune(name, os.PathSeparator) {\n\t\treturn nil, fmt.Errorf(\"temp.TempDir.FixedDir: Invalid name %v\", name)\n\t}\n\tp := path.Join(d.Dir, name)\n\tif err := os.MkdirAll(p, 0777); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &TempDir{p}, nil\n}", "title": "" }, { "docid": "2fcafc1b602d360e3560d968c6abea1f", "score": "0.52712554", "text": "func TempFile(t *testing.T, size int64) (string, func()) {\n\tfp, err := ioutil.TempFile(\".\", testPrefix)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdefer fp.Close()\n\n\tif size > 0 {\n\t\tFill(t, fp, size)\n\t}\n\tname := fp.Name()\n\treturn name, func() {\n\t\terr := os.Remove(name)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b135fb93e03fe4d55453958e07f2ea5f", "score": "0.5270438", "text": "func getTmpDirectory() (string, error) {\n\tvar (\n\t\tdir string\n\t\terr error\n\t)\n\t// If a temp dir is referenced, return that.\n\tif os.Getenv(\"E2E_TEMP_DIR\") != \"\" {\n\t\tdir = os.Getenv(\"E2E_TEMP_DIR\")\n\t} else {\n\t\tdir, err = os.Getwd()\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t}\n\n\ttmpDir, err := os.MkdirTemp(dir, \"e2e_\")\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tabsDir, err := filepath.Abs(tmpDir)\n\tif err != nil {\n\t\t_ = os.RemoveAll(tmpDir)\n\t\treturn \"\", err\n\t}\n\n\treturn absDir, nil\n}", "title": "" } ]
7431b5e84823834d58c2e96331dfd720
Validate validates this io k8s api networking v1 IP block
[ { "docid": "1a687cc7fece268e1f63d50e8a72d67a", "score": "0.7565395", "text": "func (m *IoK8sAPINetworkingV1IPBlock) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateCidr(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" } ]
[ { "docid": "af1e4a493a0306448aa38ac5ba287fc7", "score": "0.65954185", "text": "func ValidateIP(r *http.Request, allow string, block string) bool {\n\tallowed := false\n\tallowSize := uint32(0)\n\n\tallowList := strings.Split(allow, \",\")\n\tfor _, net := range allowList {\n\t\tif v, size := requestInNet(r, net); v {\n\t\t\tallowed = true\n\t\t\tif size > allowSize {\n\t\t\t\tallowSize = size\n\t\t\t}\n\t\t}\n\t}\n\n\tblockList := strings.Split(block, \",\")\n\tfor _, net := range blockList {\n\t\tif v, size := requestInNet(r, net); v {\n\t\t\tif size > allowSize {\n\t\t\t\tallowed = false\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\tif !allowed {\n\t\tIncrementMetric(\"uadmin/security/blockedip\")\n\t}\n\treturn allowed\n}", "title": "" }, { "docid": "c23b51429240c6a10b1e58ed25d53089", "score": "0.6451862", "text": "func (a *VIPAddress) Validate() error {\n\tif a.IP == \"\" {\n\t\treturn fmt.Errorf(\"an 'ip' is mandatory for every 'addresses'\")\n\t}\n\tif a.VrId < 1 || a.VrId > 255 {\n\t\treturn fmt.Errorf(\"invalid 'vr_id' should be between 1 and 255, got '%d'\", a.VrId)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "226bd3612678eefa72a74ebfe376a764", "score": "0.6168228", "text": "func (v *IPAddressType) Validate() error {\n\n\treturn nil\n}", "title": "" }, { "docid": "2814bd4fec7ef5be87f5034029c6a2da", "score": "0.61667526", "text": "func (v *NotIPAddressType) Validate() error {\n\n\treturn nil\n}", "title": "" }, { "docid": "f863497d56a5d8ff1141b3262bcc938e", "score": "0.60002273", "text": "func validateVIPs(p *openstack.Platform, ci *CloudInfo, fldPath *field.Path) (allErrs field.ErrorList) {\n\t// If the subnet is not found in the CloudInfo object, abandon validation\n\tif ci.MachinesSubnet != nil {\n\t\tfor _, allocationPool := range ci.MachinesSubnet.AllocationPools {\n\t\t\tstart := net.ParseIP(allocationPool.Start)\n\t\t\tend := net.ParseIP(allocationPool.End)\n\n\t\t\t// If the allocation pool is undefined, abandon validation\n\t\t\tif start == nil || end == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tfor _, apiVIPString := range p.APIVIPs {\n\t\t\t\tapiVIP := net.ParseIP(apiVIPString)\n\t\t\t\tif bytes.Compare(start, apiVIP) <= 0 && bytes.Compare(end, apiVIP) >= 0 {\n\t\t\t\t\tallErrs = append(allErrs, field.Invalid(fldPath.Child(\"apiVIPs\"), apiVIPString, \"apiVIP can not fall in a MachineNetwork allocation pool\"))\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tfor _, ingressVIPString := range p.IngressVIPs {\n\t\t\t\tingressVIP := net.ParseIP(ingressVIPString)\n\t\t\t\tif bytes.Compare(start, ingressVIP) <= 0 && bytes.Compare(end, ingressVIP) >= 0 {\n\t\t\t\t\tallErrs = append(allErrs, field.Invalid(fldPath.Child(\"ingressVIPs\"), ingressVIPString, \"ingressVIP can not fall in a MachineNetwork allocation pool\"))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn allErrs\n}", "title": "" }, { "docid": "5e19071740fab061da10ed244050fd94", "score": "0.59313864", "text": "func (b Box) Validate() error {\n\tif b.Name == \"\" {\n\t\treturn errors.New(\"setting a name for the box is required\")\n\t}\n\n\tif !govalidator.IsIP(b.IP) {\n\t\tgui.Warn(\"invalid IP address\", b.IP)\n\t\tb.IP = gui.InputPromptWithResponse(\"what is its IP?\", \"\", true)\n\t\tif !govalidator.IsIP(b.IP) {\n\t\t\treturn errors.New(b.IP + \" is not a valid IP address\")\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "8f5ce506de54d92f81d780bc5ce11e46", "score": "0.58596265", "text": "func (ref VirtualRouterNetworkIpamRef) Validate() error {\n\tif len(ref.GetAttr().GetAllocationPools()) == 0 {\n\t\treturn errors.Errorf(\"no allocation-pools for this vrouter\")\n\t}\n\n\tvrSubnets := ref.GetAttr().GetSubnet()\n\tfor _, vrSubnet := range vrSubnets {\n\t\tif err := vrSubnet.Validate(); err != nil {\n\t\t\treturn errors.Errorf(\"couldn't validate vrouter subnet: %v\", err)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "88ced0e5931b2067a3eeb0064003853e", "score": "0.5844732", "text": "func (m *IPSecurityPolicy) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateIPBlock(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c502344d83f36cada0d71cd7d0a30d39", "score": "0.58396983", "text": "func (e ErrParseIP) BadRequest() {}", "title": "" }, { "docid": "78c31c970c766478d819d4488a7fe872", "score": "0.5718182", "text": "func (ipAddressStrategy) Validate(ctx context.Context, obj runtime.Object) field.ErrorList {\n\tipAddress := obj.(*networking.IPAddress)\n\terr := validation.ValidateIPAddress(ipAddress)\n\treturn err\n}", "title": "" }, { "docid": "c72b0a699b623651ffa21a1fffc09beb", "score": "0.5688853", "text": "func (ref VirtualRouterNetworkIpamRef) ValidateLinkToIpam(netIpam *NetworkIpam) error {\n\t// read data on the link between vrouter and ipam\n\t// if alloc pool exists, then make sure that alloc-pools are\n\t// configured in ipam subnet with a flag indicating\n\t// vrouter specific allocation pool\n\n\tvrAllocPools := ref.GetVrouterSpecificAllocationPools()\n\tfor _, vrAllocPool := range vrAllocPools {\n\t\tif !netIpam.ContainsAllocationPool(vrAllocPool) {\n\t\t\treturn errors.Errorf(\"vrouter allocation-pool start:%s, end %s not in ipam %s\",\n\t\t\t\tvrAllocPool.GetStart(), vrAllocPool.GetEnd(), netIpam.GetUUID())\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "978a1946a118d311e52a2e24643f4033", "score": "0.56622535", "text": "func (m *Ipsec) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateLinks(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateReplayWindow(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8e77277022dcf48d5673a773faf1bdf0", "score": "0.56344163", "text": "func (m *IP) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateLat(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateLon(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b1c91832aa10677422db7ffc06374908", "score": "0.5607506", "text": "func (o *GetIPAMIpsSubnetIDOKBody) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := o.validateIps(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6f828414150f134948ec3de85fd025f5", "score": "0.5590676", "text": "func validateCustomResource(instance *operatorv1.Installation) error {\n\tif instance.Spec.CalicoNetwork != nil {\n\t\tif len(instance.Spec.CalicoNetwork.IPPools) > 1 {\n\t\t\treturn fmt.Errorf(\"With CalicoNetwork only one IPPool is allowed\")\n\t\t}\n\t\tif len(instance.Spec.CalicoNetwork.IPPools) == 1 {\n\t\t\tpool := instance.Spec.CalicoNetwork.IPPools[0]\n\t\t\t_, _, err := net.ParseCIDR(pool.CIDR)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"ipPool.CIDR(%s) is invalid: %s\", pool.CIDR, err)\n\t\t\t}\n\n\t\t\tvalid := false\n\t\t\tfor _, t := range operatorv1.EncapsulationTypes {\n\t\t\t\tif pool.Encapsulation == t {\n\t\t\t\t\tvalid = true\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !valid {\n\t\t\t\treturn fmt.Errorf(\"%s is invalid for ipPool.encapsulation, should be one of %s\", pool.Encapsulation,\n\t\t\t\t\tstrings.Join(operatorv1.EncapsulationTypesString, \",\"))\n\t\t\t}\n\n\t\t\tvalid = false\n\t\t\tfor _, t := range operatorv1.NATOutgoingTypes {\n\t\t\t\tif pool.NATOutgoing == t {\n\t\t\t\t\tvalid = true\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !valid {\n\t\t\t\treturn fmt.Errorf(\"%s is invalid for ipPool.natOutgoing, should be one of %s\", pool.NATOutgoing,\n\t\t\t\t\tstrings.Join(operatorv1.NATOutgoingTypesString, \",\"))\n\t\t\t}\n\n\t\t\tif pool.NodeSelector == \"\" {\n\t\t\t\treturn fmt.Errorf(\"ipPool.nodeSelector, should not be empty\")\n\t\t\t}\n\t\t}\n\n\t\tif instance.Spec.CalicoNetwork.NodeAddressAutodetectionV4 != nil {\n\t\t\terr := validateNodeAddressDetection(instance.Spec.CalicoNetwork.NodeAddressAutodetectionV4)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t}\n\t\tif instance.Spec.CalicoNetwork.NodeAddressAutodetectionV6 != nil {\n\t\t\terr := validateNodeAddressDetection(instance.Spec.CalicoNetwork.NodeAddressAutodetectionV6)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "655ba0e95c0d62691ec3fd09fa096777", "score": "0.5575525", "text": "func (a *ASNRequest) Valid() bool {\n\tif ip := net.ParseIP(a.Address); ip == nil {\n\t\treturn false\n\t}\n\tif _, _, err := net.ParseCIDR(a.Prefix); err != nil {\n\t\treturn false\n\t}\n\tfor _, netblock := range a.Netblocks.Slice() {\n\t\tif _, _, err := net.ParseCIDR(netblock); err != nil {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "4e3ee12231a16214c2b15a41bac01969", "score": "0.55706865", "text": "func (m *NetworkV1Request) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateAws(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateAzure(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateGcp(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateMock(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateOutboundInternetTraffic(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7d04805172ba84469e94e8d5b2a27d1c", "score": "0.5567113", "text": "func (m *ApplicationSanAccessIscsiEndpointInlineInterfaceInlineIP) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateAddress(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "526d208bf60bed24af4d4212ad2fb144", "score": "0.5556698", "text": "func (m *AwsKmsInlineAmazonReachability) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "0865aee531106ccfde30dd666bfe3dc5", "score": "0.5545957", "text": "func validIPAddress(IP string) string {\n\tfor _, c := range IP {\n\t\tif c == '.' {\n\t\t\treturn isIPv4(IP)\n\t\t} else if c == ':' {\n\t\t\treturn isIPv6(IP)\n\t\t}\n\t}\n\n\treturn neither\n}", "title": "" }, { "docid": "f2cf08fbd7be85e8d7b95247148a11d0", "score": "0.55254275", "text": "func (c *controlPlane) Validate() error {\n\tif len(c.PublicAddress) < 3 {\n\t\treturn errors.New(\"must specify a unique cluster name\")\n\t}\n\n\tif len(c.PublicAddress) != len(c.PrivateAddress) {\n\t\treturn errors.New(\"number of public addresses must be equal to number of private addresses\")\n\t}\n\n\tif len(c.PublicAddress) < 3 {\n\t\treturn errors.New(\"must specify at least three public addresses\")\n\t}\n\n\tfor i := 0; i < len(c.PublicAddress); i++ {\n\t\tif len(c.PublicAddress[i]) == 0 {\n\t\t\treturn errors.Errorf(\"public address for host %d is empty\", i+1)\n\t\t}\n\n\t\tif len(c.PrivateAddress[i]) == 0 {\n\t\t\treturn errors.Errorf(\"private address for host %d is empty\", i+1)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "4e113c31783c010431f83adc345b65c6", "score": "0.5522663", "text": "func validateVNET(a *Properties) error {\n\n\tn := a.NetworkProfile\n\n\t// validate network profile settings\n\tif n != nil {\n\t\tswitch n.NetworkPlugin {\n\t\tcase Azure, Kubenet:\n\t\t\tif n.ServiceCidr != \"\" && n.DNSServiceIP != \"\" && n.DockerBridgeCidr != \"\" {\n\t\t\t\t// validate ServiceCidr\n\t\t\t\t_, serviceCidr, err := net.ParseCIDR(n.ServiceCidr)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn ErrorInvalidServiceCidr\n\t\t\t\t}\n\n\t\t\t\t// validate ServiceCidr not too large\n\t\t\t\tvar ones, bits = serviceCidr.Mask.Size()\n\t\t\t\tif bits-ones > 20 {\n\t\t\t\t\treturn ErrorServiceCidrTooLarge\n\t\t\t\t}\n\n\t\t\t\t// validate DNSServiceIP\n\t\t\t\tdnsServiceIP := net.ParseIP(n.DNSServiceIP)\n\t\t\t\tif dnsServiceIP == nil {\n\t\t\t\t\treturn ErrorInvalidDNSServiceIP\n\t\t\t\t}\n\n\t\t\t\t// validate DockerBridgeCidr\n\t\t\t\t_, _, err = net.ParseCIDR(n.DockerBridgeCidr)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn ErrorInvalidDockerBridgeCidr\n\t\t\t\t}\n\n\t\t\t\t// validate DNSServiceIP is within ServiceCidr\n\t\t\t\tif !serviceCidr.Contains(dnsServiceIP) {\n\t\t\t\t\treturn ErrorDNSServiceIPNotInServiceCidr\n\t\t\t\t}\n\n\t\t\t\t// validate DNSServiceIP is not the first IP in ServiceCidr. The first IP is reserved for redirect svc.\n\t\t\t\tkubernetesServiceIP, err := common.CidrStringFirstIP(n.ServiceCidr)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn ErrorInvalidServiceCidr\n\t\t\t\t}\n\t\t\t\tif dnsServiceIP.String() == kubernetesServiceIP.String() {\n\t\t\t\t\treturn ErrorDNSServiceIPAlreadyUsed\n\t\t\t\t}\n\t\t\t} else if n.ServiceCidr == \"\" && n.DNSServiceIP == \"\" && n.DockerBridgeCidr == \"\" {\n\t\t\t\t// this is a valid case, and no validation needed.\n\t\t\t} else {\n\t\t\t\treturn ErrorInvalidNetworkProfile\n\t\t\t}\n\n\t\t\t// PodCidr should not be set for Azure CNI\n\t\t\tif n.NetworkPlugin == Azure && n.PodCidr != \"\" {\n\t\t\t\treturn ErrorPodCidrNotSetableInAzureCNI\n\t\t\t}\n\t\tdefault:\n\t\t\treturn ErrorInvalidNetworkPlugin\n\t\t}\n\t}\n\n\t// validate agent pool custom VNET settings\n\tif a.AgentPoolProfiles != nil {\n\t\tif e := validateAgentPoolVNET(a.AgentPoolProfiles); e != nil {\n\t\t\treturn e\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "53bf0dada5844edde0a9d52ac498c35d", "score": "0.54544955", "text": "func (m *UpdateExternalNetworkIPRangeSpecification) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "1592a8486b29115cf736bc2b1f3aa10d", "score": "0.5447199", "text": "func (o *GetIPAMIpnatOKBody) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := o.validateIpnats(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d966a0040a3e44a77f09507e4262c577", "score": "0.5438758", "text": "func ValidateIP(ipAddress string, countryList []string) bool {\n\t// get country for ip address\n\tcountryCode, err := adapters.GetCountryCode(ipAddress)\n\tif err != nil {\n\t\treturn false\n\t}\n\n\t// check if ip address country is present in whitelisted countries\n\tfor _, eachCountry := range countryList {\n\t\tif eachCountry == countryCode {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "9124ee063d1d5bfbf2ea0a23b037fc84", "score": "0.5432448", "text": "func validateIPAddress(ip string) error {\n\tipaddr := strings.TrimSpace(ip)\n\tif net.ParseIP(ipaddr) == nil {\n\t\treturn fmt.Errorf(\"Invalid IP address: %s\", ip)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6cffa816e2a6cc8875931cffb9db57ca", "score": "0.5425668", "text": "func (m *VerifiedVip) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateVerification(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateVip(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateVipType(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "568396e269583eceea985b0e23149ba3", "score": "0.5413281", "text": "func (m *SnapmirrorEndpointInlineSvm) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateLinks(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2681032aa78132dadf5021e336a03d70", "score": "0.5411123", "text": "func (d *Device) Validate() error {\n\treturn vd.ValidateStruct(\n\t\tvd.Field(&d.IPv4Address, vd.Match(regexp.MustCompile(`^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$`))), // nolint:lll\n\t\tvd.Field(&d.IPv6Address, vd.Match(regexp.MustCompile(`([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))`))), // nolint:lll,staticcheck\n\t\tvd.Field(&d.PublicKey, vd.By(checkKey)),\n\t\tvd.Field(&d.IPv4Address, is.IPv4),\n\t\tvd.Field(&d.IPv6Address, is.IPv6),\n\t)\n}", "title": "" }, { "docid": "457c09001f99630a001e0503038bebcb", "score": "0.53782964", "text": "func (m *ClusterPeerInlineRemote) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateIPAddresses(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6b0dc766ca591440297d2657183a50e1", "score": "0.5363475", "text": "func (d *nicRouted) validateConfig(instConf instance.ConfigReader) error {\n\tif !instanceSupported(instConf.Type(), instancetype.Container, instancetype.VM) {\n\t\treturn ErrUnsupportedDevType\n\t}\n\n\terr := d.isUniqueWithGatewayAutoMode(instConf)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\trequiredFields := []string{}\n\toptionalFields := []string{\n\t\t\"name\",\n\t\t\"parent\",\n\t\t\"mtu\",\n\t\t\"queue.tx.length\",\n\t\t\"hwaddr\",\n\t\t\"host_name\",\n\t\t\"vlan\",\n\t\t\"limits.ingress\",\n\t\t\"limits.egress\",\n\t\t\"limits.max\",\n\t\t\"ipv4.gateway\",\n\t\t\"ipv6.gateway\",\n\t\t\"ipv4.routes\",\n\t\t\"ipv6.routes\",\n\t\t\"ipv4.host_address\",\n\t\t\"ipv6.host_address\",\n\t\t\"ipv4.host_table\",\n\t\t\"ipv6.host_table\",\n\t\t\"gvrp\",\n\t}\n\n\trules := nicValidationRules(requiredFields, optionalFields, instConf)\n\trules[\"ipv4.address\"] = validate.Optional(validate.IsListOf(validate.IsNetworkAddressV4))\n\trules[\"ipv6.address\"] = validate.Optional(validate.IsListOf(validate.IsNetworkAddressV6))\n\trules[\"gvrp\"] = validate.Optional(validate.IsBool)\n\trules[\"ipv4.neighbor_probe\"] = validate.Optional(validate.IsBool)\n\trules[\"ipv6.neighbor_probe\"] = validate.Optional(validate.IsBool)\n\n\terr = d.config.Validate(rules)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Detect duplicate IPs in config.\n\tfor _, key := range []string{\"ipv4.address\", \"ipv6.address\"} {\n\t\tips := make(map[string]struct{})\n\n\t\tif d.config[key] != \"\" {\n\t\t\tfor _, addr := range strings.Split(d.config[key], \",\") {\n\t\t\t\taddr = strings.TrimSpace(addr)\n\t\t\t\t_, dupe := ips[addr]\n\t\t\t\tif dupe {\n\t\t\t\t\treturn fmt.Errorf(\"Duplicate address %q in %q\", addr, key)\n\t\t\t\t}\n\n\t\t\t\tips[addr] = struct{}{}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Ensure that address is set if routes is set.\n\tfor _, keyPrefix := range []string{\"ipv4\", \"ipv6\"} {\n\t\tif d.config[fmt.Sprintf(\"%s.routes\", keyPrefix)] != \"\" && d.config[fmt.Sprintf(\"%s.address\", keyPrefix)] == \"\" {\n\t\t\treturn fmt.Errorf(\"%s.routes requires %s.address to be set\", keyPrefix, keyPrefix)\n\t\t}\n\t}\n\n\t// Ensure that VLAN setting is only used with parent setting.\n\tif d.config[\"parent\"] == \"\" && d.config[\"vlan\"] != \"\" {\n\t\treturn fmt.Errorf(\"The vlan setting can only be used when combined with a parent interface\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "05bd08e253d2e9a8274632216f76ab73", "score": "0.536175", "text": "func init() {\n\tfor _, cidr := range []string{\n\t\t\"127.0.0.0/8\", // IPv4 loopback\n\t\t\"10.0.0.0/8\", // RFC1918\n\t\t\"172.16.0.0/12\", // RFC1918\n\t\t\"192.168.0.0/16\", // RFC1918\n\t\t\"169.254.0.0/16\", // RFC3927 link-local\n\t\t\"::1/128\", // IPv6 loopback\n\t\t\"fe80::/10\", // IPv6 link-local\n\t\t\"fc00::/7\", // IPv6 unique local addr\n\t} {\n\t\t_, block, err := net.ParseCIDR(cidr)\n\t\tif err != nil {\n\t\t\tpanic(fmt.Errorf(\"parse error on %q: %v\", cidr, err))\n\t\t}\n\t\tprivateIPBlocks = append(privateIPBlocks, block)\n\t}\n\tBlockedIPs = append(BlockedIPs, privateIPBlocks...)\n}", "title": "" }, { "docid": "0f93e4ef364961476fb7a1c8e470d1ed", "score": "0.53390837", "text": "func validateVIPs(p *vsphere.Platform, fldPath *field.Path) field.ErrorList {\n\tallErrs := field.ErrorList{}\n\n\tif len(p.APIVIP) == 0 {\n\t\tallErrs = append(allErrs, field.Required(fldPath.Child(\"apiVIP\"), \"must specify a VIP for the API\"))\n\t} else if err := validate.IP(p.APIVIP); err != nil {\n\t\tallErrs = append(allErrs, field.Invalid(fldPath.Child(\"apiVIP\"), p.APIVIP, err.Error()))\n\t}\n\n\tif len(p.IngressVIP) == 0 {\n\t\tallErrs = append(allErrs, field.Required(fldPath.Child(\"ingressVIP\"), \"must specify a VIP for Ingress\"))\n\t} else if err := validate.IP(p.IngressVIP); err != nil {\n\t\tallErrs = append(allErrs, field.Invalid(fldPath.Child(\"ingressVIP\"), p.IngressVIP, err.Error()))\n\t}\n\n\tif len(p.APIVIP) != 0 && len(p.IngressVIP) != 0 && p.APIVIP == p.IngressVIP {\n\t\tallErrs = append(allErrs, field.Invalid(fldPath.Child(\"apiVIP\"), p.APIVIP, \"IPs for both API and Ingress should not be the same.\"))\n\t}\n\n\treturn allErrs\n}", "title": "" }, { "docid": "f6183e0a7de938c1119d569519498ca1", "score": "0.5338473", "text": "func (s *Subnet) Validate() error {\n\tif _, err := canonicalizeUUID(s.ID); err != nil {\n\t\treturn errors.New(\"invalid ID\")\n\t}\n\n\tif s.CIDR == nil {\n\t\treturn errors.New(\"CIDR cannot be nil\")\n\t}\n\n\tif s.StartRange == nil {\n\t\treturn errors.New(\"StartRange cannot be nil\")\n\t}\n\tif !s.CIDR.Contains(s.StartRange) {\n\t\treturn fmt.Errorf(\"%s does not contain %s\", s.CIDR, s.StartRange)\n\t}\n\n\tif s.EndRange == nil {\n\t\treturn errors.New(\"EndRange cannot be nil\")\n\t}\n\tif !s.CIDR.Contains(s.EndRange) {\n\t\treturn fmt.Errorf(\"%s does not contain %s\", s.CIDR, s.EndRange)\n\t}\n\n\tif bytes.Compare(s.StartRange, s.EndRange) > 0 {\n\t\treturn errors.New(\"EndRange cannot be less than StartRange\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "dd2919c3b288735d542f27f44c9e8679", "score": "0.5335791", "text": "func (n Network) Validate() error {\n\tif n.NetworkID == 0 && n.NetworkLabel == \"\" {\n\t\treturn fmt.Errorf(\"id is required\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "090c5ff801912781ed0ccd7b62c6ea4b", "score": "0.533464", "text": "func validateIP(ip string) (bool, string){\n // Parse the IP\n testIP := net.ParseIP(ip)\n\n // Make sure its a valid ipv4 or ipv6\n if testIP == nil{\n return false, \"Not a valid IP\"\n }\n\n // Make sure its version IPv4 Only\n if testIP.To4() == nil{\n return false, \"Only IPv4 is currently supported right now\"\n }\n\n // IP is good\n return true, \"\"\n}", "title": "" }, { "docid": "b18e5a0f7dfef2dca684bc8abdafc8c8", "score": "0.5333664", "text": "func validateNetwork(req abstract.SubnetRequest) (bool, fail.Error) {\n\terr := validation.ValidateStruct(&req,\n\t\tvalidation.Field(&req.Name, validation.Required, validation.Length(1, 64)),\n\t\tvalidation.Field(&req.Name, validation.Required, validation.Match(regexp.MustCompile(`^[a-zA-Z0-9_-]+$`))),\n\t)\n\tif err != nil {\n\t\treturn false, fail.Wrap(err, \"validation issue\")\n\t}\n\n\treturn true, nil\n}", "title": "" }, { "docid": "02266b1a5ebdd2b3e4f9272d84e2a6f2", "score": "0.5327536", "text": "func ValidateIP(str string) cnet.IP {\n\t// Parse the input string as an IP address (IPv4 or IPv6).\n\t// This also validates the IP address.\n\tip := net.ParseIP(str)\n\tif ip == nil {\n\t\tfmt.Printf(\"Error executing command: invalid IP address specified: %s\\n\", str)\n\t\tos.Exit(1)\n\t}\n\treturn cnet.IP{IP: ip}\n}", "title": "" }, { "docid": "d33f7608fc6cfc172468c7f694d39d29", "score": "0.53253955", "text": "func (m *Network2) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "0bffb6c09f4abe209d06d67a187d0588", "score": "0.53221196", "text": "func (a ACMETxt) allowedFrom(ip string) bool {\n\tremoteIP := net.ParseIP(ip)\n\t// Range not limited\n\tif len(a.AllowFrom.ValidEntries()) == 0 {\n\t\treturn true\n\t}\n\tlog.WithFields(log.Fields{\"ip\": remoteIP}).Debug(\"Checking if update is permitted from IP\")\n\tfor _, v := range a.AllowFrom.ValidEntries() {\n\t\t_, vnet, _ := net.ParseCIDR(v)\n\t\tif vnet.Contains(remoteIP) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "fbbb72da5b6fa7b7b9bec8a129dbeb83", "score": "0.5317318", "text": "func (d *InterfaceAddressDescriptor) Validate(key string, _ *interfaces.Interface) (err error) {\n\tiface, addr, _, invalidKey, _ := interfaces.ParseInterfaceAddressKey(key)\n\tif invalidKey {\n\t\treturn errors.New(\"invalid key\")\n\t}\n\n\treturn d.addrAlloc.ValidateIPAddress(addr, iface, \"ip_addresses\", netalloc.GwRefUnexpected)\n}", "title": "" }, { "docid": "4c06e614ff7c5174e03d610b3e23fb4b", "score": "0.53081834", "text": "func (m *AzureManagedControlPlane) validateDNSServiceIP(_ client.Client) error {\n\tif m.Spec.DNSServiceIP != nil {\n\t\tif net.ParseIP(*m.Spec.DNSServiceIP) == nil {\n\t\t\treturn errors.New(\"DNSServiceIP must be a valid IP\")\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "559bf86037a7469e1be47672def2e3e9", "score": "0.5303856", "text": "func (m *ConnectivityCheckNic) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateIPAddresses(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateMac(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2eb0689356006aa8608e58bba4fe1662", "score": "0.5288923", "text": "func (m *ClusterPeerInlineIpspace) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateLinks(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7e75635197dd8b6344db7618c58b21ff", "score": "0.5284932", "text": "func (m *IPServiceIP) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateCanBeTerminated(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateCountry(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateIP(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateRoutedTo(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateType(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6ea95b19fec4ab7b5bd98562b1b2d185", "score": "0.52659374", "text": "func (m *NetworkMasterInterface) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "198729f6ba756ce67a67778be299d629", "score": "0.52560234", "text": "func (ipAddressStrategy) ValidateUpdate(ctx context.Context, new, old runtime.Object) field.ErrorList {\n\tnewIPAddress := new.(*networking.IPAddress)\n\toldIPAddress := old.(*networking.IPAddress)\n\terrList := validation.ValidateIPAddress(newIPAddress)\n\terrList = append(errList, validation.ValidateIPAddressUpdate(newIPAddress, oldIPAddress)...)\n\treturn errList\n}", "title": "" }, { "docid": "1aba12becc061b6d95341f7cf06334c8", "score": "0.5255914", "text": "func (p *SubnetUpdateInternetParam) Validate() []error {\n\terrors := []error{}\n\t{\n\t\tvalidator := validateRequired\n\t\terrs := validator(\"--next-hop\", p.NextHop)\n\t\tif errs != nil {\n\t\t\terrors = append(errors, errs...)\n\t\t}\n\t}\n\t{\n\t\tvalidator := define.Resources[\"Internet\"].Commands[\"subnet-update\"].Params[\"next-hop\"].ValidateFunc\n\t\terrs := validator(\"--next-hop\", p.NextHop)\n\t\tif errs != nil {\n\t\t\terrors = append(errors, errs...)\n\t\t}\n\t}\n\t{\n\t\tvalidator := define.Resources[\"Internet\"].Commands[\"subnet-update\"].Params[\"subnet-id\"].ValidateFunc\n\t\terrs := validator(\"--subnet-id\", p.SubnetId)\n\t\tif errs != nil {\n\t\t\terrors = append(errors, errs...)\n\t\t}\n\t}\n\t{\n\t\tvalidator := validateSakuraID\n\t\terrs := validator(\"--id\", p.Id)\n\t\tif errs != nil {\n\t\t\terrors = append(errors, errs...)\n\t\t}\n\t}\n\n\t{\n\t\tvalidator := schema.ValidateInStrValues(define.AllowOutputTypes...)\n\t\terrs := validator(\"--output-type\", p.OutputType)\n\t\tif errs != nil {\n\t\t\terrors = append(errors, errs...)\n\t\t}\n\t}\n\t{\n\t\terrs := validateInputOption(p)\n\t\tif errs != nil {\n\t\t\terrors = append(errors, errs...)\n\t\t}\n\t}\n\t{\n\t\terrs := validateOutputOption(p)\n\t\tif errs != nil {\n\t\t\terrors = append(errors, errs...)\n\t\t}\n\t}\n\n\treturn errors\n}", "title": "" }, { "docid": "54d8c9cb97326d4cb15e40a40190c9bb", "score": "0.5247704", "text": "func isValidIPAddress(ip string) bool {\n\treturn net.ParseIP(ip) != nil\n}", "title": "" }, { "docid": "ea8f75299273acedd7adea260fdf5687", "score": "0.5232318", "text": "func IsIP(v *Validate, topStruct reflect.Value, currentStructOrField reflect.Value, field reflect.Value, fieldType reflect.Type, fieldKind reflect.Kind, param string) bool {\n\n\tip := net.ParseIP(field.String())\n\n\treturn ip != nil\n}", "title": "" }, { "docid": "16f2845e3bb12d4ac9dab90ec3d2ec72", "score": "0.52226025", "text": "func validateIP(pool []string, ip, net string) (bool, error) {\n\t// check exists\n\texists := false\n\tfor _, addr := range pool {\n\t\tif ip == addr {\n\t\t\texists = true\t\n\t\t}\n\t}\n\n\tif !exists {\n\t\treturn false, fmt.Errorf(\"IP %s not in pool\", ip)\n\t}\n\n\t// check assigned\n\tassigned, err := checkIPAssigned(net, ip)\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"check ip %s assigned error: %v\", ip, err)\n\t}\n\n\tif !assigned {\n\t\treturn true, nil\n\t}\n\n\t// maybe assign pool not clean\n\t// check alive\n\talive := checkIPAlive(ip)\n\n\t// ip is really used by container.\n\tif alive {\n\t\treturn false, fmt.Errorf(\"IP %s has been assigned\", ip)\n\t}\n\n\t// ip actually not used by any container, release it.\n\tif err := ReleaseIP(net, ip); err != nil {\n\t\tlog.Errorln(\"Release assgined ip %s failed with error: %v\", ip, err)\n\t\treturn false, fmt.Errorf(\"IP %s has been assigned\", ip)\n\t} \n\n\treturn true, nil\n}", "title": "" }, { "docid": "2c6733a777ba71ee31c06d80aa04b848", "score": "0.52214384", "text": "func (o *DeleteIPAMsubnetsOKBody) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "6fcfcf1c78e6e264b24f434665007eb4", "score": "0.5220622", "text": "func IsCIDRv4(v *Validate, topStruct reflect.Value, currentStructOrField reflect.Value, field reflect.Value, fieldType reflect.Type, fieldKind reflect.Kind, param string) bool {\n\n\tip, _, err := net.ParseCIDR(field.String())\n\n\treturn err == nil && ip.To4() != nil\n}", "title": "" }, { "docid": "84e05fd3cdae0e6ffda8ab7c226bfef9", "score": "0.5215989", "text": "func IP(ip string, required bool) ValidateFunc {\n\treturn func() error {\n\t\tif isEmptyStr(ip) {\n\t\t\treturn requiredErr(required, \"IP address cannot be empty\")\n\t\t}\n\t\tif addr := net.ParseIP(ip); addr == nil {\n\t\t\treturn fmt.Errorf(\"invalid IP address `%s`\", ip)\n\t\t}\n\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "00436489e01bcb678b1d986b333cc4d7", "score": "0.5206522", "text": "func (m *UpdateNetworkAppliancePort) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "ba8227f23634816fdb8a0de76f2520d0", "score": "0.5199281", "text": "func validateCIDRorIP(cidr string) error {\n\tif cidr == \"\" {\n\t\treturn fmt.Errorf(\"invalid CIDR address: an empty string is an invalid CIDR block or IP address\")\n\t}\n\t_, _, err := net.ParseCIDR(cidr)\n\tif err == nil {\n\t\treturn nil\n\t}\n\tip := net.ParseIP(cidr)\n\tif ip == nil {\n\t\treturn fmt.Errorf(\"invalid IP address: %v\", cidr)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2275e88423bb94199c18fecaf00ca214", "score": "0.5198213", "text": "func (m *NrpInterfaceNrpCarrierEthConnectivityEndPointResource) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateCeVlanIDListAndUntag(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateColorIdentifier(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateCosIdentifierList(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateCosMappingType(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateEecIdentifierList(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateEecMappingType(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateEgressBwpFlow(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateEgressMapList(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateIngressBwpFlow(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateL2cpAddressSet(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateLeafSvlanID(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateRootSvlanID(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateSVlanIDList(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateSourceMacAddressLimit(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d005801b88d2d609d0df588e600d991b", "score": "0.51921076", "text": "func (o *ContainerCreateParamsBodyAO1NetworkingConfig) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := o.validateEndpointsConfig(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1303c094064a828a9640d2e37d9891ce", "score": "0.51876557", "text": "func IsValidIP(ip string) (net.IP, error) {\n\tnetIP := net.ParseIP(ip)\n\tif netIP == nil {\n\t\treturn nil, fmt.Errorf(\"Invalid IP : %s\", ip)\n\t}\n\treturn netIP.To4(), nil\n}", "title": "" }, { "docid": "f9d0fde5fcc02ed253927b428b82c6d4", "score": "0.51870286", "text": "func (m *UpdatePrivateIPDetails) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateDisplayName(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateHostnameLabel(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateVnicID(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8eacdc875c7e00d4c0c37f21cd2fd7de", "score": "0.51862305", "text": "func (p *SubnetInfoInternetParam) Validate() []error {\n\terrors := []error{}\n\t{\n\t\tvalidator := validateSakuraID\n\t\terrs := validator(\"--id\", p.Id)\n\t\tif errs != nil {\n\t\t\terrors = append(errors, errs...)\n\t\t}\n\t}\n\n\t{\n\t\tvalidator := schema.ValidateInStrValues(define.AllowOutputTypes...)\n\t\terrs := validator(\"--output-type\", p.OutputType)\n\t\tif errs != nil {\n\t\t\terrors = append(errors, errs...)\n\t\t}\n\t}\n\t{\n\t\terrs := validateInputOption(p)\n\t\tif errs != nil {\n\t\t\terrors = append(errors, errs...)\n\t\t}\n\t}\n\t{\n\t\terrs := validateOutputOption(p)\n\t\tif errs != nil {\n\t\t\terrors = append(errors, errs...)\n\t\t}\n\t}\n\n\treturn errors\n}", "title": "" }, { "docid": "23176d0f66f0cca6a0c035dc8eced1f6", "score": "0.5182499", "text": "func (m *ApplicationSanAccessIscsiEndpointInlineInterface) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateLinks(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateIP(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ec2599642e73d0933e968be245a01774", "score": "0.5181424", "text": "func IsIPAddress(i interface{}, k string) (warnings []string, errors []error) {\n\tv, ok := i.(string)\n\tif !ok {\n\t\terrors = append(errors, fmt.Errorf(\"expected type of %q to be string\", k))\n\t\treturn warnings, errors\n\t}\n\n\tip := net.ParseIP(v)\n\tif ip == nil {\n\t\terrors = append(errors, fmt.Errorf(\"expected %s to contain a valid IP, got: %s\", k, v))\n\t}\n\n\treturn warnings, errors\n}", "title": "" }, { "docid": "9ac3a4cc7bad7c62a04f0fc3a36fc270", "score": "0.5180671", "text": "func IsCIDR(v *Validate, topStruct reflect.Value, currentStructOrField reflect.Value, field reflect.Value, fieldType reflect.Type, fieldKind reflect.Kind, param string) bool {\n\n\t_, _, err := net.ParseCIDR(field.String())\n\n\treturn err == nil\n}", "title": "" }, { "docid": "5ab608174d3c62f4b6a4aaf0a96c7a74", "score": "0.5176481", "text": "func validateIPAddressRange(iprange string) error {\n\tiprange = strings.TrimSpace(iprange)\n\tif strings.Count(iprange, \"-\") < 1 {\n\t\treturn validateIPAddress(iprange)\n\t}\n\tif strings.Count(iprange, \"-\") > 1 {\n\t\treturn fmt.Errorf(\"invalid IP range format: %s\", iprange)\n\t}\n\n\t// It's an IP range of the form: n.n.n.n-n\n\trangeLimits := strings.Split(iprange, \"-\")\n\tstartIP := rangeLimits[0]\n\tparts := strings.Split(startIP, \".\")\n\tif len(parts) != 4 {\n\t\treturn fmt.Errorf(\"invalid IP range start format: %s\", startIP)\n\t}\n\trangeStart := parts[3]\n\trangeEnd := rangeLimits[1]\n\tif err := validateIPAddress(startIP); err != nil {\n\t\treturn err\n\t}\n\n\t// Manufacture ending IP address for the range.\n\tparts[3] = rangeEnd\n\tendIP := strings.Join(parts, \".\")\n\tif validateIPAddress(endIP) != nil {\n\t\treturn fmt.Errorf(\"invalid IP range end: %s [%s]\", rangeEnd, endIP)\n\t}\n\n\t// Lastly, ensure start <= end\n\tstart, err := strconv.Atoi(rangeStart)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"invalid IP range start: %s [%s]\", rangeStart, startIP)\n\t}\n\n\tend, err := strconv.Atoi(rangeEnd)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"invalid IP range end: %s [%s]\", rangeEnd, endIP)\n\t}\n\n\tif start > end {\n\t\treturn fmt.Errorf(\"invalid IP range %s-%s: start=%v > end=%v\", startIP, endIP, start, end)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "09771b7750dead4247b800f087594386", "score": "0.51751244", "text": "func (m *DetectionHostNetwork) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "59ce14c0e1d97371b24cefcbe59699d9", "score": "0.5174955", "text": "func validateNetworkingConfig(n *libnetwork.Network, epConfig *networktypes.EndpointSettings) error {\n\tif n == nil || epConfig == nil {\n\t\treturn nil\n\t}\n\tif !containertypes.NetworkMode(n.Name()).IsUserDefined() {\n\t\tif hasUserDefinedIPAddress(epConfig.IPAMConfig) && !enableIPOnPredefinedNetwork() {\n\t\t\treturn runconfig.ErrUnsupportedNetworkAndIP\n\t\t}\n\t\tif len(epConfig.Aliases) > 0 && !serviceDiscoveryOnDefaultNetwork() {\n\t\t\treturn runconfig.ErrUnsupportedNetworkAndAlias\n\t\t}\n\t}\n\tif !hasUserDefinedIPAddress(epConfig.IPAMConfig) {\n\t\treturn nil\n\t}\n\n\t_, _, nwIPv4Configs, nwIPv6Configs := n.IpamConfig()\n\tfor _, s := range []struct {\n\t\tipConfigured bool\n\t\tsubnetConfigs []*libnetwork.IpamConf\n\t}{\n\t\t{\n\t\t\tipConfigured: len(epConfig.IPAMConfig.IPv4Address) > 0,\n\t\t\tsubnetConfigs: nwIPv4Configs,\n\t\t},\n\t\t{\n\t\t\tipConfigured: len(epConfig.IPAMConfig.IPv6Address) > 0,\n\t\t\tsubnetConfigs: nwIPv6Configs,\n\t\t},\n\t} {\n\t\tif s.ipConfigured {\n\t\t\tfoundSubnet := false\n\t\t\tfor _, cfg := range s.subnetConfigs {\n\t\t\t\tif len(cfg.PreferredPool) > 0 {\n\t\t\t\t\tfoundSubnet = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !foundSubnet {\n\t\t\t\treturn runconfig.ErrUnsupportedNetworkNoSubnetAndIP\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3ff21c3f55334bbf0d134eef08492134", "score": "0.5163043", "text": "func (c *Config) Validate() error {\n\tdur := c.LeaseDuration()\n\tif dur < 1*time.Hour || dur > 24*time.Hour {\n\t\treturn errors.Newv(\"lease must be 1-24 hours\", map[string]interface{}{\"duration\": dur})\n\t}\n\n\tnet, err := c.network()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tg := c.Gateway()\n\tif g != nil && !net.Contains(g) {\n\t\treturn errors.Newv(\"gateway is not reachable from subnet\", map[string]interface{}{\"gateway\": g, \"subnet\": net})\n\t}\n\n\treturn c.Config.Validate()\n}", "title": "" }, { "docid": "9ebe856b5063a87ddf0d6c60befc30e4", "score": "0.51560116", "text": "func validateSubnet(subnet net.Subnet) bool {\n\tvar ipBytes []uint8\n\tswitch typ := subnet.Addr.Which(); typ {\n\tcase net.IpAddressIpv4:\n\t\tipBytes = subnet.Addr.Ipv4.Addr[:]\n\tcase net.IpAddressIpv6:\n\t\tipBytes = subnet.Addr.Ipv6.Addr[:]\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"unknown IpAddress type %d\", typ))\n\t}\n\tif int(subnet.PrefixLen) > len(ipBytes)*8 {\n\t\treturn false\n\t}\n\tprefixBytes := subnet.PrefixLen / 8\n\tipBytes = ipBytes[prefixBytes:]\n\tif prefixBits := subnet.PrefixLen - (prefixBytes * 8); prefixBits > 0 {\n\t\t// prefixBits is only greater than zero when ipBytes is non-empty.\n\t\tmask := uint8((1 << (8 - prefixBits)) - 1)\n\t\tipBytes[0] &= mask\n\t}\n\tfor _, byte := range ipBytes {\n\t\tif byte != 0 {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "4cb2ac1bc0a9edfdd7b375c7b0f17ecf", "score": "0.5152139", "text": "func isPrivateSubnet(ipAddress net.IP) bool {\n // my use case is only concerned with ipv4 atm\n if ipCheck := ipAddress.To4(); ipCheck != nil {\n // iterate over all our ranges\n for _, r := range privateRanges {\n // check if this ip is in a private range\n if inRange(r, ipAddress){\n return true\n }\n }\n }\n return false\n}", "title": "" }, { "docid": "20649f81ef0fcd79934e1b72bd2b5e39", "score": "0.51510274", "text": "func Validate(ctx context.Context, m *plugin.Manifest) error {\n\tfmt.Println(\"## conn_ip_example Validate called ##\")\n\tfmt.Printf(\"---- context: %s\\n\", ctx)\n\treturn nil\n}", "title": "" }, { "docid": "1adc318b458b30d0dd209bd744000cfb", "score": "0.51508313", "text": "func (c *addressManager) isValidNodeIP(addr net.IP) bool {\n\tif addr == nil {\n\t\treturn false\n\t}\n\tif addr.IsLinkLocalUnicast() {\n\t\treturn false\n\t}\n\tif addr.IsLoopback() {\n\t\treturn false\n\t}\n\n\tif utilnet.IsIPv4(addr) {\n\t\tif c.mgmtPortConfig.ipv4 != nil && c.mgmtPortConfig.ipv4.ifAddr.IP.Equal(addr) {\n\t\t\treturn false\n\t\t}\n\t} else if utilnet.IsIPv6(addr) {\n\t\tif c.mgmtPortConfig.ipv6 != nil && c.mgmtPortConfig.ipv6.ifAddr.IP.Equal(addr) {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "8008cfbc38518db18ac72c97cc057964", "score": "0.51402926", "text": "func (m *ClusterPeerInlineVersion) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "1d206d9cb3dba1d24f0d07f1f90cfe11", "score": "0.51372683", "text": "func IsPrivate(ipString string) bool {\n\tipParsed := net.ParseIP(ipString)\n\tif ipParsed == nil {\n\t\treturn false\n\t}\n\tipSplits := strings.Split(ipParsed.String(), \".\")\n\tipValue2, _ := strconv.Atoi(ipSplits[1])\n\n\tswitch {\n\tcase ipSplits[0] == \"10\": // 10.0.0.0/8\n\t\treturn true\n\tcase ipSplits[0] == \"172\" && (ipValue2 >= 16 && ipValue2 < 32): // 172.16.0.0/12\n\t\treturn true\n\tcase ipSplits[0] == \"192\" && ipValue2 == 168: // 192.168.0.0/16\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "16e20db2942dc1dae458eca8b3d7ad00", "score": "0.5128977", "text": "func (config NetworkVPCConfig) Validate() (errors []error) {\n\t// Enforce required props\n\tif config.Properties.CIDR == nil {\n\t\terrors = append(errors, fmt.Errorf(\"Missing required field 'CIDR'\"))\n\t}\n\tif config.Properties.DHCP.Name == \"\" {\n\t\terrors = append(errors, fmt.Errorf(\"Missing required field 'DHCP.Name'\"))\n\t}\n\treturn\n}", "title": "" }, { "docid": "95098b077f00ef6eacc37589146a5378", "score": "0.5125233", "text": "func Validate(m message.Message) error {\n\tcm := m.Payload().(block.Block)\n\treturn ValidateCandidate(cm)\n}", "title": "" }, { "docid": "bcd652650c82f9de768f559285235b09", "score": "0.5115845", "text": "func (o *Options) validate(args []string) (int, error) {\n\tif len(args) != 0 {\n\t\treturn 0, fmt.Errorf(\"no positional arguments are supported\")\n\t}\n\n\t_, _, err := net.ParseCIDR(o.config.ServiceCIDR)\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(\"Service CIDR %s is invalid\", o.config.ServiceCIDR)\n\t}\n\tif o.config.ServiceCIDRv6 != \"\" {\n\t\t_, _, err := net.ParseCIDR(o.config.ServiceCIDRv6)\n\t\tif err != nil {\n\t\t\treturn 0, fmt.Errorf(\"Service CIDR v6 %s is invalid\", o.config.ServiceCIDRv6)\n\t\t}\n\t}\n\n\t// 检查 o.config.HealthzBindAddress 和 o.config.MetricsBindAddress 是否符合ipPort\n\n\treturn 0, nil\n}", "title": "" }, { "docid": "38699017de24e1594acd5f3f1533af40", "score": "0.51108295", "text": "func (v *StringIsIPLoopback) Validate(e *validator.Errors) {\n\tip := net.ParseIP(v.Field)\n\n\tif ip.IsLoopback() {\n\t\treturn\n\t}\n\n\te.Add(v.Name, StringIsIPLoopbackError(v))\n}", "title": "" }, { "docid": "715ba3b2695c60c191450cbfcf559a7e", "score": "0.51100737", "text": "func (m *V1NetworkCreateRequest) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateDestinationprefixes(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateID(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateNat(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateParentnetworkid(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validatePrefixes(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validatePrimary(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateUnderlay(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c6e159be87e959ca5f17c56d5556bf41", "score": "0.5109212", "text": "func validateIPAddress(val string) (string, error) {\n\tvar ip = net.ParseIP(strings.TrimSpace(val))\n\tif ip != nil {\n\t\treturn ip.String(), nil\n\t}\n\treturn \"\", fmt.Errorf(\"%s is not an ip address\", val)\n}", "title": "" }, { "docid": "958eff0ed4b1eb14347c6cebc1395f9a", "score": "0.51067936", "text": "func SingleIP() schema.SchemaValidateFunc {\n\treturn IsIPAddress\n}", "title": "" }, { "docid": "7e0a2ffb7d2de27f5550a9cb71cc79e1", "score": "0.5104851", "text": "func privateIP(ip string) bool {\n\tprivate := false\n\tIP := net.ParseIP(ip)\n\tif IP == nil {\n\t\tfmt.Println(\"func privateIP unable to parse IP\")\n\t} else {\n\t\t_, private24BitBlock, _ := net.ParseCIDR(\"10.0.0.0/8\")\n\t\t_, private20BitBlock, _ := net.ParseCIDR(\"172.16.0.0/12\")\n\t\t_, private16BitBlock, _ := net.ParseCIDR(\"192.168.0.0/16\")\n\t\tprivate = private24BitBlock.Contains(IP) || private20BitBlock.Contains(IP) || private16BitBlock.Contains(IP)\n\t}\n\treturn private\n}", "title": "" }, { "docid": "eb1a9490e78badd4ba008851181b815d", "score": "0.51032686", "text": "func validateClientIP(addr string) (string, error) {\n\tif addr != \"\" && net.ParseIP(addr) == nil {\n\t\tlog.Debugf(\"Error while parsing CLC runner address %s\", addr)\n\t\treturn \"\", fmt.Errorf(\"cannot parse CLC runner address: %s\", addr)\n\t}\n\n\tif addr == \"\" && config.Datadog.GetBool(\"cluster_checks.advanced_dispatching_enabled\") {\n\t\tlog.Warn(\"Cluster check dispatching error: cannot get runner IP from http headers. advanced_dispatching_enabled requires agent 6.17 or above.\")\n\t}\n\n\treturn addr, nil\n}", "title": "" }, { "docid": "2fb9e3ac8ce906dfc0ae484ef90d2d15", "score": "0.50914156", "text": "func (b *BannedIps) Validate(action Action) error {\n\treturn nil\n}", "title": "" }, { "docid": "afe0d474a3ab3051e7cf5ff11d3d0ece", "score": "0.5090942", "text": "func (o *GetIPAMsubnetsOKBody) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := o.validateSubnets(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b09ef9993070668b3428a2b9271e7830", "score": "0.50899047", "text": "func (s *Subnet) Validate() error {\n\tif s.CIDR == nil {\n\t\treturn errors.New(\"CIDR cannot be nil\")\n\t}\n\n\tif s.StartRange == nil {\n\t\treturn errors.New(\"StartRange cannot be nil\")\n\t}\n\tif !s.CIDR.Contains(s.StartRange) {\n\t\treturn fmt.Errorf(\"%s does not contain %s\", s.CIDR, s.StartRange)\n\t}\n\n\tif s.EndRange == nil {\n\t\treturn errors.New(\"EndRange cannot be nil\")\n\t}\n\tif !s.CIDR.Contains(s.EndRange) {\n\t\treturn fmt.Errorf(\"%s does not contain %s\", s.CIDR, s.EndRange)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "abe8ab52730695fe8befb59e900c1e18", "score": "0.5083681", "text": "func (m *NestedTemplateNic) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateIndex(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateModel(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateVlan(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "543323e92b1416044d03379359e75d27", "score": "0.5081729", "text": "func (daemon *Daemon) verifyNetworkingConfig(nwConfig *networktypes.NetworkingConfig) error {\n\tif nwConfig == nil || len(nwConfig.EndpointsConfig) == 0 {\n\t\treturn nil\n\t}\n\tif len(nwConfig.EndpointsConfig) == 1 {\n\t\tfor _, v := range nwConfig.EndpointsConfig {\n\t\t\tif v != nil && v.IPAMConfig != nil {\n\t\t\t\tif v.IPAMConfig.IPv4Address != \"\" && net.ParseIP(v.IPAMConfig.IPv4Address).To4() == nil {\n\t\t\t\t\treturn apierrors.NewBadRequestError(fmt.Errorf(\"invalid IPv4 address: %s\", v.IPAMConfig.IPv4Address))\n\t\t\t\t}\n\t\t\t\tif v.IPAMConfig.IPv6Address != \"\" {\n\t\t\t\t\tn := net.ParseIP(v.IPAMConfig.IPv6Address)\n\t\t\t\t\t// if the address is an invalid network address (ParseIP == nil) or if it is\n\t\t\t\t\t// an IPv4 address (To4() != nil), then it is an invalid IPv6 address\n\t\t\t\t\tif n == nil || n.To4() != nil {\n\t\t\t\t\t\treturn apierrors.NewBadRequestError(fmt.Errorf(\"invalid IPv6 address: %s\", v.IPAMConfig.IPv6Address))\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}\n\tl := make([]string, 0, len(nwConfig.EndpointsConfig))\n\tfor k := range nwConfig.EndpointsConfig {\n\t\tl = append(l, k)\n\t}\n\terr := fmt.Errorf(\"Container cannot be connected to network endpoints: %s\", strings.Join(l, \", \"))\n\treturn apierrors.NewBadRequestError(err)\n}", "title": "" }, { "docid": "ce90570520e3d273986911b2feac1782", "score": "0.50814646", "text": "func (fr *FederationResolver) Validate(tx *sql.Tx) error {\n\treturn validation.ValidateStruct(fr,\n\t\tvalidation.Field(&fr.IPAddress, validation.Required, validation.By(func(v interface{}) error {\n\t\t\tif v == nil {\n\t\t\t\treturn nil // this is handled by 'required'\n\t\t\t}\n\n\t\t\tif ip := net.ParseIP(*v.(*string)); ip != nil {\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\tif _, _, err := net.ParseCIDR(*v.(*string)); err != nil {\n\t\t\t\treturn errors.New(\"invalid network IP or CIDR-notation subnet\")\n\t\t\t}\n\t\t\treturn nil\n\t\t})),\n\t\tvalidation.Field(&fr.TypeID, validation.Required),\n\t)\n}", "title": "" }, { "docid": "28621298a2c674c76984dd8b2aa8ee10", "score": "0.5069826", "text": "func (d *InterfaceDescriptor) Validate(key string, linuxIf *interfaces.Interface) error {\n\t// validate name (this should never happen, since key is derived from name)\n\tif linuxIf.GetName() == \"\" {\n\t\treturn kvs.NewInvalidValueError(ErrInterfaceWithoutName, \"name\")\n\t}\n\n\t// validate namespace\n\tif ns := linuxIf.GetNamespace(); ns != nil {\n\t\tif ns.GetType() == namespace.NetNamespace_UNDEFINED || ns.GetReference() == \"\" {\n\t\t\treturn kvs.NewInvalidValueError(ErrNamespaceWithoutReference, \"namespace\")\n\t\t}\n\t}\n\n\t// validate type\n\tswitch linuxIf.GetType() {\n\tcase interfaces.Interface_EXISTING:\n\t\tif linuxIf.GetLink() != nil {\n\t\t\treturn kvs.NewInvalidValueError(ErrInterfaceReferenceMismatch, \"link\")\n\t\t}\n\t\t// For now support only the same namespace as the agent.\n\t\tif linuxIf.GetNamespace() != nil {\n\t\t\treturn kvs.NewInvalidValueError(ErrExistingWithNamespace, \"namespace\")\n\t\t}\n\t\t// Currently it is not supported to combine netalloc with existing IP.\n\t\tif linuxIf.GetLinkOnly() {\n\t\t\tfor i, ipAddr := range linuxIf.GetIpAddresses() {\n\t\t\t\t_, hasAllocDep := d.addrAlloc.GetAddressAllocDep(ipAddr, linuxIf.Name, \"\")\n\t\t\t\tif hasAllocDep {\n\t\t\t\t\treturn kvs.NewInvalidValueError(ErrExistingIpWithNetalloc,\n\t\t\t\t\t\t\"type\", \"link_only\", fmt.Sprintf(\"ip_addresses[%d]\", i))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\tcase interfaces.Interface_LOOPBACK:\n\t\tif linuxIf.GetLink() != nil {\n\t\t\treturn kvs.NewInvalidValueError(ErrInterfaceReferenceMismatch, \"link\")\n\t\t}\n\tcase interfaces.Interface_TAP_TO_VPP:\n\t\tif d.vppIfPlugin == nil {\n\t\t\treturn ErrTAPRequiresVPPIfPlugin\n\t\t}\n\tcase interfaces.Interface_VRF_DEVICE:\n\t\tif linuxIf.GetPhysAddress() != \"\" {\n\t\t\treturn kvs.NewInvalidValueError(ErrVRFDevWithMACAddr, \"type\", \"phys_address\")\n\t\t}\n\t\tif linuxIf.GetVrfMasterInterface() != \"\" {\n\t\t\treturn kvs.NewInvalidValueError(ErrVRFDevInsideVrf, \"type\", \"vrf\")\n\t\t}\n\tcase interfaces.Interface_UNDEFINED:\n\t\treturn kvs.NewInvalidValueError(ErrInterfaceWithoutType, \"type\")\n\t}\n\n\t// validate link\n\tswitch linuxIf.GetLink().(type) {\n\tcase *interfaces.Interface_Tap:\n\t\tif linuxIf.GetType() != interfaces.Interface_TAP_TO_VPP {\n\t\t\treturn kvs.NewInvalidValueError(ErrInterfaceReferenceMismatch, \"link\")\n\t\t}\n\t\tif linuxIf.GetTap().GetVppTapIfName() == \"\" {\n\t\t\treturn kvs.NewInvalidValueError(ErrTAPWithoutVPPReference, \"vpp_tap_if_name\")\n\t\t}\n\tcase *interfaces.Interface_Veth:\n\t\tif linuxIf.GetType() != interfaces.Interface_VETH {\n\t\t\treturn kvs.NewInvalidValueError(ErrInterfaceReferenceMismatch, \"link\")\n\t\t}\n\t\tif linuxIf.GetVeth().GetPeerIfName() == \"\" {\n\t\t\treturn kvs.NewInvalidValueError(ErrVETHWithoutPeer, \"peer_if_name\")\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "18c8f8130929a3f7e98853a198cf7d94", "score": "0.50643253", "text": "func (d *nicOVN) validateConfig(instConf instance.ConfigReader) error {\n\tif !instanceSupported(instConf.Type(), instancetype.Container, instancetype.VM) {\n\t\treturn ErrUnsupportedDevType\n\t}\n\n\trequiredFields := []string{\n\t\t\"network\",\n\t}\n\n\toptionalFields := []string{\n\t\t\"name\",\n\t\t\"hwaddr\",\n\t\t\"host_name\",\n\t\t\"mtu\",\n\t\t\"ipv4.address\",\n\t\t\"ipv6.address\",\n\t\t\"ipv4.routes\",\n\t\t\"ipv6.routes\",\n\t\t\"ipv4.routes.external\",\n\t\t\"ipv6.routes.external\",\n\t\t\"boot.priority\",\n\t\t\"security.acls\",\n\t\t\"security.acls.default.ingress.action\",\n\t\t\"security.acls.default.egress.action\",\n\t\t\"security.acls.default.ingress.logged\",\n\t\t\"security.acls.default.egress.logged\",\n\t\t\"acceleration\",\n\t\t\"nested\",\n\t\t\"vlan\",\n\t}\n\n\t// The NIC's network may be a non-default project, so lookup project and get network's project name.\n\tnetworkProjectName, _, err := project.NetworkProject(d.state.DB.Cluster, instConf.Project().Name)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed loading network project name: %w\", err)\n\t}\n\n\t// Lookup network settings and apply them to the device's config.\n\tn, err := network.LoadByName(d.state, networkProjectName, d.config[\"network\"])\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error loading network config for %q: %w\", d.config[\"network\"], err)\n\t}\n\n\tif n.Status() != api.NetworkStatusCreated {\n\t\treturn fmt.Errorf(\"Specified network is not fully created\")\n\t}\n\n\tif n.Type() != \"ovn\" {\n\t\treturn fmt.Errorf(\"Specified network must be of type ovn\")\n\t}\n\n\tbannedKeys := []string{\"mtu\"}\n\tfor _, bannedKey := range bannedKeys {\n\t\tif d.config[bannedKey] != \"\" {\n\t\t\treturn fmt.Errorf(\"Cannot use %q property in conjunction with %q property\", bannedKey, \"network\")\n\t\t}\n\t}\n\n\tovnNet, ok := n.(ovnNet)\n\tif !ok {\n\t\treturn fmt.Errorf(\"Network is not ovnNet interface type\")\n\t}\n\n\td.network = ovnNet // Stored loaded network for use by other functions.\n\tnetConfig := d.network.Config()\n\n\tif d.config[\"ipv4.address\"] != \"\" {\n\t\t// Check that DHCPv4 is enabled on parent network (needed to use static assigned IPs).\n\t\tif n.DHCPv4Subnet() == nil {\n\t\t\treturn fmt.Errorf(\"Cannot specify %q when DHCP is disabled on network %q\", \"ipv4.address\", d.config[\"network\"])\n\t\t}\n\n\t\tip, subnet, err := net.ParseCIDR(netConfig[\"ipv4.address\"])\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Invalid network ipv4.address: %w\", err)\n\t\t}\n\n\t\t// Check the static IP supplied is valid for the linked network. It should be part of the\n\t\t// network's subnet, but not necessarily part of the dynamic allocation ranges.\n\t\tif !dhcpalloc.DHCPValidIP(subnet, nil, net.ParseIP(d.config[\"ipv4.address\"])) {\n\t\t\treturn fmt.Errorf(\"Device IP address %q not within network %q subnet\", d.config[\"ipv4.address\"], d.config[\"network\"])\n\t\t}\n\n\t\t// IP should not be the same as the parent managed network address.\n\t\tif ip.Equal(net.ParseIP(d.config[\"ipv4.address\"])) {\n\t\t\treturn fmt.Errorf(\"IP address %q is assigned to parent managed network device %q\", d.config[\"ipv4.address\"], d.config[\"parent\"])\n\t\t}\n\t}\n\n\tif d.config[\"ipv6.address\"] != \"\" {\n\t\t// Check that DHCPv6 is enabled on parent network (needed to use static assigned IPs).\n\t\tif n.DHCPv6Subnet() == nil || shared.IsFalseOrEmpty(netConfig[\"ipv6.dhcp.stateful\"]) {\n\t\t\treturn fmt.Errorf(\"Cannot specify %q when DHCP or %q are disabled on network %q\", \"ipv6.address\", \"ipv6.dhcp.stateful\", d.config[\"network\"])\n\t\t}\n\n\t\tip, subnet, err := net.ParseCIDR(netConfig[\"ipv6.address\"])\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Invalid network ipv6.address: %w\", err)\n\t\t}\n\n\t\t// Check the static IP supplied is valid for the linked network. It should be part of the\n\t\t// network's subnet, but not necessarily part of the dynamic allocation ranges.\n\t\tif !dhcpalloc.DHCPValidIP(subnet, nil, net.ParseIP(d.config[\"ipv6.address\"])) {\n\t\t\treturn fmt.Errorf(\"Device IP address %q not within network %q subnet\", d.config[\"ipv6.address\"], d.config[\"network\"])\n\t\t}\n\n\t\t// IP should not be the same as the parent managed network address.\n\t\tif ip.Equal(net.ParseIP(d.config[\"ipv6.address\"])) {\n\t\t\treturn fmt.Errorf(\"IP address %q is assigned to parent managed network device %q\", d.config[\"ipv6.address\"], d.config[\"parent\"])\n\t\t}\n\t}\n\n\t// Apply network level config options to device config before validation.\n\td.config[\"mtu\"] = netConfig[\"bridge.mtu\"]\n\n\t// Check VLAN ID is valid.\n\tif d.config[\"vlan\"] != \"\" {\n\t\tnestedVLAN, err := strconv.ParseUint(d.config[\"vlan\"], 10, 16)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Invalid VLAN ID %q: %w\", d.config[\"vlan\"], err)\n\t\t}\n\n\t\tif nestedVLAN < 1 || nestedVLAN > 4095 {\n\t\t\treturn fmt.Errorf(\"Invalid VLAN ID %q: Must be between 1 and 4095 inclusive\", d.config[\"vlan\"])\n\t\t}\n\t}\n\n\t// Perform checks that require instance (those not appropriate to do during profile validation).\n\tif d.inst != nil {\n\t\t// Check nested VLAN combination settings are valid. Requires instance for validation as settings\n\t\t// may come from a combination of profile and instance configs.\n\t\tif d.config[\"nested\"] != \"\" {\n\t\t\tif d.config[\"vlan\"] == \"\" {\n\t\t\t\treturn fmt.Errorf(\"VLAN must be specified with a nested NIC\")\n\t\t\t}\n\n\t\t\t// Check the NIC that this NIC is neted under exists on this instance and shares same\n\t\t\t// parent network.\n\t\t\tvar nestedParentNIC string\n\t\t\tfor devName, devConfig := range instConf.ExpandedDevices() {\n\t\t\t\tif devName != d.config[\"nested\"] || devConfig[\"type\"] != \"nic\" {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tif devConfig[\"network\"] != d.config[\"network\"] {\n\t\t\t\t\treturn fmt.Errorf(\"The nested parent NIC must be connected to same network as this NIC\")\n\t\t\t\t}\n\n\t\t\t\tnestedParentNIC = devName\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tif nestedParentNIC == \"\" {\n\t\t\t\treturn fmt.Errorf(\"Instance does not have a NIC called %q for nesting under\", d.config[\"nested\"])\n\t\t\t}\n\t\t} else if d.config[\"vlan\"] != \"\" {\n\t\t\treturn fmt.Errorf(\"Specifying a VLAN requires that this NIC be nested\")\n\t\t}\n\n\t\t// Check there isn't another NIC with any of the same addresses specified on the same network.\n\t\t// Can only validate this when the instance is supplied (and not doing profile validation).\n\t\terr := d.checkAddressConflict()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\trules := nicValidationRules(requiredFields, optionalFields, instConf)\n\n\t// Now run normal validation.\n\terr = d.config.Validate(rules)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Check IP external routes are within the network's external routes.\n\tvar externalRoutes []*net.IPNet\n\tfor _, k := range []string{\"ipv4.routes.external\", \"ipv6.routes.external\"} {\n\t\tif d.config[k] == \"\" {\n\t\t\tcontinue\n\t\t}\n\n\t\texternalRoutes, err = network.SubnetParseAppend(externalRoutes, shared.SplitNTrimSpace(d.config[k], \",\", -1, false)...)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(externalRoutes) > 0 {\n\t\terr = d.network.InstanceDevicePortValidateExternalRoutes(d.inst, d.name, externalRoutes)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Check Security ACLs exist.\n\tif d.config[\"security.acls\"] != \"\" {\n\t\terr = acl.Exists(d.state, networkProjectName, shared.SplitNTrimSpace(d.config[\"security.acls\"], \",\", -1, true)...)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "585c653faa007ccd1abdd37316ceef11", "score": "0.50461745", "text": "func checkIPAddressType(ip string) int {\n\tif net.ParseIP(ip) == nil {\n\t\treturn -1 //Error\n\t}\n\tfor i := 0; i < len(ip); i++ {\n\t\tswitch ip[i] {\n\t\tcase '.':\n\t\t\treturn 0 //IPv4\n\t\tcase ':':\n\t\t\treturn 1 //IPv6\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "bcd055f04f14e31e6ce352e5cccc4908", "score": "0.5041646", "text": "func TestBadInputForIPAllocation(t *testing.T) {\n\ti := setup(t, newDefaultConfig())\n\t_, err := i.NextPodIP(incorrectHostIDForIPAllocation)\n\tExpect(err).NotTo(BeNil())\n}", "title": "" }, { "docid": "8bca30b731552e69e2bb131f1dcba5f9", "score": "0.50405556", "text": "func CheckIPValid(ipAddr string) bool {\n\tip := net.ParseIP(ipAddr)\n\tif ip == nil {\n\t\t// log.Errorf(\"wrong ipAddr format\")\n\t\treturn false\n\t}\n\tip = ip.To4()\n\tif ip == nil {\n\t\t// log.Errorf(\"wrong ipAddr to To4 format\")\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "af33b39abb25dc2c9002acb037f39223", "score": "0.50384164", "text": "func validateCIDR(fieldPath *field.Path, cidr string) field.ErrorList {\n\t_, errs := parseCIDR(fieldPath, cidr)\n\treturn errs\n}", "title": "" }, { "docid": "d4e08f5a0208f0e80de5103abfbb81ea", "score": "0.50330085", "text": "func validateSubnet(subnet string) error {\n\tip, cidr, err := netutil.ParseAddr(subnet)\n\tif err != nil {\n\t\treturn errors.Errorf(\"Sorry, unable to parse subnet: %v\", err)\n\t}\n\tif !ip.IsPrivate() {\n\t\treturn errors.Errorf(\"Sorry, the subnet %s is not a private IP\", ip)\n\t}\n\n\tif cidr != nil {\n\t\tmask, _ := cidr.Mask.Size()\n\t\tif mask > 30 {\n\t\t\treturn errors.Errorf(\"Sorry, the subnet provided does not have a mask less than or equal to /30\")\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "94889b25928393048102a64a15765f3f", "score": "0.50322896", "text": "func Validate(conf *netv1.NetworkConfig) error {\n\terrs := []error{}\n\n\terrs = append(errs, ValidateDefaultNetwork(conf)...)\n\n\tif len(errs) > 0 {\n\t\treturn errors.Errorf(\"invalid configuration: %v\", errs)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1c1387d8045787fa5650067ffdfd862f", "score": "0.50279933", "text": "func isPrivateIP(ipStr string) bool {\n\tip := net.ParseIP(ipStr)\n\tfor _, priv := range privateBlocks {\n\t\tif priv.Contains(ip) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "a06e16269fe916d562a14271dbe494bb", "score": "0.5008941", "text": "func (m *FpolicyConnectionInlineSvm) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateLinks(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b3cd9c3773738f554f83f3be26faa781", "score": "0.50013447", "text": "func (m *V5ModifyNodePoolRequestScaling) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" } ]
5df01bf42276635a228fc82c52d0d8a5
MaxConnsPerBroker is a ClientOption to set the maximum number of connections to pool for a given broker in the cluster. The default is 2. Deprecated: the client now maintains one connection per broker.
[ { "docid": "e5c86f06038339505453cc6126fdee04", "score": "0.84446913", "text": "func MaxConnsPerBroker(max int) ClientOption {\n\treturn func(o *ClientOptions) error {\n\t\to.MaxConnsPerBroker = max\n\t\treturn nil\n\t}\n}", "title": "" } ]
[ { "docid": "3cd2049f06af3d9b34a5012643d8dc87", "score": "0.5719962", "text": "func (client *SocketClient) SetMaxPoolSize(size int) {\n\tpool := make(chan *connEntry, size)\n\tfor i := 0; i < len(client.connPool); i++ {\n\t\tselect {\n\t\tcase pool <- <-client.connPool:\n\t\tdefault:\n\t\t}\n\t}\n\tclient.connPool = pool\n}", "title": "" }, { "docid": "8bd505ad69813a8deba0db6d8128ddce", "score": "0.56749594", "text": "func (client *SocketClient) MaxPoolSize() int {\n\treturn cap(client.connPool)\n}", "title": "" }, { "docid": "b226c651b529fc953fc33a6ff5fe50ff", "score": "0.565162", "text": "func MaxConnectionsPerHost(conns int) OutboundOption {\n\treturn func(c *outboundConfig) {\n\t\tc.MaxConnsPerHost = conns\n\t}\n}", "title": "" }, { "docid": "65d9fd241e58d2b87163072bc76488ab", "score": "0.5510727", "text": "func (db *DB) MaxConns() int {\n\treturn db.maxConns\n}", "title": "" }, { "docid": "a5214e02989a0faba8cae03b2991251b", "score": "0.53895503", "text": "func NumMaxActiveConnections(numMaxActiveConnections int) Option {\n\treturn func(c *cosmosImpl) {\n\t\tc.numMaxActiveConnections = numMaxActiveConnections\n\t}\n}", "title": "" }, { "docid": "f2431c77fc8ff4ac764349b948cc331c", "score": "0.5378761", "text": "func (p *Pool) SetMaxOpenConns(n int) {\n\treturn\n}", "title": "" }, { "docid": "da3b7b60c1eb8c80ea433bfd75b50f57", "score": "0.5359297", "text": "func MaxWorkers(count int) Option {\n\treturn func(p *Provider) {\n\t\tp.workerLimit = count\n\t}\n}", "title": "" }, { "docid": "eef10be5f2f382cac116e40909c5a0f7", "score": "0.5341908", "text": "func WithMaxIdleConnsPerHost(conns int) ClientOrHTTPClientParam {\n\treturn clientOrHTTPClientParamFunc(func(b *httpClientBuilder) error {\n\t\tb.TransportParams = refreshingclient.ConfigureTransport(b.TransportParams, func(p refreshingclient.TransportParams) refreshingclient.TransportParams {\n\t\t\tp.MaxIdleConnsPerHost = conns\n\t\t\treturn p\n\t\t})\n\t\treturn nil\n\t})\n}", "title": "" }, { "docid": "1becd1d37891962badf610adbf93cfa1", "score": "0.52901995", "text": "func WithMaxIdleConnsPerHost(max int) Option {\n\treturn func(c *config) {\n\t\tc.maxIdleConnsPerHost = max\n\t}\n}", "title": "" }, { "docid": "3089a5b627846f3cc0df5a555edb780d", "score": "0.5254787", "text": "func (this *Client) SetMaxOpenConns(n int) {\n\tthis.mu.Lock()\n\tthis.maxOpen = n\n\tif n < 0 {\n\t\tthis.maxOpen = 0\n\t}\n\tsyncMaxIdle := this.maxOpen > 0 && this.maxIdleConnsLocked() > this.maxOpen\n\tthis.mu.Unlock()\n\tif syncMaxIdle {\n\t\tthis.SetMaxIdleConns(n)\n\t}\n}", "title": "" }, { "docid": "d3bb3a1531550b24733d7a7e117f9e40", "score": "0.51818424", "text": "func WithMaxOpenConns(size int) Option {\n\treturn func(o *options) {\n\t\to.maxOpenConns = size\n\t}\n}", "title": "" }, { "docid": "37e83f88069c4730462d9e728564ba53", "score": "0.51590043", "text": "func MaxOpenConns(i int) ModelOption {\n\treturn func(opts *options) {\n\t\topts.maxOpenConns = i\n\t}\n}", "title": "" }, { "docid": "37e83f88069c4730462d9e728564ba53", "score": "0.51590043", "text": "func MaxOpenConns(i int) ModelOption {\n\treturn func(opts *options) {\n\t\topts.maxOpenConns = i\n\t}\n}", "title": "" }, { "docid": "0419b25cc6507f5611bb8601f25d6c48", "score": "0.5144305", "text": "func MaxIdleConns(i int) ModelOption {\n\treturn func(opts *options) {\n\t\topts.maxIdleConns = i\n\t}\n}", "title": "" }, { "docid": "0419b25cc6507f5611bb8601f25d6c48", "score": "0.5144305", "text": "func MaxIdleConns(i int) ModelOption {\n\treturn func(opts *options) {\n\t\topts.maxIdleConns = i\n\t}\n}", "title": "" }, { "docid": "49ea7a24d84a942232746d2b52bc9886", "score": "0.5121572", "text": "func (p *Pool) SetMaxIdleConns(n int) {\n\treturn\n}", "title": "" }, { "docid": "d1122457495740c90252d0479044b383", "score": "0.5105989", "text": "func WithMaxIdleConns(size int) Option {\n\treturn func(o *options) {\n\t\to.maxIdleConns = size\n\t}\n}", "title": "" }, { "docid": "07391cbfea2826d72d299cab305a6bb0", "score": "0.50815535", "text": "func WithMaxIdleConns(conns int) ClientOrHTTPClientParam {\n\treturn clientOrHTTPClientParamFunc(func(b *httpClientBuilder) error {\n\t\tb.TransportParams = refreshingclient.ConfigureTransport(b.TransportParams, func(p refreshingclient.TransportParams) refreshingclient.TransportParams {\n\t\t\tp.MaxIdleConns = conns\n\t\t\treturn p\n\t\t})\n\t\treturn nil\n\t})\n}", "title": "" }, { "docid": "41ece3a201246bed58d942bdca91c839", "score": "0.50638616", "text": "func NumReplicas(n int) Option {\n\treturn numReplicasOption{numReplicas: n}\n}", "title": "" }, { "docid": "2005394a45d57738c0b2c023a35e513c", "score": "0.50592643", "text": "func (ctx *Context) SetMaxSockets(n int) error {\n\treturn setOption(ctx, C.ZMQ_MAX_SOCKETS, n)\n}", "title": "" }, { "docid": "98cc9cf5192cc5aaeb5bd439cd3cf73f", "score": "0.5052223", "text": "func (cm *DBConnectionManager) SetMaxOpenConns(n int) {\n\tcm.maxOpenConns = n\n}", "title": "" }, { "docid": "e5f93b59a38e12649d75e83ed137813c", "score": "0.50516766", "text": "func (db DB) SetMaxOpenConns(n int) {\n\tdb.db.SetMaxOpenConns(n)\n}", "title": "" }, { "docid": "320281590e9fc2b7264f35f9ce95cf14", "score": "0.50479263", "text": "func (el *etcdLimiter) LimitConns() (int, error) {\n\tval, err := el.limitCache.Get(el.keyLimitConns)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treturn val.(int), nil\n}", "title": "" }, { "docid": "482d7d61c449a7eab9c4d7e36f1a404d", "score": "0.5008594", "text": "func (pool *Pool) SetMaxWorkers(n int32) {\n\tpool.maxWorkers = n\n}", "title": "" }, { "docid": "2e0a1d3e5f49b7f4a87345072061291d", "score": "0.50042623", "text": "func WithHTTPMaxConnsPerHost(n int) HTTPClientOption {\n\treturn newFuncHTTPOption(func(o *httpClientOptions) error {\n\t\to.maxConnsPerHost = n\n\n\t\treturn nil\n\t})\n}", "title": "" }, { "docid": "30f9310029061edf6a48479d25b16282", "score": "0.4991766", "text": "func SetMaxConnections(count int) Param {\n\treturn setParamInt(\"max_connections\", count)\n}", "title": "" }, { "docid": "55102a440e2f0eeca47a23c3b4c3d88e", "score": "0.49838945", "text": "func (_m *DatabaseI) SetMaxOpenConns(n int) {\n\t_m.Called(n)\n}", "title": "" }, { "docid": "067de8ad166c65d2be848e498d19d4df", "score": "0.49791214", "text": "func WithBrokers(brokers ...string) ClientOption {\n\treturn func(client *KafkaConsumer) {\n\t\tclient.brokers = brokers\n\t}\n}", "title": "" }, { "docid": "2b4bfed6ef240ecdf6ad0153c6ad147e", "score": "0.49429286", "text": "func (o BackendServiceBackendOutput) MaxConnectionsPerInstance() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v BackendServiceBackend) *int { return v.MaxConnectionsPerInstance }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "d00ba434b79a0d7ae0ca763599cb94d7", "score": "0.49395284", "text": "func applyBrokerThrottles(bs map[int]struct{}, capacities, prevThrottles replicationCapacityByBroker, l Limits, zk kafkazk.Handler) (chan brokerChangeEvent, []string) {\n\tevents := make(chan brokerChangeEvent, len(bs)*2)\n\tvar errs []string\n\n\t// Set the throttle config for all reassigning brokers.\n\tfor ID := range bs {\n\t\tbrokerConfig := kafkazk.KafkaConfig{\n\t\t\tType: \"broker\",\n\t\t\tName: strconv.Itoa(ID),\n\t\t\tConfigs: []kafkazk.KafkaConfigKV{},\n\t\t}\n\n\t\t// Check if a rate was determined for each role (leader, follower) type.\n\t\tfor i, rate := range capacities[ID] {\n\t\t\tif rate == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\trole := roleFromIndex(i)\n\n\t\t\tprevRate := prevThrottles[ID][i]\n\t\t\tif prevRate == nil {\n\t\t\t\tv := 0.00\n\t\t\t\tprevRate = &v\n\t\t\t}\n\n\t\t\tvar max float64\n\t\t\tswitch role {\n\t\t\tcase \"leader\":\n\t\t\t\tmax = l[\"srcMax\"]\n\t\t\tcase \"follower\":\n\t\t\t\tmax = l[\"dstMax\"]\n\t\t\t}\n\n\t\t\tlog.Printf(\"Replication throttle rate for broker %d [%s] (based on a %.0f%% max free capacity utilization): %0.2fMB/s\\n\",\n\t\t\t\tID, role, max, *rate)\n\n\t\t\t// Check if the delta between the newly calculated throttle and the\n\t\t\t// previous throttle exceeds the ChangeThreshold param.\n\t\t\td := math.Abs((*prevRate - *rate) / *prevRate * 100)\n\t\t\tif d < Config.ChangeThreshold {\n\t\t\t\tlog.Printf(\"Proposed throttle is within %.2f%% of the previous throttle \"+\n\t\t\t\t\t\"(below %.2f%% threshold), skipping throttle update for broker %d\\n\",\n\t\t\t\t\td, Config.ChangeThreshold, ID)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\trateBytesString := fmt.Sprintf(\"%.0f\", *rate*1000000.00)\n\n\t\t\t// Append config.\n\t\t\tc := kafkazk.KafkaConfigKV{fmt.Sprintf(\"%s.replication.throttled.rate\", role), rateBytesString}\n\t\t\tbrokerConfig.Configs = append(brokerConfig.Configs, c)\n\t\t}\n\n\t\t// Write the throttle config.\n\t\tchanges, err := zk.UpdateKafkaConfig(brokerConfig)\n\t\tif err != nil {\n\t\t\terrs = append(errs, fmt.Sprintf(\"Error setting throttle on broker %d: %s\", ID, err))\n\t\t}\n\n\t\tfor i, changed := range changes {\n\t\t\tif changed {\n\t\t\t\t// This will be either \"leader.replication.throttled.rate\" or\n\t\t\t\t// \"follower.replication.throttled.rate\".\n\t\t\t\tthrottleConfigString := brokerConfig.Configs[i][0]\n\t\t\t\t// Split on \".\", get \"leader\" or \"follower\" string.\n\t\t\t\trole := strings.Split(throttleConfigString, \".\")[0]\n\n\t\t\t\tlog.Printf(\"Updated throttle on broker %d [%s]\\n\", ID, role)\n\n\t\t\t\tvar rate *float64\n\n\t\t\t\t// Store the configured rate.\n\t\t\t\tswitch role {\n\t\t\t\tcase \"leader\":\n\t\t\t\t\trate = capacities[ID][0]\n\t\t\t\t\tprevThrottles.storeLeaderCapacity(ID, *rate)\n\t\t\t\tcase \"follower\":\n\t\t\t\t\trate = capacities[ID][1]\n\t\t\t\t\tprevThrottles.storeFollowerCapacity(ID, *rate)\n\t\t\t\t}\n\n\t\t\t\tevents <- brokerChangeEvent{\n\t\t\t\t\tid: ID,\n\t\t\t\t\trole: role,\n\t\t\t\t\trate: *rate,\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Hard coded sleep to reduce\n\t\t// ZK load.\n\t\ttime.Sleep(250 * time.Millisecond)\n\t}\n\n\tclose(events)\n\n\treturn events, errs\n}", "title": "" }, { "docid": "cdb6ec89b2dd8c0483801f5bd46ac4a7", "score": "0.49359632", "text": "func NewBroker(saKubeClientConfig *restclient.Config, informer templateinformer.TemplateInformer, namespaces []string) (*Broker, error) {\n\ttemplateNamespaces := map[string]struct{}{}\n\tfor _, namespace := range namespaces {\n\t\ttemplateNamespaces[namespace] = struct{}{}\n\t}\n\n\tkubeClient, err := kclientset.NewForConfig(saKubeClientConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ttemplateClient, err := templateclientset.NewForConfig(saKubeClientConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdynamicClient, err := dynamic.NewForConfig(saKubeClientConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// TODO use the genericclioptions and use \"normal\" construction\n\t// The more groups you have, the more discovery requests you need to make.\n\t// given 25 groups (our groups + a few custom resources) with one-ish version each, discovery needs to make 50 requests\n\t// double it just so we don't end up here again for a while. This config is only used for discovery.\n\tdiscoveryConfig := restclient.CopyConfig(saKubeClientConfig)\n\tdiscoveryConfig.Burst = 100\n\tdiscoveryClient, err := discovery.NewDiscoveryClientForConfig(discoveryConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tcachedDiscovery := cacheddiscovery.NewMemCacheClient(discoveryClient)\n\trestMapper := restmapper.NewDeferredDiscoveryRESTMapper(cachedDiscovery)\n\n\t// start keeping the restmapper up to date with reality\n\trestMapper.Reset()\n\tgo wait.Until(restMapper.Reset, 30*time.Second, wait.NeverStop)\n\n\tdelay := 5 * time.Second\n\tvalue := os.Getenv(\"TEMPLATE_SERVICE_BROKER_GC_DELAY\")\n\tif len(value) != 0 {\n\t\tif v, err := time.ParseDuration(value); err == nil {\n\t\t\tdelay = v\n\t\t}\n\t}\n\tb := &Broker{\n\t\tkc: kubeClient,\n\t\ttemplateclient: templateClient.Template(),\n\t\tlister: informer.Lister(),\n\t\thasSynced: informer.Informer().HasSynced,\n\t\ttemplateNamespaces: templateNamespaces,\n\t\trestmapper: restMapper,\n\t\tdynamicClient: dynamicClient,\n\t\tgcCreateDelay: delay,\n\t}\n\n\treturn b, nil\n}", "title": "" }, { "docid": "d89fed5199ba1c3991413bb369fdd8df", "score": "0.49353904", "text": "func (db *DB) SetMaxOpenConns(n int) {\n\tdb.DB.SetMaxOpenConns(n)\n}", "title": "" }, { "docid": "e70523c170009bfbcf7ee9d13402aa37", "score": "0.4919361", "text": "func (ctx *Context) GetMaxSockets() (int, error) {\n\treturn getOption(ctx, C.ZMQ_MAX_SOCKETS)\n}", "title": "" }, { "docid": "ec24f336960b641cf5bc98ac272f630d", "score": "0.49167764", "text": "func (p *Process) ConnectionsMax(max int) ([]net.ConnectionStat, error) {\n\treturn p.ConnectionsMaxWithContext(context.Background(), max)\n}", "title": "" }, { "docid": "5538b760f2af90646e0d612e33c6a170", "score": "0.48964238", "text": "func WithMaxConcurrency(mc int) ConfigOption {\n\treturn func(c *Config) error {\n\t\tc.MaxConcurrent = mc\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "63e40a25f64db838f14d35daed6dda17", "score": "0.48934707", "text": "func (c *ClientOptions) SetMaxPoolSize(u uint16) *ClientOptions {\n\tc.MaxPoolSize = &u\n\treturn c\n}", "title": "" }, { "docid": "22c99bf341db572267c52cffb4620726", "score": "0.4883247", "text": "func WithConnMaxRetries(n int) CMDProviderOption {\n\treturn func(o *cmdProviderOptions) {\n\t\to.connMaxRetries = n\n\t}\n}", "title": "" }, { "docid": "e34e0bbf6b16b6603f551a5121a704be", "score": "0.48526958", "text": "func (this *Client) SetMaxIdleConns(n int) {\n\tthis.mu.Lock()\n\tif n > 0 {\n\t\tthis.maxIdle = n\n\t} else {\n\t\t// No idle connections.\n\t\tthis.maxIdle = -1\n\t}\n\t// Make sure maxIdle doesn't exceed maxOpen\n\tif this.maxOpen > 0 && this.maxIdleConnsLocked() > this.maxOpen {\n\t\tthis.maxIdle = this.maxOpen\n\t}\n\tvar closing []*driverConn\n\tidleCount := len(this.freeConn)\n\tmaxIdle := this.maxIdleConnsLocked()\n\tif idleCount > maxIdle {\n\t\tclosing = this.freeConn[maxIdle:]\n\t\tthis.freeConn = this.freeConn[:maxIdle]\n\t}\n\tthis.mu.Unlock()\n\tfor _, c := range closing {\n\t\tc.Close()\n\t}\n}", "title": "" }, { "docid": "a8d9f592e591eaa3c8b120fe1164ba12", "score": "0.48503518", "text": "func (o RegionBackendServiceBackendOutput) MaxConnectionsPerInstance() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v RegionBackendServiceBackend) *int { return v.MaxConnectionsPerInstance }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "7fccb7165fcd9a385d953de0b2031ee1", "score": "0.48184907", "text": "func (b *BrokerBuilder) RetryAfterMax(max *string) *BrokerBuilder {\n\tif max == nil || *max == \"\" {\n\t\treturn b\n\t}\n\tif b.broker.Spec.Delivery == nil {\n\t\tb.broker.Spec.Delivery = &v1.DeliverySpec{}\n\t}\n\tb.broker.Spec.Delivery.RetryAfterMax = max\n\treturn b\n\n}", "title": "" }, { "docid": "c078e1d5763aa069df491a32c08f94c9", "score": "0.48118716", "text": "func SetMaxOpenConns(max int) {\n\tdatabase.SQLDB().SetMaxOpenConns(max)\n}", "title": "" }, { "docid": "aec7716cf6d13720a23b8dc533c89900", "score": "0.48113558", "text": "func ConnectionsMax(kind string, max int) ([]ConnectionStat, error) {\n\treturn []ConnectionStat{}, common.ErrNotImplementedError\n}", "title": "" }, { "docid": "3f3bcacd4207b6b9ff82351a9ee88aff", "score": "0.47746405", "text": "func (p *Pool) MaximumCapacity() int { return cap(p.getConns()) }", "title": "" }, { "docid": "9f6898c949912ed23f2042501d79c60f", "score": "0.47446936", "text": "func ModifyMaxMessageCount(config *common.Config) (uint32, error) {\n\n\t// Modify Config\n\tbatchSizeBytes := config.ChannelGroup.Groups[\"Orderer\"].Values[\"BatchSize\"].Value\n\tbatchSize := &orderer.BatchSize{}\n\tif err := proto.Unmarshal(batchSizeBytes, batchSize); err != nil {\n\t\treturn 0, err\n\t}\n\tbatchSize.MaxMessageCount = batchSize.MaxMessageCount + 1\n\tnewMatchSizeBytes, err := proto.Marshal(batchSize)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tconfig.ChannelGroup.Groups[\"Orderer\"].Values[\"BatchSize\"].Value = newMatchSizeBytes\n\n\treturn batchSize.MaxMessageCount, nil\n}", "title": "" }, { "docid": "b641c463c4a20210833190a9d579979d", "score": "0.47433937", "text": "func (_m *DatabaseI) SetMaxIdleConns(n int) {\n\t_m.Called(n)\n}", "title": "" }, { "docid": "9c922a8a324982db5c6f655fec7d28f4", "score": "0.47110838", "text": "func (c *Client) MaxNumberOfRetries() int {\n\treturn c.cfg.maxNumberOfRetries\n}", "title": "" }, { "docid": "f684827c7606ad803b606848a066357e", "score": "0.46939647", "text": "func (db DB) SetMaxIdleConns(n int) {\n\tdb.db.SetMaxIdleConns(n)\n}", "title": "" }, { "docid": "c668570569d9e511d6fbdb9516fca46f", "score": "0.46601972", "text": "func MaxSize(size int64) Option {\n\treturn func(c *Client) {\n\t\tc.maxSize = size\n\t}\n}", "title": "" }, { "docid": "9f187def769ec2a8c5b29f29609aa3bb", "score": "0.46530882", "text": "func (cm *DBConnectionManager) SetMaxIdleConns(n int) {\n\tcm.maxIdleConns = n\n}", "title": "" }, { "docid": "aa18c26607313e67e4eca6f04ada8299", "score": "0.46470058", "text": "func (o EndpointConfigurationShadowProductionVariantServerlessConfigOutput) MaxConcurrency() pulumi.IntOutput {\n\treturn o.ApplyT(func(v EndpointConfigurationShadowProductionVariantServerlessConfig) int { return v.MaxConcurrency }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "251a98e5a6a0f230cd628c02e4898940", "score": "0.4644823", "text": "func (m *wsNotificationManager) NumClients() (n int) {\n\tselect {\n\tcase n = <-m.numClients:\n\tcase <-m.quit: // Use default n (0) if server has shut down.\n\t}\n\treturn\n}", "title": "" }, { "docid": "9502f3429b8d7049fc67d406414b2c39", "score": "0.46136367", "text": "func (o EndpointConfigurationProductionVariantServerlessConfigOutput) MaxConcurrency() pulumi.IntOutput {\n\treturn o.ApplyT(func(v EndpointConfigurationProductionVariantServerlessConfig) int { return v.MaxConcurrency }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "bf69f932f8950556413b9eb1de81928b", "score": "0.4600981", "text": "func (l *listener) Conns() chan net.Conn { return l.conns }", "title": "" }, { "docid": "ce2a7bde7ef2228e77da23866f84ad57", "score": "0.45954984", "text": "func (n *Nats) GetMaxConnectionCount() int {\n\tif n.Size == 0 {\n\t\treturn 100\n\t}\n\treturn n.Size\n}", "title": "" }, { "docid": "14a8f9b088b8df92a377e2ca40be212b", "score": "0.45837983", "text": "func configureGoMaxProcs() {\n\tisOnlyOne := runtime.GOMAXPROCS(0) == 1\n\tif isOnlyOne {\n\t\truntime.GOMAXPROCS(2)\n\t}\n}", "title": "" }, { "docid": "217959e3bcf851c808efc684d1ab1b56", "score": "0.45777136", "text": "func ConnMaxSessions(n int) ConnOption {\n\treturn func(c *conn) error {\n\t\tif n < 1 {\n\t\t\treturn errorNew(\"max sessions cannot be less than 1\")\n\t\t}\n\t\tif n > 65536 {\n\t\t\treturn errorNew(\"max sessions cannot be greater than 65536\")\n\t\t}\n\t\tc.channelMax = uint16(n - 1)\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "3f67638961ffbd5871449e90fdccae0f", "score": "0.4577513", "text": "func (engine *Engine) SetMaxOpenConns(conns int) {\n\tengine.DB().SetMaxOpenConns(conns)\n}", "title": "" }, { "docid": "2c719ae01b028bc4bce0208ba340def3", "score": "0.45713285", "text": "func MaxRetry(maxRetry int) Option {\n\treturn func(opts *options) {\n\t\topts.maxRetry = maxRetry\n\t}\n}", "title": "" }, { "docid": "72521fd04181c518e34e74b38a93710b", "score": "0.45616052", "text": "func (cm *BasicConnMgr) getConnsToClose() []network.Conn {\n\tif cm.cfg.lowWater == 0 || cm.cfg.highWater == 0 {\n\t\t// disabled\n\t\treturn nil\n\t}\n\n\tif int(cm.connCount.Load()) <= cm.cfg.lowWater {\n\t\tlog.Info(\"open connection count below limit\")\n\t\treturn nil\n\t}\n\n\tcandidates := make(peerInfos, 0, cm.segments.countPeers())\n\tvar ncandidates int\n\tgracePeriodStart := cm.clock.Now().Add(-cm.cfg.gracePeriod)\n\n\tcm.plk.RLock()\n\tfor _, s := range cm.segments.buckets {\n\t\ts.Lock()\n\t\tfor id, inf := range s.peers {\n\t\t\tif _, ok := cm.protected[id]; ok {\n\t\t\t\t// skip over protected peer.\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif inf.firstSeen.After(gracePeriodStart) {\n\t\t\t\t// skip peers in the grace period.\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// note that we're copying the entry here,\n\t\t\t// but since inf.conns is a map, it will still point to the original object\n\t\t\tcandidates = append(candidates, inf)\n\t\t\tncandidates += len(inf.conns)\n\t\t}\n\t\ts.Unlock()\n\t}\n\tcm.plk.RUnlock()\n\n\tif ncandidates < cm.cfg.lowWater {\n\t\tlog.Info(\"open connection count above limit but too many are in the grace period\")\n\t\t// We have too many connections but fewer than lowWater\n\t\t// connections out of the grace period.\n\t\t//\n\t\t// If we trimmed now, we'd kill potentially useful connections.\n\t\treturn nil\n\t}\n\n\t// Sort peers according to their value.\n\tcandidates.SortByValueAndStreams(&cm.segments, false)\n\n\ttarget := ncandidates - cm.cfg.lowWater\n\n\t// slightly overallocate because we may have more than one conns per peer\n\tselected := make([]network.Conn, 0, target+10)\n\n\tfor _, inf := range candidates {\n\t\tif target <= 0 {\n\t\t\tbreak\n\t\t}\n\n\t\t// lock this to protect from concurrent modifications from connect/disconnect events\n\t\ts := cm.segments.get(inf.id)\n\t\ts.Lock()\n\t\tif len(inf.conns) == 0 && inf.temp {\n\t\t\t// handle temporary entries for early tags -- this entry has gone past the grace period\n\t\t\t// and still holds no connections, so prune it.\n\t\t\tdelete(s.peers, inf.id)\n\t\t} else {\n\t\t\tfor c := range inf.conns {\n\t\t\t\tselected = append(selected, c)\n\t\t\t}\n\t\t\ttarget -= len(inf.conns)\n\t\t}\n\t\ts.Unlock()\n\t}\n\n\treturn selected\n}", "title": "" }, { "docid": "f21656d8345ee1466c22e7175d5d6779", "score": "0.45579237", "text": "func SetMaxSockets(n int) error {\n\tif initVersionError != nil {\n\t\treturn initVersionError\n\t}\n\tif initContextError != nil {\n\t\treturn initContextError\n\t}\n\treturn defaultCtx.SetMaxSockets(n)\n}", "title": "" }, { "docid": "9c0084c7debe06fd4e75d169c386a27a", "score": "0.45426002", "text": "func (o BackendServiceBackendOutput) MaxConnectionsPerEndpoint() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v BackendServiceBackend) *int { return v.MaxConnectionsPerEndpoint }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "ff9d58ca5d925ff3539f003848f9e74e", "score": "0.45333284", "text": "func Broker(b broker.MessageBroker) Option {\n\treturn func(o *Options) {\n\t\to.Broker = b\n\t}\n}", "title": "" }, { "docid": "d7ca7a0562b884206c3ec1f674e55a87", "score": "0.4526902", "text": "func ResilientClientWithMaxRetry(retryMax int) ResilientOptions {\n\treturn func(o *resilientOptions) {\n\t\to.retryMax = retryMax\n\t}\n}", "title": "" }, { "docid": "2bbce8ac53ff2d0b506c54b53c6ae0eb", "score": "0.45238885", "text": "func (b *dbBaseBackend) SetMaxOpenConns(maxOpenConns int) {\n\tb.db.SetMaxOpenConns(maxOpenConns)\n}", "title": "" }, { "docid": "07a57da151e553c7dab928a67ed901b5", "score": "0.45079085", "text": "func (cp *grpcGcpConnPool) Num() int {\n\treturn cp.size\n}", "title": "" }, { "docid": "644eb3d85434a318859e8d06f33a19aa", "score": "0.45072407", "text": "func (o EndpointConfigurationAsyncInferenceConfigClientConfigOutput) MaxConcurrentInvocationsPerInstance() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v EndpointConfigurationAsyncInferenceConfigClientConfig) *int {\n\t\treturn v.MaxConcurrentInvocationsPerInstance\n\t}).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "b64839b981eebc923794e2959f152e24", "score": "0.45069683", "text": "func Broker(b broker.Broker) Option {\n\treturn func(o *Options) {\n\t\to.Broker = b\n\t\tif o.Client != nil {\n\t\t\t// Update Client and Server\n\t\t\to.Client.Init(client.Broker(b))\n\t\t}\n\t\tif o.Server != nil {\n\t\t\to.Server.Init(server.Broker(b))\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c60795cc31a9fb8a0f9747527a936f0b", "score": "0.44978523", "text": "func WithMaxMsgSize(s int) DialOption {\n\treturn func(o *dialOptions) {\n\t\to.maxMsgSize = s\n\t}\n}", "title": "" }, { "docid": "b28806d01804e189f58a3a365dcc2268", "score": "0.44972152", "text": "func WithMaxBackups(count int) Option {\n\treturn func(c *config) {\n\t\tif count < 0 {\n\t\t\tcount = 0\n\t\t}\n\n\t\tc.maxBackups = count\n\t}\n}", "title": "" }, { "docid": "3bdc58ff058aac85885e7df2358721d8", "score": "0.44850776", "text": "func (backend Backend) MaxConnections() int {\n\tif backend.GCS != nil {\n\t\treturn backend.GCS.MaxConnections\n\t} else if backend.Azure != nil {\n\t\treturn backend.Azure.MaxConnections\n\t} else if backend.B2 != nil {\n\t\treturn backend.B2.MaxConnections\n\t}\n\treturn 0\n}", "title": "" }, { "docid": "ace0f35a092c93209c1e6a5735eca47d", "score": "0.44763094", "text": "func (c *Config) SetCBWorkerCount(count int) {\n\tc.cbPoolWorker.Set(float64(count))\n}", "title": "" }, { "docid": "4a5acafb720f2cc9235c5871b8f9ef8f", "score": "0.44746327", "text": "func (o BackendServiceCircuitBreakersOutput) MaxConnections() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v BackendServiceCircuitBreakers) *int { return v.MaxConnections }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "76efba3cccc77812e77206426cca30bf", "score": "0.44651", "text": "func (cm *Cluster) connectionPoolForClient(clientId string, conf ClusterConnectionConf) (*ConnectionPool, error) {\n\treturn cm.connPoolCache.getOrCreateConnectionPool(clientId, conf, cm.metadataConnPool.GetAllAddrs())\n}", "title": "" }, { "docid": "5299f2d2ebc6700e16d4ce94f0b8c291", "score": "0.44600168", "text": "func (o AutoscalerAutoscalingPolicyOutput) MaxReplicas() pulumi.IntOutput {\n\treturn o.ApplyT(func(v AutoscalerAutoscalingPolicy) int { return v.MaxReplicas }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "1a9058035e96e74c46a85416d66513fc", "score": "0.4457741", "text": "func (o EndpointConfigurationAsyncInferenceConfigClientConfigPtrOutput) MaxConcurrentInvocationsPerInstance() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *EndpointConfigurationAsyncInferenceConfigClientConfig) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.MaxConcurrentInvocationsPerInstance\n\t}).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "c06ef12ac3ab19719dbcc774626b0d2e", "score": "0.44525388", "text": "func WithBufferSize(size int) brokerOption {\n\treturn func(b *Broker) error {\n\t\tif size <= 0 {\n\t\t\treturn fmt.Errorf(\"broker.WithBufferSize: invalid size value (%d)\", size)\n\t\t}\n\t\tb.bufSize = size\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "2afa0b60049cd4598c43a95f4e521af7", "score": "0.4450361", "text": "func newConnectionPool(conf BrokerConf) connectionPool {\n\treturn connectionPool{\n\t\tconf: conf,\n\t\tmu: &sync.RWMutex{},\n\t\tclosedChan: make(chan struct{}),\n\t\tbackends: make(map[string]*backend),\n\t}\n}", "title": "" }, { "docid": "b1360d3f2b9895b422c4a53a3d06949e", "score": "0.44465506", "text": "func WithMaxIdleConns(maxIdleConns int) ServerOption {\n\treturn ServerOptionFunc(func(c *Server) {\n\t\tc.maxIdleConns = maxIdleConns\n\t})\n}", "title": "" }, { "docid": "07fc42236b17af115f5057b360c0df91", "score": "0.44463897", "text": "func WithHTTPMaxIdleConns(n int) HTTPClientOption {\n\treturn newFuncHTTPOption(func(o *httpClientOptions) error {\n\t\to.maxIdleConns = n\n\n\t\treturn nil\n\t})\n}", "title": "" }, { "docid": "777e2db8ab9c0a22c6bcba90d7bf3368", "score": "0.44453108", "text": "func (o BackendServiceBackendOutput) MaxConnections() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v BackendServiceBackend) *int { return v.MaxConnections }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "b127ab265988d35f9d0301f53906ac68", "score": "0.44440076", "text": "func (c Config) GetMaxIdleConnections(parallelConns int) int {\n\tif c.MaxIdleConnections == 0 {\n\t\treturn parallelConns\n\t}\n\treturn c.MaxIdleConnections\n}", "title": "" }, { "docid": "815591579e3ea42ca1e311aadc9849b3", "score": "0.4442098", "text": "func (mc *Cluster) SetMaxReplicas(v int) {\n\tmc.updateReplicationConfig(func(r *sc.ReplicationConfig) { r.MaxReplicas = uint64(v) })\n}", "title": "" }, { "docid": "c270f60fbff1d70dec07d7f5b4709799", "score": "0.44379693", "text": "func (o RegionBackendServiceBackendOutput) MaxConnectionsPerEndpoint() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v RegionBackendServiceBackend) *int { return v.MaxConnectionsPerEndpoint }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "b8ac015750f1ff1ec5e4e6bee9e9d550", "score": "0.4436634", "text": "func (s *Server) SetMaxConnection(n int) {\n\ts.config.MaxConnection = n\n}", "title": "" }, { "docid": "99e49d60e617120deee0e08402cee215", "score": "0.44342485", "text": "func (c *Config) MaxOpenConnections() int {\n\treturn c.MaxOpenConns\n}", "title": "" }, { "docid": "ad81f905dea597dcac1d85f0ad5a51b1", "score": "0.44304943", "text": "func (app *Application) nClients() int {\n\treturn app.clients.nClients()\n}", "title": "" }, { "docid": "340b31e2c64ac90a134e25fa608592d8", "score": "0.4423781", "text": "func (o ServiceAttachmentConsumerAcceptListOutput) ConnectionLimit() pulumi.IntOutput {\n\treturn o.ApplyT(func(v ServiceAttachmentConsumerAcceptList) int { return v.ConnectionLimit }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "dcdd391a11609107d6cd9fecc6640a54", "score": "0.4419628", "text": "func (o RegionBackendServiceCircuitBreakersOutput) MaxConnections() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v RegionBackendServiceCircuitBreakers) *int { return v.MaxConnections }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "03931dc58d923c0fc0fffcbaeba45126", "score": "0.44188532", "text": "func GenReplicaConfigs(platform string, cluster string, service string, azs []string, opts *manage.CatalogKafkaOptions, zkServers string) []*manage.ReplicaConfig {\n\tdomain := dns.GenDefaultDomainName(cluster)\n\n\t// adjust the default configs by the number of members(replicas)\n\treplFactor := defaultReplFactor\n\tif int(opts.Replicas) < defaultReplFactor {\n\t\treplFactor = int(opts.Replicas)\n\t}\n\tminInsyncReplica := defaultInsyncReplicas\n\tif int(opts.Replicas) < defaultInsyncReplicas {\n\t\tminInsyncReplica = int(opts.Replicas)\n\t}\n\tnumPartitions := defaultMaxPartitions\n\tif int(opts.Replicas) < defaultMaxPartitions {\n\t\tnumPartitions = int(opts.Replicas)\n\t}\n\n\treplicaCfgs := make([]*manage.ReplicaConfig, opts.Replicas)\n\tfor i := 0; i < int(opts.Replicas); i++ {\n\t\t// create the sys.conf file\n\t\tmember := utils.GenServiceMemberName(service, int64(i))\n\t\tmemberHost := dns.GenDNSName(member, domain)\n\t\tsysCfg := catalog.CreateSysConfigFile(platform, memberHost)\n\n\t\t// create the server.properties file\n\t\tindex := i % len(azs)\n\t\tbind := memberHost\n\t\tif platform == common.ContainerPlatformSwarm {\n\t\t\tbind = catalog.BindAllIP\n\t\t}\n\t\tcontent := fmt.Sprintf(serverPropConfig, i, azs[index], strconv.FormatBool(opts.AllowTopicDel), numPartitions, bind, memberHost,\n\t\t\treplFactor, replFactor, replFactor, replFactor, minInsyncReplica, opts.RetentionHours, zkServers)\n\t\tserverCfg := &manage.ReplicaConfigFile{\n\t\t\tFileName: serverPropConfFileName,\n\t\t\tFileMode: common.DefaultConfigFileMode,\n\t\t\tContent: content,\n\t\t}\n\n\t\t// create the java.env file\n\t\tcontent = fmt.Sprintf(javaEnvConfig, opts.HeapSizeMB, opts.HeapSizeMB)\n\t\tjavaEnvCfg := &manage.ReplicaConfigFile{\n\t\t\tFileName: javaEnvConfFileName,\n\t\t\tFileMode: common.DefaultConfigFileMode,\n\t\t\tContent: content,\n\t\t}\n\n\t\t// create the log config file\n\t\tlogCfg := &manage.ReplicaConfigFile{\n\t\t\tFileName: logConfFileName,\n\t\t\tFileMode: common.DefaultConfigFileMode,\n\t\t\tContent: logConfConfig,\n\t\t}\n\n\t\tconfigs := []*manage.ReplicaConfigFile{sysCfg, serverCfg, javaEnvCfg, logCfg}\n\n\t\treplicaCfg := &manage.ReplicaConfig{Zone: azs[index], MemberName: member, Configs: configs}\n\t\treplicaCfgs[i] = replicaCfg\n\t}\n\treturn replicaCfgs\n}", "title": "" }, { "docid": "ff595acc996bfd919cd7593d5527532c", "score": "0.44150507", "text": "func removeBrokerThrottles(params *ReplicationThrottleConfigs) error {\n\t// Fetch brokers.\n\tbrokers, errs := params.zk.GetAllBrokerMeta(false)\n\tif errs != nil {\n\t\treturn errs[0]\n\t}\n\n\tvar ids = make(map[int]struct{})\n\tfor id := range brokers {\n\t\t// Skip brokers with an override where AutoRemove is false.\n\t\tif override, exists := params.brokerOverrides[id]; exists {\n\t\t\tif !override.Config.AutoRemove {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\tids[id] = struct{}{}\n\t}\n\n\treturn removeBrokerThrottlesByID(params, ids)\n}", "title": "" }, { "docid": "4a616f7fc6b3da0b6365f6bd2fde0323", "score": "0.4414463", "text": "func (o PrometheusSpecRemoteWriteQueueConfigOutput) MaxBackoff() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v PrometheusSpecRemoteWriteQueueConfig) *string { return v.MaxBackoff }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "13ff7ecf4b5cf5599a2f6c22eb8f48e3", "score": "0.44123924", "text": "func (o AutoscalarAutoscalingPolicyOutput) MaxReplicas() pulumi.IntOutput {\n\treturn o.ApplyT(func(v AutoscalarAutoscalingPolicy) int { return v.MaxReplicas }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "a5c7398c4823b30759f36a324e0fa7b2", "score": "0.44090715", "text": "func configureConnectionPool(dbPool *sql.DB) {\n // [START cloud_sql_mysql_databasesql_limit]\n\n // Set maximum number of connections in idle connection pool.\n dbPool.SetMaxIdleConns(5)\n\n // Set maximum number of open connections to the database.\n dbPool.SetMaxOpenConns(7)\n\n // [END cloud_sql_mysql_databasesql_limit]\n\n // [START cloud_sql_mysql_databasesql_lifetime]\n\n // Set Maximum time (in seconds) that a connection can remain open.\n dbPool.SetConnMaxLifetime(1800)\n\n // [END cloud_sql_mysql_databasesql_lifetime]\n}", "title": "" }, { "docid": "6a12dfca9ac179371733a31c4b96769b", "score": "0.44028136", "text": "func configureNCopies(c *cli.Context, bck cmn.Bck, copies int) (err error) {\n\tvar xid string\n\tif xid, err = api.MakeNCopies(apiBP, bck, copies); err != nil {\n\t\treturn\n\t}\n\tvar baseMsg string\n\tif copies > 1 {\n\t\tbaseMsg = fmt.Sprintf(\"Configured %s as %d-way mirror. \", bck.Cname(\"\"), copies)\n\t} else {\n\t\tbaseMsg = fmt.Sprintf(\"Configured %s for single-replica (no redundancy). \", bck.Cname(\"\"))\n\t}\n\tactionDone(c, baseMsg+toMonitorMsg(c, xid, \"\"))\n\treturn\n}", "title": "" }, { "docid": "13fc62c466ada46c89c2ef0e541b461f", "score": "0.43957058", "text": "func (o BackendServiceCircuitBreakersOutput) MaxRequestsPerConnection() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v BackendServiceCircuitBreakers) *int { return v.MaxRequestsPerConnection }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "1afc2529ffca413d406c6c52536d8a26", "score": "0.4392694", "text": "func WithMaxWorkerNum(num int) Setter {\n\treturn func(d *Dispatcher) error {\n\t\td.MaxWorkerNum = num\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "16e7450118b96059e12afcec24a1caa4", "score": "0.43905827", "text": "func (p *WorkerPool) MaxWorkers() int {\n\treturn p.maxWorkers\n}", "title": "" }, { "docid": "16a1a21859effbd8b08b943d51d93c06", "score": "0.4383142", "text": "func NewClient(connector Connector, conf ...ConfigFunc) (*Client, error) {\n\tctx, cancel := context.WithCancel(context.Background())\n\tc := &Client{\n\t\tconnector: connector,\n\t\texchName: \"default\",\n\t\tworkers: 1,\n\t\texchType: ExchangeTypeTopic,\n\t\tdeliveryMode: DeliveryModePersistent,\n\t\tdurable: true,\n\t\tpubChBuff: 10,\n\t\tconsumerName: internal.GetRandomName(),\n\t\tretryDelay: 100 * time.Millisecond,\n\t\tctx: ctx,\n\t\tcancel: cancel,\n\t}\n\tfor _, cnf := range conf {\n\t\terr := cnf(c)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif c.prefetchCount < c.workers {\n\t\tc.prefetchCount = c.workers\n\t}\n\terr := c.validate()\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"validating configuration\")\n\t}\n\tc.conn, err = c.connector()\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"getting a connection to the broker\")\n\t}\n\terr = c.setupChannel()\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"setting up a channel\")\n\t}\n\terr = c.setupQueue()\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"setting up a queue\")\n\t}\n\n\tif c.pubChBuff == 0 {\n\t\tc.pubChBuff = 1\n\t}\n\tc.pubCh = make(chan *publishMsg, c.workers*c.pubChBuff)\n\tfor i := 0; i < c.workers; i++ {\n\t\tc.publishWorker(ctx)\n\t}\n\tc.registerReconnect(ctx)\n\tc.started = true\n\treturn c, nil\n}", "title": "" }, { "docid": "df2b669471c563b32fcaed4c11580cef", "score": "0.43764043", "text": "func (o GetClustersClusterDbNodeOutput) MaxConnections() pulumi.IntOutput {\n\treturn o.ApplyT(func(v GetClustersClusterDbNode) int { return v.MaxConnections }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "40be3f7a8ed7ea4a29108586f7c4a381", "score": "0.43696332", "text": "func (c MqttClientConfig) Broker() *url.URL {\n\treturn c.broker\n}", "title": "" } ]
4a67a427a27978684ed2e6b4d8d9e01f
NewProxyConn new a memcache decoder and encode.
[ { "docid": "1ce5f2d68aa75b7dd23086b1e37ca1ad", "score": "0.65771824", "text": "func NewProxyConn(rw *libnet.Conn) proto.ProxyConn {\n\tp := &proxyConn{\n\t\t// TODO: optimus zero\n\t\tbr: bufio.NewReader(rw, bufio.Get(proxyReadBufSize)),\n\t\tbw: bufio.NewWriter(rw),\n\t\tcompleted: true,\n\t}\n\treturn p\n}", "title": "" } ]
[ { "docid": "3fa7826f16eacc4db1971602deba7d99", "score": "0.6902908", "text": "func New(conn *net.TCPConn, proxyAddr, remoteAddr *net.TCPAddr, connid uint64) *Proxy {\n\treturn &Proxy{\n\t\tlconn: conn,\n\t\tladdr: proxyAddr,\n\t\traddr: remoteAddr,\n\t\terred: false,\n\t\terrsig: make(chan bool),\n\t\tprefix: fmt.Sprintf(\"Connection #%03d \", connid),\n\t\tconnId: connid,\n\t}\n}", "title": "" }, { "docid": "163f902b04ba02dc2b9c9f1a2c0a9244", "score": "0.66149706", "text": "func NewProxyConn(confPath, poolName string, keyCap int, create CreatePool) (*ProxyConn, error) {\n\tf, err := ioutil.ReadFile(confPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar m map[string]redisPoolConfig\n\tif err := yaml.Unmarshal(f, &m); err != nil {\n\t\treturn nil, err\n\t}\n\n\tconf := m[poolName]\n\tpools := make([]ConnGetter, len(conf.Servers))\n\n\t// For each instance described in the Twemproxy configuration, create a connection pool.\n\t// Execute a PING command to check that it is valid and available.\n\tfor i, def := range conf.Servers {\n\t\tp := create(def, conf.Auth)\n\n\t\tc := p.Get()\n\t\tdefer c.Close()\n\t\tif _, err := c.Do(\"PING\"); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tpools[i] = p\n\t}\n\n\tproxy := new(ProxyConn)\n\tproxy.Pools = pools\n\tproxy.KeyInstance = make(map[string]ConnGetter, keyCap)\n\tproxy.keyInstanceMutex = new(sync.RWMutex)\n\treturn proxy, nil\n}", "title": "" }, { "docid": "c6ae7e58cfee1ce9e2fb0558bec2ea20", "score": "0.6360333", "text": "func NewProxy(r *httprouter.Router, repo, binn string) *Proxy {\n\treturn &Proxy{side: 2, router: r, repo: repo, binn: binn}\n}", "title": "" }, { "docid": "5ce488fafef40a1945532486951ee1bf", "score": "0.63490874", "text": "func NewProxy(transport http.RoundTripper, cache Cache, maxResponseSize uint64) *Proxy {\n\t// TLSClientConfig: &tls.Config{InsecureSkipVerify: true},\n\n\tif transport == nil {\n\t\ttransport = http.DefaultTransport\n\t}\n\tif cache == nil {\n\t\tcache = NopCache\n\t}\n\n\tproxy := Proxy{\n\t\tCache: cache,\n\t}\n\n\tclient := new(http.Client)\n\tclient.Transport = &httpcache.Transport{\n\t\tTransport: &TransformingTransport{transport, client, maxResponseSize},\n\t\tCache: cache,\n\t\tMarkCachedResponses: true,\n\t}\n\n\tproxy.Client = client\n\n\treturn &proxy\n}", "title": "" }, { "docid": "09200381b920d077041522ca5e992f74", "score": "0.6299044", "text": "func NewProxy(transport http.RoundTripper, cacheInstance cache.Cache, wg *sync.WaitGroup) *Proxy {\n\tif transport == nil {\n\t\ttransport = http.DefaultTransport\n\t}\n\tif cacheInstance == nil {\n\t\tcacheInstance = cache.NopCache\n\t}\n\n\tproxy := Proxy{\n\t\tCache: cacheInstance,\n\t\tWg: wg,\n\t}\n\n\tclient := new(http.Client)\n\n\t//\n\t// 工作流程:\n\t// ServeHTTP 对外处理请求\n\t// 权限控制\n\t// p.Client.Get 内部处理\n\t// cache.Transport 先做一层缓存处理\n\t// 缓存没有命中,则TransformingTransport继续处理\n\t//\n\tclient.Transport = &cache.Transport{\n\t\tTransport: &TransformingTransport{transport, client, cacheInstance},\n\t\tCache: cacheInstance,\n\t\tMarkCachedResponses: true,\n\t}\n\n\tproxy.Client = client\n\n\treturn &proxy\n}", "title": "" }, { "docid": "4e14af359dfe986838f1d68c04519a56", "score": "0.615733", "text": "func New(p proxy.Proxy, maxEntry, saverProc, loaderProc int) *ProxyCache {\n\tc := cache.NewCache(maxEntry)\n\tb := cache.NewBuffer()\n\ts := proxy.NewSaver(p, saverProc, b)\n\tl := proxy.NewLoader(p, loaderProc)\n\n\treturn &ProxyCache{\n\t\tcache: c,\n\t\tbuffer: b,\n\t\tsaver: s,\n\t\tloader: l,\n\t}\n}", "title": "" }, { "docid": "424d21cd7b76763618c0d7db022cf05c", "score": "0.61537623", "text": "func NewProxy(config *Config) *Proxy {\n\treturn &Proxy{\n\t\tconfig: config,\n\t}\n}", "title": "" }, { "docid": "832831d555fa42fe6ad667efc14f4d5d", "score": "0.612664", "text": "func New(rw io.ReadWriter) net.Conn { return &Mock{rw} }", "title": "" }, { "docid": "ddcb0134dfd93ee95251f6c860e22ae6", "score": "0.6074308", "text": "func NewProxy() *Proxy {\n\treturn &Proxy{\n\t\tworkChan: make(chan byte, 0xffff),\n\t\tcloseChan: make(chan struct{}),\n\t\tprocessCompletionChan: make(chan struct{}),\n\t\tcanRender: true,\n\t\tredrawChan: make(chan struct{}, 1),\n\t}\n}", "title": "" }, { "docid": "b9ffa18d34aab692320bb4031121e5ec", "score": "0.6033413", "text": "func New(in io.Reader, out io.Writer) *Proxy {\n\treturn &Proxy{\n\t\tin: json.NewDecoder(in),\n\t\tout: json.NewEncoder(out),\n\t}\n}", "title": "" }, { "docid": "8ac35d0b58ad502dedcec90239768952", "score": "0.59242886", "text": "func New(client *MatrixClient, ws *websocket.Conn) *Connection {\n\tif client == nil {\n\t\tlog.Fatalln(\"nil value passed as client to proxy.New()\")\n\t}\n\tif ws == nil {\n\t\tlog.Fatalln(\"nil value passed as ws to proxy.New()\")\n\t}\n\n\treturn &Connection{\n\t\tws: ws,\n\t\tsend: make(chan message, 256),\n\t\tquit: make(chan struct{}),\n\t\tclient: client,\n\t}\n}", "title": "" }, { "docid": "ef4935e2e62c1462cd4c4e421c4d29b4", "score": "0.5921911", "text": "func (wsc *WebSocketClient) NewProxy(onData func(ksuid.KSUID, ServerData),\n\tonClosed func(ksuid.KSUID, bool), onError func(ksuid.KSUID, error)) *ProxyClient {\n\tid := ksuid.New()\n\tproxy := ProxyClient{Id: id, onData: onData, onClosed: onClosed, onError: onError}\n\n\twsc.proxyMu.Lock()\n\tdefer wsc.proxyMu.Unlock()\n\n\twsc.proxies[id] = &proxy\n\treturn &proxy\n}", "title": "" }, { "docid": "34b529dab737697fc0fa98cba8dc0788", "score": "0.59063077", "text": "func New(conn *Conn, cache *Cache, keygen keygen.I) (ws *T) {\n\tcache.Sync(func(get CacheGetter, set CacheSetter) {\n\t\tvar id string\n\t\tfor ok := true; ok; ok = get(id) != nil {\n\t\t\tid = keygen.New()\n\t\t}\n\t\tws = &T{\n\t\t\tconn: conn,\n\t\t\tid: id,\n\t\t\tsend: make(chan types.Bytes),\n\t\t\trecv: newChanMessage(conn),\n\t\t\tdone: make(chan bool),\n\t\t}\n\t\tset(id, ws)\n\t})\n\treturn\n}", "title": "" }, { "docid": "1b49c7a5d1951aea2eaba88ebb37708f", "score": "0.58595824", "text": "func New() *Proxy {\n\tself := &Proxy{}\n\tself.Bind = \"0.0.0.0:9999\"\n\treturn self\n}", "title": "" }, { "docid": "0c945f06f2d16ebc0c0d13760b105d09", "score": "0.5853212", "text": "func NewProxy(servers []string, port string, resolvconf string, exchanger Exchanger) (*ProxyBackend, error) {\n\n\tif resolvconf == \"\" {\n\t\tresolvconf = \"/etc/resolv.conf\"\n\t}\n\n\t// Default to parsing resolve.conf file.\n\tif servers == nil {\n\t\tconfig, err := dns.ClientConfigFromFile(resolvconf)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tservers = config.Servers\n\t}\n\n\t// Default to port 53.\n\tif port == \"\" {\n\t\tport = \"53\"\n\t}\n\n\t// Default to returning a normal dns.Client pointer.\n\tif exchanger == nil {\n\t\texchanger = new(dns.Client)\n\t}\n\n\treturn &ProxyBackend{Servers: servers, Port: port, Exchanger: exchanger}, nil\n}", "title": "" }, { "docid": "812e02188e679680e721c61dbae59911", "score": "0.5848054", "text": "func newProxy(dis serviced.Discover) (*proxy, error) {\n\tstate, ok := dis.(serviced.State)\n\tif !ok {\n\t\treturn nil, errors.New(\"discover convert state failed\")\n\t}\n\n\tcfgSvrMux, err := newCfgServerMux(dis)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tauthSvrMux, err := newAuthServerMux(dis)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tauthorizer, err := auth.NewAuthorizer(dis, cc.ApiServer().Network.TLS)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"new authorizer failed, err: %v\", err)\n\t}\n\n\trepo, err := newRepoService(cc.ApiServer().Repo, authorizer)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcfgClient, err := newCfgClient(dis)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tp := &proxy{\n\t\tcfgSvrMux: cfgSvrMux,\n\t\trepo: repo,\n\t\tstate: state,\n\t\tauthorizer: authorizer,\n\t\tauthSvrMux: authSvrMux,\n\t\tcfgClient: cfgClient,\n\t}\n\n\tp.initBizsOfTmplSpaces()\n\n\treturn p, nil\n}", "title": "" }, { "docid": "c6481cfc6f4de2073bcc3371da54d8d8", "score": "0.5844346", "text": "func NewProxy(opts ...options.Option) proxy.Proxy {\n\tp := new(Proxy)\n\tp.Options = options.NewOptions(opts...)\n\tp.Options.Init(options.WithString(\"mucp\"))\n\n\t// get endpoint\n\tep, ok := p.Options.Values().Get(\"proxy.endpoint\")\n\tif ok {\n\t\tp.Endpoint = ep.(string)\n\t}\n\n\t// get client\n\tc, ok := p.Options.Values().Get(\"proxy.client\")\n\tif ok {\n\t\tp.Client = c.(client.Client)\n\t}\n\n\t// set the default client\n\tif p.Client == nil {\n\t\tp.Client = client.DefaultClient\n\t}\n\n\t// get router\n\tr, ok := p.Options.Values().Get(\"proxy.router\")\n\tif ok {\n\t\tp.Router = r.(router.Router)\n\t}\n\n\t// create default router and start it\n\tif p.Router == nil {\n\t\tp.Router = router.DefaultRouter\n\t}\n\n\t// routes cache\n\tp.Routes = make(map[string]map[uint64]router.Route)\n\n\t// watch router service routes\n\tp.errChan = make(chan error, 1)\n\tgo p.watchRoutes()\n\n\treturn p\n}", "title": "" }, { "docid": "312e14e79129c56409a09a3703aa6160", "score": "0.58442545", "text": "func newConn(conn net.Conn, onClose func()) net.Conn {\n\treturn &connWrapper{conn, onClose}\n}", "title": "" }, { "docid": "39639970d43d596545bb7682da392914", "score": "0.584243", "text": "func New(addr string, port int64, localDir string, cluster cluster.Interface) *Proxy {\n\taddr = fmt.Sprintf(\"%s:%d\", addr, port)\n\treturn &Proxy{\n\t\tserver: &http.Server{\n\t\t\tAddr: addr,\n\t\t},\n\t\tport: port,\n\t\tcluster: cluster,\n\t\tlocalDir: localDir,\n\t}\n}", "title": "" }, { "docid": "90a3fd69085c44a50d262ca8d39815b1", "score": "0.58366", "text": "func NewProxy(r Router, name string, f IdFilter, t IdTranslator) Proxy {\n\tp := new(proxyImpl)\n\tp.router = r.(*routerImpl)\n\tp.name = name\n\tp.filter = f\n\tp.translator = t\n\t//create chan for incoming ctrl msgs during connSetup\n\tp.ctrlChan = make(chan *genericMsg, DefCmdChanBufSize)\n\t//chans to local router\n\tp.sysChans = newSysChanSet(p)\n\tp.appSendChans = &sendChanSet{newChanSet(p, ScopeLocal, MemberRemote)}\n\tp.appRecvChans = &recvChanSet{newChanSet(p, ScopeLocal, MemberRemote)}\n\t//cache: only need to create import cache, since export cache are queried/returned from router\n\tp.importSendIds = make(map[interface{}]*ChanInfo)\n\tp.importRecvIds = make(map[interface{}]*ChanInfo)\n\tp.router.addProxy(p)\n\tln := \"\"\n\tif len(p.router.name) > 0 {\n\t\tif len(p.name) > 0 {\n\t\t\tln = p.router.name + p.name\n\t\t} else {\n\t\t\tln = p.router.name + \"_proxy\"\n\t\t}\n\t}\n\tp.Logger.Init(p.router.SysID(RouterLogId), p.router, ln)\n\tp.FaultRaiser.Init(p.router.SysID(RouterFaultId), p.router, ln)\n\treturn p\n}", "title": "" }, { "docid": "eb481292935e8c5c05f5eb9ca5f65c70", "score": "0.58302075", "text": "func NewProxy(scope string) (*Proxy, error) {\n\tr, err := regexp.Compile(scope)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tserver := goproxy.NewProxyHttpServer()\n\n\tret := &Proxy{\n\t\tServer: server,\n\t\tScope: r,\n\t\tRequests: make([]proxyReq, 0),\n\t\tResponses: make([]proxyResp, 0),\n\t\treqMu: &sync.RWMutex{},\n\t\trespMu: &sync.RWMutex{},\n\t\tReqChan: make(chan []byte, 10),\n\t\tRespChan: make(chan []byte, 10),\n\t}\n\n\tfs, d := fusebox.NewEmptyFS()\n\tret.FS = fs\n\td.AddNode(\"scope\", fusebox.NewRegexpFile(ret.Scope))\n\n\t// Intercept controls\n\treqNode := fusebox.NewBoolFile(&ret.IntReq)\n\trespNode := fusebox.NewBoolFile(&ret.IntResp)\n\td.AddNode(\"intreq\", reqNode)\n\td.AddNode(\"intresp\", respNode)\n\n\t// Responses and requests\n\td.AddNode(\"req\", newReqListDir(&ret.Requests))\n\td.AddNode(\"resp\", newRespListDir(&ret.Responses))\n\n\treqChanNode := fusebox.NewBytePipeFile(ret.ReqChan)\n\trespChanNode := fusebox.NewBytePipeFile(ret.RespChan)\n\treqChanNode.Mode = 0444\n\trespChanNode.Mode = 0444\n\td.AddNode(\"urlreq\", reqChanNode)\n\td.AddNode(\"urlresp\", respChanNode)\n\n\tgo ret.dispatchIntercepts(reqNode.Change, respNode.Change)\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "a2dd71502c85d209299fa1f6c5883fa9", "score": "0.58133674", "text": "func newRpcProxy(cfg *Config, validator macaroons.MacaroonValidator,\n\tpermissionMap map[string][]bakery.Op,\n\tbufListener *bufconn.Listener) *rpcProxy {\n\n\t// The gRPC web calls are protected by HTTP basic auth which is defined\n\t// by base64(username:password). Because we only have a password, we\n\t// just use base64(password:password).\n\tbasicAuth := base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf(\n\t\t\"%s:%s\", cfg.UIPassword, cfg.UIPassword,\n\t)))\n\n\t// Set up the final gRPC server that will serve gRPC web to the browser\n\t// and translate all incoming gRPC web calls into native gRPC that are\n\t// then forwarded to lnd's RPC interface. GRPC web has a few kinks that\n\t// need to be addressed with a custom director that just takes care of a\n\t// few HTTP header fields.\n\tp := &rpcProxy{\n\t\tcfg: cfg,\n\t\tbasicAuth: basicAuth,\n\t\tmacValidator: validator,\n\t\tbufListener: bufListener,\n\t}\n\tp.grpcServer = grpc.NewServer(\n\t\t// From the grpxProxy doc: This codec is *crucial* to the\n\t\t// functioning of the proxy.\n\t\tgrpc.CustomCodec(grpcProxy.Codec()),\n\t\tgrpc.ChainStreamInterceptor(p.StreamServerInterceptor(\n\t\t\tpermissionMap,\n\t\t)),\n\t\tgrpc.ChainUnaryInterceptor(p.UnaryServerInterceptor(\n\t\t\tpermissionMap,\n\t\t)),\n\t\tgrpc.UnknownServiceHandler(\n\t\t\tgrpcProxy.TransparentHandler(p.director),\n\t\t),\n\t)\n\n\t// Create the gRPC web proxy that wraps the just created grpcServer and\n\t// converts the browser's gRPC web calls into native gRPC.\n\toptions := []grpcweb.Option{\n\t\tgrpcweb.WithWebsockets(true),\n\t\tgrpcweb.WithWebsocketPingInterval(2 * time.Minute),\n\t\tgrpcweb.WithCorsForRegisteredEndpointsOnly(false),\n\t}\n\tp.grpcWebProxy = grpcweb.WrapServer(p.grpcServer, options...)\n\treturn p\n}", "title": "" }, { "docid": "7e299777017e9595d8c20c1de0e9e285", "score": "0.5811378", "text": "func NewProxy(serviceName string, conf config.ProxyConfig,\n\tlbconf config.LoadBalancerConfig) *Proxy {\n\tvar p Proxy\n\tp.name = serviceName\n\tif lbconf.Hosts == nil || len(lbconf.Hosts) < 1 {\n\t\tfmt.Println(\"Missing backend instances for service \"+serviceName)\n\t\tos.Exit(1)\n\t}\n\tp.lb = NewLoadBalancer(lbconf)\n\tp.port = conf.Port\n\tp.httpclient = http.Client{}\n\tp.bindhost = conf.BindHost\n\tif (conf.BindHost == \"\") {\n\t\tp.bindhost = \"localhost\"\n\t}\n\n\tp.Protocol = conf.Protocol\n\tp.rules = map[MessageType][]Rule{Request: {}, Response: {}}\n\tp.ruleLock = new(sync.RWMutex)\n\t/**\n\tp.expects = map[string]chan int{}\n\tp.expectLock = new(sync.RWMutex)\n\t**/\n\tp.httpregexp = regexp.MustCompile(\"^https?://\")\n\treturn &p\n}", "title": "" }, { "docid": "084e88fc74b76c5606e32cdef4211aa2", "score": "0.5780022", "text": "func NewProxy() Proxy {\n\treturn &proxy{\n\t\tproxyList: make([]string, 0),\n\t\titerator: 0,\n\t}\n}", "title": "" }, { "docid": "c11ad99f29dd7e0b71a6d9963a3e767d", "score": "0.57797873", "text": "func NewProxy(ctx context.Context, cfg *Config) *Proxy {\n\tmux := http.NewServeMux()\n\tv := config.SetupViper(cfg.EnvPrefix)\n\tc := &config.ProxyConfig{\n\t\tJWTKey: v.GetString(\"jwt_key\"),\n\t\tEndpoint: v.GetString(\"endpoint\"),\n\t\tLogLevel: v.GetString(\"log_level\"),\n\t\tLogHeaders: v.GetBool(\"log_headers\"),\n\t\tCorsAllowOrigin: v.GetString(\"cors.allow-origin\"),\n\t\tCorsAllowCredentials: v.GetString(\"cors.allow-credentials\"),\n\t\tCorsAllowMethods: v.GetString(\"cors.allow-methods\"),\n\t\tCorsAllowHeaders: v.GetString(\"cors.allow-headers\"),\n\t\tApiPrefix: v.GetString(\"proxy.api-prefix\"),\n\t}\n\tgw := config.SetupGateway()\n\tif err := cfg.RegisterFunc(ctx, gw, c.Endpoint, cfg.DialOptions); err != nil {\n\t\tlogrus.Fatalf(\"failed to register grpc gateway from endpoint: %s\", err.Error())\n\t}\n\tmux.Handle(c.ApiPrefix, handlers.CustomLoggingHandler(os.Stdout, http.StripPrefix(c.ApiPrefix[:len(c.ApiPrefix)-1], config.AllowCors(c, gw)), config.LogFormatter(c)))\n\tif c.JWTKey != \"\" {\n\t\treturn &Proxy{\n\t\t\tHandler: grants.Middleware(c.JWTKey, true).Handler(mux),\n\t\t\tport: v.GetInt(\"proxy.port\"),\n\t\t\tv: v,\n\t\t}\n\t}\n\treturn &Proxy{\n\t\tHandler: mux,\n\t\tport: v.GetInt(\"proxy.port\"),\n\t\tv: v,\n\t}\n}", "title": "" }, { "docid": "e8e77ab5f190cbc240aa9daf86a65ed9", "score": "0.57710946", "text": "func NewProxy(addr string, tlsConfig *tls.Config) *Proxy {\n\tvar host string\n\tu, err := url.Parse(addr)\n\tif err == nil {\n\t\thost, _, err = net.SplitHostPort(u.Host)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"could not parse upstream network address (%v)\", err)\n\t\t}\n\t} else {\n\t\thost, _, err = net.SplitHostPort(addr)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"could not parse upstream network address (%v)\", err)\n\t\t}\n\t}\n\tp := &Proxy{\n\t\taddr: addr,\n\t\tfails: 0,\n\t\tprobe: up.New(),\n\t\ttransport: newTransport(addr, tlsConfig),\n\t\tpushAddr: newPushAddr(host),\n\t\tpushChan: make(chan struct{}),\n\t}\n\tp.client = dnsClient(tlsConfig)\n\treturn p\n}", "title": "" }, { "docid": "4150b9b52f05492a5437bc7f2918eec8", "score": "0.5749323", "text": "func NewProxy(keyFunc KeyFunc, g Grouper, r Router, conf Config) http.Handler {\n\tp := new(proxy)\n\t*p = proxy{\n\t\tkeyFunc: keyFunc,\n\t\tgrouper: g,\n\t\trouter: r,\n\t\ttransport: conf.Transport,\n\t\tReverseProxy: &httputil.ReverseProxy{\n\t\t\tDirector: func(*http.Request) { /* in RoundTrip so we can error out */ },\n\t\t\tTransport: p,\n\t\t\tBufferPool: newBufferPool(),\n\t\t},\n\t}\n\n\tsetTracer(conf.ZipkinURL)\n\n\treturn p\n}", "title": "" }, { "docid": "9b67170a4d566311c68b01004b13b0b6", "score": "0.5717844", "text": "func NewProxy(iD int32, server string, port int32, lastUsedDate int32, isEnabled bool, typeParam ProxyType) *Proxy {\n\tproxyTemp := Proxy{\n\t\ttdCommon: tdCommon{Type: \"proxy\"},\n\t\tID: iD,\n\t\tServer: server,\n\t\tPort: port,\n\t\tLastUsedDate: lastUsedDate,\n\t\tIsEnabled: isEnabled,\n\t\tType: typeParam,\n\t}\n\n\treturn &proxyTemp\n}", "title": "" }, { "docid": "50c07ea1e61f2c1e6a986735f23643b7", "score": "0.57024163", "text": "func NewProxy(address string) (*Proxy, error) {\n\treturn &Proxy{target: address}, nil\n}", "title": "" }, { "docid": "545966eb8f740657f2c6b61518ceae02", "score": "0.5698674", "text": "func NewProxy(driver driver.Driver, hooks *Hooks) *Proxy {\n\tif hooks == nil {\n\t\thooks = &Hooks{}\n\t}\n\treturn &Proxy{\n\t\tDriver: driver,\n\t\tHooks: hooks,\n\t}\n}", "title": "" }, { "docid": "703e5729d5162cef7dc3d338da60c6cf", "score": "0.565486", "text": "func (s *Service) newRpcConn(conn interface{}, connid uid.LID, clientid uid.ID) *Conn {\n\tc := &Conn{\n\t\tconnid: connid,\n\t\tclientid: clientid,\n\t\tMessageIds: message.NewMessageIds(),\n\t\tsend: make(chan lp.Packet, 1), // buffered\n\t\trecv: make(chan lp.Packet),\n\t\tpub: make(chan *lp.Publish),\n\t\tstop: make(chan interface{}, 1), // Buffered by 1 just to make it non-blocking\n\t\tservice: s,\n\t\tsubs: message.NewStats(),\n\t\tclnode: conn.(*ClusterNode),\n\t\tnodes: make(map[string]bool, 3),\n\t}\n\n\tGlobals.ConnCache.Add(c)\n\treturn c\n}", "title": "" }, { "docid": "0c4092ab1e320c301e0b3b01740cc79d", "score": "0.5639478", "text": "func (t *MplexTransport) NewConn(nc net.Conn, isServer bool) (smux.Conn, error) {\n\treturn &conn{NewMultiplex(nc, isServer)}, nil\n}", "title": "" }, { "docid": "ce2f3ad3e017c31ccf4f7ea4b4b5c20e", "score": "0.56127", "text": "func New(conn net.Conn) *Conn {\n\treturn &Conn{\n\t\tconn,\n\t\tsnappy.NewBufferedWriter(conn),\n\t\tsnappy.NewReader(conn),\n\t}\n}", "title": "" }, { "docid": "7728bff95662958bee62ffa11efaa1fa", "score": "0.5609071", "text": "func NewProxy(target string, transformer RequestTransformer, optionalTimeouts ...time.Duration) *HttpProxy {\n\tconnectTimeout := 5 * time.Second\n\tglobalTimeout := 20 * time.Second\n\n\tswitch len(optionalTimeouts) {\n\tcase 2:\n\t\tglobalTimeout = optionalTimeouts[1]\n\t\tfallthrough\n\tcase 1:\n\t\tconnectTimeout = optionalTimeouts[0]\n\tcase 0:\n\tdefault:\n\t\tpanic(\"Too many arguments for NewProxy\")\n\t}\n\n\ttransport := &http.Transport{\n\t\tDisableKeepAlives: true,\n\t\tMaxIdleConnsPerHost: 128,\n\t\tDial: func(network, addr string) (net.Conn, error) {\n\t\t\treturn net.DialTimeout(network, addr, connectTimeout)\n\t\t},\n\t}\n\tclient := &http.Client{\n\t\tTransport: transport,\n\t\tTimeout: globalTimeout,\n\t}\n\n\tproxy := &HttpProxy{\n\t\ttarget: target,\n\t\ttransformer: transformer,\n\t\tclient: client,\n\t}\n\n\treturn proxy\n}", "title": "" }, { "docid": "70b841b7da968cb7e186a0c2eb339f02", "score": "0.560899", "text": "func New(exec executor.Executor, config Config) Memcached {\n\tif config.IP == \"0.0.0.0\" {\n\t\tlog.Panic(\"Memcached has to listen on actual device address, not '0.0.0.0'\")\n\t}\n\treturn Memcached{\n\t\texec: exec,\n\t\tconf: config,\n\t\tisMemcachedUp: netutil.IsListening,\n\t}\n\n}", "title": "" }, { "docid": "68c5d7804a4813e875da88c6564b5d8c", "score": "0.5602217", "text": "func NewHTTPProxy(rpcPort string, httpPort string, contentDir string) (*Proxy, error) {\n\tctx := context.Background()\n\tctx, cancel := context.WithCancel(ctx)\n\n\t//setup RESTful proxy\n\tmarsh := MarshalClean{\n\t\tm: &runtime.JSONPb{\n\t\t\tEnumsAsInts: false,\n\t\t\tEmitDefaults: true,\n\t\t\tOrigName: true,\n\t\t},\n\t}\n\tgrpcMux := runtime.NewServeMux(runtime.WithMarshalerOption(\"*\", &marsh))\n\topts := []grpc.DialOption{grpc.WithInsecure()}\n\n\tlog.Println(\"HTTP proxy connecting to localhost:\" + rpcPort)\n\terr := aql.RegisterQueryHandlerFromEndpoint(ctx, grpcMux, \"localhost:\"+rpcPort, opts)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Register error: %v\", err)\n\t}\n\terr = aql.RegisterEditHandlerFromEndpoint(ctx, grpcMux, \"localhost:\"+rpcPort, opts)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Register error: %v\", err)\n\t}\n\n\tr := mux.NewRouter()\n\truntime.OtherErrorHandler = handleError\n\n\tr.PathPrefix(\"/graphql/\").Handler(graphql.NewHTTPHandler(\"localhost:\" + rpcPort))\n\tr.PathPrefix(\"/v1/\").Handler(grpcMux)\n\tif contentDir != \"\" {\n\t\tr.PathPrefix(\"/\").Handler(http.StripPrefix(\"/\", http.FileServer(http.Dir(contentDir))))\n\t}\n\n\treturn &Proxy{\n\t\tcancel: cancel,\n\t\tserver: &http.Server{\n\t\t\tAddr: \":\" + httpPort,\n\t\t\tHandler: r,\n\t\t},\n\t\thttpPort: httpPort,\n\t}, nil\n}", "title": "" }, { "docid": "ca08127fcc5852d01432cada9c6cb7c1", "score": "0.5599138", "text": "func NewReverseProxy(conn1 net.Conn, conn2 net.Conn) *ReverseProxy {\n\treturn &ReverseProxy{\n\t\tbiConn: handler.NewBiConn(conn1, conn2),\n\t}\n}", "title": "" }, { "docid": "6324a0482a8c5417449c9be3dafad3df", "score": "0.5598686", "text": "func NewConn(rwc io.ReadWriteCloser) *Conn {\n\tc := &Conn{\n\t\trwc: rwc,\n\t\tbufr: bufio.NewReader(rwc),\n\t}\n\n\tif tc, ok := rwc.(srvTrackingConn); ok {\n\t\tc.localAddr = tc.LocalAddr()\n\t\tc.remoteAddr = tc.RemoteAddr()\n\t}\n\n\treturn c\n}", "title": "" }, { "docid": "f37f3e6eb59a5215d01a187a4329c881", "score": "0.55848914", "text": "func newInitProxyMutator(mutatorConfig initProxyMutatorConfig, proxyConfig proxyConfig) *initProxyMutator {\n\treturn &initProxyMutator{\n\t\tmutatorConfig: mutatorConfig,\n\t\tproxyConfig: proxyConfig,\n\t}\n}", "title": "" }, { "docid": "2b6066e1352427a0afe54cd4d152604c", "score": "0.5566198", "text": "func NewProxy(target string) *Proxy {\r\n\tpr := &Proxy{}\r\n\r\n\tInitProxy(pr, target)\r\n\r\n\treturn pr\r\n}", "title": "" }, { "docid": "e4c83e6a928ef08385c9e000cb482a63", "score": "0.5553161", "text": "func newProxy() *httputil.ReverseProxy {\n\treturn &httputil.ReverseProxy{\n\t\tDirector: func(r *http.Request) {\n\t\t\tif dump, err := httputil.DumpRequest(r, true); err == nil {\n\t\t\t\tlog.Printf(\"%s\", dump)\n\t\t\t}\n\t\t\t// hardcode username/password \"u:p\" (base64 encoded: dTpw ) to make it simple\n\t\t\tif auth := r.Header.Get(\"Proxy-Authorization\"); auth != \"Basic dTpw\" {\n\t\t\t\tr.Header.Set(\"X-Failed\", \"407\")\n\t\t\t}\n\t\t},\n\t\tTransport: &transport{http.DefaultTransport},\n\t\tErrorHandler: func(w http.ResponseWriter, r *http.Request, err error) {\n\t\t\tif err.Error() == \"407\" {\n\t\t\t\tlog.Println(\"proxy: not authorized\")\n\t\t\t\tw.Header().Add(\"Proxy-Authenticate\", `Basic realm=\"Proxy Authorization\"`)\n\t\t\t\tw.WriteHeader(407)\n\t\t\t} else {\n\t\t\t\tw.WriteHeader(http.StatusBadGateway)\n\t\t\t}\n\t\t},\n\t}\n}", "title": "" }, { "docid": "6d9ff9dfe5d4412dbca2cafa2a4ae187", "score": "0.5553151", "text": "func NewProxy(baseURI string, authToken string, sharedSecret []byte, logger *zerolog.Logger) (Proxy, error) {\n\n\tif baseURI == \"\" || authToken == \"\" || len(sharedSecret) == 0 || logger == nil {\n\t\treturn nil, ErrProxyMisconfigured\n\t}\n\n\turi, err := url.Parse(baseURI)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &proxy{\n\t\tconfig: gwsConfig{\n\t\t\tbaseURI: uri,\n\t\t\tauthToken: authToken,\n\t\t\tsharedSecret: sharedSecret,\n\t\t},\n\t\tlogger: logger,\n\t}, nil\n\n}", "title": "" }, { "docid": "a47a4c3ac694cd76c04fc8ca3ca95b50", "score": "0.5549181", "text": "func New(env environment.Env) (*Proxy, error) {\n\tport, err := portpicker.PickUnusedPort()\n\tif err != nil {\n\t\treturn nil, errors.New(compName, err)\n\t}\n\treturn &Proxy{\n\t\tenv: env,\n\t\tAddress: net.JoinHostPort(\"localhost\", strconv.Itoa(port)),\n\t\tport: port,\n\t}, nil\n}", "title": "" }, { "docid": "939ab10f5e6e2da66f972e87f0050f01", "score": "0.552324", "text": "func NewProxy(address common.Address, backend bind.ContractBackend) (*Proxy, error) {\n\tcontract, err := bindProxy(address, backend, backend, backend)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Proxy{ProxyCaller: ProxyCaller{contract: contract}, ProxyTransactor: ProxyTransactor{contract: contract}, ProxyFilterer: ProxyFilterer{contract: contract}}, nil\n}", "title": "" }, { "docid": "939ab10f5e6e2da66f972e87f0050f01", "score": "0.552324", "text": "func NewProxy(address common.Address, backend bind.ContractBackend) (*Proxy, error) {\n\tcontract, err := bindProxy(address, backend, backend, backend)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Proxy{ProxyCaller: ProxyCaller{contract: contract}, ProxyTransactor: ProxyTransactor{contract: contract}, ProxyFilterer: ProxyFilterer{contract: contract}}, nil\n}", "title": "" }, { "docid": "0bb7efa9a29163f39dfd2f2b1c4801ef", "score": "0.5519259", "text": "func newProxyHandler(srvURL string, conn1Log, conn2Log *logStorage) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {\n\t\tconn1 := upgrade(w, req)\n\t\tconn2, _, err := websocket.DefaultDialer.Dial(srvURL, nil)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tif err := wsproxy.Copy(conn1, conn2, conn1Log, conn2Log); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t})\n}", "title": "" }, { "docid": "af910497b46671b7340c5551798ead92", "score": "0.5506232", "text": "func NewConn(c net.Conn, p Protocol, iv []byte) net.Conn {\n\treturn &Conn{Conn: c, Protocol: p.initForConn(iv)}\n}", "title": "" }, { "docid": "dba54b7452530b68489c3c2181d495dc", "score": "0.5505815", "text": "func NewConnMock(t minimock.Tester) *ConnMock {\n\tm := &ConnMock{t: t}\n\tif controller, ok := t.(minimock.MockController); ok {\n\t\tcontroller.RegisterMocker(m)\n\t}\n\n\tm.CloseMock = mConnMockClose{mock: m}\n\n\tm.LocalAddrMock = mConnMockLocalAddr{mock: m}\n\n\tm.ReadMock = mConnMockRead{mock: m}\n\tm.ReadMock.callArgs = []*ConnMockReadParams{}\n\n\tm.RemoteAddrMock = mConnMockRemoteAddr{mock: m}\n\n\tm.SetDeadlineMock = mConnMockSetDeadline{mock: m}\n\tm.SetDeadlineMock.callArgs = []*ConnMockSetDeadlineParams{}\n\n\tm.SetReadDeadlineMock = mConnMockSetReadDeadline{mock: m}\n\tm.SetReadDeadlineMock.callArgs = []*ConnMockSetReadDeadlineParams{}\n\n\tm.SetWriteDeadlineMock = mConnMockSetWriteDeadline{mock: m}\n\tm.SetWriteDeadlineMock.callArgs = []*ConnMockSetWriteDeadlineParams{}\n\n\tm.WriteMock = mConnMockWrite{mock: m}\n\tm.WriteMock.callArgs = []*ConnMockWriteParams{}\n\n\treturn m\n}", "title": "" }, { "docid": "8eec2ca91807b4b4991f8a929dcd8da0", "score": "0.55008554", "text": "func newProxyManager(ctx context.Context, client *clientv3.Client, fns ...func([]*sessionutil.Session)) *proxyManager {\n\tctx, cancel := context.WithCancel(ctx)\n\tp := &proxyManager{\n\t\tctx: ctx,\n\t\tcancel: cancel,\n\t\tlock: sync.Mutex{},\n\t\tetcdCli: client,\n\t}\n\tp.initSessionsFunc = append(p.initSessionsFunc, fns...)\n\treturn p\n}", "title": "" }, { "docid": "da0dbb2febb16d4e4742dd1ae09dcacc", "score": "0.54647267", "text": "func (client *Client) newReverseProxy() (*httputil.ReverseProxy, error) {\n\n\t// This is a bit unorthodox in that we get a load balanced connection\n\t// first and then simply return that in our dial function below.\n\t// The reason for this is that the only the dialer knows the\n\t// authentication token for its associated server, and we need to\n\t// set that in the Transport RoundTrip call above.\n\tdialer, conn, err := client.getBalancer().TrustedDialerAndConn()\n\tif err != nil {\n\t\t// The internal code has already reported an error here.\n\t\tlog.Debugf(\"Could not get balanced dialer %v\", err)\n\t\treturn nil, err\n\t}\n\n\t// We we simply return the already-established connection - see\n\t// above comment.\n\tdial := func(network, addr string) (net.Conn, error) {\n\t\treturn conn, err\n\t}\n\n\ttransport := &authTransport{\n\t\tbalancedDialer: dialer,\n\t}\n\t// We disable keepalives because some servers pretend to support\n\t// keep-alives but close their connections immediately, which\n\t// causes an error inside ReverseProxy. This is not an issue\n\t// for HTTPS because the browser is responsible for handling\n\t// the problem, which browsers like Chrome and Firefox already\n\t// know to do.\n\t//\n\t// See https://code.google.com/p/go/issues/detail?id=4677\n\ttransport.DisableKeepAlives = true\n\ttransport.TLSHandshakeTimeout = 40 * time.Second\n\n\t// TODO: would be good to make this sensitive to QOS, which\n\t// right now is only respected for HTTPS connections. The\n\t// challenge is that ReverseProxy reuses connections for\n\t// different requests, so we might have to configure different\n\t// ReverseProxies for different QOS's or something like that.\n\tif runtime.GOOS == \"android\" || client.ProxyAll {\n\t\ttransport.Dial = dial\n\t} else {\n\t\ttransport.Dial = detour.Dialer(dial)\n\t}\n\n\trp := &httputil.ReverseProxy{\n\t\tDirector: func(req *http.Request) {\n\t\t\t// do nothing\n\t\t},\n\t\tTransport: &errorRewritingRoundTripper{\n\t\t\twithDumpHeaders(false, transport),\n\t\t},\n\t\t// Set a FlushInterval to prevent overly aggressive buffering of\n\t\t// responses, which helps keep memory usage down\n\t\tFlushInterval: 250 * time.Millisecond,\n\t\tErrorLog: log.AsStdLogger(),\n\t}\n\n\treturn rp, nil\n}", "title": "" }, { "docid": "8590e18558c30e92c5d0556adefaf1db", "score": "0.546303", "text": "func NewConn(conn protocols.Protocol, crypto *Crypto) protocols.Protocol {\n\treturn &Conn{\n\t\tConn: conn,\n\t\tCrypto: crypto,\n\t\twriteBuf: leakyBuf.Get(),\n\t\treadBuf: leakyBuf.Get(),\n\t}\n}", "title": "" }, { "docid": "e51f4164821340a551246f66b1c4710a", "score": "0.54557425", "text": "func newServerConn(c conn, url *URL, siteInfo *VisitCnt) *serverConn {\n\tsv := &serverConn{\n\t\tconn: c,\n\t\turl: url,\n\t\tsiteInfo: siteInfo,\n\t}\n\treturn sv\n}", "title": "" }, { "docid": "c66b86964e59702f25342d129b04cf0a", "score": "0.54533166", "text": "func NewConnCache(idleExpiry time.Duration) *ConnCache {\n\tmu := &sync.Mutex{}\n\tcond := sync.NewCond(mu)\n\treturn &ConnCache{\n\t\tmu: mu,\n\t\tcond: cond,\n\t\taddrCache: make(map[string]*connEntry),\n\t\tridCache: make(map[naming.RoutingID]*connEntry),\n\t\tstarted: make(map[string]bool),\n\t\tunmappedConns: make(map[*connEntry]bool),\n\t\tidleExpiry: idleExpiry,\n\t}\n}", "title": "" }, { "docid": "8cd8c3316b49ad0252f306723cc67d55", "score": "0.5451346", "text": "func New(cfg *Config) func() {\n\tfmt.Printf(\"starting proxy server on :%s\\n\", cfg.Port)\n\tserver := &http.Server{\n\t\tAddr: \":\" + cfg.Port,\n\t\tHandler: http.HandlerFunc(handleHTTP(cfg)),\n\t\t// Disable HTTP/2.\n\t\tTLSNextProto: make(map[string]func(*http.Server, *tls.Conn, http.Handler)),\n\t}\n\n\tgo func() {\n\t\tvar err error\n\t\tif cfg.Proto == \"https\" {\n\t\t\terr = server.ListenAndServeTLS(cfg.SSLPem, cfg.SSLKey)\n\t\t} else {\n\t\t\terr = server.ListenAndServe()\n\t\t}\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"proxy server failed: %s\\n\", err)\n\t\t}\n\t}()\n\treturn func() {\n\t\tserver.Close()\n\t}\n}", "title": "" }, { "docid": "c4a1ef2888894616db72661b7bbc6539", "score": "0.5444917", "text": "func New(conn net.Conn) *Conn {\n\treturn NewLevel(conn, gzip.DefaultCompression)\n}", "title": "" }, { "docid": "71688acf5cbb6216782b8e29ef050ff3", "score": "0.54421896", "text": "func (process *TeleportProcess) newLocalCacheForProxy(clt auth.ClientI, cacheName []string) (auth.ProxyAccessPoint, error) {\n\t// if caching is disabled, return access point\n\tif !process.Config.CachePolicy.Enabled {\n\t\treturn clt, nil\n\t}\n\n\tcache, err := process.NewLocalCache(clt, cache.ForProxy, cacheName)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\treturn auth.NewProxyWrapper(clt, cache), nil\n}", "title": "" }, { "docid": "6be6d9ef839170998f9635ce28d77bb9", "score": "0.5426036", "text": "func (p *MemProvider) Init(maxlifetime int64, connStrs string) error {\n\tp.maxlifetime = maxlifetime\n\tp.conninfo = strings.Split(connStrs, \";\")\n\tclient = memcache.New(p.conninfo...)\n\treturn nil\n}", "title": "" }, { "docid": "f783bca041fa2ce52fe4997d45b9c831", "score": "0.54182553", "text": "func NewProxy(url *url.URL, transport http.RoundTripper, evaluator jq.Evaluator, logger *log.Logger) *Proxy {\n\tbackend := httputil.NewSingleHostReverseProxy(url)\n\ttransformer := NewTransformer(evaluator, Rewriter(logger))\n\n\t// Preserve the director set by NewSingleHostReverseProxy\n\tbackend.Director = Director(backend.Director, logger)\n\tbackend.ModifyResponse = transformer.ModifyResponse\n\tbackend.ErrorHandler = ErrorHandler(logger)\n\tbackend.Transport = transport\n\n\treturn &Proxy{\n\t\tbackend: backend,\n\t\tlogger: logger,\n\t}\n}", "title": "" }, { "docid": "754aed2dcf942e0d2890bd440f15d4d7", "score": "0.5413321", "text": "func newProxy(pType ProxyType) (proxy, error) {\n\tswitch pType {\n\tcase NoopProxyType:\n\t\treturn &noopProxy{}, nil\n\tcase CCProxyType:\n\t\treturn &ccProxy{}, nil\n\tdefault:\n\t\treturn &noopProxy{}, nil\n\t}\n}", "title": "" }, { "docid": "2042a347ab7598f349dd39efec1f5717", "score": "0.53955024", "text": "func New(u, accessToken string, apiCfg goprismic.Config, cfg Config) (*Proxy, error) {\n\ta, err := goprismic.Get(u, accessToken, apiCfg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif cfg.MasterRefresh == 0 {\n\t\tcfg.MasterRefresh = time.Minute\n\t}\n\tcfg.debug = apiCfg.Debug\n\tif cfg.BaselineRefreshChance == 0 {\n\t\tcfg.BaselineRefreshChance = 1.0\n\t}\n\tc := NewCache(cfg.CacheSize, cfg.TTL, 1.0)\n\tc.revision = a.GetMasterRef()\n\tp := &Proxy{\n\t\tcache: c,\n\t\tapi: a,\n\t\tConfig: cfg,\n\t\tlastRefresh: time.Now(),\n\t}\n\tgo p.loopRefresh()\n\treturn p, nil\n}", "title": "" }, { "docid": "6a77980f7c9007e60d6443a4c5ee4d6f", "score": "0.5385667", "text": "func newExecCachingProxy(config *config.ExecCachingExporterConfig) *execCachingProxy {\n\trdyCh := make(chan struct{})\n\n\tnewProxy := execCachingProxy{\n\t\tcommandPath: config.Command,\n\t\targuments: config.Args,\n\t\texecInterval: time.Duration(config.ExecInterval),\n\n\t\tlastResult: make([]*dto.MetricFamily, 0),\n\t\tresultReadyCh: rdyCh,\n\t\tlastResultMtx: &sync.RWMutex{},\n\n\t\tlog: zap.L(),\n\t}\n\n\tgo newProxy.execer(rdyCh)\n\n\treturn &newProxy\n}", "title": "" }, { "docid": "7d6fdf2f6dd63dc962ff6dd82e5fbd28", "score": "0.5375607", "text": "func NewHttpProxyReader(r io.Reader, f func(n int, err error)) io.Reader {\n\treturn &HttpProxyReader{r, f}\n}", "title": "" }, { "docid": "e29cf7a59cd424829e18127491af2955", "score": "0.5365111", "text": "func newConsensusStoreProxy(config ClusterConfig, store *consensusStoreImpl, raftLeaderServiceAddrChan <-chan string) (*consensusStoreProxy, error) {\n\tproxy := &consensusStoreProxy{\n\t\tstore: store,\n\t\tconnectionMutex: sync.RWMutex{},\n\t\traftLeaderServiceAddrChan: raftLeaderServiceAddrChan,\n\t\tlogger: config.logger,\n\t\t// these two are being set in updateLeaderConnection()\n\t\t// leaderClient: leaderClient,\n\t\t// leaderConnection: leaderConnection,\n\t}\n\n\t// we do it once to complete setting up the proxy\n\tproxy.updateLeaderConnection()\n\t// then we spin up a co routine to keep the connection\n\t// to the leader up to date\n\tgo proxy.updateLeaderConnection()\n\n\treturn proxy, nil\n}", "title": "" }, { "docid": "b81421c0f63a5f156c74e31c60fcdc36", "score": "0.53630376", "text": "func New(c *conf.Config) (dao *Dao) {\n\thttpCli := bm.NewClient(c.HTTPClient)\n\tmvipHttpCli := bm.NewClient(c.HTTPClient)\n\tmvipCli, err := mvipgrpc.NewClient(c.MVIPClient)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\taccCli, err := acclgrpc.NewClient(c.ACCClient)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdao = &Dao{\n\t\tc: c,\n\t\tmc: memcache.NewPool(c.Memcache),\n\t\tdb: xsql.NewMySQL(c.MySQL),\n\t\tmvipCli: mvipCli,\n\t\tmvipHttpCli: mvipHttpCli,\n\t\taccCli: accCli,\n\t\thttpCli: httpCli,\n\t\tystCli: NewYstClient(httpCli),\n\t\tcache: fanout.New(\"cache\", fanout.Worker(1), fanout.Buffer(1024)),\n\t\tcacheTTL: c.CacheTTL,\n\t\tsigner: &pkg.Signer{Key: c.YST.Key},\n\t}\n\treturn\n}", "title": "" }, { "docid": "2a11c1773ddccdb5d02d429129d580ee", "score": "0.5347222", "text": "func NewProxy(logger *zap.Logger, h *bridge.Hub, relayClient googlehome.GoogleHomeServiceClient, agentID string) *Proxy {\n\treturn &Proxy{\n\t\tlogger: logger,\n\t\th: h,\n\t\trelayClient: relayClient,\n\t\tagentID: agentID,\n\t\twait: make(chan struct{}),\n\t\tunsupportedDeviceIDs: map[string]bool{},\n\t}\n}", "title": "" }, { "docid": "b95c12cf1ebe664410a7df8376a460ae", "score": "0.53421664", "text": "func newConn(ctx context.Context, s *cdputil.Session, id target.ID,\n\tlm *jslog.Master, pageURL string, chromeErr func(error) error) (c *Conn, retErr error) {\n\tco, err := s.NewConn(ctx, id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer func() {\n\t\tif retErr != nil {\n\t\t\tco.Close()\n\t\t}\n\t}()\n\n\tev, err := co.ConsoleAPICalled(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Conn{\n\t\tco: co,\n\t\tlw: lm.NewWorker(string(id), pageURL, ev),\n\t\tchromeErr: chromeErr,\n\t}, nil\n}", "title": "" }, { "docid": "7bfbd48c3c67b382c27a3ec9b414d4f0", "score": "0.5325161", "text": "func newMaConnWithAddrs(c net.Conn, laddr ma.Multiaddr, raddr ma.Multiaddr) utpMaConn {\n\treturn utpMaConn{\n\t\tConn: c,\n\t\tladdr: laddr,\n\t\traddr: raddr,\n\t}\n}", "title": "" }, { "docid": "c7abc065a7609917761d46a3358d907f", "score": "0.53206563", "text": "func NewConn(conn io.ReadWriter, client DBGPClient) *Conn {\n\trw := bufio.NewReadWriter(bufio.NewReader(conn), bufio.NewWriter(conn))\n\treturn &Conn{rw, client}\n}", "title": "" }, { "docid": "953b1ee14a3a6d1a768188a45ab1d3e3", "score": "0.5309787", "text": "func newProxyServer() {\n\truntime.GOMAXPROCS(runtime.NumCPU())\n\n\t//client := redis.NewClient(&redis.Options{\n\t//\tAddr: \"127.0.0.1:6379\",\n\t//\tPassword: \"\", // no password set\n\t//\tDB: 0, // use default DB\n\t//})\n\tvar cli redis.ClientInterface\n\tlisten := flag.String(\"l\", \":6380\", \"addr to listen for\")\n\tcluster := flag.Bool(\"c\", false, \"enable cluster or not\")\n\taddr := flag.String(\"a\", \"127.0.0.1:6379\", \"addrs, separated by comma\")\n\tflag.Parse()\n\n\tfmt.Println(\"Launching redis proxy server...\")\n\n\tfmt.Printf(\"Using cluster: %t, listen on: %s, proxy for: %s\\n\", *cluster, *listen, *addr)\n\tif *cluster {\n\t\tcli = redis.NewClusterClient(&redis.ClusterOptions{\n\t\t\tAddrs: strings.Split(*addr, \",\"),\n\t\t\tPassword: \"\", // no password set\n\t\t})\n\t} else {\n\t\tcli = redis.NewClient(&redis.Options{\n\t\t\tAddr: *addr,\n\t\t\tPassword: \"\", // no password set\n\t\t\tDB: 0, // use default DB\n\t\t})\n\t}\n\n\n\t// listen on all interfaces\n\tlistenAddr := *listen\n\tvar ln net.Listener\n\tvar err error\n\tif strings.HasPrefix(listenAddr, \"unix://\") {\n\t\tos.Remove(listenAddr[7:])\n\t\tln, err = net.Listen(\"unix\", listenAddr[7:])\n\t} else if strings.HasPrefix(listenAddr, \"tcp://\") {\n\t\tln, err = net.Listen(\"tcp\", listenAddr[6:])\n\t} else {\n\t\tln, err = net.Listen(\"tcp\", listenAddr)\n\t}\n\tif err != nil {\n\t\tpanic(\"cannot listen:\" + err.Error())\n\t}\n\n\t// accept connection on port\n\tfor {\n\t\tconn, _ := ln.Accept()\n\n\t\tgo handleConn(conn, cli)\n\t}\n\n\n\n\n\t// Output: PONG <nil>\n}", "title": "" }, { "docid": "d0ebe415e9f66925a73e726991b81bed", "score": "0.5309497", "text": "func (s *Server) newConn(conn net.Conn) *clientConn {\n\treturn &clientConn{}\n}", "title": "" }, { "docid": "caff5de3bb0f0e12662ecf8e55eaecdb", "score": "0.5302989", "text": "func New(target *config.Target) (Proxy, error) {\n\t// initialize a new proxy variable\n\tvar proxy Proxy\n\n\t// create the proxy based on the protocol type\n\tswitch target.Protocol {\n\tcase \"tcp\":\n\t\tproxy = &TCPProxy{\n\t\t\tTarget: target,\n\t\t}\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"wrong protocol given for target\")\n\t}\n\n\t// return the proxy\n\treturn proxy, nil\n}", "title": "" }, { "docid": "f2d26bce711c5d51978dd57ad16b1eff", "score": "0.53004795", "text": "func NewCache(addr string) *BCacheClient {\n\treturn &BCacheClient{\n\t\taddr: \"http://\" + addr + \"/v1/\",\n\t}\n}", "title": "" }, { "docid": "6ea775866e1d4fb01fff4b812245fec6", "score": "0.52922046", "text": "func New(c *api.Config) (*Proxy, error) {\n\n\tvar transports = make(map[string]http.RoundTripper)\n\n\tfor ctxKey := range c.Contexts {\n\t\tcluster := getClusterByContextName(c, ctxKey)\n\t\tauth := getAuthByContextName(c, ctxKey)\n\t\ttlsConfig, err := configureTLS(auth, cluster)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\ttransports[ctxKey] = &Transport{\n\t\t\tTLSClientConfig: tlsConfig,\n\t\t\tCache: cache.New(),\n\t\t}\n\t}\n\n\treturn &Proxy{\n\t\tkubeConfig: c,\n\t\ttransports: transports,\n\t}, nil\n}", "title": "" }, { "docid": "2dd6058a055fb23f8bc73cf47738e547", "score": "0.528792", "text": "func NewConn(options ...func(*pgxmock) error) (PgxConnIface, error) {\n\tsmock := &pgxmockConn{}\n\tsmock.ordered = true\n\treturn smock, smock.open(options)\n}", "title": "" }, { "docid": "0e9c7e62742b4b332fdf32ea6e65388c", "score": "0.5263392", "text": "func DialCache(addr string, login string, pass string) *Cache {\r\n\tc := new(Cache)\r\n\tc.writer = make(chan []byte, 100)\r\n\tc.reader = make(chan []byte, 100)\r\n\tvar err error\r\n\tconn, err := net.Dial(\"tcp4\", addr)\r\n\tif err != nil {\r\n\t\tfmt.Println(err)\r\n\t}\r\n\tgo func() {\r\n\t\tfor {\r\n\t\t\tbr := make([]byte, 1)\r\n\t\t\t_, err := conn.Read(br)\r\n\t\t\tif err != nil {\r\n\t\t\t\tlog.Fatal(err)\r\n\t\t\t}\r\n\t\t\tc.reader <- br\r\n\t\t}\r\n\t}()\r\n\tgo func() {\r\n\t\tfor {\r\n\t\t\tbw := <-c.writer\r\n\t\t\t_, err := conn.Write(bw)\r\n\t\t\tif err != nil {\r\n\t\t\t\tlog.Fatal(err)\r\n\t\t\t}\r\n\t\t}\r\n\t}()\r\n\tc.ReadFor([]byte(\"Username:\"))\r\n\tc.WriteLine([]byte(login))\r\n\tc.ReadFor([]byte(\"Password:\"))\r\n\tc.WriteLine([]byte(pass))\r\n\tc.ReadFor([]byte(\">\"))\r\n\treturn c\r\n}", "title": "" }, { "docid": "145caa7a3be9759e1a747301856affac", "score": "0.5257971", "text": "func NewConn(msg string, w http.ResponseWriter, r *http.Request) {\n\thelpers.ServeJSON(w, struct {\n\t\tMsg string `json:\"msg\"`\n\t}{\n\t\tMsg: msg,\n\t})\n}", "title": "" }, { "docid": "22a3f338fe5f0cf41034780ddc03bf09", "score": "0.5257906", "text": "func NewProxy(opts ...ProxyOption) *proxy {\n\tp := &proxy{\n\t\tserver: runtime.NewServeMux(\n\t\t\truntime.WithMarshalerOption(runtime.MIMEWildcard, new(pb.JSONPb)),\n\t\t),\n\t\trouter: negroni.New(),\n\t}\n\n\tfor _, opt := range opts {\n\t\topt(p)\n\t}\n\n\tif err := p.registerAPIs(); err != nil {\n\t\tlog.Error(\"Failed to register API\", \"err\", err)\n\t\treturn nil\n\t}\n\n\treturn p\n}", "title": "" }, { "docid": "e40748600689f41ff1f4228e2ae67e63", "score": "0.5250577", "text": "func (p *Proxy) prepConn(c net.Conn) (net.Conn, os.Error) {\n\tc.(*net.TCPConn).SetKeepAlive(true)\n\terr := c.SetReadTimeout(p.config.Timeout)\n\tif err != nil {\n\t\tlog.Printf(\"Error TCP set read timeout: %s\\n\", err)\n\t\tc.Close()\n\t\tp.fdl.Unlock()\n\t\treturn c, err\n\t}\n\terr = c.SetWriteTimeout(p.config.Timeout)\n\tif err != nil {\n\t\tlog.Printf(\"Error TCP set write timeout: %s\\n\", err)\n\t\tc.Close()\n\t\tp.fdl.Unlock()\n\t\treturn c, err\n\t}\n\treturn util.NewRunOnCloseConn(c, func() { p.fdl.Unlock() }), nil\n}", "title": "" }, { "docid": "a93f39cebd2042ee166b8a13c2dc6a2c", "score": "0.52450633", "text": "func NewConn() *Conn {\n\tconn := &Conn{}\n\tconn.Pila = pila.NewPila()\n\tconn.Config = config.NewConfig()\n\tconn.Status = NewStatus(v(), time.Now().UTC(), MemStats())\n\treturn conn\n}", "title": "" }, { "docid": "f84d32080cb9951291aa120c2db119b4", "score": "0.5238846", "text": "func (srv *Server) newConn(addr string) (*conn, error) {\n\tpc, err := net.ListenPacket(\"udp\", addr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tc := &conn{\n\t\tserver: srv,\n\t\trwc: pc,\n\t\tbuffer: make([]byte, bufferSize),\n\t\tlocalAddr: pc.LocalAddr(),\n\t}\n\treturn c, nil\n}", "title": "" }, { "docid": "6faded5298f5b50ffc06f4f68f1072a6", "score": "0.5235828", "text": "func New(c net.Conn, opts ...Options) *Conn {\n\ts := &Conn{\n\t\tConn: c,\n\t\tctx: context.Background(),\n\t}\n\tfor _, opt := range opts {\n\t\topt(s)\n\t}\n\treturn s\n}", "title": "" }, { "docid": "68f53584b8899f74ee19b9ab7907a264", "score": "0.5229776", "text": "func New(addr string, password string) (*Conn, error) {\r\n\tc := &Conn{}\r\n\r\n\tc.pool = sync.Pool{\r\n\t\tNew: func() interface{} {\r\n\t\t\tconn, err := net.Dial(\"tcp\", addr)\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\t// Retrieve the XOR key used to encrypt communications between client/server.\r\n\t\t\tkey := make([]byte, msglen)\r\n\r\n\t\t\tn, err := conn.Read(key)\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\tkey = key[:n]\r\n\r\n\t\t\ts := &session{\r\n\t\t\t\tConn: conn,\r\n\t\t\t\tkey: key,\r\n\t\t\t}\r\n\r\n\t\t\terr = s.login(password)\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\tif !c.closing {\r\n\t\t\t\tc.active++\r\n\t\t\t}\r\n\r\n\t\t\treturn s\r\n\t\t},\r\n\t}\r\n\r\n\tswitch s := c.pool.Get().(type) {\r\n\tcase error:\r\n\t\treturn nil, s\r\n\tcase *session:\r\n\t\tc.pool.Put(s)\r\n\t}\r\n\r\n\treturn c, nil\r\n}", "title": "" }, { "docid": "63291eca8a02303109fc42ffda462ea5", "score": "0.5212649", "text": "func newConn(w http.ResponseWriter, req *http.Request) (gochat.Conn, error) {\n return gochat_ws.NewConn(upgrader, timeout, w, req)\n}", "title": "" }, { "docid": "386ed8f7b1a24566723fe6ccc43d2cb1", "score": "0.52067584", "text": "func New(proxyURLString string) *Proxy {\n\tproxy := &Proxy{\n\t\tTr: &http.Transport{\n\t\t\tTLSHandshakeTimeout: 10 * time.Second,\n\t\t\tExpectContinueTimeout: 1 * time.Second,\n\t\t\tDialContext: (&net.Dialer{\n\t\t\t\tTimeout: 30 * time.Second,\n\t\t\t\tKeepAlive: 30 * time.Second,\n\t\t\t}).DialContext,\n\t\t\tIdleConnTimeout: 90 * time.Second,\n\t\t\tDial: net.Dial,\n\t\t},\n\t}\n\n\tif proxyURLString == \"direct\" {\n\t\tproxy.Tr.Proxy = func(req *http.Request) (*url.URL, error) { return nil, nil }\n\t\tproxy.Available = func() bool { return true }\n\t\tproxy.ConnectDial = nil\n\t} else {\n\t\tproxyURL := earl.ParseWithDefaults(proxyURLString, &earl.URL{Scheme: \"auto\"})\n\t\tproxy.Tr.Proxy = func(req *http.Request) (*url.URL, error) { return proxyURL.ToNetURL(), nil }\n\t\tproxy.Available = func() bool { return exec.Command(\"ping\", \"-w\", \"1\", proxyURL.Host).Run() == nil }\n\t\tproxy.ConnectDial = proxy.connectDialer(proxyURL.ToNetURL().String())\n\t}\n\n\treturn proxy\n}", "title": "" }, { "docid": "328577b566e895bd73960ca397e0173f", "score": "0.5205538", "text": "func newProxyConfig(config PodConfig) interface{} {\n\tswitch config.ProxyType {\n\tcase NoopProxyType:\n\t\treturn nil\n\tcase CCProxyType:\n\t\tvar ccConfig CCProxyConfig\n\t\terr := mapstructure.Decode(config.ProxyConfig, &ccConfig)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn ccConfig\n\tdefault:\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "ed747d0aeb8f8619983e2636f282999e", "score": "0.519829", "text": "func newRedisCache(options *modelsoptions.ServingOptions) Cache {\n\tconn, err := redis.Dial(\"tcp\", options.CacheConnectedUrl)\n\tif err != nil {\n\t\tlogrus.Fatal(err)\n\t}\n\treturn &redisCache{conn: conn}\n}", "title": "" }, { "docid": "6f960df73342288da9e89424c248f6eb", "score": "0.5190222", "text": "func newConnWrapper(room *Room, readCloser io.ReadCloser) Connection {\n\treturn &connWrapper{\n\t\tRoom: room,\n\t\treadCloser: readCloser,\n\t}\n}", "title": "" }, { "docid": "8057ce18539a096c6be60b1ea73d3d95", "score": "0.5187118", "text": "func NewProxy(carsChannel, carsChaincode string) *router.Chaincode {\n\tr := router.New(`cars_proxy`) // also initialized logger with \"cars_related\" prefix\n\n\tr.Init(invokeInit)\n\n\tr.Query(`carGet`, queryCarProxy, p.String(`id`))\n\n\treturn router.NewChaincode(r)\n}", "title": "" }, { "docid": "55fcfea81305b43f8e565b75103ca428", "score": "0.5185253", "text": "func New() SqlConn {\n\tvar svc SqlConn\n\t{\n\t\tsvc = NewMysqlConn()\n\t}\n\treturn svc\n}", "title": "" }, { "docid": "6950391f08debfc4d32ad2d3654b45eb", "score": "0.51668423", "text": "func newSessionCache(proxyClient auth.ClientI, servers []utils.NetAddr) (*sessionCache, error) {\n\tclusterName, err := proxyClient.GetClusterName()\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\tm, err := ttlmap.New(1024, ttlmap.CallOnExpire(closeContext))\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\tcache := &sessionCache{\n\t\tclusterName: clusterName.GetClusterName(),\n\t\tproxyClient: proxyClient,\n\t\tcontexts: m,\n\t\tauthServers: servers,\n\t\tcloser: utils.NewCloseBroadcaster(),\n\t}\n\t// periodically close expired and unused sessions\n\tgo cache.expireSessions()\n\treturn cache, nil\n}", "title": "" }, { "docid": "955e9008424861bf2c71c0cad9d9dbf4", "score": "0.51661825", "text": "func NewConn(c net.Conn) *Conn {\n\treturn &Conn{\n\t\tbuf: make([]byte, 8),\n\t\tc: c,\n\t}\n}", "title": "" }, { "docid": "5433379611167447c3001375158bfe46", "score": "0.5165443", "text": "func New(address string, password string, db int, ssl bool) cache.Cache {\n\n\tif ssl {\n\t\treturn &redis{\n\t\t\tclient: r.NewClient(&r.Options{\n\t\t\t\tAddr: address,\n\t\t\t\tPassword: password,\n\t\t\t\tDB: db,\n\t\t\t\tTLSConfig: &tls.Config{InsecureSkipVerify: true},\n\t\t\t})}\n\t}\n\treturn &redis{\n\t\tclient: r.NewClient(&r.Options{\n\t\t\tAddr: address,\n\t\t\tPassword: password,\n\t\t\tDB: db,\n\t\t})}\n\n}", "title": "" }, { "docid": "f47e2c736a1d874e8a914efaead3254c", "score": "0.51538014", "text": "func newClient(key, secret string) *http.Client {\n\tpreq := proxyReq{\n\t\tkey: key,\n\t\tsecret: secret,\n\t}\n\tjar, _ := cookiejar.New(nil)\n\ttransport := &http.Transport{\n\t\tProxy: preq.reqProxy,\n\t\tDialContext: (&net.Dialer{\n\t\t\tTimeout: 30 * time.Second,\n\t\t\tKeepAlive: 30 * time.Second,\n\t\t}).DialContext,\n\t\tMaxIdleConns: 100,\n\t\tIdleConnTimeout: 90 * time.Second,\n\t\tTLSHandshakeTimeout: 10 * time.Second,\n\t\tExpectContinueTimeout: 1 * time.Second,\n\t}\n\treturn &http.Client{\n\t\tJar: jar,\n\t\tTransport: transport,\n\t\tTimeout: 2 * time.Minute,\n\t}\n}", "title": "" }, { "docid": "3c668fa2c0979802ff12522ac09a32e5", "score": "0.5147143", "text": "func NewConn(conn net.Conn, typ Type) *Conn {\n\tseqId, done := newSeqIdGenerator()\n\tc := &Conn{\n\t\tConn: conn,\n\t\tTyp: typ,\n\t\tSeqId: seqId,\n\t\tdone: done,\n\t}\n\ttc := c.Conn.(*net.TCPConn) // Always tcpconn\n\ttc.SetKeepAlive(true) //Keepalive as default\n\treturn c\n}", "title": "" }, { "docid": "3ea51941811f4006e4b455e32e8e54ea", "score": "0.51389146", "text": "func NewConn(conn net.Conn) *Conn {\n\tpConn := &Conn{\n\t\tbufReader: bufio.NewReader(conn),\n\t\tconn: conn,\n\t}\n\treturn pConn\n}", "title": "" }, { "docid": "3ea51941811f4006e4b455e32e8e54ea", "score": "0.51389146", "text": "func NewConn(conn net.Conn) *Conn {\n\tpConn := &Conn{\n\t\tbufReader: bufio.NewReader(conn),\n\t\tconn: conn,\n\t}\n\treturn pConn\n}", "title": "" }, { "docid": "f091023f2cac6a2127fc0371e374ffb7", "score": "0.5128755", "text": "func New() *ConnectionCache {\n\tcache := ConnectionCache{\n\t\tmutex: &sync.Mutex{},\n\t\tconnectCache: make(map[string]time.Time),\n\t\tdisconnectCache: make(map[string]time.Time),\n\t}\n\tgo pollForTimedOutRecords(cache.mutex, []map[string]time.Time{\n\t\tcache.connectCache,\n\t\tcache.disconnectCache,\n\t})\n\treturn &cache\n}", "title": "" }, { "docid": "354d63dbce7c3a6d7c5dc1a7d633f87d", "score": "0.5124102", "text": "func newMemCache(lruCap ...int) *memCache {\n\tc := &memCache{\n\t\tlruGetList: glist.New(true),\n\t\tdata: make(map[interface{}]memCacheItem),\n\t\texpireTimes: make(map[interface{}]int64),\n\t\texpireSets: make(map[int64]*gset.Set),\n\t\teventList: glist.New(true),\n\t\tclosed: gtype.NewBool(),\n\t}\n\tif len(lruCap) > 0 {\n\t\tc.cap = lruCap[0]\n\t\tc.lru = newMemCacheLru(c)\n\t}\n\treturn c\n}", "title": "" }, { "docid": "658b41a2e6e4324286b28fd4cfdfea62", "score": "0.51225895", "text": "func (cp *connectionPool) newBackend(addr string) *backend {\n\treturn &backend{\n\t\tmu: &sync.Mutex{},\n\t\tconf: cp.conf,\n\t\taddr: addr,\n\t\tchannel: make(chan *connection, cp.conf.ConnectionLimit),\n\t}\n}", "title": "" }, { "docid": "ca5da8ba79155e2ab9cfe12ddd4535df", "score": "0.5121496", "text": "func newConn(rw io.ReadWriter, prev net.Conn) net.Conn {\n\tif c, ok := rw.(net.Conn); ok {\n\t\treturn c\n\t}\n\n\t// Pull out a connection state function if possible.\n\ttc, ok := rw.(tlsConn)\n\tif !ok {\n\t\ttc, _ = prev.(tlsConn)\n\t}\n\tvar cs func() tls.ConnectionState\n\tif tc != nil {\n\t\tcs = tc.ConnectionState\n\t}\n\n\tvar rd, wd func(time.Time) error\n\tif rdPrev, ok := prev.(interface {\n\t\tSetReadDeadline(time.Time) error\n\t}); ok {\n\t\trd = rdPrev.SetReadDeadline\n\t}\n\tif wdPrev, ok := prev.(interface {\n\t\tSetWriteDeadline(time.Time) error\n\t}); ok {\n\t\twd = wdPrev.SetWriteDeadline\n\t}\n\n\tnc := &conn{\n\t\trw: rw,\n\t\tc: prev,\n\t\trd: rd,\n\t\twd: wd,\n\t\tconnState: cs,\n\t}\n\treturn nc\n}", "title": "" } ]
70730fd4d40c97c527f866b06b4144a4
validateSignature validates the signature for the given payload. The signature is included on each webhook with the attribute p_signature. payload is the Form payload sent by Paddle Webhooks. publicKey is the Paddle public key. Paddle Reference:
[ { "docid": "42836c93a07b838e00ec8015cea44caa", "score": "0.7062219", "text": "func validateSignature(form url.Values, p_signature string, publicKey []byte) error {\n\t// Find PEM public key block.\n\tder, _ := pem.Decode(publicKey)\n\tif der == nil {\n\t\treturn errors.New(\"Could not parse public key pem\")\n\t}\n\n\t// Parse public key in PKIX, ASN.1 DER form.\n\tpub, err := x509.ParsePKIXPublicKey(der.Bytes)\n\tif err != nil {\n\t\treturn errors.New(\"Could not parse public key pem der\")\n\t}\n\n\tsigningKey, ok := pub.(*rsa.PublicKey)\n\tif !ok {\n\t\treturn errors.New(\"Not the correct key format\")\n\t}\n\n\t// base64 decode p_signature\n\tsig, err := base64.StdEncoding.DecodeString(p_signature)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// ksort() and serialize the Form\n\tsha1Sum := sha1.Sum(phpserialize(form))\n\n\terr = rsa.VerifyPKCS1v15(signingKey, crypto.SHA1, sha1Sum[:], sig)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" } ]
[ { "docid": "c65d5bec0655922c15ea8fe69d9a9119", "score": "0.6765457", "text": "func validateSignature(signature string, payload, secretKey []byte) error {\n\ttimestamp, sig, err := getTimestampAndSignature(signature)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tmacPayload := fmt.Sprintf(\"%s.%s\", timestamp, payload)\n\n\tif !checkMAC([]byte(macPayload), sig, secretKey, sha256.New) {\n\t\treturn fmt.Errorf(\"payload signature check failed\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "21a9d5fa0c8e489ac8fdd7f537ad62e9", "score": "0.67541295", "text": "func ValidateSignature(jwtToken, body, jwksURI string, b64 bool) (bool, error) {\n\terr := ValidateSignatureHeader(jwtToken, b64)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tkid, err := getKidFromToken(jwtToken)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tcert, err := getCertForKid(kid, jwksURI)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tsignature, err := insertBodyIntoJWT(jwtToken, body, b64) // b64claim\n\tif err != nil {\n\t\tlogrus.Errorf(\"failed to insert body into signature message: %v\", err)\n\t\treturn false, err\n\t}\n\tlogrus.Trace(\"Signature with payload: \" + signature)\n\n\tverified, err := JWSVerify(signature, jwa.PS256, cert.PublicKey, b64)\n\tif err != nil {\n\t\tlogrus.Errorf(\"failed to verify message: %v\", err)\n\t\treturn false, err\n\t}\n\n\tlogrus.Tracef(\"signed message verified! -> %s\", verified)\n\n\treturn true, nil\n}", "title": "" }, { "docid": "42c6fdd548b57d35a45c55873892000a", "score": "0.66901743", "text": "func ValidatePayload(r *http.Request, secretKey []byte) (payload []byte, err error) {\n\tif payload, err = ioutil.ReadAll(r.Body); err != nil {\n\t\treturn nil, err\n\t}\n\n\tsig := r.Header.Get(SignatureHeader)\n\tif sig == \"\" {\n\t\treturn nil, fmt.Errorf(\"No %s header present on request\", SignatureHeader)\n\t}\n\n\tif err = validateSignature(sig, payload, secretKey); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn payload, nil\n}", "title": "" }, { "docid": "a41b9f1410fd5065dff264223384682a", "score": "0.6345721", "text": "func ValidateSignature(sharedSecret string) func(next http.Handler) http.Handler {\n\treturn func(next http.Handler) http.Handler {\n\t\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\tctx, span := trace.StartSpan(r.Context(), \"middleware.ValidateSignature\")\n\t\t\tdefer span.End()\n\n\t\t\terr := r.ParseForm()\n\t\t\tif err != nil {\n\t\t\t\thttputil.ErrorResponse(w, r, httputil.Error(\"couldn't parse form\", http.StatusBadRequest, err))\n\t\t\t\treturn\n\t\t\t}\n\t\t\tredirectURI := r.Form.Get(\"redirect_uri\")\n\t\t\tsigVal := r.Form.Get(\"sig\")\n\t\t\ttimestamp := r.Form.Get(\"ts\")\n\t\t\tif !ValidSignature(redirectURI, sigVal, timestamp, sharedSecret) {\n\t\t\t\thttputil.ErrorResponse(w, r, httputil.Error(\"invalid signature\", http.StatusBadRequest, nil))\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tnext.ServeHTTP(w, r.WithContext(ctx))\n\t\t})\n\t}\n}", "title": "" }, { "docid": "98a4e214a646151cc589e695e324e335", "score": "0.62199056", "text": "func doesPolicySignatureMatch(formValues http.Header) APIErrorCode {\n\t// For SignV2 - Signature field will be valid\n\tif _, ok := formValues[\"Signature\"]; ok {\n\t\treturn doesPolicySignatureV2Match(formValues)\n\t}\n\treturn doesPolicySignatureV4Match(formValues)\n}", "title": "" }, { "docid": "4f1a88b1a9b82a4d1b0e98847c2bd620", "score": "0.6129335", "text": "func ValidateSignature(sharedSecret string) func(next http.Handler) http.Handler {\n\treturn func(next http.Handler) http.Handler {\n\t\treturn httputil.HandlerFunc(func(w http.ResponseWriter, r *http.Request) error {\n\t\t\tctx, span := trace.StartSpan(r.Context(), \"middleware.ValidateSignature\")\n\t\t\tdefer span.End()\n\t\t\tif err := ValidateRequestURL(r, sharedSecret); err != nil {\n\t\t\t\treturn httputil.NewError(http.StatusBadRequest, err)\n\t\t\t}\n\t\t\tnext.ServeHTTP(w, r.WithContext(ctx))\n\t\t\treturn nil\n\t\t})\n\t}\n}", "title": "" }, { "docid": "a9f3b1c6f483b9774a4f7739f4b2bf00", "score": "0.60721666", "text": "func (a AAT) ValidateSignature() error {\n\t// check for valid signature\n\tmessageHash := a.HashString()\n\t// verifies the signature with the message of the AAT\n\tif err := SignatureVerification(a.ApplicationPublicKey, messageHash, a.ApplicationSignature); err != nil {\n\t\treturn InvalidTokenSignatureErorr\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a604d1dca2206a576f4840274a9454c6", "score": "0.60555565", "text": "func (h *slackEventAPIHandler) verifySigning(header http.Header, body []byte) error {\n\tsignature := sanitizeUserInput(header.Get(signatureHeader))\n\tif signature == \"\" {\n\t\treturn errors.New(\"empty signature header\")\n\t}\n\n\tif signature[:3] != \"v0=\" {\n\t\treturn errors.New(`signature header format does not begin with \"v0=\": ` + signature)\n\t}\n\n\ttimestamp := header.Get(signatureTimestampHeader)\n\tif timestamp == \"\" {\n\t\treturn errors.New(\"empty signature timestamp header\")\n\t}\n\n\tts, err := strconv.ParseInt(timestamp, 10, 64)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error parsing header timestamp: %w\", err)\n\t}\n\n\tnow := int64(h.time.Now().Unix())\n\tif now-ts > expiresSeconds {\n\t\treturn errors.New(\"signing timestamp expired\")\n\t}\n\n\tsignString := \"v0:\" + timestamp + \":\" + string(body)\n\thm := hmac.New(sha256.New, []byte(h.signingSecret))\n\tif _, err := hm.Write([]byte(signString)); err != nil {\n\t\treturn fmt.Errorf(\"error writing signing string into hmac: %w\", err)\n\t}\n\n\thash := hm.Sum(nil)\n\tchallenge := hex.EncodeToString(hash)\n\n\t// remove `v=0` from signature\n\tif challenge != signature[3:] {\n\t\treturn errors.New(\"received wrong signature signing hash\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "126323142e90c633842a3026a895c2eb", "score": "0.5984528", "text": "func VerifySignature(curve elliptic.Curve, signerPublicKey *Point, msgHash []byte, s *Skalar, R *Point) bool {\n\tccurve := NewCurve(curve)\n\tmsg := ccurve.Skalar(msgHash)\n\tr2 := R.ExtractR()\n\tlh := ccurve.ScalarBaseMult(s)\n\trh := signerPublicKey.ScalarMult(r2).Add(R.ScalarMult(msg))\n\treturn lh.Equal(rh)\n}", "title": "" }, { "docid": "ca17d5c8f382b465bd8eb3c864e3fc2d", "score": "0.5962761", "text": "func (ctx rsaEncrypterVerifier) verifyPayload(payload []byte, signature []byte, alg SignatureAlgorithm) error {\n\tvar hash crypto.Hash\n\n\tswitch alg {\n\tcase RS256, PS256:\n\t\thash = crypto.SHA256\n\tcase RS384, PS384:\n\t\thash = crypto.SHA384\n\tcase RS512, PS512:\n\t\thash = crypto.SHA512\n\tdefault:\n\t\treturn ErrUnsupportedAlgorithm\n\t}\n\n\thasher := hash.New()\n\n\t// According to documentation, Write() on hash never fails\n\t_, _ = hasher.Write(payload)\n\thashed := hasher.Sum(nil)\n\n\tswitch alg {\n\tcase RS256, RS384, RS512:\n\t\treturn rsa.VerifyPKCS1v15(ctx.publicKey, hash, hashed, signature)\n\tcase PS256, PS384, PS512:\n\t\treturn rsa.VerifyPSS(ctx.publicKey, hash, hashed, signature, nil)\n\t}\n\n\treturn ErrUnsupportedAlgorithm\n}", "title": "" }, { "docid": "ae2f1297a5a8b0998bc7c13bd984f769", "score": "0.593877", "text": "func (*Backend) VerifySignature(msg []byte, sig wallet.Sig, a wallet.Address) (bool, error) {\n\treturn VerifySignature(msg, sig, a)\n}", "title": "" }, { "docid": "27fa3e1daa673ca0114854c9e9706e5d", "score": "0.59028846", "text": "func validatePayload(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tp, err := github.ValidatePayload(r, []byte(conf.GithubApp.GithubWebhookSecret))\n\t\tif err != nil {\n\t\t\tlog.Error(err)\n\t\t\thttp.Error(w, http.StatusText(401), 401)\n\t\t\treturn\n\t\t}\n\n\t\tpd, err := getWebhookAPIRequest(p)\n\t\tif err != nil {\n\t\t\tlog.Error(\"Error unmarshalling json payload: \", err)\n\t\t\treturn\n\t\t}\n\t\tpayload = pd\n\t\tnext.ServeHTTP(w, r)\n\t})\n}", "title": "" }, { "docid": "98bd5aa84dfb3761239d5a29cc5f5d75", "score": "0.5881146", "text": "func ValidatePayload(payload []byte, header string, secret string) error {\n\treturn ValidatePayloadWithTolerance(payload, header, secret, DefaultTolerance)\n}", "title": "" }, { "docid": "ea781687a3d902f38a5fa5920145fc4b", "score": "0.5869332", "text": "func (c *Wallet) VerifySignature(pubKey, msg, signature string) error {\n\treturn errors.New(\"verify signature not supported for BBC currently\")\n}", "title": "" }, { "docid": "b974883e8e9dd1fc64276ea568317161", "score": "0.58492047", "text": "func VerifySignature(publicKey *rsa.PublicKey, hashedIntent []byte, signature string) bool {\n\tsignatureString, err := base64.StdEncoding.DecodeString(signature)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tpanic(err)\n\t}\n\n\terr = rsa.VerifyPSS(publicKey, crypto.SHA256, hashedIntent, signatureString, nil)\n\tif err != nil {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "211f85768fa35a4ec2f950c19b7ac004", "score": "0.5848174", "text": "func (v *Validator) validSignature(ts, rqp string, b []byte, rs string) bool {\n\tuqp, err := url.Parse(\"?\" + rqp)\n\tif err != nil {\n\t\treturn false\n\t}\n\tes, err := v.calculateSignature(ts, uqp.Query().Encode(), b)\n\tif err != nil {\n\t\treturn false\n\t}\n\tdrs, err := base64.StdEncoding.DecodeString(rs)\n\tif err != nil {\n\t\treturn false\n\t}\n\treturn hmac.Equal(drs, es)\n}", "title": "" }, { "docid": "bea96109b2a9409d4fac3eac45ac875f", "score": "0.5847429", "text": "func Validate(sig string, payload, key []byte) error {\n\tmessageMAC, hashFunc, err := messageMAC(sig)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !checkMAC(payload, messageMAC, key, hashFunc) {\n\t\treturn errors.New(\"signature check failed\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d36d1c2875c873877d83bdd5916c7542", "score": "0.5832864", "text": "func CheckPayloadSignature(payload []byte, secret string, signature string) (string, bool) {\n\tif strings.HasPrefix(signature, \"sha1=\") {\n\t\tsignature = signature[5:]\n\t}\n\n\tmac := hmac.New(sha1.New, []byte(secret))\n\tmac.Write(payload)\n\texpectedMAC := hex.EncodeToString(mac.Sum(nil))\n\n\treturn expectedMAC, hmac.Equal([]byte(signature), []byte(expectedMAC))\n}", "title": "" }, { "docid": "919fa87f8dbefe7344912f5cf22c5392", "score": "0.58173114", "text": "func (ctx ecEncrypterVerifier) verifyPayload(payload []byte, signature []byte, alg SignatureAlgorithm) error {\n\tvar keySize int\n\tvar hash crypto.Hash\n\n\tswitch alg {\n\tcase ES256:\n\t\tkeySize = 32\n\t\thash = crypto.SHA256\n\tcase ES384:\n\t\tkeySize = 48\n\t\thash = crypto.SHA384\n\tcase ES512:\n\t\tkeySize = 66\n\t\thash = crypto.SHA512\n\tdefault:\n\t\treturn ErrUnsupportedAlgorithm\n\t}\n\n\tif len(signature) != 2*keySize {\n\t\treturn fmt.Errorf(\"square/go-jose: invalid signature size, have %d bytes, wanted %d\", len(signature), 2*keySize)\n\t}\n\n\thasher := hash.New()\n\n\t// According to documentation, Write() on hash never fails\n\t_, _ = hasher.Write(payload)\n\thashed := hasher.Sum(nil)\n\n\tr := big.NewInt(0).SetBytes(signature[:keySize])\n\ts := big.NewInt(0).SetBytes(signature[keySize:])\n\n\tmatch := ecdsa.Verify(ctx.publicKey, hashed, r, s)\n\tif !match {\n\t\treturn errors.New(\"square/go-jose: ecdsa signature failed to verify\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "39370e2e3e3bc28893ec9593d3ca986d", "score": "0.57737035", "text": "func (r RealTime) ValidSignature(body []byte, signature string) bool {\n\thash := hmac.New(sha1.New, []byte(r.ClientSecret))\n\thash.Write(body)\n\treturn hex.EncodeToString(hash.Sum(nil)) == signature\n}", "title": "" }, { "docid": "753801576c4ad806f616cbde02b10d53", "score": "0.5757451", "text": "func (xp *Xp) VerifySignature(context types.Node, publicKeys []*rsa.PublicKey) (err error) {\n\tsignaturelist := xp.Query(context, \"ds:Signature[1]\")\n\tif len(signaturelist) != 1 {\n\t\treturn fmt.Errorf(\"no signature found\")\n\t}\n\tsignature := signaturelist[0]\n\n\tsignatureValue := xp.Query1(signature, \"ds:SignatureValue\")\n\tsignedInfo := xp.Query(signature, \"ds:SignedInfo\")[0]\n\n\tsignedInfoC14n := xp.C14n(signedInfo, \"\")\n\tdigestValue := xp.Query1(signedInfo, \"ds:Reference/ds:DigestValue\")\n\tID := xp.Query1(context, \"@ID\")\n\tURI := xp.Query1(signedInfo, \"ds:Reference/@URI\")\n\tisvalid := \"#\"+ID == URI\n\tif !isvalid {\n\t\treturn fmt.Errorf(\"ID mismatch\")\n\t}\n\n\tdigestMethod := xp.Query1(signedInfo, \"ds:Reference/ds:DigestMethod/@Algorithm\")\n\n\tnsPrefix := xp.Query1(signature, \".//ec:InclusiveNamespaces/@PrefixList\")\n\n nextsibling, _ := signature.NextSibling()\n\tcontext.RemoveChild(signature)\n\n\tcontextDigest := Hash(Algos[digestMethod].Algo, xp.C14n(context, nsPrefix))\n\tnextsibling.AddPrevSibling(signature)\n\tcontextDigestValueComputed := base64.StdEncoding.EncodeToString(contextDigest)\n\n\tisvalid = contextDigestValueComputed == digestValue\n\tif !isvalid {\n\t\treturn fmt.Errorf(\"digest mismatch\")\n\t}\n\tsignatureMethod := xp.Query1(signedInfo, \"ds:SignatureMethod/@Algorithm\")\n\tsignedInfoDigest := Hash(Algos[signatureMethod].Algo, signedInfoC14n)\n\n// log.Printf(\"SigAlg: %s %s %s %s\\n\", xp.QueryString(context, \"local-name(.)\"), xp.Query1(context, \"saml:Issuer\"), digestMethod, signatureMethod)\n\n\tds, _ := base64.StdEncoding.DecodeString(signatureValue)\n\n\tfor _, pub := range publicKeys {\n\t\terr = rsa.VerifyPKCS1v15(pub, Algos[signatureMethod].Algo, signedInfoDigest[:], ds)\n\t\tif err == nil {\n\t\t\treturn\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "0ed4fad52b4be8701d7d564221620344", "score": "0.57447743", "text": "func (s NaclSigInfo) verifyWithPayload(payload []byte, checkPayloadEquality bool) (*NaclSigningKeyPublic, error) {\n\tkey := KIDToNaclSigningKeyPublic(s.Kid)\n\tif key == nil {\n\t\treturn nil, BadKeyError{}\n\t}\n\tif payload == nil {\n\t\treturn nil, newVerificationErrorWithString(\"nil payload\")\n\t}\n\tif len(payload) == 0 {\n\t\treturn nil, newVerificationErrorWithString(\"empty payload\")\n\t}\n\n\tif checkPayloadEquality && s.Payload != nil && !SecureByteArrayEq(payload, s.Payload) {\n\t\treturn nil, newVerificationErrorWithString(\"payload mismatch\")\n\t}\n\n\tswitch s.Version {\n\tcase 0, 1:\n\t\tif !key.Verify(payload, s.Sig) {\n\t\t\treturn nil, newVerificationErrorWithString(\"verify failed\")\n\t\t}\n\tcase 2:\n\t\tif !s.Prefix.IsWhitelisted() {\n\t\t\treturn nil, newVerificationErrorWithString(\"unknown prefix\")\n\t\t}\n\t\tif !key.Verify(s.Prefix.Prefix(payload), s.Sig) {\n\t\t\treturn nil, newVerificationErrorWithString(\"verify failed\")\n\t\t}\n\tdefault:\n\t\treturn nil, UnhandledSignatureError{s.Version}\n\t}\n\n\treturn key, nil\n}", "title": "" }, { "docid": "3edcc14ad01fd820f2f2d817815b6b41", "score": "0.57447416", "text": "func (v *verifier) Verify(msg *message) error {\n\tsigHdr := msg.Header.Get(\"Signature\")\n\tif sigHdr == \"\" {\n\t\treturn errNotSigned\n\t}\n\n\tparamHdr := msg.Header.Get(\"Signature-Input\")\n\tif paramHdr == \"\" {\n\t\treturn errNotSigned\n\t}\n\n\tsigParts := strings.Split(sigHdr, \", \")\n\tparamParts := strings.Split(paramHdr, \", \")\n\n\tif len(sigParts) != len(paramParts) {\n\t\treturn errMalformedSignature\n\t}\n\n\t// TODO: could be smarter about selecting the sig to verify, eg based\n\t// on algorithm\n\tvar sigID string\n\tvar params *signatureParams\n\tfor _, p := range paramParts {\n\t\tpParts := strings.SplitN(p, \"=\", 2)\n\t\tif len(pParts) != 2 {\n\t\t\treturn errMalformedSignature\n\t\t}\n\n\t\tcandidate, err := parseSignatureInput(pParts[1])\n\t\tif err != nil {\n\t\t\treturn errMalformedSignature\n\t\t}\n\n\t\tif _, ok := v.keys[candidate.keyID]; ok {\n\t\t\tsigID = pParts[0]\n\t\t\tparams = candidate\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif params == nil {\n\t\treturn errUnknownKey\n\t}\n\n\tvar signature string\n\tfor _, s := range sigParts {\n\t\tsParts := strings.SplitN(s, \"=\", 2)\n\t\tif len(sParts) != 2 {\n\t\t\treturn errMalformedSignature\n\t\t}\n\n\t\tif sParts[0] == sigID {\n\t\t\t// TODO: error if not surrounded by colons\n\t\t\tsignature = strings.Trim(sParts[1], \":\")\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif signature == \"\" {\n\t\treturn errMalformedSignature\n\t}\n\n\tver := v.keys[params.keyID]\n\tif ver.alg != \"\" && params.alg != \"\" && ver.alg != params.alg {\n\t\treturn errAlgMismatch\n\t}\n\n\t// verify signature. if invalid, error\n\tsig, err := base64.StdEncoding.DecodeString(signature)\n\tif err != nil {\n\t\treturn errMalformedSignature\n\t}\n\n\tverifier := ver.verifier()\n\n\t//TODO: skip the buffer.\n\n\tvar b bytes.Buffer\n\n\t// canonicalize headers\n\t// TODO: wrap the errors within\n\tfor _, h := range params.items {\n\n\t\t// handle specialty components, section 2.3\n\t\tvar err error\n\t\tswitch h {\n\t\tcase \"@method\":\n\t\t\terr = canonicalizeMethod(&b, msg.Method)\n\t\tcase \"@path\":\n\t\t\terr = canonicalizePath(&b, msg.URL.Path)\n\t\tcase \"@query\":\n\t\t\terr = canonicalizeQuery(&b, msg.URL.RawQuery)\n\t\tcase \"@authority\":\n\t\t\terr = canonicalizeAuthority(&b, msg.Authority)\n\t\tdefault:\n\t\t\t// handle default (header) components\n\t\t\terr = canonicalizeHeader(&b, h, msg.Header)\n\t\t}\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif _, err := verifier.w.Write(b.Bytes()); err != nil {\n\t\treturn err\n\t}\n\n\tif err = canonicalizeSignatureParams(verifier.w, params); err != nil {\n\t\treturn err\n\t}\n\n\terr = verifier.verify(sig)\n\tif err != nil {\n\t\treturn errInvalidSignature\n\t}\n\n\t// TODO: could put in some wiggle room\n\tif params.expires != nil && params.expires.After(time.Now()) {\n\t\treturn errSignatureExpired\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f35bd7c8399a3b60a3209932338b95f3", "score": "0.5743505", "text": "func VerifySignature(headers map[string]string, body string) error {\n\trawToken := os.Getenv(\"WEBHOOK_SECRET_TOKEN\")\n\tsignature, err := GetSignature(headers)\n\tif err != nil {\n\t\treturn errors.New(\"Missing signature\")\n\t}\n\tmac := hmac.New(sha1.New, []byte(rawToken))\n\tmac.Write([]byte(body))\n\texpectedMAC := mac.Sum(nil)\n\texpectedHubSignature := fmt.Sprintf(\"sha1=%s\", hex.EncodeToString(expectedMAC))\n\n\tif signature != expectedHubSignature {\n\t\treturn errors.New(\"Signature did not match\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e6bd6276111fb68b5804b0e00f71851a", "score": "0.5723861", "text": "func (a *Authenticate) requireValidSignature(next httputil.HandlerFunc) http.Handler {\n\treturn httputil.HandlerFunc(func(w http.ResponseWriter, r *http.Request) error {\n\t\terr := middleware.ValidateRequestURL(a.getExternalRequest(r), a.state.Load().sharedKey)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn next(w, r)\n\t})\n}", "title": "" }, { "docid": "e6bd6276111fb68b5804b0e00f71851a", "score": "0.5723861", "text": "func (a *Authenticate) requireValidSignature(next httputil.HandlerFunc) http.Handler {\n\treturn httputil.HandlerFunc(func(w http.ResponseWriter, r *http.Request) error {\n\t\terr := middleware.ValidateRequestURL(a.getExternalRequest(r), a.state.Load().sharedKey)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn next(w, r)\n\t})\n}", "title": "" }, { "docid": "ba313e8ceb2b80e93b232955cede5387", "score": "0.5707021", "text": "func (m *HelmV001SchemaChartProvenanceSignature) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateContent(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4f91a8a8ece8e5ead2c7ba40eb6b2179", "score": "0.5700808", "text": "func (s SignatureVerifier) verifySignature(data []byte, sig DigitallySigned) error {\n\tif sig.HashAlgorithm != SHA256 {\n\t\treturn fmt.Errorf(\"unsupported HashAlgorithm in signature: %v\", sig.HashAlgorithm)\n\t}\n\n\thasherType := crypto.SHA256\n\thasher := hasherType.New()\n\tif _, err := hasher.Write(data); err != nil {\n\t\treturn fmt.Errorf(\"failed to write to hasher: %v\", err)\n\t}\n\thash := hasher.Sum([]byte{})\n\n\tswitch sig.SignatureAlgorithm {\n\tcase RSA:\n\t\trsaKey, ok := s.pubKey.(*rsa.PublicKey)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"cannot verify RSA signature with %T key\", s.pubKey)\n\t\t}\n\t\tif err := rsa.VerifyPKCS1v15(rsaKey, hasherType, hash, sig.Signature); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to verify rsa signature: %v\", err)\n\t\t}\n\tcase ECDSA:\n\t\tecdsaKey, ok := s.pubKey.(*ecdsa.PublicKey)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"cannot verify ECDSA signature with %T key\", s.pubKey)\n\t\t}\n\t\tvar ecdsaSig struct {\n\t\t\tR, S *big.Int\n\t\t}\n\t\trest, err := asn1.Unmarshal(sig.Signature, &ecdsaSig)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to unmarshal ECDSA signature: %v\", err)\n\t\t}\n\t\tif len(rest) != 0 {\n\t\t\tlog.Printf(\"Garbage following signature %v\", rest)\n\t\t}\n\n\t\tif !ecdsa.Verify(ecdsaKey, hash, ecdsaSig.R, ecdsaSig.S) {\n\t\t\treturn errors.New(\"failed to verify ecdsa signature\")\n\t\t}\n\tdefault:\n\t\treturn fmt.Errorf(\"unsupported signature type %v\", sig.SignatureAlgorithm)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "235f4ed838613baa0dd277b85e3378b6", "score": "0.5685966", "text": "func (pubKey PubKey) VerifySignature(msg, sig []byte) bool {\n\treturn pubKey.verifySignatureECDSA(msg, sig) || pubKey.verifySignatureAsEIP712(msg, sig)\n}", "title": "" }, { "docid": "cd76a2b8728b9203f795439e49b263c6", "score": "0.5682055", "text": "func (v pgpVerifierImpl) verifyPgp(signature, publicKey []byte) ([]byte, error) {\n\tkeyring, err := openpgp.ReadArmoredKeyRing(bytes.NewReader(publicKey))\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"error reading armored key ring\")\n\t}\n\n\tarmorBlock, err := armor.Decode(bytes.NewReader(signature))\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"error decoding armored signature\")\n\t}\n\n\tmessageDetails, err := openpgp.ReadMessage(armorBlock.Body, keyring, nil, nil)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"error reading armor signature\")\n\t}\n\n\t// MessageDetails.UnverifiedBody signature is not verified until we read it.\n\t// This will call PublicKey.VerifySignature for the keys in the keyring.\n\tpayload, err := ioutil.ReadAll(messageDetails.UnverifiedBody)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"error reading message contents\")\n\t}\n\n\t// Make sure after reading the UnverifiedBody above that the Signature\n\t// exists and there is no SignatureError.\n\tif messageDetails.SignatureError != nil {\n\t\treturn nil, errors.Wrap(messageDetails.SignatureError, \"failed to validate: signature error\")\n\t}\n\tif messageDetails.Signature == nil {\n\t\treturn nil, fmt.Errorf(\"failed to validate: signature missing\")\n\t}\n\treturn payload, nil\n}", "title": "" }, { "docid": "2d7af6ef93ba703db05e8a30d718098b", "score": "0.5670293", "text": "func (address *ED25519Address) CheckSignature(message []byte, signature Signature) error {\n\n\tif ed25519.SignatureSize != len(signature) {\n\t\treturn fault.ErrInvalidSignature\n\t}\n\n\t// ***** FIX THIS: any way to avoid these exta copies *****\n\ts := [ed25519.SignatureSize]byte{}\n\tcopy(s[:], signature[:])\n\n\tif !ed25519.Verify(address.PublicKey, message, &s) {\n\t\treturn fault.ErrInvalidSignature\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "388286e79c43266c6120ba482af3925c", "score": "0.56635916", "text": "func (wh eventsReceiver) ValidatePayload(r *http.Request) ([]byte, apperrors.AppError) {\n\tpayload, err := github.ValidatePayload(r, []byte(wh.secret))\n\tif err != nil {\n\t\treturn nil, apperrors.AuthenticationFailed(\"authentication during GitHub payload validation failed: %s\", err)\n\t}\n\treturn payload, nil\n}", "title": "" }, { "docid": "be27056907c1ace19a4ed367b016bf2b", "score": "0.56522787", "text": "func verifyWebHook(r *http.Request, slackSigningSecret string) (bool, error) {\n\t// Set basic control data from the request itself.\n\ttimeStamp := r.Header.Get(slackRequestTimestampHeader)\n\tslackSignature := r.Header.Get(slackSignatureHeader)\n\n\t// Convert the timestamp into an integer for comparing.\n\tt, err := strconv.ParseInt(timeStamp, 10, 64)\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"strconv.ParseInt(%s): %v\", timeStamp, err)\n\t}\n\n\t// Validate that the time this message was sent was within the last five minutes.\n\tif ageOk, age := checkTimestamp(t); !ageOk {\n\t\treturn false, fmt.Errorf(\"checkTimestamp(%v): %v %v\", t, ageOk, age)\n\t}\n\n\t// Verify that the headers actually contained the needed controls.\n\tif timeStamp == \"\" || slackSignature == \"\" {\n\t\treturn false, fmt.Errorf(\"either timeStamp or signature headers were blank\")\n\t}\n\n\t// Generate a slice of bytes representing the body for hashing.\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"ioutil.ReadAll(%v): %v\", r.Body, err)\n\t}\n\n\t// Reset the body so other calls won't fail.\n\tr.Body = ioutil.NopCloser(bytes.NewBuffer(body))\n\n\t// Create the string used to validate the signature. The string is\n\t// based on the Slack version (which is always \"v0\"), the timestamp,\n\t// and the body itself.\n\tbaseString := fmt.Sprintf(\"%s:%s:%s\", version, timeStamp, body)\n\n\t// Generate the signature of this request based on all the parts and the\n\t// original signing secret from Slack.\n\tsignature := getSignature([]byte(baseString), []byte(slackSigningSecret))\n\n\t// Drop the \"v0=\" off the front of the signature since the computed\n\t// one will not have it. Convert the trimmed hex string into bytes.\n\ttrimmed := strings.TrimPrefix(slackSignature, fmt.Sprintf(\"%s=\", version))\n\tsignatureInHeader, err := hex.DecodeString(trimmed)\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"hex.DecodeString(%v): %v\", trimmed, err)\n\t}\n\n\t// Compare the two values and return true if they are a match.\n\treturn hmac.Equal(signature, signatureInHeader), nil\n}", "title": "" }, { "docid": "465d04d137b57217bb23630ba1aeaf6c", "score": "0.5640177", "text": "func VerifySignature(signature, pubKey, msg string) error {\n\tsig, err := ConvertSignature(signature)\n\tif err != nil {\n\t\treturn SignatureError{\n\t\t\tErrorCode: ErrorStatusSignatureInvalid,\n\t\t\tErrorContext: err.Error(),\n\t\t}\n\t}\n\tb, err := hex.DecodeString(pubKey)\n\tif err != nil {\n\t\treturn SignatureError{\n\t\t\tErrorCode: ErrorStatusPublicKeyInvalid,\n\t\t\tErrorContext: \"key is not hex\",\n\t\t}\n\t}\n\tpk, err := identity.PublicIdentityFromBytes(b)\n\tif err != nil {\n\t\treturn SignatureError{\n\t\t\tErrorCode: ErrorStatusPublicKeyInvalid,\n\t\t\tErrorContext: err.Error(),\n\t\t}\n\t}\n\tif !pk.VerifyMessage([]byte(msg), sig) {\n\t\treturn SignatureError{\n\t\t\tErrorCode: ErrorStatusSignatureInvalid,\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ece3e9a9a30b4eee052e7eb95bf76190", "score": "0.56357884", "text": "func VerifySignature(message []byte, signature []byte, p *crypto.ECPoint) bool {\n\thash := sha256.Sum256(message)\n\tpublicKey := p.ToECDsa()\n\n\tif p.X == nil || p.Y == nil {\n\t\treturn false\n\t}\n\trBytes := new(big.Int).SetBytes(signature[0:32])\n\tsBytes := new(big.Int).SetBytes(signature[32:64])\n\treturn ecdsa.Verify(publicKey, hash[:], rBytes, sBytes)\n}", "title": "" }, { "docid": "e3ab82550643a70a964eb3f219f02058", "score": "0.56066287", "text": "func (s signatureHeader) validateSignatureHeader(b64 bool) error {\n\tdumpJSON(s)\n\n\tif s.Type != \"\" { // Optional must be \"JOSE\" if present\n\t\tif s.Type != \"JOSE\" {\n\t\t\treturn errInvalidSignatureClaim(\"typ\", s.Type, \"must equal 'JOSE' if present\")\n\t\t}\n\t}\n\n\tif s.Alg != \"PS256\" { // Mandatory must be \"PS256\"\n\t\treturn errInvalidSignatureClaim(\"alg\", s.Alg, \"PS256\")\n\t}\n\n\tif s.Kid == \"\" { // Mandatory - must be present\n\t\treturn fmt.Errorf(\"%w: kid claim MUST be present\", ErrInvalidSignatureHeader)\n\t}\n\n\tif s.Ctype != \"\" { // Optional - if present must be json or application/json\n\t\tif s.Ctype != \"json\" && s.Ctype != \"application/json\" {\n\t\t\treturn errInvalidSignatureClaim(\"cty\", s.Ctype, \"'json' or 'application/json'\")\n\t\t}\n\t}\n\n\tif b64 { // version 3.1.4 and newer\n\t\tif s.B64 != nil {\n\t\t\treturn fmt.Errorf(\"%w: b64 claim is set - must not be present for v3.1.4 and newer APIs\", ErrInvalidSignatureHeader)\n\t\t}\n\t\tif len(s.Critical) != 3 {\n\t\t\treturn errInvalidSignatureClaim(\"crit\", s.Critical, \"must contain 3 elements for v3.1.4 and newer APIs\")\n\t\t}\n\n\t\trequiredElements := []string{\"http://openbanking.org.uk/iss\", \"http://openbanking.org.uk/iat\", \"http://openbanking.org.uk/tan\"}\n\t\tif !containsAllElements(s.Critical, requiredElements) {\n\t\t\treturn errInvalidSignatureClaim(\"crit\", s.Critical, requiredElements)\n\t\t}\n\n\t} else { // version 3.1.3 and older\n\t\tif s.B64 == nil {\n\t\t\treturn fmt.Errorf(\"%w: b64 claim is not set - must be present for v3.1.3 and older APIs\", ErrInvalidSignatureHeader)\n\t\t}\n\t\tif *s.B64 == true {\n\t\t\treturn errInvalidSignatureClaim(\"b64\", *s.B64, \"value must be false for v3.1.3 and older APIs\")\n\t\t}\n\t\tif len(s.Critical) != 4 {\n\t\t\treturn errInvalidSignatureClaim(\"crit\", s.Critical, \"must contain 4 elements for v3.1.3 and older APIs\")\n\t\t}\n\n\t\trequiredElements := []string{\"http://openbanking.org.uk/iss\", \"http://openbanking.org.uk/iat\", \"http://openbanking.org.uk/tan\", \"b64\"}\n\t\tif !containsAllElements(s.Critical, requiredElements) {\n\t\t\treturn errInvalidSignatureClaim(\"crit\", s.Critical, requiredElements)\n\t\t}\n\t}\n\n\tif s.IssuedAt == decimal.Zero {\n\t\treturn errInvalidSignatureClaim(\"http://openbanking.org.uk/iat\", s.IssuedAt.String(), \"a JSON number representing time\")\n\t}\n\tif s.TrustAnchor != \"openbanking.org.uk\" && !isHSBCTrustAnchor(s.TrustAnchor) { // allow trust anchors from OBIE HSBC\n\t\treturn errInvalidSignatureClaim(\"http://openbanking.org.uk/tan\", s.TrustAnchor, \"openbanking.org.uk or ASPSP specific value\")\n\t}\n\n\tif len(s.Issuer) == 0 {\n\t\treturn errInvalidSignatureClaim(\"http://openbanking.org.uk/iss\", s.Issuer, \"non empty value\")\n\t}\n\n\tif s.TrustAnchor == \"openbanking.org.uk\" { // only check when trust anchor is OBIE\n\t\tif !checkSignatureIssuerASPSP(s.Issuer) {\n\t\t\treturn errInvalidSignatureClaim(\"http://openbanking.org.uk/iss\", s.Issuer, \"only the ORG-ID\")\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "00bc5a100ca5611d2405ae8a23285ae4", "score": "0.5573559", "text": "func VerifySignature(data []byte, signature string) (result bool, err error) {\n\treturn pgpBackend.VerifySignature(ctx, data, signature)\n}", "title": "" }, { "docid": "947e1596bf3997255a6cc09841c7f34e", "score": "0.5563825", "text": "func checkSignature() signedCertificationValidator {\n\treturn signedCertificationValidatorFunc(func(_ appcontext.AppContext, newSignedCertification models.SignedCertification, originalSignedCertification *models.SignedCertification) error {\n\t\tverrs := validate.NewErrors()\n\n\t\tif newSignedCertification.Signature == \"\" {\n\t\t\tverrs.Add(\"Signature\", \"Signature is required\")\n\t\t}\n\n\t\treturn verrs\n\t})\n}", "title": "" }, { "docid": "503d2627a2169768bfae5b6ef7980d2a", "score": "0.5562103", "text": "func (ut *walletVerificationPayload) Validate() (err error) {\n\tif ut.UserID == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`request`, \"userId\"))\n\t}\n\tif ut.TaskID == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`request`, \"taskId\"))\n\t}\n\tif ut.Address == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`request`, \"address\"))\n\t}\n\tif ut.Message == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`request`, \"message\"))\n\t}\n\tif ut.Signature == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`request`, \"signature\"))\n\t}\n\tif ut.Version == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`request`, \"version\"))\n\t}\n\tif ut.TaskID != nil {\n\t\tif ok := goa.ValidatePattern(`^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$`, *ut.TaskID); !ok {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidPatternError(`request.taskId`, *ut.TaskID, `^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$`))\n\t\t}\n\t}\n\tif ut.UserID != nil {\n\t\tif ok := goa.ValidatePattern(`^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$`, *ut.UserID); !ok {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidPatternError(`request.userId`, *ut.UserID, `^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$`))\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "cccc10272fd998aeb2c0ea039e541765", "score": "0.5559227", "text": "func (ut *WalletVerificationPayload) Validate() (err error) {\n\tif ut.UserID == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`type`, \"userId\"))\n\t}\n\tif ut.TaskID == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`type`, \"taskId\"))\n\t}\n\tif ut.Address == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`type`, \"address\"))\n\t}\n\tif ut.Message == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`type`, \"message\"))\n\t}\n\tif ut.Signature == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`type`, \"signature\"))\n\t}\n\tif ut.Version == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`type`, \"version\"))\n\t}\n\tif ok := goa.ValidatePattern(`^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$`, ut.TaskID); !ok {\n\t\terr = goa.MergeErrors(err, goa.InvalidPatternError(`type.taskId`, ut.TaskID, `^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$`))\n\t}\n\tif ok := goa.ValidatePattern(`^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$`, ut.UserID); !ok {\n\t\terr = goa.MergeErrors(err, goa.InvalidPatternError(`type.userId`, ut.UserID, `^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$`))\n\t}\n\treturn\n}", "title": "" }, { "docid": "bc724bf849f86cd126490d6dae4b2fdb", "score": "0.55503863", "text": "func TestValidatePayload(t *testing.T) {\n\tvar testcases = []struct {\n\t\tpayload string\n\t\tsig string\n\t\ttokenGenerator func() []byte\n\t\tvalid bool\n\t}{\n\t\t{\n\t\t\t\"{}\",\n\t\t\t\"sha1=db5c76f4264d0ad96cf21baec394964b4b8ce580\",\n\t\t\tdefaultTokenGenerator,\n\t\t\ttrue,\n\t\t},\n\t\t{\n\t\t\t\"{}\",\n\t\t\t\"db5c76f4264d0ad96cf21baec394964b4b8ce580\",\n\t\t\tdefaultTokenGenerator,\n\t\t\tfalse,\n\t\t},\n\t\t{\n\t\t\t\"{}\",\n\t\t\t\"\",\n\t\t\tdefaultTokenGenerator,\n\t\t\tfalse,\n\t\t},\n\t\t{\n\t\t\t\"{}\",\n\t\t\t\"\",\n\t\t\tdefaultTokenGenerator,\n\t\t\tfalse,\n\t\t},\n\t}\n\tfor _, tc := range testcases {\n\t\tif ValidatePayload([]byte(tc.payload), tc.sig, tc.tokenGenerator) != tc.valid {\n\t\t\tt.Errorf(\"Wrong validation for %+v\", tc)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9fd109ff927affbf93b9aa45e53fe589", "score": "0.5541221", "text": "func (p PublicKey) SignatureValid(data []byte, signature Signature) bool {\n\treturn bdn.Verify(blsSuite, p.Point, data, signature.Bytes()) == nil\n}", "title": "" }, { "docid": "52cb234c81c47ee2d97cab3a5d5b03db", "score": "0.5540003", "text": "func VerifySignature(data sodium.Bytes, signature sodium.Signature, signing_key sodium.SignPublicKey) bool {\n\tvar verified = false\n\terr := data.SignVerifyDetached(signature, signing_key)\n\tif err == nil {\n\t\tverified = true\n\t}\n\treturn verified\n}", "title": "" }, { "docid": "e20dc34e7ea08d8bef72496bb0dc2224", "score": "0.5528392", "text": "func ValidatePublicKey(token string) error {\n\tparts := strings.Split(token, \".\") \n\tif len(parts) != 3 {\n\t\treturn fmt.Errorf(\"token contains an invalid number of segments\")\n\t}\n\t// HEADER\n\th, err := Base64Decode(parts[0])\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Unable to decode base64url encoded header\")\n\t}\n\t// Validate JWT header\n\tvar header map[string]interface{}\n\tif err = json.Unmarshal([]byte(h), &header); err != nil {\n\t\treturn fmt.Errorf(\"JSON error - Unable to unmarshal JWT header\")\n\t}\t\n\t// Validate header\n\talg := header[\"alg\"].(string)\n\tif alg != \"ES256\" {\n\t\treturn fmt.Errorf(\"Algorithm not ES256. Failed authorization (%s)\", alg)\n\t}\n\t// CLAIMS\n\t// Get JWT claims\n\tclaimsStr, err := Base64Decode(parts[1])\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Unable to decode base64url encoded claims\")\n\t}\n\tvar claims map[string]interface{}\n\tif err = json.Unmarshal([]byte(claimsStr), &claims); err != nil {\n\t\treturn fmt.Errorf(\"JSON error - Unable to unmarshal JWT claims\")\n\t}\n\n\t// First, validate exp time\n\t// https://golang.org/pkg/encoding/json/#Unmarshal states that\n\t// JSON numbers are stored as float64 when unmarshaling JSON to an interface\n\tif _, ok := claims[\"exp\"]; ok {\n\t\texp := claims[\"exp\"].(float64)\n\t\tif int64(exp) < time.Now().Unix() {\n\t\t\treturn fmt.Errorf(\"JWT expired\")\n\t\t} // else continue with scopes validation\n\t} else {\n\t\treturn fmt.Errorf(\"unable to verify if claims has \\\"exp\\\" field\")\n\t}\n\t\n\t// Now, get the public key and verify signature\n\tif _, ok := claims[\"app_key\"]; !ok {\n\t\treturn fmt.Errorf(\"unable to verify if claims has \\\"app_key\\\"\")\n\t}\n\t\n\t// check if public ID is cached\n\tappKey := claims[\"app_key\"].(string)\n\tvar pk string\n\tmtx.RLock()\n\tif _, ok := publicKeys[appKey]; ok {\n\t\tpk = publicKeys[appKey]\n\t}\n\tmtx.RUnlock()\t\n\tif len(pk) == 0 {\n\t\tpublicKeyURI := x5u + \"/\" + claims[\"app_key\"].(string) + \".pub\"\n\t\t// Get the data\n\t\tresp, err := http.Get(publicKeyURI)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer resp.Body.Close()\n\t\t// Writer the body to buffer\n\t\tpubKeyByte, err := ioutil.ReadAll(resp.Body)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tpk = string(pubKeyByte[:])\n\t\tmtx.Lock()\n\t\tpublicKeys[appKey] = pk\n\t\tmtx.Unlock()\n\t}\n\t// else public key is cached \n\t\t\n\tdecodedPEM, _ := pem.Decode([]byte(pk))\n\tif decodedPEM == nil {\n\t\treturn fmt.Errorf(\"no PEM data is found\")\n\t}\n\tpub, err := x509.ParsePKIXPublicKey(decodedPEM.Bytes)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to parse DER encoded public key\")\n\t}\n\tecdsaPub, ok := pub.(*ecdsa.PublicKey)\n\tif !ok { \n\t\treturn fmt.Errorf(\"Value returned from ParsePKIXPublicKey is not an ECDSA public key\")\n\t}\n\treturn verifyEC(token, ecdsaPub)\n}", "title": "" }, { "docid": "e36da352650a5faf3c706ba1bdd1073f", "score": "0.55262935", "text": "func (s *PuppetSecurity) VerifySignatureBytes(dat []byte, sig []byte, public ...[]byte) (should bool, signer string) {\n\treturn s.fsec.VerifySignatureBytes(dat, sig, public...)\n}", "title": "" }, { "docid": "b64871502d98f454fff6856fe960eb8a", "score": "0.55202746", "text": "func (v pgpVerifierImpl) verifyPgp(signature, publicKey []byte) ([]byte, error) {\n\tkeyring, err := openpgp.ReadArmoredKeyRing(bytes.NewReader(publicKey))\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"error reading armored key ring\")\n\t}\n\n\tarmorBlock, err := armor.Decode(bytes.NewReader(signature))\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"error decoding armored signature\")\n\t}\n\n\tmessageDetails, err := openpgp.ReadMessage(armorBlock.Body, keyring, nil, nil)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"error reading armor signature\")\n\t}\n\n\t// MessageDetails.UnverifiedBody signature is not verified until we read it.\n\t// This will call PublicKey.VerifySignature for the keys in the keyring.\n\tpayload, err := ioutil.ReadAll(messageDetails.UnverifiedBody)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"could not verify armor signature\")\n\t}\n\n\t// Make sure after reading the UnverifiedBody above, there is no signature error.\n\tif messageDetails.SignatureError != nil {\n\t\treturn nil, errors.Wrap(messageDetails.SignatureError, \"bad signature found\")\n\t}\n\tif messageDetails.Signature == nil {\n\t\treturn nil, errors.New(\"no signature found for given key\")\n\t}\n\treturn payload, nil\n}", "title": "" }, { "docid": "fde7c9e3f9b92fb801c1dee9e6ec00ec", "score": "0.5517993", "text": "func (service *ModelService) verifySignature(request *AuthorizationDetails) error {\n\treturn utils.VerifySigner(service.getMessageBytes(request.Message, request),\n\t\trequest.GetSignature(), utils.ToChecksumAddress(request.SignerAddress))\n}", "title": "" }, { "docid": "bc95bd4857626a0549fdc5cd1b87e940", "score": "0.5513916", "text": "func (s *StdSignature) Validate() error {\n\tseq := s.GetSequence()\n\tif seq < 0 {\n\t\treturn errors.Wrap(ErrInvalidSequence, \"negative\")\n\t}\n\tif s.Pubkey == nil {\n\t\treturn errors.Wrap(errors.ErrUnauthorized, \"missing public key\")\n\t}\n\tif s.Signature == nil {\n\t\treturn errors.Wrap(errors.ErrUnauthorized, \"missing signature\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "22cf4a3355f7b6cff92d7daab149c6a3", "score": "0.55074245", "text": "func (this *RecordJson) CheckSignature() bool {\n\tvar pub *crypto.PublicIdentity\n\tvar sig *crypto.Signature\n\terr := transfer.DecodeString(this.PublicKey, &pub)\n\tif err != nil {\n\t\tfmt.Printf(\"Error: CheckSignature failed to decode PublicKey: %s\\n\", this.PublicKey)\n\t\treturn false\n\t}\n\terr = transfer.DecodeString(this.Signature, &sig)\n\tif err != nil {\n\t\tfmt.Printf(\"Error: CheckSignature failed to decode Signature: %s\\n\", this.Signature)\n\t\treturn false\n\t}\n\tfp := pub.Fingerprint().String()\n\tif fp != this.Fingerprint {\n\t\tfmt.Printf(\"Error: CheckSignature fingerprint mismatch: %s\\n\", this.Fingerprint)\n\t\treturn false\n\t}\n\tdigest := crypto.HashOf(this.Version, this.Host, this.Port)\n\tif !pub.Verify(digest, sig) {\n\t\tfmt.Printf(\"Error: CheckSignature failed to verify signature\\n\")\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "04bee7fe32c83ab9bfde4dfeb10cb05e", "score": "0.5503487", "text": "func VerifySignature(message []byte, signatureBytes []byte,\n\tpublicKeyBytes []byte) (bool, error) {\n\tsignature, err := schnorr.ParseSignature(signatureBytes)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tpublicKey, err := secp256k1.ParsePubKey(publicKeyBytes)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\treturn schnorr.Verify(publicKey, chainhash.HashB(message), signature.R, signature.S), nil\n}", "title": "" }, { "docid": "5fcb1e6c8ba89bed45435354b3ddcee6", "score": "0.54795873", "text": "func (p *signer) CheckSignature(req *http.Request) (hasSignature, validSignature bool, err error) {\n qstring, err := url.ParseQuery(req.URL.RawQuery)\n if err != nil {\n err = ErrorInvalidURI\n return\n }\n if qstring.Get(\"Signature\") == \"\" || qstring.Get(\"DSOCAccessKeyId\") == \"\" {\n return\n }\n hasSignature = true\n now := time.Now().Unix()\n if expiresStr := qstring.Get(\"Expires\"); expiresStr != \"\" {\n expiresAt, _ := strconv.ParseInt(expiresStr, 10, 64)\n if expiresAt < now {\n err = ErrorRequestExpired\n return\n }\n } else if timestampStr := qstring.Get(\"Timestamp\"); timestampStr != \"\" {\n timestamp, _ := time.Parse(dm.UTC_DATETIME_FORMAT, timestampStr)\n if timestamp.IsZero() || timestamp.Unix()-MAX_VALID_TIMESTAMP_IN_SECONDS > now || timestamp.Unix()+MAX_VALID_TIMESTAMP_IN_SECONDS < now {\n err = ErrorTimestampTooOld\n return\n }\n } else {\n err = ErrorExpiresOrTimestampRequired\n return\n }\n if qstring.Get(\"SignatureVersion\") != \"\" && qstring.Get(\"SignatureVersion\") != DEFAULT_SIGNATURE_VERSION {\n err = ErrorInvalidSignatureVersion\n return\n }\n var h crypto.Hash\n signatureMethod := qstring.Get(\"SignatureMethod\")\n if signatureMethod == \"\" {\n signatureMethod = DEFAULT_SIGNATURE_METHOD\n }\n switch signatureMethod {\n case SIGNATURE_METHOD_HMAC_SHA256:\n h = crypto.SHA256\n case SIGNATURE_METHOD_HMAC_SHA1:\n h = crypto.SHA1\n default:\n err = ErrorInvalidSignatureMethod\n return\n }\n originalSignature := qstring.Get(\"Signature\")\n delete(qstring, \"Signature\")\n qstring[\"DSOCAccessKeyId\"] = []string{p.accessKey}\n\n var signature []byte\n req.URL.RawQuery = qstring.Encode()\n canonicalizedStringToSign, err := p.Canonicalize(req)\n if err != nil {\n return\n }\n //log.Printf(\"String-to-sign: '%s'\", canonicalizedStringToSign)\n\n signature, err = p.SignEncoded(h, canonicalizedStringToSign, base64.StdEncoding)\n if err != nil || string(signature) != originalSignature {\n err = ErrorSignatureDoesNotMatch\n } else {\n validSignature = true\n }\n return\n}", "title": "" }, { "docid": "3bef8e5bf84643dc9b3f3615af45c522", "score": "0.5473619", "text": "func validateSchnorrSignature(sig []byte) bool {\n\t_, err := schnorr.ParseSignature(sig)\n\treturn err == nil\n}", "title": "" }, { "docid": "3859f618480a89956dd46792d990d265", "score": "0.54456145", "text": "func (s *Specification) VerifySignature(key ed25519.PublicKey) (bool, error) {\n\tsig, err := hex.DecodeString(s.Signature)\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"invalid signature data: %w\", err)\n\t}\n\n\treturn iu.Ed25519Verify(key, []byte(s.Plugins), sig)\n}", "title": "" }, { "docid": "49078760118d12c766c55b8acf8f086a", "score": "0.54341584", "text": "func doesSignatureMatch(hashedPayload string, r *http.Request, region string, stype serviceType) APIErrorCode {\n\t// Copy request.\n\treq := *r\n\n\t// Save authorization header.\n\tv4Auth := req.Header.Get(xhttp.Authorization)\n\n\t// Parse signature version '4' header.\n\tsignV4Values, err := parseSignV4(v4Auth, region, stype)\n\tif err != ErrNone {\n\t\treturn err\n\t}\n\n\t// Extract all the signed headers along with its values.\n\textractedSignedHeaders, errCode := extractSignedHeaders(signV4Values.SignedHeaders, r)\n\tif errCode != ErrNone {\n\t\treturn errCode\n\t}\n\n\tcred, _, s3Err := checkKeyValid(signV4Values.Credential.accessKey)\n\tif s3Err != ErrNone {\n\t\treturn s3Err\n\t}\n\n\t// Extract date, if not present throw error.\n\tvar date string\n\tif date = req.Header.Get(xhttp.AmzDate); date == \"\" {\n\t\tif date = r.Header.Get(xhttp.Date); date == \"\" {\n\t\t\treturn ErrMissingDateHeader\n\t\t}\n\t}\n\n\t// Parse date header.\n\tt, e := time.Parse(iso8601Format, date)\n\tif e != nil {\n\t\treturn ErrMalformedDate\n\t}\n\n\t// Query string.\n\tqueryStr := req.URL.Query().Encode()\n\n\t// Get canonical request.\n\tcanonicalRequest := getCanonicalRequest(extractedSignedHeaders, hashedPayload, queryStr, req.URL.Path, req.Method)\n\n\t// Get string to sign from canonical request.\n\tstringToSign := getStringToSign(canonicalRequest, t, signV4Values.Credential.getScope())\n\n\t// Get hmac signing key.\n\tsigningKey := getSigningKey(cred.SecretKey, signV4Values.Credential.scope.date,\n\t\tsignV4Values.Credential.scope.region, stype)\n\n\t// Calculate signature.\n\tnewSignature := getSignature(signingKey, stringToSign)\n\n\t// Verify if signature match.\n\tif !compareSignatureV4(newSignature, signV4Values.Signature) {\n\t\treturn ErrSignatureDoesNotMatch\n\t}\n\n\t// Return error none.\n\treturn ErrNone\n}", "title": "" }, { "docid": "2eefb640f5a0dc49a125534dd1614c13", "score": "0.54223895", "text": "func VerifySignatureWithPublicKey(publicKey []byte, signature []byte, data []byte) (bool, error) {\n\tsigPublicKey, err := crypto.Ecrecover(signHash(data), signature)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tif isPublicKey64(publicKey) {\n\t\tpublicKey = append([]byte{0x04}, publicKey...)\n\t} else if !isPublicKey65(publicKey) {\n\t\treturn false, errors.New(\"invalid public key\")\n\t}\n\tmatches := bytes.Equal(sigPublicKey, publicKey)\n\treturn matches, nil\n}", "title": "" }, { "docid": "bfde624450a9a2d2be872e758f47c75e", "score": "0.5416354", "text": "func (s *Scanner) isValidSignature(sig []byte) bool {\n\treturn bytes.Equal(sig, []byte{'P', 'A', 'C', 'K'})\n}", "title": "" }, { "docid": "a60e89951fa0523d6e485f6ff1ffb363", "score": "0.5405789", "text": "func (pubKey *PubKey) VerifySignature(msg, sigStr []byte) bool {\n\treturn secp256k1.VerifySignature(pubKey.Bytes(), crypto.Sha256(msg), sigStr)\n}", "title": "" }, { "docid": "5b19c8ce7fe6772ad8bc5c679c58680d", "score": "0.5390886", "text": "func (k Keeper) handleValidatorSignature(ctx sdk.Context, pubkey crypto.PubKey, power int64, signed bool) {\n\tlogger := ctx.Logger().With(\"module\", \"x/slashing\")\n\theight := ctx.BlockHeight()\n\taddress := sdk.ValAddress(pubkey.Address())\n\n\t// Local index, so counts blocks validator *should* have signed\n\t// Will use the 0-value default signing info if not present, except for start height\n\tsignInfo, found := k.getValidatorSigningInfo(ctx, address)\n\tif !found {\n\t\t// If this validator has never been seen before, construct a new SigningInfo with the correct start height\n\t\tsignInfo = NewValidatorSigningInfo(height, 0, 0, 0)\n\t}\n\tindex := signInfo.IndexOffset % k.SignedBlocksWindow(ctx)\n\tsignInfo.IndexOffset++\n\n\t// Update signed block bit array & counter\n\t// This counter just tracks the sum of the bit array\n\t// That way we avoid needing to read/write the whole array each time\n\tprevious := k.getValidatorSigningBitArray(ctx, address, index)\n\tif previous == signed {\n\t\t// Array value at this index has not changed, no need to update counter\n\t} else if previous && !signed {\n\t\t// Array value has changed from signed to unsigned, decrement counter\n\t\tk.setValidatorSigningBitArray(ctx, address, index, false)\n\t\tsignInfo.SignedBlocksCounter--\n\t} else if !previous && signed {\n\t\t// Array value has changed from unsigned to signed, increment counter\n\t\tk.setValidatorSigningBitArray(ctx, address, index, true)\n\t\tsignInfo.SignedBlocksCounter++\n\t}\n\n\tif !signed {\n\t\tlogger.Info(fmt.Sprintf(\"Absent validator %s at height %d, %d signed, threshold %d\", pubkey.Address(), height, signInfo.SignedBlocksCounter, k.MinSignedPerWindow(ctx)))\n\t}\n\tminHeight := signInfo.StartHeight + k.SignedBlocksWindow(ctx)\n\tif height > minHeight && signInfo.SignedBlocksCounter < k.MinSignedPerWindow(ctx) {\n\t\t// Downtime confirmed, slash, revoke, and jail the validator\n\t\tlogger.Info(fmt.Sprintf(\"Validator %s past min height of %d and below signed blocks threshold of %d\", pubkey.Address(), minHeight, k.MinSignedPerWindow(ctx)))\n\t\tk.validatorSet.Slash(ctx, pubkey, height, power, k.SlashFractionDowntime(ctx))\n\t\tk.validatorSet.Revoke(ctx, pubkey)\n\t\tsignInfo.JailedUntil = ctx.BlockHeader().Time + k.DowntimeUnbondDuration(ctx)\n\t}\n\n\t// Set the updated signing info\n\tk.setValidatorSigningInfo(ctx, address, signInfo)\n}", "title": "" }, { "docid": "97b1c72713df0237a4a71bc80e851e40", "score": "0.53905797", "text": "func VerifySignature(msg []byte, sig wallet.Sig, a wallet.Address) (bool, error) {\n\thash := PrefixedHash(msg)\n\tsigCopy := make([]byte, SigLen)\n\tcopy(sigCopy, sig)\n\tif len(sigCopy) == SigLen && (sigCopy[SigLen-1] >= 27) {\n\t\tsigCopy[SigLen-1] -= 27\n\t}\n\tpk, err := crypto.SigToPub(hash, sigCopy)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\taddr := crypto.PubkeyToAddress(*pk)\n\treturn a.Equals((*Address)(&addr)), nil\n}", "title": "" }, { "docid": "637f9523844b2b0a3c8083bdb8ab6b78", "score": "0.53832036", "text": "func ValidSignature(redirectURI, sigVal, timestamp, secret string) bool {\n\tif redirectURI == \"\" || sigVal == \"\" || timestamp == \"\" || secret == \"\" {\n\t\treturn false\n\t}\n\t_, err := urlutil.ParseAndValidateURL(redirectURI)\n\tif err != nil {\n\t\treturn false\n\t}\n\trequestSig, err := base64.URLEncoding.DecodeString(sigVal)\n\tif err != nil {\n\t\treturn false\n\t}\n\ti, err := strconv.ParseInt(timestamp, 10, 64)\n\tif err != nil {\n\t\treturn false\n\t}\n\ttm := time.Unix(i, 0)\n\tttl := 5 * time.Minute\n\tif time.Since(tm) > ttl {\n\t\treturn false\n\t}\n\tlocalSig := redirectURLSignature(redirectURI, tm, secret)\n\n\treturn hmac.Equal(requestSig, localSig)\n}", "title": "" }, { "docid": "20809330763627105a4cfab5ed482766", "score": "0.5364479", "text": "func ValidateSignatureHeader(token string, b64 bool) error {\n\tvar tokenHeader signatureHeader\n\n\tsegments := strings.Split(token, \".\")\n\tdecodedPayload, _ := base64.RawURLEncoding.DecodeString(segments[0])\n\n\tlogrus.Trace(string(decodedPayload))\n\n\terr := json.Unmarshal(decodedPayload, &tokenHeader)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"ValidateSignatureHeader: cannot convert header into JSON: \" + err.Error())\n\t}\n\n\tdumpJSON(tokenHeader)\n\n\terr = tokenHeader.validateSignatureHeader(b64) // validate header depent on b64 setting for api true=3.1.4, false=3.1.3\n\n\treturn err\n}", "title": "" }, { "docid": "096319c73bef17e9e97aee88a7e155bb", "score": "0.5353709", "text": "func validatePayload(next http.HandlerFunc, payload PayloadValidation) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// To understand better http.Handler wrapper: https://medium.com/@matryer/the-http-handler-wrapper-technique-in-golang-updated-bc7fbcffa702\n\n\t\t// the Decode method will look at the JSON tag directly, in that way we avoid marshalling\n\t\t// Basically this can be read as: a request handler is received. So, we create a new enconder (which is the body sent)\n\t\t// and decode it using the payload struct, which as JSON tags\n\t\terr := json.NewDecoder(r.Body).Decode(&payload)\n\n\t\tif err != nil {\n\t\t\tbadRequestResponse(w, err)\n\t\t\treturn\n\t\t}\n\t\t// only if we dont receive an error (i.e, the whole function must be executed), we want to close the body\n\t\tdefer r.Body.Close()\n\n\t\t// In case the pauload is NOT valid send a response error\n\t\tif isValid, errs := payload.IsValid(); !isValid {\n\t\t\tjsonResponse(w, errs, http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\t// context\n\n\t\t//A way to think about context package in go is that it allows you to pass values without being a global variable\n\t\t// is very common to see code where middleware are added to HTTP pipeline and the results are added to the http.Request,\n\t\t// like we do here. https://blog.golang.org/context\n\n\t\tctx := context.WithValue(r.Context(), \"payload\", payload)\n\n\t\t// we serve the payload to the HTTP pipeline only if isValid is true\n\t\t// serveHTTP calls next(w,r)\n\t\tnext.ServeHTTP(w, r.WithContext(ctx))\n\n\t}\n}", "title": "" }, { "docid": "23498075e0d2f15c6541bd4d8de5cb68", "score": "0.5346004", "text": "func (ctx symmetricMac) verifyPayload(payload []byte, mac []byte, alg SignatureAlgorithm) error {\r\n\texpected, err := ctx.hmac(payload, alg)\r\n\tif err != nil {\r\n\t\treturn errors.New(\"square/go-jose: failed to compute hmac\")\r\n\t}\r\n\r\n\tif len(mac) != len(expected) {\r\n\t\treturn errors.New(\"square/go-jose: invalid hmac\")\r\n\t}\r\n\r\n\tmatch := subtle.ConstantTimeCompare(mac, expected)\r\n\tif match != 1 {\r\n\t\treturn errors.New(\"square/go-jose: invalid hmac\")\r\n\t}\r\n\r\n\treturn nil\r\n}", "title": "" }, { "docid": "877c37a330a4b659d55ac3f73212c705", "score": "0.53451204", "text": "func doesPresignedSignatureMatch(hashedPayload string, r *http.Request, region string, stype serviceType) APIErrorCode {\n\t// Copy request\n\treq := *r\n\n\t// Parse request query string.\n\tpSignValues, err := parsePreSignV4(req.URL.Query(), region, stype)\n\tif err != ErrNone {\n\t\treturn err\n\t}\n\n\tcred, _, s3Err := checkKeyValid(pSignValues.Credential.accessKey)\n\tif s3Err != ErrNone {\n\t\treturn s3Err\n\t}\n\n\t// Extract all the signed headers along with its values.\n\textractedSignedHeaders, errCode := extractSignedHeaders(pSignValues.SignedHeaders, r)\n\tif errCode != ErrNone {\n\t\treturn errCode\n\t}\n\n\t// Construct new query.\n\tquery := make(url.Values)\n\tif req.URL.Query().Get(xhttp.AmzContentSha256) != \"\" {\n\t\tquery.Set(xhttp.AmzContentSha256, hashedPayload)\n\t}\n\n\tquery.Set(xhttp.AmzAlgorithm, signV4Algorithm)\n\n\t// If the host which signed the request is slightly ahead in time (by less than globalMaxSkewTime) the\n\t// request should still be allowed.\n\tif pSignValues.Date.After(UTCNow().Add(globalMaxSkewTime)) {\n\t\treturn ErrRequestNotReadyYet\n\t}\n\n\tif UTCNow().Sub(pSignValues.Date) > pSignValues.Expires {\n\t\treturn ErrExpiredPresignRequest\n\t}\n\n\t// Save the date and expires.\n\tt := pSignValues.Date\n\texpireSeconds := int(pSignValues.Expires / time.Second)\n\n\t// Construct the query.\n\tquery.Set(xhttp.AmzDate, t.Format(iso8601Format))\n\tquery.Set(xhttp.AmzExpires, strconv.Itoa(expireSeconds))\n\tquery.Set(xhttp.AmzSignedHeaders, getSignedHeaders(extractedSignedHeaders))\n\tquery.Set(xhttp.AmzCredential, cred.AccessKey+SlashSeparator+pSignValues.Credential.getScope())\n\n\t// Save other headers available in the request parameters.\n\tfor k, v := range req.URL.Query() {\n\t\tkey := strings.ToLower(k)\n\n\t\t// Handle the metadata in presigned put query string\n\t\tif strings.Contains(key, \"x-amz-meta-\") {\n\t\t\tquery.Set(k, v[0])\n\t\t\tcontinue\n\t\t}\n\n\t\tif strings.Contains(key, \"x-amz-server-side-\") {\n\t\t\tquery.Set(k, v[0])\n\t\t}\n\n\t\tif strings.HasPrefix(key, \"x-amz\") {\n\t\t\tcontinue\n\t\t}\n\t\tquery[k] = v\n\t}\n\n\t// Get the encoded query.\n\tencodedQuery := query.Encode()\n\n\t// Verify if date query is same.\n\tif req.URL.Query().Get(xhttp.AmzDate) != query.Get(xhttp.AmzDate) {\n\t\treturn ErrSignatureDoesNotMatch\n\t}\n\t// Verify if expires query is same.\n\tif req.URL.Query().Get(xhttp.AmzExpires) != query.Get(xhttp.AmzExpires) {\n\t\treturn ErrSignatureDoesNotMatch\n\t}\n\t// Verify if signed headers query is same.\n\tif req.URL.Query().Get(xhttp.AmzSignedHeaders) != query.Get(xhttp.AmzSignedHeaders) {\n\t\treturn ErrSignatureDoesNotMatch\n\t}\n\t// Verify if credential query is same.\n\tif req.URL.Query().Get(xhttp.AmzCredential) != query.Get(xhttp.AmzCredential) {\n\t\treturn ErrSignatureDoesNotMatch\n\t}\n\t// Verify if sha256 payload query is same.\n\tif req.URL.Query().Get(xhttp.AmzContentSha256) != \"\" {\n\t\tif req.URL.Query().Get(xhttp.AmzContentSha256) != query.Get(xhttp.AmzContentSha256) {\n\t\t\treturn ErrContentSHA256Mismatch\n\t\t}\n\t}\n\n\t/// Verify finally if signature is same.\n\n\t// Get canonical request.\n\tpresignedCanonicalReq := getCanonicalRequest(extractedSignedHeaders, hashedPayload, encodedQuery, req.URL.Path, req.Method)\n\n\t// Get string to sign from canonical request.\n\tpresignedStringToSign := getStringToSign(presignedCanonicalReq, t, pSignValues.Credential.getScope())\n\n\t// Get hmac presigned signing key.\n\tpresignedSigningKey := getSigningKey(cred.SecretKey, pSignValues.Credential.scope.date,\n\t\tpSignValues.Credential.scope.region, stype)\n\n\t// Get new signature.\n\tnewSignature := getSignature(presignedSigningKey, presignedStringToSign)\n\n\t// Verify signature.\n\tif !compareSignatureV4(req.URL.Query().Get(xhttp.AmzSignature), newSignature) {\n\t\treturn ErrSignatureDoesNotMatch\n\t}\n\treturn ErrNone\n}", "title": "" }, { "docid": "cbc7a595eec2bdb48bff61e2d83beb92", "score": "0.5341705", "text": "func (s SignatureVerifier) VerifySignature(data []byte, sig tls.DigitallySigned) error {\n\treturn tls.VerifySignature(s.PubKey, data, sig)\n}", "title": "" }, { "docid": "05e540989082d0067f590648e088837c", "score": "0.5328988", "text": "func verify(signed string, signature []byte, key *rsa.PublicKey) (isValid bool) {\n\thasher := sha256.New()\n\thasher.Write([]byte(signed))\n\n\terr := rsa.VerifyPKCS1v15(key, crypto.SHA256, hasher.Sum(nil), signature)\n\tif err != nil {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "e75b3a23a49987fbb9a49364da9b4546", "score": "0.5318451", "text": "func (c Client) VerifySignature(signature string, body []byte) error {\n\tsecret := []byte(\"testsecret\")\n\n\thash := hmac.New(sha256.New, secret)\n\thash.Write(body)\n\tgeneratedSignature := hex.EncodeToString(hash.Sum(nil))\n\n\tif signature == generatedSignature {\n\t\treturn nil\n\t}\n\n\treturn errors.New(\"Signature mismatch\")\n}", "title": "" }, { "docid": "2118e90a28ff9b47b9521cb5ca2c7d10", "score": "0.53174543", "text": "func verifySignature(\n\tpubKeyEntries openpgp.EntityList,\n\torigText io.Reader,\n\tsignature []byte,\n\tverifyTime int64,\n\tverificationContext *VerificationContext,\n) (*packet.Signature, error) {\n\tconfig := &packet.Config{}\n\tif verifyTime == 0 {\n\t\tconfig.Time = func() time.Time {\n\t\t\treturn time.Unix(0, 0)\n\t\t}\n\t} else {\n\t\tconfig.Time = func() time.Time {\n\t\t\treturn time.Unix(verifyTime+internal.CreationTimeOffset, 0)\n\t\t}\n\t}\n\n\tif verificationContext != nil {\n\t\tconfig.KnownNotations = map[string]bool{constants.SignatureContextName: true}\n\t}\n\tsignatureReader := bytes.NewReader(signature)\n\n\tsig, signer, err := openpgp.VerifyDetachedSignatureAndHash(pubKeyEntries, origText, signatureReader, allowedHashes, config)\n\n\tif sig != nil && signer != nil && (errors.Is(err, pgpErrors.ErrSignatureExpired) || errors.Is(err, pgpErrors.ErrKeyExpired)) { //nolint:nestif\n\t\tif verifyTime == 0 { // Expiration check disabled\n\t\t\terr = nil\n\t\t} else {\n\t\t\t// Maybe the creation time offset pushed it over the edge\n\t\t\t// Retry with the actual verification time\n\t\t\tconfig.Time = func() time.Time {\n\t\t\t\treturn time.Unix(verifyTime, 0)\n\t\t\t}\n\n\t\t\tseeker, ok := origText.(io.ReadSeeker)\n\t\t\tif !ok {\n\t\t\t\treturn nil, errors.Wrap(err, \"gopenpgp: message reader do not support seeking, cannot retry signature verification\")\n\t\t\t}\n\n\t\t\t_, err = seeker.Seek(0, io.SeekStart)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, newSignatureFailed(errors.Wrap(err, \"gopenpgp: could not rewind the data reader.\"))\n\t\t\t}\n\n\t\t\t_, err = signatureReader.Seek(0, io.SeekStart)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, newSignatureFailed(err)\n\t\t\t}\n\n\t\t\tsig, signer, err = openpgp.VerifyDetachedSignatureAndHash(pubKeyEntries, seeker, signatureReader, allowedHashes, config)\n\t\t}\n\t}\n\n\tif err != nil {\n\t\treturn nil, newSignatureFailed(err)\n\t}\n\n\tif sig == nil || signer == nil {\n\t\treturn nil, newSignatureFailed(errors.New(\"gopenpgp: no signer or valid signature\"))\n\t}\n\n\tif verificationContext != nil {\n\t\terr := verificationContext.verifyContext(sig)\n\t\tif err != nil {\n\t\t\treturn nil, newSignatureBadContext(err)\n\t\t}\n\t}\n\n\treturn sig, nil\n}", "title": "" }, { "docid": "00d444cfde5f3fb6ac87dce42b8a3bd6", "score": "0.5313043", "text": "func ValidateSignatureLength(keyType string, hashBits int) error {\n\tif keyType == \"any\" || keyType == \"ec\" || keyType == \"ed25519\" || keyType == \"ed448\" {\n\t\t// ed25519 and ed448 include built-in hashing and is not externally\n\t\t// configurable. There are three modes for each of these schemes:\n\t\t//\n\t\t// 1. Built-in hash (default, used in TLS, x509).\n\t\t// 2. Double hash (notably used in some block-chain implementations,\n\t\t// but largely regarded as a specialized use case with security\n\t\t// concerns).\n\t\t// 3. No hash (bring your own hash function, less commonly used).\n\t\t//\n\t\t// In all cases, we won't have a hash algorithm to validate here, so\n\t\t// return nil.\n\t\t//\n\t\t// Additionally, when KeyType is any, we can't yet validate the\n\t\t// signature algorithm size, so it takes the default zero value.\n\t\t//\n\t\t// When KeyType is ec, we also can't validate this value as we're\n\t\t// forcefully ignoring the users' choice and specifying a value based\n\t\t// on issuer type.\n\t\treturn nil\n\t}\n\n\tswitch hashBits {\n\tcase 256:\n\tcase 384:\n\tcase 512:\n\tdefault:\n\t\treturn fmt.Errorf(\"unsupported hash signature algorithm: %d\", hashBits)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "824524e841e0ab2cf6392131de06bcf4", "score": "0.5306234", "text": "func verifyDetailsSignature(md *openpgp.MessageDetails, verifierKey *KeyRing) error {\n\tif !md.IsSigned {\n\t\treturn newSignatureNotSigned()\n\t}\n\tif md.SignedBy == nil ||\n\t\tlen(verifierKey.entities) == 0 ||\n\t\tlen(verifierKey.entities.KeysById(md.SignedByKeyId)) == 0 {\n\t\treturn newSignatureNoVerifier()\n\t}\n\tif md.SignatureError != nil {\n\t\treturn newSignatureFailed()\n\t}\n\tif md.Signature == nil ||\n\t\tmd.Signature.Hash < allowedHashes[0] ||\n\t\tmd.Signature.Hash > allowedHashes[len(allowedHashes)-1] {\n\t\treturn newSignatureInsecure()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "21da7644df6984eb651dd67b943855ed", "score": "0.5302514", "text": "func buildSignature(b64 bool, kid, issuer, trustAnchor, body string, alg jwt.SigningMethod, privKey *rsa.PrivateKey) (string, error) {\n\tvar token jwt.Token\n\n\tif b64 {\n\t\ttoken = GetSignatureToken314Plus(kid, issuer, trustAnchor, alg)\n\t} else {\n\t\ttoken = GetSignatureToken313Minus(kid, issuer, trustAnchor, alg)\n\t}\n\n\ttokenString, err := CreateSignature(&token, privKey, body, b64) // sign the token\n\tif err != nil {\n\t\treturn \"\", errors.New(\"buildSignature: CreateSignature failed \" + err.Error())\n\t}\n\n\tlogrus.Tracef(\"Full Request JWT: %s\", tokenString)\n\n\tdetachedJWS := SplitJWSWithBody(tokenString) // remove the body from the signature string to form the detached signature\n\n\treturn detachedJWS, nil\n}", "title": "" }, { "docid": "34bb3ae6260cb0733071cf2a5b809e59", "score": "0.52934825", "text": "func verifySig(data, sig []byte) error {\n\tel, err := openpgp.ReadArmoredKeyRing(strings.NewReader(hashiPublicKey))\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t_, err = openpgp.CheckDetachedSignature(el, bytes.NewReader(data), bytes.NewReader(sig))\n\treturn err\n}", "title": "" }, { "docid": "6821af9900d604a1fa9db69e82d4388c", "score": "0.5292032", "text": "func VerifySignature(pubkey *ecdsa.PublicKey, digestHash, signature []byte) bool {\n\tsig, err := ParseSignature(signature)\n\tif err != nil {\n\t\treturn false\n\t}\n\tpublicKey := secp256k1.NewPublicKey(pubkey.X, pubkey.Y)\n\treturn ecc.Secp256k1.Verify(publicKey, digestHash, sig.GetR(), sig.GetS())\n}", "title": "" }, { "docid": "0f83f21fd9deb3fc44217446cafa075f", "score": "0.52685785", "text": "func (ut *verificationPayload) Validate() (err error) {\n\tif ut.UserID == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`request`, \"userId\"))\n\t}\n\tif ut.UserID != nil {\n\t\tif ok := goa.ValidatePattern(`^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$`, *ut.UserID); !ok {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidPatternError(`request.userId`, *ut.UserID, `^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$`))\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "09cf01e9339e9aa0c818b6bf12e8ebee", "score": "0.5259536", "text": "func Validate(h func() hash.Hash, message, key []byte, signature string) bool {\n\tdecoded, err := hex.DecodeString(signature)\n\tif err != nil {\n\t\treturn false\n\t}\n\treturn validate(h, message, key, decoded)\n}", "title": "" }, { "docid": "de76f52ec673ed20b6cb14d1760843ef", "score": "0.5252233", "text": "func verifySignatures(pluginFilePaths []string) error {\n\tblock, err := armor.Decode(bytes.NewReader(mattermostPluginPublicKey))\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to decode public key\")\n\t}\n\n\tkeyring, err := openpgp.ReadKeyRing(block.Body)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"can't read public key\")\n\t}\n\n\tfor _, pluginFilePath := range pluginFilePaths {\n\t\tsignedFile, err := os.Open(pluginFilePath)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"cannot read signed file\")\n\t\t}\n\t\tdefer signedFile.Close()\n\n\t\t// Assume signature is always <filepath>.sig\n\t\tsignatureFile, err := os.Open(fmt.Sprintf(\"%s.sig\", pluginFilePath))\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"cannot read signature file\")\n\t\t}\n\t\tdefer signatureFile.Close()\n\n\t\tif _, err = openpgp.CheckDetachedSignature(keyring, signedFile, signatureFile); err != nil {\n\t\t\treturn errors.Wrap(err, \"error while checking the signature\")\n\t\t}\n\t}\n\n\tLogInfo(\"Signatures verified for %+v\", pluginFilePaths)\n\treturn nil\n}", "title": "" }, { "docid": "1cc59901e8b1a6fe37af1674af8f0634", "score": "0.52418935", "text": "func (sig *Signature) Validate() bool {\n\tv, r, s := sig.VRS()\n\tone := big.NewInt(1)\n\n\tif r.Cmp(one) < 0 || s.Cmp(one) < 0 {\n\t\treturn false\n\t}\n\n\tif s.Cmp(halfN) > 0 {\n\t\treturn false\n\t}\n\n\treturn r.Cmp(N) < 0 && s.Cmp(N) < 0 && (v == 0 || v == 1)\n}", "title": "" }, { "docid": "15c7641d43589ccffba73c227f222aee", "score": "0.52332115", "text": "func VerifyBLSSignature(pubKeyBytes, message, signature []byte) error {\n\tpubKeyBLS := &bls.PublicKey{}\n\tif err := pubKeyBLS.Unmarshal(pubKeyBytes); err != nil {\n\t\treturn err\n\t}\n\n\tsig := &bls.Signature{}\n\tif err := sig.Decompress(signature); err != nil {\n\t\treturn err\n\t}\n\n\tapk := bls.NewApk(pubKeyBLS)\n\treturn bls.Verify(apk, message, sig)\n}", "title": "" }, { "docid": "7c8270189c9379a317c821ccd1da9410", "score": "0.52331156", "text": "func verify(fileName, sigFileName, groupToml string) error {\n\t// if the file hash matches the one in the signature\n\tlog.Lvl4(\"Reading file \" + fileName)\n\tb, err := ioutil.ReadFile(fileName)\n\tif err != nil {\n\t\treturn errors.New(\"Couldn't open msgFile: \" + err.Error())\n\t}\n\t// Read the JSON signature file\n\tlog.Lvl4(\"Reading signature\")\n\tvar sigBytes []byte\n\tif sigFileName == \"\" {\n\t\tfmt.Println(\"[+] Reading signature from standard input ...\")\n\t\tsigBytes, err = ioutil.ReadAll(os.Stdin)\n\t} else {\n\t\tsigBytes, err = ioutil.ReadFile(sigFileName)\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\tsig := &s.SignatureResponse{}\n\tlog.Lvl4(\"Unmarshalling signature \")\n\tif err := json.Unmarshal(sigBytes, sig); err != nil {\n\t\treturn err\n\t}\n\tfGroup, err := os.Open(groupToml)\n\tif err != nil {\n\t\treturn err\n\t}\n\tlog.Lvl4(\"Reading group definition\")\n\tel, err := config.ReadGroupToml(fGroup)\n\tif err != nil {\n\t\treturn err\n\t}\n\tlog.Lvl4(\"Verfifying signature\")\n\terr = verifySignatureHash(b, sig, el)\n\treturn err\n}", "title": "" }, { "docid": "abf31eca4f2e94ec518f6fa9b892cc2e", "score": "0.5231034", "text": "func CertificateCheckSignature(c *x509.Certificate, algo x509.SignatureAlgorithm, signed, signature []byte) error", "title": "" }, { "docid": "c479d4de4d88dc3b8d5533c8de2a16fb", "score": "0.5224646", "text": "func ValidateDid(DID string) (bool, error) {\n\tlog.Println(\"Caller is using JWT did\")\n\n\theader, payload, signature, err := validateJWT(DID)\n\tif err != nil {\n\t\tlog.Println(\"Error validating JWT\")\n\t\treturn false, err\n\t}\n\n\tlog.Println(len(signature))\n\n\tparte1 := base64.StdEncoding.EncodeToString(header)\n\tparte2 := base64.StdEncoding.EncodeToString(payload)\n\tparte3 := base64.StdEncoding.EncodeToString(signature)\n\n\tlog.Printf(\"base64 signature:%v\", parte3)\n\n\tparte1 = strings.TrimRight(parte1, \"=\")\n\tparte2 = strings.TrimRight(parte2, \"=\")\n\n\thashInput := parte1 + \".\" + parte2\n\n\thash256 := sha256.Sum256([]byte(hashInput))\n\n\tvar hashVerify = make([]byte, 32, 64)\n\n\tfor i, j := range hash256 {\n\t\thashVerify[i] = j\n\t}\n\n\thexaSig := hex.EncodeToString(signature)\n\n\tlog.Printf(\"firmaaHexa:%v\", hexaSig)\n\n\tvar payloadJSON interface{}\n\terr = json.Unmarshal(payload, &payloadJSON)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tdata := payloadJSON.(map[string]interface{})\n\n\tlog.Println(\"iss:\", data[\"iss\"])\n\n\t//add 04 before publicKey because Y is into publicKey\n\tpubKey, err := hex.DecodeString(\"04\" + data[\"iss\"].(string))\n\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tvalidate := secp256k1.VerifySignature(pubKey, hashVerify, signature)\n\n\tlog.Println(\"is validate?:\", validate)\n\n\treturn validate, nil\n}", "title": "" }, { "docid": "9d5e63a4111514bb68b635c4b830e6ce", "score": "0.5218517", "text": "func (n *p2pNetwork) BroadcastSignature(msg *proto.SignedMessage) error {\n\tmsgBytes, err := json.Marshal(network.Message{\n\t\tLambda: msg.Message.Lambda,\n\t\tMsg: msg,\n\t\tType: network.SignatureBroadcastingType,\n\t})\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to marshal message\")\n\t}\n\n\treturn n.cfg.Topic.Publish(n.ctx, msgBytes)\n}", "title": "" }, { "docid": "3c9bb202bf9fc10525ccc10996fd7be5", "score": "0.521144", "text": "func VerifySignature(data, signature []byte, opts SignatureOptions, pubKeyPem string) error {\n\tif opts.Algorithm != \"PSS\" {\n\t\treturn fmt.Errorf(\"Unsupported signature algorithm %q\", opts.Algorithm)\n\t}\n\tpubKey, err := loadPublicKey(pubKeyPem)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\thasher := crypto.Hash(opts.Hash)\n\thash, err := hash(data, hasher)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Could not compute the cryptographic hash of the license: %s\", err)\n\t}\n\n\tpssOpts := rsa.PSSOptions{\n\t\tSaltLength: opts.SaltLength,\n\t\tHash: hasher,\n\t}\n\n\treturn rsa.VerifyPSS(pubKey, hasher, hash, signature, &pssOpts)\n}", "title": "" }, { "docid": "d7855ff61cc653710ab6c963147a75e1", "score": "0.51790345", "text": "func TestSignature_Verify(t *testing.T) {\n\ttx := getTestTransaction()\n\tex, _ := btcec.PrivKeyFromBytes(btcec.S256(), testPri)\n\tsignature := getTestSignature()\n\terr := signature.Verify(tx.GetTxID().CloneBytes(), ex.PubKey().SerializeCompressed())\n\tunittest.NotError(t, err)\n}", "title": "" }, { "docid": "75bfbd11dca7a89e750553dfe017ae7b", "score": "0.51768625", "text": "func SJWTVerifyWithPubKey(signingString string, signature string, key interface{}) (int, error) {\n\tvar err error\n\n\tvar sig []byte\n\tif sig, err = SJWTBase64DecodeBytes(signature); err != nil {\n\t\treturn SJWTRetErrJSONSignatureNob64, err\n\t}\n\n\tvar ecdsaKey *ecdsa.PublicKey\n\tswitch k := key.(type) {\n\tcase *ecdsa.PublicKey:\n\t\tecdsaKey = k\n\tdefault:\n\t\treturn SJWTRetErrCertInvalidFormat, errors.New(\"invalid key type\")\n\t}\n\n\tif len(sig) != 2*sES256KeySize {\n\t\treturn SJWTRetErrJSONSignatureSize, errors.New(\"ECDSA signature size verification failed\")\n\t}\n\n\tr := big.NewInt(0).SetBytes(sig[:sES256KeySize])\n\ts := big.NewInt(0).SetBytes(sig[sES256KeySize:])\n\n\tif !crypto.SHA256.Available() {\n\t\treturn SJWTRetErrJSONSignatureHashing, errors.New(\"hashing function unavailable\")\n\t}\n\thasher := crypto.SHA256.New()\n\thasher.Write([]byte(signingString))\n\n\tif verifystatus := ecdsa.Verify(ecdsaKey, hasher.Sum(nil), r, s); verifystatus == true {\n\t\treturn SJWTRetOK, nil\n\t}\n\treturn SJWTRetErrJSONSignatureInvalid, errors.New(\"ECDSA verification failed\")\n}", "title": "" }, { "docid": "2918ea8e55bfea6e3f958626e58a4aab", "score": "0.5168615", "text": "func (acc *Account) VerifySignature(data, signature []byte) bool {\n\treturn Verify(acc.publicKey, data, signature) == 1\n}", "title": "" }, { "docid": "990a27330b419d415f27d8676113c8e9", "score": "0.51611906", "text": "func verifySignature(pubKeyEntries openpgp.EntityList, origText io.Reader, signature []byte, verifyTime int64) error {\n\tconfig := &packet.Config{}\n\tif verifyTime == 0 {\n\t\tconfig.Time = func() time.Time {\n\t\t\treturn time.Unix(0, 0)\n\t\t}\n\t} else {\n\t\tconfig.Time = func() time.Time {\n\t\t\treturn time.Unix(verifyTime+internal.CreationTimeOffset, 0)\n\t\t}\n\t}\n\tsignatureReader := bytes.NewReader(signature)\n\n\tsigner, err := openpgp.CheckDetachedSignatureAndHash(pubKeyEntries, origText, signatureReader, allowedHashes, config)\n\n\tif errors.Is(err, pgpErrors.ErrSignatureExpired) && signer != nil && verifyTime > 0 {\n\t\t// if verifyTime = 0: time check disabled, everything is okay\n\t\t// Maybe the creation time offset pushed it over the edge\n\t\t// Retry with the actual verification time\n\t\tconfig.Time = func() time.Time {\n\t\t\treturn time.Unix(verifyTime, 0)\n\t\t}\n\n\t\t_, err = signatureReader.Seek(0, io.SeekStart)\n\t\tif err != nil {\n\t\t\treturn newSignatureFailed()\n\t\t}\n\n\t\tsigner, err = openpgp.CheckDetachedSignatureAndHash(pubKeyEntries, origText, signatureReader, allowedHashes, config)\n\t\tif err != nil {\n\t\t\treturn newSignatureFailed()\n\t\t}\n\t}\n\n\tif signer == nil {\n\t\treturn newSignatureFailed()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "0abb35d84fcdf38f8942fa98ce28075e", "score": "0.51521003", "text": "func (v *Client) VerifySignature(keyName, signature, message string) (bool, error) {\n\tcomparePath := fmt.Sprintf(\"/transit/verify/%s/sha2-256\", keyName)\n\tlogrus.Debugf(\"Vault Backend: verify signature: %s against key %s\", signature, keyName)\n\n\tsigSplit := strings.SplitN(signature, \":\", 2)\n\tif len(sigSplit) != 2 {\n\t\treturn false, errors.New(\"Invalid signature format\")\n\t}\n\n\tnonce := sigSplit[0]\n\n\tdata := map[string]interface{}{\n\t\t\"hmac\": sigSplit[1],\n\t}\n\n\tdata[\"input\"], _ = formatSignatureString(nonce, message)\n\n\tsecret, err := v.writeToVault(comparePath, data)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tverified, ok := secret.Data[\"valid\"].(bool)\n\tif verified && ok {\n\t\treturn true, nil\n\t}\n\treturn false, nil\n}", "title": "" }, { "docid": "9a665cb01e671c380beb1522e2fe3408", "score": "0.5148995", "text": "func (ut *VerificationPayload) Validate() (err error) {\n\tif ut.UserID == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`type`, \"userId\"))\n\t}\n\tif ok := goa.ValidatePattern(`^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$`, ut.UserID); !ok {\n\t\terr = goa.MergeErrors(err, goa.InvalidPatternError(`type.userId`, ut.UserID, `^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$`))\n\t}\n\treturn\n}", "title": "" }, { "docid": "a6b775222ad7aa2612ea0677e3074dbb", "score": "0.5144181", "text": "func Signature(request *http.Request, payload string, timestamp time.Time, region, service, key string) string {\n\tstring := canonicalString(request, payload)\n\thashed := fmt.Sprintf(\"%x\", sha256.Sum256([]byte(string)))\n\tstringToSign := stringToSign(timestamp, region, service, hashed)\n\tsigningKey := deriveSigningKey(key, timestamp, region, service)\n\n\treturn calculateSignature(signingKey, stringToSign)\n}", "title": "" }, { "docid": "473707b19fba14bd102ad72f547364ae", "score": "0.51359266", "text": "func Verify(signature *Signature) error {\n\tpk, ai, err := keys.ParsePublicKey(signature.PublicKey)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsigBytes, err := encoding.DecodePEM(signature.Signature, SignaturePEMLabel)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\talgo, err := getSignatureAlgorithmFromIdentifier(ai.Algorithm)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif algo == PureED25519 {\n\t\tif pub, ok := pk.(*ed25519.PublicKey); ok {\n\t\t\tif ed25519.Verify(*pub, signature.Message, sigBytes) {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn errors.Wrap(ErrInvalidSignature, \"invalid ed25519 signature\")\n\t\t}\n\t\treturn errors.Wrap(ErrInvalidSignature, \"incorrect ed25519 public key\")\n\t}\n\n\tcrt := x509.Certificate{PublicKey: pk}\n\tif err := crt.CheckSignature(algo, signature.Message, sigBytes); err != nil {\n\t\treturn errors.Wrap(ErrInvalidSignature, err.Error())\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "933cd6e7b4d536bfbc1e82e98ba0e97c", "score": "0.5114987", "text": "func (sig *Signature) Verify(message []byte, signature []byte,\n\tpublicKey []byte) (bool, error) {\n\tif len(publicKey) != sig.algDetails.LengthPublicKey {\n\t\treturn false, errors.New(\"incorrect public key length\")\n\t}\n\n\tif len(signature) > sig.algDetails.MaxLengthSignature {\n\t\treturn false, errors.New(\"incorrect signature size\")\n\t}\n\n\trv := C.OQS_SIG_verify(sig.sig, (*C.uint8_t)(unsafe.Pointer(&message[0])),\n\t\tC.size_t(len(message)), (*C.uint8_t)(unsafe.Pointer(&signature[0])),\n\t\tC.size_t(len(signature)), (*C.uint8_t)(unsafe.Pointer(&publicKey[0])))\n\n\tif rv != C.OQS_SUCCESS {\n\t\treturn false, nil\n\t}\n\n\treturn true, nil\n}", "title": "" }, { "docid": "12854bce0ab11ef4a47639c2a5f67635", "score": "0.5114394", "text": "func (pubKey PubKey) verifySignatureAsEIP712(msg, sig []byte) bool {\n\teip712Bytes, err := GetEIP712BytesForMsg(msg)\n\tif err != nil {\n\t\treturn false\n\t}\n\n\treturn pubKey.verifySignatureECDSA(eip712Bytes, sig)\n}", "title": "" }, { "docid": "1c51c64fa3a182e04ff23188d201d8cc", "score": "0.51061326", "text": "func (t *TBLN) VerifySignature(name string, pubkey []byte) bool {\n\tif t == nil || t.Definition == nil || len(t.Signs) == 0 {\n\t\treturn false\n\t}\n\tif len(pubkey) != ed25519.PublicKeySize {\n\t\treturn false\n\t}\n\ts := t.Signs[name]\n\tif s.algorithm == ED25519 {\n\t\tx := ed25519.PublicKey(pubkey)\n\t\tif ed25519.Verify(x, t.SerializeHash(), s.sign) {\n\t\t\treturn t.Verify()\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "f589ae4469a58329268c4f2e052c20fd", "score": "0.5105453", "text": "func verifyDetailsSignature(md *openpgp.MessageDetails, verifierKey *KeyRing, verificationContext *VerificationContext) error {\n\tif !md.IsSigned {\n\t\treturn newSignatureNotSigned()\n\t}\n\tif md.SignedBy == nil ||\n\t\tlen(verifierKey.entities) == 0 ||\n\t\tlen(verifierKey.entities.KeysById(md.SignedByKeyId)) == 0 {\n\t\treturn newSignatureNoVerifier()\n\t}\n\tif md.SignatureError != nil {\n\t\treturn newSignatureFailed(md.SignatureError)\n\t}\n\tif md.Signature == nil ||\n\t\tmd.Signature.Hash < allowedHashes[0] ||\n\t\tmd.Signature.Hash > allowedHashes[len(allowedHashes)-1] {\n\t\treturn newSignatureInsecure()\n\t}\n\tif verificationContext != nil {\n\t\terr := verificationContext.verifyContext(md.Signature)\n\t\tif err != nil {\n\t\t\treturn newSignatureBadContext(err)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "134d9b0f60b99c167d9272ccc30440ea", "score": "0.5102033", "text": "func (tx *MsgTx) VerifySignature() bool {\n\tif len(tx.SignatureScript) == 0 {\n\t\treturn false\n\t}\n\n\tpublicKey := tx.PublicKey\n\n\t// Verify that the address of outPoint in PreviousOutPoint matches the publicKey in Tx.\n\tif tx.IsReduceTx() {\n\t\tif len(tx.TxIn) != 1 {\n\t\t\treturn false\n\t\t}\n\n\t\ttxIn := tx.TxIn[0]\n\t\tif err := txIn.PreviousOutPoint.UserAddress.VerifyPublicKey(publicKey,\n\t\t\tmultivacaddress.SmartContractAddress); err != nil {\n\t\t\tlogger.WireLogger().Warn(\"MsgTx#VerifySignature wrong pub key for reduce out\")\n\t\t\treturn false\n\t\t}\n\t} else {\n\t\tfor _, txIn := range tx.TxIn {\n\t\t\tif err := txIn.PreviousOutPoint.UserAddress.VerifyPublicKey(publicKey,\n\t\t\t\tmultivacaddress.UserAddress); err != nil {\n\t\t\t\tlogger.WireLogger().Warn(\"MsgTx#VerifySignature wrong pub key for outs\")\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t}\n\tsig := tx.SignatureScript\n\tdata := tx.doubleSha256WithoutSignatureAndPubKey()\n\tv := signature.Verify(publicKey, data[:], sig)\n\tif !v {\n\t\tlogger.WireLogger().Warn(\"MsgTx#VerifySignature Signature is wrong\")\n\t}\n\treturn v\n}", "title": "" }, { "docid": "3e927b106560c225e9a73b40be0c5789", "score": "0.50988567", "text": "func verifySignature(e *Exchange, verificationTime time.Time, fetch CertFetcher, signature *Signature) (certurl.CertChain, []byte, error) {\n\t// Step 1: Extract the signature fields\n\t// |signature| is the parsed signature.\n\n\t// Step 2: Fetch cert-url and determine the signing algorithm\n\tcertBytes, err := fetch(signature.CertUrl)\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"verify: failed to fetch %q: %v\", signature.CertUrl, err)\n\t}\n\tcerts, err := certurl.ReadCertChain(bytes.NewReader(certBytes))\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"verify: could not parse certificate CBOR: %v\", err)\n\t}\n\tmainCert := certs[0]\n\tverifier, err := signingalgorithm.VerifierForPublicKey(mainCert.Cert.PublicKey)\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"verify: unsupported main certificate public key: %v\", err)\n\t}\n\n\t// Step 3 and 4: Timestamp checks\n\tif err := verifyTimestamps(signature, verificationTime); err != nil {\n\t\treturn nil, nil, err\n\t}\n\t// Step 5: Reconstruct the signing message\n\tcertSha256 := mainCert.CertSha256()\n\tmsg, err := serializeSignedMessage(e, certSha256, signature.ValidityUrl, signature.Date, signature.Expires)\n\tif err != nil {\n\t\treturn nil, nil, errors.New(\"verify: cannot reconstruct signed message\")\n\t}\n\t// Step 6: Cert-sha256 check\n\tif !bytes.Equal(signature.CertSha256, certSha256) {\n\t\treturn nil, nil, errors.New(\"verify: cert-sha256 mismatch\")\n\t}\n\t// Step 7: Signature verification\n\tok, err := verifier.Verify(msg, signature.Sig)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tif !ok {\n\t\treturn nil, nil, errors.New(\"verify: signature verification failed\")\n\t}\n\t// Step 8: (version >= 1b3) Response headers must contain Content-Type\n\tif e.Version != version.Version1b1 && e.Version != version.Version1b2 {\n\t\tif e.ResponseHeaders.Get(\"Content-Type\") == \"\" {\n\t\t\treturn nil, nil, errors.New(\"verify: Content-Type response header is absent\")\n\t\t}\n\t}\n\t// Step 9: Payload integrity check\n\tdecodedPayload, err := verifyPayload(e, signature)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\t// Step 10: Return \"potentially-valid\" with certificate-chain.\n\treturn certs, decodedPayload, nil\n}", "title": "" }, { "docid": "136c78e6dd4eb6d359e89e608eac599f", "score": "0.50855464", "text": "func TestGenSignature(t *testing.T) {\n\tjsonPayload := RemoveWhitespaces(`\n{\n \"product\": {\n \"cloud\": {\n \"amount\": 1,\n \"vm\": {\n \"cpu\": 1,\n \"mem\": 1024,\n \"image_id\": \"centos65x64d\",\n \"name\": \"test\",\n \"mode\": \"system\",\n \"login_mode\": \"pwd\",\n \"password\": \"anchnet20150401\"\n },\n \"net0\": true,\n \"net1\": [],\n \"hd\": [\n {\n \"type\": 0,\n \"unit\": \"100\",\n \"name\": \"anchnet应用\"\n },\n {\n \"type\": 0,\n \"unit\": \"100\",\n \"name\": \"anchnet数据库\"\n }\n ],\n \"ip\": {\n \"bw\": \"5\",\n \"ip_group\": \"eipg-00000000\"\n }\n }\n },\n \"zone\": \"ac1\",\n \"token\": \"1HC4XSHVTSRVU5C89NP4\",\n \"action\": \"RunInstances\"\n}\n`)\n\n\tsecret := \"r3ak4XcBlM3zclK5turz1I3DjclK3Lk098Y4HDHo\"\n\t// The result given in API doc is wrong:\n\t// \"c37797da5d2747f68b8bbb9e0ad0d6da08132c3b66ceb48c3a491311a7bd080d\"\n\texpectedSignature := \"f45022c0f5b1da37dd53d2983b5cf2d487603ad48b88adae942297aa570ffd18\"\n\tacutalSignature := GenSignature([]byte(jsonPayload), []byte(secret))\n\n\tif expectedSignature != acutalSignature {\n\t\tt.Errorf(\"Expected signature \\n%v, but got \\n%v\", expectedSignature, acutalSignature)\n\t}\n}", "title": "" }, { "docid": "f95ccc2742bc8dc2c3e61fca11763ae5", "score": "0.5084336", "text": "func postPresignSignatureV4(policyBase64 string, t time.Time, secretAccessKey, location string) string {\n\t// Get signing key.\n\tsigningkey := getSigningKey(secretAccessKey, t, location)\n\t// Calculate signature.\n\tsignature := getSignature(signingkey, policyBase64)\n\treturn signature\n}", "title": "" }, { "docid": "94c0f8ff14eb36970b42ee9c9a16ab27", "score": "0.50820637", "text": "func VerifySignature(sig, canonicalString, secret string) bool {\n\texpected := Compute(canonicalString, secret)\n\treturn expected == sig\n}", "title": "" } ]
da119217370d2757e1f65171b56f3df8
Transform adds a merged device to the spec
[ { "docid": "69f21950d01476cd884986211e30f86f", "score": "0.8057964", "text": "func (m mergedDevice) Transform(spec *specs.Spec) error {\n\tif spec == nil {\n\t\treturn nil\n\t}\n\n\tmergedDevice, err := mergeDeviceSpecs(spec.Devices, m.name)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to generate merged device %q: %v\", m.name, err)\n\t}\n\tif mergedDevice == nil {\n\t\tif m.skipIfExists {\n\t\t\treturn nil\n\t\t}\n\t\treturn fmt.Errorf(\"device %q already exists\", m.name)\n\t}\n\n\tspec.Devices = append(spec.Devices, *mergedDevice)\n\n\tif err := m.simplifier.Transform(spec); err != nil {\n\t\treturn fmt.Errorf(\"failed to simplify spec after merging device %q: %v\", m.name, err)\n\t}\n\n\treturn nil\n}", "title": "" } ]
[ { "docid": "da8b236648f8502caf065e23c8ed4ff6", "score": "0.63392025", "text": "func mergeDeviceSpecs(deviceSpecs []specs.Device, mergedDeviceName string) (*specs.Device, error) {\n\tfor _, d := range deviceSpecs {\n\t\tif d.Name == mergedDeviceName {\n\t\t\treturn nil, nil\n\t\t}\n\t}\n\n\tmergedEdits := edits.NewContainerEdits()\n\n\tfor _, d := range deviceSpecs {\n\t\tedit := cdi.ContainerEdits{\n\t\t\tContainerEdits: &d.ContainerEdits,\n\t\t}\n\t\tmergedEdits.Append(&edit)\n\t}\n\n\tmerged := specs.Device{\n\t\tName: mergedDeviceName,\n\t\tContainerEdits: *mergedEdits.ContainerEdits,\n\t}\n\treturn &merged, nil\n}", "title": "" }, { "docid": "f5ca9394c03769989a1dc79cd822ceb6", "score": "0.6239091", "text": "func (s simplify) Transform(spec *specs.Spec) error {\n\tif spec == nil {\n\t\treturn nil\n\t}\n\n\tdedupe := dedupe{}\n\tif err := dedupe.Transform(spec); err != nil {\n\t\treturn err\n\t}\n\n\tcommonEntityIDs, err := (*containerEdits)(&spec.ContainerEdits).getEntityIds()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ttoRemove := newRemover(commonEntityIDs...)\n\tvar updatedDevices []specs.Device\n\tfor _, device := range spec.Devices {\n\t\tdeviceAsSpec := specs.Spec{\n\t\t\tContainerEdits: device.ContainerEdits,\n\t\t}\n\t\terr := toRemove.Transform(&deviceAsSpec)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to transform device edits: %w\", err)\n\t\t}\n\n\t\tif !(containerEdits)(deviceAsSpec.ContainerEdits).IsEmpty() {\n\t\t\t// Devices with empty edits are invalid.\n\t\t\t// We only update the container edits for the device if this would\n\t\t\t// result in a valid device.\n\t\t\tdevice.ContainerEdits = deviceAsSpec.ContainerEdits\n\t\t}\n\t\tupdatedDevices = append(updatedDevices, device)\n\t}\n\tspec.Devices = updatedDevices\n\n\treturn nil\n}", "title": "" }, { "docid": "2d31849b9433daf8f40323cd20891870", "score": "0.6106074", "text": "func NewMergedDevice(opts ...MergedDeviceOption) (Transformer, error) {\n\tm := &mergedDevice{}\n\tfor _, opt := range opts {\n\t\topt(m)\n\t}\n\tif m.name == \"\" {\n\t\tm.name = allDeviceName\n\t}\n\tm.simplifier = NewSimplifier()\n\n\tif err := cdi.ValidateDeviceName(m.name); err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid device name %q: %v\", m.name, err)\n\t}\n\n\treturn m, nil\n}", "title": "" }, { "docid": "873b46fd53d91e6a45dec293e127396d", "score": "0.54784095", "text": "func merge(dst, src *specs.Spec) *specs.Spec {\n\terr := mergo.Merge(dst, src, mergo.WithAppendSlice)\n\tif err != nil {\n\t\tpanic(fmt.Errorf(\n\t\t\t\"failed to merge specs %v %v - programming mistake? %w\",\n\t\t\tdst, src, err,\n\t\t))\n\t}\n\n\treturn dst\n}", "title": "" }, { "docid": "38fe4be424b4269aa4f996ad898531f8", "score": "0.49587533", "text": "func (g *Generator) AdjustDevices(devices []*nri.LinuxDevice) {\n\tfor _, d := range devices {\n\t\tkey, marked := d.IsMarkedForRemoval()\n\t\tg.RemoveDevice(key)\n\t\tif marked {\n\t\t\tcontinue\n\t\t}\n\t\tg.AddDevice(d.ToOCI())\n\t\tmajor, minor, access := &d.Major, &d.Minor, d.AccessString()\n\t\tg.AddLinuxResourcesDevice(true, d.Type, major, minor, access)\n\t}\n}", "title": "" }, { "docid": "6c55c30fd574b2257dec6fb145acf3aa", "score": "0.49114352", "text": "func AddDevices(state *configs.HookState, hookConfig *hconfig.ContainerHookConfig, spec *specs.Spec) error {\n\tpid := strconv.Itoa(state.Pid)\n\tdriver := nsexec.NewDefaultNsDriver()\n\n\tcgroupPath, err := libdevice.FindCgroupPath(pid, \"devices\", spec.Linux.CgroupsPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tudevdCtrl := udevd.NewUdevdController()\n\tif err := udevdCtrl.Lock(); err != nil {\n\t\treturn err\n\t}\n\tdefer udevdCtrl.Unlock()\n\n\tif err := udevdCtrl.LoadRules(); err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tlogrus.Infof(\"Start sync rules to disk\")\n\t\tudevdCtrl.ToDisk()\n\t\tlogrus.Infof(\"Finish sync rules to disk\")\n\t}()\n\n\tfor index, dev := range hookConfig.Devices {\n\t\t// re-calc the dest path of device.\n\t\tresolvDev := calcPathForDevice(state.Root, dev)\n\t\tdevice, err := libdevice.ParseDevice(resolvDev)\n\t\tif err != nil {\n\t\t\tlogrus.Errorf(\"[device-hook] Add device (%s), parse device failed: %v\", resolvDev, err)\n\t\t\treturn err\n\t\t}\n\n\t\t// update config here\n\t\tif dev.Major != device.Major || dev.Minor != device.Minor {\n\t\t\thookConfig.Devices[index].Major = device.Major\n\t\t\thookConfig.Devices[index].Minor = device.Minor\n\t\t\thookConfig.SetConfigDirty()\n\t\t}\n\n\t\tif device.Type != \"c\" {\n\t\t\tdevType, err := types.GetDeviceType(device.PathOnHost)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif devType == \"disk\" {\n\t\t\t\tudevdCtrl.AddRule(&udevd.Rule{\n\t\t\t\t\tName: dev.PathOnHost,\n\t\t\t\t\tCtrDevName: dev.PathInContainer,\n\t\t\t\t\tContainer: state.ID,\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\t// use exec driver to add device.\n\t\tlibdevice.UpdateDeviceOwner(spec, device)\n\t\tif err = driver.AddDevice(pid, device, true); err != nil {\n\t\t\tlogrus.Errorf(\"[device-hook] Add device (%s) failed: %v\", resolvDev, err)\n\t\t\treturn err\n\t\t}\n\n\t\t// update cgroup access permission.\n\t\tif err = libdevice.UpdateCgroupPermission(cgroupPath, device, true); err != nil {\n\t\t\tlogrus.Errorf(\"[device-hook] Update add device (%s) cgroup failed: %v\", resolvDev, err)\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d3a585cde28bd2ec9c80eda1d3978c97", "score": "0.4902695", "text": "func (d *DeviceMapperDriver) addDevice(headDeviceHash string) (string, error) {\n\n\t// Generate the device ID.\n\tdeviceHash, err := utils.NewUUID62()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// Create the device.\n\tif err := d.DeviceSet.AddDevice(deviceHash, headDeviceHash); err != nil {\n\t\tglog.Errorf(\"Unable to create device %s: %s\", deviceHash, err)\n\t\treturn \"\", err\n\t}\n\n\tif headDeviceHash == \"\" {\n\n\t\t// Activate the device.\n\t\td.DeviceSet.GetDeviceStatus(deviceHash)\n\n\t\t// CC-2219: Ensure the device base size is equal or greater than the\n\t\t// configured dm.basesize.\n\t\tsize, err := d.deviceSize(deviceHash)\n\t\tif err != nil {\n\t\t\tglog.Errorf(\"Could not read the size of device %s: %s\", deviceHash, err)\n\t\t\treturn \"\", err\n\t\t}\n\t\tif baseSize := d.baseSize(); baseSize > size {\n\n\t\t\t// Make the device to match dm.basesize\n\t\t\tglog.V(2).Infof(\"Device size is smaller than dm.basesize; expanding\")\n\t\t\tif err := d.resize(deviceHash, baseSize); err != nil {\n\t\t\t\tglog.Errorf(\"Could not update the size of the device %s: %s\", deviceHash, err)\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn deviceHash, nil\n}", "title": "" }, { "docid": "0afc7cba8fceedf25c659fd40484d823", "score": "0.48552996", "text": "func (o *overlayTransformer) Transform(baseResourceMap resource.ResourceCollection) error {\n\t// Merge and then index the patches by GVKN.\n\toverlays, err := o.mergePatches()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Strategic merge the resources exist in both base and overlay.\n\tfor _, overlay := range overlays {\n\t\t// Merge overlay with base resource.\n\t\tgvkn := overlay.GVKN()\n\t\tbase, found := baseResourceMap[gvkn]\n\t\tif !found {\n\t\t\treturn fmt.Errorf(\"failed to find an object with %#v to apply the patch\", gvkn.GVK)\n\t\t}\n\t\tmerged := map[string]interface{}{}\n\t\tversionedObj, err := scheme.Scheme.New(gvkn.GVK)\n\t\tbaseName := base.Data.GetName()\n\t\tswitch {\n\t\tcase runtime.IsNotRegisteredError(err):\n\t\t\t// Use JSON merge patch to handle types w/o schema\n\t\t\tbaseBytes, err := json.Marshal(base.Data)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tpatchBytes, err := json.Marshal(overlay.Data)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tmergedBytes, err := jsonpatch.MergePatch(baseBytes, patchBytes)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\terr = json.Unmarshal(mergedBytes, &merged)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\tcase err != nil:\n\t\t\treturn err\n\t\tdefault:\n\t\t\t// Use Strategic Merge Patch to handle types w/ schema\n\t\t\t// TODO: Change this to use the new Merge package.\n\t\t\t// Store the name of the base object, because this name may have been munged.\n\t\t\t// Apply this name to the StrategicMergePatched object.\n\t\t\tlookupPatchMeta, err := strategicpatch.NewPatchMetaFromStruct(versionedObj)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tmerged, err = strategicpatch.StrategicMergeMapPatchUsingLookupPatchMeta(\n\t\t\t\tbase.Data.Object,\n\t\t\t\toverlay.Data.Object,\n\t\t\t\tlookupPatchMeta)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\tbase.Data.SetName(baseName)\n\t\tbaseResourceMap[gvkn].Data.Object = merged\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9b05ad1902db6df31efc8604a3f9add0", "score": "0.4808171", "text": "func (dh *DeviceHandler) AdoptDevice(ctx context.Context, device *voltha.Device) {\n\tdh.transitionMap = NewTransitionMap(dh)\n\tlogger.Infow(\"adopt-device\", log.Fields{\"device-id\": device.Id, \"Address\": device.GetHostAndPort()})\n\tdh.transitionMap.Handle(ctx, DeviceInit)\n\n\t// Now, set the initial PM configuration for that device\n\tif err := dh.coreProxy.DevicePMConfigUpdate(nil, dh.metrics.ToPmConfigs()); err != nil {\n\t\tolterrors.NewErrAdapter(\"error-updating-performance-metrics\", log.Fields{\"device-id\": device.Id}, err).LogAt(log.ErrorLevel)\n\t}\n\n\tgo startHeartbeatCheck(ctx, dh)\n}", "title": "" }, { "docid": "5100c2f6239058348f2d23c8b821e409", "score": "0.4795625", "text": "func (o *PutV1DevicesDeviceCommandsCommandParams) bindDevice(rawData []string, hasKey bool, formats strfmt.Registry) error {\n\tvar raw string\n\tif len(rawData) > 0 {\n\t\traw = rawData[len(rawData)-1]\n\t}\n\n\t// Required: true\n\t// Parameter is provided by construction from the route\n\n\to.Device = raw\n\n\treturn nil\n}", "title": "" }, { "docid": "75fa231dbe4a05594e32812635ca3910", "score": "0.4767769", "text": "func patchMerge(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\tnewDep := dep.DeepCopy()\n\tnewDep.Spec.Replicas = pointer.Int32Ptr(3)\n\tpatch := client.MergeFrom(&dep)\n\n\terr = cli.Patch(ctx, newDep, patch)\n\n\treturn err\n}", "title": "" }, { "docid": "ba42004909a5c4467ef92d3aa61c48f1", "score": "0.4753185", "text": "func UpdateDevice(c *container.Container, opts *types.AddDeviceOptions) error {\n\tpid := strconv.Itoa(c.Pid())\n\n\tinnerPath, err := c.GetCgroupPath()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := c.Lock(); err != nil {\n\t\treturn err\n\t}\n\tdefer c.Unlock()\n\n\t// create config file handler.\n\tconfig, err := hconfig.NewContainerConfig(c)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := checkDevice(config, []*types.Device{}, opts); err != nil {\n\t\treturn err\n\t}\n\n\tdefer func() {\n\t\tif err := config.Flush(); err != nil {\n\t\t\tlogrus.Infof(\"config Flush error:%v\", err)\n\t\t}\n\t}()\n\n\tif err := updateQos(config, pid, innerPath, opts); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c7b8a4338d1ac8228fbc3bc3e419b637", "score": "0.47459358", "text": "func (oo *OpenOLT) Adopt_device(ctx context.Context, device *voltha.Device) error {\n\tif device == nil {\n\t\treturn olterrors.NewErrInvalidValue(log.Fields{\"device\": nil}, nil).Log()\n\t}\n\tlogger.Infow(ctx, \"adopt-device\", log.Fields{\"deviceId\": device.Id})\n\tvar handler *DeviceHandler\n\tif handler = oo.getDeviceHandler(device.Id); handler == nil {\n\t\thandler := NewDeviceHandler(oo.coreProxy, oo.adapterProxy, oo.eventProxy, device, oo)\n\t\too.addDeviceHandlerToMap(handler)\n\t\tgo handler.AdoptDevice(ctx, device)\n\t\t// Launch the creation of the device topic\n\t\t// go oo.createDeviceTopic(device)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7554121f423800d37cd7ea31492b9282", "score": "0.4721542", "text": "func (q *qemu) addDevice(devInfo interface{}, devType deviceType) error {\n\tswitch devType {\n\tcase fsDev:\n\t\tvolume := devInfo.(Volume)\n\t\tq.qemuConfig.Devices = q.appendVolume(q.qemuConfig.Devices, volume)\n\tcase serialPortDev:\n\t\tsocket := devInfo.(Socket)\n\t\tq.qemuConfig.Devices = q.appendSocket(q.qemuConfig.Devices, socket)\n\tdefault:\n\t\tbreak\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f52569c7a0311240830ce11120a23a62", "score": "0.4718645", "text": "func AddDevice(c *container.Container, devices []*types.Device, opts *types.AddDeviceOptions) error {\n\tdriver := nsexec.NewDefaultNsDriver()\n\tpid := strconv.Itoa(c.Pid())\n\n\tinnerPath, err := c.GetCgroupPath()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcgroupPath, err := FindCgroupPath(pid, \"devices\", innerPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, device := range devices {\n\t\tUpdateDeviceOwner(c.GetSpec(), device)\n\t}\n\n\tudevdCtrl := udevd.NewUdevdController()\n\n\t// lockFile := <container config path>/lock\n\t// 1. use file lock, to make sure only one process to access this config file.\n\t// 2. different container has different lock, will not block other container.\n\tif err := c.Lock(); err != nil {\n\t\treturn err\n\t}\n\tdefer c.Unlock()\n\n\t// create config file handler.\n\tconfig, err := hconfig.NewContainerConfig(c)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := checkDevice(config, devices, opts); err != nil {\n\t\treturn err\n\t}\n\n\tdefer func() {\n\t\tif err := config.Flush(); err != nil {\n\t\t\tlogrus.Infof(\"config Flush error:%v\", err)\n\t\t}\n\t}()\n\n\tif err := udevdCtrl.Lock(); err != nil {\n\t\treturn err\n\t}\n\tdefer udevdCtrl.Unlock()\n\n\tif err := udevdCtrl.LoadRules(); err != nil {\n\t\treturn err\n\t}\n\tdefer udevdCtrl.ToDisk()\n\n\tvar retErr []error\n\t// add device and udpate cgroup here\n\tfor _, device := range devices {\n\t\t// update config here\n\t\tif err = config.UpdateDevice(device, true); err != nil {\n\t\t\tretErr = append(retErr, err)\n\t\t\tcontinue\n\t\t}\n\n\t\tr := &udevd.Rule{\n\t\t\tName: device.PathOnHost,\n\t\t\tContainer: c.ContainerID(),\n\t\t\tCtrDevName: device.Path,\n\t\t}\n\t\tif device.Type != \"c\" {\n\t\t\tdevType, err := types.GetDeviceType(device.PathOnHost)\n\t\t\tif err != nil {\n\t\t\t\tretErr = append(retErr, err)\n\t\t\t\tconfig.UpdateDevice(device, false)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif devType == \"disk\" {\n\t\t\t\tudevdCtrl.AddRule(r)\n\t\t\t}\n\t\t}\n\t\t// Do not insert device and update cgroup when:\n\t\t// 1. update-config-only flag is set\n\t\t// 2. container isn't running (pid==0)\n\t\tif !opts.UpdateConfigOnly && c.Pid() > 0 && c.CheckPidExist() {\n\t\t\t// add device to container.\n\t\t\tif err = driver.AddDevice(pid, device, opts.Force); err != nil {\n\t\t\t\tretErr = append(retErr, err)\n\t\t\t\t// roll back config and udev rules\n\t\t\t\tconfig.UpdateDevice(device, false)\n\t\t\t\tudevdCtrl.RemoveRule(r)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// update cgroup access permission.\n\t\t\tif err = UpdateCgroupPermission(cgroupPath, device, true); err != nil {\n\t\t\t\tretErr = append(retErr, err)\n\t\t\t\t// roll back config and udev rules and remove device\n\t\t\t\tdriver.RemoveDevice(pid, device)\n\t\t\t\tconfig.UpdateDevice(device, false)\n\t\t\t\tudevdCtrl.RemoveRule(r)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\tfmt.Fprintf(os.Stdout, \"Add device (%s) to container(%s,%s) done.\\n\", device.PathOnHost, c.Name(), device.Path)\n\t\tlogrus.Infof(\"Add device (%s) to container(%s,%s) done\", device.PathOnHost, c.Name(), device.Path)\n\t}\n\n\tif err := updateQos(config, pid, innerPath, opts); err != nil {\n\t\treturn err\n\t}\n\n\tif len(retErr) == 0 {\n\t\treturn nil\n\t}\n\tfor i := 0; i < len(retErr); i++ {\n\t\tretErr[i] = fmt.Errorf(\"%s\", retErr[i].Error())\n\t}\n\treturn errors.New(strings.Trim(fmt.Sprint(retErr), \"[]\"))\n}", "title": "" }, { "docid": "a8c12a75337e859e2b316bfc297ce7da", "score": "0.47154626", "text": "func (spec *CDISpec) AddDevice(name string, devices []*Device) {\n\tspec.CDIDevices = append(spec.CDIDevices,\n\t\t&CDIDevice{\n\t\t\tName: name,\n\t\t\tContainerSpec: &ContainerDevices{\n\t\t\t\tDevices: devices,\n\t\t\t},\n\t\t})\n\tspec.ContainerSpec.Devices = append(spec.ContainerSpec.Devices, devices...)\n}", "title": "" }, { "docid": "cf237f683eceea6c70cb72318bd0fa55", "score": "0.46884045", "text": "func (r *RecordConfig) MergeToTarget() {\n\tif r.CombinedTarget {\n\t\tpm := strings.Join([]string{\"MergeToTarget: Already collapsed: \", r.Name, r.Target}, \" \")\n\t\tpanic(pm)\n\t}\n\n\t// Merge \"extra\" fields into the Target.\n\tr.Target = r.Content()\n\n\t// Zap any fields that may have been merged.\n\tr.MxPreference = 0\n\tr.SrvPriority = 0\n\tr.SrvWeight = 0\n\tr.SrvPort = 0\n\tr.CaaFlag = 0\n\tr.CaaTag = \"\"\n\n\tr.CombinedTarget = true\n}", "title": "" }, { "docid": "2bb768ca6ead30dd2389a1facf383fb3", "score": "0.46876305", "text": "func (s securityGroupsIDsOrConfigTransformer) Transformer(typ reflect.Type) func(dst, src reflect.Value) error {\n\tif typ != reflect.TypeOf(SecurityGroupsIDsOrConfig{}) {\n\t\treturn nil\n\t}\n\n\treturn func(dst, src reflect.Value) error {\n\t\tdstStruct, srcStruct := dst.Interface().(SecurityGroupsIDsOrConfig), src.Interface().(SecurityGroupsIDsOrConfig)\n\n\t\tif !srcStruct.AdvancedConfig.isEmpty() {\n\t\t\tdstStruct.IDs = nil\n\t\t}\n\n\t\tif srcStruct.IDs != nil {\n\t\t\tdstStruct.AdvancedConfig = SecurityGroupsConfig{}\n\t\t}\n\n\t\tif dst.CanSet() { // For extra safety to prevent panicking.\n\t\t\tdst.Set(reflect.ValueOf(dstStruct))\n\t\t}\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "69e737f9178ca48fcfd52e5073b67c6a", "score": "0.468536", "text": "func (t efsVolumeConfigurationTransformer) Transformer(typ reflect.Type) func(dst, src reflect.Value) error {\n\tif typ != reflect.TypeOf(EFSVolumeConfiguration{}) {\n\t\treturn nil\n\t}\n\treturn func(dst, src reflect.Value) error {\n\t\tdstStruct, srcStruct := dst.Interface().(EFSVolumeConfiguration), src.Interface().(EFSVolumeConfiguration)\n\t\tif !srcStruct.EmptyUIDConfig() {\n\t\t\tdstStruct.unsetBYOConfig()\n\t\t}\n\n\t\tif !srcStruct.EmptyBYOConfig() {\n\t\t\tdstStruct.unsetUIDConfig()\n\t\t}\n\n\t\tif dst.CanSet() { // For extra safety to prevent panicking.\n\t\t\tdst.Set(reflect.ValueOf(dstStruct))\n\t\t}\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "b26aeb7b31bf71b02876696fca3eafd2", "score": "0.46733087", "text": "func convertDevice(d Device) types.Device {\n\tcomponents := make(map[string]types.Component)\n\tfor id, serverComponent := range d.Components {\n\t\tcomp, err := convertComponent(serverComponent)\n\t\tif err != nil {\n\t\t\tLog.Warn(err.Error())\n\t\t\tcontinue\n\t\t}\n\t\tcomponents[id] = comp\n\t}\n\n\treturn types.Device{\n\t\tComponents: components,\n\t}\n}", "title": "" }, { "docid": "c6cab8f57bdf183a6893be9cf6b5c0e5", "score": "0.46691036", "text": "func TestComplexComposition_Dev_Failure(t *testing.T) {\n\tth := kusttest_test.NewKustTestHarness(t, \"/app/dev\")\n\twriteStatefulSetBase(th)\n\twritePatchingOverlays(th)\n\tth.WriteK(\"/app/dev\", `\nresources:\n- ../storage\n- ../config\n`)\n\n\t_, err := th.MakeKustTarget().MakeCustomizedResMap()\n\tif err == nil {\n\t\tt.Fatalf(\"Expected resource accumulation error\")\n\t}\n\tif !strings.Contains(\n\t\terr.Error(), \"already registered id: apps_v1_StatefulSet|~X|my-sts\") {\n\t\tt.Fatalf(\"Unexpected err: %v\", err)\n\t}\n\n\t// Expected Output\n\tconst devMergeResult = `\napiVersion: v1\ndata:\n MY_ENV: foo\nkind: ConfigMap\nmetadata:\n name: my-config\n---\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n name: my-sts\nspec:\n serviceName: my-svc\n selector:\n matchLabels:\n app: my-app\n template:\n metadata:\n labels:\n app: my-app\n spec:\n containers:\n - name: app\n image: my-image\n envFrom:\n - configMapRef:\n name: my-config\n volumeClaimTemplates:\n - spec:\n storageClassName: my-sc\n `\n}", "title": "" }, { "docid": "e8085650fb3200d49a160ecee817c020", "score": "0.4625701", "text": "func (t *TransformerConfig) Merge(input *TransformerConfig) *TransformerConfig {\n\tmerged := &TransformerConfig{}\n\tmerged.NamePrefix = append(t.NamePrefix, input.NamePrefix...)\n\tmerged.NameSpace = append(t.NameSpace, input.NameSpace...)\n\tmerged.CommonAnnotations = append(t.CommonAnnotations, input.CommonAnnotations...)\n\tmerged.CommonLabels = append(t.CommonLabels, input.CommonLabels...)\n\tmerged.VarReference = append(t.VarReference, input.VarReference...)\n\tmerged.NameReference = mergeNameReferencePathConfigs(t.NameReference, input.NameReference)\n\treturn merged\n}", "title": "" }, { "docid": "9b0098f078e224357b4d4b480c02cc70", "score": "0.46215484", "text": "func TestMergeSpecOverride(t *testing.T) {\n\tdefaultSpec := &pod.PodSpec{\n\t\tContainers: []*pod.ContainerSpec{\n\t\t\t{\n\t\t\t\tResource: &pod.ResourceSpec{\n\t\t\t\t\tCpuLimit: 0.8,\n\t\t\t\t\tMemLimitMb: 800,\n\t\t\t\t\tDiskLimitMb: 1500,\n\t\t\t\t\tFdLimit: 1000,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tController: false,\n\t}\n\tinstanceSpec := &pod.PodSpec{\n\t\tContainers: []*pod.ContainerSpec{\n\t\t\t{\n\t\t\t\tResource: &pod.ResourceSpec{\n\t\t\t\t\tCpuLimit: 1,\n\t\t\t\t\tMemLimitMb: 100,\n\t\t\t\t\tDiskLimitMb: 2000,\n\t\t\t\t\tFdLimit: 3000,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tController: true,\n\t}\n\n\tassert.Equal(t,\n\t\tinstanceSpec.Containers[0].Resource,\n\t\tMergePodSpec(defaultSpec, instanceSpec).Containers[0].Resource,\n\t)\n\tassert.Equal(t,\n\t\tinstanceSpec.Controller,\n\t\tMergePodSpec(defaultSpec, instanceSpec).Controller,\n\t)\n}", "title": "" }, { "docid": "964eca5ad11d007265cd09ec758c6baa", "score": "0.4616117", "text": "func (t unionTransformer) Transformer(typ reflect.Type) func(dst, src reflect.Value) error {\n\t// :sweat_smile: https://github.com/golang/go/issues/54393\n\t// reflect currently doesn't have support for getting type parameters\n\t// or checking if a type is a non-specific instantiation of a generic type\n\t// (i.e., no way to tell if the type Union[string, bool] is a Union)\n\tisUnion := strings.HasPrefix(typ.String(), unionPrefix)\n\tif !isUnion {\n\t\treturn nil\n\t}\n\n\treturn func(dst, src reflect.Value) (err error) {\n\t\tdefer func() {\n\t\t\t// should realistically never happen unless Union type code has been\n\t\t\t// refactored to change functions called via reflection.\n\t\t\tif r := recover(); r != nil {\n\t\t\t\terr = fmt.Errorf(\"override union: %v\", r)\n\t\t\t}\n\t\t}()\n\n\t\tisBasic := src.MethodByName(\"IsBasic\").Call(nil)[0].Bool()\n\t\tisAdvanced := src.MethodByName(\"IsAdvanced\").Call(nil)[0].Bool()\n\n\t\t// Call SetType with the correct type based on src's type.\n\t\t// We use the value from dst because it holds the merged value.\n\t\tif isBasic {\n\t\t\tif dst.CanAddr() {\n\t\t\t\tdst.Addr().MethodByName(\"SetBasic\").Call([]reflect.Value{dst.FieldByName(\"Basic\")})\n\t\t\t}\n\t\t} else if isAdvanced {\n\t\t\tif dst.CanAddr() {\n\t\t\t\tdst.Addr().MethodByName(\"SetAdvanced\").Call([]reflect.Value{dst.FieldByName(\"Advanced\")})\n\t\t\t}\n\t\t}\n\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "8e39efb0702cfb0c01fe2d9f736df49e", "score": "0.46072516", "text": "func (d *unixCommon) Register() error {\n\t// Don't register for hot plug events if the device is required.\n\tif d.isRequired() {\n\t\treturn nil\n\t}\n\n\t// Extract variables needed to run the event hook so that the reference to this device\n\t// struct is not needed to be kept in memory.\n\tdevicesPath := d.inst.DevicesPath()\n\tdevConfig := d.config\n\tdeviceName := d.name\n\tstate := d.state\n\n\t// Handler for when a Unix event occurs.\n\tf := func(e UnixEvent) (*deviceConfig.RunConfig, error) {\n\t\t// Check if the event is for a device file that this device wants.\n\t\tif unixDeviceSourcePath(devConfig) != e.Path {\n\t\t\treturn nil, nil\n\t\t}\n\n\t\t// Derive the host side path for the instance device file.\n\t\tourPrefix := deviceJoinPath(\"unix\", deviceName)\n\t\trelativeDestPath := strings.TrimPrefix(unixDeviceDestPath(devConfig), \"/\")\n\t\tdevName := filesystem.PathNameEncode(deviceJoinPath(ourPrefix, relativeDestPath))\n\t\tdevPath := filepath.Join(devicesPath, devName)\n\n\t\trunConf := deviceConfig.RunConfig{}\n\n\t\tif e.Action == \"add\" {\n\t\t\t// Skip if host side instance device file already exists.\n\t\t\tif shared.PathExists(devPath) {\n\t\t\t\treturn nil, nil\n\t\t\t}\n\n\t\t\t// Get the file type and ensure it matches what the user was expecting.\n\t\t\tdType, _, _, err := unixDeviceAttributes(e.Path)\n\t\t\tif err != nil {\n\t\t\t\tif os.IsNotExist(err) {\n\t\t\t\t\t// Skip if host side source device doesn't exist.\n\t\t\t\t\t// This could be an event for the parent directory being added.\n\t\t\t\t\treturn nil, nil\n\t\t\t\t}\n\n\t\t\t\treturn nil, fmt.Errorf(\"Failed getting device attributes: %w\", err)\n\t\t\t}\n\n\t\t\tif !unixIsOurDeviceType(d.config, dType) {\n\t\t\t\treturn nil, fmt.Errorf(\"Path specified is not a %s device\", d.config[\"type\"])\n\t\t\t}\n\n\t\t\terr = unixDeviceSetup(state, devicesPath, \"unix\", deviceName, devConfig, true, &runConf)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t} else if e.Action == \"remove\" {\n\t\t\t// Skip if host side instance device file doesn't exist.\n\t\t\tif !shared.PathExists(devPath) {\n\t\t\t\treturn nil, nil\n\t\t\t}\n\n\t\t\terr := unixDeviceRemove(devicesPath, \"unix\", deviceName, relativeDestPath, &runConf)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\t// Add a post hook function to remove the specific USB device file after unmount.\n\t\t\trunConf.PostHooks = []func() error{func() error {\n\t\t\t\terr := unixDeviceDeleteFiles(state, devicesPath, \"unix\", deviceName, relativeDestPath)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"Failed to delete files for device '%s': %w\", deviceName, err)\n\t\t\t\t}\n\n\t\t\t\treturn nil\n\t\t\t}}\n\t\t}\n\n\t\treturn &runConf, nil\n\t}\n\n\t// Register the handler function against the device's source path.\n\tsubPath := unixDeviceSourcePath(devConfig)\n\terr := unixRegisterHandler(d.state, d.inst, d.name, subPath, f)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "864083e08859259ef2b164fe3af99cc9", "score": "0.45706168", "text": "func MergeSpecOntoCaps(caps map[string]interface{}, spec Spec) Spec {\n\tnewSpec := Spec{}\n\tif spec.OSSCaps != nil {\n\t\tnewSpec.OSSCaps = Merge(caps, spec.OSSCaps)\n\t}\n\tif spec.Always == nil && spec.First == nil {\n\t\treturn newSpec\n\t}\n\n\t// No key is allowed to appear in both alwaysMatch and firstMatch. Any key in\n\t// caps that is present in ANY of the firstMatch maps must be merged into each\n\t// firstMatch map, rather than into the alwaysMatch map.\n\tfirstMatchKeys := map[string]bool{}\n\tfor _, f := range spec.First {\n\t\tfor fk := range f {\n\t\t\tfirstMatchKeys[fk] = true\n\t\t}\n\t}\n\talwaysMerge := map[string]interface{}{}\n\tfirstMerge := map[string]interface{}{}\n\tfor k, v := range caps {\n\t\tif firstMatchKeys[k] {\n\t\t\tfirstMerge[k] = v\n\t\t} else {\n\t\t\talwaysMerge[k] = v\n\t\t}\n\t}\n\tnewSpec.Always = Merge(alwaysMerge, spec.Always)\n\tfor _, f := range spec.First {\n\t\tnewSpec.First = append(newSpec.First, Merge(firstMerge, f))\n\t}\n\treturn newSpec\n}", "title": "" }, { "docid": "a08b4533b80ac45d68ecde69adb0af18", "score": "0.45620593", "text": "func MergeRaw(rsc []io.ReadSeeker, w io.Writer, conf *model.Configuration) error {\n\n\tif rsc == nil {\n\t\treturn errors.New(\"pdfcpu: MergeRaw: missing rsc\")\n\t}\n\n\tif w == nil {\n\t\treturn errors.New(\"pdfcpu: MergeRaw: missing w\")\n\t}\n\n\tif conf == nil {\n\t\tconf = model.NewDefaultConfiguration()\n\t}\n\tconf.Cmd = model.MERGECREATE\n\tconf.ValidationMode = model.ValidationRelaxed\n\tconf.CreateBookmarks = false\n\n\tctxDest, _, _, err := readAndValidate(rsc[0], conf, time.Now())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tctxDest.EnsureVersionForWriting()\n\n\tfor i, f := range rsc[1:] {\n\t\tif err = appendTo(f, strconv.Itoa(i), ctxDest); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif err = OptimizeContext(ctxDest); err != nil {\n\t\treturn err\n\t}\n\n\treturn WriteContext(ctxDest, w)\n}", "title": "" }, { "docid": "b065230e65d23631ba66d41ac4dc6a24", "score": "0.4559932", "text": "func (serie *Serie) PopulateDeviceField() {\n\tif !serie.hasDeviceTag() {\n\t\treturn\n\t}\n\t// make a copy of the tags array. Otherwise the underlying array won't have\n\t// the device tag for the Nth iteration (N>1), and the deice field will\n\t// be lost\n\tfilteredTags := make([]string, 0, serie.Tags.Len())\n\n\tserie.Tags.ForEach(func(tag string) {\n\t\tif strings.HasPrefix(tag, \"device:\") {\n\t\t\tserie.Device = tag[7:]\n\t\t} else {\n\t\t\tfilteredTags = append(filteredTags, tag)\n\t\t}\n\t})\n\n\tserie.Tags = tagset.CompositeTagsFromSlice(filteredTags)\n}", "title": "" }, { "docid": "568de6206a5cfcb3b9d997afabb1d929", "score": "0.4524856", "text": "func (r *Reconciler) transform(ctx context.Context, manifest *mf.Manifest, comp v1alpha1.TektonComponent) error {\n\tinstance := comp.(*v1alpha1.TektonChain)\n\tchainImages := common.ToLowerCaseKeys(common.ImagesFromEnv(common.ChainsImagePrefix))\n\textra := []mf.Transformer{\n\t\tcommon.InjectOperandNameLabelOverwriteExisting(v1alpha1.OperandTektoncdChains),\n\t\tcommon.DeploymentImages(chainImages),\n\t\tcommon.AddConfiguration(instance.Spec.Config),\n\t\tcommon.AddConfigMapValues(ChainsConfig, instance.Spec.Chain.ChainProperties),\n\t\tcommon.AddDeploymentRestrictedPSA(),\n\t\tAddControllerEnv(instance.Spec.Chain.ControllerEnvs),\n\t}\n\textra = append(extra, r.extension.Transformers(instance)...)\n\treturn common.Transform(ctx, manifest, instance, extra...)\n}", "title": "" }, { "docid": "127a07aa9b9410b5166948bf3a342430", "score": "0.45225942", "text": "func (rc *RequiredComponent) Merge(in *RequiredComponent) *RequiredComponent {\n\trc.IsRequired = merge(rc.IsRequired, in.IsRequired)\n\trc.Containers = mergeSlices(rc.Containers, in.Containers)\n\treturn rc\n}", "title": "" }, { "docid": "3e9186e60c33068516a40d5babd89971", "score": "0.45120558", "text": "func (t sliceTransformer) Transformer(typ reflect.Type) func(dst, src reflect.Value) error {\n\tif typ == reflect.TypeOf([]EnvironmentConfig{}) {\n\t\treturn func(dst, src reflect.Value) error {\n\t\t\td := dst.Interface().([]EnvironmentConfig)\n\t\t\ts := src.Interface().([]EnvironmentConfig)\n\t\t\tif dst.CanSet() {\n\t\t\t\tfor i, v := range s {\n\t\t\t\t\tif i > len(d)-1 {\n\t\t\t\t\t\td = append(d, v)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tnv := v\n\t\t\t\t\t\terr := mergo.Merge(&d[i], &nv, mergo.WithOverride)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\treturn errors.Wrap(err, \"error merging EnvironmentConfig slices\")\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tdst.Set(reflect.ValueOf(d))\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\t}\n\tif typ == reflect.TypeOf([]StorageConfig{}) {\n\t\treturn func(dst, src reflect.Value) error {\n\t\t\td := dst.Interface().([]StorageConfig)\n\t\t\ts := src.Interface().([]StorageConfig)\n\t\t\tif dst.CanSet() {\n\t\t\t\tfor i, v := range s {\n\t\t\t\t\tif len(d) > 0 {\n\t\t\t\t\t\td = append(d, v)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tnv := v\n\t\t\t\t\t\terr := mergo.Merge(&d[i], &nv, mergo.WithOverride)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\treturn errors.Wrap(err, \"error merging StorageConfig slices\")\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tdst.Set(reflect.ValueOf(d))\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0f7637f6f310d62db69a8eae12811fcc", "score": "0.4499141", "text": "func (h *MutatingHandler) Mutate(obj *v1alpha2.ApplicationConfiguration) error {\n\tmutatelog.Info(\"mutate\", \"name\", obj.Name)\n\n\tfor compIdx, comp := range obj.Spec.Components {\n\t\tvar updated bool\n\t\tfor idx, tr := range comp.Traits {\n\t\t\tvar content map[string]interface{}\n\t\t\tif err := json.Unmarshal(tr.Trait.Raw, &content); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\trawByte, mutated, err := h.mutateTrait(content, comp.ComponentName)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif !mutated {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\ttr.Trait.Raw = rawByte\n\t\t\tcomp.Traits[idx] = tr\n\t\t\tupdated = true\n\t\t}\n\t\tif updated {\n\t\t\tobj.Spec.Components[compIdx] = comp\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "bdaa819a4c4df1be9979b22e8cf676d3", "score": "0.44879398", "text": "func (s *Service) Merge(ctx context.Context, name string, version string, merge *Service, diff *[]*registry.Result) error {\r\n\t// Unmarshal service\r\n\ts1, err := getService(nil, name, version, s.Raw)\r\n\tif err != nil {\r\n\t\treturn errors.Wrap(err, \"Could not get destination service\")\r\n\t}\r\n\r\n\ts2, err := getService(ctx, name, version, merge.Raw)\r\n\tif err != nil {\r\n\t\treturn errors.Wrap(err, \"Could not get source service\")\r\n\t}\r\n\r\n\t// Has the service changed\r\n\tchanged := false\r\n\tcount := len(s1.Nodes)\r\n\r\n\t// If s2 is more recent than s1 then replace meta data\r\n\tif s.Mod <= merge.Mod {\r\n\t\ts1.Name = s2.Name\r\n\t\ts1.Version = s2.Version\r\n\t\ts1.Endpoints = s2.Endpoints\r\n\t\ts1.Metadata = s2.Metadata\r\n\r\n\t\tchanged = true\r\n\t}\r\n\r\n\t// For each node in service\r\n\tfor id, n2 := range merge.Nodes {\r\n\t\tn1, ok := s.Nodes[id]\r\n\t\tif !ok {\r\n\t\t\ts.Nodes[id] = n2\r\n\t\t\tn1 = n2\r\n\t\t}\r\n\r\n\t\t// If n2 is newer than n1 then replace meta data\r\n\t\tif n1.Mod <= n2.Mod {\r\n\t\t\tn1.Enabled = n2.Enabled\r\n\t\t\tn1.Mod = n2.Mod\r\n\t\t\tn1.Expiry = n2.Expiry\r\n\t\t\tchanged = true\r\n\r\n\t\t\ti, node1 := NodeByID(s1.Nodes, id)\r\n\t\t\t_, node2 := NodeByID(s2.Nodes, id)\r\n\r\n\t\t\t// If non existent then insert\r\n\t\t\tif i == -1 && n2.Enabled {\r\n\t\t\t\ts1.Nodes = append(s1.Nodes, node2)\r\n\t\t\t\tcontinue\r\n\t\t\t} else if i != -1 {\r\n\t\t\t\t// If enabled replace node meta data, else delete\r\n\t\t\t\tif n2.Enabled {\r\n\t\t\t\t\tnode1.Address = node2.Address\r\n\t\t\t\t\tnode1.Metadata = node2.Metadata\r\n\t\t\t\t\tnode1.Port = node2.Port\r\n\t\t\t\t} else {\r\n\t\t\t\t\ts1.Nodes = append(s1.Nodes[:i], s1.Nodes[i+1:]...)\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tif changed {\r\n\t\tif len(s1.Nodes) == 0 && count != 0 {\r\n\t\t\t*diff = append(*diff, &registry.Result{\r\n\t\t\t\tAction: \"delete\",\r\n\t\t\t\tService: s1,\r\n\t\t\t})\r\n\t\t} else if count == 0 {\r\n\t\t\t*diff = append(*diff, &registry.Result{\r\n\t\t\t\tAction: \"create\",\r\n\t\t\t\tService: s1,\r\n\t\t\t})\r\n\t\t} else {\r\n\t\t\t*diff = append(*diff, &registry.Result{\r\n\t\t\t\tAction: \"update\",\r\n\t\t\t\tService: s1,\r\n\t\t\t})\r\n\t\t}\r\n\t}\r\n\r\n\t// Marshal service and store\r\n\traw, err := msgpack.Marshal(s1)\r\n\tif err != nil {\r\n\t\treturn errors.Wrap(err, \"Error marshaling merged service\")\r\n\t}\r\n\r\n\t// Update state\r\n\ts.Raw = raw\r\n\r\n\t// Return\r\n\treturn nil\r\n}", "title": "" }, { "docid": "9ad0e74191c907992dc9c76ca7fab7ac", "score": "0.44778588", "text": "func PatchDevice(dto dtos.UpdateDevice, ctx context.Context, dic *di.Container) errors.EdgeX {\n\tdbClient := container.DBClientFrom(dic.Get)\n\tlc := bootstrapContainer.LoggingClientFrom(dic.Get)\n\n\t// Check the existence of device service before device validation\n\tif dto.ServiceName != nil {\n\t\texists, edgeXerr := dbClient.DeviceServiceNameExists(*dto.ServiceName)\n\t\tif edgeXerr != nil {\n\t\t\treturn errors.NewCommonEdgeX(errors.Kind(edgeXerr), fmt.Sprintf(\"device service '%s' existence check failed\", *dto.ServiceName), edgeXerr)\n\t\t} else if !exists {\n\t\t\treturn errors.NewCommonEdgeX(errors.KindContractInvalid, fmt.Sprintf(\"device service '%s' does not exists\", *dto.ServiceName), nil)\n\t\t}\n\t}\n\n\tdevice, err := deviceByDTO(dbClient, dto)\n\tif err != nil {\n\t\treturn errors.NewCommonEdgeXWrapper(err)\n\t}\n\n\t// Old service name is used for invoking callback\n\tvar oldServiceName string\n\tif dto.ServiceName != nil && *dto.ServiceName != device.ServiceName {\n\t\toldServiceName = device.ServiceName\n\t}\n\n\trequests.ReplaceDeviceModelFieldsWithDTO(&device, dto)\n\n\tdeviceDTO := dtos.FromDeviceModelToDTO(device)\n\terr = validateDeviceCallback(deviceDTO, dic)\n\tif err != nil {\n\t\treturn errors.NewCommonEdgeXWrapper(err)\n\t}\n\n\terr = dbClient.UpdateDevice(device)\n\tif err != nil {\n\t\treturn errors.NewCommonEdgeXWrapper(err)\n\t}\n\n\t// If device is successfully updated, check each AutoEvent interval value and display a warning if it's smaller than the suggested 10ms value\n\tfor _, autoEvent := range device.AutoEvents {\n\t\tutils.CheckMinInterval(autoEvent.Interval, minAutoEventInterval, lc)\n\t}\n\n\tlc.Debugf(\n\t\t\"Device patched on DB successfully. Correlation-ID: %s \",\n\t\tcorrelation.FromContext(ctx),\n\t)\n\n\tif oldServiceName != \"\" {\n\t\tgo publishSystemEvent(common.DeviceSystemEventType, common.SystemEventActionUpdate, oldServiceName, deviceDTO, ctx, dic)\n\t}\n\n\tgo publishSystemEvent(common.DeviceSystemEventType, common.SystemEventActionUpdate, device.ServiceName, deviceDTO, ctx, dic)\n\n\treturn nil\n}", "title": "" }, { "docid": "d8fac59fb777fea5b74f983330332fc6", "score": "0.446729", "text": "func (f *FilesApp) FormatDevice() uiauto.Action {\n\treturn uiauto.Combine(\"FormatDevice\",\n\t\tf.LeftClick(nodewith.Name(\"Format device\").Role(role.Button)),\n\t\tf.WaitUntilExists(nodewith.Name(\"Erase and Format\").Role(role.Button)),\n\t\tf.LeftClick(nodewith.Name(\"Erase and Format\").Role(role.Button)),\n\t)\n}", "title": "" }, { "docid": "422ba0a3bd7107d29069b1d0e4863117", "score": "0.4465511", "text": "func merge(c context.Context, kinds *gce.Kinds, cfgs *gce.Configs) error {\n\tkindsMap := kinds.Map()\n\tfor _, cfg := range cfgs.Vms {\n\t\tif cfg.GetKind() != \"\" {\n\t\t\tk, ok := kindsMap[cfg.Kind]\n\t\t\tif !ok {\n\t\t\t\treturn errors.Reason(\"unknown kind %q\", cfg.Kind).Err()\n\t\t\t}\n\t\t\t// Merge the config's attributes into a copy of the kind's.\n\t\t\t// This ensures the config's attributes overwrite the kind's.\n\t\t\tattrs := proto.Clone(k.Attributes).(*gce.VM)\n\t\t\t// By default, proto.Merge concatenates repeated field values.\n\t\t\t// Instead, make repeated fields in the config override the kind.\n\t\t\tif len(cfg.Attributes.Disk) > 0 {\n\t\t\t\tattrs.Disk = nil\n\t\t\t}\n\t\t\tproto.Merge(attrs, cfg.Attributes)\n\t\t\tcfg.Attributes = attrs\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "718cfa73fc58494bc85278c55e9278f3", "score": "0.4453469", "text": "func CompareDevices(base, new StaticDevice) (diff StaticDevice, merged StaticDevice, changes bool, err *nerr.E) {\n\n\t//base is our base\n\tmerged = base\n\n\t//common fields\n\tif new.UpdateTimes[\"deviceID\"].After(base.UpdateTimes[\"deviceID\"]) {\n\t\tdiff.DeviceID, merged.DeviceID, changes = compareString(base.DeviceID, new.DeviceID, changes)\n\t}\n\tif new.UpdateTimes[\"alerting\"].After(base.UpdateTimes[\"alerting\"]) {\n\t\tdiff.Alerting, merged.Alerting, changes = compareBool(base.Alerting, new.Alerting, changes)\n\t}\n\n\tif new.UpdateTimes[\"notifications-suppressed\"].After(base.UpdateTimes[\"notifications-suppressed\"]) {\n\t\tdiff.NotificationsSuppressed, merged.NotificationsSuppressed, changes = compareBool(base.NotificationsSuppressed, new.NotificationsSuppressed, changes)\n\t}\n\tif new.UpdateTimes[\"building\"].After(base.UpdateTimes[\"building\"]) {\n\t\tdiff.Building, merged.Building, changes = compareString(base.Building, new.Building, changes)\n\t}\n\tif new.UpdateTimes[\"room\"].After(base.UpdateTimes[\"room\"]) {\n\t\tdiff.Room, merged.Room, changes = compareString(base.Room, new.Room, changes)\n\t}\n\tif new.UpdateTimes[\"hostname\"].After(base.UpdateTimes[\"hostname\"]) {\n\t\tdiff.Hostname, merged.Hostname, changes = compareString(base.Hostname, new.Hostname, changes)\n\t}\n\n\tif new.UpdateTimes[\"device-name\"].After(base.UpdateTimes[\"device-name\"]) {\n\t\tdiff.DeviceName, merged.DeviceName, changes = compareString(base.DeviceName, new.DeviceName, changes)\n\t}\n\tif new.UpdateTimes[\"device-class\"].After(base.UpdateTimes[\"device-class\"]) {\n\t\tdiff.DeviceClass, merged.DeviceClass, changes = compareString(base.DeviceClass, new.DeviceClass, changes)\n\t}\n\n\tif new.UpdateTimes[\"device-type\"].After(base.UpdateTimes[\"device-type\"]) {\n\t\tdiff.DeviceType, merged.DeviceType, changes = compareString(base.DeviceType, new.DeviceType, changes)\n\t}\n\n\tif new.UpdateTimes[\"tags\"].After(base.UpdateTimes[\"tags\"]) {\n\t\tdiff.Tags, merged.Tags, changes = compareTags(base.Tags, new.Tags, changes)\n\t}\n\n\t//semi-common fields\n\tif new.UpdateTimes[\"last-heartbeat\"].After(base.UpdateTimes[\"last-heartbeat\"]) {\n\t\tdiff.LastHeartbeat, merged.LastHeartbeat, changes = compareTime(base.LastHeartbeat, new.LastHeartbeat, changes)\n\t}\n\tif new.UpdateTimes[\"last-user-input\"].After(base.UpdateTimes[\"last-user-input\"]) {\n\t\tdiff.LastUserInput, merged.LastUserInput, changes = compareTime(base.LastUserInput, new.LastUserInput, changes)\n\t}\n\tif new.UpdateTimes[\"last-state-received\"].After(base.UpdateTimes[\"last-state-received\"]) {\n\t\tdiff.LastStateReceived, merged.LastStateReceived, changes = compareTime(base.LastStateReceived, new.LastStateReceived, changes)\n\t}\n\tif new.UpdateTimes[\"power\"].After(base.UpdateTimes[\"power\"]) {\n\t\tdiff.Power, merged.Power, changes = compareString(base.Power, new.Power, changes)\n\t}\n\tif new.UpdateTimes[\"active\"].After(base.UpdateTimes[\"active\"]) {\n\t\tdiff.Active, merged.Active, changes = compareString(base.Active, new.Active, changes)\n\t}\n\tif new.UpdateTimes[\"secure\"].After(base.UpdateTimes[\"secure\"]) {\n\t\tdiff.Secure, merged.Secure, changes = compareString(base.Secure, new.Power, changes)\n\t}\n\tif new.UpdateTimes[\"hardware-version\"].After(base.UpdateTimes[\"hardware-version\"]) {\n\t\tdiff.HardwareVersion, merged.HardwareVersion, changes = compareString(base.HardwareVersion, new.HardwareVersion, changes)\n\t}\n\tif new.UpdateTimes[\"software-version\"].After(base.UpdateTimes[\"software-version\"]) {\n\t\tdiff.SoftwareVersion, merged.SoftwareVersion, changes = compareString(base.SoftwareVersion, new.SoftwareVersion, changes)\n\t}\n\tif new.UpdateTimes[\"firmware-version\"].After(base.UpdateTimes[\"firmware-version\"]) {\n\t\tdiff.FirmwareVersion, merged.FirmwareVersion, changes = compareString(base.FirmwareVersion, new.FirmwareVersion, changes)\n\t}\n\tif new.UpdateTimes[\"serial-number\"].After(base.UpdateTimes[\"serial-number\"]) {\n\t\tdiff.SerialNumber, merged.SerialNumber, changes = compareString(base.SerialNumber, new.SerialNumber, changes)\n\t}\n\tif new.UpdateTimes[\"ip-address\"].After(base.UpdateTimes[\"ip-address\"]) {\n\t\tdiff.IPAddress, merged.IPAddress, changes = compareString(base.IPAddress, new.IPAddress, changes)\n\t}\n\tif new.UpdateTimes[\"mac-address\"].After(base.UpdateTimes[\"mac-address\"]) {\n\t\tdiff.MACAddress, merged.MACAddress, changes = compareString(base.MACAddress, new.MACAddress, changes)\n\t}\n\tif new.UpdateTimes[\"dns-address\"].After(base.UpdateTimes[\"dns-address\"]) {\n\t\tdiff.DNSAddress, merged.DNSAddress, changes = compareString(base.DNSAddress, new.DNSAddress, changes)\n\t}\n\tif new.UpdateTimes[\"default-gateway\"].After(base.UpdateTimes[\"default-gateway\"]) {\n\t\tdiff.DefaultGateway, merged.DefaultGateway, changes = compareString(base.DefaultGateway, new.DefaultGateway, changes)\n\t}\n\tif new.UpdateTimes[\"model-name\"].After(base.UpdateTimes[\"model-name\"]) {\n\t\tdiff.ModelName, merged.ModelName, changes = compareString(base.ModelName, new.ModelName, changes)\n\t}\n\n\t//Conrol processor specific fields\n\tif new.UpdateTimes[\"websocket\"].After(base.UpdateTimes[\"websocket\"]) {\n\t\tdiff.Websocket, merged.Websocket, changes = compareString(base.Websocket, new.Websocket, changes)\n\t}\n\tif new.UpdateTimes[\"websocket-count\"].After(base.UpdateTimes[\"websocket-count\"]) {\n\t\tdiff.WebsocketCount, merged.WebsocketCount, changes = compareInt(base.WebsocketCount, new.WebsocketCount, changes)\n\t}\n\n\t//Display specific fields\n\tif new.UpdateTimes[\"blanked\"].After(base.UpdateTimes[\"blanked\"]) {\n\t\tdiff.Blanked, merged.Blanked, changes = compareBool(base.Blanked, new.Blanked, changes)\n\t}\n\tif new.UpdateTimes[\"input\"].After(base.UpdateTimes[\"input\"]) {\n\t\tdiff.Input, merged.Input, changes = compareString(base.Input, new.Input, changes)\n\t}\n\tif new.UpdateTimes[\"lamp-hours\"].After(base.UpdateTimes[\"lamp-hours\"]) {\n\t\tdiff.LampHours, merged.LampHours, changes = compareInt(base.LampHours, new.LampHours, changes)\n\t}\n\tif new.UpdateTimes[\"temperature\"].After(base.UpdateTimes[\"temperature\"]) {\n\t\tdiff.Temperature, merged.Temperature, changes = compareInt(base.Temperature, new.Temperature, changes)\n\t}\n\n\tif new.UpdateTimes[\"active-signal\"].After(base.UpdateTimes[\"active-signal\"]) {\n\t\tdiff.ActiveSignal, merged.ActiveSignal, changes = compareBool(base.ActiveSignal, new.ActiveSignal, changes)\n\t}\n\n\t//Audio Device specific fields\n\tif new.UpdateTimes[\"muted\"].After(base.UpdateTimes[\"muted\"]) {\n\t\tdiff.Muted, merged.Muted, changes = compareBool(base.Muted, new.Muted, changes)\n\t}\n\tif new.UpdateTimes[\"volume\"].After(base.UpdateTimes[\"volume\"]) {\n\t\tdiff.Volume, merged.Volume, changes = compareInt(base.Volume, new.Volume, changes)\n\t}\n\n\t//Microphone specific fields\n\tif new.UpdateTimes[\"battery-charge-bars\"].After(base.UpdateTimes[\"battery-charge-bars\"]) {\n\t\tdiff.BatteryChargeBars, merged.BatteryChargeBars, changes = compareInt(base.BatteryChargeBars, new.BatteryChargeBars, changes)\n\t}\n\tif new.UpdateTimes[\"battery-charge-minutes\"].After(base.UpdateTimes[\"battery-charge-minutes\"]) {\n\t\tdiff.BatteryChargeMinutes, merged.BatteryChargeMinutes, changes = compareInt(base.BatteryChargeMinutes, new.BatteryChargeMinutes, changes)\n\t}\n\tif new.UpdateTimes[\"battery-charge-percentage\"].After(base.UpdateTimes[\"battery-charge-percentage\"]) {\n\t\tdiff.BatteryChargePercentage, merged.BatteryChargePercentage, changes = compareInt(base.BatteryChargePercentage, new.BatteryChargePercentage, changes)\n\t}\n\tif new.UpdateTimes[\"battery-chage-hours-minutes\"].After(base.UpdateTimes[\"battery-chage-hours-minutes\"]) {\n\t\tdiff.BatteryChargeHoursMinutes, merged.BatteryChargeHoursMinutes, changes = compareString(base.BatteryChargeHoursMinutes, new.BatteryChargeHoursMinutes, changes)\n\t}\n\tif new.UpdateTimes[\"battery-cycles\"].After(base.UpdateTimes[\"battery-cycles\"]) {\n\t\tdiff.BatteryCycles, merged.BatteryCycles, changes = compareInt(base.BatteryCycles, new.BatteryCycles, changes)\n\t}\n\tif new.UpdateTimes[\"battery-type\"].After(base.UpdateTimes[\"battery-type\"]) {\n\t\tdiff.BatteryType, merged.BatteryType, changes = compareString(base.BatteryType, new.BatteryType, changes)\n\t}\n\tif new.UpdateTimes[\"microphone-channel\"].After(base.UpdateTimes[\"microphone-channel\"]) {\n\t\tdiff.MicrophoneChannel, merged.MicrophoneChannel, changes = compareString(base.MicrophoneChannel, new.MicrophoneChannel, changes)\n\t}\n\tif new.UpdateTimes[\"interference\"].After(base.UpdateTimes[\"interference\"]) {\n\t\tdiff.Interference, merged.Interference, changes = compareString(base.Interference, new.Interference, changes)\n\t}\n\n\t//Via specific fields\n\tif new.UpdateTimes[\"current-user-count\"].After(base.UpdateTimes[\"current-user-count\"]) {\n\t\tdiff.CurrentUserCount, merged.CurrentUserCount, changes = compareInt(base.CurrentUserCount, new.CurrentUserCount, changes)\n\t}\n\tif new.UpdateTimes[\"presenter-count\"].After(base.UpdateTimes[\"presenter-count\"]) {\n\t\tdiff.PresenterCount, merged.PresenterCount, changes = compareInt(base.PresenterCount, new.PresenterCount, changes)\n\t}\n\n\t//PI Hardware Info fields\n\tif new.UpdateTimes[\"cpu-usage-percent\"].After(base.UpdateTimes[\"cpu-usage-percent\"]) {\n\t\tdiff.CPUUsagePercentage, merged.CPUUsagePercentage, changes = compareFloat64(base.CPUUsagePercentage, new.CPUUsagePercentage, changes)\n\t}\n\tif new.UpdateTimes[\"v-mem-used-percent\"].After(base.UpdateTimes[\"v-mem-used-percent\"]) {\n\t\tdiff.VMemUsage, merged.VMemUsage, changes = compareFloat64(base.VMemUsage, new.VMemUsage, changes)\n\t}\n\tif new.UpdateTimes[\"s-mem-used-percent\"].After(base.UpdateTimes[\"s-mem-used-percent\"]) {\n\t\tdiff.SMemUsage, merged.SMemUsage, changes = compareFloat64(base.SMemUsage, new.SMemUsage, changes)\n\t}\n\tif new.UpdateTimes[\"cpu-thermal0-temp\"].After(base.UpdateTimes[\"cpu-thermal0-temp\"]) {\n\t\tdiff.CPUTemp, merged.CPUTemp, changes = compareFloat64(base.CPUTemp, new.CPUTemp, changes)\n\t}\n\tif new.UpdateTimes[\"writes-to-mmcblk0\"].After(base.UpdateTimes[\"writes-to-mmcblk0\"]) {\n\t\tdiff.DiskWrites, merged.DiskWrites, changes = compareInt(base.DiskWrites, new.DiskWrites, changes)\n\t}\n\tif new.UpdateTimes[\"disk-used-percent\"].After(base.UpdateTimes[\"disk-used-percent\"]) {\n\t\tdiff.DiskUsagePercentage, merged.DiskUsagePercentage, changes = compareFloat64(base.DiskUsagePercentage, new.DiskUsagePercentage, changes)\n\t}\n\tif new.UpdateTimes[\"avg-procs-u-sleep\"].After(base.UpdateTimes[\"avg-procs-u-sleep\"]) {\n\t\tdiff.AverageProcessesSleep, merged.AverageProcessesSleep, changes = compareFloat64(base.AverageProcessesSleep, new.AverageProcessesSleep, changes)\n\t}\n\tif new.UpdateTimes[\"bcm2835_thermal0-temp\"].After(base.UpdateTimes[\"bcm2835_thermal0-temp\"]) {\n\t\tdiff.BroadcomChipTemp, merged.BroadcomChipTemp, changes = compareFloat64(base.BroadcomChipTemp, new.BroadcomChipTemp, changes)\n\t}\n\t//DMPS fields\n\tif new.UpdateTimes[\"status-message\"].After(base.UpdateTimes[\"status-message\"]) {\n\t\tdiff.StatusMessage, merged.StatusMessage, changes = compareString(base.StatusMessage, new.StatusMessage, changes)\n\t}\n\tif new.UpdateTimes[\"transmit-rf-power\"].After(base.UpdateTimes[\"transmit-rf-power\"]) {\n\t\tdiff.TransmitRFPower, merged.TransmitRFPower, changes = compareString(base.TransmitRFPower, new.TransmitRFPower, changes)\n\t}\n\n\t//meta fields\n\tif new.UpdateTimes[\"control\"].After(base.UpdateTimes[\"control\"]) {\n\t\tdiff.Control, merged.Control, changes = compareString(base.Control, new.Control, changes)\n\t}\n\tif new.UpdateTimes[\"enable-notifications\"].After(base.UpdateTimes[\"enable-notifications\"]) {\n\t\tdiff.EnableNotifications, merged.EnableNotifications, changes = compareString(base.EnableNotifications, new.EnableNotifications, changes)\n\t}\n\tif new.UpdateTimes[\"suppress-notifications\"].After(base.UpdateTimes[\"suppress-notifications\"]) {\n\t\tdiff.SuppressNotifications, merged.SuppressNotifications, changes = compareString(base.SuppressNotifications, new.SuppressNotifications, changes)\n\t}\n\tif new.UpdateTimes[\"view-dashboard\"].After(base.UpdateTimes[\"view-dashboard\"]) {\n\t\tdiff.ViewDashboard, merged.ViewDashboard, changes = compareString(base.ViewDashboard, new.ViewDashboard, changes)\n\t}\n\n\tfor k, v := range new.UpdateTimes {\n\t\tif v.After(base.UpdateTimes[k]) {\n\t\t\tmerged.UpdateTimes[k] = v\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "d6912de96aa140cd70456df297491d40", "score": "0.44509587", "text": "func (n noop) Transform(spec *specs.Spec) error {\n\treturn nil\n}", "title": "" }, { "docid": "7023eb24b4d74135d96c0a98f583b5e3", "score": "0.4443337", "text": "func mergeTargetFile(targets []*wrapper, mergeFileName string) *wrapper {\n\tvar mergedTarget *wrapper\n\tfor _, f := range targets {\n\t\tif mergedTarget == nil {\n\t\t\tmergedTarget = &wrapper{\n\t\t\t\tfileName: mergeFileName,\n\t\t\t\tswagger: f.swagger,\n\t\t\t}\n\t\t} else {\n\t\t\tfor k, v := range f.swagger.Definitions {\n\t\t\t\tmergedTarget.swagger.Definitions[k] = v\n\t\t\t}\n\t\t\tfor k, v := range f.swagger.StreamDefinitions {\n\t\t\t\tmergedTarget.swagger.StreamDefinitions[k] = v\n\t\t\t}\n\t\t\tfor k, v := range f.swagger.Paths {\n\t\t\t\tmergedTarget.swagger.Paths[k] = v\n\t\t\t}\n\t\t\tfor k, v := range f.swagger.SecurityDefinitions {\n\t\t\t\tmergedTarget.swagger.SecurityDefinitions[k] = v\n\t\t\t}\n\t\t\tmergedTarget.swagger.Security = append(mergedTarget.swagger.Security, f.swagger.Security...)\n\t\t}\n\t}\n\treturn mergedTarget\n}", "title": "" }, { "docid": "fc0fd81341569fd9e7bb72c9a5596fda", "score": "0.44340447", "text": "func makeDeviceObject(d *schema.ResourceData) (output models.Device) {\n\tvar cid = int32(d.Get(\"collector\").(int))\n\tvar hostgroupID = d.Get(\"hostgroup_id\").(string)\n\tvar name = d.Get(\"ip_addr\").(string)\n\n\t// Device type will default to HOST (0) and optionally be set to SERVICE (6)\n\tvar deviceType = d.Get(\"type\").(string)\n\tvar deviceTypeID int32 = getDeviceTypeID(deviceType)\n\n\t// if displayname is not there, we can automatically add ipaddr\n\tvar displayname = d.Get(\"display_name\").(string)\n\tif displayname == \"\" {\n\t\tdisplayname = name\n\t}\n\n\toutput = models.Device{\n\t\tName: &name,\n\t\tDeviceType: deviceTypeID,\n\t\tDisplayName: &displayname,\n\t\tDisableAlerting: d.Get(\"disable_alerting\").(bool),\n\t\tHostGroupIds: &hostgroupID,\n\t\tPreferredCollectorID: &cid,\n\t\tCustomProperties: getProperties(d),\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "03769411cc5d5f32bebe5650da9f59f6", "score": "0.44274592", "text": "func (t platformArgsOrStringTransformer) Transformer(typ reflect.Type) func(dst, src reflect.Value) error {\n\tif typ != reflect.TypeOf(PlatformArgsOrString{}) {\n\t\treturn nil\n\t}\n\n\treturn func(dst, src reflect.Value) error {\n\t\tdstStruct, srcStruct := dst.Interface().(PlatformArgsOrString), src.Interface().(PlatformArgsOrString)\n\n\t\tif srcStruct.PlatformString != nil {\n\t\t\tdstStruct.PlatformArgs = PlatformArgs{}\n\t\t}\n\n\t\tif !srcStruct.PlatformArgs.isEmpty() {\n\t\t\tdstStruct.PlatformString = nil\n\t\t}\n\n\t\tif dst.CanSet() { // For extra safety to prevent panicking.\n\t\t\tdst.Set(reflect.ValueOf(dstStruct))\n\t\t}\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "595886ea9d55a2675d23dbfede2f76a4", "score": "0.44186205", "text": "func handleMerge(original, patch, dataStruct interface{}) ([]byte, error) {\n\tif reflect.TypeOf(original) != reflect.TypeOf(patch) {\n\t\treturn nil, fmt.Errorf(\"type of original and patch doesn't match\")\n\t}\n\n\toriginalJson, err := json.Marshal(original)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpatchJson, err := json.Marshal(patch)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tmerged, err := strategicpatch.StrategicMergePatch(originalJson, patchJson, dataStruct)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn merged, nil\n}", "title": "" }, { "docid": "ae09073c73466f23e50ca92134086bef", "score": "0.44110444", "text": "func (s *Specification) Merge(that spec.Topology) spec.Topology {\n\tspec := that.(*Specification)\n\treturn &Specification{\n\t\tGlobalOptions: s.GlobalOptions,\n\t\tMonitoredOptions: s.MonitoredOptions,\n\t\tServerConfigs: s.ServerConfigs,\n\t\tMasters: append(s.Masters, spec.Masters...),\n\t\tWorkers: append(s.Workers, spec.Workers...),\n\t\tMonitors: append(s.Monitors, spec.Monitors...),\n\t\tGrafanas: append(s.Grafanas, spec.Grafanas...),\n\t\tAlertmanagers: append(s.Alertmanagers, spec.Alertmanagers...),\n\t}\n}", "title": "" }, { "docid": "58087f97969ff08d8f4a3670c4e02b6e", "score": "0.44081804", "text": "func Merge(m1, m2 *Metadata) (*Metadata, error) {\n\tcapabilities := capabilities.Merge(m1.Capabilities, m2.Capabilities)\n\n\tenvironment := m1.Environment\n\tif m2.Environment != \"\" {\n\t\tenvironment = m2.Environment\n\t}\n\n\tlabel := m1.Label\n\tif m2.Label != \"\" {\n\t\tlabel = m2.Label\n\t}\n\n\tbrowserLabel := m1.BrowserLabel\n\tif m2.BrowserLabel != \"\" {\n\t\tbrowserLabel = m2.BrowserLabel\n\t}\n\n\ttestLabel := m1.TestLabel\n\tif m2.TestLabel != \"\" {\n\t\ttestLabel = m2.TestLabel\n\t}\n\n\tconfigLabel := m1.ConfigLabel\n\tif m2.ConfigLabel != \"\" {\n\t\tconfigLabel = m2.ConfigLabel\n\t}\n\n\tdebuggerPort := m1.DebuggerPort\n\tif m2.DebuggerPort != 0 {\n\t\tdebuggerPort = m2.DebuggerPort\n\t}\n\n\tvar webTestFiles []*WebTestFiles\n\twebTestFiles = append(webTestFiles, m1.WebTestFiles...)\n\twebTestFiles = append(webTestFiles, m2.WebTestFiles...)\n\n\twebTestFiles, err := normalizeWebTestFiles(webTestFiles)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\textension := m1.Extension\n\tif extension == nil {\n\t\textension = m2.Extension\n\t} else if m2.Extension != nil {\n\t\te, err := extension.Merge(m2.Extension)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\textension = e\n\t}\n\n\treturn &Metadata{\n\t\tCapabilities: capabilities,\n\t\tEnvironment: environment,\n\t\tLabel: label,\n\t\tBrowserLabel: browserLabel,\n\t\tTestLabel: testLabel,\n\t\tConfigLabel: configLabel,\n\t\tDebuggerPort: debuggerPort,\n\t\tWebTestFiles: webTestFiles,\n\t\tExtension: extension,\n\t}, nil\n}", "title": "" }, { "docid": "a94741026e68c14b70d3243c3d72d909", "score": "0.43698707", "text": "func (t efsConfigOrBoolTransformer) Transformer(typ reflect.Type) func(dst, src reflect.Value) error {\n\tif typ != reflect.TypeOf(EFSConfigOrBool{}) {\n\t\treturn nil\n\t}\n\treturn func(dst, src reflect.Value) error {\n\t\tdstStruct, srcStruct := dst.Interface().(EFSConfigOrBool), src.Interface().(EFSConfigOrBool)\n\n\t\tif !srcStruct.Advanced.IsEmpty() {\n\t\t\tdstStruct.Enabled = nil\n\t\t}\n\n\t\tif srcStruct.Enabled != nil {\n\t\t\tdstStruct.Advanced = EFSVolumeConfiguration{}\n\t\t}\n\n\t\tif dst.CanSet() { // For extra safety to prevent panicking.\n\t\t\tdst.Set(reflect.ValueOf(dstStruct))\n\t\t}\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "26a257a380da1e01a38889b37e75c49a", "score": "0.43678498", "text": "func (dst *Exec) Merge(src Exec) {\n\tif dst == nil || dst.Name != src.Name {\n\t\treturn\n\t}\n\n\tif src.Enabled != nil {\n\t\tdst.Enabled = src.Enabled\n\t}\n\tif src.Command != \"\" {\n\t\tdst.Command = src.Command\n\t}\n\tif src.Image != \"\" {\n\t\tdst.Image = src.Image\n\t}\n\tif src.Replicas != 0 {\n\t\tdst.Replicas = src.Replicas\n\t}\n\tif src.Port != 0 {\n\t\tdst.Port = src.Port\n\t}\n\tif src.RedinessProbe != \"\" {\n\t\tdst.RedinessProbe = src.RedinessProbe\n\t}\n\tif src.LivenessProbe != \"\" {\n\t\tdst.LivenessProbe = src.LivenessProbe\n\t}\n\tif src.Size != \"\" {\n\t\tdst.Size = src.Size\n\t}\n\n\tif src.Resources != nil && dst.Resources == nil {\n\t\tdst.Resources = new(Resources)\n\t}\n\tdst.Resources.Merge(src.Resources)\n}", "title": "" }, { "docid": "bcc4ec64e1f0556757ffe15f8cdd5d41", "score": "0.43642855", "text": "func (c *ClusterMetadataSpec) Merge(newc ClusterMetadataSpec) bool {\n\t// Allow only intersection of storage classes\n\tnewslice := []string{}\n\tfor _, sc := range c.StorageClasses {\n\t\tif common.IsStringPresent(newc.StorageClasses, sc) {\n\t\t\tnewslice = append(newslice, sc)\n\t\t}\n\t}\n\tc.StorageClasses = newslice\n\t//TODO: Do Intelligent merge of version\n\tapiversionkindmap := map[string][]string{}\n\tfor kindname, gvList := range newc.APIKindVersionMap {\n\t\tif _, ok := c.APIKindVersionMap[kindname]; ok {\n\t\t\tapiversionkindmap[kindname] = gvList\n\t\t}\n\t}\n\tc.APIKindVersionMap = apiversionkindmap\n\tc.Host = newc.Host\n\treturn true\n}", "title": "" }, { "docid": "69a7b3e9d37ca6b9ce490f9790824e26", "score": "0.43585023", "text": "func (bc *BuilderConfig) Merge(bc2 BuilderConfig) {\n\tif bc2.Command != nil {\n\t\tbc.Command = bc2.Command\n\t}\n\n\tif bc2.Requirements != nil {\n\t\tbc.Requirements = bc2.Requirements\n\t}\n}", "title": "" }, { "docid": "0ef106b35d567776f2344adea3bf4cae", "score": "0.43563342", "text": "func createSelectivePatchObjectForTransformer(transformerName, appName string) (types.Patch, error) {\n\t//patchName := \"transformer-\"\n\t//sp := getSelectivePatchTemplate(patchName)\n\tpatchBody := getSelectivePatchTemplateForTransformer(transformerName)\n\tphb, err := yaml.Marshal(patchBody)\n\tif err != nil {\n\t\treturn types.Patch{}, err\n\t}\n\tp1 := types.Patch{\n\t\tPatch: string(phb),\n\t}\n\tp1.Target = &types.Selector{\n\t\tResId: resid.ResId{\n\t\t\tGvk: resid.Gvk{\n\t\t\t\tKind: \"SelectivePatch\",\n\t\t\t},\n\t\t},\n\t\tLabelSelector: \"app=\" + appName + \",key=\" + transformerName,\n\t}\n\treturn p1, nil\n}", "title": "" }, { "docid": "6ddc8be7d61f029170fd9073907458c9", "score": "0.434768", "text": "func (t imageTransformer) Transformer(typ reflect.Type) func(dst, src reflect.Value) error {\n\tif typ != reflect.TypeOf(Image{}) {\n\t\treturn nil\n\t}\n\n\treturn func(dst, src reflect.Value) error {\n\t\tdstStruct, srcStruct := dst.Interface().(Image), src.Interface().(Image)\n\n\t\tif !srcStruct.Build.isEmpty() && srcStruct.Location != nil {\n\t\t\treturn fmt.Errorf(fmtExclusiveFieldsSpecifiedTogether, \"image.build\", \"is\", \"image.location\")\n\t\t}\n\n\t\tif !srcStruct.Build.isEmpty() {\n\t\t\tdstStruct.Location = nil\n\t\t}\n\n\t\tif srcStruct.Location != nil {\n\t\t\tdstStruct.Build = BuildArgsOrString{}\n\t\t}\n\n\t\tif dst.CanSet() { // For extra safety to prevent panicking.\n\t\t\tdst.Set(reflect.ValueOf(dstStruct))\n\t\t}\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "ffcc2d2fce2b8c8dbf10525af09b0e54", "score": "0.43333873", "text": "func SpecGenToOCI(ctx context.Context, s *specgen.SpecGenerator, rt *libpod.Runtime, rtc *config.Config, newImage *libimage.Image, mounts []spec.Mount, pod *libpod.Pod, finalCmd []string, compatibleOptions *libpod.InfraInherit) (*spec.Spec, error) {\n\tg, err := generate.New(\"freebsd\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tg.SetProcessCwd(s.WorkDir)\n\n\tg.SetProcessArgs(finalCmd)\n\n\tg.SetProcessTerminal(s.Terminal)\n\n\tfor key, val := range s.Annotations {\n\t\tg.AddAnnotation(key, val)\n\t}\n\n\tg.ClearProcessEnv()\n\tfor name, val := range s.Env {\n\t\tg.AddProcessEnv(name, val)\n\t}\n\n\taddRlimits(s, &g)\n\n\t// NAMESPACES\n\tif err := specConfigureNamespaces(s, &g, rt, pod); err != nil {\n\t\treturn nil, err\n\t}\n\tconfigSpec := g.Config\n\n\tif err := securityConfigureGenerator(s, &g, newImage, rtc); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// BIND MOUNTS\n\tconfigSpec.Mounts = SupersedeUserMounts(mounts, configSpec.Mounts)\n\t// Process mounts to ensure correct options\n\tif err := InitFSMounts(configSpec.Mounts); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Add annotations\n\tif configSpec.Annotations == nil {\n\t\tconfigSpec.Annotations = make(map[string]string)\n\t}\n\n\tif s.Remove {\n\t\tconfigSpec.Annotations[define.InspectAnnotationAutoremove] = define.InspectResponseTrue\n\t} else {\n\t\tconfigSpec.Annotations[define.InspectAnnotationAutoremove] = define.InspectResponseFalse\n\t}\n\n\tif len(s.VolumesFrom) > 0 {\n\t\tconfigSpec.Annotations[define.InspectAnnotationVolumesFrom] = strings.Join(s.VolumesFrom, \",\")\n\t}\n\n\tif s.Privileged {\n\t\tconfigSpec.Annotations[define.InspectAnnotationPrivileged] = define.InspectResponseTrue\n\t} else {\n\t\tconfigSpec.Annotations[define.InspectAnnotationPrivileged] = define.InspectResponseFalse\n\t}\n\n\tif s.Init {\n\t\tconfigSpec.Annotations[define.InspectAnnotationInit] = define.InspectResponseTrue\n\t} else {\n\t\tconfigSpec.Annotations[define.InspectAnnotationInit] = define.InspectResponseFalse\n\t}\n\n\tif s.OOMScoreAdj != nil {\n\t\tg.SetProcessOOMScoreAdj(*s.OOMScoreAdj)\n\t}\n\n\treturn configSpec, nil\n}", "title": "" }, { "docid": "fcb538f692acfc744fedbd17b4e781e4", "score": "0.43216333", "text": "func (c *DevicesController) AddDevice(ctx *gin.Context) {\n\thelpers.JSONResponseNotImplemented(ctx)\n}", "title": "" }, { "docid": "3f91982ab8c980f69078c9393c0de02c", "score": "0.43210906", "text": "func (c *parsedConfig) updateWithConfigurationFrom(updates *parsedConfig) {\n\t// == Merge Registries:\n\tregistryMap := make(map[string]Registry)\n\tfor i := range c.partialV2.Registries {\n\t\tregistryMap[c.partialV2.Registries[i].Prefix] = c.partialV2.Registries[i]\n\t}\n\t// Merge the freshly loaded registries.\n\tfor i := range updates.partialV2.Registries {\n\t\tregistryMap[updates.partialV2.Registries[i].Prefix] = updates.partialV2.Registries[i]\n\t}\n\n\t// Go maps have a non-deterministic order when iterating the keys, so\n\t// we dump them in a slice and sort it to enforce some order in\n\t// Registries slice. Some consumers of c/image (e.g., CRI-O) log the\n\t// configuration where a non-deterministic order could easily cause\n\t// confusion.\n\tprefixes := maps.Keys(registryMap)\n\tsort.Strings(prefixes)\n\n\tc.partialV2.Registries = []Registry{}\n\tfor _, prefix := range prefixes {\n\t\tc.partialV2.Registries = append(c.partialV2.Registries, registryMap[prefix])\n\t}\n\n\t// == Merge UnqualifiedSearchRegistries:\n\t// This depends on an subtlety of the behavior of the TOML decoder, where a missing array field\n\t// is not modified while unmarshaling (in our case remains to nil), while an [] is unmarshaled\n\t// as a non-nil []string{}.\n\tif updates.partialV2.UnqualifiedSearchRegistries != nil {\n\t\tc.partialV2.UnqualifiedSearchRegistries = updates.partialV2.UnqualifiedSearchRegistries\n\t\tc.unqualifiedSearchRegistriesOrigin = updates.unqualifiedSearchRegistriesOrigin\n\t}\n\n\t// == Merge credential helpers:\n\tif updates.partialV2.CredentialHelpers != nil {\n\t\tc.partialV2.CredentialHelpers = updates.partialV2.CredentialHelpers\n\t}\n\n\t// == Merge shortNameMode:\n\t// We don’t maintain c.partialV2.ShortNameMode.\n\tif updates.shortNameMode != types.ShortNameModeInvalid {\n\t\tc.shortNameMode = updates.shortNameMode\n\t}\n\n\t// == Merge aliasCache:\n\t// We don’t maintain (in fact we actively clear) c.partialV2.shortNameAliasConf.\n\tc.aliasCache.updateWithConfigurationFrom(updates.aliasCache)\n}", "title": "" }, { "docid": "05443e248fab604af4209c3a3bf9cbda", "score": "0.43202987", "text": "func (c DeviceController) Create(resp http.ResponseWriter, req *http.Request, params map[string]string) error {\n\tctx := req.Context()\n\tlog := logger.Get(ctx)\n\tdevice := models.Device{}\n\tlog.Info(\"Start device import\")\n\n\t// Decode the generic model\n\terr := json.NewDecoder(req.Body).Decode(&device)\n\tif err != nil {\n\t\t// If it fails, the json is invalid\n\t\tutils.Err(ctx, resp, http.StatusBadRequest, err.Error())\n\t\tlog.WithError(err).Error(\"Invalid body\")\n\t\treturn nil\n\t}\n\n\tlog = log.WithFields(logrus.Fields{\n\t\t\"type\": device.Type,\n\t\t\"name\": device.Name,\n\t})\n\tctx = logger.ToCtx(ctx, log)\n\n\tlog.Info(\"Load device\")\n\t// Find the device type in the loader\n\tloader, err := devices.GetLoader(device.Type)\n\tif err != nil { // if there was an error while finding the device type\n\t\tif err == devices.ErrTypeNotFound {\n\t\t\t// If the device was not found => Invalid request\n\t\t\tutils.Err(ctx, resp, http.StatusBadRequest, \"invalid device type\")\n\t\t\tlog.WithError(err).Error(\"Invalid device type\")\n\t\t\treturn nil\n\t\t} else {\n\t\t\t// It's another error => 500\n\t\t\treturn errors.Wrap(err, \"fail to get device loader\")\n\t\t}\n\t}\n\n\t// We found a loader for this device\n\tlog.Info(\"Validate\")\n\n\t// Validate the specialized params\n\terr = loader.Validate(device.Params)\n\tif err != nil {\n\t\t// If the validation did not pass => Invalid request (the specialization body is invalid)\n\t\tutils.Err(ctx, resp, http.StatusBadRequest, err.Error())\n\t\treturn nil\n\t}\n\n\tlog.Info(\"Save\")\n\t// If everything checked out store this in the database\n\terr = document.Create(ctx, models.DeviceCollection, &device)\n\tif err != nil {\n\t\tlog.WithError(err).Error(\"Fail to save it\")\n\t\treturn errors.Wrap(err, \"fail to save device\")\n\t}\n\n\t// Create a new context so the device wont be affected by the request (imeouts, etc.)\n\tctx = logger.ToCtx(context.Background(), log)\n\n\tlog.Info(\"Add device to the graph\")\n\t// Add the device to the graph\n\tdev, err := c.graph.Add(ctx, device.ID.Hex())\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"fail to add device\")\n\t}\n\n\tlog.Info(\"Device imported\")\n\tdeviceResp := deviceToDeviceResponse(dev, &device)\n\tutils.JSON(ctx, resp, deviceResp)\n\n\treturn nil\n}", "title": "" }, { "docid": "61989f040f344231eb58daaf327d50ac", "score": "0.4307002", "text": "func (st *MongoStore) Upsert(ctx context.Context, d *api.Device) error {\n\t_, err := st.mc.UpdateOne(ctx,\n\t\tbson.M{\"device_id\": d.Id},\n\t\tbson.M{\"$set\": bson.M{\n\t\t\t\"device_id\": d.Id,\n\t\t\t\"organization_id\": d.OrganizationId,\n\t\t\t\"tz\": d.Tz,\n\t\t\t\"installed_at\": d.InstalledAt,\n\t\t\t\"updated_at\": d.UpdatedAt,\n\t\t}},\n\t\t&options.UpdateOptions{Upsert: &t})\n\treturn err\n}", "title": "" }, { "docid": "b9a4abc1cb70219cd41b03f4c8793b5f", "score": "0.4306066", "text": "func RemoveDevice(c *container.Container, devices []*types.Device, followPartition bool) error {\n\tdriver := nsexec.NewDefaultNsDriver()\n\tpid := strconv.Itoa(c.Pid())\n\n\tinnerPath, err := c.GetCgroupPath()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcgroupPath, err := FindCgroupPath(pid, \"devices\", innerPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := c.Lock(); err != nil {\n\t\treturn err\n\t}\n\tdefer c.Unlock()\n\n\tconfig, err := hconfig.NewContainerConfig(c)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer config.Flush()\n\n\tudevdCtrl := udevd.NewUdevdController()\n\tif err := udevdCtrl.Lock(); err != nil {\n\t\treturn err\n\t}\n\tdefer udevdCtrl.Unlock()\n\n\tif err := udevdCtrl.LoadRules(); err != nil {\n\t\treturn err\n\t}\n\tdefer udevdCtrl.ToDisk()\n\n\tvar retErr []error\n\tvar newDevices []*types.Device\n\tfor _, device := range devices {\n\t\tnewDevice := config.FindDeviceByMapping(device)\n\t\tif newDevice == nil {\n\t\t\terrinfo := fmt.Sprint(\"Device pair(\", device.PathOnHost, \":\", device.Path, \") is not added by syscontainer-tools, can not remove it, please check input parameter.\")\n\t\t\tretErr = append(retErr, errors.New(errinfo))\n\t\t\tcontinue\n\t\t}\n\t\tnewDevices = append(newDevices, newDevice)\n\n\t\tif followPartition {\n\t\t\tsubDevices := config.FindSubPartition(newDevice)\n\t\t\tfor _, subDev := range subDevices {\n\t\t\t\t// check the sub partition is added by syscontainer-tools\n\t\t\t\tif found := config.FindDeviceByMapping(subDev); found == nil {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tfound := false\n\t\t\t\tfor _, eDev := range newDevices {\n\t\t\t\t\tif subDev.Path == eDev.Path && subDev.PathOnHost == eDev.PathOnHost {\n\t\t\t\t\t\tfound = true\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif !found {\n\t\t\t\t\tnewDevices = append(newDevices, subDev)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfor _, device := range newDevices {\n\t\t// update config.\n\t\tif err = config.UpdateDevice(device, false); err != nil {\n\t\t\tretErr = append(retErr, err)\n\t\t\tcontinue\n\t\t}\n\t\tr := &udevd.Rule{\n\t\t\tName: device.PathOnHost,\n\t\t\tCtrDevName: device.Path,\n\t\t\tContainer: c.ContainerID(),\n\t\t}\n\t\tudevdCtrl.RemoveRule(r)\n\n\t\t// only update for running container\n\t\tif c.Pid() > 0 && c.CheckPidExist() {\n\t\t\tif err = driver.RemoveDevice(pid, device); err != nil {\n\t\t\t\tconfig.UpdateDevice(device, true)\n\t\t\t\tif device.Type != \"c\" {\n\t\t\t\t\tdevType, err := types.GetDeviceType(device.PathOnHost)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tretErr = append(retErr, err)\n\t\t\t\t\t\tconfig.UpdateDevice(device, true)\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tif devType == \"disk\" {\n\t\t\t\t\t\tudevdCtrl.AddRule(r)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tretErr = append(retErr, err)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// update cgroup access permission.\n\t\t\tif err = UpdateCgroupPermission(cgroupPath, device, false); err != nil {\n\t\t\t\t// TODO: also need a roll back?\n\t\t\t\tretErr = append(retErr, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\tfmt.Fprintf(os.Stdout, \"Remove device (%s) from container(%s,%s) done.\\n\", device.PathOnHost, c.Name(), device.Path)\n\t\tlogrus.Infof(\"Remove device (%s) from container(%s,%s) done.\\n\", device.PathOnHost, c.Name(), device.Path)\n\n\t\tif err := removeQos(config, pid, innerPath, device); err != nil {\n\t\t\tretErr = append(retErr, err)\n\t\t}\n\t}\n\n\tif len(retErr) == 0 {\n\t\treturn nil\n\t}\n\tfor i := 0; i < len(retErr); i++ {\n\t\tretErr[i] = fmt.Errorf(\"%s\", retErr[i].Error())\n\t}\n\treturn errors.New(strings.Trim(fmt.Sprint(retErr), \"[]\"))\n}", "title": "" }, { "docid": "1061516e7a3e0ebd459f5af6ddc2e057", "score": "0.42688897", "text": "func (t scalingConfigOrTTransformer[T]) Transformer(typ reflect.Type) func(dst, src reflect.Value) error {\n\tif typ != reflect.TypeOf(ScalingConfigOrT[T]{}) {\n\t\treturn nil\n\t}\n\n\treturn func(dst, src reflect.Value) error {\n\t\tdstStruct, srcStruct := dst.Interface().(ScalingConfigOrT[T]), src.Interface().(ScalingConfigOrT[T])\n\n\t\tif !srcStruct.ScalingConfig.IsEmpty() {\n\t\t\tdstStruct.Value = nil\n\t\t}\n\n\t\tif srcStruct.Value != nil {\n\t\t\tdstStruct.ScalingConfig = AdvancedScalingConfig[T]{}\n\t\t}\n\n\t\tif dst.CanSet() { // For extra safety to prevent panicking.\n\t\t\tdst.Set(reflect.ValueOf(dstStruct))\n\t\t}\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "626b916dcff9c0a9d6392e530ff8cb62", "score": "0.42597347", "text": "func (o AppOutput) BuildSpec() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *App) pulumi.StringOutput { return v.BuildSpec }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "ac5f1d2cfff6f9f265f6df45ff1a4b68", "score": "0.42572165", "text": "func (f *Finder) AddDevice(d DeviceInfo) {\n\tisNew := true\n\tif d.MachineID == \"\" {\n\t\tisNew = false\n\t} else {\n\t\tfor _, i := range f.Devices {\n\t\t\tif i.MachineID == d.MachineID {\n\t\t\t\tisNew = false\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\tif isNew {\n\t\tf.Devices = append(f.Devices, d)\n\t}\n}", "title": "" }, { "docid": "2bcdbfe8073ed57d284c8f8d55bf9662", "score": "0.42540348", "text": "func patchApply(ctx context.Context, cli client.Client) error {\n\tpatch := &unstructured.Unstructured{}\n\tpatch.SetGroupVersionKind(schema.GroupVersionKind{\n\t\tGroup: \"apps\",\n\t\tVersion: \"v1\",\n\t\tKind: \"Deployment\",\n\t})\n\tpatch.SetNamespace(\"default\")\n\tpatch.SetName(\"sample2\")\n\tpatch.UnstructuredContent()[\"spec\"] = map[string]interface{}{\n\t\t\"replicas\": 2,\n\t\t\"selector\": map[string]interface{}{\n\t\t\t\"matchLabels\": map[string]string{\n\t\t\t\t\"app\": \"nginx\",\n\t\t\t},\n\t\t},\n\t\t\"template\": map[string]interface{}{\n\t\t\t\"metadata\": map[string]interface{}{\n\t\t\t\t\"labels\": map[string]string{\n\t\t\t\t\t\"app\": \"nginx\",\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"spec\": map[string]interface{}{\n\t\t\t\t\"containers\": []interface{}{\n\t\t\t\t\tmap[string]interface{}{\n\t\t\t\t\t\t\"name\": \"nginx\",\n\t\t\t\t\t\t\"image\": \"nginx:latest\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\terr := cli.Patch(ctx, patch, client.Apply, &client.PatchOptions{\n\t\tFieldManager: \"client-sample\",\n\t\tForce: pointer.Bool(true),\n\t})\n\n\treturn err\n}", "title": "" }, { "docid": "fd9a1940b0bbe686b5187df8a9d6a028", "score": "0.42538708", "text": "func (c *armConversionApplier) transformSpec(resourceType *astmodel.ResourceType) (astmodel.TypeDefinition, error) {\n\tresourceSpecDef, err := c.definitions.ResolveResourceSpecDefinition(resourceType)\n\tif err != nil {\n\t\treturn astmodel.TypeDefinition{}, err\n\t}\n\n\tinjectOwnerProperty := func(t *astmodel.ObjectType) (*astmodel.ObjectType, error) {\n\t\tif resourceType.Owner() != nil && resourceType.Scope() == astmodel.ResourceScopeResourceGroup {\n\t\t\townerProperty := c.createOwnerProperty(resourceType.Owner())\n\t\t\tt = t.WithProperty(ownerProperty)\n\t\t} else if resourceType.Scope() == astmodel.ResourceScopeExtension {\n\t\t\tt = t.WithProperty(c.createExtensionResourceOwnerProperty())\n\t\t}\n\n\t\treturn t, nil\n\t}\n\n\tremapProperties := func(t *astmodel.ObjectType) (*astmodel.ObjectType, error) {\n\t\t// TODO: Right now the Kubernetes type has all of its standard requiredness (validations). If we want to allow\n\t\t// TODO: users to submit \"just a name and owner\" types we will have to strip some validation until\n\t\t// TODO: https://github.com/kubernetes-sigs/controller-tools/issues/461 is fixed\n\n\t\tnameProp, hasName := t.Property(astmodel.NameProperty)\n\t\tif !hasName {\n\t\t\treturn t, nil\n\t\t}\n\n\t\t// rename Name to AzureName and promote type if needed\n\t\t// Note: if this type ends up wrapped in another type we may need to use a visitor to do this instead of\n\t\t// doing it manually.\n\t\tnamePropType := nameProp.PropertyType()\n\t\tif optional, ok := namePropType.(*astmodel.OptionalType); ok {\n\t\t\tnamePropType = optional.Element()\n\t\t}\n\t\tazureNameProp := armconversion.GetAzureNameProperty(c.idFactory).WithType(namePropType)\n\t\treturn t.WithoutProperty(astmodel.NameProperty).WithProperty(azureNameProp), nil\n\t}\n\n\tkubernetesDef, err := resourceSpecDef.ApplyObjectTransformations(remapProperties, injectOwnerProperty)\n\tif err != nil {\n\t\treturn astmodel.TypeDefinition{}, errors.Wrapf(err, \"remapping properties of Kubernetes definition\")\n\t}\n\n\treturn kubernetesDef, nil\n}", "title": "" }, { "docid": "0438a309dd0b0293c0e28bc3f75fb307", "score": "0.4252202", "text": "func (m *ComanagedDevicesManagedDeviceItemRequestBuilder) Patch(ctx context.Context, body ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.ManagedDeviceable, requestConfiguration *ComanagedDevicesManagedDeviceItemRequestBuilderPatchRequestConfiguration)(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.ManagedDeviceable, error) {\n requestInfo, err := m.ToPatchRequestInformation(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.CreateManagedDeviceFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.ManagedDeviceable), nil\n}", "title": "" }, { "docid": "1366be9687b67bedff94115f0eb7989c", "score": "0.4250716", "text": "func (mc *matchedContainer) MergeTargets(newTargets []matchedTarget) {\nNextNewTarget:\n\tfor _, newt := range newTargets {\n\t\tfor _, old := range mc.Targets {\n\t\t\t// If port and metrics_path are same, then we treat them as same target and keep the existing one\n\t\t\tif old.Port == newt.Port && old.MetricsPath == newt.MetricsPath {\n\t\t\t\tcontinue NextNewTarget\n\t\t\t}\n\t\t}\n\t\tmc.Targets = append(mc.Targets, newt)\n\t}\n}", "title": "" }, { "docid": "d402f63e8ef1be37c5634145688ad16f", "score": "0.42477342", "text": "func (mt *ImplementationMerger) Merge() (Implementation, error) {\n\tmerged := Implementation{}\n\tfor _, ft := range mt.layers {\n\t\tif !ft.GVK.Empty() {\n\t\t\tmerged.GVK = ft.GVK\n\t\t}\n\t\tif ft.TerraformResourceName != \"\" {\n\t\t\tmerged.TerraformResourceName = ft.TerraformResourceName\n\t\t}\n\t\tif ft.CtyEncoder != nil {\n\t\t\tmerged.CtyEncoder = ft.CtyEncoder\n\t\t}\n\t\tif ft.CtyDecoder != nil {\n\t\t\tmerged.CtyDecoder = ft.CtyDecoder\n\t\t}\n\t\tif ft.SchemeBuilder != nil {\n\t\t\tmerged.SchemeBuilder = ft.SchemeBuilder\n\t\t}\n\t\tif ft.ReconcilerConfigurer != nil {\n\t\t\tmerged.ReconcilerConfigurer = ft.ReconcilerConfigurer\n\t\t}\n\t\tif ft.ResourceYAMLUnmarshaller != nil {\n\t\t\tmerged.ResourceYAMLUnmarshaller = ft.ResourceYAMLUnmarshaller\n\t\t}\n\t\tif ft.ResourceYAMLMarshaller != nil {\n\t\t\tmerged.ResourceYAMLMarshaller = ft.ResourceYAMLMarshaller\n\t\t}\n\t\tif ft.ResourceMerger != nil {\n\t\t\tmerged.ResourceMerger = ft.ResourceMerger\n\t\t}\n\t}\n\treturn merged, nil\n}", "title": "" }, { "docid": "fe9443eabb958a8071ac7c2f2a692323", "score": "0.42466104", "text": "func UpdateDeviceOwner(spec *specs.Spec, device *types.Device) {\n\tif spec == nil {\n\t\treturn\n\t}\n\n\tuid, gid := utils.GetUIDGid(spec)\n\n\tif uid != -1 {\n\t\tdevice.UID = uint32(uid)\n\t}\n\tif gid != -1 {\n\t\tdevice.GID = uint32(gid)\n\t}\n}", "title": "" }, { "docid": "f0afd0049d6fc62c775d1f43ed370c2e", "score": "0.4242706", "text": "func (d *DeviceMapperDriver) writeDeviceInfo(deviceHash string, devInfo devInfo) error {\n\tdevInfoPath := d.deviceInfoPath(deviceHash)\n\tfs, err := os.Stat(devInfoPath)\n\tif err != nil {\n\t\tglog.Errorf(\"Could not stat file %s: %s\", devInfoPath, err)\n\t\treturn err\n\t}\n\tdata, err := json.Marshal(devInfo)\n\tif err != nil {\n\t\tglog.Errorf(\"Could not marshal info for device %s: %s\", deviceHash, err)\n\t\treturn err\n\t}\n\tif err := atomicfile.WriteFile(devInfoPath, data, fs.Mode()); err != nil {\n\t\tglog.Errorf(\"Could not update info for device %s: %s\", deviceHash, err)\n\t\treturn err\n\t}\n\t// Clear the cached device info for the set\n\td.invalidateDeviceInfo(deviceHash)\n\treturn nil\n}", "title": "" }, { "docid": "ecc28fb81ab11bbb478d54e04d7f6add", "score": "0.4236941", "text": "func (s GetDeviceDefinitionOutput) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.Arn != nil {\n\t\tv := *s.Arn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Arn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.CreationTimestamp != nil {\n\t\tv := *s.CreationTimestamp\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"CreationTimestamp\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Id != nil {\n\t\tv := *s.Id\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Id\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.LastUpdatedTimestamp != nil {\n\t\tv := *s.LastUpdatedTimestamp\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"LastUpdatedTimestamp\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.LatestVersion != nil {\n\t\tv := *s.LatestVersion\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"LatestVersion\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.LatestVersionArn != nil {\n\t\tv := *s.LatestVersionArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"LatestVersionArn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "95642e1db128afeb25be58ecdc10e535", "score": "0.4235559", "text": "func (r *Resolver) Device() generated.DeviceResolver { return &deviceResolver{r} }", "title": "" }, { "docid": "edc7d624ebc7dee8a55c23c870736cbc", "score": "0.42245165", "text": "func (s UpdateDeviceDefinitionInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/x-amz-json-1.1\"), protocol.Metadata{})\n\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.DeviceDefinitionId != nil {\n\t\tv := *s.DeviceDefinitionId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"DeviceDefinitionId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "78f6e3770ff3f3bafa968f6ea3a652cd", "score": "0.42205998", "text": "func cardTransform(source []*model.Card) (target []*model.ModCard) {\n\tfor _, v := range source {\n\t\ttarget = append(target, &model.ModCard{\n\t\t\tCard: *v,\n\t\t})\n\t}\n\treturn\n}", "title": "" }, { "docid": "6544c7ac4f02434fb50b05ea9daaae45", "score": "0.42127946", "text": "func (a *DeviceApiService) DeviceDeviceAdd(ctx _context.Context) ApiDeviceDeviceAddRequest {\n\treturn ApiDeviceDeviceAddRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "title": "" }, { "docid": "b721a2c5cf2b20cda5c5954f197a1b80", "score": "0.42097184", "text": "func (e *dataUsageEntry) merge(other dataUsageEntry) {\n\te.Objects += other.Objects\n\te.Size += other.Size\n\tfor i, v := range other.ObjSizes[:] {\n\t\te.ObjSizes[i] += v\n\t}\n}", "title": "" }, { "docid": "6eb43583ec5337a980151b28eac717f1", "score": "0.42084572", "text": "func (ts Targets) Merge(ts1 *Targets) *Targets {\n\ttargets := Targets{}\n\n\tfor _, t := range ts {\n\t\tfor _, t1 := range *ts1 {\n\t\t\tif t.Image != t1.Image {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tfor k, tg := range t.Tags {\n\t\t\t\tfor _, tg1 := range t1.Tags {\n\t\t\t\t\tif tg.Pattern == tg1.Pattern {\n\t\t\t\t\t\tt.Tags[k] = tg1\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\ttargets = append(targets, t)\n\t}\n\n\treturn &targets\n}", "title": "" }, { "docid": "d322ac6ff890fbde1f24c5231794383b", "score": "0.4207889", "text": "func (c *Client) UpdateDevice(device Device) (*Device, error) {\n\t//This only handles changing the community string and snmp port at this point...\n\trb := \"{\\\"field\\\": [\\\"community\\\",\\\"port\\\"], \\\"data\\\": [\\\"\" + device.Community + \"\\\",\" + strconv.Itoa(device.Port) + \"]}\"\n\t//This is how we could do multiple fields at once in the future\n\t//{\"field\": [\"notes\",\"purpose\"], \"data\": [\"This server should be kept online\", \"For serving web traffic\"]}\n\n\t// fieldsToUpdate := []string{\"Community\", \"Port\"}\n\n\t// v := reflect.ValueOf(device)\n\t// typeOfDevice := v.Type()\n\t// var field []string\n\t// var data []string\n\n\t// for i := 0; i < v.NumField(); i++ {\n\t// \tif contains(fieldsToUpdate, typeOfDevice.Field(i).Name) {\n\t// \t\tfield = append(field, typeOfDevice.Field(i).Name)\n\t// \t\tdata = append(data, v.Field(i).String())\n\t// \t}\n\t// }\n\n\t// fmt.Println(field)\n\t// fmt.Println(data)\n\n\t// need to build out the body and choose which fields we'll update\n\n\t// rb, err := json.Marshal(device)\n\t// if err != nil {\n\t// \treturn nil, err\n\t// }\n\t// fmt.Println(rb)\n\treq, err := http.NewRequest(\"PATCH\", fmt.Sprintf(\"%s/api/v0/devices/%s\", c.HostURL, device.Hostname), strings.NewReader(string(rb)))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t_, err = c.doRequest(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &device, nil\n}", "title": "" }, { "docid": "6bee1b012f9c72339fb137445e46ab55", "score": "0.4201278", "text": "func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec {\n\ts := map[string]hcldec.Spec{\n\t\t\"packer_build_name\": &hcldec.AttrSpec{Name: \"packer_build_name\", Type: cty.String, Required: false},\n\t\t\"packer_builder_type\": &hcldec.AttrSpec{Name: \"packer_builder_type\", Type: cty.String, Required: false},\n\t\t\"packer_debug\": &hcldec.AttrSpec{Name: \"packer_debug\", Type: cty.Bool, Required: false},\n\t\t\"packer_force\": &hcldec.AttrSpec{Name: \"packer_force\", Type: cty.Bool, Required: false},\n\t\t\"packer_on_error\": &hcldec.AttrSpec{Name: \"packer_on_error\", Type: cty.String, Required: false},\n\t\t\"packer_user_variables\": &hcldec.BlockAttrsSpec{TypeName: \"packer_user_variables\", ElementType: cty.String, Required: false},\n\t\t\"packer_sensitive_variables\": &hcldec.AttrSpec{Name: \"packer_sensitive_variables\", Type: cty.List(cty.String), Required: false},\n\t\t\"command\": &hcldec.AttrSpec{Name: \"command\", Type: cty.String, Required: false},\n\t\t\"extra_arguments\": &hcldec.AttrSpec{Name: \"extra_arguments\", Type: cty.List(cty.String), Required: false},\n\t\t\"bolt_env_vars\": &hcldec.AttrSpec{Name: \"bolt_env_vars\", Type: cty.List(cty.String), Required: false},\n\t\t\"bolt_params\": &hcldec.BlockAttrsSpec{TypeName: \"bolt_params\", ElementType: cty.String, Required: false},\n\t\t\"bolt_task\": &hcldec.AttrSpec{Name: \"bolt_task\", Type: cty.String, Required: false},\n\t\t\"bolt_plan\": &hcldec.AttrSpec{Name: \"bolt_plan\", Type: cty.String, Required: false},\n\t\t\"bolt_module_path\": &hcldec.AttrSpec{Name: \"bolt_module_path\", Type: cty.String, Required: false},\n\t\t\"inventory_file\": &hcldec.AttrSpec{Name: \"inventory_file\", Type: cty.String, Required: false},\n\t\t\"local_port\": &hcldec.AttrSpec{Name: \"local_port\", Type: cty.Number, Required: false},\n\t\t\"skip_version_check\": &hcldec.AttrSpec{Name: \"skip_version_check\", Type: cty.Bool, Required: false},\n\t\t\"user\": &hcldec.AttrSpec{Name: \"user\", Type: cty.String, Required: false},\n\t\t\"ssh_host_key_file\": &hcldec.AttrSpec{Name: \"ssh_host_key_file\", Type: cty.String, Required: false},\n\t\t\"ssh_authorized_key_file\": &hcldec.AttrSpec{Name: \"ssh_authorized_key_file\", Type: cty.String, Required: false},\n\t\t\"winrm_ssl_verify\": &hcldec.AttrSpec{Name: \"winrm_ssl_verify\", Type: cty.Bool, Required: false},\n\t}\n\treturn s\n}", "title": "" }, { "docid": "eefe5b5175b8f5417a972bc5e8712803", "score": "0.41923633", "text": "func parseDevice(device string) (*types.DeviceMapping, error) {\n\tsrc := \"\"\n\tdst := \"\"\n\tpermissions := \"rwm\"\n\tarr := strings.Split(device, \":\")\n\tswitch len(arr) {\n\tcase 3:\n\t\tpermissions = arr[2]\n\t\tfallthrough\n\tcase 2:\n\t\tdst = arr[1]\n\t\tfallthrough\n\tcase 1:\n\t\tsrc = arr[0]\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"invalid device specification: %s\", device)\n\t}\n\n\tif dst == \"\" {\n\t\tdst = src\n\t}\n\n\tdeviceMapping := &types.DeviceMapping{\n\t\tPathOnHost: src,\n\t\tPathInContainer: dst,\n\t\tCgroupPermissions: permissions,\n\t}\n\treturn deviceMapping, nil\n}", "title": "" }, { "docid": "bf51aa2d236617fade2abd36688a4f7c", "score": "0.41897613", "text": "func (fpv *DeviceSpec_FieldTerminalPathValue) SetTo(target **Device_Spec) {\n\tif *target == nil {\n\t\t*target = new(Device_Spec)\n\t}\n\tswitch fpv.selector {\n\tcase DeviceSpec_FieldPathSelectorServiceAccount:\n\t\t(*target).ServiceAccount = fpv.value.(*iam_service_account.Reference)\n\tcase DeviceSpec_FieldPathSelectorOsVersion:\n\t\t(*target).OsVersion = fpv.value.(string)\n\tcase DeviceSpec_FieldPathSelectorNetConfig:\n\t\t(*target).NetConfig = fpv.value.(*Device_Spec_NetworkConfig)\n\tcase DeviceSpec_FieldPathSelectorNetConfigMode:\n\t\t(*target).NetConfigMode = fpv.value.(string)\n\tcase DeviceSpec_FieldPathSelectorOsImageUrl:\n\t\t(*target).OsImageUrl = fpv.value.(string)\n\tcase DeviceSpec_FieldPathSelectorSshConfig:\n\t\t(*target).SshConfig = fpv.value.(*Device_Spec_SSHConfig)\n\tcase DeviceSpec_FieldPathSelectorAttestationConfig:\n\t\t(*target).AttestationConfig = fpv.value.(*Device_Spec_AttestationConfig)\n\tcase DeviceSpec_FieldPathSelectorDisableDeviceDiscovery:\n\t\t(*target).DisableDeviceDiscovery = fpv.value.(bool)\n\tcase DeviceSpec_FieldPathSelectorLoggingConfig:\n\t\t(*target).LoggingConfig = fpv.value.(*Device_Spec_LoggingConfig)\n\tcase DeviceSpec_FieldPathSelectorProxyConfig:\n\t\t(*target).ProxyConfig = fpv.value.(*Device_Spec_ProxyConfig)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for Device_Spec: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "b31bba3ecbac8693fb945c8dc36d1265", "score": "0.41849673", "text": "func (dcb *DeviceCreateBulk) Save(ctx context.Context) ([]*Device, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(dcb.builders))\n\tnodes := make([]*Device, len(dcb.builders))\n\tmutators := make([]Mutator, len(dcb.builders))\n\tfor i := range dcb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := dcb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*DeviceMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, dcb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, dcb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif cerr, ok := isSQLConstraintError(err); ok {\n\t\t\t\t\t\t\terr = cerr\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, dcb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "title": "" }, { "docid": "ca80d90c3b80fa6042be67a30290fad1", "score": "0.4184576", "text": "func TestMerge_Merge_order(t *testing.T) {\n\tr1, err := yaml.Parse(`\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: foo-1\n namespace: bar-1\nspec:\n template:\n spec: {}\n`)\n\tif !assert.NoError(t, err) {\n\t\tt.FailNow()\n\t}\n\n\tr2, err := yaml.Parse(`\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: foo-2\n namespace: bar-2\nspec:\n template:\n spec: {}\n`)\n\tif !assert.NoError(t, err) {\n\t\tt.FailNow()\n\t}\n\n\tvar b bytes.Buffer\n\terr = kio.Pipeline{\n\t\tInputs: []kio.Reader{&kio.PackageBuffer{Nodes: []*yaml.RNode{r1, r2}}},\n\t\tFilters: []kio.Filter{filters.MatchFilter{}},\n\t\tOutputs: []kio.Writer{&kio.ByteWriter{Writer: &b}},\n\t}.Execute()\n\tif !assert.NoError(t, err) {\n\t\tt.FailNow()\n\t}\n\n\texpected := strings.TrimSpace(`\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: foo-1\n namespace: bar-1\nspec:\n template:\n spec: {}\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: foo-2\n namespace: bar-2\nspec:\n template:\n spec: {}\n`)\n\n\tif !assert.Equal(t, expected, strings.TrimSpace(b.String())) {\n\t\tt.FailNow()\n\t}\n\n\tb.Reset()\n\terr = kio.Pipeline{\n\t\tInputs: []kio.Reader{&kio.PackageBuffer{Nodes: []*yaml.RNode{r2, r1}}},\n\t\tFilters: []kio.Filter{filters.MatchFilter{}},\n\t\tOutputs: []kio.Writer{&kio.ByteWriter{Writer: &b}},\n\t}.Execute()\n\tif !assert.NoError(t, err) {\n\t\tt.FailNow()\n\t}\n\n\texpected = strings.TrimSpace(`\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: foo-2\n namespace: bar-2\nspec:\n template:\n spec: {}\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: foo-1\n namespace: bar-1\nspec:\n template:\n spec: {}\n`)\n\n\tif !assert.Equal(t, expected, strings.TrimSpace(b.String())) {\n\t\tt.FailNow()\n\t}\n}", "title": "" }, { "docid": "9245185e3fdeb1b7f63c6e1b785cb117", "score": "0.41819906", "text": "func (r *ManagedDeviceMobileAppConfigurationDeviceSummaryRequest) Update(ctx context.Context, reqObj *ManagedDeviceMobileAppConfigurationDeviceSummary) error {\n\treturn r.JSONRequest(ctx, \"PATCH\", \"\", reqObj, nil)\n}", "title": "" }, { "docid": "c02041e0d654c6dfbe9150187007ba63", "score": "0.41758606", "text": "func TestUnmarshalDevice(t *testing.T) {\n\tfor _, tc := range []struct {\n\t\tdesc string\n\t\tinput string\n\t\terrorContains string\n\t\texpected *DeviceV1\n\t}{\n\t\t{\n\t\t\tdesc: \"success\",\n\t\t\tinput: `\n{\n \"kind\": \"device\",\n\t\"version\": \"v1\",\n\t\"metadata\": {\n\t\t\"name\": \"xaa\"\n\t},\n\t\"spec\": {\n\t\t\"asset_tag\": \"mymachine\",\n\t\t\"os_type\": \"macos\",\n\t\t\"enroll_status\": \"enrolled\"\n\t}\n}`,\n\t\t\texpected: &DeviceV1{\n\t\t\t\tResourceHeader: ResourceHeader{\n\t\t\t\t\tKind: KindDevice,\n\t\t\t\t\tVersion: \"v1\",\n\t\t\t\t\tMetadata: Metadata{\n\t\t\t\t\t\tNamespace: defaults.Namespace,\n\t\t\t\t\t\tName: \"xaa\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tSpec: &DeviceSpec{\n\t\t\t\t\tOsType: \"macos\",\n\t\t\t\t\tAssetTag: \"mymachine\",\n\t\t\t\t\tEnrollStatus: \"enrolled\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tdesc: \"fail string as num\",\n\t\t\terrorContains: `cannot unmarshal number`,\n\t\t\tinput: `\n{\n \"kind\": \"device\",\n\t\"version\": \"v1\",\n\t\"metadata\": {\n\t\t\"name\": \"secretid\"\n\t},\n\t\"spec\": {\n\t\t\"asset_tag\": 4,\n\t\t\"os_type\": \"macos\",\n\t\t\"enroll_status\": \"enrolled\"\n\t}\n}`,\n\t\t},\n\t} {\n\t\tt.Run(tc.desc, func(t *testing.T) {\n\t\t\tout, err := UnmarshalDevice([]byte(tc.input))\n\t\t\tif tc.errorContains != \"\" {\n\t\t\t\trequire.ErrorContains(t, err, tc.errorContains, \"error from UnmarshalDevice does not contain the expected string\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\trequire.NoError(t, err, \"UnmarshalDevice returned unexpected error\")\n\t\t\trequire.Equal(t, tc.expected, out, \"unmarshalled device does not match what was expected\")\n\t\t})\n\t}\n}", "title": "" }, { "docid": "50fb232ae1a4aba2eab9a5e795db1d1d", "score": "0.41704538", "text": "func convertManifest(ctx context.Context, cs content.Store, newDesc *ocispec.Descriptor, opt MergeOption) (*ocispec.Descriptor, error) {\n\tvar manifest ocispec.Manifest\n\tmanifestDesc := *newDesc\n\tmanifestLabels, err := readJSON(ctx, cs, &manifest, manifestDesc)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"read manifest json\")\n\t}\n\n\t// Append bootstrap layer to manifest.\n\tbootstrapDesc, blobDescs, err := MergeLayers(ctx, cs, manifest.Layers, MergeOption{\n\t\tBuilderPath: opt.BuilderPath,\n\t\tWorkDir: opt.WorkDir,\n\t\tChunkDictPath: opt.ChunkDictPath,\n\t\tFsVersion: opt.FsVersion,\n\t\tWithTar: true,\n\t})\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"merge nydus layers\")\n\t}\n\tif opt.Backend != nil {\n\t\t// Only append nydus bootstrap layer into manifest, and do not put nydus\n\t\t// blob layer into manifest if blob storage backend is specified.\n\t\tmanifest.Layers = []ocispec.Descriptor{*bootstrapDesc}\n\t} else {\n\t\tfor idx, blobDesc := range blobDescs {\n\t\t\tblobGCLabelKey := fmt.Sprintf(\"containerd.io/gc.ref.content.l.%d\", idx)\n\t\t\tmanifestLabels[blobGCLabelKey] = blobDesc.Digest.String()\n\t\t}\n\t\t// Affected by chunk dict, the blob list referenced by final bootstrap\n\t\t// are from different layers, part of them are from original layers, part\n\t\t// from chunk dict bootstrap, so we need to rewrite manifest's layers here.\n\t\tmanifest.Layers = append(blobDescs, *bootstrapDesc)\n\t}\n\n\t// Update the gc label of bootstrap layer\n\tbootstrapGCLabelKey := fmt.Sprintf(\"containerd.io/gc.ref.content.l.%d\", len(manifest.Layers)-1)\n\tmanifestLabels[bootstrapGCLabelKey] = bootstrapDesc.Digest.String()\n\n\t// Rewrite diff ids and remove useless annotation.\n\tvar config ocispec.Image\n\tconfigLabels, err := readJSON(ctx, cs, &config, manifest.Config)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"read image config\")\n\t}\n\tif opt.Backend != nil {\n\t\tconfig.RootFS.DiffIDs = []digest.Digest{digest.Digest(bootstrapDesc.Annotations[LayerAnnotationUncompressed])}\n\t} else {\n\t\tconfig.RootFS.DiffIDs = make([]digest.Digest, 0, len(manifest.Layers))\n\t\tfor i, layer := range manifest.Layers {\n\t\t\tconfig.RootFS.DiffIDs = append(config.RootFS.DiffIDs, digest.Digest(layer.Annotations[LayerAnnotationUncompressed]))\n\t\t\t// Remove useless annotation.\n\t\t\tdelete(manifest.Layers[i].Annotations, LayerAnnotationUncompressed)\n\t\t}\n\t}\n\t// Update image config in content store.\n\tnewConfigDesc, err := writeJSON(ctx, cs, config, manifest.Config, configLabels)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"write image config\")\n\t}\n\tmanifest.Config = *newConfigDesc\n\t// Update the config gc label\n\tmanifestLabels[configGCLabelKey] = newConfigDesc.Digest.String()\n\n\t// Update image manifest in content store.\n\tnewManifestDesc, err := writeJSON(ctx, cs, manifest, manifestDesc, manifestLabels)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"write manifest\")\n\t}\n\n\treturn newManifestDesc, nil\n}", "title": "" }, { "docid": "2aa9483597b93099fa7ab734b0bef72a", "score": "0.41648063", "text": "func (c *newStorageMapperCollector) Update(ch chan<- prometheus.Metric) error {\n\n\tmapper := make(map[string]string)\n\n\t// DeviceMapper record\n\tdevicemapper, err := execCommand(\"docker inspect --format='{{.Name}}__{{.GraphDriver.Data.DeviceName}}' $(docker ps -aq)\")\n\tif err != nil {\n\t\tlog.Debugf(\"Get devicemapper fail: %q\", err)\n\t}\n\t// Overlay2 record\n\toverlay2, err := execCommand(\"docker inspect --format='{{.Name}}__{{.GraphDriver.Data.MergedDir}}' $(docker ps -aq)\")\n\tif err != nil {\n\t\tlog.Debugf(\"Get overlay2 fail: %q\", err)\n\t}\n\n\tupdateStorageMapper(append(strings.Split(string(devicemapper), \"\\n\"),\n\t\tstrings.Split(string(overlay2), \"\\n\")...), &mapper)\n\n\tfor mapperPodInfo, storagePath := range mapper {\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tprometheus.NewDesc(\n\t\t\t\tprometheus.BuildFQName(namespace, storageMapperInfo, \"StorageMapper\"),\n\t\t\t\tfmt.Sprintf(\"storage mapper information\"),\n\t\t\t\t[]string{\"storagePath\", \"mapperPodInfo\"}, nil,\n\t\t\t),\n\t\t\tprometheus.GaugeValue, float64(1), storagePath, mapperPodInfo,\n\t\t)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "28d948865a1f49d7626c6f214afc0721", "score": "0.4162177", "text": "func mergedTags(dst map[string]uint64, attach attacher, module *bcc.Module, attachments map[string]string) error {\n\tsrc, err := attach(module, attachments)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor name, tag := range src {\n\t\tdst[name] = tag\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "7952bd9d7d1f47490189c4cd7d218896", "score": "0.4161107", "text": "func RegisterDevice(t cbtest.T, provider provider.ConfigAndClient, name, activeKey string) {\n\tt.Helper()\n\terr := RegisterDeviceE(t, provider, name, activeKey)\n\trequire.NoError(t, err)\n}", "title": "" }, { "docid": "eafe72ee0f295abdd14950faa259fc1f", "score": "0.41596928", "text": "func mergeMetadata(rawCfg map[interface{}]interface{}, md datasource.Metadata) map[interface{}]interface{} {\n\tif rawCfg == nil {\n\t\treturn nil\n\t}\n\tout := util.MapCopy(rawCfg)\n\n\toutHostname, ok := out[\"hostname\"]\n\tif !ok {\n\t\toutHostname = \"\"\n\t}\n\n\tif md.Hostname != \"\" {\n\t\tif outHostname != \"\" {\n\t\t\tlog.Debugf(\"Warning: user-data hostname (%s) overrides metadata hostname (%s)\\n\", outHostname, md.Hostname)\n\t\t} else {\n\t\t\tout[\"hostname\"] = md.Hostname\n\t\t}\n\t}\n\n\t// Sort SSH keys by key name\n\tkeys := []string{}\n\tfor k := range md.SSHPublicKeys {\n\t\tkeys = append(keys, k)\n\t}\n\n\tsort.Sort(sort.StringSlice(keys))\n\n\tfinalKeys, _ := out[\"ssh_authorized_keys\"].([]interface{})\n\tfor _, k := range keys {\n\t\tfinalKeys = append(finalKeys, md.SSHPublicKeys[k])\n\t}\n\n\tout[\"ssh_authorized_keys\"] = finalKeys\n\n\trancherOut, _ := out[\"rancher\"].(map[interface{}]interface{})\n\tif _, ok := rancherOut[\"resize_device\"]; md.RootDisk != \"\" && !ok {\n\t\trancherOut[\"resize_device\"] = md.RootDisk\n\t}\n\n\treturn out\n}", "title": "" }, { "docid": "980d72c12b39666d8fd6cd672d9f05c4", "score": "0.4154123", "text": "func (message *Message) AddDevice(device string) *Message {\n\tmessage.device = device\n\treturn message\n}", "title": "" }, { "docid": "5cb4f4ba43734e9f905bbdfa39be7d75", "score": "0.41540807", "text": "func (c *Controller) PushDeviceResource(oldDvr *apis.Device,\n\tdeviceDetails *DeviceInfo) {\n\tdeviceDetails.HostName = c.HostName\n\tdeviceApi := deviceDetails.ToDevice()\n\tif oldDvr != nil {\n\t\tc.UpdateDevice(deviceApi, oldDvr)\n\t\treturn\n\t}\n\tc.CreateDevice(deviceApi)\n}", "title": "" }, { "docid": "ca81a78968d07ddfe6386375c42eb3f0", "score": "0.41539055", "text": "func AddDevice(d *Device) (err error) {\n\t_, err = engine.Insert(d)\n\treturn\n}", "title": "" }, { "docid": "0c314dd1b5e9c8156ac8627747fae073", "score": "0.4153019", "text": "func (client *Client) UpdateRenderingDeviceSpec(request *UpdateRenderingDeviceSpecRequest) (response *UpdateRenderingDeviceSpecResponse, err error) {\n\tresponse = CreateUpdateRenderingDeviceSpecResponse()\n\terr = client.DoAction(request, response)\n\treturn\n}", "title": "" }, { "docid": "f7d6c50728085dce2ecd88da0929b2b8", "score": "0.414691", "text": "func (m *WindowsAutopilotDeviceIdentityItemRequestBuilder) Patch(ctx context.Context, body iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.WindowsAutopilotDeviceIdentityable, requestConfiguration *WindowsAutopilotDeviceIdentityItemRequestBuilderPatchRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.WindowsAutopilotDeviceIdentityable, error) {\n requestInfo, err := m.CreatePatchRequestInformation(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.requestAdapter.SendAsync(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateWindowsAutopilotDeviceIdentityFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.WindowsAutopilotDeviceIdentityable), nil\n}", "title": "" }, { "docid": "cbfce7a39bd42684caaddc260f988c40", "score": "0.41466108", "text": "func (m *WindowsAutopilotDeviceIdentitiesWindowsAutopilotDeviceIdentityItemRequestBuilder) Patch(ctx context.Context, body iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.WindowsAutopilotDeviceIdentityable, requestConfiguration *WindowsAutopilotDeviceIdentitiesWindowsAutopilotDeviceIdentityItemRequestBuilderPatchRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.WindowsAutopilotDeviceIdentityable, error) {\n requestInfo, err := m.ToPatchRequestInformation(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.Send(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateWindowsAutopilotDeviceIdentityFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.WindowsAutopilotDeviceIdentityable), nil\n}", "title": "" }, { "docid": "25f5b356ac0a1d681abb31b9e89f6575", "score": "0.41447404", "text": "func (out *DefaultIOHandler) Merge(mergeOutput *DefaultIOHandler) {\n\n\t// Append Info\n\tvar stdoutBuffer bytes.Buffer\n\tif len(out.stdout) > 0 {\n\t\tstdoutBuffer.WriteString(out.stdout + \"\\n\")\n\t}\n\tstdoutBuffer.WriteString(mergeOutput.GetStdout())\n\tout.stdout = stdoutBuffer.String()\n\n\t// Append Error\n\tvar stderrBuffer bytes.Buffer\n\tif len(out.stderr) > 0 {\n\t\tstderrBuffer.WriteString(out.stderr + \"\\n\")\n\t}\n\tstderrBuffer.WriteString(mergeOutput.GetStderr())\n\tout.stderr = stderrBuffer.String()\n\n\tif out.ExitCode == 0 {\n\t\tout.ExitCode = mergeOutput.GetExitCode()\n\t}\n\tout.Status = contracts.MergeResultStatus(out.Status, mergeOutput.GetStatus())\n}", "title": "" }, { "docid": "435d2073e991c2437bc322c2e874e88e", "score": "0.41444805", "text": "func (h *hostDeviceSet) AddDevice(device string) {\n\th.Devices = append(h.Devices, device)\n}", "title": "" }, { "docid": "8349ae6a1bada2bce33129b3f26e80e9", "score": "0.4140909", "text": "func getDevicesOPAE() []device {\n\treturn []device{\n\t\t{\n\t\t\tname: \"intel-fpga-dev.0\",\n\t\t\tregions: []region{\n\t\t\t\t{\n\t\t\t\t\tid: \"intel-fpga-fme.0\",\n\t\t\t\t\tinterfaceID: \"ce48969398f05f33946d560708be108a\",\n\t\t\t\t\tdevNode: \"/dev/intel-fpga-fme.0\",\n\t\t\t\t\tafus: []afu{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tid: \"intel-fpga-port.0\",\n\t\t\t\t\t\t\tafuID: \"d8424dc4a4a3c413f89e433683f9040b\",\n\t\t\t\t\t\t\tdevNode: \"/dev/intel-fpga-port.0\",\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\t{\n\t\t\tname: \"intel-fpga-dev.1\",\n\t\t\tregions: []region{\n\t\t\t\t{\n\t\t\t\t\tid: \"intel-fpga-fme.1\",\n\t\t\t\t\tinterfaceID: \"ce48969398f05f33946d560708be108a\",\n\t\t\t\t\tdevNode: \"/dev/intel-fpga-fme.1\",\n\t\t\t\t\tafus: []afu{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tid: \"intel-fpga-port.1\",\n\t\t\t\t\t\t\tafuID: \"d8424dc4a4a3c413f89e433683f9040b\",\n\t\t\t\t\t\t\tdevNode: \"/dev/intel-fpga-port.1\",\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\t{\n\t\t\tname: \"intel-fpga-dev.2\",\n\t\t\tregions: []region{\n\t\t\t\t{\n\t\t\t\t\tid: \"intel-fpga-fme.2\",\n\t\t\t\t\tinterfaceID: unhealthyInterfaceID,\n\t\t\t\t\tdevNode: \"/dev/intel-fpga-fme.2\",\n\t\t\t\t\tafus: []afu{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tid: \"intel-fpga-port.2\",\n\t\t\t\t\t\t\tafuID: unhealthyAfuID,\n\t\t\t\t\t\t\tdevNode: \"/dev/intel-fpga-port.2\",\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}", "title": "" }, { "docid": "8349ae6a1bada2bce33129b3f26e80e9", "score": "0.4140909", "text": "func getDevicesOPAE() []device {\n\treturn []device{\n\t\t{\n\t\t\tname: \"intel-fpga-dev.0\",\n\t\t\tregions: []region{\n\t\t\t\t{\n\t\t\t\t\tid: \"intel-fpga-fme.0\",\n\t\t\t\t\tinterfaceID: \"ce48969398f05f33946d560708be108a\",\n\t\t\t\t\tdevNode: \"/dev/intel-fpga-fme.0\",\n\t\t\t\t\tafus: []afu{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tid: \"intel-fpga-port.0\",\n\t\t\t\t\t\t\tafuID: \"d8424dc4a4a3c413f89e433683f9040b\",\n\t\t\t\t\t\t\tdevNode: \"/dev/intel-fpga-port.0\",\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\t{\n\t\t\tname: \"intel-fpga-dev.1\",\n\t\t\tregions: []region{\n\t\t\t\t{\n\t\t\t\t\tid: \"intel-fpga-fme.1\",\n\t\t\t\t\tinterfaceID: \"ce48969398f05f33946d560708be108a\",\n\t\t\t\t\tdevNode: \"/dev/intel-fpga-fme.1\",\n\t\t\t\t\tafus: []afu{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tid: \"intel-fpga-port.1\",\n\t\t\t\t\t\t\tafuID: \"d8424dc4a4a3c413f89e433683f9040b\",\n\t\t\t\t\t\t\tdevNode: \"/dev/intel-fpga-port.1\",\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\t{\n\t\t\tname: \"intel-fpga-dev.2\",\n\t\t\tregions: []region{\n\t\t\t\t{\n\t\t\t\t\tid: \"intel-fpga-fme.2\",\n\t\t\t\t\tinterfaceID: unhealthyInterfaceID,\n\t\t\t\t\tdevNode: \"/dev/intel-fpga-fme.2\",\n\t\t\t\t\tafus: []afu{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tid: \"intel-fpga-port.2\",\n\t\t\t\t\t\t\tafuID: unhealthyAfuID,\n\t\t\t\t\t\t\tdevNode: \"/dev/intel-fpga-port.2\",\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}", "title": "" }, { "docid": "aaa69e2ce3a08880302d2db308b3ec2e", "score": "0.41404352", "text": "func (env Envelope) Union(other Envelope) Envelope {\n\tif env.IsInit() {\n\t\tenv.cval.MinX = min(env.cval.MinX, other.cval.MinX)\n\t\tenv.cval.MinY = min(env.cval.MinY, other.cval.MinY)\n\t\tenv.cval.MaxX = max(env.cval.MaxX, other.cval.MaxX)\n\t\tenv.cval.MaxY = max(env.cval.MaxY, other.cval.MaxY)\n\t} else {\n\t\tenv.cval.MinX = other.cval.MinX\n\t\tenv.cval.MinY = other.cval.MinY\n\t\tenv.cval.MaxX = other.cval.MaxX\n\t\tenv.cval.MaxY = other.cval.MaxY\n\t}\n\treturn env\n}", "title": "" }, { "docid": "c68fa5a5fd0d6426179b57b4a6de1d66", "score": "0.41392082", "text": "func (m hostDeviceResultMap) AddHostDevice(resultStr string, host string, device string) error {\n\terr := m.AddHost(resultStr, host)\n\tif err != nil {\n\t\treturn err\n\t}\n\tm[resultStr].AddDevice(device)\n\treturn nil\n}", "title": "" }, { "docid": "0e9c3341b05b15f299337d41fe1f279e", "score": "0.41390887", "text": "func (s *fakeDeviceService) EnrollDevice(stream devicepb.DeviceTrustService_EnrollDeviceServer) error {\n\treq, err := stream.Recv()\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\tinitReq := req.GetInit()\n\tswitch {\n\tcase initReq == nil:\n\t\treturn trace.BadParameter(\"init required\")\n\tcase initReq.Token == \"\":\n\t\treturn trace.BadParameter(\"token required\")\n\tcase initReq.CredentialId == \"\":\n\t\treturn trace.BadParameter(\"credential ID required\")\n\t}\n\tif err := validateCollectedData(initReq.DeviceData); err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\tcd := initReq.DeviceData\n\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\n\t// Find or auto-create device.\n\tsd, err := s.findDeviceByOSTag(cd.OsType, cd.SerialNumber)\n\tswitch {\n\tcase s.autoCreateDevice && trace.IsNotFound(err):\n\t\t// Auto-created device.\n\t\tnow := timestamppb.Now()\n\t\tdev := &devicepb.Device{\n\t\t\tApiVersion: \"v1\",\n\t\t\tId: uuid.NewString(),\n\t\t\tOsType: cd.OsType,\n\t\t\tAssetTag: cd.SerialNumber,\n\t\t\tCreateTime: now,\n\t\t\tUpdateTime: now,\n\t\t\tEnrollStatus: devicepb.DeviceEnrollStatus_DEVICE_ENROLL_STATUS_NOT_ENROLLED,\n\t\t}\n\t\ts.devices = append(s.devices, storedDevice{\n\t\t\tpb: dev,\n\t\t})\n\t\tsd = &s.devices[len(s.devices)-1]\n\tcase err != nil:\n\t\treturn err\n\t}\n\n\t// Spend enrollment token.\n\tif err := s.spendEnrollmentToken(sd, initReq.Token); err != nil {\n\t\treturn err\n\t}\n\n\t// OS-specific enrollment.\n\tvar cred *devicepb.DeviceCredential\n\tvar pub *ecdsa.PublicKey\n\tswitch initReq.DeviceData.OsType {\n\tcase devicepb.OSType_OS_TYPE_MACOS:\n\t\tcred, pub, err = enrollMacOS(stream, initReq)\n\t\t// err handled below\n\tcase devicepb.OSType_OS_TYPE_WINDOWS:\n\t\tcred, err = enrollTPM(stream, initReq)\n\t\t// err handled below\n\tdefault:\n\t\treturn trace.BadParameter(\"os not supported\")\n\t}\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\n\t// Save enrollment information.\n\tsd.pb.UpdateTime = timestamppb.Now()\n\tsd.pb.EnrollStatus = devicepb.DeviceEnrollStatus_DEVICE_ENROLL_STATUS_ENROLLED\n\tsd.pb.Credential = cred\n\tsd.pub = pub\n\n\t// Success.\n\terr = stream.Send(&devicepb.EnrollDeviceResponse{\n\t\tPayload: &devicepb.EnrollDeviceResponse_Success{\n\t\t\tSuccess: &devicepb.EnrollDeviceSuccess{\n\t\t\t\tDevice: sd.pb,\n\t\t\t},\n\t\t},\n\t})\n\treturn trace.Wrap(err)\n}", "title": "" }, { "docid": "8436b8b19979af8ae37579bf0277e735", "score": "0.41390413", "text": "func (ntdmc *NetTopologyDeviceMapCreate) SetDevice(d *Device) *NetTopologyDeviceMapCreate {\n\treturn ntdmc.SetDeviceID(d.ID)\n}", "title": "" } ]
8007e89072e97fbb1e7c3f0ce4a72e1b
Message returns the exception's message.
[ { "docid": "4bb2e1696d3ca9fd6b81348abc4a0b56", "score": "0.7567655", "text": "func (s *ServiceQuotaExceededException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" } ]
[ { "docid": "3be3daf353822d9860b1bab17a491b24", "score": "0.8580382", "text": "func (e *exception) Message() string {\n\treturn e.message\n}", "title": "" }, { "docid": "3d85ced6f9b9153b6fc4bec031cc035c", "score": "0.81021744", "text": "func (exception *Exception) getMessage() string {\n\treturn exception.message\n}", "title": "" }, { "docid": "9d31facbc7320e298f013cd901a89fcd", "score": "0.80168194", "text": "func (s *NoSuchRemediationExceptionException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "24891f7e3eaa0df44b93531adcb72217", "score": "0.79800713", "text": "func (s *ServiceAccountException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "4f6a678eb4c1bd2c0c1a7c1ffbd9da30", "score": "0.79458535", "text": "func (s *InvalidExpressionException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "96206aa8b2b3dfb1a044bddb2157d281", "score": "0.79421824", "text": "func (s *ServerException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "0bf1eeeaa0b1063f4e20cf311cf17c04", "score": "0.79374486", "text": "func (s *TrailNotProvidedException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "47c93b776f4d6258492f5665078bcc39", "score": "0.7905721", "text": "func (s *KmsException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "7875c1bf43c530be26cc1ae53b92115f", "score": "0.7904383", "text": "func (s *NoSuchConfigRuleException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "5cad827a042120f090a91bb09db39d8b", "score": "0.78544474", "text": "func (s *InvalidSourceException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "91b2ea31d1595f52ddae1643e3f0103a", "score": "0.783764", "text": "func (s *AssessmentRunInProgressException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "3da45b5cce9ed2db4f01c4d94372ce4f", "score": "0.78315115", "text": "func (s *OversizedConfigurationItemException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "3f4254a87e569df86c9f1e687c1ff369", "score": "0.77905655", "text": "func (s *InvalidTrailNameException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "78ff7eec05176b97450478352c2e428a", "score": "0.77837336", "text": "func (s *NoSuchOrganizationConfigRuleException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "2cfd4758ca450eaf33760e638d56ee6d", "score": "0.77744895", "text": "func (s *InvalidMaxResultsException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "2cfd4758ca450eaf33760e638d56ee6d", "score": "0.77744895", "text": "func (s *InvalidMaxResultsException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "ffa8df6648d1879ca18397b3ff58b2c0", "score": "0.7765396", "text": "func (s *MaxNumberOfRetentionConfigurationsExceededException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "46628e1691d6e3f3bb2a98a22e1e5b2c", "score": "0.7746601", "text": "func (s *NoSuchEntityException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "4aff22f1d573c1e23957463d9e7197e9", "score": "0.77435166", "text": "func (s *NoManagementAccountSLRExistsException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "87641c90b4138fed36526dd56543ef27", "score": "0.7741872", "text": "func (s *InternalException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "87641c90b4138fed36526dd56543ef27", "score": "0.7741861", "text": "func (s *InternalException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "31337c8dd2900f7e48a0e28babffec32", "score": "0.77382636", "text": "func (s *InvalidParameterException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "31337c8dd2900f7e48a0e28babffec32", "score": "0.77382636", "text": "func (s *InvalidParameterException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "31337c8dd2900f7e48a0e28babffec32", "score": "0.77382636", "text": "func (s *InvalidParameterException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "31337c8dd2900f7e48a0e28babffec32", "score": "0.77382636", "text": "func (s *InvalidParameterException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "d6a39f6358d87d88a02dc80c9f154afe", "score": "0.772462", "text": "func (s *InvalidInstanceException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "1ff51789cdbcc5c259e1e097e2e126a1", "score": "0.7718453", "text": "func (s *InvalidEventCategoryException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "a54a63bba2bd7605b106e5b7aa388c35", "score": "0.77174026", "text": "func (s *InternalServerException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "a54a63bba2bd7605b106e5b7aa388c35", "score": "0.77164704", "text": "func (s *InternalServerException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "a54a63bba2bd7605b106e5b7aa388c35", "score": "0.77164704", "text": "func (s *InternalServerException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "a54a63bba2bd7605b106e5b7aa388c35", "score": "0.77164704", "text": "func (s *InternalServerException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "a54a63bba2bd7605b106e5b7aa388c35", "score": "0.77164704", "text": "func (s *InternalServerException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "a54a63bba2bd7605b106e5b7aa388c35", "score": "0.77164704", "text": "func (s *InternalServerException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "a54a63bba2bd7605b106e5b7aa388c35", "score": "0.77164704", "text": "func (s *InternalServerException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "a54a63bba2bd7605b106e5b7aa388c35", "score": "0.77164704", "text": "func (s *InternalServerException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "a54a63bba2bd7605b106e5b7aa388c35", "score": "0.77164704", "text": "func (s *InternalServerException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "70914806336560bb240a1d1b315f6a10", "score": "0.7715335", "text": "func (s *InvalidPolicyException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "18507bd77f74ae358bdaa7d5bbaab31f", "score": "0.7714879", "text": "func (s *MaxNumberOfOrganizationConformancePacksExceededException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "322fbbc9ee01f8182174a279f9a08d9a", "score": "0.77070326", "text": "func (err *Error) Message() string {\n\treturn err.msg\n}", "title": "" }, { "docid": "9a933ad1e4d6dfd60bfc27036680c651", "score": "0.7706413", "text": "func (s *MaximumNumberOfTrailsExceededException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "24217d991471b39d0852fe97c95174ce", "score": "0.7703089", "text": "func (s *OperationNotPermittedException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "24217d991471b39d0852fe97c95174ce", "score": "0.7703089", "text": "func (s *OperationNotPermittedException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "ac76b713c6d96fdfa353c8a24bafb9af", "score": "0.7700936", "text": "func (s *InvalidEventDataStoreStatusException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "82bb4455bf19bf5ff68c0e7247245903", "score": "0.76932883", "text": "func (s *InvalidImportSourceException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "b0767971ed0b3a5a62ca6d0152b6a909", "score": "0.7691862", "text": "func (s *RemediationInProgressException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "ededfb21a73fafbc0ec87fee63c8759b", "score": "0.76860875", "text": "func (s *InvalidQueryStatusException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "5a3fc0d38c2640ddc5a3823720ea9e4f", "score": "0.76835275", "text": "func (s *CoreNetworkPolicyException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "0981a3128a5f81e4dfa634cfcac1aa93", "score": "0.767956", "text": "func (s *AgentsAlreadyRunningAssessmentException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "35f11e08560829d3d663e90cadcab893", "score": "0.767394", "text": "func (s *InvalidInputException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "35f11e08560829d3d663e90cadcab893", "score": "0.76736134", "text": "func (s *InvalidInputException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "7f9362e7dc4cb56c55b0d2f2bbc15ef1", "score": "0.76705265", "text": "func (s *PreviewGenerationInProgressException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "ecd69f4c67ce84ea97afa56c58aa86f5", "score": "0.76684225", "text": "func (s *LimitExceededException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "ecd69f4c67ce84ea97afa56c58aa86f5", "score": "0.7667996", "text": "func (s *LimitExceededException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "c82383b4e85387be36784ed7be302bdd", "score": "0.76672494", "text": "func (s *ResourceLimitExceededException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "c82383b4e85387be36784ed7be302bdd", "score": "0.76672494", "text": "func (s *ResourceLimitExceededException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "ecd69f4c67ce84ea97afa56c58aa86f5", "score": "0.7667235", "text": "func (s *LimitExceededException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "c4ec57c67b08d2f9470e5b2c77496bbc", "score": "0.7666648", "text": "func (s *MaxConcurrentQueriesException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "ecd69f4c67ce84ea97afa56c58aa86f5", "score": "0.7666447", "text": "func (s *LimitExceededException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "ecd69f4c67ce84ea97afa56c58aa86f5", "score": "0.7666447", "text": "func (s *LimitExceededException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "ecd69f4c67ce84ea97afa56c58aa86f5", "score": "0.7666447", "text": "func (s *LimitExceededException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "ecd69f4c67ce84ea97afa56c58aa86f5", "score": "0.7666447", "text": "func (s *LimitExceededException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "ecd69f4c67ce84ea97afa56c58aa86f5", "score": "0.7666447", "text": "func (s *LimitExceededException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "bf9215f85f4b4a1950e3cee8e244e226", "score": "0.76647377", "text": "func (s *ARNInvalidException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "e4e21c06629e8e7e18d01c8e844cf064", "score": "0.7658828", "text": "func (s *PermissionVersionsLimitExceededException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "849df9e001bf7541863f6465867a5301", "score": "0.765833", "text": "func (s *NotEligibleException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "63a6bc59e9396104f11a63c3d2318396", "score": "0.7652487", "text": "func (s *MaxNumberOfConformancePacksExceededException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "6410fd798a3d42575748219926599413", "score": "0.7649953", "text": "func (s *InsufficientCapacityException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "92e2951f94a3be8f2d227aadde58b1c2", "score": "0.76426744", "text": "func (s *InvalidLookupAttributesException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "3dd4e5987b535484b9a6dc58240dd76e", "score": "0.7638376", "text": "func (s *ResourcePolicyNotValidException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "0c05c385a8161cd7793f547c89e00025", "score": "0.7634824", "text": "func (s *PolicyEnforcedException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "498ce46af30578accc346647f3f85d0c", "score": "0.7621265", "text": "func (s *TagsLimitExceededException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "15b4a9649156134cfb649b340139335b", "score": "0.7620027", "text": "func (s *CannotDeleteException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "11d34c1925bd099922ec3ee1e6395966", "score": "0.76162934", "text": "func (s *MaxNumberOfOrganizationConfigRulesExceededException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "3dfef3cb6a1bfbf825138d6c2447de0a", "score": "0.7613311", "text": "func (s *UnprocessableEntityException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "5e2fbc4bd4fb9e7061ab47246ec89a8d", "score": "0.76122147", "text": "func (s *MaxActiveResourcesExceededException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "517fadf1fdee5c03efe64831c2449ef7", "score": "0.760897", "text": "func (s *ServerInternalException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "eb0f6973166d70a5623e2fdd2069d65e", "score": "0.76079875", "text": "func (s *InvalidKmsKeyIdException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "53d92c7bbc9ba6487b43dbdf71973136", "score": "0.7607173", "text": "func (s *MaxNumberOfConfigRulesExceededException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "25fc6ef467fec4959ecbe9271184c544", "score": "0.76048416", "text": "func (s *NoSuchConfigurationAggregatorException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "4018d5762c0bdbb8c8238b3f1d6e6d0d", "score": "0.75991786", "text": "func (s *IdempotencyException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "3fea85e85476c54839f536c5bf980d55", "score": "0.75982964", "text": "func (s *NoSuchBucketException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "c7db0844faf4ca159d3f63c4f7ee7723", "score": "0.7598206", "text": "func (s *MissingRequiredParameterException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "c7db0844faf4ca159d3f63c4f7ee7723", "score": "0.7598206", "text": "func (s *MissingRequiredParameterException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "23192d702ba89e212d02ba880bc03e45", "score": "0.75973225", "text": "func (s *InvalidResourceTypeException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "40ce93f2a1d6f5b49e3b2405d7cff7bb", "score": "0.75970167", "text": "func (s *InvalidTagException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "1816bd8e0e4a9b279c6d8dd9b97cd06c", "score": "0.7595022", "text": "func (s *InvalidParameterValueException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "ad677fa37c842492ab918c325adcc505", "score": "0.7594469", "text": "func (s *InsightNotEnabledException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "1816bd8e0e4a9b279c6d8dd9b97cd06c", "score": "0.75936663", "text": "func (s *InvalidParameterValueException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "cbd44a706749c8507cac750778df80bd", "score": "0.75881386", "text": "func (s *NoSuchConfigurationRecorderException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "2ab8226e5ea001bffc159db14121fbd0", "score": "0.75856423", "text": "func (s *BadRequestException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "2ab8226e5ea001bffc159db14121fbd0", "score": "0.75856423", "text": "func (s *BadRequestException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "2ab8226e5ea001bffc159db14121fbd0", "score": "0.75856423", "text": "func (s *BadRequestException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "2ab8226e5ea001bffc159db14121fbd0", "score": "0.75856423", "text": "func (s *BadRequestException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "2ab8226e5ea001bffc159db14121fbd0", "score": "0.75856423", "text": "func (s *BadRequestException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "2ab8226e5ea001bffc159db14121fbd0", "score": "0.75856423", "text": "func (s *BadRequestException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "3248a22b94d14788b36451ad579e7f2e", "score": "0.7585564", "text": "func (s *ResourceARNNotValidException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "f16c07fa9f824503be93fec2cac6b173", "score": "0.75759244", "text": "func (s *TagLimitExceededException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "c78962927a9e9f5bf7f63eeceb4dba19", "score": "0.7569903", "text": "func (s *NotOrganizationManagementAccountException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" } ]
8266410c64d9584113ff3019c0e05dad
Fatalf logging with message.
[ { "docid": "ceda6abb1b679663641bdae8f7f095a0", "score": "0.0", "text": "func (l *Logger) Fatalf(msg string, args ...interface{}) {\n\tlog.IncreaseFatalCounter()\n\tl.loggerf.Fatal().Msgf(msg, args...)\n}", "title": "" } ]
[ { "docid": "159e633e7455ab58d617082aa14a1ce5", "score": "0.78594476", "text": "func LogFatalf(ctx context.Context, format string, args ...interface{}) {\n\tmsg := fmt.Sprintf(format, args...)\n\tmyLogger := getLogger(ctx)\n\tmyLogger.Fatal(msg)\n}", "title": "" }, { "docid": "d1eaa49fc43505fd14d410f8a1a56009", "score": "0.7831283", "text": "func Fatalf(format string, args ...interface{}) { Default.Fatalf(format, args...) }", "title": "" }, { "docid": "901d58364daaff33f19fea6c0b9d50e6", "score": "0.76365364", "text": "func (l *NopLogger) Fatalf(format string, args ...interface{}) {}", "title": "" }, { "docid": "60876dade409351e7d463b3aa70fb40e", "score": "0.75682425", "text": "func (h *TestHelper) fatalf(format string, args ...interface{}) {\n\th.t.Fatalf(format, args...)\n}", "title": "" }, { "docid": "b9f3898c522c799e3d49b95db017388e", "score": "0.7540928", "text": "func Fatalf(format string, v ...interface{}) {\n\tglobalLogger.Fatalf(format, v...)\n}", "title": "" }, { "docid": "582f5557359cba83e1716f21721d526b", "score": "0.7476605", "text": "func (td TestData) Fatalf(tb testing.TB, format string, args ...interface{}) {\n\ttb.Helper()\n\ttb.Fatalf(\"%s: %s\", td.Pos, fmt.Sprintf(format, args...))\n}", "title": "" }, { "docid": "09b7e4e7235ea90602f64f7af1428f76", "score": "0.7475063", "text": "func Fatalf(format string, v ...interface{}) {\n\tlogger.Fatalf(format, v...)\n}", "title": "" }, { "docid": "1e34fb580cc3c1635a3597792e941453", "score": "0.74447125", "text": "func (l *Logger) Fatalf(message string, args ...interface{}) {\n\tformatter := buildFatalfFormatter(l.Settings)\n\twriter := l.getWriter(l.Settings.Writer)\n\tl.write(writer, formatter.format(message, args...))\n}", "title": "" }, { "docid": "9e844c0f7fefbb610d4998eab00f6e39", "score": "0.74360234", "text": "func Fatalf(format string, args ...interface{}) {\n\tGetLogger().Fatalf(format, args...)\n}", "title": "" }, { "docid": "9e844c0f7fefbb610d4998eab00f6e39", "score": "0.74360234", "text": "func Fatalf(format string, args ...interface{}) {\n\tGetLogger().Fatalf(format, args...)\n}", "title": "" }, { "docid": "81701ae47593ff9782c8ab2ead1c6b94", "score": "0.7433363", "text": "func (hd *Hal) Fatalf(format string, args ...interface{}) {\n\tlog.Fatalf(format, args...)\n}", "title": "" }, { "docid": "9c45495f34988726b854354626599e5e", "score": "0.7423524", "text": "func Fatalf(format string, args ...interface{}) {\r\n\tdefaultLogger.Fatalf(format, args...)\r\n}", "title": "" }, { "docid": "6a7072efcd5525bc762cb1e98a5f420a", "score": "0.74184006", "text": "func (l EmptyLogger) Fatalf(format string, args ...interface{}) {}", "title": "" }, { "docid": "9dd63ddd3f8c918a5e7f96b99df29b8f", "score": "0.74043685", "text": "func Fatalf(msg string, args ...interface{}) {\n\tlogger().Fatalf(msg, args...)\n}", "title": "" }, { "docid": "02ba04dee0f0e6a467c174f155e67327", "score": "0.73977274", "text": "func Fatalf(template string, args ...interface{}) {\n\tGetLogger().Fatalf(template, args...)\n}", "title": "" }, { "docid": "43613d1e6f8cf5c57267375b4c78ff05", "score": "0.73917806", "text": "func Fatalf(format string, v ...interface{}) {\n\tStandardLogger().Fatalf(format, v...)\n}", "title": "" }, { "docid": "b0642787dfd5f5e7d1bf818808344451", "score": "0.7391293", "text": "func Fatalf(format string, args ...interface{}) {\n\tDefaultLogger.Fatalf(format, args...)\n}", "title": "" }, { "docid": "072acb82ae20c66eb39b8c801fe94f6b", "score": "0.7375738", "text": "func Fatalf(format string, args ...interface{}) {\n\tlogger.Fatalf(format, args...)\n}", "title": "" }, { "docid": "072acb82ae20c66eb39b8c801fe94f6b", "score": "0.7375738", "text": "func Fatalf(format string, args ...interface{}) {\n\tlogger.Fatalf(format, args...)\n}", "title": "" }, { "docid": "24b75394f94578ea4f58edd4884b664e", "score": "0.7374983", "text": "func (t *T) Fatalf(format string, args ...interface{}) {\n\tt.Logf(format, args...)\n\tt.FailNow()\n}", "title": "" }, { "docid": "fbb0538f710c6132b649a5cac5037392", "score": "0.73737204", "text": "func Fatalf(format string, a ...interface{}) {\n\tDefault.Fatalf(format, a...)\n}", "title": "" }, { "docid": "f1fab8a88c9f394cc0b2c8d68383f978", "score": "0.7369756", "text": "func Fatalf(ctx context.Context, msg string, args ...interface{}) {\n\tDefaultLogger.Fatalf(ctx, msg, args...)\n}", "title": "" }, { "docid": "65bb167d7d9975247c78574d605f81c2", "score": "0.7365095", "text": "func (l logger) Fatalf(format string, args ...interface{}) {\n\tl.sourced().Fatalf(format, args...)\n}", "title": "" }, { "docid": "65bb167d7d9975247c78574d605f81c2", "score": "0.7365095", "text": "func (l logger) Fatalf(format string, args ...interface{}) {\n\tl.sourced().Fatalf(format, args...)\n}", "title": "" }, { "docid": "bb74d8a72dc2a56259c28d839770f71d", "score": "0.7345831", "text": "func Fatalf(template string, args ...interface{}) {\n\tDefaultSugaredLogger.Fatalf(template, args...)\n}", "title": "" }, { "docid": "26e7cda2bc17492c2047f89a24aa5c59", "score": "0.7345136", "text": "func (c *common) Fatalf(format string, args ...interface{}) {\n\tc.log(fmt.Sprintf(format, args...))\n\tc.FailNow()\n}", "title": "" }, { "docid": "9a89e6912f67bd0fd6531dc488de7684", "score": "0.7341117", "text": "func Fatalf(f string, a ...interface{}) {\n\tdefaultLogger.Fatalf(f, a...)\n}", "title": "" }, { "docid": "a4bd5e619ec7f470fd1c36d5934ad50d", "score": "0.732666", "text": "func (logger *Logger) Fatalf(format string, v ...interface{}) {\n\tif logger.stackdriverEnabled {\n\t\tlogger.e.Fatalf(format, v...)\n\t}\n\tif logger.stdoutEnabled {\n\t\tlog.Fatalf(format, v...)\n\t}\n}", "title": "" }, { "docid": "3b9a7ae9561b468d89d617ea913336a2", "score": "0.73259115", "text": "func (l GrpcLogger) Fatalf(format string, args ...interface{}) {\n\tl.Logger.Fatal().Msgf(format, args...)\n}", "title": "" }, { "docid": "12ecc2f37d50b32ecfec5f6369e658ba", "score": "0.7320512", "text": "func (l *Logger) Fatalf(fmt string, v ...interface{}) { l.WritefFunc(FatalLevel, fmt, v...) }", "title": "" }, { "docid": "fa16715153621355ad18a0e4e4cc98cd", "score": "0.73116046", "text": "func Fatalf(format string, args ...interface{}) {\n\tlog.Fatalf(format, args...)\n}", "title": "" }, { "docid": "27046cd4b2e1ce1283846831236a2b3e", "score": "0.73066497", "text": "func (l GrpcZeroLogger) Fatalf(format string, args ...interface{}) {\n\tl.log.Fatal().Msgf(format, args...)\n}", "title": "" }, { "docid": "f5d1d83ffe40874dbec73e94cf87ee0a", "score": "0.7305866", "text": "func (l *Logger) Fatalf(msg string, args ...interface{}) {\n\tl.logger.Fatalf(msg, args...)\n}", "title": "" }, { "docid": "e2642accaba4683514c1df7f03f6964b", "score": "0.7301869", "text": "func Fatalf(format string, args ...interface{}) {\n\tbaseLogger.sourced().Fatalf(format, args...)\n}", "title": "" }, { "docid": "e2642accaba4683514c1df7f03f6964b", "score": "0.7301869", "text": "func Fatalf(format string, args ...interface{}) {\n\tbaseLogger.sourced().Fatalf(format, args...)\n}", "title": "" }, { "docid": "a1cc30d59da2b0e9c070bfb6ba81202e", "score": "0.72849655", "text": "func (l GRPCLogger) Fatalf(format string, args ...interface{}) {\n\tl.getLogger().Fatal(fmt.Sprintf(format, args...), l.Fields)\n}", "title": "" }, { "docid": "fe81ae06b8a6a55b03a329d7c0e0d184", "score": "0.72817427", "text": "func Fatalf(format string, a ...interface{}) {\n\tFatal(fmt.Sprintf(format, a...))\n}", "title": "" }, { "docid": "42f880570625372e9bea94699419911b", "score": "0.72804266", "text": "func Fatalf(format string, v ...interface{}) {\n\texecuteLogCall(func(log Logger, format string, v ...interface{}) {\n\t\tlog.Fatalf(format, v...)\n\t}, format, v...)\n}", "title": "" }, { "docid": "6ee230bc32c7e44fc7931f49faf36d6b", "score": "0.72658354", "text": "func Fatalf(t string, i ...interface{}) {\n\tstaticLogger.Fatalf(t, i...)\n}", "title": "" }, { "docid": "df6431512db9b78759dc62e23895703f", "score": "0.72462696", "text": "func (logger *LogrusLogger) Fatalf(format string, args ...interface{}) {\n\tlogger.internalLog.Fatalf(format, args...)\n}", "title": "" }, { "docid": "6253f1a14a7361c565f3a975beabb913", "score": "0.7238031", "text": "func (t *TestingTB) Fatalf(format string, args ...any) {\n\tt.TestingT.Fatal(fmt.Sprintf(format, args...))\n}", "title": "" }, { "docid": "a8450baf7dc2c80fb0b656e99aa33f57", "score": "0.72376555", "text": "func Fatalf(format string, args ...interface{}) {\n\tdef.Fatalf(format, args...)\n}", "title": "" }, { "docid": "7186eb79fd33c596384551ee0d8cdd11", "score": "0.72364175", "text": "func Fatalf(ctx context.Context, fs string, args ...interface{}) {\n\tFatalv(ctx, 1, fmt.Sprintf(fs, args...))\n}", "title": "" }, { "docid": "4f25d90037621eeadec218ca32a65fe2", "score": "0.7227968", "text": "func Fatalf(format string, args ...interface{}) {\n\tDefault().Fatalf(format, args...)\n}", "title": "" }, { "docid": "102e435bcbfaee1b83ef7fab18268b80", "score": "0.7210726", "text": "func (l *scwLogger) Fatalf(format string, v ...interface{}) {\n\tlevel.Error(l).Log(\"msg\", fmt.Sprintf(format, v...))\n\tos.Exit(1)\n}", "title": "" }, { "docid": "6037bc2e67bf24ac9ac0a53d67365b93", "score": "0.721042", "text": "func Fatalf(format string, args ...interface{}) {\n\tstd.Fatalf(format, args...)\n}", "title": "" }, { "docid": "f8983a524a5e3e3a36f9e2d2f6a44d78", "score": "0.72089934", "text": "func Fatalf(format string, args ...interface{}) {\n\tentry.Fatalf(format, args...)\n}", "title": "" }, { "docid": "71c5eeae81fab8b0e6896eba747554d7", "score": "0.7196775", "text": "func (l *Logger) SyncFatalf(format string, args ...interface{}) {\n\tl.trigger(false, Errorf(Fatal, format, args...))\n}", "title": "" }, { "docid": "339db8fd1378ca31c7b60bb47124e51c", "score": "0.7193932", "text": "func Fatalf(format string, args ...interface{}) {\r\n\tGlobal.bizlog.Fatalf(format, args...)\r\n}", "title": "" }, { "docid": "e4948598d4e652f2e0bece2d020df064", "score": "0.7189103", "text": "func (l *Logger) Fatalf(format string, a ...interface{}) {\n\tl.log(Fatal, format, a...)\n\tpanic(fmt.Sprintf(format, a...))\n}", "title": "" }, { "docid": "84bee36ce77a76cdd284c2b71439f84b", "score": "0.7183011", "text": "func Fatalf(format string, args ...interface{}) {\n\tl.Fatalf(format, args...)\n}", "title": "" }, { "docid": "610fffc698a3f35d441e9ce819ecd943", "score": "0.7180001", "text": "func Fatalf(template string, args ...interface{}) {\n\tglobalLogger.Sugar().Fatalf(template, args...)\n}", "title": "" }, { "docid": "ad4c876005c937885c8857aa3e979888", "score": "0.71679145", "text": "func Fatalf(format string, args ...interface{}) {\n\tsentry.CaptureException(fmt.Errorf(format, args...))\n\tlogger.Fatalf(format, args...)\n}", "title": "" }, { "docid": "2e000cb99c008a022c02d3f755675ac2", "score": "0.7162162", "text": "func Fatalf(msg string, args ...interface{}) {\n\tif InTesting() {\n\t\tlogger.Panicf(msg, args)\n\t}\n\tlogger.Fatalf(msg, args...)\n}", "title": "" }, { "docid": "81d493bddb14cbb5493795ce4b13682c", "score": "0.7160923", "text": "func (m *testMock) Fatalf(format string, args ...any) {\n\tm.fail(fmt.Sprintf(format, args...))\n}", "title": "" }, { "docid": "d8d9e4ce276415b5ba73561b5f35285c", "score": "0.7147075", "text": "func (w *Log) Fatalf(format string, args ...interface{}) {\n\tw.Fatal(fmt.Sprintf(format, args...))\n}", "title": "" }, { "docid": "b9bc4d97d3da4200fb07527f29ff7372", "score": "0.71467793", "text": "func (l *Logger) Fatalf(format string, v ...interface{}) {\n\te := acquireEntry(l)\n\te.Fatalf(format, v...)\n\treleaseEntry(e)\n}", "title": "" }, { "docid": "70438f52b6f008eb4c9267c3eddd1eb1", "score": "0.71444595", "text": "func fatalf(service *storage.Service, errorMessage string, args ...interface{}) {\n\tlog.Fatalf(\"Dying with error:\\n\"+errorMessage, args...)\n}", "title": "" }, { "docid": "1a2c44aa1a460d58658b86a20eed326b", "score": "0.71310234", "text": "func logFatalf(format string, v ...interface{}) {\n\t// TODO what happens with an ELB if we have a logFatal?\n\tfmt.Fprintf(os.Stderr, format, v...)\n\t// if pidPath != \"\" {\n\t// \tos.Remove(pidPath)\n\t// }\n\tlog.Fatalf(format, v...)\n}", "title": "" }, { "docid": "ae2f18642132b0202ec8f4fcec4df2ba", "score": "0.7125702", "text": "func (r *MessageManager) AddFatalf(format string, a ...interface{}) {\n\tf := fmt.Sprintf(format, a...)\n\tr.AddFatal(f)\n}", "title": "" }, { "docid": "ba471c6803039de98d024014eb6ca4b8", "score": "0.71234417", "text": "func Fatalf(template string, args ...any) {\n\tglobal.Logger.Sugar().Fatalf(template, args...)\n}", "title": "" }, { "docid": "75e9be9d995b84df96621c82842a47ad", "score": "0.7119682", "text": "func Fatalf(f string, args ...interface{}) {\n\tstd.Fatalf(f, args...)\n}", "title": "" }, { "docid": "d13c12cd1e2f886140cc688d82dc328c", "score": "0.7116366", "text": "func Fatalf(format string, args ...interface{}) {\n\tfatalf(1, logger.fatal, format, args...)\n}", "title": "" }, { "docid": "a312019ed7448d3ea4eea73ca781c234", "score": "0.71128845", "text": "func logFatalf(format string, args ...interface{}) {\n\tif _, file, line, ok := runtime.Caller(1); ok {\n\t\tfmt.Printf(\"%s.%d: \", file, line)\n\t}\n\tfmt.Printf(format, args...)\n\tif format != \"\" && format[len(format)-1] != '\\n' {\n\t\tfmt.Println()\n\t}\n\tos.Exit(1)\n}", "title": "" }, { "docid": "273251eecd1bed00c0932cef2ccb4ace", "score": "0.71117944", "text": "func Fatalf(format string, v ...interface{}) {\n\tmainLogger.Errorf(format, v...)\n\tClose()\n\tos.Exit(1)\n}", "title": "" }, { "docid": "ac6467f2a15fd46921d903df560c76a2", "score": "0.7105022", "text": "func Fatalf(format string, args ...interface{}) {\n\tlog.Fatalf(resolveLocation(format), args...)\n}", "title": "" }, { "docid": "84d148acff4103d489d7f1d2665a0d32", "score": "0.7095071", "text": "func (p *Plugin) LogFatalfAndExitf(format string, args ...interface{}) {\n\tp.Logger().Fatalf(format, args...)\n}", "title": "" }, { "docid": "00b285660fa4663e33cc50303afbbcf9", "score": "0.70933235", "text": "func Fatalf(format string, args ...interface{}) {\n\toutputf(levelFatal, format, args...)\n}", "title": "" }, { "docid": "398751c3a39168bb810d4cf2847c81da", "score": "0.709201", "text": "func (c *C) Fatalf(format string, args ...interface{}) {\n\tc.logCaller(1)\n\tc.logString(fmt.Sprint(\"Error: \", fmt.Sprintf(format, args...)))\n\tc.logNewLine()\n\tc.FailNow()\n}", "title": "" }, { "docid": "e285eb7025099fd9c136f1e97f2e86bd", "score": "0.70917493", "text": "func Fatalf(format string, v ...interface{}) {\n\tstd.Output(FATAL, 2, fmt.Sprintf(format, v...))\n}", "title": "" }, { "docid": "6c77cd8646dff74f079a0fe5679796a4", "score": "0.70888966", "text": "func Fatalf(format string, l ...interface{}) {\n\tlog.Fatalf(\"FATAL %s\", fmt.Sprintf(format, l...))\n}", "title": "" }, { "docid": "7d09f34205e29b3cce820bb11ad2e57a", "score": "0.70870316", "text": "func Fatalf(format string, args ...interface{}) {\n\tmsg := fmt.Sprintf(format, args...)\n\tFatal(msg)\n}", "title": "" }, { "docid": "3e95bbd54e6d763150c89e9ba8bae31a", "score": "0.7070201", "text": "func (cl *ContextLogger) Fatalf(format string, args ...interface{}) {\n\tcl.logger.Fatalf(format, args)\n}", "title": "" }, { "docid": "fd8c16244f6983ac0da14a35fd64ac2a", "score": "0.7069553", "text": "func Fatalf(format string, value ...interface{}) {\n\tlogger.logf(LevelFatal, format, value...)\n\tExiter(1)\n}", "title": "" }, { "docid": "889e04e41b5ee914c6bbfb34e11fc5d3", "score": "0.70677376", "text": "func Fatalf(format string, args ...interface{}) {\n\tdoLogf(2, fatalLevel, format, args...)\n\tos.Exit(255)\n}", "title": "" }, { "docid": "0d5c4e09545b0fff849fb1e189c01b2b", "score": "0.7067612", "text": "func (l *Logger) Fatalf(format string, v ...interface{}) {\n\tl.log(FatalMode, fmt.Sprintf(format, v...))\n}", "title": "" }, { "docid": "f79292fcf98cd591734f9d39438068d0", "score": "0.70616347", "text": "func (t *T) Fatalf(format string, values ...interface{}) {\n\tt.t.Helper()\n\tt.t.Log(fmt.Sprintf(format, values...))\n\tt.failed = true\n\tt.values = values\n\tt.format = format\n\tdoPanic()\n}", "title": "" }, { "docid": "5e6b073ce22a2a5e3ee6fab9df056019", "score": "0.7058988", "text": "func (l *Logger) Fatalf(format string, args ...interface{}) {\n\tl.Logger.Fatal(fmt.Sprintf(format, args...))\n}", "title": "" }, { "docid": "47b54889d2f15e7f3f44381713d51365", "score": "0.704846", "text": "func Fatalf(format string, args ...interface{}) {\n\tlog.Fatal().Msgf(format, args...)\n\t// Make sure fatal logs will exit.\n\tos.Exit(1)\n}", "title": "" }, { "docid": "64746aeceef2b45cd8fdeae8ca8640d5", "score": "0.7036769", "text": "func Fatalf(format string, args ...interface{}) {\n\trootLogger.Logf(FatalLvl, format, args...)\n}", "title": "" }, { "docid": "7d9f1db7da7b8c233d6777b795bd5064", "score": "0.7035021", "text": "func (r *testReporter) Fatalf(format string, args ...interface{}) {\n\ts := fmt.Sprintf(format, args...)\n\tr.logs.error(s)\n\tr.fatal(s)\n}", "title": "" }, { "docid": "62d42dd75fec9602b68f7825a3401af2", "score": "0.70337236", "text": "func Fatalf(format string, v ...interface{}) {\n\tgl.Fatalf(format, v...)\n}", "title": "" }, { "docid": "22469915bc7e235b4e60ee854ecdd3db", "score": "0.70330113", "text": "func Fatalf(format string, v ...interface{}) {\n\tl.Output(2, fmt.Sprintf(format, v...))\n\tos.Exit(1)\n}", "title": "" }, { "docid": "6e7831ea9d8f873bf076ff9a24f56e2d", "score": "0.7022575", "text": "func IfErrFatalf(err error, msg string, args ...interface{}) {\n\tif err != nil {\n\t\tFatalf(msg, args...)\n\t}\n}", "title": "" }, { "docid": "6728336ce1879f40a43ab1057f19b004", "score": "0.7021563", "text": "func (l clogger) Fatalf(ctx context.Context, format string, args ...interface{}) {\n\tl.log.With(GetGlobalLFM().ExtractContextAttributes(ctx)...).Fatalf(format, args...)\n}", "title": "" }, { "docid": "dcf6e4f0360f8bce5a5d11d316aed7bf", "score": "0.70125407", "text": "func (ctr *SafeTestReporter) Fatalf(format string, args ...interface{}) {\n\ts := fmt.Sprintf(format, args...)\n\tctr.error(s)\n\t// panic here, since a Goexit() might leave the main thread\n\t// waiting for results.\n\tpanic(s)\n}", "title": "" }, { "docid": "1cc7d5e340450ac816cf8da68dfffe0a", "score": "0.7008466", "text": "func (l *Logger) Fatalf(format string, args ...interface{}) error {\n\treturn l.Fatal(fmt.Errorf(format, args...))\n}", "title": "" }, { "docid": "14cebdd604856af1affd22020e619a74", "score": "0.70016366", "text": "func Fatalf(format string, v ...interface{}) {\n\tErrf(format, v...)\n\tos.Exit(1)\n}", "title": "" }, { "docid": "95f569d6c7e60ee61f48621aea17b4b3", "score": "0.70010334", "text": "func (c *Component) LogFatalfAndExit(template string, args ...interface{}) {\n\tc.Logger().Fatalf(template, args...)\n}", "title": "" }, { "docid": "28bb4961baa01f16b9a5ddf40a5725c5", "score": "0.69982", "text": "func Fatalf(format string, args ...interface{}) {\n\tlogging.printf(fatalLog, format, args...)\n}", "title": "" }, { "docid": "e8426ac5ce7b36b8ed1d7a406a3990da", "score": "0.6995683", "text": "func Fatalf(format string, v ...interface{}) {\n\tif logFile != nil {\n\t\tfmt.Fprintf(logFile, format, v...)\n\t}\n\n\tlog.Fatal().Msg(fmt.Sprintf(format, v...))\n}", "title": "" }, { "docid": "a2c607f1d7eb8eb3cb605a379076fed2", "score": "0.69895613", "text": "func (tl *throttledLogger) Fatalf(format string, args ...interface{}) {\n\ttl.log.Fatalf(format, args)\n}", "title": "" }, { "docid": "4c338b3830e3017496a72e04c27357e4", "score": "0.6987129", "text": "func (e *ssaExport) Fatalf(pos src.XPos, msg string, args ...interface{}) {\n\tFatalf(msg, args...)\n}", "title": "" }, { "docid": "cc3e9f06a003629f4b8296964107f824", "score": "0.698622", "text": "func (l *Logger) Fatalf(format string, args ...interface{}) {\n\tl.Logf(FatalLvl, format, args...)\n}", "title": "" }, { "docid": "1d9a80c9b3841787560d4e433f1d7547", "score": "0.69811666", "text": "func (l *Log) Fatalf(msg string, v ...interface{}) {\n\tn := time.Now()\n\tl.Fatal(fmt.Sprintf(n.Format(FORMAT) + \": \" + msg, v...))\n}", "title": "" }, { "docid": "66c3cba5862502de5858685d27530ba4", "score": "0.6980518", "text": "func Fatalf(s string, data ...interface{}) error {\n\treturn Wrap(fatalError(fmt.Sprintf(s, data...)), \"Fatal\")\n}", "title": "" }, { "docid": "ab61273326fd0bd2e4db2b045a42a8bd", "score": "0.6977703", "text": "func Fatalf(format string, v ...interface{}) {\n\toutput(2, fmt.Sprintf(format, v...))\n\tfatal(\"exit status 1\")\n}", "title": "" }, { "docid": "f2e7e2bd3011c8f50c09bcec8d9468ea", "score": "0.6973383", "text": "func Fatalf(format string, v ...interface{}) {\n\tOutput(2, aurora.BrightRed, \"FATAL \", fmt.Sprintf(format, v...))\n\tos.Exit(1)\n}", "title": "" }, { "docid": "9e4cd4cf6185c2f4a979453f8994e8fc", "score": "0.6971424", "text": "func (l *zapLogger) Fatalf(template string, args ...interface{}) {\n\tl.sugaredLogger.Fatalf(template, args...)\n}", "title": "" }, { "docid": "fbbd30ec9957db6f9b635d829b7d079c", "score": "0.6969812", "text": "func (l Logger) Fatalf(format string, a ...interface{}) {\n\tl.Fatal(fmt.Sprintf(format, a...))\n}", "title": "" }, { "docid": "2d43082a635cdfe3f20f0140f538b58a", "score": "0.69639045", "text": "func (*PanickingTB) Fatalf(format string, args ...interface{}) {\n\tpanic(fmt.Sprintf(format, args...))\n}", "title": "" } ]
78e011fc7317b5a7aec88da4b990c06d
The first parameter can be 1 or 2 (relay 1 or relay 2). The second parameter is the desired state of the relay (true means on and false means off). The third parameter indicates the time that the relay should hold the state. If this function is called with the parameters (1, true, 1500): Relay 1 will turn on and in 1.5s it will turn off again. A monoflop can be used as a failsafe mechanism. For example: Lets assume you have a RS485 bus and a Dual Relay Bricklet connected to one of the slave stacks. You can now call this function every second, with a time parameter of two seconds. The relay will be on all the time. If now the RS485 connection is lost, the relay will turn off in at most two seconds.
[ { "docid": "5b8f7e421f59a565cf87ced6c4827006", "score": "0.65359473", "text": "func (device *DualRelayBricklet) SetMonoflop(relay uint8, state bool, time uint32) (err error) {\n\tvar buf bytes.Buffer\n\tbinary.Write(&buf, binary.LittleEndian, relay)\n\tbinary.Write(&buf, binary.LittleEndian, state)\n\tbinary.Write(&buf, binary.LittleEndian, time)\n\n\tresultBytes, err := device.device.Set(uint8(FunctionSetMonoflop), buf.Bytes())\n\tif err != nil {\n\t\treturn err\n\t}\n\tif len(resultBytes) > 0 {\n\t\tvar header PacketHeader\n\n\t\theader.FillFromBytes(resultBytes)\n\n\t\tif header.Length != 8 {\n\t\t\treturn fmt.Errorf(\"Received packet of unexpected size %d, instead of %d\", header.Length, 8)\n\t\t}\n\n\t\tif header.ErrorCode != 0 {\n\t\t\treturn DeviceError(header.ErrorCode)\n\t\t}\n\n\t\tbytes.NewBuffer(resultBytes[8:])\n\n\t}\n\n\treturn nil\n}", "title": "" } ]
[ { "docid": "c4e63971bda792cc24581f99528b9826", "score": "0.58634204", "text": "func (t *TasmotaT1) TurnOn() error {\n\t_, err := t.UpdateStatus()\n\tif err != nil {\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"err\": err,\n\t\t}).Error(\"failed to update status before turning on\")\n\t\treturn err\n\t}\n\n\ttimeout := time.Duration(5 * time.Second)\n\tclient := http.Client{\n\t\tTimeout: timeout,\n\t}\n\tresp, err := client.Get(fmt.Sprintf(\"%s/cm?cmnd=POWER%d%%20ON\", t.URI, t.SwitchNumber))\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\trespBytes, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn err\n\t}\n\tvar switchStatusResp map[string]string\n\terr = json.Unmarshal(respBytes, &switchStatusResp)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif status, ok := switchStatusResp[\"POWER\"+strconv.Itoa(t.SwitchNumber)]; ok {\n\t\tif status != \"ON\" {\n\t\t\terrorString := fmt.Sprintf(\"switch %d not reporting as ON after requesting to be ON\", t.SwitchNumber)\n\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\"switchStatusResp\": switchStatusResp,\n\t\t\t\t\"switchNumber\": t.SwitchNumber,\n\t\t\t}).Error(errorString)\n\t\t\treturn fmt.Errorf(errorString)\n\t\t}\n\t} else {\n\t\terrorString := fmt.Sprintf(\"switch %d not reporting back after requesting to be ON\", t.SwitchNumber)\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"switchStatusResp\": switchStatusResp,\n\t\t\t\"switchNumber\": t.SwitchNumber,\n\t\t}).Error(errorString)\n\t\treturn fmt.Errorf(errorString)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "561dcd0435c616349e0da27b3e0157d4", "score": "0.5640883", "text": "func (device *DualRelayBricklet) GetMonoflop(relay uint8) (state bool, time uint32, timeRemaining uint32, err error) {\n\tvar buf bytes.Buffer\n\tbinary.Write(&buf, binary.LittleEndian, relay)\n\n\tresultBytes, err := device.device.Get(uint8(FunctionGetMonoflop), buf.Bytes())\n\tif err != nil {\n\t\treturn state, time, timeRemaining, err\n\t}\n\tif len(resultBytes) > 0 {\n\t\tvar header PacketHeader\n\n\t\theader.FillFromBytes(resultBytes)\n\n\t\tif header.Length != 17 {\n\t\t\treturn state, time, timeRemaining, fmt.Errorf(\"Received packet of unexpected size %d, instead of %d\", header.Length, 17)\n\t\t}\n\n\t\tif header.ErrorCode != 0 {\n\t\t\treturn state, time, timeRemaining, DeviceError(header.ErrorCode)\n\t\t}\n\n\t\tresultBuf := bytes.NewBuffer(resultBytes[8:])\n\t\tbinary.Read(resultBuf, binary.LittleEndian, &state)\n\t\tbinary.Read(resultBuf, binary.LittleEndian, &time)\n\t\tbinary.Read(resultBuf, binary.LittleEndian, &timeRemaining)\n\n\t}\n\n\treturn state, time, timeRemaining, nil\n}", "title": "" }, { "docid": "0cf548b7cd6782c6423eeb341e1d6517", "score": "0.55427986", "text": "func (b *f6BankSwitchCart) PowerOn() {}", "title": "" }, { "docid": "b482a2d21135ace996973eced3319649", "score": "0.5522546", "text": "func (t *TasmotaT1) TurnOff() error {\n\n\t_, err := t.UpdateStatus()\n\tif err != nil {\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"err\": err,\n\t\t}).Error(\"failed to update status before turning off\")\n\t\treturn err\n\t}\n\n\ttimeout := time.Duration(5 * time.Second)\n\tclient := http.Client{\n\t\tTimeout: timeout,\n\t}\n\tresp, err := client.Get(fmt.Sprintf(\"%s/cm?cmnd=POWER%d%%20OFF\", t.URI, t.SwitchNumber))\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\trespBytes, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn err\n\t}\n\tvar switchStatusResp map[string]string\n\terr = json.Unmarshal(respBytes, &switchStatusResp)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif status, ok := switchStatusResp[\"POWER\"+strconv.Itoa(t.SwitchNumber)]; ok {\n\t\tif status != \"OFF\" {\n\t\t\terrorString := fmt.Sprintf(\"switch %d not reporting as OFF after requesting to be OFF\", t.SwitchNumber)\n\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\"switchStatusResp\": switchStatusResp,\n\t\t\t\t\"switchNumber\": t.SwitchNumber,\n\t\t\t}).Error(errorString)\n\t\t\treturn fmt.Errorf(errorString)\n\t\t}\n\t} else {\n\t\terrorString := fmt.Sprintf(\"switch %d not reporting back after requesting to be OFF\", t.SwitchNumber)\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"switchStatusResp\": switchStatusResp,\n\t\t\t\"switchNumber\": t.SwitchNumber,\n\t\t}).Error(errorString)\n\t\treturn fmt.Errorf(errorString)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c07817d3cba315bd9abbc285c27d7dde", "score": "0.54803604", "text": "func (b *f8BankSwitchCart) PowerOn() {}", "title": "" }, { "docid": "1072d978343133b2f62b82051d63807c", "score": "0.5458752", "text": "func (o *OnkyoReceiver) Mute(state string) (string, error) {\n var rv string\n var err error\n switch state {\n case \"on\":\n rv, err = o.sendCmd(\"AMT01\", 0)\n case \"off\":\n rv, err = o.sendCmd(\"AMT00\", 0)\n case \"toggle\":\n rv, err = o.sendCmd(\"AMTTG\", 0)\n }\n return rv, err\n}", "title": "" }, { "docid": "12bec63828ba110d6e0cac9512295337", "score": "0.5415567", "text": "func (b *f6SCBankSwitchCart) PowerOn() {}", "title": "" }, { "docid": "b614803325dea463f2eac4a7fdfa2df3", "score": "0.524972", "text": "func (c *Controller) TurnOnRelay(ctx context.Context, index uint16) error {\n\tlsb := byte(index - 1)\n\tmsb := byte(index >> 8)\n\tpacket := CreatePacket([]byte{254, 48, lsb, msb})\n\treturn c.ExecuteCommand(ctx, packet)\n}", "title": "" }, { "docid": "a6035c72151904b0ae8eec1f22f47a83", "score": "0.5244552", "text": "func (o *OnkyoReceiver) Power(state string) (string, error) {\n var rv string\n var err error\n\n switch state {\n case \"on\":\n rv, err = o.sendCmd(\"PWR01\", -1)\n case \"off\":\n rv, err = o.sendCmd(\"PWR00\", -1)\n case \"toggle\":\n rv, err = o.sendCmd(\"PWRQSTN\", -1)\n if err != nil {\n clog.Error(\"ERROR: %s\", err.Error())\n return \"\", err\n }\n clog.Debug(\"Power state query: '%s', %d\", rv, len(rv))\n if rv == \"PWR00\" {\n clog.Debug(\"Sending PWR01\")\n o.sendCmd(\"PWR01\", -1)\n } else {\n clog.Debug(\"Sending PWR00\")\n o.sendCmd(\"PWR00\", -1)\n }\n }\n return rv, err\n}", "title": "" }, { "docid": "2df20a55565faf8cdd0237c920af8977", "score": "0.5232923", "text": "func charging_timer() {\n phase := \"off\"\n h_on := 1\n m_on := 0\n s_on := 0\n h_off := 9\n m_off := 0\n s_off :=0\n t := time.Now()\n h,m,s := t.Clock()\n for {\n t = time.Now()\n h,m,s = t.Clock()\n //is it time to turn on the charger?\n if phase == \"off\" {\n if h >= h_on {\n if m >= m_on {\n if s >= s_on {\n phase = \"on\"\n bbb_io.DigitalWrite(SW[0],\"HIGH\") //turn it on \n }}}\n }\n //is it time to turn off the charger? \n if phase == \"on\" {\n if h >= h_off {\n if m >= m_off {\n if s >= s_off {\n phase = \"off\"\n bbb_io.DigitalWrite(SW[0],\"LOW\") \n }}}\n }\n time.Sleep(time.Second*1)\n }\n}", "title": "" }, { "docid": "25a1315a177d82e0344b7d5024b474fe", "score": "0.5203327", "text": "func toggle_gpio(restart_gpio *bool) {\n\n var gpio_state C.int\n\n for {\n\n if *restart_gpio == true {\n //waait for next 10ms slot\n // for int(C.get_system_time(nil, nil)*1000)%10 != 0 {\n // }\n *restart_gpio = false\n gpio_state = 0\n }\n\n C.set_gpio(gpio_state)\n\n gpio_state ^= 1\n\n time.Sleep(time.Millisecond * 10)\n\n }\n\nreturn\n}", "title": "" }, { "docid": "2be5871522f7355f695bbcd2cdd84a21", "score": "0.5144454", "text": "func (device *DualRelayBricklet) SetState(relay1 bool, relay2 bool) (err error) {\n\tvar buf bytes.Buffer\n\tbinary.Write(&buf, binary.LittleEndian, relay1)\n\tbinary.Write(&buf, binary.LittleEndian, relay2)\n\n\tresultBytes, err := device.device.Set(uint8(FunctionSetState), buf.Bytes())\n\tif err != nil {\n\t\treturn err\n\t}\n\tif len(resultBytes) > 0 {\n\t\tvar header PacketHeader\n\n\t\theader.FillFromBytes(resultBytes)\n\n\t\tif header.Length != 8 {\n\t\t\treturn fmt.Errorf(\"Received packet of unexpected size %d, instead of %d\", header.Length, 8)\n\t\t}\n\n\t\tif header.ErrorCode != 0 {\n\t\t\treturn DeviceError(header.ErrorCode)\n\t\t}\n\n\t\tbytes.NewBuffer(resultBytes[8:])\n\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a0bdc0f0656618562c2bf376ce569630", "score": "0.5093888", "text": "func (n *Connection) TurnOnFanTimer(deviceID string, duration int) error {\n\t// Error checking\n\tvalidVals := []int{15, 30, 45, 60, 120, 240, 480, 720}\n\n\tvalid := false\n\tfor _, v := range validVals {\n\t\tif duration == v {\n\t\t\tvalid = true\n\t\t}\n\t}\n\n\tif !valid {\n\t\treturn fmt.Errorf(\"Fan Timer Duration must be one of the following: %d\", validVals)\n\t}\n\n\tvals := make(map[string]interface{})\n\tvals[\"fan_timer_active\"] = true\n\tvals[\"fan_timer_duration\"] = duration\n\n\treturn n.setValue(\"thermostats\", deviceID, vals)\n}", "title": "" }, { "docid": "910f906e4fbddbc37680f6aba4a80332", "score": "0.5084982", "text": "func (lf LightFlags) LED() bool { return lf[0]&0x08 == 0x08 }", "title": "" }, { "docid": "910f906e4fbddbc37680f6aba4a80332", "score": "0.5084982", "text": "func (lf LightFlags) LED() bool { return lf[0]&0x08 == 0x08 }", "title": "" }, { "docid": "10c133e7f8a9086fcd91a712ce685d55", "score": "0.50619394", "text": "func (m *Motor) toggle() {\n\n\tif m.locked {\n\t\t// already switching i presume?\n\t\treturn\n\t}\n\n\tif m.IsSpinning() {\n\t\tm.Stop()\n\t}\n\n\tm.locked = true\n\n\t// wait till the current switching stops...\n\ttime.Sleep(m.BreakTime)\n\n\tm.pinPlus.Toggle()\n\tm.pinMin.Toggle()\n\tm.pinEnable.High()\n\n\tm.locked = false\n}", "title": "" }, { "docid": "ddc6c6ab4d544717f24ea2bf5a09621a", "score": "0.4981147", "text": "func (s *Server) TurnOn() {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\n\tvalue := s.addr.Value\n\tif value == \"\" {\n\t\tvalue = \"0\" // initial address.\n\t}\n\n\ts.addr = machine.Addr{\n\t\tNetwork: \"on\",\n\t\tValue: value,\n\t}\n}", "title": "" }, { "docid": "fe7afbcd4b1067ec8bb01f107e2ac9c2", "score": "0.49677858", "text": "func monitor_switch(resync_period *int) {\n\n for {\n\n gpio := C.get_switch()\n\n if gpio == 1 {\n *resync_period = 1000\n } else {\n *resync_period = 10000\n }\n\n }\n\n}", "title": "" }, { "docid": "df3f5357afbf0108cd3fefc1cfb6cfea", "score": "0.49320862", "text": "func (c *Controller) TurnOffRelay(ctx context.Context, index uint16) error {\n\tlsb := byte(index - 1)\n\tmsb := byte(index >> 8)\n\tpacket := CreatePacket([]byte{254, 47, lsb, msb})\n\treturn c.ExecuteCommand(ctx, packet)\n}", "title": "" }, { "docid": "d528b3dcd18b96562d17acf5088f15c4", "score": "0.4912843", "text": "func (b *basicCart) PowerOn() {}", "title": "" }, { "docid": "e8fb2d139ade6981d543731800ce05cd", "score": "0.48906612", "text": "func (t *Thermostat) SetPower(power bool) error {\n\terr := t.State.SetPower(power)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif power {\n\t\tif err = t.sendOnState(); err != nil {\n\t\t\treturn err\n\t\t}\n\t\ttime.Sleep(1 * time.Second)\n\t}\n\n\treturn t.sendCurrentState()\n}", "title": "" }, { "docid": "6a17f45ee4eb1f36f35fde042bc5d4e1", "score": "0.48852724", "text": "func ToggleOnOff(id string, ip string) error {\n\tlights, err := GetLights(ip)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor i := 0; i < len(lights); i++ {\n\t\tif lights[i].ID == id {\n\t\t\tif lights[i].Level != 0 {\n\t\t\t\terr = SetOnOff(id, false, ip)\n\t\t\t} else {\n\t\t\t\terr = SetOnOff(id, true, ip)\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t}\n\treturn err\n}", "title": "" }, { "docid": "a34ac5f48ee4d7c0cea9e555f5a7df68", "score": "0.48833233", "text": "func (lf LightFlags) TxLED() bool { return lf[0]&0x02 == 0x02 }", "title": "" }, { "docid": "a34ac5f48ee4d7c0cea9e555f5a7df68", "score": "0.48833233", "text": "func (lf LightFlags) TxLED() bool { return lf[0]&0x02 == 0x02 }", "title": "" }, { "docid": "cc5bb888fbfbcc7cae07c76c3af9a6b9", "score": "0.48675025", "text": "func (l *Light) Toggle(on bool) error {\n\t_, err := l.Bridge.put(\n\t\tfmt.Sprintf(\"/lights/%s/state\", l.Key),\n\t\tbytes.NewBuffer(\n\t\t\t[]byte(\n\t\t\t\tfmt.Sprintf(`{\"on\": %t}`, on),\n\t\t\t),\n\t\t),\n\t)\n\tif err != nil {\n\t\treturn logger.Error(err)\n\t}\n\n\tl.State.On = on\n\n\treturn nil\n}", "title": "" }, { "docid": "4b7578fdfd8906e96652f26bea3e8176", "score": "0.4857505", "text": "func (conn *I2CConnection) BacklightOn() error {\n\treturn conn.I2C.WriteByteToReg(conn.Addr, 0x12, 0x00) // backlight on\n}", "title": "" }, { "docid": "9ad15641a1394a3d42c246d9fdaf9284", "score": "0.4843075", "text": "func (l *Lidar) TurnOn() bool { return (bool)(C.CYdCGOturnOn(l.l)) }", "title": "" }, { "docid": "64a5436093c1cd6b15294c533f826ce2", "score": "0.48412338", "text": "func TurnOffAllLights(ip string) error {\n\t_, err := SendCommand(\"C G000,,,0,0,0\\r\\n\", ip)\n\treturn err\n}", "title": "" }, { "docid": "fbeaea03cbca3e6e0f8fa8976c39c611", "score": "0.48153016", "text": "func TestSwitchingOn(t *testing.T) {\n\tfritz := New().Start()\n\tdefer fritz.Close()\n\tr, _ := (&http.Client{}).Get(fritz.Server.URL + \"/webservices/homeautoswitch.lua?switchcmd=setswitchon\")\n\tassert2xxResponse(t, r)\n}", "title": "" }, { "docid": "15635960f165ba52795f2979e85331a6", "score": "0.4804413", "text": "func Stop() {\n\tlog.Println(\"Set relays to default state\")\n\terr := OffHeat()\n\tif err != nil {\n\t\tlog.Println(err.Error())\n\t}\n\n\terr = OnHeatPump()\n\tif err != nil {\n\t\tlog.Println(err.Error())\n\t}\n}", "title": "" }, { "docid": "f5671691ebe9e2f9fc76ac4570d3884e", "score": "0.4772825", "text": "func Enable()", "title": "" }, { "docid": "70e5f269cbbcdee01d3bdc6c1a436768", "score": "0.47708896", "text": "func (c *LEDCtl) SetOn(on bool) *InvokeLEDSetPowerState {\n\treturn c.SetPowerState(&LEDPowerState{On: on})\n}", "title": "" }, { "docid": "beb16a96b18a0fc6768b0085e1f16f8e", "score": "0.47658116", "text": "func sendToRelay() {\n\tticker := time.NewTicker(time.Millisecond * time.Duration(global.Config().SendPeriodMilliseconds))\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-ticker.C:\n\t\t\t\thandleSendRelay()\n\t\t\tcase <-BrubeckChanOverflow:\n\t\t\t\thandleSendRelay()\n\t\t\t}\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "1761ec3296b8b487f3a36cbf224ace7a", "score": "0.47452554", "text": "func TestPower_SetPower2(t *testing.T) {\n\ttt := Power_SetUp()\n\n\ttt.target.On(\"Publish\", mock.Anything).Return(nil)\n\ttt.outbound.\n\t\tOn(\"Call\", \"set_power\", []string{common.PowerStateOn}).\n\t\tReturn(nil, nil)\n\n\terr := tt.power.SetPower(common.PowerStateOn)\n\tassert.NoError(t, err)\n\n\ttt.outbound.AssertNumberOfCalls(t, \"Call\", 1)\n\ttt.outbound.AssertExpectations(t)\n}", "title": "" }, { "docid": "f7dc99c86b0d602c4907e07b42c29026", "score": "0.4744717", "text": "func (c *Controller) TurnOnRelayByBank(ctx context.Context, index uint8, bank uint8) error {\n\tpacket := CreatePacket([]byte{254, 48, 107 + index, bank})\n\treturn c.ExecuteCommand(ctx, packet)\n}", "title": "" }, { "docid": "3af75aaf3777660277afcb46436578f0", "score": "0.4743521", "text": "func (r *Readiness) TurnOn() error {\n\tif atomic.CompareAndSwapInt32(&r.ready, _notReady, _ready) {\n\t\treturn nil\n\t}\n\treturn ErrWrongState\n}", "title": "" }, { "docid": "056faf5bfee4a3b84f336adf368972dd", "score": "0.47391093", "text": "func TestPower_SetPower(t *testing.T) {\n\ttt := Power_SetUp()\n\n\ttt.outbound.On(\"Call\", mock.Anything, mock.Anything).Return(nil, nil)\n\ttt.target.On(\"Publish\", mock.Anything).Return(nil).Once()\n\n\terr := tt.power.SetPower(common.PowerStateOn)\n\tassert.NoError(t, err)\n\ttt.target.AssertExpectations(t)\n}", "title": "" }, { "docid": "ebc782b2b2d013b15cbec5489ed77e3f", "score": "0.47366232", "text": "func lampSwitch(numOfLamps int) []bool {\r\n\tlamps := make([]bool, numOfLamps)\r\n\tfor i := 0; i < numOfLamps; i++ {\r\n\t\tfor j := 0; j < numOfLamps; j++ {\r\n\t\t\tif (j+1) % (i+1) == 0 {\r\n\t\t\t\tlamps[j] = changeBool(lamps[j])\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tfmt.Println(lamps)\r\n\treturn lamps\r\n}", "title": "" }, { "docid": "54a2226d574dc6e04bbdc3c90f566534", "score": "0.46991873", "text": "func (s *synaccessClient) PowerCycle(ctx context.Context, id DeviceID, delayOverride time.Duration) error {\n\tport, ok := s.conf.DevPortMap[id]\n\tif !ok {\n\t\treturn skerr.Fmt(\"No mapping exists for %s\", id)\n\t}\n\n\t// The API for the Synaccess series of PDU is a stateless HTTP based system.\n\t// https://github.com/synaccess-networks/API-Examples/blob/master/examples.sh\n\t// The $A3 one seems more consistent across models than the other API.s\n\tturnOffCmd := s.conf.Address + \"/cmd.cgi?\" +\n\t\t\"$A3\" + // Command for setting an outlet to off or on\n\t\t\"%20\" + // URL encoded space\n\t\tstrconv.Itoa(port) +\n\t\t\"%20\" + // URL encoded space\n\t\t\"0\" // turn port off\n\n\tif err := s.doGetAndIgnoreResponse(ctx, turnOffCmd); err != nil {\n\t\treturn skerr.Wrapf(err, \"turning off port %d\", port)\n\t}\n\n\tdelay := powerOffDelaySynaccess\n\tif delayOverride > 0 {\n\t\tdelay = delayOverride\n\t}\n\tsklog.Infof(\"Switched %s port %d off. Waiting for %s.\", s.name, port, delay)\n\n\ttime.Sleep(delay)\n\n\tturnOnCmd := s.conf.Address + \"/cmd.cgi?\" +\n\t\t\"$A3\" + // Command for setting an outlet to off or on\n\t\t\"%20\" + // URL encoded space\n\t\tstrconv.Itoa(port) +\n\t\t\"%20\" + // URL encoded space\n\t\t\"1\" // turn port off\n\n\tif err := s.doGetAndIgnoreResponse(ctx, turnOnCmd); err != nil {\n\t\treturn skerr.Wrapf(err, \"turning on port %d\", port)\n\t}\n\tsklog.Infof(\"Switched %s port %d on.\", s.name, port)\n\treturn nil\n}", "title": "" }, { "docid": "9c31843c139500f33344aab0d86108f0", "score": "0.4695687", "text": "func ActivityLED(on bool) {\n\tprint(\"Activite LED: \", on, \"\\n\")\n}", "title": "" }, { "docid": "d9b23ec0eef6a4d7e7a205b95603b95b", "score": "0.46867537", "text": "func (this *ener314rt) SetLED(led LED, state gopi.GPIOState) error {\n\tswitch led {\n\tcase LED_ALL:\n\t\tif this.led1 != gopi.GPIO_PIN_NONE {\n\t\t\tif err := this.SetLED(LED_1, state); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\tif this.led2 != gopi.GPIO_PIN_NONE {\n\t\t\tif err := this.SetLED(LED_2, state); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\tcase LED_1:\n\t\tif this.led1 == gopi.GPIO_PIN_NONE {\n\t\t\treturn gopi.ErrNotImplemented\n\t\t} else {\n\t\t\tthis.gpio.SetPinMode(this.led1, gopi.GPIO_OUTPUT)\n\t\t\tthis.gpio.WritePin(this.led1, state)\n\t\t}\n\tcase LED_2:\n\t\tif this.led2 == gopi.GPIO_PIN_NONE {\n\t\t\treturn gopi.ErrNotImplemented\n\t\t} else {\n\t\t\tthis.gpio.SetPinMode(this.led2, gopi.GPIO_OUTPUT)\n\t\t\tthis.gpio.WritePin(this.led2, state)\n\t\t}\n\tcase LED_RX:\n\t\tif this.ledrx == gopi.GPIO_PIN_NONE {\n\t\t\t// Allow to silently do nothing where device does have RX indicator\n\t\t\treturn nil\n\t\t} else {\n\t\t\tthis.gpio.SetPinMode(this.ledrx, gopi.GPIO_OUTPUT)\n\t\t\tthis.gpio.WritePin(this.ledrx, state)\n\t\t}\n\tcase LED_TX:\n\t\tif this.ledtx == gopi.GPIO_PIN_NONE {\n\t\t\t// Allow to silently do nothing where device does have RX indicator\n\t\t\treturn nil\n\t\t} else {\n\t\t\tthis.gpio.SetPinMode(this.ledtx, gopi.GPIO_OUTPUT)\n\t\t\tthis.gpio.WritePin(this.ledtx, state)\n\t\t}\n\tdefault:\n\t\treturn gopi.ErrBadParameter\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "12d9beed304962836d74bc2998d6968c", "score": "0.46859604", "text": "func (h *Hive) ToggleHotWater(on bool, onForLength time.Duration) error {\n\tvar info nodeInfo\n\tif on == true {\n\t\tinfo = nodeInfo{\n\t\t\tAttributes: nodeAttributes{\n\t\t\t\tActiveHeatCoolMode: &nodeReportString{\n\t\t\t\t\tTargetValue: apiBoost,\n\t\t\t\t},\n\t\t\t\tScheduleLockDuration: &nodeReportInt{\n\t\t\t\t\tTargetValue: int32(onForLength.Minutes()),\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\t} else {\n\t\tinfo = nodeInfo{\n\t\t\tAttributes: nodeAttributes{\n\t\t\t\tActiveHeatCoolMode: &nodeReportString{\n\t\t\t\t\tTargetValue: apiHeat,\n\t\t\t\t},\n\t\t\t\tActiveScheduleLock: &nodeReportBool{\n\t\t\t\t\tTargetValue: false,\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\t}\n\n\tnodes := nodesReply{\n\t\tNodes: []nodeInfo{info},\n\t}\n\n\tbody, err := json.Marshal(nodes)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tstate := h.GetState()\n\t_, err = h.putHTTP(nodeURL+state.hotWaterNodeID, body)\n\n\tgo (func() {\n\t\t<-time.After(5 * time.Second)\n\t\th.updateNow <- true\n\t})()\n\n\treturn err\n}", "title": "" }, { "docid": "5f0bdc5e6ceac5acd4fcc4f846ffca26", "score": "0.4682352", "text": "func SetOnOff(id string, state bool, ip string) error {\n\tvar cmd string\n\tif state {\n\t\tcmd = fmt.Sprintf(\"C %s,,,,100,\\r\\n\", id)\n\t} else {\n\t\tcmd = fmt.Sprintf(\"C %s,,,,0,\\r\\n\", id)\n\t}\n\t_, err := SendCommand(cmd, ip)\n\treturn err\n}", "title": "" }, { "docid": "08c1cfeead6ce1331460b67caed8bdc2", "score": "0.4680663", "text": "func (t *Timer) preflight(f func()) func() {\n\tp := func() {\n\t\tt.running = false\n\t\tf()\n\t}\n\treturn p\n}", "title": "" }, { "docid": "e2274b88e9dcea6863406f484f633dd4", "score": "0.46608552", "text": "func BlinkOn(hd *ADAFRUIT_CHARLCD) { hd.dMode |= lcdBlinkOn }", "title": "" }, { "docid": "aace4294e8e3b9f491916d86ac04eeac", "score": "0.46429068", "text": "func (sim *Simulation) oneToTwo(delay int) {\n\tlog.Debug(\"oneToTwo\")\n\tsim.setRealTime(delay)\n\tsim.newPrivateBlock()\n\tsim.setState(sim.state + 1)\n}", "title": "" }, { "docid": "dda89d48fd2bb7d17f001e53ff9dc0b5", "score": "0.4632487", "text": "func (n *NegatedTrafficLight) AllOn() {\n\tlog.Println(\"All on. (negated call)\")\n\tn.classicTrafficLight.AllOff()\n}", "title": "" }, { "docid": "9022da3438b49168e3133cf14e1c184f", "score": "0.46288154", "text": "func TestSwitchingOff(t *testing.T) {\n\tfritz := New().Start()\n\tdefer fritz.Close()\n\tr, _ := (&http.Client{}).Get(fritz.Server.URL + \"/webservices/homeautoswitch.lua?switchcmd=setswitchoff\")\n\tassert2xxResponse(t, r)\n}", "title": "" }, { "docid": "90de7d66a482f2871adbe61152995755", "score": "0.46206856", "text": "func cbBITm1(cpu *Core) {\n\tcpu.Registers.SetZero((cpu.Memory.ReadByte(cpu.Registers.HL()) & (1 << 1)) == 0)\n\tcpu.Registers.SetSub(false)\n\tcpu.Registers.SetHalfCarry(true)\n\n\tcpu.Registers.LastClockM = 3\n\tcpu.Registers.LastClockT = 12\n}", "title": "" }, { "docid": "ccc03ab469e5dbb5a5f54e2ee11c599b", "score": "0.46091744", "text": "func (gb *Gameboy) checkSpeedSwitch() {\n\t// TODO: This should actually happen after a STOP after asking to switch\n\tif gb.prepareSpeed {\n\t\t// Switch speed\n\t\tgb.prepareSpeed = false\n\t\tif gb.currentSpeed == 0 {\n\t\t\tgb.currentSpeed = 1\n\t\t} else {\n\t\t\tgb.currentSpeed = 0\n\t\t}\n\t\tgb.halted = false\n\t}\n}", "title": "" }, { "docid": "5bcc74393785ad72d27f4f8efd6d98bc", "score": "0.45994177", "text": "func TurnLEDOn(handler groove.Handler, pin byte) error {\n\terr := handler.PinMode(pin, \"output\")\n\tif err != nil {\n\t\treturn err\n\t}\n\thandler.DigitalWrite(pin, 1)\n\ttime.Sleep(100 * time.Millisecond)\n\treturn nil\n}", "title": "" }, { "docid": "6f11c39d080e12737100d84cad48d60b", "score": "0.4582852", "text": "func (b *BroadcastStatus) check(ctx context.Context, lastOn time.Time, params BroadcastParams) time.Time {\n\tb.statusMx.Lock()\n\tdefer b.statusMx.Unlock()\n\n\tnewStatus := ping(ctx, params.Client, params.URL)\n\n\t// 0 -> 1\n\tif !b.status && newStatus {\n\t\tlog.Print(\"[INFO] Broadcast started\")\n\t\tb.status = true\n\t\treturn time.Now()\n\t}\n\n\t// 1 -> 0\n\t// 0 -> 0\n\tif !newStatus {\n\t\tif b.status && lastOn.Add(params.DelayToOff).Before(time.Now()) {\n\t\t\tlog.Print(\"[INFO] Broadcast finished\")\n\t\t\tb.status = false\n\t\t}\n\t\treturn lastOn\n\t}\n\n\t// 1 -> 1\n\treturn time.Now()\n}", "title": "" }, { "docid": "57cf76d91afc783a9a18f3ae654bf3b0", "score": "0.45723084", "text": "func (n *NegatedTrafficLight) RedOn() {\n\tlog.Println(\"Red on. (negated call)\")\n\tn.classicTrafficLight.RedOff()\n}", "title": "" }, { "docid": "97d3e550ddccfa9117e1a555f5877516", "score": "0.45694563", "text": "func (m *MqttClient) BoolSetter(param, topic, message string) func(bool) error {\n\treturn func(v bool) error {\n\t\tpayload, err := m.formatValue(param, message, v)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tm.log.TRACE.Printf(\"send %s: '%s'\", topic, payload)\n\t\ttoken := m.Client.Publish(topic, m.Qos, false, payload)\n\t\tif token.WaitTimeout(publishTimeout) {\n\t\t\treturn token.Error()\n\t\t}\n\n\t\treturn fmt.Errorf(\"%s send timeout\", topic)\n\t}\n}", "title": "" }, { "docid": "b3ebd9371c5fb09d7151b2ee62d98123", "score": "0.45603487", "text": "func Control(timeout time.Duration, s20device *Device, state bool) error {\n\tinBuf := make([]byte, readBufLen)\n\n\t// build the command\n\txmitBuf := bytes.NewBufferString(magic + control)\n\txmitBuf.Write(s20device.Mac)\n\txmitBuf.WriteString(padding1)\n\txmitBuf.WriteString(padding2)\n\tif state {\n\t\txmitBuf.WriteString(on)\n\t} else {\n\t\txmitBuf.WriteString(off)\n\t}\n\ttxtutil.PriFmtPrintln(3, \"\\nbuilding command\")\n\ttxtutil.PriDump(3, xmitBuf.String())\n\n\t// get network connection, listen for reply on udpDiscoverPort\n\tsender := fmt.Sprintf(\":%d\", udpDiscoverPort)\n\tourAddr, err = net.ResolveUDPAddr(\"udp\", sender)\n\tcheckErr(err)\n\tconn, err = net.ListenUDP(\"udp\", ourAddr)\n\tcheckErr(err)\n\tdefer conn.Close()\n\n\t// send the Control message\n\tfinished := false // set to true when done\n\tskipSend := false // set to true to repeat loop w/out extra send\n\n\tretries := 3 // allow three retries\n\tfor !finished {\n\t\tif !skipSend {\n\t\t\tsendLen, err := conn.WriteToUDP(xmitBuf.Bytes(), &s20device.IPAddr)\n\t\t\tcheckErr(err)\n\t\t\ttxtutil.PriFmtPrintln(3, \"Sent Control\", sendLen, \"bytes\")\n\t\t} else {\n\t\t\tskipSend = false\n\t\t}\n\n\t\t// read single replies\n\t\terr = conn.SetReadDeadline(time.Now().Add(timeout * time.Second))\n\t\treadLen, fromAddr, err := conn.ReadFromUDP(inBuf)\n\t\tif err, ok := err.(net.Error); ok && err.Timeout() {\n\t\t\ttxtutil.PriFmtPrintln(4, \"ReadFromUDP timeout\", err)\n\t\t\t// retry if not successful\n\t\t\tretries-- // = retries - 1\n\t\t\tif retries <= 0 {\n\t\t\t\treturn err // bail on too many timeouts\n\t\t\t} else {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t} else if err != nil {\n\t\t\ttxtutil.PriFmtPrintln(4, \"ReadFromUDP error\", err)\n\t\t\treturn err // bail on error\n\t\t}\n\n\t\t// process reply\n\t\ttxtutil.PriFmtPrintln(3, \"Control Reply\", readLen, \"bytes from \", fromAddr)\n\t\tif bytes.Compare(inBuf[2:6], []byte(controlResp)) != 0 {\n\t\t\ttxtutil.PriFmtPrintln(4, \"unexpected Control reply\", inBuf[2:6])\n\t\t\tskipSend = true\n\t\t\tcontinue // retry on unexpected message\n\t\t}\n\t\ttxtutil.PriDump(3, string(inBuf[:readLen]))\n\t\ts20device.IsOn = inBuf[22] != 0 // capture on/off state\n\n\t\tif s20device.IsOn == state {\n\t\t\treturn nil\n\t\t}\n\n\t\t// retry if not successful\n\t\tretries-- // = retries - 1\n\t\tif retries <= 0 {\n\t\t\treturn errors.New(\"Control retries exhausted\")\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "38f0937e820b1d2e06d2d59b1f2f3df4", "score": "0.45419377", "text": "func (k Keeper) ToggleRelay(ctx sdk.Context, token string) (types.TokenPair, error) {\n\tid := k.GetTokenPairID(ctx, token)\n\n\tif len(id) == 0 {\n\t\treturn types.TokenPair{}, sdkerrors.Wrapf(types.ErrInternalTokenPair, \"token %s not registered\", token)\n\t}\n\n\tpair, found := k.GetTokenPair(ctx, id)\n\tif !found {\n\t\treturn types.TokenPair{}, sdkerrors.Wrapf(types.ErrInternalTokenPair, \"not registered\")\n\t}\n\n\tpair.Enabled = !pair.Enabled\n\n\tk.SetTokenPair(ctx, pair)\n\treturn pair, nil\n}", "title": "" }, { "docid": "c9a463306dca8a2eed52f7a8eef76627", "score": "0.4537161", "text": "func (n *Connection) TurnOffFanTimer(deviceID string) error {\n\tvals := make(map[string]interface{})\n\tvals[\"fan_timer_active\"] = false\n\n\treturn n.setValue(\"thermostats\", deviceID, vals)\n}", "title": "" }, { "docid": "95b9c8aa0e0552cdec7f29d9c748a217", "score": "0.4524389", "text": "func (c *Controller) LightOn(id string) error {\n\n\tlog.Printf(\"Called controller.light.LightOn for %v\", id)\n\tl, ok := c.config.Lights[id]\n\tif !ok {\n\t\treturn fmt.Errorf(\"Light named: '%s' does not exist\", id)\n\t}\n\n\tl.State = \"on\"\n\treturn c.doSwitching(l.GPIO, true)\n\n}", "title": "" }, { "docid": "482c034f560e626b7e501762f4b56a29", "score": "0.4520271", "text": "func (rr *Server) OnSwitchMode(f func(string)) {\n\tgo func() {\n\t\tmode := <-rr.switchModeChan\n\t\tf(mode)\n\t}()\n}", "title": "" }, { "docid": "4225ee2734ae1dcce9966d58a0f18976", "score": "0.45156515", "text": "func (r *Raft) tick() {\n\t// Your Code Here (2A).\n\tswitch r.State {\n\tcase StateLeader:\n\t\tr.heartbeatElapsed++\n\t\tif r.heartbeatElapsed >= r.heartbeatTimeout {\n\t\t\tr.heartbeatElapsed = 0\n\t\t\t// 发送MessageType_MsgBeat确认leader\n\t\t\tr.Step(pb.Message{\n\t\t\t\tMsgType: pb.MessageType_MsgBeat,\n\t\t\t})\n\t\t}\n\tdefault:\n\t\tr.electionElapsed++\n\t\tif r.electionElapsed >= r.randElectionTimeout {\n\t\t\tr.electionElapsed = 0\n\t\t\t// 发送MessageType_MsgHup成为候选人并开始选举\n\t\t\tr.Step(pb.Message{\n\t\t\t\tMsgType: pb.MessageType_MsgHup,\n\t\t\t})\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9e80aaeb331280e91605153d0776ca2f", "score": "0.45039535", "text": "func (n *NetworkInstance_Protocol_Isis_Global_LspBit_OverloadBit_ResetTrigger) Delay() *NetworkInstance_Protocol_Isis_Global_LspBit_OverloadBit_ResetTrigger_Delay {\n\treturn &NetworkInstance_Protocol_Isis_Global_LspBit_OverloadBit_ResetTrigger_Delay{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"delay\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "9e80aaeb331280e91605153d0776ca2f", "score": "0.4502924", "text": "func (n *NetworkInstance_Protocol_Isis_Global_LspBit_OverloadBit_ResetTrigger) Delay() *NetworkInstance_Protocol_Isis_Global_LspBit_OverloadBit_ResetTrigger_Delay {\n\treturn &NetworkInstance_Protocol_Isis_Global_LspBit_OverloadBit_ResetTrigger_Delay{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"delay\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "630b3c5f41100fa5ae7619325498b5e0", "score": "0.4495304", "text": "func ToggleHeatPump() error {\n\tlog.Println(\"toggle heat motor r1\")\n\treturn relHeatPump.Toggle()\n}", "title": "" }, { "docid": "87a5e5f271fd99b1dd743d2e686abb3c", "score": "0.4488514", "text": "func (l *Lidar) TurnOff() bool { return (bool)(C.CYdCGOturnOff(l.l)) }", "title": "" }, { "docid": "276838eade88eabfab1e382461b74e9b", "score": "0.44781482", "text": "func switchToDelay(rtt time.Duration) {\n\tif !useSwitching {\n\t\treturn\n\t}\n\tif flowMode == DELAY {\n\t\treturn\n\t}\n\n\tdelayThreshold = max(*initDelayThreshold, rtt.Seconds()/min_rtt.Seconds())\n\tlog.WithFields(log.Fields{\n\t\t\"elapsed\": time.Since(startTime),\n\t\t\"from\": currMode,\n\t\t\"to\": \"DELAY\",\n\t\t\"DelayTheshold\": delayThreshold,\n\t}).Info(\"switched mode\")\n\n\tflowMode = DELAY\n\tcurrMode = \"DELAY\"\n\tmodeSwitchTime = time.Now()\n}", "title": "" }, { "docid": "6ca6fd0044ec01dfcf2c4b039fb67505", "score": "0.44772118", "text": "func (m Motors) TurnForward(leftSpeed uint8, rightSpeed uint8) {\n\tif leftSpeed > 100 || leftSpeed < 0 || rightSpeed > 100 || rightSpeed < 0 {\n\t\tfmt.Println(\"speed out of range\")\n\t\treturn\n\t}\n\n\t// TODO: stubbed\n}", "title": "" }, { "docid": "63fff5c989cd083d739fa618de4b6735", "score": "0.4458277", "text": "func togglePowerCycle(ctx context.Context, id, user string, in machine.Description) machine.Description {\n\tret := in.Copy()\n\tret.PowerCycle = !ret.PowerCycle\n\tret.Annotation = machine.Annotation{\n\t\tUser: user,\n\t\tMessage: fmt.Sprintf(\"Requested powercycle for %q\", id),\n\t\tTimestamp: now.Now(ctx),\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "77b5950b0c22e8abd1b1934a1ca0a21b", "score": "0.44563827", "text": "func dummyTogglingPollingFunc() float64 {\n\tpollingFuncInvocationCount.Add(1)\n\n\tdummyPollingFuncToggle = !dummyPollingFuncToggle\n\n\tif dummyPollingFuncToggle {\n\t\treturn 1.0\n\t}\n\n\treturn 0.0\n}", "title": "" }, { "docid": "adec8a46030f88ad38ebb5b192b62f2d", "score": "0.44504625", "text": "func TestPower_SetPower3(t *testing.T) {\n\ttt := Power_SetUp()\n\n\ttt.outbound.\n\t\tOn(\"Call\", \"set_power\", []string{common.PowerStateOn}).\n\t\tReturn(nil, assert.AnError)\n\n\terr := tt.power.SetPower(common.PowerStateOn)\n\tassert.Error(t, err)\n}", "title": "" }, { "docid": "bd1abe3593b15437dbdac9b9ffe82f5b", "score": "0.44477633", "text": "func sta2trade(*stateReg state)(res bool){\r\n\r\n switch (*stateReg).State{\r\n case Init: \r\n \r\n case Idle, ChunXiLu_:\r\n \r\n case NiuShiKou:\r\n \r\n case NiuShiKou_:\r\n \r\n case NiuWangMiao:\r\n \r\n case NiuWangMiao_:\r\n \r\n case DongMenDaQiao_:\r\n \r\n case ChunXiLu: \r\n \r\n default:\r\n \r\n }\r\n \r\n \r\n}", "title": "" }, { "docid": "b5bf4efa522596be44564a8993859ca2", "score": "0.44439304", "text": "func ledCtrl(led *OutputPin, ctrl <-chan uint) {\n\trequest := <-ctrl\n\tfor {\n\n\t\tswitch request {\n\t\tcase 0, 1:\n\t\t\tled.SetValue(request == 1)\n\t\t\trequest = <-ctrl\n\t\tdefault:\n\t\t\thalfPeriod := time.Duration(int64(1000000) / int64(request))\n\t\t\tled.SetValue(true)\n\t\t\ttime.Sleep(halfPeriod * time.Microsecond)\n\t\t\tled.SetValue(false)\n\n\t\t\tselect {\n\t\t\tcase request = <-ctrl:\n\t\t\t\tbreak\n\t\t\tdefault:\n\t\t\t\ttime.Sleep(halfPeriod * time.Microsecond)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3f0532d8851bb078eb905054ee2dc106", "score": "0.44435695", "text": "func LedOn(pin ManagerGpio) error {\n\treturn gpioFunc(pin, func(p Pin) error {\n\t\treturn p.High()\n\t})\n}", "title": "" }, { "docid": "2c63c0f5012bcdef5659214ebfa3ecfd", "score": "0.44388804", "text": "func (r *Raft) tick() {\n\t// Your Code Here (2A).\n\tswitch r.State {\n\tcase StateFollower:\n\t\t// 如果 election timemout,重新发起 election,编程 candidate\n\t\tr.electionElapsed++\n\t\tif r.electionElapsed >= r.electionTimeout {\n\t\t\tr.becomeCandidate()\n\t\t\tr.startElection()\n\t\t}\n\tcase StateCandidate:\n\t\t// candidate 的 electionElapsed 还是会增加,直到出现 leader 才复位\n\t\tr.electionElapsed++\n\t\tif r.electionElapsed >= r.electionTimeout {\n\t\t\tr.becomeCandidate()\n\t\t\tr.startElection()\n\t\t}\n\tcase StateLeader:\n\t\t// 只要超过 heartbeatTimeout 就发送心跳\n\t\tr.heartbeatElapsed++\n\t\tif r.heartbeatElapsed >= r.heartbeatTimeout {\n\t\t\tfor _, pr := range r.restPeers() {\n\t\t\t\tr.sendHeartbeat(pr)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e754b7898f2db73ca301286f820be294", "score": "0.44356203", "text": "func onoff(v string) string {\n\tif v == \"1\" {\n\t\treturn \"on\"\n\t}\n\treturn \"off\"\n}", "title": "" }, { "docid": "7989157d2b3d6c46cdf4637268d5c667", "score": "0.44307676", "text": "func mind() {\n\tupdateAndMind()\n\tminuteTicker := time.Tick(1 * time.Minute)\n\tfor {\n\t\tselect {\n\t\tcase <-minuteTicker:\n\t\t\tupdateAndMind()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "43eeda4f023c41ce11bc41aceb1db460", "score": "0.4424604", "text": "func gpioExpanderActivityLED(on bool) bool {\n\tvalue := uint32(0)\n\tif on {\n\t\tvalue = 1\n\t}\n\tbuffer := message(2, MailboxTagSetGPIOState, 0)\n\tbuffer.s[5].Set(130)\n\tbuffer.s[6].Set(value)\n\treturn Call(MailboxChannelProperties, buffer)\n}", "title": "" }, { "docid": "3fe61fe9e96b68b8c6b77a1658348993", "score": "0.4420258", "text": "func BitsToggle(b, flag Bits) Bits { return b ^ flag }", "title": "" }, { "docid": "5f1f17cdeddfd5b97d177c07b690e01d", "score": "0.4407377", "text": "func setLight(light lightConfig, computerListening bool) (err error) {\n\tswitch light.System {\n\tcase \"hue\":\n\t\tsettings := light.Parameters.(hueConfig)\n\t\tif computerListening {\n\t\t\terr = setHueLights(settings.Bridge, settings.Light, settings.Active[0], settings.Active[1], settings.Brightness)\n\t\t} else {\n\t\t\terr = setHueLights(settings.Bridge, settings.Light, settings.Inactive[0], settings.Inactive[1], settings.Brightness)\n\t\t}\n case \"ifttt\":\n\t settings := light.Parameters.(iftttConfig)\n\t if computerListening {\n\t \terr = invokeIFTTTHook(settings.key, settings.onairHook)\n\t } else {\n\t err = invokeIFTTTHook(settings.key, settings.offairHook)\n\t }\n\n\tif err != nil {\n\t\treturn err\n\t}\n }\n\treturn nil\n}", "title": "" }, { "docid": "f61824e86c05ed541909a13d8d5a297b", "score": "0.4405204", "text": "func BlinkOff(hd *ADAFRUIT_CHARLCD) { hd.dMode &= ^lcdBlinkOn }", "title": "" }, { "docid": "089da8aaa26f7b6ee2aec6c99ed0b182", "score": "0.4399698", "text": "func RunTraffic() {\n\tprintLightSwitchState()\n\ttoogleLightSwitch()\n\tprintLightSwitchState()\n\ttoogleLightSwitch()\n\tprintLightSwitchState()\n}", "title": "" }, { "docid": "eed6442b12b3fb620064b7567bd194ae", "score": "0.43989503", "text": "func handleRelayConnection(conn net.Conn, port int) bool {\n\tc := NewConnection(conn)\n\tvar relayPort int\n\n\tc.Conn.SetReadDeadline(time.Now().Add(time.Second))\n\trelayAddress, err := c.Reader.ReadString('\\n')\n\tc.Conn.SetReadDeadline(time.Time{})\n\tisTimeoutError := false\n\tif err != nil {\n\t\tif strings.Contains(err.Error(), \"i/o timeout\") {\n\t\t\tisTimeoutError = true\n\t\t} else if strings.Contains(err.Error(), \"forcibly closed by the remote host\") {\n\t\t\treturn false\n\t\t} else {\n\t\t\tfmt.Printf(\"++++++++++++++++++++++ %T : %v\\n\", err, err)\n\t\t\tc.Close()\n\t\t\treturn false\n\t\t}\n\t}\n\n\tif isTimeoutError {\n\t\tmakeConnectionChannel(port)\n\t\trelay := NewRelayService(c, port)\n\t\terr := relay.Start()\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"Failed to Start Relay Service:: %v :: %v\", port, err)\n\t\t\tc.Conn.Close()\n\t\t\treturn false\n\t\t}\n\t\tfmt.Printf(\"Successfully Accepted Relay Client Connection: %v\\n\", fmt.Sprintf(\"%v:%v\", relay.address, relay.port))\n\t\treturn true\n\t} else {\n\t\trelayAddress = strings.ReplaceAll(relayAddress, \"\\n\", \"\")\n\t\trelayPort, err = strconv.Atoi(relayAddress)\n\t\tif err != nil {\n\t\t\tc.Close()\n\t\t\treturn false\n\t\t}\n\t\tif !pushToChannel(relayPort, c) {\n\t\t\tconn.Close()\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "df1fa5a3202bd4d4d209895af90c8852", "score": "0.43969992", "text": "func Bool(t TestingT, actual interface{}, args ...int) bool {\n\tcall := 4\n\tif len(args) > 0 {\n\t\tcall = args[0]\n\t}\n\n\treturn Expect(t, \"true\", actual, call)\n}", "title": "" }, { "docid": "7de1960a6bdefc4dc718b6b338d4b94f", "score": "0.4393244", "text": "func (self *OfnetAgent) IsSwitchConnected() bool {\n return self.isConnected\n}", "title": "" }, { "docid": "d7a8c659169db4df7ea3a3152c1fe2b8", "score": "0.43893525", "text": "func (this *GpioPin) Modulate(dutyCycle int, hertz int) {\n\t// Frequency of a 100Hz which is 100 times a second (based on https://projects.drogon.net/raspberry-pi/wiringpi/software-pwm-library/).\n\tif hertz < 0 || hertz > 100 {\n\t\tthis.hertz = 100\n\t} else {\n\t\tthis.hertz = hertz\n\t}\n\t// If dutyCycle is 0 or less then reset stored dutyCycle and call pin.Low().\n\tif dutyCycle < 1 {\n\t\tthis.dutyCycle = 0\n\t\tthis.Low()\n\t\treturn\n\t}\n\t// If dutyCycle is 100 or greater then reset stored dutyCycle and call pin.High().\n\tif dutyCycle > 99 {\n\t\tthis.dutyCycle = 0\n\t\tthis.High()\n\t\treturn\n\t}\n\t// If there is already a dutyCycle value then update it and return.\n\tif this.dutyCycle > 0 {\n\t\tthis.dutyCycle = dutyCycle\n\t\treturn\n\t}\n\t// If none of the above are true then store the dutyCycle percentage for the pin.\n\tthis.dutyCycle = dutyCycle\n\t// Start the dutyCycle routine that will run until the dutyCycle value is out of range.\n\tgo this.modulateGpioPin()\n}", "title": "" }, { "docid": "b4c1dddde60672cf2c3c9ae1f7e9d826", "score": "0.4385679", "text": "func Toggle(s *discordgo.Session, m *discordgo.MessageCreate) {\n\tserver, err := s.Guild(m.GuildID)\n\tif err != nil {\n\t\ts.ChannelMessageSend(m.ChannelID, \"This is not a server!\")\n\t\treturn\n\t}\n\n\tchannel, err := s.Channel(m.ChannelID)\n\tif err != nil {\n\t\ts.ChannelMessageSend(m.ChannelID, \"This is not an allowed channel!\")\n\t\treturn\n\t}\n\n\tif !tools.AdminCheck(s, m, *server) {\n\t\ts.ChannelMessageSend(m.ChannelID, \"You must be an admin, server manager, or server owner!\")\n\t\treturn\n\t}\n\n\t// Obtain server data\n\tserverData, _ := tools.GetServer(*server, s)\n\tchannelData, _ := tools.GetChannel(*channel, s)\n\n\t// Set new information in server data\n\tserverData.Time = time.Now()\n\tflagged := false\n\ttarget := \"\"\n\tstatus := \"false\"\n\tif strings.Contains(m.Content, \"-a\") || strings.Contains(m.Content, \"-announce\") {\n\t\tif serverData.AnnounceChannel == m.ChannelID {\n\t\t\tserverData.AnnounceChannel = \"\"\n\t\t\tstatus = \"N/A\"\n\t\t} else {\n\t\t\tserverData.AnnounceChannel = m.ChannelID\n\t\t\tstatus = \"this channel\"\n\t\t}\n\t\tflagged = true\n\t\ttarget = \"The announcement channel\"\n\t}\n\tif strings.Contains(m.Content, \"-s\") || strings.Contains(m.Content, \"-stats\") {\n\t\tserverData.AllowAnyoneStats = !serverData.AllowAnyoneStats\n\t\tflagged = true\n\t\ttarget = \"`AllowAnyoneStats`\"\n\t\tstatus = strconv.FormatBool(serverData.AllowAnyoneStats)\n\t}\n\tif strings.Contains(m.Content, \"-d\") || strings.Contains(m.Content, \"-daily\") {\n\t\tif strings.Contains(m.Content, \"-ch\") || strings.Contains(m.Content, \"-channel\") {\n\t\t\tchannelData.Daily = !channelData.Daily\n\t\t} else {\n\t\t\tserverData.Daily = !serverData.Daily\n\t\t}\n\t\tflagged = true\n\t\ttarget = \"`daily`\"\n\t\tstatus = strconv.FormatBool(serverData.Daily)\n\t}\n\tif strings.Contains(m.Content, \"-os\") || strings.Contains(m.Content, \"-osu\") {\n\t\tif strings.Contains(m.Content, \"-ch\") || strings.Contains(m.Content, \"-channel\") {\n\t\t\tchannelData.OsuToggle = !channelData.OsuToggle\n\t\t} else {\n\t\t\tserverData.OsuToggle = !serverData.OsuToggle\n\t\t}\n\t\tflagged = true\n\t\ttarget = \"`osuToggle`\"\n\t\tstatus = strconv.FormatBool(serverData.OsuToggle)\n\t}\n\tif strings.Contains(m.Content, \"-t\") || strings.Contains(m.Content, \"-time\") || strings.Contains(m.Content, \"-timestamp\") {\n\t\tif strings.Contains(m.Content, \"-ch\") || strings.Contains(m.Content, \"-channel\") {\n\t\t\tchannelData.TimestampToggle = !channelData.TimestampToggle\n\t\t} else {\n\t\t\tserverData.TimestampToggle = !serverData.TimestampToggle\n\t\t}\n\t\tflagged = true\n\t\ttarget = \"`timestampToggle`\"\n\t\tstatus = strconv.FormatBool(serverData.TimestampToggle)\n\t}\n\tif strings.Contains(m.Content, \"-v\") || strings.Contains(m.Content, \"-vibe\") {\n\t\tif strings.Contains(m.Content, \"-ch\") || strings.Contains(m.Content, \"-channel\") {\n\t\t\tchannelData.Vibe = !channelData.Vibe\n\t\t} else {\n\t\t\tserverData.Vibe = !serverData.Vibe\n\t\t}\n\t\tflagged = true\n\t\ttarget = \"`Vibe`\"\n\t\tstatus = strconv.FormatBool(serverData.Vibe)\n\t}\n\tif !flagged {\n\t\ts.ChannelMessageSend(m.ChannelID, \"No flags given! Please use one of the flags listed in `help toggle`!\")\n\t\treturn\n\t}\n\n\tjsonCache, err := json.Marshal(serverData)\n\ttools.ErrRead(s, err)\n\n\terr = ioutil.WriteFile(\"./data/serverData/\"+m.GuildID+\".json\", jsonCache, 0644)\n\ttools.ErrRead(s, err)\n\n\ts.ChannelMessageSend(m.ChannelID, target+\" has now been set to \"+status+\". Obtaining server info...\")\n\tgo gencommands.ServerInfo(s, m)\n}", "title": "" }, { "docid": "a1367a3663cff098a23075e569d04b36", "score": "0.4383383", "text": "func (n *NetworkInstance_Protocol_Isis_Global_LspBit_OverloadBit_ResetTriggerAny) Delay() *NetworkInstance_Protocol_Isis_Global_LspBit_OverloadBit_ResetTrigger_DelayAny {\n\treturn &NetworkInstance_Protocol_Isis_Global_LspBit_OverloadBit_ResetTrigger_DelayAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"delay\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "c74f9668b53ec8d8f76c0fd6c58e39ee", "score": "0.4381454", "text": "func (s *SupermicroX) PowerOn() (status bool, err error) {\n\ti, err := ipmi.New(s.username, s.password, s.ip)\n\tif err != nil {\n\t\treturn status, err\n\t}\n\tstatus, err = i.PowerOn(context.Background())\n\treturn status, err\n}", "title": "" }, { "docid": "e2695ace5a9d82966e14123048fa4a34", "score": "0.43718052", "text": "func (l *Lidar) SetAutoReconnect(val bool) { C.CYdCGOsetAutoReconnect(l.l, (C.bool)(val)) }", "title": "" }, { "docid": "af1799708b3ab096d6a5b307f6b7fd1f", "score": "0.43710092", "text": "func New(uid string, ipcon *ipconnection.IPConnection) (DualRelayBricklet, 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 DualRelayBricklet{}, err\n\t}\n\tdev.ResponseExpected[FunctionSetState] = ResponseExpectedFlagFalse\n\tdev.ResponseExpected[FunctionGetState] = ResponseExpectedFlagAlwaysTrue\n\tdev.ResponseExpected[FunctionSetMonoflop] = ResponseExpectedFlagFalse\n\tdev.ResponseExpected[FunctionGetMonoflop] = ResponseExpectedFlagAlwaysTrue\n\tdev.ResponseExpected[FunctionSetSelectedState] = ResponseExpectedFlagFalse\n\tdev.ResponseExpected[FunctionGetIdentity] = ResponseExpectedFlagAlwaysTrue\n\treturn DualRelayBricklet{dev}, nil\n}", "title": "" }, { "docid": "a290bd03707a9480d6cd0807258bfb22", "score": "0.43647906", "text": "func TestToggleOff(t *testing.T) {\n\tSTATUS = Status{\n\t\tState: State{\n\t\t\tOK: true,\n\t\t},\n\t\tTargets: []Target{\n\t\t\tTarget{\n\t\t\t\tOK: true,\n\t\t\t},\n\t\t},\n\t}\n\tSTATUS.toggleOff()\n\tif STATUS.State.OK {\n\t\tt.Errorf(\"State.OK should return false, but returned true.\")\n\t}\n}", "title": "" }, { "docid": "ccbd9161964e9a537ccce912f409054b", "score": "0.43604228", "text": "func (f *SPFunctions) ToggleFlag(flag SPFunctions) { *f ^= flag }", "title": "" }, { "docid": "01c466eddb095f9be726a8c5a8f461ac", "score": "0.4357994", "text": "func SetDoorLamp(value bool) {\n\tif value {\n\t\tioSetBit(LIGHT_DOOR_OPEN)\n\t} else {\n\t\tioClearBit(LIGHT_DOOR_OPEN)\n\t}\n}", "title": "" }, { "docid": "b7b7411c6ff334c2e771b8335a0b5805", "score": "0.43570596", "text": "func (t *T) ConnState(state ble.State) {\n}", "title": "" }, { "docid": "cfddc06ab7cd9b427658326f78e8d9da", "score": "0.43550834", "text": "func Schedule() {\n\tutil.Operate(func(device gatt.Device, peripheral gatt.Peripheral, done chan bool) {\n\t\tif strings.ToUpper(*cli.ScheduleTarget) == strings.ToUpper(peripheral.ID()) {\n\t\t\tdevice.Handle(gatt.PeripheralConnected(func(peripheral gatt.Peripheral, err error) {\n\t\t\t\tdefer device.CancelConnection(peripheral)\n\n\t\t\t\tcharacteristic, err := util.GetCharacteristic(peripheral, gatt.MustParseUUID(\"FFD5\"), gatt.MustParseUUID(\"FFD9\"))\n\n\t\t\t\tif (err != nil) || (nil == characteristic) {\n\t\t\t\t\tlog.Error.Printf(\"Failed to get characteristic: %v\\n\", err)\n\t\t\t\t\tos.Exit(util.ExitStatusGenericError)\n\t\t\t\t}\n\n\t\t\t\tlisten, err := util.GetCharacteristicWithDescriptors(peripheral, gatt.MustParseUUID(\"FFD0\"), gatt.MustParseUUID(\"FFD4\"))\n\n\t\t\t\tif (err != nil) || (nil == listen) {\n\t\t\t\t\tlog.Error.Printf(\"Failed to get listen characteristic: %v\\n\", err)\n\t\t\t\t\tos.Exit(util.ExitStatusGenericError)\n\t\t\t\t}\n\n\t\t\t\tchunks := make(chan []byte)\n\t\t\t\tvar data []byte\n\n\t\t\t\tperipheral.SetNotifyValue(listen, func(characteristic *gatt.Characteristic, data []byte, err error) {\n\t\t\t\t\tchunks <- data\n\n\t\t\t\t\t// 0x52 indicated end of timings data\n\t\t\t\t\tif data[len(data)-1] == 0x52 {\n\t\t\t\t\t\tclose(chunks)\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\tperipheral.WriteCharacteristic(characteristic, []byte{0x24, 0x2A, 0x2B, 0x42}, false)\n\n\t\t\t\t// Wait for the timings data\n\t\t\t\tfor chunk := range chunks {\n\t\t\t\t\tdata = append(data, chunk...)\n\t\t\t\t}\n\t\t\t\tfor i := 0; i < 6; i++ {\n\t\t\t\t\tlog.Info.Printf(\"Timing #%v: Days: %v, Hour: %02v, Minute: %02v, Turn on?: %v, Open?: %v\\n\", i+1, days(data[i*14+8]), data[i*14+5], data[i*14+6], data[i*14+14] == 240, data[i*14+1] == 240)\n\t\t\t\t}\n\n\t\t\t\tdone <- true\n\t\t\t}))\n\n\t\t\tdevice.StopScanning()\n\t\t\tdevice.Connect(peripheral)\n\t\t}\n\t})\n}", "title": "" }, { "docid": "b8580861e9c7b664edffe4dc2ddbb63a", "score": "0.4353085", "text": "func digitalWrite() {\n\treadpin.Configure(machine.PinConfig{Mode: machine.PinInput})\n\twritepin.Configure(machine.PinConfig{Mode: machine.PinOutput})\n\n\tprinttest(\"digitalWriteOn\")\n\twritepin.High()\n\ttime.Sleep(100 * time.Millisecond)\n\n\t// should be on\n\tif readpin.Get() {\n\t\tprinttestresult(\"pass\")\n\t} else {\n\t\tprinttestresult(\"fail\")\n\t}\n\n\ttime.Sleep(100 * time.Millisecond)\n\n\tprinttest(\"digitalWriteOff\")\n\twritepin.Low()\n\ttime.Sleep(100 * time.Millisecond)\n\n\t// should be off\n\tif readpin.Get() {\n\t\tprinttestresult(\"fail\")\n\t\treturn\n\t} else {\n\t\tprinttestresult(\"pass\")\n\t}\n}", "title": "" }, { "docid": "f03d21350d39791f0da31921e1bea7bd", "score": "0.4347993", "text": "func (s *Server) TurnOff() {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\n\ts.addr.Network = \"off\"\n}", "title": "" }, { "docid": "b02cdf81eb22d324ae2afc3496a0421b", "score": "0.43468404", "text": "func TestSwitchToggle(t *testing.T) {\n\tfritz := New().Start()\n\tdefer fritz.Close()\n\tr, _ := (&http.Client{}).Get(fritz.Server.URL + \"/webservices/homeautoswitch.lua?switchcmd=setswitchtoggle\")\n\tassert2xxResponse(t, r)\n}", "title": "" }, { "docid": "1f8c343384b7604f2a2a9ce8ec1432a4", "score": "0.4346809", "text": "func (t *Thermostat) SetFanSpeed(speed FanSpeed) error {\n\terr := t.State.SetFanSpeed(speed)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn t.sendCurrentState()\n}", "title": "" }, { "docid": "38cb7968cf35b10b9f816b91024bda51", "score": "0.4343113", "text": "func resetState(t int) {\n\tipHits = 0\n\tproxyIndex = 0\n\tlog.Printf(\"Sleeping for %d hours...\\n\", t)\n\ttime.Sleep(time.Duration(t) * time.Hour)\n}", "title": "" }, { "docid": "e617c96940b9375ae7947cdfdb445e7c", "score": "0.43428314", "text": "func (n *Numato) On(p Port) error {\n\treturn n.action(p, On)\n}", "title": "" } ]
896aff33c72dd819a46cedcd609e4786
Deprecated: Do not use.
[ { "docid": "4c6efa7c56cf848a0ce9c1ccb7852084", "score": "0.0", "text": "func (m *IngressGatewayConfig) GetRollingMaxSurge() *IntOrStringForPB {\n\tif m != nil {\n\t\treturn m.RollingMaxSurge\n\t}\n\treturn nil\n}", "title": "" } ]
[ { "docid": "96059a39986d18e0489344b39c14820f", "score": "0.5307445", "text": "func (g *GenericVersioner) Deprecated() bool { return g.deprecated }", "title": "" }, { "docid": "13735f239a9647a06d9e04af75abab8d", "score": "0.5294432", "text": "func fn2() { // want fn2:`Deprecated: Don't use this\\.`\n}", "title": "" }, { "docid": "cd23a79484d5e707cb981c14979bd1a7", "score": "0.4940295", "text": "func unused(value interface{}) {\n\t// TODO remove this method\n}", "title": "" }, { "docid": "cd23a79484d5e707cb981c14979bd1a7", "score": "0.4940295", "text": "func unused(value interface{}) {\n\t// TODO remove this method\n}", "title": "" }, { "docid": "cd23a79484d5e707cb981c14979bd1a7", "score": "0.4940295", "text": "func unused(value interface{}) {\n\t// TODO remove this method\n}", "title": "" }, { "docid": "cd23a79484d5e707cb981c14979bd1a7", "score": "0.4940295", "text": "func unused(value interface{}) {\n\t// TODO remove this method\n}", "title": "" }, { "docid": "cd23a79484d5e707cb981c14979bd1a7", "score": "0.4940295", "text": "func unused(value interface{}) {\n\t// TODO remove this method\n}", "title": "" }, { "docid": "cd23a79484d5e707cb981c14979bd1a7", "score": "0.4940295", "text": "func unused(value interface{}) {\n\t// TODO remove this method\n}", "title": "" }, { "docid": "cd23a79484d5e707cb981c14979bd1a7", "score": "0.4940295", "text": "func unused(value interface{}) {\n\t// TODO remove this method\n}", "title": "" }, { "docid": "008c02da0f522e6ca5ff746e21f9d026", "score": "0.4927844", "text": "func (typenameMetaField) Deprecation() *Deprecation {\n\treturn nil\n}", "title": "" }, { "docid": "277ef9e8e083345e1fb784108bdf37de", "score": "0.48982847", "text": "func registerDeprecated(global *flag.FlagSet, local *pflag.FlagSet, globalName, deprecated string) {\n\tregister(global, local, globalName)\n\tlocal.Lookup(normalize(globalName)).Deprecated = deprecated\n}", "title": "" }, { "docid": "09736ca4aeb063fc475ec63557215d27", "score": "0.4884708", "text": "func Noop() {}", "title": "" }, { "docid": "c9c266aff5b94ff0a5cb49f5fc2a534d", "score": "0.47831842", "text": "func (typeMetaField) Deprecation() *Deprecation {\n\treturn nil\n}", "title": "" }, { "docid": "9a01b23cc156f963ea392589c9f28d36", "score": "0.47672948", "text": "func Example() {}", "title": "" }, { "docid": "9a01b23cc156f963ea392589c9f28d36", "score": "0.47672948", "text": "func Example() {}", "title": "" }, { "docid": "99874fc54c46a02b518d6bcf5649ea3e", "score": "0.47458085", "text": "func (in *Scale) APILifecycleDeprecated() (major, minor int) {\n\treturn 1, 2\n}", "title": "" }, { "docid": "5627f53e6cef6116a05a8c47efb95dab", "score": "0.4702748", "text": "func (ec *executionContext) dir_deprecated_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {\n\tvar err error\n\targs := map[string]interface{}{}\n\tvar arg0 *string\n\tif tmp, ok := rawArgs[\"reason\"]; ok {\n\t\targ0, err = ec.unmarshalOString2ᚖstring(ctx, tmp)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\targs[\"reason\"] = arg0\n\treturn args, nil\n}", "title": "" }, { "docid": "ae40f5cf6ad2eee6d7f2c21d1f8ab24a", "score": "0.46950856", "text": "func ShowUsage() {\n}", "title": "" }, { "docid": "884e85c3a916f58de0efdbd15ce60cc2", "score": "0.4678352", "text": "func (schemaMetaField) Deprecation() *Deprecation {\n\treturn nil\n}", "title": "" }, { "docid": "7d9d4c35bd9dff981cc65e1e1b7244c7", "score": "0.4676367", "text": "func (in *NetworkPolicy) APILifecycleDeprecated() (major, minor int) {\n\treturn 1, 9\n}", "title": "" }, { "docid": "74e644e09d3f2331740bdd2c8115e1a8", "score": "0.46054447", "text": "func (in *Ingress) APILifecycleDeprecated() (major, minor int) {\n\treturn 1, 14\n}", "title": "" }, { "docid": "d977ffb97560ca81dc2cef5f0824e6ad", "score": "0.46008715", "text": "func xx() {\n\tpanic(\"Operation not supported\")\n}", "title": "" }, { "docid": "68e3ac73a9459a6dfa21ec7c384a86e4", "score": "0.45960057", "text": "func (in *ReplicaSet) APILifecycleDeprecated() (major, minor int) {\n\treturn 1, 8\n}", "title": "" }, { "docid": "b234065d7669ca9722f72d514edaeff0", "score": "0.4566184", "text": "func (f feature) Deprecated() (bool, string) {\n\treturn len(f.deprecated) > 0, f.deprecated\n}", "title": "" }, { "docid": "516242bdca13856c10f888eaf871051b", "score": "0.45576042", "text": "func (in *NetworkPolicyList) APILifecycleDeprecated() (major, minor int) {\n\treturn 1, 9\n}", "title": "" }, { "docid": "0cd76780a8022142f6b7fe7e5a8f52a5", "score": "0.45560902", "text": "func (in *DeploymentConfig) APILifecycleDeprecated() (major, minor int) {\n\treturn 4, 14\n}", "title": "" }, { "docid": "b5213bcb1d4e71c6574176d4cc05bec7", "score": "0.45517164", "text": "func (in *Deployment) APILifecycleDeprecated() (major, minor int) {\n\treturn 1, 8\n}", "title": "" }, { "docid": "ca1ab0725cfba925186e17701da55656", "score": "0.45423895", "text": "func (in *DaemonSet) APILifecycleDeprecated() (major, minor int) {\n\treturn 1, 8\n}", "title": "" }, { "docid": "a5fe4107ac32db490807cb97f66ffd29", "score": "0.453638", "text": "func (in *DeploymentLogOptions) APILifecycleDeprecated() (major, minor int) {\n\treturn 4, 14\n}", "title": "" }, { "docid": "1dca339e1b353d8bda352f43ac4813df", "score": "0.45227325", "text": "func init() {}", "title": "" }, { "docid": "1dca339e1b353d8bda352f43ac4813df", "score": "0.45227325", "text": "func init() {}", "title": "" }, { "docid": "1dca339e1b353d8bda352f43ac4813df", "score": "0.45227325", "text": "func init() {}", "title": "" }, { "docid": "26952ce10b464e3800194bcf9fc45acd", "score": "0.4516106", "text": "func checkRemoved(name string) error {\n\tswitch name {\n\tcase \"aufs\", \"devicemapper\", \"overlay\":\n\t\treturn NotSupportedError(fmt.Sprintf(\"[graphdriver] ERROR: the %s storage-driver has been deprecated and removed; visit https://docs.docker.com/go/storage-driver/ for more information\", name))\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "facca92a423409afa80edf7988d03a67", "score": "0.4516052", "text": "func (n *nullDevice) DeprecatedPreadv(ctx context.Context, dst usermem.IOSequence, offset int64) (int64, error) {\n\treturn 0, io.EOF\n}", "title": "" }, { "docid": "10c2de064d0750b53d06cdd010773dcb", "score": "0.45136473", "text": "func use(interface{}) {}", "title": "" }, { "docid": "2c825630c9817429f24e09126539abf5", "score": "0.45124787", "text": "func (in *DeploymentConfigList) APILifecycleDeprecated() (major, minor int) {\n\treturn 4, 14\n}", "title": "" }, { "docid": "26b65d7ce8336427b3f21b5b4c380d18", "score": "0.45115623", "text": "func (in *ReplicaSetList) APILifecycleDeprecated() (major, minor int) {\n\treturn 1, 8\n}", "title": "" }, { "docid": "34216de80ff1e87d62d34d591e0a9efe", "score": "0.45076466", "text": "func (err *InvalidArgument) InvalidArgument() {}", "title": "" }, { "docid": "cbfb45f569c492b7d77fef6287880526", "score": "0.45036754", "text": "func BadUsage(msg string) error { return badUsageError{msg} }", "title": "" }, { "docid": "cd14dc00c0c43711a058e6ea84f4ea7b", "score": "0.44912022", "text": "func (*UsedStruct) UsedInPackageMethod() {}", "title": "" }, { "docid": "c4e1525b14624b7c05b739b3cc1d4e61", "score": "0.44873768", "text": "func mustMarkDeprecated(name string, usageMessage string) {\n\terr := pflag.CommandLine.MarkDeprecated(name, usageMessage)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"error marking flag %q as deprecated: %v\", name, err))\n\t}\n}", "title": "" }, { "docid": "ca963b08265722bcb891a73df5dbc85f", "score": "0.4487207", "text": "func (in *DeploymentLog) APILifecycleDeprecated() (major, minor int) {\n\treturn 4, 14\n}", "title": "" }, { "docid": "64f9703e5514ef774a03dc3f0fe0d96a", "score": "0.44809633", "text": "func (*ValueSetDeprecated) Descriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_r5_core_extensions_proto_rawDescGZIP(), []int{385}\n}", "title": "" }, { "docid": "db9c2cd127ed288303de14d7cf4cbb2a", "score": "0.44800887", "text": "func pflagRegisterDeprecated(global, local *pflag.FlagSet, globalName, deprecated string) {\n\tpflagRegister(global, local, globalName)\n\tlocal.Lookup(normalize(globalName)).Deprecated = deprecated\n}", "title": "" }, { "docid": "f9727db6f92da2615d9c9c80d5df5a9d", "score": "0.4479835", "text": "func MarkDeprecated(fs *pflag.FlagSet, name, message string) {\n\tfs.MarkDeprecated(name, message) //nolint: errcheck\n}", "title": "" }, { "docid": "18e3317a7f2130d6b12757c563f201bb", "score": "0.44690475", "text": "func getg0() interface{}", "title": "" }, { "docid": "54e906ca5385895939f9788e5e3edc5b", "score": "0.4466178", "text": "func (*MySQLService) sealedService() {}", "title": "" }, { "docid": "0db2a289b053888f48d8d437b526750e", "score": "0.44645905", "text": "func (in *IngressList) APILifecycleDeprecated() (major, minor int) {\n\treturn 1, 14\n}", "title": "" }, { "docid": "cad7771ba83cff42e27f48c5923e8de6", "score": "0.44632298", "text": "func (*ValueSetDeprecated) Descriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_r4_core_extensions_proto_rawDescGZIP(), []int{365}\n}", "title": "" }, { "docid": "ba8f41cc90875a4e1b10479367f03f2c", "score": "0.44552404", "text": "func deprecateSnakeCase(cmd *cobra.Command, args []string) {\n\tif strings.Contains(cmd.CalledAs(), \"_\") {\n\t\tfmt.Println(\"Deprecated: snake_case commands will be replaced by hyphen-case commands in the next major release\")\n\t}\n}", "title": "" }, { "docid": "44a822e0931c9578155fb495dbb4838a", "score": "0.44540176", "text": "func parseDeprecatedEnvironment() {\n\tcheckDepricatedStatsD()\n\tcheckDepricatedNomadHTTP()\n\tcheckDepricatedNomadAddr()\n\tcheckDepricatedConsulAddr()\n\tcheckDepricatedNomadRegion()\n\tcheckDepricatedLoggerLevel()\n\tcheckDepricatedLoggerFormat()\n\tcheckDepricatedLoggerOutput()\n}", "title": "" }, { "docid": "fdb36b13bb2b5c8f7160ecc0c081fad3", "score": "0.4450313", "text": "func (s *Scrapper) foo() {}", "title": "" }, { "docid": "f4506d034921c07de48f25a2c19b4647", "score": "0.4449736", "text": "func newUnsupportChartType(chartType string) error {\n\treturn fmt.Errorf(\"unsupported chart type %s\", chartType)\n}", "title": "" }, { "docid": "f5760b5b3838eb3af4ef33fade597666", "score": "0.4442708", "text": "func (in *DaemonSetList) APILifecycleDeprecated() (major, minor int) {\n\treturn 1, 8\n}", "title": "" }, { "docid": "99ed5a1b29a94738b6976e16a7ff8a00", "score": "0.44407964", "text": "func (in *DeploymentList) APILifecycleDeprecated() (major, minor int) {\n\treturn 1, 8\n}", "title": "" }, { "docid": "98c74ecb169665b1be0d1571c95b90b2", "score": "0.44392997", "text": "func (*Session) BuiltinFunctionUsageInc(_ string) {\n}", "title": "" }, { "docid": "643372b477255f2cd1ff1997fe5e0ab3", "score": "0.44280803", "text": "func main() {\n\td := duration{42}\n\td.pretty()\n\n\t// ./listing46.go:17: cannot call pointer method on duration(42)\n\t// ./listing46.go:17: cannot take the address of duration(42)\n}", "title": "" }, { "docid": "2988b3d13da126532211152a64aad105", "score": "0.4420763", "text": "func DeprecatedFlag(f *flag.FlagSet, name, message string) {\n\tf.Var(deprecatedFlag{name}, name, message)\n}", "title": "" }, { "docid": "a7a2bbc932dbb752147472e53b769e02", "score": "0.44147632", "text": "func (loadset *LoadSet) get_load_vector() {\n\n}", "title": "" }, { "docid": "0461f607390da2469030461a01383fb1", "score": "0.4413072", "text": "func parseDeprecation(block *LineBlock, line *Line) string {\n\ttext := parseDirectiveComment(block, line)\n\tm := deprecatedRE.FindStringSubmatch(text)\n\tif m == nil {\n\t\treturn \"\"\n\t}\n\treturn m[1]\n}", "title": "" }, { "docid": "11fc0879812c708ac1bfe6d11b9c0dc7", "score": "0.44084096", "text": "func (in *DeploymentConfigRollback) APILifecycleDeprecated() (major, minor int) {\n\treturn 4, 14\n}", "title": "" }, { "docid": "c38a5149f656c3cf44bcef5f6797169b", "score": "0.4396656", "text": "func usage() {\n\tfmt.Fprint(os.Stderr, USAGE)\n}", "title": "" }, { "docid": "038dd7f29f4a053c9cd3d896ec4014a4", "score": "0.43938047", "text": "func addMetadataDeprecated(client *Client, typedValue, key, value, requestUri string) (Task, error) {\n\tnewMetadata := &types.MetadataValue{\n\t\tXmlns: types.XMLNamespaceVCloud,\n\t\tXsi: types.XMLNamespaceXSI,\n\t\tTypedValue: &types.MetadataTypedValue{\n\t\t\tXsiType: typedValue,\n\t\t\tValue: value,\n\t\t},\n\t}\n\n\tapiEndpoint := urlParseRequestURI(requestUri)\n\tapiEndpoint.Path += \"/metadata/\" + key\n\n\t// Return the task\n\treturn client.ExecuteTaskRequest(apiEndpoint.String(), http.MethodPut,\n\t\ttypes.MimeMetaDataValue, \"error adding metadata: %s\", newMetadata)\n}", "title": "" }, { "docid": "87d234d599f098eff995d451aeb46502", "score": "0.43925098", "text": "func (in *DeploymentRequest) APILifecycleDeprecated() (major, minor int) {\n\treturn 4, 14\n}", "title": "" }, { "docid": "c683e635ffc3763051d721242e8c62b8", "score": "0.43923432", "text": "func TestProviderControlService_GetListInProgress(t *testing.T) {\n\n}", "title": "" }, { "docid": "85f3224f68a25798b755e08579bdb0fd", "score": "0.43734246", "text": "func newTooShortParseLineError(s string) error {\n\treturn errors.New(fmt.Sprintf(\"%s: Parsed line too short.\", s))\n}", "title": "" }, { "docid": "159b761f16f9629805fc2c9b94ee1d2e", "score": "0.4371957", "text": "func (gsp *Gossiper) newForwardedMessage(msg *message.SimpleMessage) *message.SimpleMessage {\n\tmsg = message.NewSimpleMessage(msg.Contents, msg.OriginalName, gsp.PeersSocket.Address())\n\treturn msg\n}", "title": "" }, { "docid": "17d7b5b54a5d03ef7c9f627883a732a9", "score": "0.43712184", "text": "func init() {\r\n}", "title": "" }, { "docid": "41081dfe386fc5ea46595c289931f495", "score": "0.43617854", "text": "func (*Listener_DeprecatedV1) Descriptor() ([]byte, []int) {\n\treturn file_envoy_config_listener_v4alpha_listener_proto_rawDescGZIP(), []int{1, 0}\n}", "title": "" }, { "docid": "eb1d98a47728d83c3cbc103690f85f5d", "score": "0.43576473", "text": "func (s S1) use_v() {\n\tfmt.Println(\"S1.use_v()\")\n}", "title": "" }, { "docid": "cb3e88bbdf18fad3bc52c60ae0640921", "score": "0.43569762", "text": "func _() int {\n\t{\n\t\treturn 2\n\t}\n}", "title": "" }, { "docid": "ddf97c40a205dba2694ca526a204fb54", "score": "0.4354603", "text": "func (in *DeploymentRollback) APILifecycleDeprecated() (major, minor int) {\n\treturn 1, 8\n}", "title": "" }, { "docid": "2be088965f73bfd7443f076d435af63d", "score": "0.43496394", "text": "func (self *MSPointer) PointerMoveCallback() interface{}{\n return self.Object.Get(\"pointerMoveCallback\")\n}", "title": "" }, { "docid": "6b115b7d2c372a3a787caa44c5a1bbcf", "score": "0.43483272", "text": "func New() {\n\n}", "title": "" }, { "docid": "36ac6cf9d4b030237a0681d36e1d516d", "score": "0.43432274", "text": "func DeprecatedDiagnostics(ctx ResolveContext) []protocol.Diagnostic {\n\tdefer util.TimeTrack(time.Now(), \"DeprecatedDiagnostics\")\n\tdoc := ctx.document\n\tq := ctx.query\n\tcreate := func(r protocol.Range, message string) protocol.Diagnostic {\n\t\treturn protocol.Diagnostic{\n\t\t\tRange: r,\n\t\t\tMessage: message,\n\t\t\tSource: source,\n\t\t\tSeverity: protocol.SeverityHint,\n\t\t\tTags: []protocol.DiagnosticTag{protocol.Deprecated},\n\t\t}\n\t}\n\tdiagnostics := []protocol.Diagnostic{}\n\tTraverseDocument(doc, func(s Symbol) {\n\t\tswitch v := s.(type) {\n\t\tcase *FunctionCall:\n\t\t\tt := NewTypeString(v.Name)\n\t\t\tfqn := doc.ImportTableAtPos(v.Location.Range.Start).GetFunctionReferenceFQN(ctx.query, t)\n\t\t\tfor _, f := range q.GetFunctions(fqn) {\n\t\t\t\tif f.deprecatedTag != nil {\n\t\t\t\t\tdiagnostics = append(diagnostics, create(\n\t\t\t\t\t\tv.Location.Range,\n\t\t\t\t\t\tdeprecatedDescription(v.Name+\" is deprecated\", f.deprecatedTag),\n\t\t\t\t\t))\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\tcase *ClassTypeDesignator:\n\t\t\tv.Resolve(ctx)\n\t\tLClassTypeDesignator:\n\t\t\tfor _, t := range v.GetTypes().Resolve() {\n\t\t\t\tfor _, c := range q.GetClasses(t.GetFQN()) {\n\t\t\t\t\tif c.deprecatedTag != nil {\n\t\t\t\t\t\tdiagnostics = append(diagnostics, create(\n\t\t\t\t\t\t\tv.Location.Range,\n\t\t\t\t\t\t\tdeprecatedDescription(v.Name+\" is deprecated\", c.deprecatedTag),\n\t\t\t\t\t\t))\n\t\t\t\t\t\tbreak LClassTypeDesignator\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\tcase *TypeDeclaration:\n\t\t\tv.Resolve(ctx)\n\t\tLTypeDecl:\n\t\t\tfor _, t := range v.GetTypes().Resolve() {\n\t\t\t\tfor _, c := range q.GetClasses(t.GetFQN()) {\n\t\t\t\t\tif c.deprecatedTag != nil {\n\t\t\t\t\t\tdiagnostics = append(diagnostics, create(\n\t\t\t\t\t\t\tv.Location.Range,\n\t\t\t\t\t\t\tdeprecatedDescription(v.Name+\" is deprecated\", c.deprecatedTag),\n\t\t\t\t\t\t))\n\t\t\t\t\t\tbreak LTypeDecl\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor _, i := range q.GetInterfaces(t.GetFQN()) {\n\t\t\t\t\tif i.deprecatedTag != nil {\n\t\t\t\t\t\tdiagnostics = append(diagnostics, create(\n\t\t\t\t\t\t\tv.Location.Range,\n\t\t\t\t\t\t\tdeprecatedDescription(v.Name+\" is deprecated\", i.deprecatedTag),\n\t\t\t\t\t\t))\n\t\t\t\t\t\tbreak LTypeDecl\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\tcase *ClassAccess:\n\t\t\tv.Resolve(ctx)\n\t\tLClass:\n\t\t\tfor _, t := range v.GetTypes().Resolve() {\n\t\t\t\tfor _, c := range q.GetClasses(t.GetFQN()) {\n\t\t\t\t\tif c.deprecatedTag != nil {\n\t\t\t\t\t\tdiagnostics = append(diagnostics, create(\n\t\t\t\t\t\t\tv.Location.Range,\n\t\t\t\t\t\t\tdeprecatedDescription(v.Name+\" is deprecated\", c.deprecatedTag),\n\t\t\t\t\t\t))\n\t\t\t\t\t\tbreak LClass\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor _, i := range q.GetInterfaces(t.GetFQN()) {\n\t\t\t\t\tif i.deprecatedTag != nil {\n\t\t\t\t\t\tdiagnostics = append(diagnostics, create(\n\t\t\t\t\t\t\tv.Location.Range,\n\t\t\t\t\t\t\tdeprecatedDescription(v.Name+\" is deprecated\", i.deprecatedTag),\n\t\t\t\t\t\t))\n\t\t\t\t\t\tbreak LClass\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\tcase *InterfaceAccess:\n\t\t\tv.Resolve(ctx)\n\t\tLInterface:\n\t\t\tfor _, t := range v.GetTypes().Resolve() {\n\t\t\t\tfor _, i := range q.GetInterfaces(t.GetFQN()) {\n\t\t\t\t\tif i.deprecatedTag != nil {\n\t\t\t\t\t\tdiagnostics = append(diagnostics, create(\n\t\t\t\t\t\t\tv.Location.Range,\n\t\t\t\t\t\t\tdeprecatedDescription(v.Name+\" is deprecated\", i.deprecatedTag),\n\t\t\t\t\t\t))\n\t\t\t\t\t\tbreak LInterface\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\tcase *ConstantAccess:\n\t\t\tv.Resolve(ctx)\n\t\t\tname := NewTypeString(v.Name)\n\t\t\tfqn := doc.ImportTableAtPos(v.Location.Range.Start).GetConstReferenceFQN(q, name)\n\t\t\tvar shouldStop bool\n\t\t\tfor _, c := range q.GetConsts(fqn) {\n\t\t\t\tif c.deprecatedTag != nil {\n\t\t\t\t\tdiagnostics = append(diagnostics, create(\n\t\t\t\t\t\tv.Location.Range,\n\t\t\t\t\t\tdeprecatedDescription(v.Name+\" is deprecated\", c.deprecatedTag),\n\t\t\t\t\t))\n\t\t\t\t\tshouldStop = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif shouldStop {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tfor _, c := range q.GetDefines(fqn) {\n\t\t\t\tif c.deprecatedTag != nil {\n\t\t\t\t\tdiagnostics = append(diagnostics, create(\n\t\t\t\t\t\tv.Location.Range,\n\t\t\t\t\t\tdeprecatedDescription(v.Name+\" is deprecated\", c.deprecatedTag),\n\t\t\t\t\t))\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\tcase *ScopedConstantAccess:\n\t\tLScopedConstant:\n\t\t\tfor _, scopeType := range v.ResolveAndGetScope(ctx).Resolve() {\n\t\t\t\tfor _, c := range q.GetClassConsts(scopeType.GetFQN(), v.Name) {\n\t\t\t\t\tif c.deprecatedTag != nil {\n\t\t\t\t\t\tdiagnostics = append(diagnostics, create(\n\t\t\t\t\t\t\tv.Location.Range,\n\t\t\t\t\t\t\tdeprecatedDescription(c.ReferenceFQN()+\" is deprecated\", c.deprecatedTag),\n\t\t\t\t\t\t))\n\t\t\t\t\t\tbreak LScopedConstant\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\tcase *ScopedMethodAccess:\n\t\t\tcurrentClass := ctx.document.GetClassScopeAtSymbol(v)\n\t\tLScopedMethod:\n\t\t\tfor _, scopeType := range v.ResolveAndGetScope(ctx).Resolve() {\n\t\t\t\tfor _, class := range q.GetClasses(scopeType.GetFQN()) {\n\t\t\t\t\tfor _, m := range q.GetClassMethods(class, v.Name, nil).ReduceStatic(currentClass, v) {\n\t\t\t\t\t\tif m.Method == nil {\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif m.Method.deprecatedTag != nil {\n\t\t\t\t\t\t\tdiagnostics = append(diagnostics, create(\n\t\t\t\t\t\t\t\tv.Location.Range,\n\t\t\t\t\t\t\t\tdeprecatedDescription(m.Method.ReferenceFQN()+\" is deprecated\", m.Method.deprecatedTag),\n\t\t\t\t\t\t\t))\n\t\t\t\t\t\t\tbreak LScopedMethod\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\tcase *ScopedPropertyAccess:\n\t\t\tcurrentClass := ctx.document.GetClassScopeAtSymbol(v)\n\t\tLScopedProp:\n\t\t\tfor _, scopeType := range v.ResolveAndGetScope(ctx).Resolve() {\n\t\t\t\tfor _, class := range q.GetClasses(scopeType.GetFQN()) {\n\t\t\t\t\tfor _, p := range q.GetClassProps(class, v.Name, nil).ReduceStatic(currentClass, v) {\n\t\t\t\t\t\tif p.Prop.deprecatedTag != nil {\n\t\t\t\t\t\t\tdiagnostics = append(diagnostics, create(\n\t\t\t\t\t\t\t\tv.Location.Range,\n\t\t\t\t\t\t\t\tdeprecatedDescription(p.Prop.ReferenceFQN()+\" is deprecated\", p.Prop.deprecatedTag),\n\t\t\t\t\t\t\t))\n\t\t\t\t\t\t\tbreak LScopedProp\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\tcase *PropertyAccess:\n\t\t\tcurrentClass := ctx.document.GetClassScopeAtSymbol(v)\n\t\tLProp:\n\t\t\tfor _, scopeType := range v.ResolveAndGetScope(ctx).Resolve() {\n\t\t\t\tfor _, class := range q.GetClasses(scopeType.GetFQN()) {\n\t\t\t\t\tfor _, p := range q.GetClassProps(class, \"$\"+v.Name, nil).ReduceAccess(currentClass, v) {\n\t\t\t\t\t\tif p.Prop.deprecatedTag != nil {\n\t\t\t\t\t\t\tdiagnostics = append(diagnostics, create(\n\t\t\t\t\t\t\t\tv.Location.Range,\n\t\t\t\t\t\t\t\tdeprecatedDescription(p.Prop.ReferenceFQN()+\" is deprecated\", p.Prop.deprecatedTag),\n\t\t\t\t\t\t\t))\n\t\t\t\t\t\t\tbreak LProp\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\tcase *MethodAccess:\n\t\t\tcurrentClass := ctx.document.GetClassScopeAtSymbol(v)\n\t\tLMethod:\n\t\t\tfor _, scopeType := range v.ResolveAndGetScope(ctx).Resolve() {\n\t\t\t\tfor _, class := range q.GetClasses(scopeType.GetFQN()) {\n\t\t\t\t\tfor _, m := range q.GetClassMethods(class, v.Name, nil).ReduceAccess(currentClass, v) {\n\t\t\t\t\t\tmethod := m.Method\n\t\t\t\t\t\tif method == nil {\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif method.deprecatedTag != nil {\n\t\t\t\t\t\t\tdiagnostics = append(diagnostics, create(\n\t\t\t\t\t\t\t\tv.Location.Range,\n\t\t\t\t\t\t\t\tdeprecatedDescription(method.ReferenceFQN()+\" is deprecated\", method.deprecatedTag),\n\t\t\t\t\t\t\t))\n\t\t\t\t\t\t\tbreak LMethod\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor _, theInterface := range q.GetInterfaces(scopeType.GetFQN()) {\n\t\t\t\t\tfor _, m := range q.GetInterfaceMethods(theInterface, v.Name, nil).ReduceAccess(currentClass, v) {\n\t\t\t\t\t\tmethod := m.Method\n\t\t\t\t\t\tif method == nil {\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif method.deprecatedTag != nil {\n\t\t\t\t\t\t\tdiagnostics = append(diagnostics, create(\n\t\t\t\t\t\t\t\tv.Location.Range,\n\t\t\t\t\t\t\t\tdeprecatedDescription(method.ReferenceFQN()+\" is deprecated\", method.deprecatedTag),\n\t\t\t\t\t\t\t))\n\t\t\t\t\t\t\tbreak LMethod\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor _, trait := range q.GetTraits(scopeType.GetFQN()) {\n\t\t\t\t\tfor _, m := range q.GetTraitMethods(trait, v.Name).ReduceAccess(currentClass, v) {\n\t\t\t\t\t\tmethod := m.Method\n\t\t\t\t\t\tif method == nil {\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif method.deprecatedTag != nil {\n\t\t\t\t\t\t\tdiagnostics = append(diagnostics, create(\n\t\t\t\t\t\t\t\tv.Location.Range,\n\t\t\t\t\t\t\t\tdeprecatedDescription(method.ReferenceFQN()+\" is deprecated\", method.deprecatedTag),\n\t\t\t\t\t\t\t))\n\t\t\t\t\t\t\tbreak LMethod\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}, nil)\n\treturn diagnostics\n}", "title": "" }, { "docid": "8896499f275215adf8df584511e9b952", "score": "0.43382946", "text": "func SupportV1(strgObject storage.IStorage, cfg *types.Config) {\n strg = strgObject\n config = cfg\n}", "title": "" }, { "docid": "1f2068eb1d21cff55665638c8a537836", "score": "0.43358812", "text": "func DeprecatedChannel(cb func(p Position, channel uint8)) func(r *Reader) {\n\treturn func(r *Reader) {\n\t\tr.message.Meta.Deprecated.Channel = cb\n\t}\n}", "title": "" }, { "docid": "2129285fd98dfa5863f69406c8b38a5a", "score": "0.43326676", "text": "func usageErr(err error) {\n\tusage()\n\tfmt.Fprintf(os.Stderr, \"Error: %v\\n\\n\", err)\n}", "title": "" }, { "docid": "0596f27be72c2459373f06fad36df414", "score": "0.43260357", "text": "func (vm *Vm) getspecial() {}", "title": "" }, { "docid": "8b236f4440ad22c48d3fbd8b20c3d6f5", "score": "0.43223923", "text": "func Version() string { return version }", "title": "" }, { "docid": "58ee5410d112cd81ed8455df864b99b9", "score": "0.43114126", "text": "func (s PathStepElementKeyInt) unexported() {}", "title": "" }, { "docid": "03d3c37b39592139b88fc69c91bd74b8", "score": "0.4306979", "text": "func (*GroupOld_G) Descriptor() ([]byte, []int) {\n\treturn file_proto2_proto_test_proto_rawDescGZIP(), []int{24, 0}\n}", "title": "" }, { "docid": "3bbf2a8da89f96460c3c22bf770da160", "score": "0.43054333", "text": "func deprecateBackend(b backend.Backend, message string) backend.Backend {\n\t// Since a Backend wrapped by deprecatedBackendShim can no longer be\n\t// asserted as an Enhanced or Local backend, disallow those types here\n\t// entirely. If something other than a basic backend.Backend needs to be\n\t// deprecated, we can add that functionality to schema.Backend or the\n\t// backend itself.\n\tif _, ok := b.(backend.Enhanced); ok {\n\t\tpanic(\"cannot use DeprecateBackend on an Enhanced Backend\")\n\t}\n\n\tif _, ok := b.(backend.Local); ok {\n\t\tpanic(\"cannot use DeprecateBackend on a Local Backend\")\n\t}\n\n\treturn deprecatedBackendShim{\n\t\tBackend: b,\n\t\tMessage: message,\n\t}\n}", "title": "" }, { "docid": "3bbf2a8da89f96460c3c22bf770da160", "score": "0.43054333", "text": "func deprecateBackend(b backend.Backend, message string) backend.Backend {\n\t// Since a Backend wrapped by deprecatedBackendShim can no longer be\n\t// asserted as an Enhanced or Local backend, disallow those types here\n\t// entirely. If something other than a basic backend.Backend needs to be\n\t// deprecated, we can add that functionality to schema.Backend or the\n\t// backend itself.\n\tif _, ok := b.(backend.Enhanced); ok {\n\t\tpanic(\"cannot use DeprecateBackend on an Enhanced Backend\")\n\t}\n\n\tif _, ok := b.(backend.Local); ok {\n\t\tpanic(\"cannot use DeprecateBackend on a Local Backend\")\n\t}\n\n\treturn deprecatedBackendShim{\n\t\tBackend: b,\n\t\tMessage: message,\n\t}\n}", "title": "" }, { "docid": "74842b8a3389ef53cd07b26848b8aa4c", "score": "0.43044475", "text": "func DeprecatedInThreePointOh(deprecationMessage string) string {\n\tif !ThreePointOh() {\n\t\treturn \"\"\n\t}\n\n\treturn deprecationMessage\n}", "title": "" }, { "docid": "425b17b98eb7c6335e3b3a36d9201c98", "score": "0.4301402", "text": "func throw(_ string)", "title": "" }, { "docid": "f743bd173c18932cb22c600d23a12a2f", "score": "0.43013328", "text": "func (s S0) use_v() {\n\tfmt.Println(\"S0.use_v()\")\n}", "title": "" }, { "docid": "6735847df02f27e29ca4faeade741027", "score": "0.42989153", "text": "func init() {\r\n\r\n}", "title": "" }, { "docid": "bcd432504a4db0ffbc17196630ac1491", "score": "0.42921108", "text": "func setErr0(frame *rtda.Frame) {\n\terrObj := frame.LocalVars().GetRef(0)\n\tsysClass := frame.GetMethod().GetOwner()\n\tsysClass.SetStaticFieldRef(\"err\", \"Ljava/io/PrintStream;\", errObj)\n}", "title": "" }, { "docid": "f08004e0a3f1e742d53a92e508806fa3", "score": "0.42899463", "text": "func newWrongTypeComplainer(dependencyName string) WrongTypeComplainer {\n\terr := internalWrongTypeComplainer{\n\t\tdependencyName:dependencyName,\n\t}\n\n\treturn &err\n}", "title": "" }, { "docid": "e719adc8a8dd3731c081d38fb4515330", "score": "0.42888063", "text": "func newUUID() string {\n\treturn uuid.Must(uuid.NewV4()).String()\n}", "title": "" }, { "docid": "f4c96c93a8b06c12b3b9a3c057291ea3", "score": "0.4287999", "text": "func ExampleWrite() {}", "title": "" }, { "docid": "720f216bd06741e3109a335b7d1beb08", "score": "0.42848593", "text": "func (self *MSPointer) Enabled() bool{\n return self.Object.Get(\"enabled\").Bool()\n}", "title": "" }, { "docid": "8143c55ed6ee324d0ce9d1b76f3f8120", "score": "0.42825598", "text": "func ExpErr() error { // ok\n return nil\n}", "title": "" }, { "docid": "ae6d9e9dd6a03f0acc987d42cd1b5ef5", "score": "0.42763168", "text": "func libfuse_rename(src *C.char, dst *C.char, flags C.uint) C.int {\n\tsrcPath := trimFusePath(src)\n\tsrcPath = common.NormalizeObjectName(srcPath)\n\tdstPath := trimFusePath(dst)\n\tdstPath = common.NormalizeObjectName(dstPath)\n\tlog.Trace(\"Libfuse::libfuse_rename : %s -> %s\", srcPath, dstPath)\n\t// Note: When running other commands from the command line, a lot of them seemed to handle some cases like ENOENT themselves.\n\t// Rename did not, so we manually check here.\n\n\t// TODO: Support for RENAME_EXCHANGE\n\tif flags&C.RENAME_EXCHANGE != 0 {\n\t\treturn -C.ENOTSUP\n\t}\n\n\t// ENOENT. Not covered: a directory component in dst does not exist\n\tif srcPath == \"\" || dstPath == \"\" {\n\t\tlog.Err(\"Libfuse::libfuse_rename : src: [%s] or dst: [%s] is an empty string\", srcPath, dstPath)\n\t\treturn -C.ENOENT\n\t}\n\n\tsrcAttr, srcErr := fuseFS.NextComponent().GetAttr(internal.GetAttrOptions{Name: srcPath})\n\tif os.IsNotExist(srcErr) {\n\t\tlog.Err(\"Libfuse::libfuse_rename : Failed to get attributes of %s [%s]\", srcPath, srcErr.Error())\n\t\treturn -C.ENOENT\n\t}\n\tdstAttr, dstErr := fuseFS.NextComponent().GetAttr(internal.GetAttrOptions{Name: dstPath})\n\n\t// EEXIST\n\tif flags&C.RENAME_NOREPLACE != 0 && (dstErr == nil || os.IsExist(dstErr)) {\n\t\treturn -C.EEXIST\n\t}\n\n\t// EISDIR\n\tif (dstErr == nil || os.IsExist(dstErr)) && dstAttr.IsDir() && !srcAttr.IsDir() {\n\t\tlog.Err(\"Libfuse::libfuse_rename : dst [%s] is an existing directory but src [%s] is not a directory\", dstPath, srcPath)\n\t\treturn -C.EISDIR\n\t}\n\n\t// ENOTDIR\n\tif (dstErr == nil || os.IsExist(dstErr)) && !dstAttr.IsDir() && srcAttr.IsDir() {\n\t\tlog.Err(\"Libfuse::libfuse_rename : dst [%s] is an existing file but src [%s] is a directory\", dstPath, srcPath)\n\t\treturn -C.ENOTDIR\n\t}\n\n\tif srcAttr.IsDir() {\n\t\t// ENOTEMPTY\n\t\tif dstErr == nil || os.IsExist(dstErr) {\n\t\t\tempty := fuseFS.NextComponent().IsDirEmpty(internal.IsDirEmptyOptions{Name: dstPath})\n\t\t\tif !empty {\n\t\t\t\treturn -C.ENOTEMPTY\n\t\t\t}\n\t\t}\n\n\t\terr := fuseFS.NextComponent().RenameDir(internal.RenameDirOptions{Src: srcPath, Dst: dstPath})\n\t\tif err != nil {\n\t\t\tlog.Err(\"Libfuse::libfuse_rename : error renaming directory %s -> %s [%s]\", srcPath, dstPath, err.Error())\n\t\t\treturn -C.EIO\n\t\t}\n\n\t\tlibfuseStatsCollector.PushEvents(renameDir, srcPath, map[string]interface{}{source: srcPath, dest: dstPath})\n\t\tlibfuseStatsCollector.UpdateStats(stats_manager.Increment, renameDir, (int64)(1))\n\n\t} else {\n\t\terr := fuseFS.NextComponent().RenameFile(internal.RenameFileOptions{Src: srcPath, Dst: dstPath})\n\t\tif err != nil {\n\t\t\tlog.Err(\"Libfuse::libfuse_rename : error renaming file %s -> %s [%s]\", srcPath, dstPath, err.Error())\n\t\t\treturn -C.EIO\n\t\t}\n\n\t\tlibfuseStatsCollector.PushEvents(renameFile, srcPath, map[string]interface{}{source: srcPath, dest: dstPath})\n\t\tlibfuseStatsCollector.UpdateStats(stats_manager.Increment, renameFile, (int64)(1))\n\n\t}\n\n\treturn 0\n}", "title": "" }, { "docid": "1c70deb30fbdc8297b8d15ac87510de3", "score": "0.42762962", "text": "func useMappedValue() {\n\t// TODO: implement\n}", "title": "" }, { "docid": "fb09d80467a2e2eb1a35fb7243db3aed", "score": "0.42727822", "text": "func (self *UtilsDebug) CurrentAlpha() int{\n return self.Object.Get(\"currentAlpha\").Int()\n}", "title": "" }, { "docid": "320e737ed6fd84e5ada50199774a6a19", "score": "0.4271352", "text": "func Fail(_ interface{}) {}", "title": "" }, { "docid": "7b8bd1462cbdadaefc7f8b173c19b0cb", "score": "0.4269854", "text": "func main() {\n\nmystructvar := mystruct {\"helloo\" }\n\nmystructvar.mymethod()\t\t// <<<<< rename,17,13,17,13,main,fail\n\n\n}", "title": "" }, { "docid": "8cb10aa70857e2ca04254d840b60cdf9", "score": "0.42691153", "text": "func (*SousQueryGDM) Help() string { return sousQueryGDMHelp }", "title": "" }, { "docid": "a69d53c7d75e9a67cce50df240fb364a", "score": "0.42688504", "text": "func (*GroupOld) Descriptor() ([]byte, []int) {\n\treturn file_proto2_proto_test_proto_rawDescGZIP(), []int{24}\n}", "title": "" } ]
a3bc3ad6de28db7f36ef31342626bf50
ProtoToTableExternalDataConfigurationJsonExtensionEnum converts a TableExternalDataConfigurationJsonExtensionEnum enum from its proto representation.
[ { "docid": "7edb893c9b3c29ba480ba2940bc86f33", "score": "0.80581", "text": "func ProtoToBigqueryAlphaTableExternalDataConfigurationJsonExtensionEnum(e alphapb.BigqueryAlphaTableExternalDataConfigurationJsonExtensionEnum) *alpha.TableExternalDataConfigurationJsonExtensionEnum {\n\tif e == 0 {\n\t\treturn nil\n\t}\n\tif n, ok := alphapb.BigqueryAlphaTableExternalDataConfigurationJsonExtensionEnum_name[int32(e)]; ok {\n\t\te := alpha.TableExternalDataConfigurationJsonExtensionEnum(n[len(\"BigqueryAlphaTableExternalDataConfigurationJsonExtensionEnum\"):])\n\t\treturn &e\n\t}\n\treturn nil\n}", "title": "" } ]
[ { "docid": "d7aaf01d9c386ed29f6b2ea7e57b1ca1", "score": "0.8263319", "text": "func BigqueryAlphaTableExternalDataConfigurationJsonExtensionEnumToProto(e *alpha.TableExternalDataConfigurationJsonExtensionEnum) alphapb.BigqueryAlphaTableExternalDataConfigurationJsonExtensionEnum {\n\tif e == nil {\n\t\treturn alphapb.BigqueryAlphaTableExternalDataConfigurationJsonExtensionEnum(0)\n\t}\n\tif v, ok := alphapb.BigqueryAlphaTableExternalDataConfigurationJsonExtensionEnum_value[\"TableExternalDataConfigurationJsonExtensionEnum\"+string(*e)]; ok {\n\t\treturn alphapb.BigqueryAlphaTableExternalDataConfigurationJsonExtensionEnum(v)\n\t}\n\treturn alphapb.BigqueryAlphaTableExternalDataConfigurationJsonExtensionEnum(0)\n}", "title": "" }, { "docid": "01c69218df8e6c89f571b5ce149fbf7f", "score": "0.68077666", "text": "func BigqueryAlphaTableExternalDataConfigurationDecimalTargetTypesEnumToProto(e *alpha.TableExternalDataConfigurationDecimalTargetTypesEnum) alphapb.BigqueryAlphaTableExternalDataConfigurationDecimalTargetTypesEnum {\n\tif e == nil {\n\t\treturn alphapb.BigqueryAlphaTableExternalDataConfigurationDecimalTargetTypesEnum(0)\n\t}\n\tif v, ok := alphapb.BigqueryAlphaTableExternalDataConfigurationDecimalTargetTypesEnum_value[\"TableExternalDataConfigurationDecimalTargetTypesEnum\"+string(*e)]; ok {\n\t\treturn alphapb.BigqueryAlphaTableExternalDataConfigurationDecimalTargetTypesEnum(v)\n\t}\n\treturn alphapb.BigqueryAlphaTableExternalDataConfigurationDecimalTargetTypesEnum(0)\n}", "title": "" }, { "docid": "5b18a2e2025a6e516f8b84fd46d43f91", "score": "0.64275616", "text": "func ProtoToBigqueryAlphaTableExternalDataConfigurationDecimalTargetTypesEnum(e alphapb.BigqueryAlphaTableExternalDataConfigurationDecimalTargetTypesEnum) *alpha.TableExternalDataConfigurationDecimalTargetTypesEnum {\n\tif e == 0 {\n\t\treturn nil\n\t}\n\tif n, ok := alphapb.BigqueryAlphaTableExternalDataConfigurationDecimalTargetTypesEnum_name[int32(e)]; ok {\n\t\te := alpha.TableExternalDataConfigurationDecimalTargetTypesEnum(n[len(\"BigqueryAlphaTableExternalDataConfigurationDecimalTargetTypesEnum\"):])\n\t\treturn &e\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c1d0fa7e81641a897e9674e0e6f65d0d", "score": "0.6250939", "text": "func DataplexAssetDiscoveryStatusStateEnumToProto(e *dataplex.AssetDiscoveryStatusStateEnum) dataplexpb.DataplexAssetDiscoveryStatusStateEnum {\n\tif e == nil {\n\t\treturn dataplexpb.DataplexAssetDiscoveryStatusStateEnum(0)\n\t}\n\tif v, ok := dataplexpb.DataplexAssetDiscoveryStatusStateEnum_value[\"AssetDiscoveryStatusStateEnum\"+string(*e)]; ok {\n\t\treturn dataplexpb.DataplexAssetDiscoveryStatusStateEnum(v)\n\t}\n\treturn dataplexpb.DataplexAssetDiscoveryStatusStateEnum(0)\n}", "title": "" }, { "docid": "2590352b3fdaaa8e2993879bad570766", "score": "0.6249885", "text": "func BigqueryAlphaTableExternalDataConfigurationValueConversionModesToProto(o *alpha.TableExternalDataConfigurationValueConversionModes) *alphapb.BigqueryAlphaTableExternalDataConfigurationValueConversionModes {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &alphapb.BigqueryAlphaTableExternalDataConfigurationValueConversionModes{}\n\tp.SetTemporalTypesOutOfRangeConversionMode(BigqueryAlphaTableExternalDataConfigurationValueConversionModesTemporalTypesOutOfRangeConversionModeEnumToProto(o.TemporalTypesOutOfRangeConversionMode))\n\tp.SetNumericTypeOutOfRangeConversionMode(BigqueryAlphaTableExternalDataConfigurationValueConversionModesNumericTypeOutOfRangeConversionModeEnumToProto(o.NumericTypeOutOfRangeConversionMode))\n\treturn p\n}", "title": "" }, { "docid": "6a1dbbdb1c88696319f745a5fa469800", "score": "0.62414753", "text": "func ProtoToBigqueryAlphaTableExternalDataConfigurationValueConversionModes(p *alphapb.BigqueryAlphaTableExternalDataConfigurationValueConversionModes) *alpha.TableExternalDataConfigurationValueConversionModes {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &alpha.TableExternalDataConfigurationValueConversionModes{\n\t\tTemporalTypesOutOfRangeConversionMode: ProtoToBigqueryAlphaTableExternalDataConfigurationValueConversionModesTemporalTypesOutOfRangeConversionModeEnum(p.GetTemporalTypesOutOfRangeConversionMode()),\n\t\tNumericTypeOutOfRangeConversionMode: ProtoToBigqueryAlphaTableExternalDataConfigurationValueConversionModesNumericTypeOutOfRangeConversionModeEnum(p.GetNumericTypeOutOfRangeConversionMode()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "9b74d5e812ba7a63ca5e116fa11190b5", "score": "0.616121", "text": "func BigqueryAlphaTableExternalDataConfigurationValueConversionModesTemporalTypesOutOfRangeConversionModeEnumToProto(e *alpha.TableExternalDataConfigurationValueConversionModesTemporalTypesOutOfRangeConversionModeEnum) alphapb.BigqueryAlphaTableExternalDataConfigurationValueConversionModesTemporalTypesOutOfRangeConversionModeEnum {\n\tif e == nil {\n\t\treturn alphapb.BigqueryAlphaTableExternalDataConfigurationValueConversionModesTemporalTypesOutOfRangeConversionModeEnum(0)\n\t}\n\tif v, ok := alphapb.BigqueryAlphaTableExternalDataConfigurationValueConversionModesTemporalTypesOutOfRangeConversionModeEnum_value[\"TableExternalDataConfigurationValueConversionModesTemporalTypesOutOfRangeConversionModeEnum\"+string(*e)]; ok {\n\t\treturn alphapb.BigqueryAlphaTableExternalDataConfigurationValueConversionModesTemporalTypesOutOfRangeConversionModeEnum(v)\n\t}\n\treturn alphapb.BigqueryAlphaTableExternalDataConfigurationValueConversionModesTemporalTypesOutOfRangeConversionModeEnum(0)\n}", "title": "" }, { "docid": "730876a4f4d2e1bb8f06656092c48ecd", "score": "0.615921", "text": "func ProtoToBigqueryAlphaTableExternalDataConfigurationValueConversionModesTemporalTypesOutOfRangeConversionModeEnum(e alphapb.BigqueryAlphaTableExternalDataConfigurationValueConversionModesTemporalTypesOutOfRangeConversionModeEnum) *alpha.TableExternalDataConfigurationValueConversionModesTemporalTypesOutOfRangeConversionModeEnum {\n\tif e == 0 {\n\t\treturn nil\n\t}\n\tif n, ok := alphapb.BigqueryAlphaTableExternalDataConfigurationValueConversionModesTemporalTypesOutOfRangeConversionModeEnum_name[int32(e)]; ok {\n\t\te := alpha.TableExternalDataConfigurationValueConversionModesTemporalTypesOutOfRangeConversionModeEnum(n[len(\"BigqueryAlphaTableExternalDataConfigurationValueConversionModesTemporalTypesOutOfRangeConversionModeEnum\"):])\n\t\treturn &e\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1bf39ba01f1a247818185858aaeb71af", "score": "0.6132508", "text": "func DataplexAssetStateEnumToProto(e *dataplex.AssetStateEnum) dataplexpb.DataplexAssetStateEnum {\n\tif e == nil {\n\t\treturn dataplexpb.DataplexAssetStateEnum(0)\n\t}\n\tif v, ok := dataplexpb.DataplexAssetStateEnum_value[\"AssetStateEnum\"+string(*e)]; ok {\n\t\treturn dataplexpb.DataplexAssetStateEnum(v)\n\t}\n\treturn dataplexpb.DataplexAssetStateEnum(0)\n}", "title": "" }, { "docid": "2e4510fc4f7c65484c7431c1a473b58a", "score": "0.61125624", "text": "func DataplexAssetResourceStatusStateEnumToProto(e *dataplex.AssetResourceStatusStateEnum) dataplexpb.DataplexAssetResourceStatusStateEnum {\n\tif e == nil {\n\t\treturn dataplexpb.DataplexAssetResourceStatusStateEnum(0)\n\t}\n\tif v, ok := dataplexpb.DataplexAssetResourceStatusStateEnum_value[\"AssetResourceStatusStateEnum\"+string(*e)]; ok {\n\t\treturn dataplexpb.DataplexAssetResourceStatusStateEnum(v)\n\t}\n\treturn dataplexpb.DataplexAssetResourceStatusStateEnum(0)\n}", "title": "" }, { "docid": "9520b56f065ab3daf638fd19d9d414cd", "score": "0.61117977", "text": "func DatafusionAlphaInstanceStateEnumToProto(e *alpha.InstanceStateEnum) alphapb.DatafusionAlphaInstanceStateEnum {\n\tif e == nil {\n\t\treturn alphapb.DatafusionAlphaInstanceStateEnum(0)\n\t}\n\tif v, ok := alphapb.DatafusionAlphaInstanceStateEnum_value[\"InstanceStateEnum\"+string(*e)]; ok {\n\t\treturn alphapb.DatafusionAlphaInstanceStateEnum(v)\n\t}\n\treturn alphapb.DatafusionAlphaInstanceStateEnum(0)\n}", "title": "" }, { "docid": "b6a6bb3700c4fd76994bbdce58656955", "score": "0.6111061", "text": "func BigqueryAlphaTableExternalDataConfigurationValueConversionModesNumericTypeOutOfRangeConversionModeEnumToProto(e *alpha.TableExternalDataConfigurationValueConversionModesNumericTypeOutOfRangeConversionModeEnum) alphapb.BigqueryAlphaTableExternalDataConfigurationValueConversionModesNumericTypeOutOfRangeConversionModeEnum {\n\tif e == nil {\n\t\treturn alphapb.BigqueryAlphaTableExternalDataConfigurationValueConversionModesNumericTypeOutOfRangeConversionModeEnum(0)\n\t}\n\tif v, ok := alphapb.BigqueryAlphaTableExternalDataConfigurationValueConversionModesNumericTypeOutOfRangeConversionModeEnum_value[\"TableExternalDataConfigurationValueConversionModesNumericTypeOutOfRangeConversionModeEnum\"+string(*e)]; ok {\n\t\treturn alphapb.BigqueryAlphaTableExternalDataConfigurationValueConversionModesNumericTypeOutOfRangeConversionModeEnum(v)\n\t}\n\treturn alphapb.BigqueryAlphaTableExternalDataConfigurationValueConversionModesNumericTypeOutOfRangeConversionModeEnum(0)\n}", "title": "" }, { "docid": "17cb43231b676089d347333cd6d895ad", "score": "0.6109816", "text": "func ProtoToBigqueryAlphaTableExternalDataConfigurationValueConversionModesNumericTypeOutOfRangeConversionModeEnum(e alphapb.BigqueryAlphaTableExternalDataConfigurationValueConversionModesNumericTypeOutOfRangeConversionModeEnum) *alpha.TableExternalDataConfigurationValueConversionModesNumericTypeOutOfRangeConversionModeEnum {\n\tif e == 0 {\n\t\treturn nil\n\t}\n\tif n, ok := alphapb.BigqueryAlphaTableExternalDataConfigurationValueConversionModesNumericTypeOutOfRangeConversionModeEnum_name[int32(e)]; ok {\n\t\te := alpha.TableExternalDataConfigurationValueConversionModesNumericTypeOutOfRangeConversionModeEnum(n[len(\"BigqueryAlphaTableExternalDataConfigurationValueConversionModesNumericTypeOutOfRangeConversionModeEnum\"):])\n\t\treturn &e\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e2fc8465de69894a95d809e449f75fa9", "score": "0.6039417", "text": "func DataplexAssetSecurityStatusStateEnumToProto(e *dataplex.AssetSecurityStatusStateEnum) dataplexpb.DataplexAssetSecurityStatusStateEnum {\n\tif e == nil {\n\t\treturn dataplexpb.DataplexAssetSecurityStatusStateEnum(0)\n\t}\n\tif v, ok := dataplexpb.DataplexAssetSecurityStatusStateEnum_value[\"AssetSecurityStatusStateEnum\"+string(*e)]; ok {\n\t\treturn dataplexpb.DataplexAssetSecurityStatusStateEnum(v)\n\t}\n\treturn dataplexpb.DataplexAssetSecurityStatusStateEnum(0)\n}", "title": "" }, { "docid": "77d87ac4e83a7336580002522386efe9", "score": "0.603619", "text": "func MonitoringAlphaNotificationChannelVerificationStatusEnumToProto(e *alpha.NotificationChannelVerificationStatusEnum) alphapb.MonitoringAlphaNotificationChannelVerificationStatusEnum {\n\tif e == nil {\n\t\treturn alphapb.MonitoringAlphaNotificationChannelVerificationStatusEnum(0)\n\t}\n\tif v, ok := alphapb.MonitoringAlphaNotificationChannelVerificationStatusEnum_value[\"NotificationChannelVerificationStatusEnum\"+string(*e)]; ok {\n\t\treturn alphapb.MonitoringAlphaNotificationChannelVerificationStatusEnum(v)\n\t}\n\treturn alphapb.MonitoringAlphaNotificationChannelVerificationStatusEnum(0)\n}", "title": "" }, { "docid": "d1907dc029813369b8dfa289bc019c50", "score": "0.597149", "text": "func BigqueryAlphaTableExternalDataConfigurationAvroOptionsToProto(o *alpha.TableExternalDataConfigurationAvroOptions) *alphapb.BigqueryAlphaTableExternalDataConfigurationAvroOptions {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &alphapb.BigqueryAlphaTableExternalDataConfigurationAvroOptions{}\n\tp.SetUseAvroLogicalTypes(dcl.ValueOrEmptyBool(o.UseAvroLogicalTypes))\n\treturn p\n}", "title": "" }, { "docid": "acc4805e7d44e6b3cc536e8f404abd14", "score": "0.59646064", "text": "func ProtoToBigqueryAlphaTableExternalDataConfiguration(p *alphapb.BigqueryAlphaTableExternalDataConfiguration) *alpha.TableExternalDataConfiguration {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &alpha.TableExternalDataConfiguration{\n\t\tSchema: ProtoToBigqueryAlphaTableExternalDataConfigurationSchema(p.GetSchema()),\n\t\tSourceFormat: dcl.StringOrNil(p.GetSourceFormat()),\n\t\tMaxBadRecords: dcl.Int64OrNil(p.GetMaxBadRecords()),\n\t\tAutodetect: dcl.Bool(p.GetAutodetect()),\n\t\tIgnoreUnknownValues: dcl.Bool(p.GetIgnoreUnknownValues()),\n\t\tCompression: dcl.StringOrNil(p.GetCompression()),\n\t\tCsvOptions: ProtoToBigqueryAlphaTableExternalDataConfigurationCsvOptions(p.GetCsvOptions()),\n\t\tBigtableOptions: ProtoToBigqueryAlphaTableExternalDataConfigurationBigtableOptions(p.GetBigtableOptions()),\n\t\tGoogleSheetsOptions: ProtoToBigqueryAlphaTableExternalDataConfigurationGoogleSheetsOptions(p.GetGoogleSheetsOptions()),\n\t\tHivePartitioningOptions: ProtoToBigqueryAlphaTableExternalDataConfigurationHivePartitioningOptions(p.GetHivePartitioningOptions()),\n\t\tConnectionId: dcl.StringOrNil(p.GetConnectionId()),\n\t\tValueConversionModes: ProtoToBigqueryAlphaTableExternalDataConfigurationValueConversionModes(p.GetValueConversionModes()),\n\t\tAvroOptions: ProtoToBigqueryAlphaTableExternalDataConfigurationAvroOptions(p.GetAvroOptions()),\n\t\tJsonExtension: ProtoToBigqueryAlphaTableExternalDataConfigurationJsonExtensionEnum(p.GetJsonExtension()),\n\t\tParquetOptions: ProtoToBigqueryAlphaTableExternalDataConfigurationParquetOptions(p.GetParquetOptions()),\n\t}\n\tfor _, r := range p.GetSourceUris() {\n\t\tobj.SourceUris = append(obj.SourceUris, r)\n\t}\n\tfor _, r := range p.GetMaxBadRecordsAlternative() {\n\t\tobj.MaxBadRecordsAlternative = append(obj.MaxBadRecordsAlternative, r)\n\t}\n\tfor _, r := range p.GetDecimalTargetTypes() {\n\t\tobj.DecimalTargetTypes = append(obj.DecimalTargetTypes, *ProtoToBigqueryAlphaTableExternalDataConfigurationDecimalTargetTypesEnum(r))\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "3a58f22108f9c14fbae9ee1198d0797a", "score": "0.59607244", "text": "func BigqueryAlphaTableExternalDataConfigurationSchemaToProto(o *alpha.TableExternalDataConfigurationSchema) *alphapb.BigqueryAlphaTableExternalDataConfigurationSchema {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &alphapb.BigqueryAlphaTableExternalDataConfigurationSchema{}\n\tsFields := make([]*alphapb.BigqueryAlphaTableGooglecloudbigqueryv2Tablefieldschema, len(o.Fields))\n\tfor i, r := range o.Fields {\n\t\tsFields[i] = BigqueryAlphaTableGooglecloudbigqueryv2TablefieldschemaToProto(&r)\n\t}\n\tp.SetFields(sFields)\n\treturn p\n}", "title": "" }, { "docid": "c95e25bd140919d5e70c92c7d4aec2dd", "score": "0.59592736", "text": "func ComputeAlphaInstanceStatusEnumToProto(e *alpha.InstanceStatusEnum) alphapb.ComputeAlphaInstanceStatusEnum {\n\tif e == nil {\n\t\treturn alphapb.ComputeAlphaInstanceStatusEnum(0)\n\t}\n\tif v, ok := alphapb.ComputeAlphaInstanceStatusEnum_value[\"InstanceStatusEnum\"+string(*e)]; ok {\n\t\treturn alphapb.ComputeAlphaInstanceStatusEnum(v)\n\t}\n\treturn alphapb.ComputeAlphaInstanceStatusEnum(0)\n}", "title": "" }, { "docid": "c7793370eb44b00c1a5fb7f86a72a256", "score": "0.5899641", "text": "func BigqueryAlphaTableExternalDataConfigurationToProto(o *alpha.TableExternalDataConfiguration) *alphapb.BigqueryAlphaTableExternalDataConfiguration {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &alphapb.BigqueryAlphaTableExternalDataConfiguration{}\n\tp.SetSchema(BigqueryAlphaTableExternalDataConfigurationSchemaToProto(o.Schema))\n\tp.SetSourceFormat(dcl.ValueOrEmptyString(o.SourceFormat))\n\tp.SetMaxBadRecords(dcl.ValueOrEmptyInt64(o.MaxBadRecords))\n\tp.SetAutodetect(dcl.ValueOrEmptyBool(o.Autodetect))\n\tp.SetIgnoreUnknownValues(dcl.ValueOrEmptyBool(o.IgnoreUnknownValues))\n\tp.SetCompression(dcl.ValueOrEmptyString(o.Compression))\n\tp.SetCsvOptions(BigqueryAlphaTableExternalDataConfigurationCsvOptionsToProto(o.CsvOptions))\n\tp.SetBigtableOptions(BigqueryAlphaTableExternalDataConfigurationBigtableOptionsToProto(o.BigtableOptions))\n\tp.SetGoogleSheetsOptions(BigqueryAlphaTableExternalDataConfigurationGoogleSheetsOptionsToProto(o.GoogleSheetsOptions))\n\tp.SetHivePartitioningOptions(BigqueryAlphaTableExternalDataConfigurationHivePartitioningOptionsToProto(o.HivePartitioningOptions))\n\tp.SetConnectionId(dcl.ValueOrEmptyString(o.ConnectionId))\n\tp.SetValueConversionModes(BigqueryAlphaTableExternalDataConfigurationValueConversionModesToProto(o.ValueConversionModes))\n\tp.SetAvroOptions(BigqueryAlphaTableExternalDataConfigurationAvroOptionsToProto(o.AvroOptions))\n\tp.SetJsonExtension(BigqueryAlphaTableExternalDataConfigurationJsonExtensionEnumToProto(o.JsonExtension))\n\tp.SetParquetOptions(BigqueryAlphaTableExternalDataConfigurationParquetOptionsToProto(o.ParquetOptions))\n\tsSourceUris := make([]string, len(o.SourceUris))\n\tfor i, r := range o.SourceUris {\n\t\tsSourceUris[i] = r\n\t}\n\tp.SetSourceUris(sSourceUris)\n\tsMaxBadRecordsAlternative := make([]int64, len(o.MaxBadRecordsAlternative))\n\tfor i, r := range o.MaxBadRecordsAlternative {\n\t\tsMaxBadRecordsAlternative[i] = r\n\t}\n\tp.SetMaxBadRecordsAlternative(sMaxBadRecordsAlternative)\n\tsDecimalTargetTypes := make([]alphapb.BigqueryAlphaTableExternalDataConfigurationDecimalTargetTypesEnum, len(o.DecimalTargetTypes))\n\tfor i, r := range o.DecimalTargetTypes {\n\t\tsDecimalTargetTypes[i] = alphapb.BigqueryAlphaTableExternalDataConfigurationDecimalTargetTypesEnum(alphapb.BigqueryAlphaTableExternalDataConfigurationDecimalTargetTypesEnum_value[string(r)])\n\t}\n\tp.SetDecimalTargetTypes(sDecimalTargetTypes)\n\treturn p\n}", "title": "" }, { "docid": "0db15a8443c33749242e242b083e79f0", "score": "0.58897173", "text": "func DataplexBetaZoneStateEnumToProto(e *beta.ZoneStateEnum) betapb.DataplexBetaZoneStateEnum {\n\tif e == nil {\n\t\treturn betapb.DataplexBetaZoneStateEnum(0)\n\t}\n\tif v, ok := betapb.DataplexBetaZoneStateEnum_value[\"ZoneStateEnum\"+string(*e)]; ok {\n\t\treturn betapb.DataplexBetaZoneStateEnum(v)\n\t}\n\treturn betapb.DataplexBetaZoneStateEnum(0)\n}", "title": "" }, { "docid": "109dbbfd73178c522fdfcae1418a24ab", "score": "0.58810306", "text": "func ApigeeEnvironmentStateEnumToProto(e *apigee.EnvironmentStateEnum) apigeepb.ApigeeEnvironmentStateEnum {\n\tif e == nil {\n\t\treturn apigeepb.ApigeeEnvironmentStateEnum(0)\n\t}\n\tif v, ok := apigeepb.ApigeeEnvironmentStateEnum_value[\"EnvironmentStateEnum\"+string(*e)]; ok {\n\t\treturn apigeepb.ApigeeEnvironmentStateEnum(v)\n\t}\n\treturn apigeepb.ApigeeEnvironmentStateEnum(0)\n}", "title": "" }, { "docid": "e528bb919bebe84b5b71d90953335f49", "score": "0.5844767", "text": "func DataplexAssetResourceSpecTypeEnumToProto(e *dataplex.AssetResourceSpecTypeEnum) dataplexpb.DataplexAssetResourceSpecTypeEnum {\n\tif e == nil {\n\t\treturn dataplexpb.DataplexAssetResourceSpecTypeEnum(0)\n\t}\n\tif v, ok := dataplexpb.DataplexAssetResourceSpecTypeEnum_value[\"AssetResourceSpecTypeEnum\"+string(*e)]; ok {\n\t\treturn dataplexpb.DataplexAssetResourceSpecTypeEnum(v)\n\t}\n\treturn dataplexpb.DataplexAssetResourceSpecTypeEnum(0)\n}", "title": "" }, { "docid": "c15e9846d608d4fea1b911d8bb5eb2f9", "score": "0.5843206", "text": "func VpcaccessAlphaConnectorStateEnumToProto(e *alpha.ConnectorStateEnum) alphapb.VpcaccessAlphaConnectorStateEnum {\n\tif e == nil {\n\t\treturn alphapb.VpcaccessAlphaConnectorStateEnum(0)\n\t}\n\tif v, ok := alphapb.VpcaccessAlphaConnectorStateEnum_value[\"ConnectorStateEnum\"+string(*e)]; ok {\n\t\treturn alphapb.VpcaccessAlphaConnectorStateEnum(v)\n\t}\n\treturn alphapb.VpcaccessAlphaConnectorStateEnum(0)\n}", "title": "" }, { "docid": "535b1d2b02716fc793d1e7355efe30df", "score": "0.5813149", "text": "func ProtoToBigqueryAlphaTableExternalDataConfigurationAvroOptions(p *alphapb.BigqueryAlphaTableExternalDataConfigurationAvroOptions) *alpha.TableExternalDataConfigurationAvroOptions {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &alpha.TableExternalDataConfigurationAvroOptions{\n\t\tUseAvroLogicalTypes: dcl.Bool(p.GetUseAvroLogicalTypes()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "6969eaa2f5d1eb4f2ac3fda44829b4a5", "score": "0.58024204", "text": "func DatafusionAlphaInstanceTypeEnumToProto(e *alpha.InstanceTypeEnum) alphapb.DatafusionAlphaInstanceTypeEnum {\n\tif e == nil {\n\t\treturn alphapb.DatafusionAlphaInstanceTypeEnum(0)\n\t}\n\tif v, ok := alphapb.DatafusionAlphaInstanceTypeEnum_value[\"InstanceTypeEnum\"+string(*e)]; ok {\n\t\treturn alphapb.DatafusionAlphaInstanceTypeEnum(v)\n\t}\n\treturn alphapb.DatafusionAlphaInstanceTypeEnum(0)\n}", "title": "" }, { "docid": "ad05a71ae8b410f8b208304f12da864d", "score": "0.5759675", "text": "func ComposerEnvironmentStateEnumToProto(e *composer.EnvironmentStateEnum) composerpb.ComposerEnvironmentStateEnum {\n\tif e == nil {\n\t\treturn composerpb.ComposerEnvironmentStateEnum(0)\n\t}\n\tif v, ok := composerpb.ComposerEnvironmentStateEnum_value[\"EnvironmentStateEnum\"+string(*e)]; ok {\n\t\treturn composerpb.ComposerEnvironmentStateEnum(v)\n\t}\n\treturn composerpb.ComposerEnvironmentStateEnum(0)\n}", "title": "" }, { "docid": "1d3596f10b59d3e4bf9b06e86244143f", "score": "0.5745379", "text": "func (x *ExtEnum) UnmarshalJSON(b []byte) error {\n\tnum, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = ExtEnum(num)\n\treturn nil\n}", "title": "" }, { "docid": "501a92613d22a46bef06d096f0ad9997", "score": "0.5743963", "text": "func BigqueryAlphaTableExternalDataConfigurationBigtableOptionsToProto(o *alpha.TableExternalDataConfigurationBigtableOptions) *alphapb.BigqueryAlphaTableExternalDataConfigurationBigtableOptions {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &alphapb.BigqueryAlphaTableExternalDataConfigurationBigtableOptions{}\n\tp.SetIgnoreUnspecifiedColumnFamilies(dcl.ValueOrEmptyBool(o.IgnoreUnspecifiedColumnFamilies))\n\tp.SetReadRowkeyAsString(dcl.ValueOrEmptyBool(o.ReadRowkeyAsString))\n\tsColumnFamilies := make([]*alphapb.BigqueryAlphaTableExternalDataConfigurationBigtableOptionsColumnFamilies, len(o.ColumnFamilies))\n\tfor i, r := range o.ColumnFamilies {\n\t\tsColumnFamilies[i] = BigqueryAlphaTableExternalDataConfigurationBigtableOptionsColumnFamiliesToProto(&r)\n\t}\n\tp.SetColumnFamilies(sColumnFamilies)\n\treturn p\n}", "title": "" }, { "docid": "ecd0c6e4f605cc53f4f0855d05f2b8d4", "score": "0.56884813", "text": "func ProtoToBigqueryAlphaTableExternalDataConfigurationSchema(p *alphapb.BigqueryAlphaTableExternalDataConfigurationSchema) *alpha.TableExternalDataConfigurationSchema {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &alpha.TableExternalDataConfigurationSchema{}\n\tfor _, r := range p.GetFields() {\n\t\tobj.Fields = append(obj.Fields, *ProtoToBigqueryAlphaTableGooglecloudbigqueryv2Tablefieldschema(r))\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "3cd4c2ee25472a173b776b2f3c383195", "score": "0.5678241", "text": "func DataplexBetaZoneResourceSpecLocationTypeEnumToProto(e *beta.ZoneResourceSpecLocationTypeEnum) betapb.DataplexBetaZoneResourceSpecLocationTypeEnum {\n\tif e == nil {\n\t\treturn betapb.DataplexBetaZoneResourceSpecLocationTypeEnum(0)\n\t}\n\tif v, ok := betapb.DataplexBetaZoneResourceSpecLocationTypeEnum_value[\"ZoneResourceSpecLocationTypeEnum\"+string(*e)]; ok {\n\t\treturn betapb.DataplexBetaZoneResourceSpecLocationTypeEnum(v)\n\t}\n\treturn betapb.DataplexBetaZoneResourceSpecLocationTypeEnum(0)\n}", "title": "" }, { "docid": "7420615db8c860d8a44de98941d65a80", "score": "0.5668478", "text": "func BigqueryAlphaTableExternalDataConfigurationCsvOptionsToProto(o *alpha.TableExternalDataConfigurationCsvOptions) *alphapb.BigqueryAlphaTableExternalDataConfigurationCsvOptions {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &alphapb.BigqueryAlphaTableExternalDataConfigurationCsvOptions{}\n\tp.SetFieldDelimiter(dcl.ValueOrEmptyString(o.FieldDelimiter))\n\tp.SetSkipLeadingRows(dcl.ValueOrEmptyString(o.SkipLeadingRows))\n\tp.SetQuote(dcl.ValueOrEmptyString(o.Quote))\n\tp.SetAllowQuotedNewlines(dcl.ValueOrEmptyBool(o.AllowQuotedNewlines))\n\tp.SetAllowJaggedRows(dcl.ValueOrEmptyBool(o.AllowJaggedRows))\n\tp.SetEncoding(dcl.ValueOrEmptyString(o.Encoding))\n\treturn p\n}", "title": "" }, { "docid": "4137a3d3e3333c9acf8070c364fdf26c", "score": "0.56681037", "text": "func ComputeAlphaServiceAttachmentConnectionPreferenceEnumToProto(e *alpha.ServiceAttachmentConnectionPreferenceEnum) alphapb.ComputeAlphaServiceAttachmentConnectionPreferenceEnum {\n\tif e == nil {\n\t\treturn alphapb.ComputeAlphaServiceAttachmentConnectionPreferenceEnum(0)\n\t}\n\tif v, ok := alphapb.ComputeAlphaServiceAttachmentConnectionPreferenceEnum_value[\"ServiceAttachmentConnectionPreferenceEnum\"+string(*e)]; ok {\n\t\treturn alphapb.ComputeAlphaServiceAttachmentConnectionPreferenceEnum(v)\n\t}\n\treturn alphapb.ComputeAlphaServiceAttachmentConnectionPreferenceEnum(0)\n}", "title": "" }, { "docid": "f92416b8ab0fe24253a56add5812789f", "score": "0.5661654", "text": "func ProtoToBigqueryAlphaTableExternalDataConfigurationCsvOptions(p *alphapb.BigqueryAlphaTableExternalDataConfigurationCsvOptions) *alpha.TableExternalDataConfigurationCsvOptions {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &alpha.TableExternalDataConfigurationCsvOptions{\n\t\tFieldDelimiter: dcl.StringOrNil(p.GetFieldDelimiter()),\n\t\tSkipLeadingRows: dcl.StringOrNil(p.GetSkipLeadingRows()),\n\t\tQuote: dcl.StringOrNil(p.GetQuote()),\n\t\tAllowQuotedNewlines: dcl.Bool(p.GetAllowQuotedNewlines()),\n\t\tAllowJaggedRows: dcl.Bool(p.GetAllowJaggedRows()),\n\t\tEncoding: dcl.StringOrNil(p.GetEncoding()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "bd2ef5f5040e23551b346dee0aaa3622", "score": "0.565815", "text": "func VertexaiAlphaModelSupportedDeploymentResourcesTypesEnumToProto(e *alpha.ModelSupportedDeploymentResourcesTypesEnum) alphapb.VertexaiAlphaModelSupportedDeploymentResourcesTypesEnum {\n\tif e == nil {\n\t\treturn alphapb.VertexaiAlphaModelSupportedDeploymentResourcesTypesEnum(0)\n\t}\n\tif v, ok := alphapb.VertexaiAlphaModelSupportedDeploymentResourcesTypesEnum_value[\"ModelSupportedDeploymentResourcesTypesEnum\"+string(*e)]; ok {\n\t\treturn alphapb.VertexaiAlphaModelSupportedDeploymentResourcesTypesEnum(v)\n\t}\n\treturn alphapb.VertexaiAlphaModelSupportedDeploymentResourcesTypesEnum(0)\n}", "title": "" }, { "docid": "9ea4a5fdbba2448079c3c639afe7fdc7", "score": "0.56514126", "text": "func GkehubAlphaFeatureResourceStateStateEnumToProto(e *alpha.FeatureResourceStateStateEnum) alphapb.GkehubAlphaFeatureResourceStateStateEnum {\n\tif e == nil {\n\t\treturn alphapb.GkehubAlphaFeatureResourceStateStateEnum(0)\n\t}\n\tif v, ok := alphapb.GkehubAlphaFeatureResourceStateStateEnum_value[\"FeatureResourceStateStateEnum\"+string(*e)]; ok {\n\t\treturn alphapb.GkehubAlphaFeatureResourceStateStateEnum(v)\n\t}\n\treturn alphapb.GkehubAlphaFeatureResourceStateStateEnum(0)\n}", "title": "" }, { "docid": "93e185a34381631267102fafb098b821", "score": "0.5632495", "text": "func MonitoringBetaServiceLevelObjectiveCalendarPeriodEnumToProto(e *beta.ServiceLevelObjectiveCalendarPeriodEnum) betapb.MonitoringBetaServiceLevelObjectiveCalendarPeriodEnum {\n\tif e == nil {\n\t\treturn betapb.MonitoringBetaServiceLevelObjectiveCalendarPeriodEnum(0)\n\t}\n\tif v, ok := betapb.MonitoringBetaServiceLevelObjectiveCalendarPeriodEnum_value[\"ServiceLevelObjectiveCalendarPeriodEnum\"+string(*e)]; ok {\n\t\treturn betapb.MonitoringBetaServiceLevelObjectiveCalendarPeriodEnum(v)\n\t}\n\treturn betapb.MonitoringBetaServiceLevelObjectiveCalendarPeriodEnum(0)\n}", "title": "" }, { "docid": "00ecda301ea7e4168b428ada8383c855", "score": "0.56055236", "text": "func BigqueryAlphaRoutineLanguageEnumToProto(e *alpha.RoutineLanguageEnum) alphapb.BigqueryAlphaRoutineLanguageEnum {\n\tif e == nil {\n\t\treturn alphapb.BigqueryAlphaRoutineLanguageEnum(0)\n\t}\n\tif v, ok := alphapb.BigqueryAlphaRoutineLanguageEnum_value[\"RoutineLanguageEnum\"+string(*e)]; ok {\n\t\treturn alphapb.BigqueryAlphaRoutineLanguageEnum(v)\n\t}\n\treturn alphapb.BigqueryAlphaRoutineLanguageEnum(0)\n}", "title": "" }, { "docid": "939f7124d32bc9e85ec22a97f06e6742", "score": "0.5587149", "text": "func GkehubAlphaFeatureStateStateCodeEnumToProto(e *alpha.FeatureStateStateCodeEnum) alphapb.GkehubAlphaFeatureStateStateCodeEnum {\n\tif e == nil {\n\t\treturn alphapb.GkehubAlphaFeatureStateStateCodeEnum(0)\n\t}\n\tif v, ok := alphapb.GkehubAlphaFeatureStateStateCodeEnum_value[\"FeatureStateStateCodeEnum\"+string(*e)]; ok {\n\t\treturn alphapb.GkehubAlphaFeatureStateStateCodeEnum(v)\n\t}\n\treturn alphapb.GkehubAlphaFeatureStateStateCodeEnum(0)\n}", "title": "" }, { "docid": "078738a9a84e8920647a666018c64862", "score": "0.5544765", "text": "func ProtoToBigqueryAlphaTableExternalDataConfigurationBigtableOptions(p *alphapb.BigqueryAlphaTableExternalDataConfigurationBigtableOptions) *alpha.TableExternalDataConfigurationBigtableOptions {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &alpha.TableExternalDataConfigurationBigtableOptions{\n\t\tIgnoreUnspecifiedColumnFamilies: dcl.Bool(p.GetIgnoreUnspecifiedColumnFamilies()),\n\t\tReadRowkeyAsString: dcl.Bool(p.GetReadRowkeyAsString()),\n\t}\n\tfor _, r := range p.GetColumnFamilies() {\n\t\tobj.ColumnFamilies = append(obj.ColumnFamilies, *ProtoToBigqueryAlphaTableExternalDataConfigurationBigtableOptionsColumnFamilies(r))\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "5a02e4c0cdb9bd8a5388ee263ca049ee", "score": "0.5541767", "text": "func DataplexBetaZoneTypeEnumToProto(e *beta.ZoneTypeEnum) betapb.DataplexBetaZoneTypeEnum {\n\tif e == nil {\n\t\treturn betapb.DataplexBetaZoneTypeEnum(0)\n\t}\n\tif v, ok := betapb.DataplexBetaZoneTypeEnum_value[\"ZoneTypeEnum\"+string(*e)]; ok {\n\t\treturn betapb.DataplexBetaZoneTypeEnum(v)\n\t}\n\treturn betapb.DataplexBetaZoneTypeEnum(0)\n}", "title": "" }, { "docid": "9e1b2486d5a7ef7771acf4fc8aa5eb56", "score": "0.5517606", "text": "func ComputeAlphaInstanceNetworkInterfacesAccessConfigsTypeEnumToProto(e *alpha.InstanceNetworkInterfacesAccessConfigsTypeEnum) alphapb.ComputeAlphaInstanceNetworkInterfacesAccessConfigsTypeEnum {\n\tif e == nil {\n\t\treturn alphapb.ComputeAlphaInstanceNetworkInterfacesAccessConfigsTypeEnum(0)\n\t}\n\tif v, ok := alphapb.ComputeAlphaInstanceNetworkInterfacesAccessConfigsTypeEnum_value[\"InstanceNetworkInterfacesAccessConfigsTypeEnum\"+string(*e)]; ok {\n\t\treturn alphapb.ComputeAlphaInstanceNetworkInterfacesAccessConfigsTypeEnum(v)\n\t}\n\treturn alphapb.ComputeAlphaInstanceNetworkInterfacesAccessConfigsTypeEnum(0)\n}", "title": "" }, { "docid": "532aa8fc8cce7992d0a1287c4ea7bab5", "score": "0.5511614", "text": "func ComputeAlphaServiceAttachmentConnectedEndpointsStatusEnumToProto(e *alpha.ServiceAttachmentConnectedEndpointsStatusEnum) alphapb.ComputeAlphaServiceAttachmentConnectedEndpointsStatusEnum {\n\tif e == nil {\n\t\treturn alphapb.ComputeAlphaServiceAttachmentConnectedEndpointsStatusEnum(0)\n\t}\n\tif v, ok := alphapb.ComputeAlphaServiceAttachmentConnectedEndpointsStatusEnum_value[\"ServiceAttachmentConnectedEndpointsStatusEnum\"+string(*e)]; ok {\n\t\treturn alphapb.ComputeAlphaServiceAttachmentConnectedEndpointsStatusEnum(v)\n\t}\n\treturn alphapb.ComputeAlphaServiceAttachmentConnectedEndpointsStatusEnum(0)\n}", "title": "" }, { "docid": "66215e2705b6831ecc7f3179695a7dfa", "score": "0.55059934", "text": "func PrivatecaCertificateConfigPublicKeyFormatEnumToProto(e *privateca.CertificateConfigPublicKeyFormatEnum) privatecapb.PrivatecaCertificateConfigPublicKeyFormatEnum {\n\tif e == nil {\n\t\treturn privatecapb.PrivatecaCertificateConfigPublicKeyFormatEnum(0)\n\t}\n\tif v, ok := privatecapb.PrivatecaCertificateConfigPublicKeyFormatEnum_value[\"CertificateConfigPublicKeyFormatEnum\"+string(*e)]; ok {\n\t\treturn privatecapb.PrivatecaCertificateConfigPublicKeyFormatEnum(v)\n\t}\n\treturn privatecapb.PrivatecaCertificateConfigPublicKeyFormatEnum(0)\n}", "title": "" }, { "docid": "9f8a08500caafd26c7ead10ead929753", "score": "0.549488", "text": "func ProtoToDataplexAssetDiscoveryStatusStateEnum(e dataplexpb.DataplexAssetDiscoveryStatusStateEnum) *dataplex.AssetDiscoveryStatusStateEnum {\n\tif e == 0 {\n\t\treturn nil\n\t}\n\tif n, ok := dataplexpb.DataplexAssetDiscoveryStatusStateEnum_name[int32(e)]; ok {\n\t\te := dataplex.AssetDiscoveryStatusStateEnum(n[len(\"DataplexAssetDiscoveryStatusStateEnum\"):])\n\t\treturn &e\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "56a3fd5c716137addf205653bfbb761f", "score": "0.5473177", "text": "func RedisInstanceTierEnumToProto(e *redis.InstanceTierEnum) redispb.RedisInstanceTierEnum {\n\tif e == nil {\n\t\treturn redispb.RedisInstanceTierEnum(0)\n\t}\n\tif v, ok := redispb.RedisInstanceTierEnum_value[\"InstanceTierEnum\"+string(*e)]; ok {\n\t\treturn redispb.RedisInstanceTierEnum(v)\n\t}\n\treturn redispb.RedisInstanceTierEnum(0)\n}", "title": "" }, { "docid": "6570d505e4bbcfe0fb3c0ff647eb465d", "score": "0.54641086", "text": "func BigqueryAlphaTableExternalDataConfigurationParquetOptionsToProto(o *alpha.TableExternalDataConfigurationParquetOptions) *alphapb.BigqueryAlphaTableExternalDataConfigurationParquetOptions {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &alphapb.BigqueryAlphaTableExternalDataConfigurationParquetOptions{}\n\tp.SetEnumAsString(dcl.ValueOrEmptyBool(o.EnumAsString))\n\tp.SetEnableListInference(dcl.ValueOrEmptyBool(o.EnableListInference))\n\treturn p\n}", "title": "" }, { "docid": "bc705a1af29ff48d68c71a59f9bd6d79", "score": "0.54553723", "text": "func ProtoToBigqueryAlphaTableExternalDataConfigurationGoogleSheetsOptions(p *alphapb.BigqueryAlphaTableExternalDataConfigurationGoogleSheetsOptions) *alpha.TableExternalDataConfigurationGoogleSheetsOptions {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &alpha.TableExternalDataConfigurationGoogleSheetsOptions{\n\t\tSkipLeadingRows: dcl.StringOrNil(p.GetSkipLeadingRows()),\n\t\tRange: dcl.StringOrNil(p.GetRange()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "9f90d52a38d9e9367c8ded7b80e0d522", "score": "0.545396", "text": "func ProtoToComputeAlphaInstanceStatusEnum(e alphapb.ComputeAlphaInstanceStatusEnum) *alpha.InstanceStatusEnum {\n\tif e == 0 {\n\t\treturn nil\n\t}\n\tif n, ok := alphapb.ComputeAlphaInstanceStatusEnum_name[int32(e)]; ok {\n\t\te := alpha.InstanceStatusEnum(n[len(\"ComputeAlphaInstanceStatusEnum\"):])\n\t\treturn &e\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4bfb4c259077277f8b62b242a6520af8", "score": "0.54520917", "text": "func ComputeAlphaInstanceDisksInterfaceEnumToProto(e *alpha.InstanceDisksInterfaceEnum) alphapb.ComputeAlphaInstanceDisksInterfaceEnum {\n\tif e == nil {\n\t\treturn alphapb.ComputeAlphaInstanceDisksInterfaceEnum(0)\n\t}\n\tif v, ok := alphapb.ComputeAlphaInstanceDisksInterfaceEnum_value[\"InstanceDisksInterfaceEnum\"+string(*e)]; ok {\n\t\treturn alphapb.ComputeAlphaInstanceDisksInterfaceEnum(v)\n\t}\n\treturn alphapb.ComputeAlphaInstanceDisksInterfaceEnum(0)\n}", "title": "" }, { "docid": "38d168ea43db6be629aa968347a8df7a", "score": "0.54419065", "text": "func RedisInstanceTransitEncryptionModeEnumToProto(e *redis.InstanceTransitEncryptionModeEnum) redispb.RedisInstanceTransitEncryptionModeEnum {\n\tif e == nil {\n\t\treturn redispb.RedisInstanceTransitEncryptionModeEnum(0)\n\t}\n\tif v, ok := redispb.RedisInstanceTransitEncryptionModeEnum_value[\"InstanceTransitEncryptionModeEnum\"+string(*e)]; ok {\n\t\treturn redispb.RedisInstanceTransitEncryptionModeEnum(v)\n\t}\n\treturn redispb.RedisInstanceTransitEncryptionModeEnum(0)\n}", "title": "" }, { "docid": "85fd4b11a8d0c5d3dc8966c6eb5d555a", "score": "0.5433548", "text": "func ProtoToDataplexAssetResourceStatusStateEnum(e dataplexpb.DataplexAssetResourceStatusStateEnum) *dataplex.AssetResourceStatusStateEnum {\n\tif e == 0 {\n\t\treturn nil\n\t}\n\tif n, ok := dataplexpb.DataplexAssetResourceStatusStateEnum_name[int32(e)]; ok {\n\t\te := dataplex.AssetResourceStatusStateEnum(n[len(\"DataplexAssetResourceStatusStateEnum\"):])\n\t\treturn &e\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "71b9cdfd82f6e128bd77e2bbd0a1ac0a", "score": "0.5430005", "text": "func ComputeAlphaInstanceDisksModeEnumToProto(e *alpha.InstanceDisksModeEnum) alphapb.ComputeAlphaInstanceDisksModeEnum {\n\tif e == nil {\n\t\treturn alphapb.ComputeAlphaInstanceDisksModeEnum(0)\n\t}\n\tif v, ok := alphapb.ComputeAlphaInstanceDisksModeEnum_value[\"InstanceDisksModeEnum\"+string(*e)]; ok {\n\t\treturn alphapb.ComputeAlphaInstanceDisksModeEnum(v)\n\t}\n\treturn alphapb.ComputeAlphaInstanceDisksModeEnum(0)\n}", "title": "" }, { "docid": "fad44fdd466e799dea0907e67baa078d", "score": "0.5409479", "text": "func ProtoToDataplexAssetStateEnum(e dataplexpb.DataplexAssetStateEnum) *dataplex.AssetStateEnum {\n\tif e == 0 {\n\t\treturn nil\n\t}\n\tif n, ok := dataplexpb.DataplexAssetStateEnum_name[int32(e)]; ok {\n\t\te := dataplex.AssetStateEnum(n[len(\"DataplexAssetStateEnum\"):])\n\t\treturn &e\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f468c5d7695d621e3486df41735b9293", "score": "0.54013145", "text": "func RedisInstanceConnectModeEnumToProto(e *redis.InstanceConnectModeEnum) redispb.RedisInstanceConnectModeEnum {\n\tif e == nil {\n\t\treturn redispb.RedisInstanceConnectModeEnum(0)\n\t}\n\tif v, ok := redispb.RedisInstanceConnectModeEnum_value[\"InstanceConnectModeEnum\"+string(*e)]; ok {\n\t\treturn redispb.RedisInstanceConnectModeEnum(v)\n\t}\n\treturn redispb.RedisInstanceConnectModeEnum(0)\n}", "title": "" }, { "docid": "0da25c09e3cca3a989ca9cf73784fd89", "score": "0.5392674", "text": "func ProtoToBigqueryAlphaTableExternalDataConfigurationParquetOptions(p *alphapb.BigqueryAlphaTableExternalDataConfigurationParquetOptions) *alpha.TableExternalDataConfigurationParquetOptions {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &alpha.TableExternalDataConfigurationParquetOptions{\n\t\tEnumAsString: dcl.Bool(p.GetEnumAsString()),\n\t\tEnableListInference: dcl.Bool(p.GetEnableListInference()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "96784cbf76052a7f18ef35dc729c89eb", "score": "0.53826475", "text": "func ApigeeBetaInstanceStateEnumToProto(e *beta.InstanceStateEnum) betapb.ApigeeBetaInstanceStateEnum {\n\tif e == nil {\n\t\treturn betapb.ApigeeBetaInstanceStateEnum(0)\n\t}\n\tif v, ok := betapb.ApigeeBetaInstanceStateEnum_value[\"InstanceStateEnum\"+string(*e)]; ok {\n\t\treturn betapb.ApigeeBetaInstanceStateEnum(v)\n\t}\n\treturn betapb.ApigeeBetaInstanceStateEnum(0)\n}", "title": "" }, { "docid": "19419eb8c0ad98cbd54e28cb4c78870b", "score": "0.5381452", "text": "func ComputeAlphaInstanceNetworkInterfacesAccessConfigsNetworkTierEnumToProto(e *alpha.InstanceNetworkInterfacesAccessConfigsNetworkTierEnum) alphapb.ComputeAlphaInstanceNetworkInterfacesAccessConfigsNetworkTierEnum {\n\tif e == nil {\n\t\treturn alphapb.ComputeAlphaInstanceNetworkInterfacesAccessConfigsNetworkTierEnum(0)\n\t}\n\tif v, ok := alphapb.ComputeAlphaInstanceNetworkInterfacesAccessConfigsNetworkTierEnum_value[\"InstanceNetworkInterfacesAccessConfigsNetworkTierEnum\"+string(*e)]; ok {\n\t\treturn alphapb.ComputeAlphaInstanceNetworkInterfacesAccessConfigsNetworkTierEnum(v)\n\t}\n\treturn alphapb.ComputeAlphaInstanceNetworkInterfacesAccessConfigsNetworkTierEnum(0)\n}", "title": "" }, { "docid": "261894d6f8704bb578d3ddf1db76f83b", "score": "0.5376581", "text": "func RedisInstanceStateEnumToProto(e *redis.InstanceStateEnum) redispb.RedisInstanceStateEnum {\n\tif e == nil {\n\t\treturn redispb.RedisInstanceStateEnum(0)\n\t}\n\tif v, ok := redispb.RedisInstanceStateEnum_value[\"InstanceStateEnum\"+string(*e)]; ok {\n\t\treturn redispb.RedisInstanceStateEnum(v)\n\t}\n\treturn redispb.RedisInstanceStateEnum(0)\n}", "title": "" }, { "docid": "57cd76ac3b94aa535b9eed4324c1919a", "score": "0.5363912", "text": "func BigqueryAlphaTableExternalDataConfigurationGoogleSheetsOptionsToProto(o *alpha.TableExternalDataConfigurationGoogleSheetsOptions) *alphapb.BigqueryAlphaTableExternalDataConfigurationGoogleSheetsOptions {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &alphapb.BigqueryAlphaTableExternalDataConfigurationGoogleSheetsOptions{}\n\tp.SetSkipLeadingRows(dcl.ValueOrEmptyString(o.SkipLeadingRows))\n\tp.SetRange(dcl.ValueOrEmptyString(o.Range))\n\treturn p\n}", "title": "" }, { "docid": "2b079bc3c6cce0ac5aab3eb7aa7ecd04", "score": "0.53631747", "text": "func RedisInstanceMaintenancePolicyWeeklyMaintenanceWindowDayEnumToProto(e *redis.InstanceMaintenancePolicyWeeklyMaintenanceWindowDayEnum) redispb.RedisInstanceMaintenancePolicyWeeklyMaintenanceWindowDayEnum {\n\tif e == nil {\n\t\treturn redispb.RedisInstanceMaintenancePolicyWeeklyMaintenanceWindowDayEnum(0)\n\t}\n\tif v, ok := redispb.RedisInstanceMaintenancePolicyWeeklyMaintenanceWindowDayEnum_value[\"InstanceMaintenancePolicyWeeklyMaintenanceWindowDayEnum\"+string(*e)]; ok {\n\t\treturn redispb.RedisInstanceMaintenancePolicyWeeklyMaintenanceWindowDayEnum(v)\n\t}\n\treturn redispb.RedisInstanceMaintenancePolicyWeeklyMaintenanceWindowDayEnum(0)\n}", "title": "" }, { "docid": "af8d1120513f59d22bf2db23bd7f3f25", "score": "0.5361482", "text": "func ProtoToMonitoringAlphaNotificationChannelVerificationStatusEnum(e alphapb.MonitoringAlphaNotificationChannelVerificationStatusEnum) *alpha.NotificationChannelVerificationStatusEnum {\n\tif e == 0 {\n\t\treturn nil\n\t}\n\tif n, ok := alphapb.MonitoringAlphaNotificationChannelVerificationStatusEnum_name[int32(e)]; ok {\n\t\te := alpha.NotificationChannelVerificationStatusEnum(n[len(\"MonitoringAlphaNotificationChannelVerificationStatusEnum\"):])\n\t\treturn &e\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3123f5158702c99d8f8146fc487be0f9", "score": "0.5358308", "text": "func BigqueryAlphaRoutineDeterminismLevelEnumToProto(e *alpha.RoutineDeterminismLevelEnum) alphapb.BigqueryAlphaRoutineDeterminismLevelEnum {\n\tif e == nil {\n\t\treturn alphapb.BigqueryAlphaRoutineDeterminismLevelEnum(0)\n\t}\n\tif v, ok := alphapb.BigqueryAlphaRoutineDeterminismLevelEnum_value[\"RoutineDeterminismLevelEnum\"+string(*e)]; ok {\n\t\treturn alphapb.BigqueryAlphaRoutineDeterminismLevelEnum(v)\n\t}\n\treturn alphapb.BigqueryAlphaRoutineDeterminismLevelEnum(0)\n}", "title": "" }, { "docid": "bf52425789635a519f13e6b4316144c5", "score": "0.5352272", "text": "func ContainerazureAlphaNodePoolStateEnumToProto(e *alpha.NodePoolStateEnum) alphapb.ContainerazureAlphaNodePoolStateEnum {\n\tif e == nil {\n\t\treturn alphapb.ContainerazureAlphaNodePoolStateEnum(0)\n\t}\n\tif v, ok := alphapb.ContainerazureAlphaNodePoolStateEnum_value[\"NodePoolStateEnum\"+string(*e)]; ok {\n\t\treturn alphapb.ContainerazureAlphaNodePoolStateEnum(v)\n\t}\n\treturn alphapb.ContainerazureAlphaNodePoolStateEnum(0)\n}", "title": "" }, { "docid": "1c6fb1cf51994f38a78f881c75107204", "score": "0.5343994", "text": "func ProtoToDataplexAssetSecurityStatusStateEnum(e dataplexpb.DataplexAssetSecurityStatusStateEnum) *dataplex.AssetSecurityStatusStateEnum {\n\tif e == 0 {\n\t\treturn nil\n\t}\n\tif n, ok := dataplexpb.DataplexAssetSecurityStatusStateEnum_name[int32(e)]; ok {\n\t\te := dataplex.AssetSecurityStatusStateEnum(n[len(\"DataplexAssetSecurityStatusStateEnum\"):])\n\t\treturn &e\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "39b775050d76fcd3a30c3c85123d63e1", "score": "0.5335428", "text": "func ComputeHealthCheckTypeEnumToProto(e *compute.HealthCheckTypeEnum) computepb.ComputeHealthCheckTypeEnum {\n\tif e == nil {\n\t\treturn computepb.ComputeHealthCheckTypeEnum(0)\n\t}\n\tif v, ok := computepb.ComputeHealthCheckTypeEnum_value[\"HealthCheckTypeEnum\"+string(*e)]; ok {\n\t\treturn computepb.ComputeHealthCheckTypeEnum(v)\n\t}\n\treturn computepb.ComputeHealthCheckTypeEnum(0)\n}", "title": "" }, { "docid": "6673bc2f6df8d3e70fa6122a9ef7444c", "score": "0.5329709", "text": "func DataplexAssetResourceSpecReadAccessModeEnumToProto(e *dataplex.AssetResourceSpecReadAccessModeEnum) dataplexpb.DataplexAssetResourceSpecReadAccessModeEnum {\n\tif e == nil {\n\t\treturn dataplexpb.DataplexAssetResourceSpecReadAccessModeEnum(0)\n\t}\n\tif v, ok := dataplexpb.DataplexAssetResourceSpecReadAccessModeEnum_value[\"AssetResourceSpecReadAccessModeEnum\"+string(*e)]; ok {\n\t\treturn dataplexpb.DataplexAssetResourceSpecReadAccessModeEnum(v)\n\t}\n\treturn dataplexpb.DataplexAssetResourceSpecReadAccessModeEnum(0)\n}", "title": "" }, { "docid": "02b113cf5dcc3aec7878ce52c24fec9f", "score": "0.53093624", "text": "func BigqueryAlphaTableExternalDataConfigurationBigtableOptionsColumnFamiliesToProto(o *alpha.TableExternalDataConfigurationBigtableOptionsColumnFamilies) *alphapb.BigqueryAlphaTableExternalDataConfigurationBigtableOptionsColumnFamilies {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &alphapb.BigqueryAlphaTableExternalDataConfigurationBigtableOptionsColumnFamilies{}\n\tp.SetFamilyId(dcl.ValueOrEmptyString(o.FamilyId))\n\tp.SetType(dcl.ValueOrEmptyString(o.Type))\n\tp.SetEncoding(dcl.ValueOrEmptyString(o.Encoding))\n\tp.SetOnlyReadLatest(dcl.ValueOrEmptyBool(o.OnlyReadLatest))\n\tsColumns := make([]*alphapb.BigqueryAlphaTableExternalDataConfigurationBigtableOptionsColumnFamiliesColumns, len(o.Columns))\n\tfor i, r := range o.Columns {\n\t\tsColumns[i] = BigqueryAlphaTableExternalDataConfigurationBigtableOptionsColumnFamiliesColumnsToProto(&r)\n\t}\n\tp.SetColumns(sColumns)\n\treturn p\n}", "title": "" }, { "docid": "76e3bc24896050f77cf6417fd20f478c", "score": "0.5299129", "text": "func ComputeHealthCheckHttpHealthCheckPortSpecificationEnumToProto(e *compute.HealthCheckHttpHealthCheckPortSpecificationEnum) computepb.ComputeHealthCheckHttpHealthCheckPortSpecificationEnum {\n\tif e == nil {\n\t\treturn computepb.ComputeHealthCheckHttpHealthCheckPortSpecificationEnum(0)\n\t}\n\tif v, ok := computepb.ComputeHealthCheckHttpHealthCheckPortSpecificationEnum_value[\"HealthCheckHttpHealthCheckPortSpecificationEnum\"+string(*e)]; ok {\n\t\treturn computepb.ComputeHealthCheckHttpHealthCheckPortSpecificationEnum(v)\n\t}\n\treturn computepb.ComputeHealthCheckHttpHealthCheckPortSpecificationEnum(0)\n}", "title": "" }, { "docid": "56753d533b15e8d21da5dac3c7eed8c8", "score": "0.5290985", "text": "func ComputeAlphaInstanceNetworkInterfacesIPv6AccessConfigsNetworkTierEnumToProto(e *alpha.InstanceNetworkInterfacesIPv6AccessConfigsNetworkTierEnum) alphapb.ComputeAlphaInstanceNetworkInterfacesIPv6AccessConfigsNetworkTierEnum {\n\tif e == nil {\n\t\treturn alphapb.ComputeAlphaInstanceNetworkInterfacesIPv6AccessConfigsNetworkTierEnum(0)\n\t}\n\tif v, ok := alphapb.ComputeAlphaInstanceNetworkInterfacesIPv6AccessConfigsNetworkTierEnum_value[\"InstanceNetworkInterfacesIPv6AccessConfigsNetworkTierEnum\"+string(*e)]; ok {\n\t\treturn alphapb.ComputeAlphaInstanceNetworkInterfacesIPv6AccessConfigsNetworkTierEnum(v)\n\t}\n\treturn alphapb.ComputeAlphaInstanceNetworkInterfacesIPv6AccessConfigsNetworkTierEnum(0)\n}", "title": "" }, { "docid": "3a67b4ecf938ba58c7cc772523f28267", "score": "0.52879786", "text": "func (x *JoinRequestType) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState) {\n\tv := s.ReadEnum(JoinRequestType_value)\n\tif err := s.Err(); err != nil {\n\t\ts.SetErrorf(\"could not read JoinRequestType enum: %v\", err)\n\t\treturn\n\t}\n\t*x = JoinRequestType(v)\n}", "title": "" }, { "docid": "8b20e6ca8d388e454d827050f241026f", "score": "0.52865624", "text": "func CloudbuildBetaWorkerPoolStateEnumToProto(e *beta.WorkerPoolStateEnum) betapb.CloudbuildBetaWorkerPoolStateEnum {\n\tif e == nil {\n\t\treturn betapb.CloudbuildBetaWorkerPoolStateEnum(0)\n\t}\n\tif v, ok := betapb.CloudbuildBetaWorkerPoolStateEnum_value[\"WorkerPoolStateEnum\"+string(*e)]; ok {\n\t\treturn betapb.CloudbuildBetaWorkerPoolStateEnum(v)\n\t}\n\treturn betapb.CloudbuildBetaWorkerPoolStateEnum(0)\n}", "title": "" }, { "docid": "0e72552ce38b94141fdad61d2d13421c", "score": "0.5278968", "text": "func (x *FieldTestMessage_Enum) UnmarshalJSON(b []byte) error {\n\tnum, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = FieldTestMessage_Enum(num)\n\treturn nil\n}", "title": "" }, { "docid": "a9b5e5b560fd58dca4c73f058372e99c", "score": "0.52748674", "text": "func ApigeeBetaEnvgroupStateEnumToProto(e *beta.EnvgroupStateEnum) betapb.ApigeeBetaEnvgroupStateEnum {\n\tif e == nil {\n\t\treturn betapb.ApigeeBetaEnvgroupStateEnum(0)\n\t}\n\tif v, ok := betapb.ApigeeBetaEnvgroupStateEnum_value[\"EnvgroupStateEnum\"+string(*e)]; ok {\n\t\treturn betapb.ApigeeBetaEnvgroupStateEnum(v)\n\t}\n\treturn betapb.ApigeeBetaEnvgroupStateEnum(0)\n}", "title": "" }, { "docid": "d216782a8a0ef4138df8b0088d30be9f", "score": "0.52644384", "text": "func ComputeAlphaInstanceDisksTypeEnumToProto(e *alpha.InstanceDisksTypeEnum) alphapb.ComputeAlphaInstanceDisksTypeEnum {\n\tif e == nil {\n\t\treturn alphapb.ComputeAlphaInstanceDisksTypeEnum(0)\n\t}\n\tif v, ok := alphapb.ComputeAlphaInstanceDisksTypeEnum_value[\"InstanceDisksTypeEnum\"+string(*e)]; ok {\n\t\treturn alphapb.ComputeAlphaInstanceDisksTypeEnum(v)\n\t}\n\treturn alphapb.ComputeAlphaInstanceDisksTypeEnum(0)\n}", "title": "" }, { "docid": "55d1af34f3c7180d675cc159bf959c9c", "score": "0.5261526", "text": "func ComputeHealthCheckHttpHealthCheckProxyHeaderEnumToProto(e *compute.HealthCheckHttpHealthCheckProxyHeaderEnum) computepb.ComputeHealthCheckHttpHealthCheckProxyHeaderEnum {\n\tif e == nil {\n\t\treturn computepb.ComputeHealthCheckHttpHealthCheckProxyHeaderEnum(0)\n\t}\n\tif v, ok := computepb.ComputeHealthCheckHttpHealthCheckProxyHeaderEnum_value[\"HealthCheckHttpHealthCheckProxyHeaderEnum\"+string(*e)]; ok {\n\t\treturn computepb.ComputeHealthCheckHttpHealthCheckProxyHeaderEnum(v)\n\t}\n\treturn computepb.ComputeHealthCheckHttpHealthCheckProxyHeaderEnum(0)\n}", "title": "" }, { "docid": "5e7d9b632d0736dbbdd771a1399fcb4b", "score": "0.5261167", "text": "func ProtoToApigeeEnvironmentStateEnum(e apigeepb.ApigeeEnvironmentStateEnum) *apigee.EnvironmentStateEnum {\n\tif e == 0 {\n\t\treturn nil\n\t}\n\tif n, ok := apigeepb.ApigeeEnvironmentStateEnum_name[int32(e)]; ok {\n\t\te := apigee.EnvironmentStateEnum(n[len(\"ApigeeEnvironmentStateEnum\"):])\n\t\treturn &e\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f397316eee5a162c3e6d175167b1bcaf", "score": "0.52547723", "text": "func ProtoToDatafusionAlphaInstanceStateEnum(e alphapb.DatafusionAlphaInstanceStateEnum) *alpha.InstanceStateEnum {\n\tif e == 0 {\n\t\treturn nil\n\t}\n\tif n, ok := alphapb.DatafusionAlphaInstanceStateEnum_name[int32(e)]; ok {\n\t\te := alpha.InstanceStateEnum(n[len(\"DatafusionAlphaInstanceStateEnum\"):])\n\t\treturn &e\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e02032467809c0a5e8eb44cad7bc65fc", "score": "0.5242722", "text": "func PrivatecaCertificateCertificateDescriptionPublicKeyFormatEnumToProto(e *privateca.CertificateCertificateDescriptionPublicKeyFormatEnum) privatecapb.PrivatecaCertificateCertificateDescriptionPublicKeyFormatEnum {\n\tif e == nil {\n\t\treturn privatecapb.PrivatecaCertificateCertificateDescriptionPublicKeyFormatEnum(0)\n\t}\n\tif v, ok := privatecapb.PrivatecaCertificateCertificateDescriptionPublicKeyFormatEnum_value[\"CertificateCertificateDescriptionPublicKeyFormatEnum\"+string(*e)]; ok {\n\t\treturn privatecapb.PrivatecaCertificateCertificateDescriptionPublicKeyFormatEnum(v)\n\t}\n\treturn privatecapb.PrivatecaCertificateCertificateDescriptionPublicKeyFormatEnum(0)\n}", "title": "" }, { "docid": "1f3a8f9522ea73f839158fd6143e1bc3", "score": "0.52218103", "text": "func ComputeHealthCheckSslHealthCheckPortSpecificationEnumToProto(e *compute.HealthCheckSslHealthCheckPortSpecificationEnum) computepb.ComputeHealthCheckSslHealthCheckPortSpecificationEnum {\n\tif e == nil {\n\t\treturn computepb.ComputeHealthCheckSslHealthCheckPortSpecificationEnum(0)\n\t}\n\tif v, ok := computepb.ComputeHealthCheckSslHealthCheckPortSpecificationEnum_value[\"HealthCheckSslHealthCheckPortSpecificationEnum\"+string(*e)]; ok {\n\t\treturn computepb.ComputeHealthCheckSslHealthCheckPortSpecificationEnum(v)\n\t}\n\treturn computepb.ComputeHealthCheckSslHealthCheckPortSpecificationEnum(0)\n}", "title": "" }, { "docid": "a88825c3f01714c00a33baef89fa5c1b", "score": "0.52163196", "text": "func ComputeVpnTunnelStatusEnumToProto(e *compute.VpnTunnelStatusEnum) computepb.ComputeVpnTunnelStatusEnum {\n\tif e == nil {\n\t\treturn computepb.ComputeVpnTunnelStatusEnum(0)\n\t}\n\tif v, ok := computepb.ComputeVpnTunnelStatusEnum_value[\"VpnTunnelStatusEnum\"+string(*e)]; ok {\n\t\treturn computepb.ComputeVpnTunnelStatusEnum(v)\n\t}\n\treturn computepb.ComputeVpnTunnelStatusEnum(0)\n}", "title": "" }, { "docid": "2f8c06bbe5708c71b506ec3a923c85e7", "score": "0.52029246", "text": "func ComputeHealthCheckSslHealthCheckProxyHeaderEnumToProto(e *compute.HealthCheckSslHealthCheckProxyHeaderEnum) computepb.ComputeHealthCheckSslHealthCheckProxyHeaderEnum {\n\tif e == nil {\n\t\treturn computepb.ComputeHealthCheckSslHealthCheckProxyHeaderEnum(0)\n\t}\n\tif v, ok := computepb.ComputeHealthCheckSslHealthCheckProxyHeaderEnum_value[\"HealthCheckSslHealthCheckProxyHeaderEnum\"+string(*e)]; ok {\n\t\treturn computepb.ComputeHealthCheckSslHealthCheckProxyHeaderEnum(v)\n\t}\n\treturn computepb.ComputeHealthCheckSslHealthCheckProxyHeaderEnum(0)\n}", "title": "" }, { "docid": "b0b172a0fc7e21af76d016e640598b53", "score": "0.519055", "text": "func ApigeeBetaInstancePeeringCidrRangeEnumToProto(e *beta.InstancePeeringCidrRangeEnum) betapb.ApigeeBetaInstancePeeringCidrRangeEnum {\n\tif e == nil {\n\t\treturn betapb.ApigeeBetaInstancePeeringCidrRangeEnum(0)\n\t}\n\tif v, ok := betapb.ApigeeBetaInstancePeeringCidrRangeEnum_value[\"InstancePeeringCidrRangeEnum\"+string(*e)]; ok {\n\t\treturn betapb.ApigeeBetaInstancePeeringCidrRangeEnum(v)\n\t}\n\treturn betapb.ApigeeBetaInstancePeeringCidrRangeEnum(0)\n}", "title": "" }, { "docid": "a0e3c8ec48440511d2629eb5cd75c2fd", "score": "0.5181174", "text": "func (e *Enum) AsProto() *pb.IntegerEnumeration {\n\tvalues := make([]*pb.Expression, len(e.Values))\n\tfor i, v := range e.Values {\n\t\tvalues[i] = v.AsProto()\n\t}\n\treturn &pb.IntegerEnumeration{\n\t\tValues: values,\n\t}\n}", "title": "" }, { "docid": "eaad0e5da489fe22c4795de0c917ce01", "score": "0.51750726", "text": "func ProtoToVertexaiAlphaModelSupportedDeploymentResourcesTypesEnum(e alphapb.VertexaiAlphaModelSupportedDeploymentResourcesTypesEnum) *alpha.ModelSupportedDeploymentResourcesTypesEnum {\n\tif e == 0 {\n\t\treturn nil\n\t}\n\tif n, ok := alphapb.VertexaiAlphaModelSupportedDeploymentResourcesTypesEnum_name[int32(e)]; ok {\n\t\te := alpha.ModelSupportedDeploymentResourcesTypesEnum(n[len(\"VertexaiAlphaModelSupportedDeploymentResourcesTypesEnum\"):])\n\t\treturn &e\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "07eac8483a5213cfa0a80d143ecede58", "score": "0.51729786", "text": "func BigqueryAlphaRoutineArgumentsArgumentKindEnumToProto(e *alpha.RoutineArgumentsArgumentKindEnum) alphapb.BigqueryAlphaRoutineArgumentsArgumentKindEnum {\n\tif e == nil {\n\t\treturn alphapb.BigqueryAlphaRoutineArgumentsArgumentKindEnum(0)\n\t}\n\tif v, ok := alphapb.BigqueryAlphaRoutineArgumentsArgumentKindEnum_value[\"RoutineArgumentsArgumentKindEnum\"+string(*e)]; ok {\n\t\treturn alphapb.BigqueryAlphaRoutineArgumentsArgumentKindEnum(v)\n\t}\n\treturn alphapb.BigqueryAlphaRoutineArgumentsArgumentKindEnum(0)\n}", "title": "" }, { "docid": "aa8b585aad7e39d1255b2ce7497b55c4", "score": "0.5171127", "text": "func BigqueryAlphaRoutineArgumentsDataTypeTypeKindEnumToProto(e *alpha.RoutineArgumentsDataTypeTypeKindEnum) alphapb.BigqueryAlphaRoutineArgumentsDataTypeTypeKindEnum {\n\tif e == nil {\n\t\treturn alphapb.BigqueryAlphaRoutineArgumentsDataTypeTypeKindEnum(0)\n\t}\n\tif v, ok := alphapb.BigqueryAlphaRoutineArgumentsDataTypeTypeKindEnum_value[\"RoutineArgumentsDataTypeTypeKindEnum\"+string(*e)]; ok {\n\t\treturn alphapb.BigqueryAlphaRoutineArgumentsDataTypeTypeKindEnum(v)\n\t}\n\treturn alphapb.BigqueryAlphaRoutineArgumentsDataTypeTypeKindEnum(0)\n}", "title": "" }, { "docid": "f123cf0ccc3e07c700c0b58812c1c87b", "score": "0.51323867", "text": "func NetworkservicesAlphaEndpointPolicyTypeEnumToProto(e *alpha.EndpointPolicyTypeEnum) alphapb.NetworkservicesAlphaEndpointPolicyTypeEnum {\n\tif e == nil {\n\t\treturn alphapb.NetworkservicesAlphaEndpointPolicyTypeEnum(0)\n\t}\n\tif v, ok := alphapb.NetworkservicesAlphaEndpointPolicyTypeEnum_value[\"EndpointPolicyTypeEnum\"+string(*e)]; ok {\n\t\treturn alphapb.NetworkservicesAlphaEndpointPolicyTypeEnum(v)\n\t}\n\treturn alphapb.NetworkservicesAlphaEndpointPolicyTypeEnum(0)\n}", "title": "" }, { "docid": "83774f232126805b4dd1202154c26351", "score": "0.51294786", "text": "func ComputeAlphaInstanceNetworkInterfacesIPv6AccessConfigsTypeEnumToProto(e *alpha.InstanceNetworkInterfacesIPv6AccessConfigsTypeEnum) alphapb.ComputeAlphaInstanceNetworkInterfacesIPv6AccessConfigsTypeEnum {\n\tif e == nil {\n\t\treturn alphapb.ComputeAlphaInstanceNetworkInterfacesIPv6AccessConfigsTypeEnum(0)\n\t}\n\tif v, ok := alphapb.ComputeAlphaInstanceNetworkInterfacesIPv6AccessConfigsTypeEnum_value[\"InstanceNetworkInterfacesIPv6AccessConfigsTypeEnum\"+string(*e)]; ok {\n\t\treturn alphapb.ComputeAlphaInstanceNetworkInterfacesIPv6AccessConfigsTypeEnum(v)\n\t}\n\treturn alphapb.ComputeAlphaInstanceNetworkInterfacesIPv6AccessConfigsTypeEnum(0)\n}", "title": "" }, { "docid": "b7c492cc4c5f030f6ae6b1c9aa74d337", "score": "0.5123198", "text": "func ComputeHealthCheckHttp2HealthCheckProxyHeaderEnumToProto(e *compute.HealthCheckHttp2HealthCheckProxyHeaderEnum) computepb.ComputeHealthCheckHttp2HealthCheckProxyHeaderEnum {\n\tif e == nil {\n\t\treturn computepb.ComputeHealthCheckHttp2HealthCheckProxyHeaderEnum(0)\n\t}\n\tif v, ok := computepb.ComputeHealthCheckHttp2HealthCheckProxyHeaderEnum_value[\"HealthCheckHttp2HealthCheckProxyHeaderEnum\"+string(*e)]; ok {\n\t\treturn computepb.ComputeHealthCheckHttp2HealthCheckProxyHeaderEnum(v)\n\t}\n\treturn computepb.ComputeHealthCheckHttp2HealthCheckProxyHeaderEnum(0)\n}", "title": "" }, { "docid": "8c13f2c818babce7df454a1b3081d463", "score": "0.51205313", "text": "func (WalletType) EnumDescriptor() ([]byte, []int) {\n\treturn file_gincoinc_adamant_global_v1_adamantglobalv1_enum_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "f46ae645ee0e56a75bed7b036bf60a8f", "score": "0.51139593", "text": "func BigqueryAlphaRoutineRoutineTypeEnumToProto(e *alpha.RoutineRoutineTypeEnum) alphapb.BigqueryAlphaRoutineRoutineTypeEnum {\n\tif e == nil {\n\t\treturn alphapb.BigqueryAlphaRoutineRoutineTypeEnum(0)\n\t}\n\tif v, ok := alphapb.BigqueryAlphaRoutineRoutineTypeEnum_value[\"RoutineRoutineTypeEnum\"+string(*e)]; ok {\n\t\treturn alphapb.BigqueryAlphaRoutineRoutineTypeEnum(v)\n\t}\n\treturn alphapb.BigqueryAlphaRoutineRoutineTypeEnum(0)\n}", "title": "" }, { "docid": "cb76a28a6e0db2102eb8e4533c7fe33c", "score": "0.51124644", "text": "func UnmarshalJSONEnum(m map[string]int32, data []byte, enumName string) (int32, error) {\n\treturn protoapi.UnmarshalJSONEnum(m, data, enumName)\n}", "title": "" }, { "docid": "70f254b6c18365892baab3e98696bc94", "score": "0.5110551", "text": "func ProtoToDataplexAssetResourceSpecTypeEnum(e dataplexpb.DataplexAssetResourceSpecTypeEnum) *dataplex.AssetResourceSpecTypeEnum {\n\tif e == 0 {\n\t\treturn nil\n\t}\n\tif n, ok := dataplexpb.DataplexAssetResourceSpecTypeEnum_name[int32(e)]; ok {\n\t\te := dataplex.AssetResourceSpecTypeEnum(n[len(\"DataplexAssetResourceSpecTypeEnum\"):])\n\t\treturn &e\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3dcfd3ddcc0bfdaa4ec5a29cb0e859c2", "score": "0.5095465", "text": "func ProtoToComposerEnvironmentStateEnum(e composerpb.ComposerEnvironmentStateEnum) *composer.EnvironmentStateEnum {\n\tif e == 0 {\n\t\treturn nil\n\t}\n\tif n, ok := composerpb.ComposerEnvironmentStateEnum_name[int32(e)]; ok {\n\t\te := composer.EnvironmentStateEnum(n[len(\"ComposerEnvironmentStateEnum\"):])\n\t\treturn &e\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6d4c103be9100175404115487e7c3c25", "score": "0.5090816", "text": "func (x RejoinTimeExponent) MarshalProtoJSON(s *jsonplugin.MarshalState) {\n\ts.WriteEnumString(int32(x), RejoinTimeExponent_name)\n}", "title": "" }, { "docid": "40ae2107590c2ed4de54e4f5cfb10d72", "score": "0.50787914", "text": "func ProtoToDataplexBetaZoneStateEnum(e betapb.DataplexBetaZoneStateEnum) *beta.ZoneStateEnum {\n\tif e == 0 {\n\t\treturn nil\n\t}\n\tif n, ok := betapb.DataplexBetaZoneStateEnum_name[int32(e)]; ok {\n\t\te := beta.ZoneStateEnum(n[len(\"DataplexBetaZoneStateEnum\"):])\n\t\treturn &e\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "242dab4277cef255cd0f121e4a7e9b1e", "score": "0.50787586", "text": "func ProtoToVpcaccessAlphaConnectorStateEnum(e alphapb.VpcaccessAlphaConnectorStateEnum) *alpha.ConnectorStateEnum {\n\tif e == 0 {\n\t\treturn nil\n\t}\n\tif n, ok := alphapb.VpcaccessAlphaConnectorStateEnum_name[int32(e)]; ok {\n\t\te := alpha.ConnectorStateEnum(n[len(\"VpcaccessAlphaConnectorStateEnum\"):])\n\t\treturn &e\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9e5ace3cbc4fa8ea3c8483c8925802d1", "score": "0.50732774", "text": "func (x *RejoinTimeExponent) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState) {\n\tv := s.ReadEnum(RejoinTimeExponent_value, RejoinTimeExponent_customvalue)\n\tif err := s.Err(); err != nil {\n\t\ts.SetErrorf(\"could not read RejoinTimeExponent enum: %v\", err)\n\t\treturn\n\t}\n\t*x = RejoinTimeExponent(v)\n}", "title": "" }, { "docid": "6321f41fbc9fdd5bc5e0849cfaf64385", "score": "0.50680745", "text": "func (Enum) EnumDescriptor() ([]byte, []int) {\n\treturn file_cmd_protoc_gen_go_testdata_extensions_proto3_ext3_proto_rawDescGZIP(), []int{0}\n}", "title": "" } ]
9b29131cde11ac7ca27aac5bada6a14e
NewGetCostsChartsByDeploymentForbidden creates a GetCostsChartsByDeploymentForbidden with default headers values
[ { "docid": "11cb67911c548746c9944b2f38a5718a", "score": "0.7453619", "text": "func NewGetCostsChartsByDeploymentForbidden() *GetCostsChartsByDeploymentForbidden {\n\treturn &GetCostsChartsByDeploymentForbidden{}\n}", "title": "" } ]
[ { "docid": "a5951441fc11f347676d1f8ff82e9cd8", "score": "0.5455902", "text": "func NewGetCostsChartsByDeploymentBadRequest() *GetCostsChartsByDeploymentBadRequest {\n\treturn &GetCostsChartsByDeploymentBadRequest{}\n}", "title": "" }, { "docid": "d96bf0fdb431a74a35a097ab7f9a6db8", "score": "0.5452695", "text": "func (o *GetCostsChartsByDeploymentForbidden) Code() int {\n\treturn 403\n}", "title": "" }, { "docid": "40a67e74eb19ceb1be461a0bad15163d", "score": "0.54067767", "text": "func NewGetFoodsByDateRangeForbidden() *GetFoodsByDateRangeForbidden {\n\treturn &GetFoodsByDateRangeForbidden{}\n}", "title": "" }, { "docid": "0bec0a90c1bcc46758d44571a772291a", "score": "0.52799636", "text": "func NewGetDashboardsForbidden() *GetDashboardsForbidden {\r\n\r\n\treturn &GetDashboardsForbidden{}\r\n}", "title": "" }, { "docid": "14afb66143c04791b1750a701a432af1", "score": "0.5193923", "text": "func NewGetComplianceByResourceTypesForbidden() *GetComplianceByResourceTypesForbidden {\n\treturn &GetComplianceByResourceTypesForbidden{}\n}", "title": "" }, { "docid": "c7e96beb770a745667257fd86e9c8098", "score": "0.50362295", "text": "func NewGetPWSViolationsForbidden() *GetPWSViolationsForbidden {\n\n\treturn &GetPWSViolationsForbidden{}\n}", "title": "" }, { "docid": "cbeb1ac0e02a94281cd967d7ec682742", "score": "0.5023031", "text": "func Forbidden(format string, a ...interface{}) *Error {\n\treturn newError(ErrForbidden, format, a)\n}", "title": "" }, { "docid": "2a3a73814219230fbaf502c20587a966", "score": "0.50122297", "text": "func NewGetPresignedForClusterFilesForbidden() *GetPresignedForClusterFilesForbidden {\n\treturn &GetPresignedForClusterFilesForbidden{}\n}", "title": "" }, { "docid": "fb1e8770743a3a317498cbba8fad1644", "score": "0.5007282", "text": "func NewGetClusterMetricsForbidden() *GetClusterMetricsForbidden {\n\treturn &GetClusterMetricsForbidden{}\n}", "title": "" }, { "docid": "61f78699a1a8bff533bfb5d466826665", "score": "0.49801597", "text": "func NewPostChartrepoChartsForbidden() *PostChartrepoChartsForbidden {\n\treturn &PostChartrepoChartsForbidden{}\n}", "title": "" }, { "docid": "1446a4ceb542851563054a36fe598836", "score": "0.4958882", "text": "func NewGetCostsChartsByDeploymentNotFound() *GetCostsChartsByDeploymentNotFound {\n\treturn &GetCostsChartsByDeploymentNotFound{}\n}", "title": "" }, { "docid": "da692042487e1743bf22ef158971b9c9", "score": "0.4958737", "text": "func Forbidden() (events.APIGatewayProxyResponse, error) {\n\treturn Custom(403, \"Forbidden\", nil)\n}", "title": "" }, { "docid": "00c827ec5bc3ef6d6177e31fa9355928", "score": "0.49073786", "text": "func NewGetFunnelsForbidden() *GetFunnelsForbidden {\n\treturn &GetFunnelsForbidden{}\n}", "title": "" }, { "docid": "213fc13e7863443b174df410f8f3fb69", "score": "0.48685786", "text": "func NewGetTransportationOfficesForbidden() *GetTransportationOfficesForbidden {\n\n\treturn &GetTransportationOfficesForbidden{}\n}", "title": "" }, { "docid": "a724af87f48d50e18bd33a62084052dc", "score": "0.48505658", "text": "func NewGetAutoDiscoveryPingsweepForbidden() *GetAutoDiscoveryPingsweepForbidden {\n\treturn &GetAutoDiscoveryPingsweepForbidden{}\n}", "title": "" }, { "docid": "319394f8a6f2a22147152a50a9159f34", "score": "0.4850143", "text": "func NewGetComplianceV1Forbidden() *GetComplianceV1Forbidden {\n\treturn &GetComplianceV1Forbidden{}\n}", "title": "" }, { "docid": "f0f17fcb9f02cf3ca326d6559b69de31", "score": "0.4845849", "text": "func NewGetAllowedRegistryForbidden() *GetAllowedRegistryForbidden {\n\treturn &GetAllowedRegistryForbidden{}\n}", "title": "" }, { "docid": "1d6dcec596ac05e5afaa60de623bf72d", "score": "0.48423487", "text": "func NewGetCompatibilityForbidden() *GetCompatibilityForbidden {\n\treturn &GetCompatibilityForbidden{}\n}", "title": "" }, { "docid": "84c09a35c3f5cfee1b7ed24b8124e917", "score": "0.4840521", "text": "func NewDownloadHostIgnitionForbidden() *DownloadHostIgnitionForbidden {\n\n\treturn &DownloadHostIgnitionForbidden{}\n}", "title": "" }, { "docid": "b76349f79555c150ce4df73e9c5d244d", "score": "0.48319247", "text": "func forbidden(reason string, attributes kauthorizer.Attributes, w http.ResponseWriter, req *http.Request) {\n\tresource := \"\"\n\tgroup := \"\"\n\tname := \"\"\n\t// the attributes can be empty for two basic reasons:\n\t// 1. malformed API request\n\t// 2. not an API request at all\n\t// In these cases, just assume default that will work better than nothing\n\tif attributes != nil {\n\t\tgroup = attributes.GetAPIGroup()\n\t\tresource = attributes.GetResource()\n\t\tname = attributes.GetName()\n\t}\n\n\t// Reason is an opaque string that describes why access is allowed or forbidden (forbidden by the time we reach here).\n\t// We don't have direct access to kind or name (not that those apply either in the general case)\n\t// We create a NewForbidden to stay close the API, but then we override the message to get a serialization\n\t// that makes sense when a human reads it.\n\tforbiddenError := kapierrors.NewForbidden(schema.GroupResource{Group: group, Resource: resource}, name, errors.New(\"\") /*discarded*/)\n\tforbiddenError.ErrStatus.Message = reason\n\n\tformatted := &bytes.Buffer{}\n\toutput, err := runtime.Encode(legacyscheme.Codecs.LegacyCodec(coreapi.SchemeGroupVersion), &forbiddenError.ErrStatus)\n\tif err != nil {\n\t\tfmt.Fprintf(formatted, \"%s\", forbiddenError.Error())\n\t} else {\n\t\tjson.Indent(formatted, output, \"\", \" \")\n\t}\n\n\tw.Header().Set(\"Content-Type\", restful.MIME_JSON)\n\tw.WriteHeader(http.StatusForbidden)\n\tw.Write(formatted.Bytes())\n}", "title": "" }, { "docid": "2384a6bb6396520626650e98ec11c0a2", "score": "0.4813345", "text": "func NewReportExecutionsDownloadGetForbidden() *ReportExecutionsDownloadGetForbidden {\n\treturn &ReportExecutionsDownloadGetForbidden{}\n}", "title": "" }, { "docid": "f65849f6cfb59dc9dfd2c7d7f6fdd305", "score": "0.4812753", "text": "func NewServiceGetForbidden() *ServiceGetForbidden {\n\n\treturn &ServiceGetForbidden{}\n}", "title": "" }, { "docid": "e2d4e535c59011b8d614247eeb191b5a", "score": "0.48107857", "text": "func NewGetServiceForbidden() *GetServiceForbidden {\n\treturn &GetServiceForbidden{}\n}", "title": "" }, { "docid": "d43868533d372f00a0861adfb4d81319", "score": "0.48042104", "text": "func NewGetTiersPricingForbidden() *GetTiersPricingForbidden {\n\treturn &GetTiersPricingForbidden{}\n}", "title": "" }, { "docid": "5f791830e7ec674234c8c4afc62ec5b7", "score": "0.48005038", "text": "func NewGetConstraintForbidden() *GetConstraintForbidden {\n\treturn &GetConstraintForbidden{}\n}", "title": "" }, { "docid": "9dd9d513835a3672e79d4b1ad0a7acdf", "score": "0.47784767", "text": "func RequireCreateChartParams(log *zerolog.Logger) func(next http.Handler) http.Handler {\n\treturn func(next http.Handler) http.Handler {\n\t\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\tcreateOptsJSON := view.CreateChartRequest{}\n\n\t\t\terr := json.NewDecoder(r.Body).Decode(&createOptsJSON)\n\t\t\tif err != nil {\n\t\t\t\tmsg := fmt.Sprintf(\"Unable to decode create chart JSON: %s\", err)\n\t\t\t\tlog := log.With().Str(RequestIDLogKey, GetRequestID(r.Context())).Logger()\n\n\t\t\t\tlog.Warn().Msg(msg)\n\n\t\t\t\tMarshalJSON(w, http.StatusBadRequest, view.NewError(msg))\n\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tcreateChartRequest, err := convert.JSONToCreateChartRequest(&createOptsJSON)\n\t\t\tif err != nil {\n\t\t\t\tMarshalJSON(w, http.StatusBadRequest, view.NewError(fmt.Sprintf(\"Unable to use the provided create chart parameters: %s\", err)))\n\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tctx := context.WithValue(r.Context(), ctxCreateChartRequest, createChartRequest)\n\n\t\t\tnext.ServeHTTP(w, r.WithContext(ctx))\n\t\t})\n\t}\n}", "title": "" }, { "docid": "02b44b3c2ee255683d85817ff9dea9c1", "score": "0.47760358", "text": "func NewTimezonesGetForbidden() *TimezonesGetForbidden {\n\treturn &TimezonesGetForbidden{}\n}", "title": "" }, { "docid": "5af1082474321966c71483bc14fa13ca", "score": "0.47757834", "text": "func NewGetClusterHealthForbidden() *GetClusterHealthForbidden {\n\treturn &GetClusterHealthForbidden{}\n}", "title": "" }, { "docid": "fdb925489fe4244aeb2cb8dd060970a8", "score": "0.47698113", "text": "func NewGetProjectSettingsForbidden() *GetProjectSettingsForbidden {\n\treturn &GetProjectSettingsForbidden{}\n}", "title": "" }, { "docid": "c15240be822e9b0049d7b4730bdd1db4", "score": "0.47618583", "text": "func NewGetConfigForbidden() *GetConfigForbidden {\n\treturn &GetConfigForbidden{}\n}", "title": "" }, { "docid": "1caa5228fa5e6bd16ac92f1dcbb970e0", "score": "0.47280702", "text": "func (ee ErrEndpointExists) Forbidden() {}", "title": "" }, { "docid": "cab0a0375bf1d147c0023e90037b6b04", "score": "0.4726626", "text": "func NewGetConnectionsForbidden() *GetConnectionsForbidden {\n\treturn &GetConnectionsForbidden{}\n}", "title": "" }, { "docid": "1e1e0f82815dc56afb8f89abed83fcf0", "score": "0.46979237", "text": "func NewWithForbiddenLicenses(threshold float64, options ...OptionFunc) (*License, error) {\n\topts := []OptionFunc{Archive(ForbiddenLicenseArchive)}\n\topts = append(opts, options...)\n\treturn New(threshold, opts...)\n}", "title": "" }, { "docid": "6278d5dcef1dfcbde7c3b999e4eaf67f", "score": "0.4675528", "text": "func NewCreateVersionControlRequestForbidden() *CreateVersionControlRequestForbidden {\n\treturn &CreateVersionControlRequestForbidden{}\n}", "title": "" }, { "docid": "cf3e3e630cd108705cc6eb10192a5464", "score": "0.46730357", "text": "func NewGetConfigByNameUsingGETForbidden() *GetConfigByNameUsingGETForbidden {\n\treturn &GetConfigByNameUsingGETForbidden{}\n}", "title": "" }, { "docid": "89d3de501cca9a8fe5958187f21a50be", "score": "0.46723914", "text": "func NewGetConnectionsByIDForbidden() *GetConnectionsByIDForbidden {\n\treturn &GetConnectionsByIDForbidden{}\n}", "title": "" }, { "docid": "15bec595afdef02bae4474ece7729139", "score": "0.4653578", "text": "func NewGetOrderForbidden() *GetOrderForbidden {\n\n\treturn &GetOrderForbidden{}\n}", "title": "" }, { "docid": "e84c873c4185f49c33e7ea1597642191", "score": "0.46401137", "text": "func Forbidden(requestID string, w http.ResponseWriter, err error, desc string) {\n\twriteErrorJSON(w, err, requestID, desc, http.StatusForbidden)\n}", "title": "" }, { "docid": "63b61479e52799fea8841d89da038064", "score": "0.46315485", "text": "func NewGetCustomIntegrationVersionsByIDUsingGETForbidden() *GetCustomIntegrationVersionsByIDUsingGETForbidden {\n\treturn &GetCustomIntegrationVersionsByIDUsingGETForbidden{}\n}", "title": "" }, { "docid": "706b8602c0dd81beae7472aeb42d485a", "score": "0.4631253", "text": "func NewListFilterSetOfProjectVersionForbidden() *ListFilterSetOfProjectVersionForbidden {\n\treturn &ListFilterSetOfProjectVersionForbidden{}\n}", "title": "" }, { "docid": "8ff6133d54345610ecfe99b16b29ce84", "score": "0.46280244", "text": "func NewInstallHostForbidden() *InstallHostForbidden {\n\n\treturn &InstallHostForbidden{}\n}", "title": "" }, { "docid": "d40f85e49cd8b800d19216e48547e64e", "score": "0.46244776", "text": "func NewGetPipelineByNameUsingGETForbidden() *GetPipelineByNameUsingGETForbidden {\n\treturn &GetPipelineByNameUsingGETForbidden{}\n}", "title": "" }, { "docid": "ae20f74be6bb87a17439d043fccac61c", "score": "0.46171573", "text": "func NewGetVsphereFabricNetworkForbidden() *GetVsphereFabricNetworkForbidden {\n\treturn &GetVsphereFabricNetworkForbidden{}\n}", "title": "" }, { "docid": "bf0793fde11acdbfd9b5f56249eeedff", "score": "0.4613824", "text": "func NewGetPreflightRequirementsForbidden() *GetPreflightRequirementsForbidden {\n\n\treturn &GetPreflightRequirementsForbidden{}\n}", "title": "" }, { "docid": "a9930e0e941609c58b98bf7db92d8f69", "score": "0.46091476", "text": "func NewGetAllExecutionsUsingGETForbidden() *GetAllExecutionsUsingGETForbidden {\n\treturn &GetAllExecutionsUsingGETForbidden{}\n}", "title": "" }, { "docid": "a9930e0e941609c58b98bf7db92d8f69", "score": "0.46091476", "text": "func NewGetAllExecutionsUsingGETForbidden() *GetAllExecutionsUsingGETForbidden {\n\treturn &GetAllExecutionsUsingGETForbidden{}\n}", "title": "" }, { "docid": "cc9b0066f4a5ce3820b93dd0b50bc194", "score": "0.45965713", "text": "func NewSearchClusterPlansUsingGETForbidden() *SearchClusterPlansUsingGETForbidden {\n\treturn &SearchClusterPlansUsingGETForbidden{}\n}", "title": "" }, { "docid": "ac831d10fbb93eafbc922fd80b432f9c", "score": "0.45940828", "text": "func NewGlobalGetFlowVersionsForbidden() *GlobalGetFlowVersionsForbidden {\n\treturn &GlobalGetFlowVersionsForbidden{}\n}", "title": "" }, { "docid": "b05a655f97da0f5f0249ee293c60fc94", "score": "0.45878056", "text": "func NewExportProductUsingGETForbidden() *ExportProductUsingGETForbidden {\n\treturn &ExportProductUsingGETForbidden{}\n}", "title": "" }, { "docid": "eab6f582f1b87acf915d993d614a1c1d", "score": "0.4578945", "text": "func NewGetCostsChartsByDeploymentOK() *GetCostsChartsByDeploymentOK {\n\treturn &GetCostsChartsByDeploymentOK{}\n}", "title": "" }, { "docid": "daf54be384018acad9f9347e09f4f4a5", "score": "0.45783478", "text": "func NewGetForbidden(body *GetForbiddenResponseBody) *goa.ServiceError {\n\tv := &goa.ServiceError{\n\t\tName: *body.Name,\n\t\tID: *body.ID,\n\t\tMessage: *body.Message,\n\t\tTemporary: *body.Temporary,\n\t\tTimeout: *body.Timeout,\n\t\tFault: *body.Fault,\n\t}\n\n\treturn v\n}", "title": "" }, { "docid": "874e8e71e58117015d6959a3b06fce12", "score": "0.4577309", "text": "func NewDeleteRetentionForbidden() *DeleteRetentionForbidden {\n\treturn &DeleteRetentionForbidden{}\n}", "title": "" }, { "docid": "bbc646f38f4f6233536a1b27d7504b51", "score": "0.45705646", "text": "func NewForbidden(msg string, args ...interface{}) error {\n\treturn New(Forbidden, msg, args...)\n}", "title": "" }, { "docid": "29271ef4f1c515ae8b4c054778165bc9", "score": "0.45704973", "text": "func NewGetServicePlanSchemaForKindForbidden() *GetServicePlanSchemaForKindForbidden {\n\treturn &GetServicePlanSchemaForKindForbidden{}\n}", "title": "" }, { "docid": "565294a944c2a63faf8640451dd98c7b", "score": "0.45620635", "text": "func NewGetCurrencyForbidden() *GetCurrencyForbidden {\n\treturn &GetCurrencyForbidden{}\n}", "title": "" }, { "docid": "bbddf6853b4b44a192a4db53282bfa7f", "score": "0.45521203", "text": "func NewGetCatalogVersionUsingGETForbidden() *GetCatalogVersionUsingGETForbidden {\n\treturn &GetCatalogVersionUsingGETForbidden{}\n}", "title": "" }, { "docid": "1812d0f0c63f1d6b1f42257349277590", "score": "0.4549708", "text": "func NewGetRulesForbidden() *GetRulesForbidden {\n\treturn &GetRulesForbidden{}\n}", "title": "" }, { "docid": "1812d0f0c63f1d6b1f42257349277590", "score": "0.4549708", "text": "func NewGetRulesForbidden() *GetRulesForbidden {\n\treturn &GetRulesForbidden{}\n}", "title": "" }, { "docid": "5558a6dc10e032eb7a1c125e05587e24", "score": "0.4540606", "text": "func NewGetCreditForbidden() *GetCreditForbidden {\n\n\treturn &GetCreditForbidden{}\n}", "title": "" }, { "docid": "c4c548245d7a12dc24fc23e22309b827", "score": "0.45401618", "text": "func NewGetGerritProjectsByNameUsingGETForbidden() *GetGerritProjectsByNameUsingGETForbidden {\n\treturn &GetGerritProjectsByNameUsingGETForbidden{}\n}", "title": "" }, { "docid": "777f224d25eb5c019371c46f3010c1e6", "score": "0.45288774", "text": "func NewGetLimitsForbidden() *GetLimitsForbidden {\n\treturn &GetLimitsForbidden{}\n}", "title": "" }, { "docid": "644dc04d9dcf1bd963ca4bd7b909b9f3", "score": "0.4524901", "text": "func Forbidden(w http.ResponseWriter, r *http.Request) {\n\tw.WriteHeader(http.StatusForbidden)\n}", "title": "" }, { "docid": "563deb08e475b21046001e7092415575", "score": "0.45176303", "text": "func NewDeleteDefaultConstraintForbidden() *DeleteDefaultConstraintForbidden {\n\treturn &DeleteDefaultConstraintForbidden{}\n}", "title": "" }, { "docid": "0edbb7dc2a595483307983884743b551", "score": "0.45160627", "text": "func NewGetChartrepoRepoChartsNameVersionLabelsForbidden() *GetChartrepoRepoChartsNameVersionLabelsForbidden {\n\treturn &GetChartrepoRepoChartsNameVersionLabelsForbidden{}\n}", "title": "" }, { "docid": "d38707870b488599ae7b03ebb162edd3", "score": "0.45145378", "text": "func NewGetSecurityGroupForbidden() *GetSecurityGroupForbidden {\n\treturn &GetSecurityGroupForbidden{}\n}", "title": "" }, { "docid": "71c22467ddbc10c6cd75c36c3b43d54e", "score": "0.45141694", "text": "func NewAddForbidden(body *AddForbiddenResponseBody) *goa.ServiceError {\n\tv := &goa.ServiceError{\n\t\tName: *body.Name,\n\t\tID: *body.ID,\n\t\tMessage: *body.Message,\n\t\tTemporary: *body.Temporary,\n\t\tTimeout: *body.Timeout,\n\t\tFault: *body.Fault,\n\t}\n\n\treturn v\n}", "title": "" }, { "docid": "afaf6e56efeeaf9110b6fb7cabca0093", "score": "0.45000637", "text": "func NewGetRulesConfigsForbidden() *GetRulesConfigsForbidden {\n\treturn &GetRulesConfigsForbidden{}\n}", "title": "" }, { "docid": "d5b0861e6b0187d7db1f64353189b0c5", "score": "0.44947785", "text": "func NewListVersionsByProviderForbidden() *ListVersionsByProviderForbidden {\n\treturn &ListVersionsByProviderForbidden{}\n}", "title": "" }, { "docid": "19445c55cbeab58439b70dbb539ef359", "score": "0.44857582", "text": "func NewShowShipmentSummaryWorksheetForbidden() *ShowShipmentSummaryWorksheetForbidden {\n\n\treturn &ShowShipmentSummaryWorksheetForbidden{}\n}", "title": "" }, { "docid": "9dc2cd9beff34dca9f92dc9077dcf142", "score": "0.4481652", "text": "func StatusForbidden(message string, errors []map[string]interface{}) {\r\n\tresponse := map[string]interface{}{\r\n\t\t\"message\": message,\r\n\t\t\"data\": nil,\r\n\t\t\"status\": http.StatusForbidden,\r\n\t\t\"errors\": errors,\r\n\t}\r\n\tpanic(response)\r\n}", "title": "" }, { "docid": "cdcf782be170b4c37e0a0547867c948d", "score": "0.4477877", "text": "func NewGetPruebasFromQuestionForbidden() *GetPruebasFromQuestionForbidden {\n\n\treturn &GetPruebasFromQuestionForbidden{}\n}", "title": "" }, { "docid": "648e7cc4941efc1717539898eef06b42", "score": "0.44762573", "text": "func NewGetCatalogsUsingGETForbidden() *GetCatalogsUsingGETForbidden {\n\treturn &GetCatalogsUsingGETForbidden{}\n}", "title": "" }, { "docid": "df62883e1cc0e941e0611aeff2d51e94", "score": "0.44728068", "text": "func NewGetFabricNetworkForbidden() *GetFabricNetworkForbidden {\n\treturn &GetFabricNetworkForbidden{}\n}", "title": "" }, { "docid": "ad5c093b372d5aac7404de93dcd29a1c", "score": "0.44694403", "text": "func BuildForbiddenResponse() *Response {\n\tresp := new(Response)\n\tresp.Status = http.StatusForbidden\n\tresp.ErrCode = ErrorForbiddenRequest\n\n\treturn resp\n}", "title": "" }, { "docid": "18dda725cf7500999682b8f1e67fceb2", "score": "0.44665617", "text": "func Forbidden() Response {\n\treturn New().\n\t\tWithStatus(http.StatusForbidden).\n\t\tWithError(\n\t\t\tNewError().\n\t\t\t\tWithTitle(http.StatusText(http.StatusForbidden)).\n\t\t\t\tWithStatus(http.StatusForbidden),\n\t\t)\n}", "title": "" }, { "docid": "0bd9d08df53204762d22c9723d228355", "score": "0.44663638", "text": "func NewDeleteForbidden(body *DeleteForbiddenResponseBody) *goa.ServiceError {\n\tv := &goa.ServiceError{\n\t\tName: *body.Name,\n\t\tID: *body.ID,\n\t\tMessage: *body.Message,\n\t\tTemporary: *body.Temporary,\n\t\tTimeout: *body.Timeout,\n\t\tFault: *body.Fault,\n\t}\n\n\treturn v\n}", "title": "" }, { "docid": "fe7398acb43e29a551469bd08781fc28", "score": "0.44661266", "text": "func NewGetFlowFileForbidden() *GetFlowFileForbidden {\n\treturn &GetFlowFileForbidden{}\n}", "title": "" }, { "docid": "1541a59813895778cf132afbc07fe76b", "score": "0.44608295", "text": "func Forbidden(domain, reason, message string) *ErrorInfo {\n\treturn Errorf(http.StatusForbidden, domain, reason, message)\n}", "title": "" }, { "docid": "3c4bde737be928d28c8dec57fe76d4a8", "score": "0.44408974", "text": "func NewGetFrequentFoodsForbidden() *GetFrequentFoodsForbidden {\n\treturn &GetFrequentFoodsForbidden{}\n}", "title": "" }, { "docid": "9be96560c4b32b8a965e849dc7a126b0", "score": "0.44240603", "text": "func NewGetVisiblePublishedPruebasFromQuestionTestForbidden() *GetVisiblePublishedPruebasFromQuestionTestForbidden {\n\n\treturn &GetVisiblePublishedPruebasFromQuestionTestForbidden{}\n}", "title": "" }, { "docid": "cf1df5f2fcd3bbbc27ad60b0cba38903", "score": "0.44234335", "text": "func NewGetServiceListenerPortsForbidden() *GetServiceListenerPortsForbidden {\n\treturn &GetServiceListenerPortsForbidden{}\n}", "title": "" }, { "docid": "6f30262ea4ee199e6a32e7779196b540", "score": "0.4419341", "text": "func NewGetReportsForbidden() *GetReportsForbidden {\n\treturn &GetReportsForbidden{}\n}", "title": "" }, { "docid": "231348d04facc3a3b87b0592a30018be", "score": "0.44140297", "text": "func NewAddCustomersForbidden() *AddCustomersForbidden {\n\treturn &AddCustomersForbidden{}\n}", "title": "" }, { "docid": "90abfc41fc4008e779688a0d61174b29", "score": "0.4406128", "text": "func (ctx *Context) Forbidden() {\n\tctx.ResponseWriter.WriteHeader(403)\n}", "title": "" }, { "docid": "50788f86512fea0afbe49e6526c51d00", "score": "0.44045702", "text": "func Forbidden(err error, c *gin.Context) {\n\tdata := errorMessage{\n\t\tStatusCode: http.StatusForbidden,\n\t\tMessage: err.Error(),\n\t}\n\n\tc.JSON(data.StatusCode, data)\n}", "title": "" }, { "docid": "e44bae142681f2a11cdabb4dc9eb59ac", "score": "0.44038096", "text": "func NewGetEnvironmentForbidden() *GetEnvironmentForbidden {\n\treturn &GetEnvironmentForbidden{}\n}", "title": "" }, { "docid": "56ce9edd3aabdb022b669cc2772f7ac8", "score": "0.43989614", "text": "func Forbidden(id, format string, a ...interface{}) error {\n\treturn &Error{\n\t\tId: id,\n\t\tCode: 403,\n\t\tDetail: fmt.Sprintf(format, a...),\n\t\tStatus: http.StatusText(403),\n\t}\n}", "title": "" }, { "docid": "f8f57270444b334cbf68f0997dabf1d3", "score": "0.43944496", "text": "func (o *RetrieveConfigDocsClearTextByCollectionIDForbidden) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(403)\n}", "title": "" }, { "docid": "8f38d740e661d5badb069135beee230d", "score": "0.43885756", "text": "func (o *GetCostsDeploymentsParams) WithAccept(accept *string) *GetCostsDeploymentsParams {\n\to.SetAccept(accept)\n\treturn o\n}", "title": "" }, { "docid": "aafccbffc8827abed5969fbb39ac0025", "score": "0.43872225", "text": "func NewGetGroupForbidden() *GetGroupForbidden {\n\treturn &GetGroupForbidden{}\n}", "title": "" }, { "docid": "aafccbffc8827abed5969fbb39ac0025", "score": "0.43872225", "text": "func NewGetGroupForbidden() *GetGroupForbidden {\n\treturn &GetGroupForbidden{}\n}", "title": "" }, { "docid": "9031aeaf9c427ed18126191039e91b56", "score": "0.4386034", "text": "func NewAttestationOptionsForbidden() *AttestationOptionsForbidden {\n\treturn &AttestationOptionsForbidden{}\n}", "title": "" }, { "docid": "b0feaa9f85ce674e10581af75307890b", "score": "0.4385271", "text": "func NewGetClusterGroupsByRequestTrackerUsingGETForbidden() *GetClusterGroupsByRequestTrackerUsingGETForbidden {\n\treturn &GetClusterGroupsByRequestTrackerUsingGETForbidden{}\n}", "title": "" }, { "docid": "fc2f673d180613b747b71e042f1f50d0", "score": "0.43839213", "text": "func LicenseMethodNotAllowed(ctx iris.Context) {\n\tdefer ctx.Next()\n\turl := ctx.Request().URL\n\tpath := url.Path\n\n\t// Extend switch case, when each path, requires different handling\n\tswitch path {\n\tcase \"/redfish/v1/LicenseService/Licenses\":\n\t\tctx.ResponseWriter().Header().Set(\"Allow\", \"GET, POST\")\n\tdefault:\n\t\tctx.ResponseWriter().Header().Set(\"Allow\", \"GET\")\n\t}\n\n\tfillMethodNotAllowedErrorResponse(ctx)\n\treturn\n}", "title": "" }, { "docid": "20bb22b044095eee60f592b2c62885d7", "score": "0.43793845", "text": "func Forbidden(message string) {\n\tPanic(message, http.StatusForbidden)\n}", "title": "" }, { "docid": "9bbcacc9f8196ada65eed7b24d86eb7e", "score": "0.43774348", "text": "func NewGetAllUsingGET7Forbidden() *GetAllUsingGET7Forbidden {\n\treturn &GetAllUsingGET7Forbidden{}\n}", "title": "" }, { "docid": "2f8886f8871220e2256be71f84c2ed3b", "score": "0.43746328", "text": "func NewPutSystemGcScheduleForbidden() *PutSystemGcScheduleForbidden {\n\treturn &PutSystemGcScheduleForbidden{}\n}", "title": "" }, { "docid": "cc0cd51c79c572a75aaca7afb633114a", "score": "0.437377", "text": "func NewPostLettersExportGetForbidden() *PostLettersExportGetForbidden {\n\treturn &PostLettersExportGetForbidden{}\n}", "title": "" }, { "docid": "a89b2a035d6fcf5d7301bcaf07038944", "score": "0.43727073", "text": "func KindsCosts(w http.ResponseWriter, r *http.Request, p httprouter.Params) {\n\targs := []string{\"Salário Thiago\", \"Salário Sostenes\", \"Salário Luana\", \"Salário Recepcionista\",\n\t\t\"Água\", \"Luz\", \"Telefone\", \"Materiais Odontológico - (Dental)\", \"Protético\", \"Impostos\", \"Publicidade\", \"Equipamentos\", \"Coleta Lixo\", \"Contador\", \"Custo Máquina de crédito\", \"Outros Gastos\"}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\tw.WriteHeader(http.StatusOK)\n\tif err := json.NewEncoder(w).Encode(args); err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "3e41291ab24ccc7ce9322b8732a78932", "score": "0.43652627", "text": "func NewGetLatestFlowVersionForbidden() *GetLatestFlowVersionForbidden {\n\treturn &GetLatestFlowVersionForbidden{}\n}", "title": "" } ]
a62e2e4b258c7a56e2fce0ce19afa7f2
ViewsByComponents mocks base method
[ { "docid": "be0cb82daa32c0c31781418a823f8330", "score": "0.7936388", "text": "func (m *MockComponentRepository) ViewsByComponents(ctx context.Context, components []int) ([][]*model.View, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ViewsByComponents\", ctx, components)\n\tret0, _ := ret[0].([][]*model.View)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" } ]
[ { "docid": "6890982ef61e95d43d494d2c42bb0c07", "score": "0.7288977", "text": "func (m *MockComponentRepository) ViewSinksByComponents(ctx context.Context, components []int) ([][]*model.ViewSink, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ViewSinksByComponents\", ctx, components)\n\tret0, _ := ret[0].([][]*model.ViewSink)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "50ce6cce4df400351361f7a2ec8061aa", "score": "0.71566755", "text": "func (m *MockComponentRepository) ViewSourcesByComponents(ctx context.Context, components []int) ([][]*model.ViewSource, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ViewSourcesByComponents\", ctx, components)\n\tret0, _ := ret[0].([][]*model.ViewSource)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "1470263dfdc6447a47a5cb9291781be4", "score": "0.67155164", "text": "func (m *MockViewSinkRepository) ComponentByViewSinks(ctx context.Context, viewSinks []int) ([]*model.Component, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ComponentByViewSinks\", ctx, viewSinks)\n\tret0, _ := ret[0].([]*model.Component)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "e606d528546b5eabd293fd3e59d0616c", "score": "0.6198734", "text": "func (m *MockViewSinkLoader) ComponentByViewSink(arg0 int) (*model.Component, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ComponentByViewSink\", arg0)\n\tret0, _ := ret[0].(*model.Component)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "de8d03fbda76ff0b68a11def7df5197b", "score": "0.6056403", "text": "func (m *MockViewSinkLoader) PodsByViewSink(arg0 int) ([]*model.Pod, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"PodsByViewSink\", arg0)\n\tret0, _ := ret[0].([]*model.Pod)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "21ca49d9c2e02c0c310e6b69b0b25bb6", "score": "0.59422237", "text": "func (mr *MockComponentRepositoryMockRecorder) ViewsByComponents(ctx, components interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"ViewsByComponents\", reflect.TypeOf((*MockComponentRepository)(nil).ViewsByComponents), ctx, components)\n}", "title": "" }, { "docid": "ad5aa10f71ae4f194ce737f4195b7ccf", "score": "0.58268124", "text": "func (m *MockIController) OnUsersViewChanged(usersView []*models.UserView) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"OnUsersViewChanged\", usersView)\n}", "title": "" }, { "docid": "80b5d96709b24fbc59fe18678013573a", "score": "0.579814", "text": "func (m *MockComponentRepository) SourcesByComponents(ctx context.Context, components []int) ([][]*model.Source, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"SourcesByComponents\", ctx, components)\n\tret0, _ := ret[0].([][]*model.Source)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "e4e87b23fcdef1e229a23c238b2888ce", "score": "0.5732865", "text": "func (m *MockViewSinkRepository) PodsByViewSinks(ctx context.Context, viewSinks []int) ([][]*model.Pod, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"PodsByViewSinks\", ctx, viewSinks)\n\tret0, _ := ret[0].([][]*model.Pod)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "78528457b003410f1097d51b4ba09d90", "score": "0.569704", "text": "func (m *MockComponentRepository) SinksByComponents(ctx context.Context, components []int) ([][]*model.Sink, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"SinksByComponents\", ctx, components)\n\tret0, _ := ret[0].([][]*model.Sink)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "2a65265718fbc8d17f6e02b57172886a", "score": "0.56437737", "text": "func (m *MockIController) CreateOrUpdateUsersView(ctx context.Context, id []go_uuid.UUID) []*models.UserView {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"CreateOrUpdateUsersView\", ctx, id)\n\tret0, _ := ret[0].([]*models.UserView)\n\treturn ret0\n}", "title": "" }, { "docid": "5fb9c0a95c7314cdc3bded103de35ffc", "score": "0.5641463", "text": "func (m *MockComponentRepository) ServicesByComponents(ctx context.Context, components []int) ([]*model.Service, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ServicesByComponents\", ctx, components)\n\tret0, _ := ret[0].([]*model.Service)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "d61395bdbd6a99c7214263d2374ad47a", "score": "0.55844945", "text": "func (m *MockIController) CreateOrUpdateUsersViewByRoles(ctx context.Context, rolesIds []go_uuid.UUID) []*models.UserView {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"CreateOrUpdateUsersViewByRoles\", ctx, rolesIds)\n\tret0, _ := ret[0].([]*models.UserView)\n\treturn ret0\n}", "title": "" }, { "docid": "5fef2986bf5d71197d917174835ddda0", "score": "0.5574743", "text": "func (m *MockComponentRepository) ProcessorsByComponents(ctx context.Context, components []int) ([][]*model.Processor, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ProcessorsByComponents\", ctx, components)\n\tret0, _ := ret[0].([][]*model.Processor)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "8384626484d6eb78bdee8a4f26449a2f", "score": "0.55415946", "text": "func (m *MockIController) GetUserViews(ctx context.Context, query repositories.GetUsersViewStoreQuery) ([]*models.UserView, *models.PaginationResponse) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetUserViews\", ctx, query)\n\tret0, _ := ret[0].([]*models.UserView)\n\tret1, _ := ret[1].(*models.PaginationResponse)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "f1ca8e2b1d0b1df4e304867124296324", "score": "0.5434488", "text": "func init_mockup() {\n\tg_mock_up_map[\"base_view\"] = func() View { return NewBaseView() }\n\tg_mock_up_map[\"image_view\"] = func() View { return NewImageView() }\n\tg_mock_up_map[\"button\"] = func() View { return NewButton() }\n\tg_mock_up_map[\"panel\"] = func() View { return NewPanel() }\n\tg_mock_up_map[\"main_frame\"] = func() View { return NewMainFrame() }\n\tg_mock_up_map[\"toolbar\"] = func() View { return NewToolbar() }\n\tg_mock_up_map[\"test_view\"] = func() View { return NewTestView() }\n}", "title": "" }, { "docid": "77102034984d011c342bf3ca4872a9e9", "score": "0.53866565", "text": "func (_m *ProductNoticesStore) View(userID string, notices []string) error {\n\tret := _m.Called(userID, notices)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(string, []string) error); ok {\n\t\tr0 = rf(userID, notices)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "3b8be971b7b3aa728a7541d4c8e2a92f", "score": "0.53117996", "text": "func (mr *MockComponentRepositoryMockRecorder) ViewSinksByComponents(ctx, components interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"ViewSinksByComponents\", reflect.TypeOf((*MockComponentRepository)(nil).ViewSinksByComponents), ctx, components)\n}", "title": "" }, { "docid": "ac21a7505eed0708d9f251d7b2474d2e", "score": "0.52930194", "text": "func (_m *Database) Views(ctx context.Context) ([]driver.View, error) {\n\tret := _m.Called(ctx)\n\n\tvar r0 []driver.View\n\tif rf, ok := ret.Get(0).(func(context.Context) []driver.View); ok {\n\t\tr0 = rf(ctx)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).([]driver.View)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(context.Context) error); ok {\n\t\tr1 = rf(ctx)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "39dbc0fb55cc039555780017c4fcefac", "score": "0.52667636", "text": "func TestViewAccessor(t *testing.T) {\n\tvar view interface{} = new(interface{})\n\n\tvar m interfaces.IMediator = &mediator.Mediator{Name: mediator.NAME, ViewComponent: view}\n\n\tif m.GetViewComponent() == nil {\n\t\tt.Error(\"Expecting m.GetViewComponent() not nil\")\n\t}\n}", "title": "" }, { "docid": "120c7dedf5cbc133010369e2dbdb6065", "score": "0.5234568", "text": "func TestView(t *testing.T) {\n\tdumpMetadata := ViewMetadata{\n\t\tTitle: \"Dump View\",\n\t\tPriority: 1,\n\t}\n\terr := RegisterViewer(\"DumpView\", dumpMetadata, dumpViewHandler)\n\tif err != nil {\n\t\tt.Fatal(\"Failed to register viewer for testing View\")\n\t}\n\tfakeLog := &FakeArtifact{\n\t\tpath: \"log.txt\",\n\t\tcontent: []byte(\"Oh wow\\nlogs\\nthis is\\ncrazy\"),\n\t\tsizeLimit: 500e6,\n\t}\n\ttestCases := []struct {\n\t\tname string\n\t\tviewerName string\n\t\tartifacts []Artifact\n\t\traw string\n\t\texpected string\n\t\terr error\n\t}{\n\t\t{\n\t\t\tname: \"simple view\",\n\t\t\tviewerName: \"DumpView\",\n\t\t\tartifacts: []Artifact{\n\t\t\t\tfakeLog, fakeLog,\n\t\t\t},\n\t\t\traw: \"\",\n\t\t\texpected: `Oh wow\nlogs\nthis is\ncrazyOh wow\nlogs\nthis is\ncrazy`,\n\t\t\terr: nil,\n\t\t},\n\t\t{\n\t\t\tname: \"fail on unregistered view name\",\n\t\t\tviewerName: \"MicroverseBattery\",\n\t\t\tartifacts: []Artifact{},\n\t\t\traw: \"\",\n\t\t\texpected: \"\",\n\t\t\terr: ErrInvalidViewName,\n\t\t},\n\t}\n\tfor _, tc := range testCases {\n\t\tview, err := View(tc.viewerName, tc.artifacts, tc.raw)\n\t\tif tc.err != err {\n\t\t\tt.Errorf(\"%s expected error %v but got error %v\", tc.name, tc.err, err)\n\t\t\tcontinue\n\t\t}\n\t\tif view != tc.expected {\n\t\t\tt.Errorf(\"%s expected view to be %s but got %s\", tc.name, tc.expected, view)\n\t\t}\n\t}\n\tUnregisterViewer(\"DumpView\")\n\n}", "title": "" }, { "docid": "1885300b07b8bf3a455a26e485545ede", "score": "0.5205574", "text": "func (mr *MockComponentRepositoryMockRecorder) ViewSourcesByComponents(ctx, components interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"ViewSourcesByComponents\", reflect.TypeOf((*MockComponentRepository)(nil).ViewSourcesByComponents), ctx, components)\n}", "title": "" }, { "docid": "dc8f320b85fa665583192bf2f153ab72", "score": "0.51610345", "text": "func (m *MockEquipmentHandler) GetAll(w http.ResponseWriter, r *http.Request) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"GetAll\", w, r)\n}", "title": "" }, { "docid": "7d696bf8d6a1d84819a68a1d5f09ca34", "score": "0.5004917", "text": "func (m *MockExecutionResultViewPersistence) Get(arg0 context.Context, arg1 string, arg2 gocql.UUID, arg3 int, arg4 bool) ([]*models.ExecutionResultView, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Get\", arg0, arg1, arg2, arg3, arg4)\n\tret0, _ := ret[0].([]*models.ExecutionResultView)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "b8c53774280e461902d371d142103158", "score": "0.5003037", "text": "func (m *MockPlaceController) FindLocations(w http.ResponseWriter, r *http.Request) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"FindLocations\", w, r)\n}", "title": "" }, { "docid": "2de04de4bba54506de99fba5e6879532", "score": "0.50027347", "text": "func newTestOnboarderCreator(t *testing.T, mockedBaseHandlerOptions ...MockedHandlerOption) (*gomock.Controller, Onboarder, mocksCollection) {\n\n\tctrl := gomock.NewController(t)\n\tmockedBaseHandler := NewMockedHandler(createKeptn(), \"\", mockedBaseHandlerOptions...)\n\tmockedMesh := mocks.NewMockMesh(ctrl)\n\tmockedProjectHandler := mocks.NewMockIProjectHandler(ctrl)\n\tmockedNamespaceManager := mocks.NewMockINamespaceManager(ctrl)\n\tmockedStagesHandler := mocks.NewMockIStagesHandler(ctrl)\n\tmockedServiceHandler := mocks.NewMockIServiceHandler(ctrl)\n\tmockedChartStorer := mocks.NewMockIChartStorer(ctrl)\n\tmockedChartGenerator := mocks.NewMockChartGenerator(ctrl)\n\tmockedChartPackager := mocks.NewMockIChartPackager(ctrl)\n\n\tonboarder := onboarder{\n\t\tHandler: mockedBaseHandler,\n\t\tmesh: mockedMesh,\n\t\tprojectHandler: mockedProjectHandler,\n\t\tnamespaceManager: mockedNamespaceManager,\n\t\tstagesHandler: mockedStagesHandler,\n\t\tserviceHandler: mockedServiceHandler,\n\t\tchartStorer: mockedChartStorer,\n\t\tchartGenerator: mockedChartGenerator,\n\t\tchartPackager: mockedChartPackager,\n\t}\n\n\tmocksCol := mocksCollection{\n\t\tmockedBaseHandler: mockedBaseHandler,\n\t\tmockedMesh: mockedMesh,\n\t\tmockedProjectHandler: mockedProjectHandler,\n\t\tmockedNamespaceManager: mockedNamespaceManager,\n\t\tmockedStagesHandler: mockedStagesHandler,\n\t\tmockedServiceHandler: mockedServiceHandler,\n\t\tmockedChartStorer: mockedChartStorer,\n\t\tmockedChartGenerator: mockedChartGenerator,\n\t\tmockedChartPackager: mockedChartPackager,\n\t}\n\treturn ctrl, &onboarder, mocksCol\n\n}", "title": "" }, { "docid": "8bfb4e1118f77ecefb478bebdfb6a58d", "score": "0.50011504", "text": "func TestOnRegisterAndOnRemove(t *testing.T) {\n\t// Get the Multiton View instance\n\tvar view = view.GetInstance(\"ViewTestKey6\", func() interfaces.IView { return &view.View{Key: \"ViewTestKey6\"} })\n\n\t// Create and register the test mediator\n\tvar data = Data{}\n\tvar mediator interfaces.IMediator = &ViewTestMediator4{mediator.Mediator{Name: ViewTestMediator4_NAME, ViewComponent: &data}}\n\tview.RegisterMediator(mediator)\n\n\t// assert that onRegsiter was called, and the mediator responded by setting our boolean\n\tif data.onRegisterCalled != true {\n\t\tt.Error(\"Expecting data.onRegisterCalled == true\")\n\t}\n\n\t// Remove the component\n\tview.RemoveMediator(ViewTestMediator4_NAME)\n\n\t// assert that the mediator is no longer retrievable\n\tif data.onRemoveCalled != true {\n\t\tt.Error(\"Expecting onRemoveCalled == true\")\n\t}\n}", "title": "" }, { "docid": "0d1897a2d5bd381cc73d26b109fa582a", "score": "0.49952972", "text": "func (m *MockHomeView) Index(context ctx.Context, data HomeViewIndexData) {\n\tm.ctrl.Call(m, \"Index\", context, data)\n}", "title": "" }, { "docid": "c4fea97a451238e31eb09beb45d6638c", "score": "0.49937585", "text": "func (m *MockHomeView) Json(context ctx.Context, data JsonData) {\n\tm.ctrl.Call(m, \"Json\", context, data)\n}", "title": "" }, { "docid": "821a063d4c2f08372a9b33cbaa317f7c", "score": "0.49776018", "text": "func (m *MockFreelancerRepository) ListOnPattern(arg0 string) ([]model.ExtendFreelancer, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListOnPattern\", arg0)\n\tret0, _ := ret[0].([]model.ExtendFreelancer)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "89fb34b64b0957df01c16f5e65f0436d", "score": "0.4967255", "text": "func (m *MockExecutionResultViewPersistence) History(arg0 context.Context, arg1 string, arg2, arg3 gocql.UUID, arg4 int, arg5 bool) ([]*models.ExecutionResultView, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"History\", arg0, arg1, arg2, arg3, arg4, arg5)\n\tret0, _ := ret[0].([]*models.ExecutionResultView)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "b432a6421c71e0377a379f89f97bee47", "score": "0.49671718", "text": "func (m *MockPlaceController) FindRegions(w http.ResponseWriter, r *http.Request) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"FindRegions\", w, r)\n}", "title": "" }, { "docid": "f03c71936a6959dc0fc9b5d94689ad48", "score": "0.49581438", "text": "func (m *MockService) GetClusterView(arg0 context.Context) (View, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetClusterView\", arg0)\n\tret0, _ := ret[0].(View)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "b8b53fafb73c29801631d2be37e675b4", "score": "0.49524623", "text": "func TestRenderAddons(t *testing.T) {\n\ttestRenderAddonsForOrchestrator(t, \"kubernetes\")\n\ttestRenderAddonsForOrchestrator(t, \"openshift\")\n}", "title": "" }, { "docid": "acd9b11d1dcb770d49f096df47c50e4f", "score": "0.4951884", "text": "func TestGetAvailableVersions(t *testing.T) {\n\tmock := getMockComponentVersions()\n\tvar mockVersions []types.ComponentVersion\n\t_ = json.Unmarshal(mock, &mockVersions)\n\tversions, err := GetAvailableVersions(testAvailableVersions{})\n\tassert.NoErr(t, err)\n\tassert.Equal(t, versions, mockVersions, \"component versions data\")\n\tversions, err = GetAvailableVersions(shouldBypassAvailableVersions{})\n\tassert.NoErr(t, err)\n\tassert.Equal(t, versions, mockVersions, \"component versions data\")\n}", "title": "" }, { "docid": "6197147880582c29dd7f7b6d9b4480b0", "score": "0.49321198", "text": "func (m *MockComponentRepository) DependsOn(arg0 context.Context, arg1 []int) ([][]*model.Component, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"DependsOn\", arg0, arg1)\n\tret0, _ := ret[0].([][]*model.Component)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "a0497f57b9696b2e546774c3997d6bed", "score": "0.49200457", "text": "func TestRegisterAndRetrieveMediator(t *testing.T) {\n\t// Get the Multiton View instance\n\tvar view = view.GetInstance(\"ViewTestKey3\", func() interfaces.IView { return &view.View{Key: \"ViewTestKey3\"} })\n\n\t// Create and register the test mediator\n\tvar viewTestMediator interfaces.IMediator = &ViewTestMediator{Mediator: mediator.Mediator{Name: ViewTestMediator_NAME, ViewComponent: nil}}\n\tview.RegisterMediator(viewTestMediator)\n\n\t// Retrieve the component\n\tvar mediator = view.RetrieveMediator(ViewTestMediator_NAME)\n\n\t// test assertions\n\tif mediator != viewTestMediator {\n\t\tt.Error(\"Expecting mediator is ViewTestMediator\")\n\t}\n}", "title": "" }, { "docid": "00d6baf93d109d6ec19bb3ca9060fb6b", "score": "0.49030334", "text": "func (m *MockProvider) Clients() []uint32 {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Clients\")\n\tret0, _ := ret[0].([]uint32)\n\treturn ret0\n}", "title": "" }, { "docid": "2bad8f18954aba29c9d8df284e3ec7ca", "score": "0.48869982", "text": "func TestActiveTicketsExplorerPageHandler_ServeHTTP_ValidRequest(t *testing.T) {\n\tuserIsAuthenticated := false\n\tuserIsAdmin := false\n\tmockedTicketContext := new(mockedForTests.MockedTicketContext)\n\tmockedTemplateManager := new(templateManager.MockedTemplateManager)\n\n\ttestee := ActiveTicketsExplorerPageHandler{TicketContext: mockedTicketContext, TemplateManager: mockedTemplateManager,\n\t\tLogger: testhelpers.GetTestLogger()}\n\n\t// Only tickets with state processing should be shown.\n\ttestTickets := getTestTickets()\n\tvar expectedTicketData []ticketData.TicketInfo\n\tfor _, possibleTicket := range testTickets {\n\t\tif possibleTicket.State == ticketData.Processing {\n\t\t\texpectedTicketData = append(expectedTicketData, possibleTicket)\n\t\t}\n\t}\n\texpectedPageData := activeTicketsExplorerPageData{\n\t\tTickets: expectedTicketData,\n\t}\n\texpectedPageData.UserIsAdmin = userIsAdmin\n\texpectedPageData.UserIsAuthenticated = userIsAuthenticated\n\texpectedPageData.Active = \"active_tickets\"\n\n\tmockedTicketContext.On(\"GetAllTicketInfo\").Return(testTickets)\n\tmockedTemplateManager.On(\"RenderTemplate\", mock.Anything, \"TicketExplorerPage\", mock.AnythingOfType(\"activeTicketsExplorerPageData\")).\n\t\tReturn(nil)\n\n\treq, err := http.NewRequest(\"GET\", \"/active_tickets\", nil)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Execute the test:\n\trr := httptest.NewRecorder()\n\thandler := http.HandlerFunc(testee.ServeHTTP)\n\tctx := wrappers.NewContextWithAuthenticationInfo(req.Context(), userIsAuthenticated, userIsAdmin, -1, \"\")\n\thandler.ServeHTTP(rr, req.WithContext(ctx))\n\n\tresp := rr.Result()\n\n\tnewLocation := resp.Header.Get(\"location\")\n\tassert.Equal(t, http.StatusOK, resp.StatusCode, \"Should return status code 200\")\n\tassert.Equal(t, \"\", newLocation, \"Should not be redirected\")\n\n\tactualPageData := mockedTemplateManager.Calls[0].Arguments[2].(activeTicketsExplorerPageData)\n\tassert.Equal(t, expectedPageData.BasePageData, actualPageData.BasePageData, \"BasePageData should be correct\")\n\n\t// Assert that all tickets are included:\n\tassert.Equal(t, len(expectedPageData.Tickets), len(actualPageData.Tickets), \"All expected tickets should be included\")\n\n\tallTicketsIncluded := true\n\tfor _, expectedTicket := range expectedPageData.Tickets {\n\t\tcurrentTicketFound := false\n\t\tfor _, possibleTicket := range actualPageData.Tickets {\n\t\t\tif expectedTicket.Id == possibleTicket.Id {\n\t\t\t\tcurrentTicketFound = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif !currentTicketFound {\n\t\t\tallTicketsIncluded = false\n\t\t\tbreak\n\t\t}\n\t}\n\tassert.True(t, allTicketsIncluded, \"All expected tickets should be rendered.\")\n\n\tmockedTicketContext.AssertExpectations(t)\n\tmockedTemplateManager.AssertExpectations(t)\n}", "title": "" }, { "docid": "ea9bb1d3c0c29973f875b34bcbb3497d", "score": "0.48712647", "text": "func TestOnRegisterAndOnRemove(t *testing.T) {\n\t// Get a Multiton View instance\n\tvar model = model.GetInstance(\"ModelTestKey5\", func() interfaces.IModel { return &model.Model{Key: \"ModelTestKey5\"} })\n\n\t// Create and register the test mediator\n\tvar proxy interfaces.IProxy = &ModelTestProxy{proxy.Proxy{Name: MODEL_TEST_PROXY}}\n\tmodel.RegisterProxy(proxy)\n\n\t// assert that onRegsiter was called, and the proxy responded by setting its data accordingly\n\tif proxy.GetData() != ON_REGISTER_CALLED {\n\t\tt.Error(\"Expecting proxy.GetData() == ON_REGISTER_CALLED\")\n\t}\n\n\t// Remove the component\n\tmodel.RemoveProxy(MODEL_TEST_PROXY)\n\n\t// assert that onRemove was called, and the proxy responded by setting its data accordingly\n\tif proxy.GetData() != ON_REMOVE_CALLED {\n\t\tt.Error(\"Expecting proxy.GetData() == ON_REMOVE_CALLED\")\n\t}\n}", "title": "" }, { "docid": "f7cba8ca0e1a5a4bcd781e34404aea4e", "score": "0.48560286", "text": "func (m *MockCmdable) XInfoConsumers(ctx context.Context, key, group string) *v8.XInfoConsumersCmd {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"XInfoConsumers\", ctx, key, group)\n\tret0, _ := ret[0].(*v8.XInfoConsumersCmd)\n\treturn ret0\n}", "title": "" }, { "docid": "249517eafb82f1a5bcdc5e4deb142e3d", "score": "0.48531994", "text": "func (m *MockMounter) List() ([]mount_utils.MountPoint, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"List\")\n\tret0, _ := ret[0].([]mount_utils.MountPoint)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "daed5784f993eded950552af9c5f84a7", "score": "0.4847824", "text": "func (m *MockDockerClient) KnownVersions() []dockerclient.DockerVersion {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"KnownVersions\")\n\tret0, _ := ret[0].([]dockerclient.DockerVersion)\n\treturn ret0\n}", "title": "" }, { "docid": "9dbb454731f11d6c5d749eefcb6bdc45", "score": "0.48329908", "text": "func TestListBaseSuccessfully(t *testing.T) {\n\tbaseName := \"test-list-base\"\n\toffset := 4\n\tlimit := 4\n\tctx := context.Background()\n\t_, metaRepo, baseService, err := createTestSuite()\n\n\tassert.Nil(t, err)\n\tassert.NotNil(t, baseService)\n\n\t//var metaResp []*ent.Meta\n\n\tvar metaResp []*ent.MetaSchema\n\tmetaRespElement := &ent.MetaSchema{\n\t\tBase: baseName,\n\t}\n\tmetaResp = append(metaResp, metaRespElement)\n\tmockCount := 0\n\n\tmetaRepo.On(\"List\", ctx, offset, limit).Return(metaResp, nil)\n\tmetaRepo.On(\"Count\", ctx).Return(mockCount, nil)\n\n\tresp, getErr := baseService.List(ctx, offset, limit)\n\n\tassert.Nil(t, getErr)\n\tassert.NotEmpty(t, resp)\n}", "title": "" }, { "docid": "1c0b01440c148de64cf8b99b240942d7", "score": "0.48321384", "text": "func (f *Fetcher) FetchJobsByViews(params *Params) (*JobResponse, error) {\n\tvar header = make(map[string]string)\n\tif params.Username != \"\" && params.Password != \"\" {\n\t\tauth := params.Username + \":\" + params.Password\n\t\tauth = \"Basic \" + base64.StdEncoding.EncodeToString([]byte(auth))\n\t\theader[\"Authorization\"] = auth\n\t}\n\turl := fmt.Sprintf(\"%s/api/json\", params.JenkinsURL)\n\tstatusCode, body, err := f.HTTPClientProvider.Request(url, \"GET\", header, nil, nil)\n\tif err != nil || statusCode != http.StatusOK {\n\t\treturn nil, err\n\t}\n\tvar jobResponse JobResponse\n\tif err := jsoniter.Unmarshal(body, &jobResponse); err != nil {\n\t\treturn nil, errors.New(\"unable to unmarshal the job response\")\n\t}\n\treturn &jobResponse, nil\n}", "title": "" }, { "docid": "71a437f946747a9a710b570fd55e49b4", "score": "0.48320147", "text": "func TestBugAllViewsLoaded(t *testing.T) {\n\tdir, err := getTempDir()\n\tassert.Nil(t, err)\n\n\terr = LoadViews(dir+\"/a\", DefaultFuncMap)\n\tassert.Nil(t, err)\n\n\ttable := []struct {\n\t\tPurpose string\n\t\tName string\n\t\tExpBody string\n\t\tExpError error\n\t}{\n\t\t{\n\t\t\t\"1. OK\",\n\t\t\t\"all/all.html\",\n\t\t\t`before_index::I am lowercase-eqs:true::after_index.before_menu::menu::after_menu`,\n\t\t\tnil,\n\t\t},\n\t\t{\n\t\t\t\"2. OK\",\n\t\t\t\"index.html\",\n\t\t\t`I am lowercase-eqs:true`,\n\t\t\tnil,\n\t\t},\n\t\t{\n\t\t\t\"3. OK\",\n\t\t\t\"menu.html\",\n\t\t\t`menu`,\n\t\t\tnil,\n\t\t},\n\t}\n\tfor i := range table {\n\t\tx := table[i]\n\n\t\tw := httptest.NewRecorder()\n\t\terr := Render(w, x.Name, map[string]interface{}{\"x\": 1})\n\t\tassert.EqualValues(t, x.ExpError, err, x.Purpose)\n\n\t\tactual := w.Body.String()\n\t\tassert.EqualValues(t, x.ExpBody, actual, x.Purpose)\n\t}\n}", "title": "" }, { "docid": "16f38ed135c0017fb357b0476156c653", "score": "0.48201576", "text": "func (m *MockClient) GetAllPipelineReleasesCount(ctx context.Context, filters map[api.FilterType][]string) (int, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetAllPipelineReleasesCount\", ctx, filters)\n\tret0, _ := ret[0].(int)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "04f2d954d1c30505598b7cb55799daf9", "score": "0.48190817", "text": "func (_m *MockMap) Hosts() []Host {\n\tret := _m.ctrl.Call(_m, \"Hosts\")\n\tret0, _ := ret[0].([]Host)\n\treturn ret0\n}", "title": "" }, { "docid": "d65066a5477945e86fead51afcdbecb6", "score": "0.4811723", "text": "func (m *MockClient) GetAllPipelineBotsCount(ctx context.Context, filters map[api.FilterType][]string) (int, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetAllPipelineBotsCount\", ctx, filters)\n\tret0, _ := ret[0].(int)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "1231227172962f06d170b2867d2e7273", "score": "0.48015305", "text": "func (m *MockEquipmentHandler) AdminGetAll(w http.ResponseWriter, r *http.Request) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"AdminGetAll\", w, r)\n}", "title": "" }, { "docid": "f4b4b9ca1ee84d521cf5626e2ef225ff", "score": "0.4791106", "text": "func (m *MockStatefulCmdable) XInfoConsumers(ctx context.Context, key, group string) *v8.XInfoConsumersCmd {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"XInfoConsumers\", ctx, key, group)\n\tret0, _ := ret[0].(*v8.XInfoConsumersCmd)\n\treturn ret0\n}", "title": "" }, { "docid": "a9d976b9b1ab19f570c4d927d284ad16", "score": "0.47870225", "text": "func (m *UnitOfWork) Users() user.Repository {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Users\")\n\tret0, _ := ret[0].(user.Repository)\n\treturn ret0\n}", "title": "" }, { "docid": "15d54906f9313f9fad9b62dc084b3a7e", "score": "0.4782862", "text": "func (_m *ProductNoticesStore) GetViews(userID string) ([]model.ProductNoticeViewState, error) {\n\tret := _m.Called(userID)\n\n\tvar r0 []model.ProductNoticeViewState\n\tif rf, ok := ret.Get(0).(func(string) []model.ProductNoticeViewState); ok {\n\t\tr0 = rf(userID)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).([]model.ProductNoticeViewState)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(string) error); ok {\n\t\tr1 = rf(userID)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "cdb6cd3de686dcfaf450f88c06850f55", "score": "0.47720605", "text": "func (m *MockOperationsService) OperationsShow(arg0 context.Context, arg1, arg2 string) (*scalingo.Operation, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"OperationsShow\", arg0, arg1, arg2)\n\tret0, _ := ret[0].(*scalingo.Operation)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "2935fb5e5d70f111099ce8dbd8c463c2", "score": "0.47605467", "text": "func testDetailPageOperations(t *testing.T) {\n\n}", "title": "" }, { "docid": "497537106bc202d09bc5b83b95011083", "score": "0.47541192", "text": "func TestViewSysViewer(t *testing.T) {\n\tcrud := moc.NewLoadedCRUD()\n\thandler := createGqlHandler(crud)\n\tassert := assert.New(t)\n\n\t// login as sys admin\n\ttoken, _ := login(crud, getSysUserAccount().ID, \"none\")\n\n\t// prepare query\n\tquery := fmt.Sprintf(`\n\t\tquery{\n\t\t\tview(token: \"%s\"){\n\t\t\t\t... on SysViewer{\n\t\t\t\t\taccounts{\n\t\t\t\t\t\tname\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t`, token)\n\n\t// request\n\tresponse, err := gqlRequestAndRespond(handler, query, nil)\n\tfailOnError(assert, err)\n\n\t// expected\n\tlist := make([]map[string]interface{}, 0)\n\tfor _, acc := range moc.Accounts {\n\t\tlist = append(list, map[string]interface{}{\n\t\t\t\"name\": acc.Name,\n\t\t})\n\t}\n\texpected := map[string]interface{}{\n\t\t\"data\": map[string]interface{}{\n\t\t\t\"view\": map[string]interface{}{\n\t\t\t\t\"accounts\": list,\n\t\t\t},\n\t\t},\n\t}\n\n\t// use strings because it's easier to construct\n\t// the expected result than with actual types\n\texpectedStr := fmt.Sprintf(\"%s\", expected)\n\tactualStr := fmt.Sprintf(\"%s\", response)\n\n\tassert.Equal(expectedStr, actualStr, msgInvalidResult)\n}", "title": "" }, { "docid": "4f0f0eaa19582c4123f5711f1950fb02", "score": "0.47440085", "text": "func TestViewDocumentsLists(t *testing.T) {\n\tassert := assert.New(t)\n\tcrud := moc.NewLoadedCRUD()\n\thandler := createGqlHandler(crud)\n\n\t// login as sys\n\ttoken, _ := login(crud, getSysUserAccount().ID, \"none\")\n\n\t// prepare query\n\tquery := fmt.Sprintf(`\n\t\tquery{\n\t\t\tview(token: \"%s\"){\n\t\t\t\t... on SysViewer{\n\t\t\t\t\tdocuments{\n\t\t\t\t\t\tid\n\t\t\t\t\t\turl\n\t\t\t\t\t\tdoc_type\n\t\t\t\t\t\towner_type\n\t\t\t\t\t\towner_id\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t`, token)\n\n\t// request\n\tresponse, err := gqlRequestAndRespond(handler, query, nil)\n\tfailOnError(assert, err)\n\n\t// prepare expected\n\tdocuments := make([]interface{}, 0)\n\tfor _, doc := range moc.Documents {\n\t\tdocuments = append(documents, map[string]interface{}{\n\t\t\t\"id\": doc.ID.Hex(),\n\t\t\t\"owner_id\": doc.OwnerID.Hex(),\n\t\t\t\"owner_type\": doc.OwnerType,\n\t\t\t\"doc_type\": doc.DocType,\n\t\t\t\"url\": doc.URL,\n\t\t})\n\t}\n\texpected := map[string]interface{}{\n\t\t\"data\": map[string]interface{}{\n\t\t\t\"view\": map[string]interface{}{\n\t\t\t\t\"documents\": documents,\n\t\t\t},\n\t\t},\n\t}\n\n\tassert.Equal(expected, response, msgInvalidResponse)\n}", "title": "" }, { "docid": "55792f681fc53d061b64c8d3b32c8668", "score": "0.47303188", "text": "func NewExecutionResultViewRepoMock(isFilled bool) (repo models.ExecutionResultViewPersistence) {\n\tdata := make(map[gocql.UUID][]*models.ExecutionResultView)\n\n\tif isFilled {\n\t\tfor _, executionResultView := range TaskExecutionResultsView {\n\t\t\tif _, ok := data[executionResultView.ManagedEndpointID]; !ok {\n\t\t\t\tdata[executionResultView.ManagedEndpointID] = []*models.ExecutionResultView{}\n\t\t\t}\n\t\t\tdata[executionResultView.ManagedEndpointID] = append(data[executionResultView.ManagedEndpointID], &executionResultView)\n\t\t}\n\t}\n\treturn ExecutionResultViewRepoMock{\n\t\tdata: data,\n\t}\n}", "title": "" }, { "docid": "7578bf465dcc348088a7e241b8b33318", "score": "0.47294772", "text": "func (mr *MockViewSinkRepositoryMockRecorder) ComponentByViewSinks(ctx, viewSinks interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"ComponentByViewSinks\", reflect.TypeOf((*MockViewSinkRepository)(nil).ComponentByViewSinks), ctx, viewSinks)\n}", "title": "" }, { "docid": "694388b3fc9f04c4eae640faf8f2af4e", "score": "0.47230145", "text": "func BuildSpecs(parts int, views ...factable.MVTag) Specs {\n\tvar specs Specs\n\n\tspecs.Journals = append(specs.Journals,\n\t\tbrokertest.Journal(pb.JournalSpec{\n\t\t\tName: InputJournal,\n\t\t\tLabelSet: pb.MustLabelSet(\n\t\t\t\tlabels.MessageType, \"Quote\",\n\t\t\t\tlabels.ContentType, labels.ContentType_JSONLines,\n\t\t\t),\n\t\t}))\n\n\tfor _, view := range views {\n\t\tvar shard = &consumer.ShardSpec{\n\t\t\tId: consumer.ShardID(fmt.Sprintf(\"extractor-%d\", view)),\n\t\t\tSources: []consumer.ShardSpec_Source{{Journal: InputJournal}},\n\t\t\tRecoveryLogPrefix: \"recovery/logs\",\n\t\t\tHintPrefix: \"/hints/extractor\",\n\t\t\tMaxTxnDuration: time.Second,\n\t\t\tLabelSet: pb.MustLabelSet(\"mvTag\", fmt.Sprintf(\"%d\", view)),\n\t\t}\n\t\tspecs.ExtractorShards = append(specs.ExtractorShards, shard)\n\n\t\tspecs.Journals = append(specs.Journals,\n\t\t\tbrokertest.Journal(pb.JournalSpec{\n\t\t\t\tName: shard.RecoveryLog(),\n\t\t\t\tLabelSet: pb.MustLabelSet(labels.ContentType, labels.ContentType_RecoveryLog),\n\t\t\t}))\n\t}\n\tfor i := 0; i != parts; i++ {\n\t\tvar part = pb.Journal(fmt.Sprintf(\"deltas/part-%03d\", i))\n\n\t\tvar shard = &consumer.ShardSpec{\n\t\t\tId: consumer.ShardID(fmt.Sprintf(\"vtable-part-%03d\", i)),\n\t\t\tSources: []consumer.ShardSpec_Source{{Journal: part}},\n\t\t\tRecoveryLogPrefix: \"recovery/logs\",\n\t\t\tHintPrefix: \"/hints/vtable\",\n\t\t\tMaxTxnDuration: time.Second,\n\t\t}\n\t\tspecs.VTableShards = append(specs.VTableShards, shard)\n\n\t\tspecs.Journals = append(specs.Journals,\n\t\t\tbrokertest.Journal(pb.JournalSpec{\n\t\t\t\tName: part,\n\t\t\t\tLabelSet: pb.MustLabelSet(\n\t\t\t\t\tlabels.MessageType, \"DeltaEvent\",\n\t\t\t\t\tlabels.ContentType, labels.ContentType_JSONLines,\n\t\t\t\t),\n\t\t\t}),\n\t\t\tbrokertest.Journal(pb.JournalSpec{\n\t\t\t\tName: shard.RecoveryLog(),\n\t\t\t\tLabelSet: pb.MustLabelSet(labels.ContentType, labels.ContentType_RecoveryLog),\n\t\t\t}),\n\t\t)\n\t}\n\treturn specs\n}", "title": "" }, { "docid": "9d6b569a7334f3f670f14dc5301be301", "score": "0.47177052", "text": "func (m *MockClusterController) All() []*clustermgr.ClusterInfo {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"All\")\n\tret0, _ := ret[0].([]*clustermgr.ClusterInfo)\n\treturn ret0\n}", "title": "" }, { "docid": "ba2a920e056f210bdc17af2a547bdd7a", "score": "0.4712247", "text": "func (m *MockRouter) GET(relativePath string, handlers ...gin.HandlerFunc) gin.IRoutes {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{relativePath}\n\tfor _, a := range handlers {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"GET\", varargs...)\n\tret0, _ := ret[0].(gin.IRoutes)\n\treturn ret0\n}", "title": "" }, { "docid": "945973f0eeaa1124f4224bb1155666e2", "score": "0.47063044", "text": "func TestImplementations(t *testing.T) {\n\tfor _, test := range tests {\n\t\tt.Run(funcName(test), func(t *testing.T) {\n\t\t\tfor _, repoProvider := range implementations {\n\t\t\t\trepo := repoProvider()\n\t\t\t\tt.Run(implName(repo), func(t *testing.T) {\n\t\t\t\t\ttest(t, repo)\n\t\t\t\t})\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "047944b86fb9769a13b070c6d6ab3f9f", "score": "0.47019663", "text": "func TestMVCCHistories(t *testing.T) {\n\tdefer leaktest.AfterTest(t)()\n\tdefer log.Scope(t).Close(t)\n\n\tctx := context.Background()\n\n\t// Everything reads/writes under the same prefix.\n\tspan := roachpb.Span{Key: keys.LocalMax, EndKey: roachpb.KeyMax}\n\n\tdatadriven.Walk(t, \"testdata/mvcc_histories\", func(t *testing.T, path string) {\n\t\t// Default to random behavior wrt cluster version and separated\n\t\t// intents.\n\t\toldClusterVersion := rand.Intn(2) == 0\n\t\tenabledSeparated := rand.Intn(2) == 0\n\t\toverridden := false\n\t\tif strings.Contains(path, \"_disallow_separated\") {\n\t\t\toldClusterVersion = true\n\t\t\tenabledSeparated = false\n\t\t\toverridden = true\n\t\t}\n\t\tif strings.Contains(path, \"_allow_separated\") {\n\t\t\toldClusterVersion = false\n\t\t\tenabledSeparated = false\n\t\t\toverridden = true\n\t\t}\n\t\tif strings.Contains(path, \"_enable_separated\") {\n\t\t\toldClusterVersion = false\n\t\t\tenabledSeparated = true\n\t\t\toverridden = true\n\t\t}\n\t\tif !overridden {\n\t\t\tlog.Infof(context.Background(),\n\t\t\t\t\"randomly setting oldClusterVersion: %t, enableSeparated: %t\",\n\t\t\t\toldClusterVersion, enabledSeparated)\n\t\t}\n\t\tsettings := makeSettingsForSeparatedIntents(oldClusterVersion, enabledSeparated)\n\t\t// We start from a clean slate in every test file.\n\t\tengine := createTestPebbleEngineWithSettings(settings)\n\t\tdefer engine.Close()\n\n\t\treportDataEntries := func(buf *bytes.Buffer) error {\n\t\t\thasData := false\n\t\t\terr := engine.MVCCIterate(span.Key, span.EndKey, MVCCKeyAndIntentsIterKind, func(r MVCCKeyValue) error {\n\t\t\t\thasData = true\n\t\t\t\tif r.Key.Timestamp.IsEmpty() {\n\t\t\t\t\t// Meta is at timestamp zero.\n\t\t\t\t\tmeta := enginepb.MVCCMetadata{}\n\t\t\t\t\tif err := protoutil.Unmarshal(r.Value, &meta); err != nil {\n\t\t\t\t\t\tfmt.Fprintf(buf, \"meta: %v -> error decoding proto from %v: %v\\n\", r.Key, r.Value, err)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tfmt.Fprintf(buf, \"meta: %v -> %+v\\n\", r.Key, &meta)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tfmt.Fprintf(buf, \"data: %v -> %s\\n\", r.Key, roachpb.Value{RawBytes: r.Value}.PrettyPrint())\n\t\t\t\t}\n\t\t\t\treturn nil\n\t\t\t})\n\t\t\tif !hasData {\n\t\t\t\tbuf.WriteString(\"<no data>\\n\")\n\t\t\t}\n\t\t\treturn err\n\t\t}\n\n\t\te := newEvalCtx(ctx, engine)\n\n\t\tdatadriven.RunTest(t, path, func(t *testing.T, d *datadriven.TestData) string {\n\t\t\t// We'll be overriding cmd/cmdargs below, because the\n\t\t\t// datadriven reader does not know about sub-commands.\n\t\t\tdefer func(pos, cmd string, cmdArgs []datadriven.CmdArg) {\n\t\t\t\td.Pos = pos\n\t\t\t\td.Cmd = cmd\n\t\t\t\td.CmdArgs = cmdArgs\n\t\t\t}(d.Pos, d.Cmd, d.CmdArgs)\n\t\t\t// The various evalCtx helpers want access to the current test\n\t\t\t// and testdata structs.\n\t\t\te.t = t\n\t\t\te.td = d\n\n\t\t\tswitch d.Cmd {\n\t\t\tcase \"skip\":\n\t\t\t\tif len(d.CmdArgs) == 0 {\n\t\t\t\t\tskip.IgnoreLint(e.t, \"skipped\")\n\t\t\t\t}\n\t\t\t\treturn d.Expected\n\t\t\tcase \"run\":\n\t\t\t\t// Syntax: run [trace] [error]\n\t\t\t\t// (other words - in particular \"ok\" - are accepted but ignored)\n\t\t\t\t//\n\t\t\t\t// \"run\" executes a script of zero or more operations from\n\t\t\t\t// the commands library defined below.\n\t\t\t\t// It stops upon the first error encountered, if any.\n\t\t\t\t//\n\t\t\t\t// Options:\n\t\t\t\t// \"trace\" means detail each operation in the output.\n\t\t\t\t// \"error\" means expect an error to occur. The specific error type/\n\t\t\t\t// message to expect is spelled out in the expected output.\n\t\t\t\t//\n\t\t\t\ttrace := false\n\t\t\t\tif e.hasArg(\"trace\") {\n\t\t\t\t\ttrace = true\n\t\t\t\t}\n\t\t\t\texpectError := false\n\t\t\t\tif e.hasArg(\"error\") {\n\t\t\t\t\texpectError = true\n\t\t\t\t}\n\n\t\t\t\t// buf will accumulate the actual output, which the\n\t\t\t\t// datadriven driver will use to compare to the expected\n\t\t\t\t// output.\n\t\t\t\tvar buf bytes.Buffer\n\t\t\t\te.results.buf = &buf\n\t\t\t\te.results.traceIntentWrites = trace\n\n\t\t\t\t// foundErr remembers which error was last encountered while\n\t\t\t\t// executing the script under \"run\".\n\t\t\t\tvar foundErr error\n\n\t\t\t\t// pos is the original <file>:<lineno> prefix computed by\n\t\t\t\t// datadriven. It points to the top \"run\" command itself.\n\t\t\t\t// We editing d.Pos in-place below by extending `pos` upon\n\t\t\t\t// each new line of the script.\n\t\t\t\tpos := d.Pos\n\n\t\t\t\t// dataChange indicates whether some command in the script\n\t\t\t\t// has modified the stored data. When this becomes true, the\n\t\t\t\t// current content of storage is printed in the results\n\t\t\t\t// buffer at the end.\n\t\t\t\tdataChange := false\n\t\t\t\t// txnChange indicates whether some command has modified\n\t\t\t\t// a transaction object. When set, the last modified txn\n\t\t\t\t// object is reported in the result buffer at the end.\n\t\t\t\ttxnChange := false\n\n\t\t\t\treportResults := func(printTxn, printData bool) {\n\t\t\t\t\tif printTxn && e.results.txn != nil {\n\t\t\t\t\t\tfmt.Fprintf(&buf, \"txn: %v\\n\", e.results.txn)\n\t\t\t\t\t}\n\t\t\t\t\tif printData {\n\t\t\t\t\t\terr := reportDataEntries(&buf)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\tif foundErr == nil {\n\t\t\t\t\t\t\t\t// Handle the error below.\n\t\t\t\t\t\t\t\tfoundErr = err\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tfmt.Fprintf(&buf, \"error reading data: (%T:) %v\\n\", err, err)\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\n\t\t\t\t// sharedCmdArgs is updated by \"with\" pseudo-commands,\n\t\t\t\t// to pre-populate common arguments for the following\n\t\t\t\t// indented commands.\n\t\t\t\tvar sharedCmdArgs []datadriven.CmdArg\n\n\t\t\t\t// The lines of the script under \"run\".\n\t\t\t\tlines := strings.Split(d.Input, \"\\n\")\n\t\t\t\tfor i, line := range lines {\n\t\t\t\t\tif short := strings.TrimSpace(line); short == \"\" || strings.HasPrefix(short, \"#\") {\n\t\t\t\t\t\t// Comment or empty line. Do nothing.\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\t// Compute a line prefix, to clarify error message. We\n\t\t\t\t\t// prefix a newline character because some text editor do\n\t\t\t\t\t// not know how to jump to the location of an error if\n\t\t\t\t\t// there are multiple file:line prefixes on the same line.\n\t\t\t\t\td.Pos = fmt.Sprintf(\"\\n%s: (+%d)\", pos, i+1)\n\n\t\t\t\t\t// Trace the execution in testing.T, to clarify where we\n\t\t\t\t\t// are in case an error occurs.\n\t\t\t\t\tlog.Infof(context.Background(), \"TestMVCCHistories:\\n\\t%s: %s\", d.Pos, line)\n\n\t\t\t\t\t// Decompose the current script line.\n\t\t\t\t\tvar err error\n\t\t\t\t\td.Cmd, d.CmdArgs, err = datadriven.ParseLine(line)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\te.t.Fatalf(\"%s: %v\", d.Pos, err)\n\t\t\t\t\t}\n\n\t\t\t\t\t// Expand \"with\" commands:\n\t\t\t\t\t// with t=A\n\t\t\t\t\t// txn_begin\n\t\t\t\t\t// resolve_intent k=a\n\t\t\t\t\t// is equivalent to:\n\t\t\t\t\t// txn_begin t=A\n\t\t\t\t\t// resolve_intent k=a t=A\n\t\t\t\t\tisIndented := strings.TrimLeft(line, \" \\t\") != line\n\t\t\t\t\tif d.Cmd == \"with\" {\n\t\t\t\t\t\tif !isIndented {\n\t\t\t\t\t\t\t// Reset shared args.\n\t\t\t\t\t\t\tsharedCmdArgs = d.CmdArgs\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// Prefix shared args. We use prefix so that the\n\t\t\t\t\t\t\t// innermost \"with\" can override/shadow the outermost\n\t\t\t\t\t\t\t// \"with\".\n\t\t\t\t\t\t\tsharedCmdArgs = append(d.CmdArgs, sharedCmdArgs...)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t} else if isIndented {\n\t\t\t\t\t\t// line is indented. Inherit arguments.\n\t\t\t\t\t\tif len(sharedCmdArgs) == 0 {\n\t\t\t\t\t\t\t// sanity check.\n\t\t\t\t\t\t\te.Fatalf(\"indented command without prior 'with': %s\", line)\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// We prepend the args that are provided on the command\n\t\t\t\t\t\t// itself so it's possible to override those provided\n\t\t\t\t\t\t// via \"with\".\n\t\t\t\t\t\td.CmdArgs = append(d.CmdArgs, sharedCmdArgs...)\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// line is not indented. Clear shared arguments.\n\t\t\t\t\t\tsharedCmdArgs = nil\n\t\t\t\t\t}\n\n\t\t\t\t\tcmd := e.getCmd()\n\t\t\t\t\ttxnChange = txnChange || cmd.typ == typTxnUpdate\n\t\t\t\t\tdataChange = dataChange || cmd.typ == typDataUpdate\n\n\t\t\t\t\tif trace {\n\t\t\t\t\t\t// If tracing is also requested by the datadriven input,\n\t\t\t\t\t\t// we'll trace the statement in the actual results too.\n\t\t\t\t\t\tfmt.Fprintf(&buf, \">> %s\", d.Cmd)\n\t\t\t\t\t\tfor i := range d.CmdArgs {\n\t\t\t\t\t\t\tfmt.Fprintf(&buf, \" %s\", &d.CmdArgs[i])\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbuf.WriteByte('\\n')\n\t\t\t\t\t}\n\n\t\t\t\t\t// Run the command.\n\t\t\t\t\tfoundErr = cmd.fn(e)\n\n\t\t\t\t\tif trace {\n\t\t\t\t\t\t// If tracing is enabled, we report the intermediate results\n\t\t\t\t\t\t// after each individual step in the script.\n\t\t\t\t\t\t// This may modify foundErr too.\n\t\t\t\t\t\treportResults(cmd.typ == typTxnUpdate, cmd.typ == typDataUpdate)\n\t\t\t\t\t}\n\n\t\t\t\t\tif foundErr != nil {\n\t\t\t\t\t\t// An error occurred. Stop the script prematurely.\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// End of script.\n\n\t\t\t\tif !trace {\n\t\t\t\t\t// If we were not tracing, no results were printed yet. Do it now.\n\t\t\t\t\tif txnChange || dataChange {\n\t\t\t\t\t\tbuf.WriteString(\">> at end:\\n\")\n\t\t\t\t\t}\n\t\t\t\t\treportResults(txnChange, dataChange)\n\t\t\t\t}\n\n\t\t\t\tsignalError := e.t.Errorf\n\t\t\t\tif txnChange || dataChange {\n\t\t\t\t\t// We can't recover from an error and continue\n\t\t\t\t\t// to proceed further tests, because the state\n\t\t\t\t\t// may have changed from what the test may be expecting.\n\t\t\t\t\tsignalError = e.t.Fatalf\n\t\t\t\t}\n\n\t\t\t\t// Check for errors.\n\t\t\t\tif foundErr == nil && expectError {\n\t\t\t\t\tsignalError(\"%s: expected error, got success\", d.Pos)\n\t\t\t\t\treturn d.Expected\n\t\t\t\t} else if foundErr != nil {\n\t\t\t\t\tif expectError {\n\t\t\t\t\t\tfmt.Fprintf(&buf, \"error: (%T:) %v\\n\", foundErr, foundErr)\n\t\t\t\t\t} else /* !expectError */ {\n\t\t\t\t\t\tsignalError(\"%s: expected success, found: (%T:) %v\", d.Pos, foundErr, foundErr)\n\t\t\t\t\t\treturn d.Expected\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// We're done. Report the actual results and errors to the\n\t\t\t\t// datadriven executor.\n\t\t\t\treturn buf.String()\n\n\t\t\tdefault:\n\t\t\t\te.t.Errorf(\"%s: unknown command: %s\", d.Pos, d.Cmd)\n\t\t\t\treturn d.Expected\n\t\t\t}\n\t\t})\n\t})\n}", "title": "" }, { "docid": "bb5aa135591412a6cccb153517e0d81e", "score": "0.4692453", "text": "func TestBcftoolsViewGetCommand(t *testing.T) {\n\tfor _, tc := range bcftoolsViewGetCommandTC {\n\t\tbcftoolsView := BcftoolsView()\n\t\tbcftoolsView.SetFilePath(tc.filepath)\n\t\tbcftoolsView.SetHeaderOnly(tc.headerOnly)\n\t\tbcftoolsView.SetRegion(tc.region)\n\t\tcommand := bcftoolsView.GetCommand()\n\t\tassert.Equal(t, \"bcftools\", command.baseCommand)\n\t\tassert.Equal(t, tc.expArgs, command.GetArgs())\n\t}\n}", "title": "" }, { "docid": "fe49b0df41efb337a48962e4fff2b9ee", "score": "0.4692053", "text": "func (m *MockRepoProduct) Search(functions ...func() error) ([]domain.Product, error) {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{}\n\tfor _, a := range functions {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"Search\", varargs...)\n\tret0, _ := ret[0].([]domain.Product)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "6b94308a36c8947d70c8ac279ecf4d57", "score": "0.46917453", "text": "func (m *MockUseInterface) GetAllUsers() ([]models.AnotherUser, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetAllUsers\")\n\tret0, _ := ret[0].([]models.AnotherUser)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "cf260bf61db8d4ccf7eec875122eef50", "score": "0.46849534", "text": "func (m *MockHttpProtocol) Params() []httprouter.Param {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Params\")\n\tret0, _ := ret[0].([]httprouter.Param)\n\treturn ret0\n}", "title": "" }, { "docid": "76f4bbb9f796b5e5385bb5b10563443a", "score": "0.46847972", "text": "func Test_Controller(t *testing.T) {\n\n\ttests := []struct {\n\t\tname string\n\t\texpectedParams int\n\t\texpectedUsecaseResponse []byte\n\t\texpectUsecaseCall bool\n\t\texpectedError error\n\t\twantError bool\n\t}{\n\t\t{\n\t\t\tname: \"OK, FindUserbyId\",\n\t\t\texpectedParams: 1,\n\t\t\texpectedUsecaseResponse: []byte(`[{\"id\": 2, \"gender\": \"female\", \"title\": \"Mrs\", \"first\": \"Rebecca\", \"last\": \"Stevens\", \"email\": \"rebecca.stevens@example.com\", \"cell\": \"0420-442-682\", \"nat\": \"AU\"}]`),\n\t\t\texpectUsecaseCall: true,\n\t\t\twantError: false,\n\t\t\texpectedError: nil,\n\t\t},\n\t}\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\tmockCtrl := gomock.NewController(t)\n\t\t\tdefer mockCtrl.Finish()\n\n\t\t\tu := mocks.NewMockUseCase(mockCtrl)\n\n\t\t\tif tt.expectUsecaseCall {\n\t\t\t\tu.EXPECT().FindUserById(tt.expectedParams).Return(tt.expectedUsecaseResponse, tt.expectedError)\n\t\t\t}\n\n\t\t\tc := New(u)\n\n\t\t\tresponse, err := c.useCase.FindUserById(tt.expectedParams)\n\t\t\tassert.Equal(t, response, tt.expectedUsecaseResponse)\n\n\t\t\tif tt.wantError {\n\t\t\t\tassert.NotNil(t, err)\n\t\t\t\tassert.Equal(t, err, tt.expectedError)\n\t\t\t} else {\n\t\t\t\tassert.Nil(t, err)\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "fae1171f9c1ca2dccd5695e76d5ba4bc", "score": "0.4683044", "text": "func (m *TerraformProvider) ResourceComponents(arg0 terraform.Resource) []query.Component {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ResourceComponents\", arg0)\n\tret0, _ := ret[0].([]query.Component)\n\treturn ret0\n}", "title": "" }, { "docid": "b809a28fc1d226a03e8d3810cb964af9", "score": "0.46811408", "text": "func (m *MockIController) GetUserView(ctx context.Context, id go_uuid.UUID) *models.UserView {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetUserView\", ctx, id)\n\tret0, _ := ret[0].(*models.UserView)\n\treturn ret0\n}", "title": "" }, { "docid": "3901db105f731f8373c49d8a91d5da78", "score": "0.46694323", "text": "func (m *MockSaaSActionResourceTypeManager) ListByActionSystem(actionSystem string) ([]sdao.SaaSActionResourceType, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListByActionSystem\", actionSystem)\n\tret0, _ := ret[0].([]sdao.SaaSActionResourceType)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "1e07c49c2390ddb6cd1ee9178b987299", "score": "0.46670395", "text": "func (m *MockKubeContextDecorator) Contexts() []kubeconfig.Context {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Contexts\")\n\tret0, _ := ret[0].([]kubeconfig.Context)\n\treturn ret0\n}", "title": "" }, { "docid": "fc36d4e42a6490a84ef0c73214d7acfd", "score": "0.466541", "text": "func (m *MockDeployer) List(ctx context.Context, name string) ([]types.Service, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"List\", ctx, name)\n\tret0, _ := ret[0].([]types.Service)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "e52155a2ccb13f6556f9ce2850fd3ea1", "score": "0.46619767", "text": "func (m *MockExecutionStore) ListConcreteExecutions(ctx context.Context, request *persistence.ListConcreteExecutionsRequest) (*persistence.InternalListConcreteExecutionsResponse, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListConcreteExecutions\", ctx, request)\n\tret0, _ := ret[0].(*persistence.InternalListConcreteExecutionsResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "9b0587f35143a44c140f25283b02a0e7", "score": "0.46416262", "text": "func (m *UnitOfWork) Routes() route.Repository {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Routes\")\n\tret0, _ := ret[0].(route.Repository)\n\treturn ret0\n}", "title": "" }, { "docid": "44ef044f88e2570b5f4c60a7c5f3157f", "score": "0.46401852", "text": "func (m *MockCmdable) XInfoConsumers(arg0 context.Context, arg1, arg2 string) *redis.XInfoConsumersCmd {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"XInfoConsumers\", arg0, arg1, arg2)\n\tret0, _ := ret[0].(*redis.XInfoConsumersCmd)\n\treturn ret0\n}", "title": "" }, { "docid": "2a080ac38c26a37d3121a8f01a522309", "score": "0.46395755", "text": "func (m *MockUserUseCase) SearchUsers(arg0 int, arg1 string) ([]models.Person, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"SearchUsers\", arg0, arg1)\n\tret0, _ := ret[0].([]models.Person)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "09695953c3adaae651973a272177a42e", "score": "0.46370485", "text": "func (m *MockUserRepository) SearchUsers(arg0 int, arg1, arg2 string) ([]models.Person, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"SearchUsers\", arg0, arg1, arg2)\n\tret0, _ := ret[0].([]models.Person)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "e1606588458b68b33247de8d2f2f6a95", "score": "0.4637015", "text": "func (m *MockInfra) List(ctx context.Context, name string) ([]types.Service, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"List\", ctx, name)\n\tret0, _ := ret[0].([]types.Service)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "2a10e0daf255da97e1b5c23480385242", "score": "0.46343508", "text": "func TestViewRecruitList(t *testing.T) {\n\tassert := assert.New(t)\n\tcrud := moc.NewLoadedCRUD()\n\thandler := createGqlHandler(crud)\n\n\t// login as sys user\n\ttoken, _ := login(crud, getSysUserAccount().ID, \"none\")\n\n\t// prepare query\n\tquery := fmt.Sprintf(`\n\t\tquery {\n\t\t\tview(token: \"%s\"){\n\t\t\t\t... on SysViewer{\n\t\t\t\t\trecruits{\n\t\t\t\t\t\tid,\n\t\t\t\t\t\temail,\n\t\t\t\t\t\tphone,\n\t\t\t\t\t\temail\n\t\t\t\t\t\tprovince,\n\t\t\t\t\t\tcity,\n\t\t\t\t\t\tdisability,\n\t\t\t\t\t\tgender,\n\t\t\t\t\t\tvid1_url,\n\t\t\t\t\t\tvid2_url,\n\t\t\t\t\t\tage,\n\t\t\t\t\t\tqa1{\n\t\t\t\t\t\t\tquestion\n\t\t\t\t\t\t\tanswer\n\t\t\t\t\t\t},\n\t\t\t\t\t\tqa2{\n\t\t\t\t\t\t\tquestion\n\t\t\t\t\t\t\tanswer\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t`, token)\n\n\t// request\n\tresponse, err := gqlRequestAndRespond(handler, query, nil)\n\tfailOnError(assert, err)\n\n\t// prepare expected\n\tyear := int32(time.Now().Year())\n\trecruits := make([]interface{}, 0)\n\tfor _, r := range moc.Recruits {\n\t\trecruits = append(recruits, map[string]interface{}{\n\t\t\t\"id\": r.ID.Hex(),\n\t\t\t\"email\": r.Email,\n\t\t\t\"phone\": r.Phone,\n\t\t\t\"province\": r.Province,\n\t\t\t\"city\": r.City,\n\t\t\t\"gender\": r.Gender,\n\t\t\t\"disability\": r.Disability,\n\t\t\t\"vid1_url\": r.Vid1Url,\n\t\t\t\"vid2_url\": r.Vid2Url,\n\t\t\t\"age\": float64(year - r.BirthYear),\n\t\t\t\"qa1\": map[string]interface{}{\n\t\t\t\t\"question\": r.Qa1.Question,\n\t\t\t\t\"answer\": r.Qa1.Answer,\n\t\t\t},\n\t\t\t\"qa2\": map[string]interface{}{\n\t\t\t\t\"question\": r.Qa2.Question,\n\t\t\t\t\"answer\": r.Qa2.Answer,\n\t\t\t},\n\t\t})\n\t}\n\texpected := map[string]interface{}{\n\t\t\"data\": map[string]interface{}{\n\t\t\t\"view\": map[string]interface{}{\n\t\t\t\t\"recruits\": recruits,\n\t\t\t},\n\t\t},\n\t}\n\n\tassert.Equal(expected, response, msgInvalidResult)\n}", "title": "" }, { "docid": "0a034ab7f579c2804f5a2b1c5597fb37", "score": "0.46337277", "text": "func (m *MockArticleRepo) FetchAll(ctx context.Context, articleViews *[]model.Article) error {\n\tret := m.Called(ctx, articleViews)\n\treturn ret.Error(0)\n}", "title": "" }, { "docid": "427ac4fdd38af23f3148edd22dd35725", "score": "0.46247062", "text": "func (m *MockCatalog) Plugins() []*catalog.ManagedPlugin {\n\tret := m.ctrl.Call(m, \"Plugins\")\n\tret0, _ := ret[0].([]*catalog.ManagedPlugin)\n\treturn ret0\n}", "title": "" }, { "docid": "d43761bbf39a559929fcc30165d73c7c", "score": "0.46203542", "text": "func (m *MockUserHandler) GetAllGroupByGrade(w http.ResponseWriter, r *http.Request) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"GetAllGroupByGrade\", w, r)\n}", "title": "" }, { "docid": "0621e25cc849aabf9fe70aacbf0b415c", "score": "0.461683", "text": "func (m *MockStore) ListServices(appName string) ([]*config.Workload, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListServices\", appName)\n\tret0, _ := ret[0].([]*config.Workload)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "505d09caaf57429fe169776ac1394c28", "score": "0.46133664", "text": "func TestViewAndTableUnique(t *testing.T) {\n\tclient := framework.NewClient()\n\n\tclient.UpdateContext(callerid.NewContext(\n\t\tcontext.Background(),\n\t\t&vtrpcpb.CallerID{},\n\t\t&querypb.VTGateCallerID{Username: \"dev\"}))\n\n\tdefer func() {\n\t\t_, _ = client.Execute(\"drop view if exists vitess_view\", nil)\n\t\t_, _ = client.Execute(\"drop table if exists vitess_view\", nil)\n\t}()\n\n\t// create a view.\n\t_, err := client.Execute(\"create view vitess_view as select * from vitess_a\", nil)\n\trequire.NoError(t, err)\n\n\t// should error on create table as view already exists with same name.\n\t_, err = client.Execute(\"create table vitess_view(id bigint primary key)\", nil)\n\trequire.ErrorContains(t, err, \"Table 'vitess_view' already exists\")\n\n\t// drop the view\n\t_, err = client.Execute(\"drop view vitess_view\", nil)\n\trequire.NoError(t, err)\n\n\t// create the table first.\n\t_, err = client.Execute(\"create table vitess_view(id bigint primary key)\", nil)\n\trequire.NoError(t, err)\n\n\t// create view should fail as table already exists with same name.\n\t_, err = client.Execute(\"create view vitess_view as select * from vitess_a\", nil)\n\trequire.ErrorContains(t, err, \"Table 'vitess_view' already exists\")\n}", "title": "" }, { "docid": "c9eb5409994071cc2ea90fd90d9767e1", "score": "0.46110922", "text": "func (m *MockMessage) GetAllForChat(arg0 string) ([]*model.Message, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetAllForChat\", arg0)\n\tret0, _ := ret[0].([]*model.Message)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "a67c54adc59306a641328dab773d424f", "score": "0.46051612", "text": "func TestBcftoolsViewSetFilePath(t *testing.T) {\n\tfor _, tc := range bcftoolsViewSetFilePathTC {\n\t\tbcftoolsView := BcftoolsView()\n\t\tbcftoolsView.SetFilePath(tc.filepath)\n\t\tassert.Equal(t, bcftoolsView.filePath, tc.filepath)\n\t}\n}", "title": "" }, { "docid": "1804b63e054a662e33a85622fe51a271", "score": "0.4604596", "text": "func (m *MockUserRepository) ListUsers(arg0 repository.Matcher) ([]models.UserInfo, error) {\n\tret := m.ctrl.Call(m, \"ListUsers\", arg0)\n\tret0, _ := ret[0].([]models.UserInfo)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "c98814f6c674e9c96041cf664d866507", "score": "0.46011767", "text": "func (m *MockINode) GetContractsByBlock(arg0 int64) ([]string, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetContractsByBlock\", arg0)\n\tret0, _ := ret[0].([]string)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "680e30ae6b2e03f08631cac9b3d9a3cb", "score": "0.45891884", "text": "func (m *MockINamingProxy) QueryInstancesOfService(serviceName, groupName, clusters string, udpPort int, healthyOnly bool) (*model.Service, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"QueryInstancesOfService\", serviceName, groupName, clusters, udpPort, healthyOnly)\n\tret0, _ := ret[0].(*model.Service)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "ed8ed092b1479cc87de7ef079e2d0d0e", "score": "0.4589029", "text": "func (m *MockPeerMgr) List(ctx context.Context, filter *util.PageFilter) ([]*types.PeerInfo, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"List\", ctx, filter)\n\tret0, _ := ret[0].([]*types.PeerInfo)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "ba559f0d2aea42b17bdf7130f1f57110", "score": "0.45769653", "text": "func (m *MockAction) URL(accessToken ...string) string {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{}\n\tfor _, a := range accessToken {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"URL\", varargs...)\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}", "title": "" }, { "docid": "ee53a6624dabf87483b7d92069fff871", "score": "0.4575122", "text": "func (m *MockTemplateServiceServer) Render(arg0 context.Context, arg1 *rpc.RenderingRequest) (*rpc.RenderingResponse, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Render\", arg0, arg1)\n\tret0, _ := ret[0].(*rpc.RenderingResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "f5409ac273c73e5ee225f197d3d6316c", "score": "0.45705712", "text": "func (_m *MockMap) HostsLen() int {\n\tret := _m.ctrl.Call(_m, \"HostsLen\")\n\tret0, _ := ret[0].(int)\n\treturn ret0\n}", "title": "" }, { "docid": "42e0d55f4a502faca5652c88cb630de6", "score": "0.45659208", "text": "func TestDoView(t *testing.T) {\n\tConvey(\"Given 用户在阅读\", t, func() {\n\t\tip := \"127.0.0.1\"\n\t\tua := \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36\"\n\t\ttitle := \"golang 网络框架之 grpc\"\n\n\t\tConvey(\"When 浏览了一次\", func() {\n\t\t\terr := DoView(ip, ua, title)\n\t\t\tSo(err, ShouldBeNil)\n\t\t\tConvey(\"Then 数据库里面应该有一条记录\", func() {\n\t\t\t\tvar count int\n\t\t\t\tdb.Model(&View{}).Where(&View{Ip: ip, Ua: ua, Title: title}).Count(&count)\n\t\t\t\tSo(count, ShouldEqual, 1)\n\t\t\t})\n\t\t})\n\n\t\tConvey(\"When 又浏览了一次\", func() {\n\t\t\terr := DoView(ip, ua, title)\n\t\t\tSo(err, ShouldBeNil)\n\t\t\tConvey(\"Then 数据库里面应该还是一条记录\", func() {\n\t\t\t\tvar count int\n\t\t\t\tdb.Model(&View{}).Where(&View{Ip: ip, Ua: ua, Title: title}).Count(&count)\n\t\t\t\tSo(count, ShouldEqual, 2)\n\t\t\t})\n\t\t})\n\n\t\t//Convey(\"Finally 删除记录\", func() {\n\t\t//\tdb.Where(&View{Ip: ip, Ua: ua, Title: title}).Delete(View{})\n\t\t//})\n\t})\n}", "title": "" }, { "docid": "52a3e826a448ee35502db82a65d9b443", "score": "0.4564603", "text": "func (m *MockauthService) ShowClusters(ctx context.Context, path string) (*http.Response, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ShowClusters\", ctx, path)\n\tret0, _ := ret[0].(*http.Response)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "237354e55bf46ea8ae26f4a272640af0", "score": "0.45631006", "text": "func (_m *Database) View(ctx context.Context, name string) (driver.View, error) {\n\tret := _m.Called(ctx, name)\n\n\tvar r0 driver.View\n\tif rf, ok := ret.Get(0).(func(context.Context, string) driver.View); ok {\n\t\tr0 = rf(ctx, name)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(driver.View)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(context.Context, string) error); ok {\n\t\tr1 = rf(ctx, name)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "644646c9391bb3e0811cbd999fa11099", "score": "0.45504525", "text": "func (m *MockEngine) Nodes(isInternal bool, tenant, username string, cnLabel map[string]string) (engine.Nodes, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Nodes\", isInternal, tenant, username, cnLabel)\n\tret0, _ := ret[0].(engine.Nodes)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "7d68f4b6ddb680fada1d4cbb8d6de1e5", "score": "0.4546925", "text": "func (m *MockDockerClient) ListPluginsWithFilters(arg0 context.Context, arg1 bool, arg2 []string, arg3 time.Duration) ([]string, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListPluginsWithFilters\", arg0, arg1, arg2, arg3)\n\tret0, _ := ret[0].([]string)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" } ]
f7ccfadd5beabc6b22bd858b5880fc56
GetVoter returns voter info given a voter name from blockchain.
[ { "docid": "c3ec86ce84b7abd6b065e808ea97abf6", "score": "0.7550349", "text": "func (query *Query) GetVoter(ctx context.Context, voterName string) (*model.Voter, error) {\n\tresp, err := query.transport.Query(ctx, getVoterKey(voterName), VoteKVStoreKey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvoter := new(model.Voter)\n\tif err := query.transport.Cdc.UnmarshalJSON(resp, voter); err != nil {\n\t\treturn nil, err\n\t}\n\treturn voter, nil\n}", "title": "" } ]
[ { "docid": "e4adb837cf1220fa62dde88195103621", "score": "0.6990146", "text": "func (vs VoteStorage) GetVoter(ctx sdk.Context, accKey types.AccountKey) (*Voter, sdk.Error) {\n\tstore := ctx.KVStore(vs.key)\n\tvoterByte := store.Get(GetVoterKey(accKey))\n\tif voterByte == nil {\n\t\treturn nil, ErrVoterNotFound()\n\t}\n\tvoter := new(Voter)\n\tif err := vs.cdc.UnmarshalJSON(voterByte, voter); err != nil {\n\t\treturn nil, ErrFailedToUnmarshalVoter(err)\n\t}\n\treturn voter, nil\n}", "title": "" }, { "docid": "e8189a8eb41a6f907f72c369f9dab424", "score": "0.56005234", "text": "func (query *Query) GetVote(ctx context.Context, proposalID, voter string) (*model.Vote, error) {\n\tresp, err := query.transport.Query(ctx, getVoteKey(proposalID, voter), VoteKVStoreKey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvote := new(model.Vote)\n\tif err := query.transport.Cdc.UnmarshalJSON(resp, vote); err != nil {\n\t\treturn nil, err\n\t}\n\treturn vote, nil\n}", "title": "" }, { "docid": "3ccc2c0626eb0cbc4deb110a98abcc3f", "score": "0.5575352", "text": "func GetVote(context *gin.Context) {\r\n\t// parse param\r\n\tvoteID := context.Param(\"voteID\")\r\n\r\n\taddress := model.GetVoteAddress(voteID)\r\n\r\n\t// get state data\r\n\tstateResponse, err := connector.GetStates(&connector.StateOptions{Address: address})\r\n\tif err != nil {\r\n\t\tcontext.JSON(http.StatusBadRequest, gin.H{\"error\": \"Failed to get state: \" + err.Error()})\r\n\t\treturn\r\n\t}\r\n\tif len(stateResponse.Data) < 1 {\r\n\t\tcontext.JSON(http.StatusOK, gin.H{\"data\": nil})\r\n\t\treturn\r\n\t}\r\n\r\n\tvote := &voting.Vote{}\r\n\terr = proto.Unmarshal(stateResponse.Data[0], vote)\r\n\tif err != nil {\r\n\t\tcontext.JSON(http.StatusBadRequest, gin.H{\"error\": \"Failed to decode state: \" + err.Error()})\r\n\t\treturn\r\n\t}\r\n\r\n\t// success\r\n\tcontext.JSON(http.StatusOK, gin.H{\r\n\t\t\"data\": vote,\r\n\t})\r\n\treturn\r\n}", "title": "" }, { "docid": "f429176aa38b5c5a0fc8c60a3f9749bb", "score": "0.55469775", "text": "func (vs VoteStorage) GetVote(ctx sdk.Context, proposalID types.ProposalKey, voter types.AccountKey) (*Vote, sdk.Error) {\n\tstore := ctx.KVStore(vs.key)\n\tvoteByte := store.Get(GetVoteKey(proposalID, voter))\n\tif voteByte == nil {\n\t\treturn nil, ErrVoteNotFound()\n\t}\n\tvote := new(Vote)\n\tif err := vs.cdc.UnmarshalJSON(voteByte, vote); err != nil {\n\t\treturn nil, ErrFailedToUnmarshalVote(err)\n\t}\n\treturn vote, nil\n}", "title": "" }, { "docid": "8596eec5640a5f79d318c7a4c0488ad8", "score": "0.55249906", "text": "func (l *LatestVotes[EntityIndex, VotePowerType]) Voter() identity.ID {\n\tl.m.RLock()\n\tdefer l.m.RUnlock()\n\n\treturn l.voter\n}", "title": "" }, { "docid": "8c350dd7ed2cd78261bc5d29d81aff48", "score": "0.54564464", "text": "func (_TomoValidator *TomoValidatorCaller) GetVoterCap(opts *bind.CallOpts, _candidate common.Address, _voter common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _TomoValidator.contract.Call(opts, out, \"getVoterCap\", _candidate, _voter)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "4357ea8f1cb6fa35af75cf7f94bc0aca", "score": "0.5363422", "text": "func (db *wiredDB) GetVoteInfo(txid string) (*apitypes.VoteInfo, error) {\n\ttxhash, err := chainhash.NewHashFromStr(txid)\n\tif err != nil {\n\t\tlog.Errorf(\"Invalid transaction hash %s\", txid)\n\t\treturn nil, nil\n\t}\n\n\ttx, err := db.client.GetRawTransaction(txhash)\n\tif err != nil {\n\t\tlog.Errorf(\"GetRawTransaction failed for: %v\", txhash)\n\t\treturn nil, nil\n\t}\n\n\tvalidation, version, bits, choices, err := txhelpers.SSGenVoteChoices(tx.MsgTx(), db.params)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvinfo := &apitypes.VoteInfo{\n\t\tValidation: apitypes.BlockValidation{\n\t\t\tHash: validation.Hash.String(),\n\t\t\tHeight: validation.Height,\n\t\t\tValidity: validation.Validity,\n\t\t},\n\t\tVersion: version,\n\t\tBits: bits,\n\t\tChoices: choices,\n\t}\n\treturn vinfo, nil\n}", "title": "" }, { "docid": "1ae5005fd9bde7389b93a3771bf143ce", "score": "0.53535545", "text": "func get_veterinary(stub shim.ChaincodeStubInterface, id string) (Veterinary, error) {\n\tvar vet Veterinary\n\tvetAsBytes, err := stub.GetState(id) //getState retreives a key/value from the ledger\n\tif err != nil { //this seems to always succeed, even if key didn't exist\n\t\treturn vet, errors.New(\"Failed to get vet - \" + id)\n\t}\n\tjson.Unmarshal(vetAsBytes, &vet) //un stringify it aka JSON.parse()\n\n\tif len(vet.PracticeName) == 0 { //test if owner is actually here or just nil\n\t\treturn vet, errors.New(\"Vet does not exist - \" + id + \", '\" + vet.PracticeName)\n\t}\n\t\n\treturn vet, nil\n}", "title": "" }, { "docid": "5a6086476f44ee0fed0175b6a63d8516", "score": "0.5313128", "text": "func (_TomoValidator *TomoValidatorSession) GetVoterCap(_candidate common.Address, _voter common.Address) (*big.Int, error) {\n\treturn _TomoValidator.Contract.GetVoterCap(&_TomoValidator.CallOpts, _candidate, _voter)\n}", "title": "" }, { "docid": "02357f4b7f4df80fd09833d0db45af4e", "score": "0.5296974", "text": "func (keeper Keeper) GetVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.AccAddress) (Vote, bool) {\n\tstore := ctx.KVStore(keeper.storeKey)\n\tbz := store.Get(KeyVote(proposalID, voterAddr))\n\tif bz == nil {\n\t\treturn Vote{}, false\n\t}\n\tvar vote Vote\n\tkeeper.cdc.MustUnmarshalBinaryLengthPrefixed(bz, &vote)\n\treturn vote, true\n}", "title": "" }, { "docid": "761c21c23b8c98314975b14cf246043d", "score": "0.5271846", "text": "func (_TomoValidator *TomoValidatorCallerSession) GetVoterCap(_candidate common.Address, _voter common.Address) (*big.Int, error) {\n\treturn _TomoValidator.Contract.GetVoterCap(&_TomoValidator.CallOpts, _candidate, _voter)\n}", "title": "" }, { "docid": "8b1c8368cae074db1aaf8f56f07dbd56", "score": "0.52630126", "text": "func (c *testRPCChain) GetVoteInfo(hash *chainhash.Hash, version uint32) (*blockchain.VoteInfo, error) {\n\treturn c.getVoteInfo, nil\n}", "title": "" }, { "docid": "e5ff71b7e725075e9a45142af67a8def", "score": "0.5127905", "text": "func (u LedgerKey) GetVote() (result LedgerKeyVote, ok bool) {\n\tarmName, _ := u.ArmForSwitch(int32(u.Type))\n\n\tif armName == \"Vote\" {\n\t\tresult = *u.Vote\n\t\tok = true\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "5a448d6c8c203a53bb2bb0ca999e9a79", "score": "0.5010142", "text": "func GetVoterKey(me types.AccountKey) []byte {\n\treturn append(voterSubstore, me...)\n}", "title": "" }, { "docid": "a44d236ee6d5c5ca6771cdceeb8bda8e", "score": "0.5006129", "text": "func (p *Pledge_pass) Get_vlan( ) ( vlanid *string ) {\n\tif p == nil {\n\t\treturn\n\t}\n\n\treturn p.vlan\n}", "title": "" }, { "docid": "073ef23bea76f5e2894b0bf85ebc89c6", "score": "0.4976585", "text": "func GetV(r string, AT string) string {\n\tparams, _ := pbc.NewParamsFromString(Params)\n\tpairing := params.NewPairing()\n\n\tpointG := pairing.NewG1()\n\tpointG.SetString(G, 10)\n\n\tpointT := pairing.NewG1()\n\tpointT.SetString(T, 10)\n\n\tpointAT := pairing.NewG1()\n\tpointAT.SetString(AT, 10)\n\n\tpointr := pairing.NewZr()\n\tpointr.SetString(r, 10)\n\n\tpointV := pairing.NewG1()\n\tpointV.PowZn(pointAT, pointr)\n\n\thash := Hash(pointV)\n\tpointV.PowZn(pointT, hash)\n\tpointV.ThenAdd(pointAT)\n\n\treturn pointV.String()\n}", "title": "" }, { "docid": "e691c8acc1b155030a730b4997c4544c", "score": "0.4974057", "text": "func (p *Pledge_bw) Get_vlan( ) ( v1 *string, v2 *string ) {\n\tif p == nil {\n\t\treturn\n\t}\n\n\treturn p.vlan1, p.vlan2\n}", "title": "" }, { "docid": "537d980059c452b21d322e26b903dba4", "score": "0.4940562", "text": "func (w *BaseWallet) GetBlockProducerVoterList(name string) (*grpcpb.GetBlockProducerVoterListResponse,error) {\n\treq := &grpcpb.GetBlockProducerVoterListRequest{\n\t\tBlockProducer:prototype.NewAccountName(name),\n\t\tLimit:math.MaxUint32,\n\t\tLastVoter:nil,\n\t}\n\treturn rpcclient.GetRpc().GetBlockProducerVoterList(context.Background(),req)\n}", "title": "" }, { "docid": "ec8ab1c5e6fcaec24a473642c1e7d99a", "score": "0.49052435", "text": "func (p *Pledge_bwow) Get_vlan( ) ( v1 *string ) {\n\tif p == nil {\n\t\treturn\n\t}\n\n\treturn p.src_vlan\n}", "title": "" }, { "docid": "177d012c68cb685db0b53d048a9cefe2", "score": "0.48904744", "text": "func VoterIdentity(ctx context.Context) (id string) {\n\tif val := ctx.Value(voterIDKey); val != nil {\n\t\tid = val.(string)\n\t}\n\treturn\n}", "title": "" }, { "docid": "148c1e1ecd811fcf204d8ba3c2f181ca", "score": "0.48726505", "text": "func (t *Template) GetVpcLatticeListenerWithName(name string) (*vpclattice.Listener, error) {\n\tif untyped, ok := t.Resources[name]; ok {\n\t\tswitch resource := untyped.(type) {\n\t\tcase *vpclattice.Listener:\n\t\t\treturn resource, nil\n\t\t}\n\t}\n\treturn nil, fmt.Errorf(\"resource %q of type vpclattice.Listener not found\", name)\n}", "title": "" }, { "docid": "90b89b24422fbe2b49a2cdbd273c6083", "score": "0.4865199", "text": "func (a *Client) GetGovProposalsProposalIDVotesVoter(params *GetGovProposalsProposalIDVotesVoterParams) (*GetGovProposalsProposalIDVotesVoterOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetGovProposalsProposalIDVotesVoterParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"GetGovProposalsProposalIDVotesVoter\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/gov/proposals/{proposalId}/votes/{voter}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &GetGovProposalsProposalIDVotesVoterReader{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.(*GetGovProposalsProposalIDVotesVoterOK)\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 GetGovProposalsProposalIDVotesVoter: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "8fec8ef9c5382a4cb5a5d1ecaa726dc4", "score": "0.4864603", "text": "func VoteStatus(voterName eos.AccountName) {\n\tapi := getAPI()\n\n\tresponse, err := api.GetTableRows(\n\t\teos.GetTableRowsRequest{\n\t\t\tCode: \"eosio\",\n\t\t\tScope: \"eosio\",\n\t\t\tTable: \"voters\",\n\t\t\tJSON: true,\n\t\t\tLowerBound: string(voterName),\n\t\t\tLimit: 1,\n\t\t},\n\t)\n\terrorCheck(\"get table row\", err)\n\n\tvar voterInfos []eos.VoterInfo\n\terr = response.JSONToStructs(&voterInfos)\n\terrorCheck(\"reading voter_info\", err)\n\n\tfound := false\n\tfor _, info := range voterInfos {\n\t\tif info.Owner == voterName {\n\t\t\tfound = true\n\t\t\tfmt.Println(\"Voter: \", info.Owner)\n\n\t\t\tif info.IsProxy != 0 {\n\t\t\t\tfmt.Println(\"Registered as a proxy voter: true\")\n\t\t\t\tfmt.Println(\"Proxied vote weight: \", info.ProxiedVoteWeight)\n\t\t\t} else {\n\t\t\t\tfmt.Println(\"Registered as a proxy voter: false\")\n\t\t\t}\n\n\t\t\tif info.Proxy != \"\" {\n\t\t\t\tfmt.Println(\"Voting via proxy: \", info.Proxy)\n\t\t\t\tfmt.Println(\"Last vote weight: \", info.LastVoteWeight)\n\n\t\t\t} else {\n\t\t\t\tfmt.Println(\"Producers list: \", info.Producers)\n\t\t\t\tfmt.Println(\"Staked amount: \", info.Staked)\n\t\t\t\tfmt.Printf(\"Last vote weight: %f\\n\", info.LastVoteWeight)\n\t\t\t}\n\t\t}\n\t}\n\tif !found {\n\t\terrorCheck(\"vote status\", fmt.Errorf(\"unable to find vote status for %s\", voterName))\n\t}\n}", "title": "" }, { "docid": "4746dbcfc2425758f0f40f96cff8ad80", "score": "0.48455423", "text": "func (b F5Backend) GetVIP(ctx context.Context, name string) (string, error) {\n\treturn \"\", nil\n}", "title": "" }, { "docid": "67ac539237f2bf8412391edbcd26195e", "score": "0.48302928", "text": "func (b *electingBackend) AddVoter(ctx context.Context, key, value string, term time.Duration) error {\n\treturn b.Leader.AddVoter(ctx, key, value, term)\n}", "title": "" }, { "docid": "76e1ace84ff65c71ec820b707f92294c", "score": "0.4819312", "text": "func (u LedgerEntryData) GetVote() (result VoteEntry, ok bool) {\n\tarmName, _ := u.ArmForSwitch(int32(u.Type))\n\n\tif armName == \"Vote\" {\n\t\tresult = *u.Vote\n\t\tok = true\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "8589b39c320bbf73ed08d255acda696d", "score": "0.47176486", "text": "func GetVethPair(name1 string, name2 string) (link1 netlink.Link,\n\tlink2 netlink.Link, err error) {\n\tlink1, err = MakeVethPair(name1, name2, 1500)\n\tif err != nil {\n\t\tswitch {\n\t\tcase os.IsExist(err):\n\t\t\terr = fmt.Errorf(\n\t\t\t\t\"container veth name provided (%v) \"+\n\t\t\t\t\t\"already exists\", name1)\n\t\t\treturn\n\t\tdefault:\n\t\t\terr = fmt.Errorf(\"failed to make veth pair: %v\", err)\n\t\t\treturn\n\t\t}\n\t}\n\n\tlink2, err = netlink.LinkByName(name2)\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"Failed to lookup %q: %v\\n\", name2, err)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "4ec2252fd7372e337c1aab4b685391a9", "score": "0.46973184", "text": "func GetVethPair(name1 string, name2 string) (link1 netlink.Link,\n\tlink2 netlink.Link, err error) {\n\tlink1, err = makeVethPair(name1, name2, 1500)\n\tif err != nil {\n\t\tswitch {\n\t\tcase os.IsExist(err):\n\t\t\terr = fmt.Errorf(\n\t\t\t\t\"container veth name provided (%v) \"+\n\t\t\t\t\t\"already exists\", name1)\n\t\t\treturn\n\t\tdefault:\n\t\t\terr = fmt.Errorf(\"failed to make veth pair: %v\", err)\n\t\t\treturn\n\t\t}\n\t}\n\n\tif link2, err = netlink.LinkByName(name2); err != nil {\n\t\terr = fmt.Errorf(\"failed to lookup %q: %v\", name2, err)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "dfa740c26dc9f36a03a4dcbe77e6db0d", "score": "0.46963742", "text": "func (_PlayerBookInterface *PlayerBookInterfaceCallerSession) GetPlayerName(_pID *big.Int) ([32]byte, error) {\n\treturn _PlayerBookInterface.Contract.GetPlayerName(&_PlayerBookInterface.CallOpts, _pID)\n}", "title": "" }, { "docid": "93150461c347977f28ce0afe052408c3", "score": "0.46923772", "text": "func (v *Vote) Votee() string {\n\treturn v.DstAddr()\n}", "title": "" }, { "docid": "71b7446389b1ba1654ca94e97a4436b4", "score": "0.4673406", "text": "func GetViewer(name string) (StateViewer, error) {\n\tview, ok := Views[name]\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"view %s not found\", name)\n\t} else {\n\t\treturn view, nil\n\t}\n}", "title": "" }, { "docid": "a52e3b45224d44a1feb48d51db8c48ee", "score": "0.4654969", "text": "func (_PlayerBook *PlayerBookCallerSession) GetPlayerName(_pID *big.Int) ([32]byte, error) {\n\treturn _PlayerBook.Contract.GetPlayerName(&_PlayerBook.CallOpts, _pID)\n}", "title": "" }, { "docid": "ede4130cbc2686f384d7237b3f6a3586", "score": "0.46513632", "text": "func (v *vaultSelector) GetVault(name string, namespace string, useIngressURL bool) (*vault.Vault, error) {\n\tvaults, err := GetVaults(v.kubeClient, v.vaultOperatorClient, namespace, useIngressURL)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif name != \"\" {\n\t\t// Return the vault that the user wanted (or an error if it doesn't exist)\n\t\tfor _, v := range vaults {\n\t\t\tif v.Name == name {\n\t\t\t\treturn v, nil\n\t\t\t}\n\t\t}\n\t\treturn nil, errors.New(fmt.Sprintf(\"vault '%s' not found in namespace '%s'\", name, namespace))\n\t}\n\n\tif len(vaults) == 0 {\n\t\treturn nil, errors.New(fmt.Sprintf(\"no vaults found in namespace '%s'\", namespace))\n\t}\n\tif len(vaults) > 1 { // Get the user to select the vault from the list\n\t\treturn v.selectVault(vaults)\n\t}\n\t// If there is only one vault, return that one\n\treturn vaults[0], nil\n}", "title": "" }, { "docid": "d61b378abd8e1af8bea1fbb999098add", "score": "0.46167663", "text": "func (req *VipRequest) GET(name string) (Vip, error) {\n\treq.ExtendsSearch = []map[string]string{\n\t\t{\"name\": name},\n\t}\n\n\tpURL, err := req.build()\n\tif err != nil {\n\t\treturn Vip{}, err\n\t}\n\n\tvar vips VipResp\n\terr = HTTP.Call(\"GET\", pURL, nil, &vips)\n\tif err != nil {\n\t\treturn Vip{}, err\n\t}\n\tif len(vips.Vips) == 0 {\n\t\treturn Vip{}, errors.New(\"Vip not found\")\n\t}\n\n\tif len(vips.Vips) > 1 {\n\t\treturn Vip{}, errors.New(\"more than one Vip was returned in the query. Aborting\")\n\t}\n\n\tvips.Vips[0].print()\n\treturn vips.Vips[0], nil\n}", "title": "" }, { "docid": "fd3146e4f4149bea1a6820abb31d265f", "score": "0.4601592", "text": "func (_PlayerBookInterface *PlayerBookInterfaceSession) GetPlayerName(_pID *big.Int) ([32]byte, error) {\n\treturn _PlayerBookInterface.Contract.GetPlayerName(&_PlayerBookInterface.CallOpts, _pID)\n}", "title": "" }, { "docid": "9a226f351ede80b36e233586abc9aa41", "score": "0.45925435", "text": "func ErrVoterNotFound() sdk.Error {\n\treturn types.NewError(types.CodeVoterNotFound, fmt.Sprintf(\"voter not found\"))\n}", "title": "" }, { "docid": "7807d1b0b2a8c09187610baa40470524", "score": "0.45789805", "text": "func GetGuest(name string) (data.Guest, error) {\n\tg, err := database.SprocGetGuestByName(name)\n\tif err != nil{\n\t\tlog.Println(err)\n\t\terr = errors.New(\" no guest by that name\")\n\t\treturn data.Guest{}, err\n\t}\n\treturn g, nil\n}", "title": "" }, { "docid": "884bcedd507a6a25312f617bf593b21e", "score": "0.45663747", "text": "func (_PlayerBookInterface *PlayerBookInterfaceCaller) GetPlayerName(opts *bind.CallOpts, _pID *big.Int) ([32]byte, error) {\n\tvar (\n\t\tret0 = new([32]byte)\n\t)\n\tout := ret0\n\terr := _PlayerBookInterface.contract.Call(opts, out, \"getPlayerName\", _pID)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "7699ef69a687e8692ba574894315822c", "score": "0.45658898", "text": "func (_PlayerBook *PlayerBookSession) GetPlayerName(_pID *big.Int) ([32]byte, error) {\n\treturn _PlayerBook.Contract.GetPlayerName(&_PlayerBook.CallOpts, _pID)\n}", "title": "" }, { "docid": "6105f5c08221f054069b81f623f4cadd", "score": "0.45602483", "text": "func (_TomoValidator *TomoValidatorCallerSession) GetVoters(_candidate common.Address) ([]common.Address, error) {\n\treturn _TomoValidator.Contract.GetVoters(&_TomoValidator.CallOpts, _candidate)\n}", "title": "" }, { "docid": "2ffdaf24c2a3ed7ba03e3c599963cb41", "score": "0.45572096", "text": "func (rpc *AergoRPCService) GetVotes(ctx context.Context, in *types.VoteParams) (*types.VoteList, error) {\n\tif err := rpc.checkAuth(ctx, ReadBlockChain); err != nil {\n\t\treturn nil, err\n\t}\n\n\tresult, err := rpc.hub.RequestFuture(message.ChainSvc,\n\t\t&message.GetElected{Id: in.GetId(), N: in.GetCount()}, defaultActorTimeout, \"rpc.(*AergoRPCService).GetVote\").Result()\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\trsp, ok := result.(*message.GetVoteRsp)\n\tif !ok {\n\t\treturn nil, status.Errorf(codes.Internal, \"internal type (%v) error\", reflect.TypeOf(result))\n\t}\n\treturn rsp.Top, rsp.Err\n}", "title": "" }, { "docid": "9d6c71931681ee479f8df7bf1ded100c", "score": "0.4521859", "text": "func (client *Client) VerifyVoter(author, permlink, voter string) bool {\n\tans, err := client.SocialNetwork.GetActiveVotes(author, permlink)\n\n\tif err != nil {\n\t\tlog.Println(errors.Wrapf(err, \"Error Verify Voter: \"))\n\t\treturn false\n\t}\n\tfor _, v := range ans {\n\t\tif v.Voter == voter {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "ed51b22d185aa9a3d1394c7bf169922d", "score": "0.45193022", "text": "func (_PlayerBook *PlayerBookCaller) GetPlayerName(opts *bind.CallOpts, _pID *big.Int) ([32]byte, error) {\n\tvar (\n\t\tret0 = new([32]byte)\n\t)\n\tout := ret0\n\terr := _PlayerBook.contract.Call(opts, out, \"getPlayerName\", _pID)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "0f7836709cc27cc6549178a0b3b4f14e", "score": "0.45160627", "text": "func GetScooter(id string) (Scooter, error) {\n\tobjID := bson.ObjectIdHex(id)\n\tc := mongo.GetDB().C(collectionName)\n\n\tvar s Scooter\n\terr := c.FindId(objID).One(&s)\n\tif err == mgo.ErrNotFound {\n\t\treturn Scooter{}, errors.New(\"scooter not found\")\n\t}\n\tassert.Nil(err)\n\n\treturn Scooter{objID, s.State}, nil\n}", "title": "" }, { "docid": "0a46039105e9d6f85b0025dd470b6fcd", "score": "0.4513697", "text": "func (_TomoValidator *TomoValidatorSession) GetVoters(_candidate common.Address) ([]common.Address, error) {\n\treturn _TomoValidator.Contract.GetVoters(&_TomoValidator.CallOpts, _candidate)\n}", "title": "" }, { "docid": "9b983b0227c6f62f00413e871d432513", "score": "0.44958287", "text": "func (_TomoValidator *TomoValidatorCaller) GetVoters(opts *bind.CallOpts, _candidate common.Address) ([]common.Address, error) {\n\tvar (\n\t\tret0 = new([]common.Address)\n\t)\n\tout := ret0\n\terr := _TomoValidator.contract.Call(opts, out, \"getVoters\", _candidate)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "879f55c32043562fd0ba5e80e994bd1d", "score": "0.44947204", "text": "func (vmdb *VMDatabase) GetByName(name *VMName) (*VM, error) {\n\tentry, err := vmdb.GetEntryByName(name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn entry.VM, nil\n}", "title": "" }, { "docid": "48d3552250522fdf4537afe8107e9ebb", "score": "0.44820812", "text": "func (t *Template) GetEC2VerifiedAccessInstanceWithName(name string) (*ec2.VerifiedAccessInstance, error) {\n\tif untyped, ok := t.Resources[name]; ok {\n\t\tswitch resource := untyped.(type) {\n\t\tcase *ec2.VerifiedAccessInstance:\n\t\t\treturn resource, nil\n\t\t}\n\t}\n\treturn nil, fmt.Errorf(\"resource %q of type ec2.VerifiedAccessInstance not found\", name)\n}", "title": "" }, { "docid": "9b5fe50f8862f73fbdbb8269bdc8eb76", "score": "0.44512054", "text": "func (t *SimpleChaincode) getVehicleByVIN(stub shim.ChaincodeStubInterface, inVIN string)([]byte, error){\n\n\tfmt.Println(\"getAllVehicles:Looking for vehicle by vin number\");\n\n\t//get the AllVehicles index\n\tallBAsBytes, err := stub.GetState(\"allVehicles\")\n\tif err != nil {\n\t\treturn nil, errors.New(\"Failed to get all Vehicles\")\n\t}\n\n\tvar res AllVehicles\n\terr = json.Unmarshal(allBAsBytes, &res)\n\t//fmt.Println(allBAsBytes);\n\tif err != nil {\n\t\tfmt.Println(\"Printing Unmarshal error:-\");\n\t\tfmt.Println(err);\n\t\treturn nil, errors.New(\"Failed to Unmarshal all Vehicles\")\n\t}\n\n\tvar cvehicle Vehicle\n\tfor i := range res.Vehicles{\n\n\t\tsbAsBytes, err := stub.GetState(res.Vehicles[i])\n\t\tif err != nil {\n\t\t\treturn nil, errors.New(\"Failed to get Vehicle\")\n\t\t}\n\t\tvar sb Vehicle\n\t\tjson.Unmarshal(sbAsBytes, &sb)\n\t\t\n\t\tif strings.ToLower(sb.Vin) == strings.ToLower(inVIN) {\n\t\t\tcvehicle = sb\n\t\t}\n\t}\n\n\trabAsBytes, _ := json.Marshal(cvehicle)\n\n\treturn rabAsBytes, nil\n\n}", "title": "" }, { "docid": "d414fc34b72db90fb95ac272473fca3a", "score": "0.44140747", "text": "func GetAlgoVer(name string, height int32) (version int32) {\n\thf := GetCurrent(height)\n\tn := AlgoSlices[hf][0].Name\n\t// D.Ln(\"GetAlgoVer\", name, height, hf, n)\n\tif _, ok := List[hf].Algos[name]; ok {\n\t\tn = name\n\t}\n\tversion = List[hf].Algos[n].Version\n\treturn\n}", "title": "" }, { "docid": "0cc51bbd93fdfa6e4e20068265d40412", "score": "0.44083926", "text": "func (r *DynamoDBRollout) Get(name string) *float64 {\n\tr.mutex.RLock()\n\tdefer r.mutex.RUnlock()\n\tversion, ok := r.versions[name]\n\tif !ok {\n\t\tlog.Printf(\"rollout: request for nonexistent version: \\\"%v\\\"\", name)\n\t\treturn nil\n\t}\n\tif version.isUnhealthy {\n\t\treturn nil\n\t}\n\treturn &version.percentage\n}", "title": "" }, { "docid": "c5c46cdca308190a9ab56e803f63efbc", "score": "0.44079214", "text": "func (t *Template) GetEC2VPNGatewayWithName(name string) (*ec2.VPNGateway, error) {\n\tif untyped, ok := t.Resources[name]; ok {\n\t\tswitch resource := untyped.(type) {\n\t\tcase *ec2.VPNGateway:\n\t\t\treturn resource, nil\n\t\t}\n\t}\n\treturn nil, fmt.Errorf(\"resource %q of type ec2.VPNGateway not found\", name)\n}", "title": "" }, { "docid": "2cfc44604a1b11643c1cdeddd6425dba", "score": "0.43641737", "text": "func (k Keeper) GetStoreLTV(ctx sdk.Context, addr sdk.AccAddress) (sdk.Dec, error) {\n\t// Fetch deposits and parse coin denoms\n\tdeposit, found := k.GetDeposit(ctx, addr)\n\tif !found {\n\t\treturn sdk.ZeroDec(), nil\n\t}\n\n\t// Fetch borrow balances and parse coin denoms\n\tborrow, found := k.GetBorrow(ctx, addr)\n\tif !found {\n\t\treturn sdk.ZeroDec(), nil\n\t}\n\n\treturn k.CalculateLtv(ctx, deposit, borrow)\n}", "title": "" }, { "docid": "39c937180579a3687fee84ba1e8a449c", "score": "0.43621874", "text": "func (s *DelegatesService) Voters(ctx context.Context, id string, query *Pagination) (*GetDelegateVoters, *http.Response, error) {\n\turi := fmt.Sprintf(\"delegates/%v/voters\", id)\n\n\tvar responseStruct *GetDelegateVoters\n\tresp, err := s.client.SendRequest(ctx, \"GET\", uri, query, nil, &responseStruct)\n\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn responseStruct, resp, err\n}", "title": "" }, { "docid": "2996d2df8719c5e9d65331076c971654", "score": "0.435742", "text": "func GetVoteKey(proposalID types.ProposalKey, voter types.AccountKey) []byte {\n\treturn append(getVotePrefix(proposalID), voter...)\n}", "title": "" }, { "docid": "8c82337335f7df822f12be80838c076f", "score": "0.43515095", "text": "func (c *VoteClient) Get(ctx context.Context, id int) (*Vote, error) {\n\treturn c.Query().Where(vote.ID(id)).Only(ctx)\n}", "title": "" }, { "docid": "0fc62cd0fa2c2acfbd72865ca5c371c6", "score": "0.43462947", "text": "func (client *Client) GetUser(\n\tctx context.Context, name string,\n) (*graylog.User, *ErrorInfo, error) {\n\tif name == \"\" {\n\t\treturn nil, nil, errors.New(\"name is empty\")\n\t}\n\tuser := &graylog.User{}\n\tei, err := client.callGet(ctx, client.Endpoints().User(name), nil, user)\n\treturn user, ei, err\n}", "title": "" }, { "docid": "65582935e224b75b2e8318e256b12418", "score": "0.43457568", "text": "func (_VehicleBooking *VehicleBookingCaller) GetVehicleInfo(opts *bind.CallOpts) (string, string, string, string, *big.Int, error) {\n\tvar (\n\t\tret0 = new(string)\n\t\tret1 = new(string)\n\t\tret2 = new(string)\n\t\tret3 = new(string)\n\t\tret4 = new(*big.Int)\n\t)\n\tout := &[]interface{}{\n\t\tret0,\n\t\tret1,\n\t\tret2,\n\t\tret3,\n\t\tret4,\n\t}\n\terr := _VehicleBooking.contract.Call(opts, out, \"getVehicleInfo\")\n\treturn *ret0, *ret1, *ret2, *ret3, *ret4, err\n}", "title": "" }, { "docid": "df498464e9d506749d057522116b8426", "score": "0.43398395", "text": "func (vs VoteStorage) DeleteVoter(ctx sdk.Context, username types.AccountKey) sdk.Error {\n\tstore := ctx.KVStore(vs.key)\n\tstore.Delete(GetVoterKey(username))\n\treturn nil\n}", "title": "" }, { "docid": "ae81b8fa82e4a99a4268fd32d6b39c00", "score": "0.43355298", "text": "func (t *SimpleChaincode) getVehicle(stub shim.ChaincodeStubInterface, vehicleId string)([]byte, error){\n\n\tfmt.Println(\"Start find Vehicle\")\n\tfmt.Println(\"Looking for Vehicle #\" + vehicleId);\n\n\t//get the vehicle index\n\tbAsBytes, err := stub.GetState(vehicleId)\n\tif err != nil {\n\t\treturn nil, errors.New(\"Failed to get Vehicle Id #\" + vehicleId)\n\t}\n\n\treturn bAsBytes, nil\n\n}", "title": "" }, { "docid": "0751c4c3b883672d2657249d9bc3658a", "score": "0.43326578", "text": "func (s *SmartContract) GetCandidate(ctx contractapi.TransactionContextInterface,\n\tcandidateID string) (types.Candidate, error) {\n\n\tbytes, err := ctx.GetStub().GetState(candidateID)\n\tcandidate := types.Candidate{}\n\n\tif err != nil {\n\t\treturn candidate, errors.New(\"Candidate not found\")\n\t}\n\n\terr = json.Unmarshal(bytes, &candidate)\n\n\treturn candidate, errors.New(\"Error parsing stored data: \" + string(bytes))\n}", "title": "" }, { "docid": "2bbe3ffa4a48d0e8fc10ceee4f0def38", "score": "0.43320388", "text": "func (m *KubernetesSecretEvidence) GetName()(*string) {\n val, err := m.GetBackingStore().Get(\"name\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "title": "" }, { "docid": "f8fbd37a2711d1bfcdaf4dfa91130098", "score": "0.4327256", "text": "func getProposalsFilterVoter(t *testing.T, port string, voterAddr sdk.AccAddress) []gov.Proposal {\n\tres, body := Request(t, port, \"GET\", fmt.Sprintf(\"/gov/proposals?voter=%s\", voterAddr), nil)\n\trequire.Equal(t, http.StatusOK, res.StatusCode, body)\n\n\tvar proposals []gov.Proposal\n\terr := cdc.UnmarshalJSON(extractResultFromResponse(t, []byte(body)), &proposals)\n\trequire.Nil(t, err)\n\treturn reverse(proposals) // HasGard\n}", "title": "" }, { "docid": "27539b471f81388ce6dc8949c869d002", "score": "0.43162796", "text": "func GetCmdVote(cdc *codec.Codec) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: \"vote\",\n\t\tShort: \"Vote for an candidate/active program, options: yes or no\",\n\t\tLong: strings.TrimSpace(`\nSubmit a vote for an candidate/active program.\n\nYou can find the program-id of active programs by running terracli query budget actives\nYou can find the program-id of candidate programs by running terracli query budget candidates\n\n$ terracli tx budget vote --program-id 1 --option yes --from mykey\n`),\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\ttxBldr := authtxb.NewTxBuilderFromCLI().WithTxEncoder(utils.GetTxEncoder(cdc))\n\t\t\tcliCtx := context.NewCLIContext().\n\t\t\t\tWithCodec(cdc).\n\t\t\t\tWithAccountDecoder(cdc)\n\n\t\t\t// Get voting address\n\t\t\tfrom := cliCtx.GetFromAddress()\n\n\t\t\t// Validate that the program id is a uint\n\t\t\tprogramStrID := viper.GetString(flagProgramID)\n\t\t\tprogramID, err := strconv.ParseUint(programStrID, 10, 64)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"given program-id {%s} is not a valid format; program-id should be formatted as integer\", programStrID)\n\t\t\t}\n\n\t\t\t// Find out which vote option user chose\n\t\t\tvar option bool\n\t\t\toptionStr := viper.GetString(flagOption)\n\t\t\tif optionStr == \"yes\" || optionStr == \"true\" {\n\t\t\t\toption = true\n\t\t\t} else if optionStr == \"no\" || optionStr == \"false\" {\n\t\t\t\toption = false\n\t\t\t} else {\n\t\t\t\treturn fmt.Errorf(`given option {%s} is not valid format;\\n option should be formatted as \"yes\" or \"no\"`, optionStr)\n\t\t\t}\n\n\t\t\toffline := viper.GetBool(flagOffline)\n\n\t\t\tif !offline {\n\t\t\t\tif err := cliCtx.EnsureAccountExists(); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Build vote message and run basic validation\n\t\t\tmsg := budget.NewMsgVoteProgram(programID, option, from)\n\t\t\terr = msg.ValidateBasic()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\treturn utils.GenerateOrBroadcastMsgs(cliCtx, txBldr, []sdk.Msg{msg}, offline)\n\t\t},\n\t}\n\n\tcmd.MarkFlagRequired(flagProgramID)\n\tcmd.MarkFlagRequired(flagOption)\n\n\tcmd.Flags().String(flagProgramID, \"\", \"the program ID to vote\")\n\tcmd.Flags().String(flagOption, \"\", \"yes or no\")\n\tcmd.Flags().Bool(flagOffline, false, \" Offline mode; Without full node connection it can build and sign tx\")\n\n\treturn cmd\n}", "title": "" }, { "docid": "e8aba755b141c3a14d2b00cef5f70045", "score": "0.4304901", "text": "func (voter *VotingUCBChaincode) Invoke(stub shim.ChaincodeStubInterface) peer.Response {\n\n\t// Get the function name and parameters\n\tfunction, args := stub.GetFunctionAndParameters()\n\n\tfmt.Println(\"Invoke ejecutado : \", function, \", args = \", args)\n\n\tswitch {\n\n\t// Funciones Invoke\n\tcase function == \"addNewVoters\":\n\t\treturn addNewVoters(stub, args)\n\tcase function == \"openElection\":\n\t\treturn openElection(stub)\n\tcase function == \"closeElection\":\n\t\treturn closeElection(stub)\n\tcase function == \"voteEmition\":\n\t\treturn voteEmition(stub, args)\n\t// Funciones Query\n\tcase function == \"voterStatusInspection\":\n\t\treturn voterStatusInspection(stub, args)\n\tcase function == \"candidateInspection\":\n\t\treturn candidateInspection(stub, args)\n\tcase function == \"voteCounting\":\n\t\treturn voteCounting(stub)\n\t}\n\n\treturn errorResponse(\"Invalid function\", 1)\n}", "title": "" }, { "docid": "bb28728ef95deda9b7125d00ecbbb657", "score": "0.430474", "text": "func GetGuest(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *GuestState, opts ...pulumi.ResourceOption) (*Guest, error) {\n\tvar resource Guest\n\terr := ctx.ReadResource(\"f5bigip:vcmp/guest:Guest\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "e5a56ca07cb4cd7817e5a6eae145dc86", "score": "0.4296557", "text": "func (s *SmartContract) GetElection(ctx contractapi.TransactionContextInterface,\n\telectionID string) (types.Election, error) {\n\n\te := types.Election{}\n\n\tresult, err := ctx.GetStub().GetState(electionID)\n\n\tif err != nil {\n\t\treturn e, errors.New(\"Election not found\")\n\t}\n\n\terr = json.Unmarshal(result, &e)\n\treturn e, err\n}", "title": "" }, { "docid": "62ba6263fde6dc548ec2a3bcc73af34a", "score": "0.42911354", "text": "func (sl *SecretLister) GetByName(name string) (*apiv1.Secret, error) {\n\ts, exists, err := sl.GetByKey(name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, fmt.Errorf(\"secret %v was not found\", name)\n\t}\n\treturn s.(*apiv1.Secret), nil\n}", "title": "" }, { "docid": "ccb0fa2015abd177f580c805dc7eac00", "score": "0.42803103", "text": "func Get(name string) (Driver, error) {\n\td, ok := volDrivers[name]\n\tif ok {\n\t\treturn d, nil\n\t}\n\n\treturn nil, &errors.ErrNotFound{\n\t\tID: name,\n\t\tType: \"VolumeDriver\",\n\t}\n}", "title": "" }, { "docid": "cfb96220259708c3ad39b51afd5a44a5", "score": "0.42674324", "text": "func (a *Client) GetGovParametersVoting(params *GetGovParametersVotingParams) (*GetGovParametersVotingOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetGovParametersVotingParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"GetGovParametersVoting\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/gov/parameters/voting\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &GetGovParametersVotingReader{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.(*GetGovParametersVotingOK)\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 GetGovParametersVoting: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "95c7088007ce8cd51fd86e1e9c81a35c", "score": "0.42660457", "text": "func (t *Template) GetLexBotVersionWithName(name string) (*lex.BotVersion, error) {\n\tif untyped, ok := t.Resources[name]; ok {\n\t\tswitch resource := untyped.(type) {\n\t\tcase *lex.BotVersion:\n\t\t\treturn resource, nil\n\t\t}\n\t}\n\treturn nil, fmt.Errorf(\"resource %q of type lex.BotVersion not found\", name)\n}", "title": "" }, { "docid": "24ba5ebe279515172371c916da56a73e", "score": "0.4265457", "text": "func (h *HSM) VaultName() string {\n\treturn h.conf.id()\n}", "title": "" }, { "docid": "80b185b6c76c783491016aa9b0eb047a", "score": "0.42622232", "text": "func getVolumeFromTerraformState(name string, state *terraform.State, virConn libvirt.Connect) (*libvirt.StorageVol, error) {\n\trs, err := getResourceFromTerraformState(name, state)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvol, err := virConn.LookupStorageVolByKey(rs.Primary.ID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlog.Printf(\"[DEBUG]:The ID is %s\", rs.Primary.ID)\n\treturn vol, nil\n}", "title": "" }, { "docid": "f7eeda09c3bc3c0b8a121a99528d127d", "score": "0.42610192", "text": "func (c *Client) GetVvar(name string) (interface{}, error) {\n\tvar retVal interface{}\n\tenc := func() (_err error) {\n\t\t_err = c.enc.EncodeSliceLen(1)\n\t\tif _err != nil {\n\t\t\treturn\n\t\t}\n\n\t\t_err = c.enc.EncodeString(name)\n\n\t\tif _err != nil {\n\t\t\treturn\n\t\t}\n\n\t\treturn\n\t}\n\tdec := func() (_i interface{}, _err error) {\n\n\t\t_i, _err = c.dec.DecodeInterface()\n\n\t\treturn\n\t}\n\trespChan, err := c.makeCall(clientGetVvar, enc, dec)\n\tif err != nil {\n\t\treturn retVal, c.panicOrReturn(errgo.NoteMask(err, \"Could not make call to Client.GetVvar\"))\n\t}\n\tresp := <-respChan\n\tif resp == nil {\n\t\treturn retVal, c.panicOrReturn(errgo.New(\"We got a nil response on respChan\"))\n\t}\n\tif resp.err != nil {\n\t\treturn retVal, c.panicOrReturn(errgo.NoteMask(err, \"We got a non-nil error in our response\"))\n\t}\n\n\tretVal = resp.obj.(interface{})\n\treturn retVal, nil\n\n}", "title": "" }, { "docid": "8dbb7b5799e5c085937360ea87c044e3", "score": "0.4258465", "text": "func (_GatewayVote *GatewayVoteCaller) IsVoter(opts *bind.CallOpts, voter common.Address) (bool, error) {\n\tvar (\n\t\tret0 = new(bool)\n\t)\n\tout := ret0\n\terr := _GatewayVote.contract.Call(opts, out, \"isVoter\", voter)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "64ee8c3d75367a6ff00c9fb86fca5a14", "score": "0.42552242", "text": "func (t *TeamService) GetByName(name string) (*model.Team, error) {\n\tteam, appErr := t.api.GetTeamByName(name)\n\n\treturn team, normalizeAppErr(appErr)\n}", "title": "" }, { "docid": "b37de6f50826999689ca5740fa860cd7", "score": "0.42540208", "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[\"arn\"] = state.Arn\n\t\tinputs[\"kmsKeyArn\"] = state.KmsKeyArn\n\t\tinputs[\"name\"] = state.Name\n\t\tinputs[\"recoveryPoints\"] = state.RecoveryPoints\n\t\tinputs[\"tags\"] = state.Tags\n\t}\n\ts, err := ctx.ReadResource(\"aws:backup/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": "61557441e24033ebce572e4a413f46ce", "score": "0.42513946", "text": "func (s *Session) GetVM(name string) (*object.VirtualMachine, error) {\n\tfinder := find.NewFinder(s.Conn.Client, true)\n\tfinder.SetDatacenter(s.Datacenter)\n\tvm, err := finder.VirtualMachine(context.TODO(), name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn vm, err\n}", "title": "" }, { "docid": "0066e306f68afea29c748bfdc4fa869f", "score": "0.42419615", "text": "func (v *Vault) Get(id string) (map[string]interface{}, error) {\n\ts, err := v.client.Logical().Read(id)\n\tif err != nil {\n\t\treturn nil, err\n\t} else if s == nil {\n\t\treturn nil, errors.New(\"missing secret\")\n\t}\n\n\treturn s.Data, nil\n}", "title": "" }, { "docid": "8951c5ca08b3c8d0b73357f417f86e5f", "score": "0.42413187", "text": "func (k Keeper) GetPrice(ctx sdk.Context, name string) sdk.Coins {\n\treturn k.GetWhoIs(ctx, name).Price\n}", "title": "" }, { "docid": "0980b03f00c9fe044446454aec23cca4", "score": "0.4234997", "text": "func (c *Security) Get(vsys, base, name string) (Entry, error) {\n c.con.LogQuery(\"(get) security policy %q\", name)\n return c.details(c.con.Get, vsys, base, name)\n}", "title": "" }, { "docid": "6f5a919260c2b3f249338b4abe2a7d65", "score": "0.42288747", "text": "func GetVendor(name string) *Vendor {\n\tdblock.Lock()\n\tdefer dblock.Unlock()\n\tvv, ok := db.Vendors[name]\n\tif !ok {\n\t\treturn nil\n\t}\n\treturn vv\n}", "title": "" }, { "docid": "4236508b93e8f8a6b8111a0ad3e40f46", "score": "0.42190018", "text": "func Get(key string) interface{} {\n\treturn v.Get(key)\n}", "title": "" }, { "docid": "bdf4c31235921d8eac8488c2610d510c", "score": "0.4218623", "text": "func (c *viziers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Vizier, err error) {\n\tresult = &v1alpha1.Vizier{}\n\terr = c.client.Get().\n\t\tNamespace(c.ns).\n\t\tResource(\"viziers\").\n\t\tName(name).\n\t\tVersionedParams(&options, scheme.ParameterCodec).\n\t\tDo(ctx).\n\t\tInto(result)\n\treturn\n}", "title": "" }, { "docid": "c074e2a4e2e077aa15f978ed18f6e89d", "score": "0.42099282", "text": "func (_Sampel *SampelCallerSession) GetUser(_name string) (common.Address, error) {\n\treturn _Sampel.Contract.GetUser(&_Sampel.CallOpts, _name)\n}", "title": "" }, { "docid": "b2d0e272855157e96543b26e6fa84850", "score": "0.4208395", "text": "func (v *Vpc) GetVpcSubnetByTag(key, value string) (Subnet, error) {\n\n\tsess := session.Must(session.NewSession(&aws.Config{Region: aws.String(v.Region)}))\n\tsvc := ec2.New(sess)\n\n\tparams := &ec2.DescribeSubnetsInput{\n\t\tFilters: []*ec2.Filter{\n\t\t\t{\n\t\t\t\tName: aws.String(\"tag:\" + key),\n\t\t\t\tValues: []*string{\n\t\t\t\t\taws.String(value),\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tName: aws.String(\"vpc-id\"),\n\t\t\t\tValues: []*string{\n\t\t\t\t\taws.String(v.VpcID),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\tresult, err := svc.DescribeSubnets(params)\n\n\tif err != nil {\n\t\treturn Subnet{}, err\n\t}\n\n\tcount := len(result.Subnets)\n\n\tswitch count {\n\tcase 0:\n\t\treturn Subnet{}, errors.New(\"No Subnet found with [\" + key + \"] of [\" + value + \"] in [\" + v.Region + \"] VPC [\" + v.Name + \"], Aborting!\")\n\tcase 1:\n\t\tsubnet := new(Subnet)\n\t\tsubnet.Marshal(result.Subnets[0], v.Region, &Vpcs{*v})\n\t\treturn *subnet, nil\n\t}\n\n\treturn Subnet{}, errors.New(\"Please limit your request to return only one Subnet\")\n}", "title": "" }, { "docid": "d696aaf3ea288f046b2d142c1fd4e25c", "score": "0.42037976", "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:glacier/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": "a8327db62f2925638ef2953269027175", "score": "0.42031997", "text": "func (s *state) GetVoteCommittee(slot uint64, p *params.ChainParams) ([]uint64, error) {\n\n\tif (slot-1)/p.EpochLength == s.EpochIndex {\n\t\tassignments := s.CurrentEpochVoteAssignments\n\t\tslotIndex := uint64(slot % p.EpochLength)\n\t\tmin := (slotIndex * uint64(len(assignments))) / p.EpochLength\n\t\tmax := ((slotIndex + 1) * uint64(len(assignments))) / p.EpochLength\n\n\t\treturn assignments[min:max], nil\n\n\t} else if (slot-1)/p.EpochLength == s.EpochIndex-1 {\n\t\tassignments := s.PreviousEpochVoteAssignments\n\t\tslotIndex := uint64(slot % p.EpochLength)\n\t\tmin := (slotIndex * uint64(len(assignments))) / p.EpochLength\n\t\tmax := ((slotIndex + 1) * uint64(len(assignments))) / p.EpochLength\n\t\treturn assignments[min:max], nil\n\t}\n\n\t// TODO: better handling\n\treturn nil, fmt.Errorf(\"tried to get vote committee out of range: %d\", slot)\n}", "title": "" }, { "docid": "c769e18f5bd4ca49caa1298a471c1bfe", "score": "0.4199828", "text": "func GetVM(connectionName string, rsType string, nameID string) (*cres.VMInfo, error) {\n\tcblog.Info(\"call GetVM()\")\n\n\t// check empty and trim user inputs\n\tconnectionName, err := EmptyCheckAndTrim(\"connectionName\", connectionName)\n\tif err != nil {\n\t\tcblog.Error(err)\n\t\treturn nil, err\n\t}\n\n\tnameID, err = EmptyCheckAndTrim(\"nameID\", nameID)\n\tif err != nil {\n\t\tcblog.Error(err)\n\t\treturn nil, err\n\t}\n\n\tcldConn, err := ccm.GetCloudConnection(connectionName)\n\tif err != nil {\n\t\tcblog.Error(err)\n\t\treturn nil, err\n\t}\n\n\thandler, err := cldConn.CreateVMHandler()\n\tif err != nil {\n\t\tcblog.Error(err)\n\t\treturn nil, err\n\t}\n\n\tvmSPLock.RLock(connectionName, nameID)\n\tdefer vmSPLock.RUnlock(connectionName, nameID)\n\n\t// (1) get IID(NameId)\n\tvar iidInfo VMIIDInfo\n\terr = infostore.GetByConditions(&iidInfo, CONNECTION_NAME_COLUMN, connectionName, NAME_ID_COLUMN, nameID)\n\tif err != nil {\n\t\tcblog.Error(err)\n\t\treturn nil, err\n\t}\n\n\t// (2) get resource(SystemId)\n\tinfo, err := handler.GetVM(getDriverIID(cres.IID{NameId: iidInfo.NameId, SystemId: iidInfo.SystemId}))\n\tif err != nil {\n\t\tcblog.Error(err)\n\t\treturn nil, err\n\t}\n\n\t// (3) set ResourceInfo(IID.NameId)\n\t// set ResourceInfo\n\tinfo.IId = getUserIID(cres.IID{NameId: iidInfo.NameId, SystemId: iidInfo.SystemId})\n\n\terr = getSetNameId(connectionName, &info)\n\tif err != nil {\n\t\tcblog.Error(err)\n\t\treturn nil, err\n\t}\n\t/*\n\t\t// set sg NameId from VPCNameId-SecurityGroupNameId\n\t\t// IID.NameID format => {VPC NameID} + SG_DELIMITER + {SG NameID}\n\t\tfor i, sgIID := range info.SecurityGroupIIds {\n\t\t\tvpc_sg_nameid := strings.Split(sgIID.NameId, SG_DELIMITER)\n\t\t\tinfo.SecurityGroupIIds[i].NameId = vpc_sg_nameid[1]\n\t\t}\n\t*/\n\n\t// check Winddows GuestOS\n\tisWindowsOS := false\n\tisWindowsOS, err = checkImageWindowsOS(cldConn, info.ImageType, info.ImageIId)\n\tif err != nil {\n\t\tif strings.Contains(err.Error(), \"yet!\") {\n\t\t\tcblog.Info(err)\n\t\t} else {\n\t\t\tcblog.Error(err)\n\t\t\t//return nil, err\n\t\t\tinfo.SSHAccessPoint = info.PublicIP\n\t\t}\n\t} else {\n\t\tif isWindowsOS {\n\t\t\tinfo.VMUserId = \"Administrator\"\n\t\t\tinfo.SSHAccessPoint = info.PublicIP + \":3389\"\n\t\t} else {\n\t\t\tinfo.VMUserId = \"cb-user\"\n\t\t\t// current: Assume 22 port, except Cloud-Twin\n\t\t\tif info.SSHAccessPoint == \"\" {\n\t\t\t\tinfo.SSHAccessPoint = info.PublicIP + \":22\"\n\t\t\t}\n\t\t}\n\t}\n\n\treturn &info, nil\n}", "title": "" }, { "docid": "31d6f05ee2393068819c4ccda69d918b", "score": "0.4198981", "text": "func (l *Client) AddVoter(context context.Context, key, value string, term time.Duration) error {\n\tif value == \"\" {\n\t\treturn trace.BadParameter(\"voter value for key cannot be empty\")\n\t}\n\tif term < time.Second {\n\t\treturn trace.BadParameter(\"term cannot be < 1s\")\n\t}\n\tgo func() {\n\t\terr := l.elect(key, value, term)\n\t\tif err != nil {\n\t\t\tlog.Debugf(\"voter error: %v\", err)\n\t\t}\n\t\tticker := time.NewTicker(term / 5)\n\t\tdefer ticker.Stop()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-l.pauseC:\n\t\t\t\tlog.Debug(\"was asked to step down, pausing heartbeat\")\n\t\t\t\tselect {\n\t\t\t\tcase <-time.After(term * 2):\n\t\t\t\tcase <-l.closeC:\n\t\t\t\t\treturn\n\t\t\t\tcase <-context.Done():\n\t\t\t\t\tlog.Debugf(\"removing voter for %v\", value)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t}\n\n\t\t\tselect {\n\t\t\tcase <-ticker.C:\n\t\t\t\terr := l.elect(key, value, term)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Debugf(\"voter error: %v\", err)\n\t\t\t\t}\n\t\t\tcase <-l.closeC:\n\t\t\t\treturn\n\t\t\tcase <-context.Done():\n\t\t\t\tlog.Debugf(\"removing voter for %v\", value)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\treturn nil\n}", "title": "" }, { "docid": "4f9016f1623ac8cd40632f33ce644151", "score": "0.4196252", "text": "func (d *volumeDriver) Get(r *volume.GetRequest) (*volume.GetResponse, error) {\n\tlogrus.WithField(\"method\", \"get\").Debugf(\"%#v\", r)\n\tif v, found := d.volumes[r.Name]; found {\n\t\treturn &volume.GetResponse{Volume: &volume.Volume{\n\t\t\tName: v.Name,\n\t\t\tMountpoint: v.Mountpoint, // \"/path/under/PropogatedMount\"\n\t\t}}, nil\n\t} else {\n\t\treturn &volume.GetResponse{}, logError(\"volume %s not found\", r.Name)\n\t}\n}", "title": "" }, { "docid": "42fd6e703e4ffd4d1d7a5284ea1aa97a", "score": "0.41897506", "text": "func getVotingParam(t *testing.T, port string) gov.VotingParams {\n\tres, body := Request(t, port, \"GET\", \"/gov/parameters/voting\", nil)\n\trequire.Equal(t, http.StatusOK, res.StatusCode, body)\n\n\tvar votingParams gov.VotingParams\n\terr := cdc.UnmarshalJSON([]byte(body), &votingParams)\n\trequire.Nil(t, err)\n\treturn votingParams\n}", "title": "" }, { "docid": "db6305e4e03ec4f39a139653a839ac46", "score": "0.4187539", "text": "func (_GatewayVote *GatewayVoteCaller) GetChainName(opts *bind.CallOpts, code uint32) (string, error) {\n\tvar (\n\t\tret0 = new(string)\n\t)\n\tout := ret0\n\terr := _GatewayVote.contract.Call(opts, out, \"getChainName\", code)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "b65a85ddf31a947d857154638d767723", "score": "0.41828874", "text": "func (u SignerRuleResource) GetVote() (result SignerRuleResourceVote, ok bool) {\n\tarmName, _ := u.ArmForSwitch(int32(u.Type))\n\n\tif armName == \"Vote\" {\n\t\tresult = *u.Vote\n\t\tok = true\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "23022d4a3bfc18231bff13ad9b6931b8", "score": "0.41822547", "text": "func (vpcs *VPCSession) GetVolume(id string) (respVolume *provider.Volume, err error) {\n\tvpcs.Logger.Debug(\"Entry of GetVolume method...\")\n\tdefer vpcs.Logger.Debug(\"Exit from GetVolume method...\")\n\n\tvpcs.Logger.Info(\"Basic validation for volume ID...\", zap.Reflect(\"VolumeID\", id))\n\t// validating volume ID\n\terr = validateVolumeID(id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvpcs.Logger.Info(\"Getting volume details from VPC provider...\", zap.Reflect(\"VolumeID\", id))\n\n\tvar volume *models.Volume\n\terr = retry(vpcs.Logger, func() error {\n\t\tvolume, err = vpcs.Apiclient.VolumeService().GetVolume(id, vpcs.Logger)\n\t\treturn err\n\t})\n\n\tif err != nil {\n\t\treturn nil, userError.GetUserError(\"StorageFindFailedWithVolumeId\", err, id)\n\t}\n\n\tvpcs.Logger.Info(\"Successfully retrieved volume details from VPC backend\", zap.Reflect(\"VolumeDetails\", volume))\n\n\t// Converting volume to lib volume type\n\trespVolume = FromProviderToLibVolume(volume, vpcs.Logger)\n\treturn respVolume, err\n}", "title": "" }, { "docid": "8ad83a234cfd12eff12a1eb66455932b", "score": "0.41739556", "text": "func GetFromVault(vaultPath string, vaultClient *api.Client) (string, error) {\n\tif RunWithoutVaultHook() {\n\t\treturn \"\", nil\n\t}\n\n\tlogicalClient := vaultClient.Logical()\n\tif logicalClient == nil {\n\t\tmsg := \"No logical client received when retrieving credentials from vault\"\n\t\treturn \"\", errors.New(msg)\n\t}\n\n\tdata, err := logicalClient.Read(vaultPath)\n\tif err != nil {\n\t\tmsg := \"Error reading credentials from vault for \" + vaultPath + \":\" + err.Error()\n\t\treturn \"\", errors.New(msg)\n\t}\n\n\tif data == nil || data.Data == nil {\n\t\tmsg := \"No data received for credentials from vault for \" + vaultPath\n\t\treturn \"\", errors.New(msg)\n\t}\n\n\tb, jsonErr := json.Marshal(data.Data)\n\tif jsonErr != nil {\n\t\tmsg := \"Error marshaling credentials to json for \" + vaultPath + \":\" + jsonErr.Error()\n\t\treturn \"\", errors.New(msg)\n\t}\n\n\treturn string(b), nil\n}", "title": "" }, { "docid": "39134eec04c1575f6fcd9e7433ce31e1", "score": "0.4172596", "text": "func (t *Template) GetVpcLatticeRuleWithName(name string) (*vpclattice.Rule, error) {\n\tif untyped, ok := t.Resources[name]; ok {\n\t\tswitch resource := untyped.(type) {\n\t\tcase *vpclattice.Rule:\n\t\t\treturn resource, nil\n\t\t}\n\t}\n\treturn nil, fmt.Errorf(\"resource %q of type vpclattice.Rule not found\", name)\n}", "title": "" }, { "docid": "c9218fe7436406767c42f1d77e3c416d", "score": "0.41722712", "text": "func (s *AutograderService) GetUser(ctx context.Context, in *pb.Void) (*pb.User, error) {\n\tusr, err := s.getCurrentUser(ctx)\n\tif err != nil {\n\t\ts.logger.Errorf(\"GetUser failed: authentication error: %v\", err)\n\t\treturn nil, ErrInvalidUserInfo\n\t}\n\tuserInfo, err := s.db.GetUserWithEnrollments(usr.GetID())\n\tif err != nil {\n\t\ts.logger.Errorf(\"GetUser failed to get user with enrollments: %v \", err)\n\t}\n\treturn userInfo, nil\n}", "title": "" }, { "docid": "a4ffd5fe1fbb1c73ea702531bb067a64", "score": "0.4168179", "text": "func (k Keeper) GetPrice(ctx sdk.Context, name string) sdk.Coins {\n\treturn k.GetWhois(ctx, name).Price\n}", "title": "" }, { "docid": "975f0bc3750a5c026dfedbd368a17463", "score": "0.41681063", "text": "func GetVpcByTag(region, key, value string) (Vpc, error) {\n\n\tsess := session.Must(session.NewSession(&aws.Config{Region: aws.String(region)}))\n\tsvc := ec2.New(sess)\n\n\tparams := &ec2.DescribeVpcsInput{\n\t\tFilters: []*ec2.Filter{\n\t\t\t{\n\t\t\t\tName: aws.String(\"tag:\" + key),\n\t\t\t\tValues: []*string{\n\t\t\t\t\taws.String(value),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\tresult, err := svc.DescribeVpcs(params)\n\tif err != nil {\n\t\treturn Vpc{}, err\n\t}\n\n\tcount := len(result.Vpcs)\n\n\tswitch count {\n\tcase 0:\n\t\treturn Vpc{}, errors.New(\"No VPC found with [\" + key + \"] of [\" + value + \"] in [\" + region + \"], Aborting!\")\n\tcase 1:\n\t\tvpc := new(Vpc)\n\t\tvpc.Marshal(result.Vpcs[0], region)\n\t\treturn *vpc, nil\n\t}\n\n\treturn Vpc{}, errors.New(\"Found more than one VPC with [\" + key + \"] of [\" + value + \"] in [\" + region + \"], Aborting!\")\n}", "title": "" } ]
7e6ca9b7bbd00c0e82ad1a65acd72cb1
/ Execute executes the request
[ { "docid": "42728d83785f01e68134661721ed40e2", "score": "0.0", "text": "func (a *PlaidApiService) PaymentInitiationPaymentListExecute(r ApiPaymentInitiationPaymentListRequest) (PaymentInitiationPaymentListResponse, *_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 PaymentInitiationPaymentListResponse\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"PlaidApiService.PaymentInitiationPaymentList\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/payment_initiation/payment/list\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\tif r.paymentInitiationPaymentListRequest == nil {\n\t\treturn localVarReturnValue, nil, reportError(\"paymentInitiationPaymentListRequest 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\t// body params\n\tlocalVarPostBody = r.paymentInitiationPaymentListRequest\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[\"clientId\"]; 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[\"PLAID-CLIENT-ID\"] = 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[\"plaidVersion\"]; 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[\"Plaid-Version\"] = 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[\"secret\"]; 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[\"PLAID-SECRET\"] = 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\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": "5f069371264b5e6f201745742b4069b8", "score": "0.7421676", "text": "func (c *Client) execute(req Request) (Result, error) {\n\treturn c.executeWithContext(context.Background(), req)\n}", "title": "" }, { "docid": "785c4dfa9922b60c7722ec3339e4bb39", "score": "0.71189284", "text": "func (s *SecurityChain) Execute() {\n\ts.Next(s.Request)\n}", "title": "" }, { "docid": "c3f7fb44878674ff75917bab392e2213", "score": "0.7078956", "text": "func (hrc *HTTPRequestClient) Execute(req *http.Request) (*http.Response, error) {\n\treturn hrc.ExecuteWithTimeout(req, time.Second*30)\n}", "title": "" }, { "docid": "326cba3bbe8f85f71d1de137ccec57b3", "score": "0.70708233", "text": "func (k *KempLM) executeRequest(r *http.Request) (body []byte, statusCode int, err error) {\n\t//var err error\n\t//log.Debugf(\"exec url: %v\", r.URL.String())\n\n\tres, err := k.httpClient.Do(r)\n\tif err != nil {\n\t\tlog.Error(err.Error())\n\t\treturn nil, 0, err\n\t}\n\tdefer func() {\n\t\tif err := res.Body.Close(); err != nil {\n\t\t\tlog.Errorf(\"Error closing body %v\", err)\n\t\t}\n\t}()\n\n\tbody, readErr := ioutil.ReadAll(res.Body)\n\tif readErr != nil {\n\t\tlog.Debugf(readErr.Error())\n\t\treturn body, res.StatusCode, err\n\t}\n\n\treturn body, res.StatusCode, nil\n}", "title": "" }, { "docid": "06e555c8c73fbb39c5ff15c8a065666a", "score": "0.6964812", "text": "func (c *Client) execute(req *Request) []byte {\n\tdefer timeTrack(time.Now(), \"Executing\")\n\n\tresp, _ := c.httpClient.R().SetFormData(req.body).Post(req.urlPathExecute)\n\tjsonParsed, err := gabs.ParseJSON(resp.Body())\n\tif err != nil {\n\t\tlog.Fatalf(err.Error())\n\t}\n\tlog.Debugf(\"%+v\", jsonParsed)\n\n\tif req.urlPathStatus != \"\" {\n\t\tserviceRequestID, _ := jsonParsed.Path(\"data.serviceRequestId\").Data().(string)\n\t\tfor {\n\t\t\ttime.Sleep(5 * time.Second)\n\t\t\tresp, _ := c.httpClient.R().SetFormData(map[string]string{\"serviceRequestId\": serviceRequestID}).Post(req.urlPathStatus)\n\t\t\tjsonParsed, err := gabs.ParseJSON(resp.Body())\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatalf(err.Error())\n\t\t\t}\n\t\t\tlog.Debugf(\"%+v\", jsonParsed)\n\n\t\t\tif success, _ := jsonParsed.Path(\"data.success\").Data().(bool); success == true {\n\t\t\t\treturn resp.Body()\n\t\t\t}\n\t\t}\n\t}\n\treturn resp.Body()\n}", "title": "" }, { "docid": "a3068b20eeaf7831fcf7426f76c1b5d3", "score": "0.69499856", "text": "func (c *SSOAuthenticator) executeRequest(req *http.Request) (*http.Response, error) {\n\tres, err := c.httpClient.Do(req)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif res.StatusCode == http.StatusOK ||\n\t\tres.StatusCode == http.StatusCreated {\n\t\treturn res, nil\n\t}\n\treturn res, errors.New(res.Status)\n}", "title": "" }, { "docid": "c9e070f43ef6cb9c0e983d707e77d825", "score": "0.6903226", "text": "func (e *Executor) Execute(args Request) (Response, int, error) {\n\tdefer func(start time.Time) {\n\t\te.latency.RecordValue(timeutil.Now().Sub(start).Nanoseconds())\n\t}(timeutil.Now())\n\tresults := e.ExecuteStatements(\n\t\targs.User, args.Session, args.SQL, args.Params)\n\treturn Response{Results: results, Session: args.Session}, 0, nil\n}", "title": "" }, { "docid": "29a1ada8720c5c6492f6fabff323cbab", "score": "0.68451554", "text": "func (r *Dummy) ExecuteRequest(req rotator.Request) error {\n\tif req.HasAzimuth {\n\t\tif err := r.SetAzimuth(req.Azimuth); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif req.HasElevation {\n\t\tif err := r.SetElevation(req.Elevation); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif req.StopAzimuth {\n\t\tif err := r.StopAzimuth(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif req.StopElevation {\n\t\tif err := r.StopElevation(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif req.Stop {\n\t\tif err := r.Stop(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2d6dc8b23166dc740fb9b9af50137dcc", "score": "0.68169856", "text": "func (c *SPClient) Execute(req *http.Request) (*http.Response, error) {\n\tif c.ConfigPath != \"\" && c.AuthCnfg.GetSiteURL() == \"\" {\n\t\tc.AuthCnfg.ReadConfig(c.ConfigPath)\n\t}\n\tif c.AuthCnfg.GetSiteURL() == \"\" {\n\t\tres := &http.Response{\n\t\t\tStatus: \"400 Bad Request\",\n\t\t\tStatusCode: 400,\n\t\t\tRequest: req,\n\t\t}\n\t\treturn res, fmt.Errorf(\"client initialization error, no siteUrl is provided\")\n\t}\n\terr := c.AuthCnfg.SetAuth(req, c)\n\tif err != nil {\n\t\tres := &http.Response{\n\t\t\tStatus: \"401 Access Denied\",\n\t\t\tStatusCode: 401,\n\t\t\tRequest: req,\n\t\t}\n\t\treturn res, err\n\t}\n\treturn c.Do(req)\n}", "title": "" }, { "docid": "ca6aaeea3cc2181979eff499651ca99b", "score": "0.6802405", "text": "func (c *Client) Execute(ctx context.Context, link string, body, ret interface{}) error {\n\tdata, err := stringify(body)\n\tif err != nil {\n\t\treturn err\n\t}\n\tbuf := bytes.NewBuffer(data)\n\t_, err = c.method(ctx, \"POST\", link, ret, buf, nil)\n\treturn err\n}", "title": "" }, { "docid": "44cd78ccbcac384d7980af9078da3adb", "score": "0.6620742", "text": "func (c *Client) Execute(request *Request) (collection *Collection, err error) {\n\tu := request.Encode(c.options.APIKey)\n\n\treq, err := http.NewRequestWithContext(request.ctx, http.MethodGet, u, nil)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tres, err := c.options.HTTPClient.Do(req)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tdefer func() {\n\t\t_ = res.Body.Close()\n\t}()\n\n\tcollection, err = c.processAPIResponse(res)\n\n\treturn\n}", "title": "" }, { "docid": "1e73dfaecdb40c07132bc6aff6c60b6d", "score": "0.66112244", "text": "func (c *CustomClient) execute(req *http.Request) (io.ReadCloser, error) {\n\tresp, err := c.Do(req)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"client.execute.Do: %w\", err)\n\t}\n\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn nil, fmt.Errorf(\"client.execute.Status: %d\", resp.StatusCode)\n\t}\n\treturn resp.Body, nil\n}", "title": "" }, { "docid": "877799ff72b9f063929e6b2fb317449c", "score": "0.6585414", "text": "func (a *Adyen) execute(method string, requestEntity interface{}) (*Response, error) {\n\tbody, err := json.Marshal(requestEntity)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\turl := a.AdyenURL(method)\n\treq, err := http.NewRequest(\"POST\", url, bytes.NewBuffer(body))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif a.Logger != nil {\n\t\ta.Logger.Printf(\"[Request]: %s %s\\n%s\", method, url, body)\n\t}\n\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treq.SetBasicAuth(a.Credentials.Username, a.Credentials.Password)\n\n\tclient := &http.Client{}\n\tresp, err := client.Do(req)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer resp.Body.Close()\n\n\tbuf := new(bytes.Buffer)\n\tbuf.ReadFrom(resp.Body)\n\n\tif a.Logger != nil {\n\t\ta.Logger.Printf(\"[Response]: %s %s\\n%s\", method, url, buf.String())\n\t}\n\n\tproviderResponse := &Response{\n\t\tResponse: resp,\n\t\tBody: buf.Bytes(),\n\t}\n\n\terr = providerResponse.handleHTTPError()\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn providerResponse, nil\n}", "title": "" }, { "docid": "24001a7cf22280d2d2123032f2375e76", "score": "0.6568617", "text": "func (client *NineClient) Execute(endpoint string, response interface{}) error {\n\n\tvar req *http.Request\n\n\treq, _ = http.NewRequest(\"GET\", client.BaseURL+endpoint, nil)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Origin\", RequestOrigin)\n\n\tresp, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\traven.CaptureError(err, nil)\n\t\tglg.Errorf(\"Failed to read the current week stats response from Trials Report!: %s\", err.Error())\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\terr = json.NewDecoder(resp.Body).Decode(&response)\n\tif err != nil {\n\t\traven.CaptureError(err, nil)\n\t\tglg.Errorf(\"Error parsing trials report response: %s\", err.Error())\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "955a8753d08b6cecd21092efdb537395", "score": "0.6531713", "text": "func Execute(ctx context.Context, method, uri string, body interface{}) ([]byte, error) {\n\tresp, err := client.R().SetContext(ctx).SetBody(body).Execute(method, uri)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif resp.IsError() {\n\t\treturn nil, errors.New(resp.Status())\n\t}\n\n\tvar r struct {\n\t\tData json.RawMessage `json:\"data,omitempty\"`\n\t}\n\terr = json.Unmarshal(resp.Body(), &r)\n\treturn r.Data, err\n}", "title": "" }, { "docid": "212b1d9f362be3a92586b8b155587b9d", "score": "0.6529425", "text": "func (s *Service) Execute(requestBody string) (map[string]interface{}, error) {\n\tvar m interface{}\n\terr := s.executeReal(requestBody, &m)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tn := m.(map[string]interface{})\n\n\treturn n, nil\n}", "title": "" }, { "docid": "f12cc02f9476675a9d88071272f6842a", "score": "0.65154624", "text": "func (g *gin) execute(c ControllerInterface, actionName string){\n\tswitch actionName {\n\tcase \"Post\":\n\t\tc.Post()\n\tcase \"Get\":\n\t\tc.Get()\n\tcase \"Delete\":\n\t\tc.Delete()\n\tcase \"Put\":\n\t\tc.Put()\n\tcase \"Head\":\n\t\tc.Head()\n\tcase \"Patch\":\n\t\tc.Patch()\n\tcase \"Options\":\n\t\tc.Options()\n\tcase \"Any\":\n\t\tc.Any()\n\tcase \"Group\":\n\t\tc.Group()\n\tcase \"Use\":\n\t\tc.Use()\n\tdefault:\n\t\tc.Get()\n\t}\n}", "title": "" }, { "docid": "edf561f4df337428e808979883fee8bb", "score": "0.6478267", "text": "func Execute() {\n\tif err := makeHTTPCmd().Execute(); err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "9066d4e02c3170d3e0a465aa25ae7942", "score": "0.6451415", "text": "func (p *Pool) Execute(query string) (resp []Response, err error) {\n\tpc, err := p.conn()\n\tif err != nil {\n\t\treturn resp, errors.Wrap(err, \"Failed p.Get\")\n\t}\n\tdefer func() {\n\t\tp.putConn(pc, err)\n\t}()\n\tresp, err = pc.Client.executeRequest(query, nil, nil)\n\treturn\n}", "title": "" }, { "docid": "9ed3e28fd6465ee17504717ba4638c8b", "score": "0.6434585", "text": "func (c *Client) execute(method, resourcePath string, options interface{}, resource interface{}) error {\n\treq, err := c.newRequest(method, resourcePath, options)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tresp, err := c.client.Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn fmt.Errorf(\"error http status api %d\", resp.StatusCode)\n\t}\n\n\tif resource != nil {\n\t\terr := json.NewDecoder(resp.Body).Decode(resource)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8a705f869a5d93e8ea3c74d97188f47b", "score": "0.64318436", "text": "func (c *client) Execute(query string) (resp []interfaces.Response, err error) {\n\tif !c.conn.IsConnected() {\n\t\treturn resp, fmt.Errorf(\"Can't write - no connection\")\n\t}\n\tresp, err = c.executeRequest(query, nil, nil)\n\treturn\n}", "title": "" }, { "docid": "b1f5623902b816017a459554733354ce", "score": "0.64118785", "text": "func (g *GHttp) Exec() ([]byte, error) {\n\tswitch g.Method {\n\tcase GET:\n\t\treturn execGet(*g)\n\tcase POST:\n\t\treturn execPost(*g)\n\tcase DELETE:\n\t\treturn execDelete(*g)\n\tcase PUT:\n\t\treturn execPut(*g)\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unexpected method: %v\", g.Method)\n\t}\n}", "title": "" }, { "docid": "19a69d7deb01b0a92731262feb23f685", "score": "0.64086574", "text": "func (r apiStartRequest) Execute() (ResponseEntity, *_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 ResponseEntity\n\t)\n\n\tlocalBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, \"PipelineControllerApiService.Start\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/pipelines/start\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif r.map_ == nil {\n\t\treturn localVarReturnValue, nil, reportError(\"map_ 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{\"*/*\"}\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 = r.map_\n\treq, err := r.apiService.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 := r.apiService.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\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 == 200 {\n\t\t\tvar v ResponseEntity\n\t\t\terr = r.apiService.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\terr = r.apiService.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": "92b37b355c00e8269228f19ec6033e15", "score": "0.64024305", "text": "func (a *Adyen) execute(service string, method string, requestEntity interface{}) (*Response, error) {\n\tbody, err := json.Marshal(requestEntity)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\turl := a.adyenURL(service, method)\n\treq, err := http.NewRequest(\"POST\", url, bytes.NewBuffer(body))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif a.Logger != nil {\n\t\ta.Logger.Printf(\"[Request]: %s %s\\n%s\", method, url, body)\n\t}\n\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treq.SetBasicAuth(a.Credentials.Username, a.Credentials.Password)\n\n\tclient := &http.Client{}\n\tresp, err := client.Do(req)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer resp.Body.Close()\n\n\tbuf := new(bytes.Buffer)\n\tbuf.ReadFrom(resp.Body)\n\n\tif a.Logger != nil {\n\t\ta.Logger.Printf(\"[Response]: %s %s\\n%s\", method, url, buf.String())\n\t}\n\n\tproviderResponse := &Response{\n\t\tResponse: resp,\n\t\tBody: buf.Bytes(),\n\t}\n\n\terr = providerResponse.handleHTTPError()\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn providerResponse, nil\n}", "title": "" }, { "docid": "aabb49bec8397e14592e1963fc5ed439", "score": "0.6379558", "text": "func Execute(t *testing.T, method string, resourceURL string, data interface{}) ([]byte, int) {\n\tbyteArray, err := json.Marshal(data)\n\n\tif err != nil {\n\t\terror(t, \"error Occured %v\", err)\n\t}\n\n\trequest, err := http.NewRequest(\n\t\tmethod,\n\t\tresourceURL,\n\t\tbytes.NewBuffer(byteArray),\n\t)\n\trequest.Header.Set(\"Content-Type\", \"application/json\")\n\n\tif err != nil {\n\t\terror(t, \"error Occured %v\", err)\n\t}\n\n\tclient := &http.Client{Timeout: time.Duration(timeout * time.Second)}\n\tresponse, err := client.Do(request)\n\n\tif err != nil {\n\t\terror(t, \"%s\", err)\n\t}\n\n\tdefer response.Body.Close()\n\n\tcontents, err := ioutil.ReadAll(response.Body)\n\tif err != nil {\n\t\terror(t, \"%s\", err)\n\t}\n\treturn contents, response.StatusCode\n}", "title": "" }, { "docid": "36448666715c2f253ce6c350998ad004", "score": "0.6355817", "text": "func (s *Server) Execute(buff []byte) []byte {\n\tcom := Command{}\n\terr := yaml.Unmarshal(buff, &com)\n\tif err != nil {\n\t\tlog.Error(\"Error parsing command %s\", err.Error())\n\t\treturn returnStatus(\"Error parsing request - bad or currupted struture:\")\n\t}\n\tif com.Command == \"create_account\" { //one case when we don't check password\n\t\treturn s.createAccount(&com)\n\t}\n\n\tif !s.verifyUser(&com) {\n\t\treturn returnStatus(\"Bad login or password\")\n\t}\n\n\tlog.Info(\"User %s execute %s\", com.Login, com.Command)\n\n\tswitch com.Command {\n\tcase \"submit\":\n\t\treturn s.submit(&com)\n\tcase \"get_task\":\n\t\treturn s.getTask(&com)\n\tcase \"contest_ranking\":\n\t\treturn s.getContestRanking(&com)\n\tcase \"round_ranking\":\n\t\treturn s.getRoundRanking(&com)\n\tcase \"list_submissions\":\n\t\treturn s.listSubmissions(&com)\n\tcase \"get_submission\":\n\t\treturn s.getSubmission(&com)\n\tcase \"list_contests\":\n\t\treturn s.listContests(&com)\n\tcase \"join_contest\":\n\t\treturn s.joinContest(&com)\n\t}\n\n\treturn returnStatus(\"Bad command name\")\n}", "title": "" }, { "docid": "cc29e8bfc73593b3e38867cb9d337d27", "score": "0.628738", "text": "func (vk *VK) Execute(code string, obj interface{}, vkErr *Error) {\n\tparams := map[string]string{\"code\": code}\n\tvk.RequestUnmarshal(\"execute\", params, &obj, vkErr)\n}", "title": "" }, { "docid": "48def1b00aaa928bfaed550d37724b42", "score": "0.6277914", "text": "func (s *SubServer) Execute(ctx context.Context, _ *pb.ExecuteRequest) (*pb.ExecuteResponse, error) {\n\t// Throttle so the load tester doesn't spam us and consume all our CPU.\n\tif err := s.lim.Wait(ctx); err != nil {\n\t\treturn nil, err\n\t}\n\n\ts.mu.Lock()\n\tidents := s.idents\n\ts.idents = nil\n\tlatencies := s.latencies\n\ts.latencies = nil\n\ts.mu.Unlock()\n\n\treturn &pb.ExecuteResponse{\n\t\tLatencies: latencies,\n\t\tReceivedMessages: idents,\n\t}, nil\n}", "title": "" }, { "docid": "fa624b23622d61af3b76a4949418d925", "score": "0.6275068", "text": "func (r Update) Perform(ctx context.Context) (*http.Response, error) {\n\treq, err := r.HttpRequest(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tres, err := r.transport.Perform(req)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"an error happened during the Update query execution: %w\", err)\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "d3b11bbce4830652f84a1ce845ed7795", "score": "0.6266848", "text": "func execRequest(request *gorequest.SuperAgent, array interface{}) {\n\tresp, _, errs := request.Send(array).End()\n\tif resp == nil {\n\t\tfmt.Println(\"[STKLOG] An unexpected error happened.\", errs)\n\t\treturn\n\t}\n\tif resp.StatusCode == http.StatusUnauthorized {\n\t\tfmt.Println(\"[STKLOG] project key is invalid.\")\n\t\treturn\n\t}\n\tif resp.StatusCode != http.StatusOK {\n\t\tfmt.Printf(\"[STKLOG] Couldn't send request to %s\\n, errors : %s\\n\", STKLOG_HOST, errs)\n\t}\n}", "title": "" }, { "docid": "c491ef7646d42032815ac1ddf0dc16b6", "score": "0.62629676", "text": "func (req *Request) Exec() (string, bool, error) {\n\tresp, ok, err := req.client.execute(req)\n\treturn resp, ok, err\n}", "title": "" }, { "docid": "97cbdad6db0a5f5905b0b4d046f8129e", "score": "0.6249623", "text": "func (h *Handler) Execute(ctx context.Context, req *pb.ExecuteRequest) (*empty.Empty, error) {\n\tsenderID := h.senderID(ctx)\n\tif senderID == 0 {\n\t\tlog.Warn().Interface(\"client\", ctx.Value(&interceptors.ClientName{})).Msg(\"Failed to obtain participant ID of sender\")\n\t\treturn nil, errors.New(\"Unknown sender\")\n\t}\n\tlog.Trace().Uint64(\"sender_id\", senderID).Msg(\"Executing as per request from sender\")\n\n\terr := h.process.OnExecute(ctx, senderID, req.Account)\n\tif err != nil {\n\t\tlog.Error().Err(err).Msg(\"Failed to execute distributed key generation\")\n\t\treturn nil, err\n\t}\n\n\tlog.Trace().Msg(\"Completed execution successfully\")\n\treturn &empty.Empty{}, nil\n}", "title": "" }, { "docid": "ad426f919cf2fee94356fb9d2a0fe0cb", "score": "0.6213444", "text": "func (m *GRPCArchiveServer) Execute(ctx context.Context, req *proto.Payload) (*proto.Status, error) {\n\tres, err := m.Impl.Execute(req.File)\n\treturn &proto.Status{Success: res}, err\n}", "title": "" }, { "docid": "fa973f9bc1ed38fd832ab6566f4886ed", "score": "0.6211889", "text": "func executeRequest(req *http.Request) *httptest.ResponseRecorder {\n\trr := httptest.NewRecorder()\n\ta.Router.ServeHTTP(rr, req)\n\n\treturn rr\n}", "title": "" }, { "docid": "38672ef04c05cf51f9fe6f6b1b78d216", "score": "0.6208959", "text": "func (r apiTestIAMPermissionsRequest) Execute() (StackTestIAMPermissionsResponse, *_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 StackTestIAMPermissionsResponse\n\t)\n\n\tlocalBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, \"StackPoliciesApiService.TestIAMPermissions\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/stack/v1/stacks/{stack_id}/iam/test\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"stack_id\"+\"}\", _neturl.QueryEscape(parameterToString(r.stackId, \"\")) , -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\t\n\t\n\tif r.stackTestIAMPermissionsRequest == nil {\n\t\treturn localVarReturnValue, nil, reportError(\"stackTestIAMPermissionsRequest 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\t// body params\n\tlocalVarPostBody = r.stackTestIAMPermissionsRequest\n\treq, err := r.apiService.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 := r.apiService.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\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 StackpathapiStatus\n\t\t\terr = r.apiService.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 StackpathapiStatus\n\t\t\terr = r.apiService.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\t\tvar v StackpathapiStatus\n\t\t\terr = r.apiService.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\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = r.apiService.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": "4cf95e652892dc9739e3d1f814078cc5", "score": "0.6206932", "text": "func Execute() {\n\t// set the base url\n\ttillclient.BaseURL = BaseURL\n\n\t// set the license's public key\n\tdecpubkey, err := hex.DecodeString(string(PubKey))\n\tif err != nil {\n\t\tlog.Fatalln(\"could not decode public key:\", PubKey)\n\t}\n\tlicense.PublicKey = decpubkey\n\n\tif err := rootCmd.Execute(); err != nil {\n\t\tfmt.Println(err)\n\t\tos.Exit(1)\n\t}\n}", "title": "" }, { "docid": "959fdbc42d4a07df38fb40941e5f68ef", "score": "0.6187958", "text": "func (cb *CircuitBreaker) Execute(req func() (interface{}, error)) (interface{}, error) {\n\tgeneration, err := cb.beforeRequest()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer func() {\n\t\te := recover()\n\t\tif e != nil {\n\t\t\tcb.afterRequest(generation, false)\n\t\t\tpanic(e)\n\t\t}\n\t}()\n\n\tresult, err := req()\n\tcb.afterRequest(generation, err == nil || !cb.recordError(err))\n\treturn result, err\n}", "title": "" }, { "docid": "938d1ef8ad3452c19a13ec29d14d1ef0", "score": "0.61862844", "text": "func (r Relay) Execute(hostedBlockchains HostedBlockchains) (string, sdk.Error) {\n\t// retrieve the hosted blockchain url requested\n\turl, err := hostedBlockchains.GetChainURL(r.Proof.Blockchain)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\t// do basic http request on the relay\n\tres, er := executeHTTPRequest(r.Payload.Data, url, r.Payload.Method, r.Payload.Headers)\n\tif er != nil {\n\t\treturn res, NewHTTPExecutionError(ModuleName, er)\n\t}\n\treturn res, nil\n}", "title": "" }, { "docid": "14c4f5b14683d30014963e4c27fe1290", "score": "0.6178471", "text": "func ExecuteRequest(client *http.Client, c *Connection, override ...*NVPair) (rep *http.Response, err error) {\n\treq := c.BuildRequest()\n\tfor _, op := range override {\n\t\treq.Header.Set(op.Name, op.Value)\n\t}\n\n\trep, err = client.Do(req)\n\treturn\n}", "title": "" }, { "docid": "cd7a75614bd7fa459d38f16674e6b6ca", "score": "0.6176633", "text": "func executeRequest(r *gin.Engine, req *http.Request) *httptest.ResponseRecorder {\n\trr := httptest.NewRecorder()\n\tr.ServeHTTP(rr, req)\n\treturn rr\n}", "title": "" }, { "docid": "71a6d71b2eb86ee4a679ebce8a14d761", "score": "0.61689436", "text": "func (self *runCommand) Execute() error {\n\n\tvar err error\n\n\th := &handler{\n\t\tr: latex.New(),\n\t}\n\n\thttp.Handle(serviceEndpoint, h)\n\n\tif strings.HasPrefix(*prefix, \"/\") {\n\t\t*prefix = \"/\" + strings.TrimLeft(*prefix, \"/\")\n\t\t*prefix = strings.TrimRight(*prefix, \"/\") + \"/\"\n\t\thttp.HandleFunc(*prefix, serveImages)\n\t}\n\n\taddr := *bindSock\n\tdomain := \"unix\"\n\n\tif addr == \"\" {\n\t\tdomain = \"tcp\"\n\t\taddr = fmt.Sprintf(\"%s:%d\", *bindIp, *bindPort)\n\t}\n\n\tlistener, err := net.Listen(domain, addr)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdefer listener.Close()\n\n\tswitch *serverType {\n\tcase \"standalone\":\n\t\terr = http.Serve(listener, nil)\n\tcase \"fastcgi\":\n\t\terr = fcgi.Serve(listener, nil)\n\tdefault:\n\t\treturn errors.New(\"Server type can be either \\\"fastcgi\\\" or \\\"standalone\\\" only.\")\n\t}\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d2bc29ee34cd03c53ec9320ec2a9b523", "score": "0.6158474", "text": "func executeRequest(req *http.Request) *httptest.ResponseRecorder {\r\n\trr := httptest.NewRecorder()\r\n\ta.Router.ServeHTTP(rr, req)\r\n\r\n\treturn rr\r\n}", "title": "" }, { "docid": "fbf34b9c9b9d23632695849c30a7cb90", "score": "0.6152986", "text": "func (p *dns) Exec(r *http.Request, out interface{}, in ...interface{}) (*http.Response, error) {\n\n\treturn p.Session.Exec(r, out, in...)\n}", "title": "" }, { "docid": "2b448708ca6dbbbd27bf75578d591f8e", "score": "0.61517715", "text": "func (c *Client) Execute() int {\n\t/**\n\t $ curl -D - -X GET http://api.b.st-hatena.com/entry.count?url=https%3A%2F%2Fbudougumi0617.github.io%2F2019%2F05%2F12%2Fpass-aws-solution-architect-associate%2F\n\t HTTP/1.1 200 OK\n\t Content-Type: text/plain\n\t Content-Length: 3\n\t Connection: keep-alive\n\t Date: Mon, 24 Jun 2019 12:21:51 GMT\n\t Server: nginx\n\t Cache-Control: public, max-age=3600, s-maxage=3600\n\t X-Cache: Miss from cloudfront\n\t Via: 1.1 4ca8d239c2b4b1a578fa3c7797e67c11.cloudfront.net (CloudFront)\n\t X-Amz-Cf-Pop: NRT57-C3\n\t X-Amz-Cf-Id: 3wS1whM3YI4I_PWIriHF6jGjZ5YkVXpGVAMbUSFarfz8qeUnI6osTw==\n\n\t 268%\n\t*/\n\tss := c.readLines()\n\tes := build(ss)\n\tcli := &http.Client{\n\t\tTimeout: 3 * time.Second,\n\t}\n\tfillHBC(cli, es)\n\n\tfor _, e := range es {\n\t\t// Report err to STDERR\n\t\tif e.Err == nil {\n\t\t\tfmt.Fprintf(c.Stdout, \"%5d\\t%s\\n\", e.HBC, e.Page.String())\n\t\t}\n\t}\n\treturn 0\n}", "title": "" }, { "docid": "d63d36c16e7d256be78a7e6ad2672f69", "score": "0.6144627", "text": "func (as *AgentServer) Execute(request *pb.ExecutionRequest, stream pb.GleamAgent_ExecuteServer) error {\n\n\tdir := path.Join(*as.Option.Dir, fmt.Sprintf(\"%d\", request.GetInstructions().GetFlowHashCode()), request.GetDir())\n\tos.MkdirAll(dir, 0755)\n\n\tallocated := *request.GetResource()\n\n\tas.plusAllocated(allocated)\n\tdefer as.minusAllocated(allocated)\n\n\treturn as.executeCommand(stream, request, dir)\n\n}", "title": "" }, { "docid": "da97069e7320cda87d9995f36a246251", "score": "0.61440045", "text": "func ExecuteHandler(view *View) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\t\t// Get the file ID from the URI\n\t\tvars := mux.Vars(r)\n\t\tfId := vars[\"f-id\"]\n\n\t\t// Get the file from the storage\n\t\tif file, err := view.Controller.GetFileWithId(fId); err != nil {\n\t\t\tlog.Println(err)\n\t\t\thttp.Error(w, err.Error(), 500)\n\t\t} else {\n\t\t\tproblemId := file.ProblemId\n\n\t\t\t// Get the problem from the storage\n\t\t\tif problem, err := view.Controller.GetProblemWithId(problemId); err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t\thttp.Error(w, err.Error(), 500)\n\t\t\t} else {\n\t\t\t\t// Get the sender ID from the request\n\t\t\t\tsenderId := context.Get(r, \"senderId\").(string)\n\n\t\t\t\t// Get the contest ID from the problem\n\t\t\t\tcontestId := problem.ContestId\n\n\t\t\t\t// Verify if the sender is the owner of the problem\n\t\t\t\tif !view.Controller.IsPublic(contestId) && !view.Controller.IsMyContest(senderId, contestId) {\n\t\t\t\t\terr := \"Not an owner of the problem\"\n\t\t\t\t\tlog.Println(err)\n\t\t\t\t\thttp.Error(w, err, 403)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\t// Add the submission in the storage\n\t\t\t\tsubmissionId, err := view.Controller.AddSubmissionToStorage(senderId, problemId, fId)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Println(err)\n\t\t\t\t\thttp.Error(w, err.Error(), 500)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\t// Run the submission\n\t\t\t\tif err := view.Controller.RunSubmission(submissionId, fId, problemId); err != nil {\n\t\t\t\t\tlog.Println(err)\n\t\t\t\t\thttp.Error(w, err.Error(), 500)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t})\n}", "title": "" }, { "docid": "12a78993e7adebe0bc108b9363d8f707", "score": "0.61386377", "text": "func executeHTTPRequest(payload string, url string, method string, headers map[string]string) (string, error) { // todo improved http responses\n\treq, err := http.NewRequest(method, url, bytes.NewBuffer([]byte(payload)))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif len(headers) == 0 { // def to json\n\t\treq.Header.Set(\"Content-Type\", \"application/json\")\n\t} else {\n\t\tfor k, v := range headers {\n\t\t\treq.Header.Set(k, v)\n\t\t}\n\t}\n\tresp, err := (&http.Client{}).Do(req)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif resp.StatusCode != 200 {\n\t\treturn \"\", NewHTTPStatusCodeError(ModuleName, resp.StatusCode)\n\t}\n\tdefer resp.Body.Close()\n\tbody, _ := ioutil.ReadAll(resp.Body)\n\treturn string(body), nil\n}", "title": "" }, { "docid": "8b16b9758e401b332d47e05f8d88d065", "score": "0.61299884", "text": "func (step *MethodStep) Execute(data *RuntimeInfo) int {\n\tret := 200\n\tswitch step.Do {\n\tcase \"sql\":\n\t\tret = step.sql(data)\n\tcase \"setheader\":\n\t\tret = step.setheader(data)\n\tcase \"assertdefined\":\n\t\tret = step.assertdefined(data)\n\tcase \"assertequal\":\n\t\tret = step.assertequal(data)\n\tcase \"assertnotequal\":\n\t\tret = step.assertnotequal(data)\n\tcase \"default\":\n\t\tret = step.defaultvalue(data)\n\tdefault:\n\t\tret = step.unknown(data)\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "9f72592e8c4a11496e9db5292156b2b3", "score": "0.61235404", "text": "func (c *Client) executeRequest(ctx context.Context, u string, bodyFunc func(body io.Reader) error) (err error) {\n\tdefer func() {\n\t\tif ctx.Err() != nil {\n\t\t\terr = fmt.Errorf(\"%v: %w\", err, derrors.ProxyTimedOut)\n\t\t}\n\t\tderrors.WrapStack(&err, \"executeRequest(ctx, %q)\", u)\n\t}()\n\n\treq, err := http.NewRequest(\"GET\", u, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif c.disableFetch {\n\t\treq.Header.Set(DisableFetchHeader, \"true\")\n\t}\n\tr, err := ctxhttp.Do(ctx, c.HTTPClient, req)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"ctxhttp.Do(ctx, client, %q): %v\", u, err)\n\t}\n\tdefer r.Body.Close()\n\tif err := responseError(r, c.disableFetch); err != nil {\n\t\treturn err\n\t}\n\treturn bodyFunc(r.Body)\n}", "title": "" }, { "docid": "e6d94d22d66554422b3de8647037a022", "score": "0.6097578", "text": "func (c *Client) Execute(query string, bindings, rebindings map[string]interface{}) ([]*GremlinRespData, error) {\n\tc.verbose(\"connection: %+v\", c.conn)\n\tif c.conn.isDisposed() {\n\t\treturn nil, ErrorConnectionDisposed\n\t}\n\tc.verbose(\"query: %s\", query)\n\tresp, err := c.executeRequest(query, bindings, rebindings)\n\tc.verbose(\"response: %+v\", spew.Sprint(resp))\n\treturn resp, err\n}", "title": "" }, { "docid": "553a6c3248028192a778d0ff9c707ad0", "score": "0.60946673", "text": "func (f *Adapter) Exec(ctx context.Context, req *gomapb.ExecReq) (resp *gomapb.ExecResp, err error) {\n\tctx, span := trace.StartSpan(ctx, \"go.chromium.org/goma/server/remoteexec.Adapter.Exec\")\n\tdefer span.End()\n\n\tlogger := log.FromContext(ctx)\n\tdefer func() {\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\terr := exec.RecordAPIError(ctx, resp)\n\t\tif err != nil {\n\t\t\tlogger.Errorf(\"failed to record stats: %v\", err)\n\t\t}\n\t}()\n\n\t// Use this to collect all timestamps and then print on one line,\n\t// regardless of where this function returns.\n\tespan := &execSpan{t0: time.Now()}\n\tdefer espan.Close(ctx)\n\n\tadjustExecReq(req)\n\tctx = f.outgoingContext(ctx, req.GetRequesterInfo())\n\tf.ensureCapabilities(ctx)\n\n\tr := f.newRequest(ctx, req)\n\tdefer r.Close()\n\tespan.req = r\n\n\tdur := espan.Do(ctx, \"inventory\", 1*time.Second, func(ctx context.Context) {\n\t\tresp = r.getInventoryData(ctx)\n\t})\n\tif resp != nil {\n\t\tlogger.Infof(\"fail fast in inventory lookup: %s\", dur)\n\t\treturn resp, nil\n\t}\n\n\tdur = espan.Do(ctx, \"input tree\", 30*time.Second, func(ctx context.Context) {\n\t\tresp = r.newInputTree(ctx)\n\t})\n\tif resp != nil {\n\t\tlogger.Infof(\"fail fast in input tree: %s\", dur)\n\t\treturn resp, nil\n\t}\n\n\tespan.Do(ctx, \"setup\", 1*time.Second, func(ctx context.Context) {\n\t\tr.setupNewAction(ctx)\n\t})\n\n\teresp := &rpb.ExecuteResponse{}\n\tvar cached bool\n\tespan.Do(ctx, \"check cache\", 3*time.Second, func(ctx context.Context) {\n\t\teresp.Result, cached = r.checkCache(ctx)\n\t})\n\tif !cached {\n\t\tvar blobs []*rpb.Digest\n\t\tvar err error\n\t\tespan.Do(ctx, \"check missing\", 10*time.Second, func(ctx context.Context) {\n\t\t\tblobs, err = r.missingBlobs(ctx)\n\t\t})\n\t\tif err != nil {\n\t\t\tlogger.Errorf(\"error in check missing blobs: %v\", err)\n\t\t\treturn nil, err\n\t\t}\n\n\t\tespan.Do(ctx, \"upload blobs\", 30*time.Second, func(ctx context.Context) {\n\t\t\tresp, err = r.uploadBlobs(ctx, blobs)\n\t\t})\n\t\tif err != nil {\n\t\t\tlogger.Errorf(\"error in upload blobs: %v\", err)\n\t\t\treturn nil, err\n\t\t}\n\t\tif resp != nil {\n\t\t\tlogger.Infof(\"fail fast for uploading missing blobs: %v\", resp)\n\t\t\treturn resp, nil\n\t\t}\n\n\t\tespan.Do(ctx, \"execute\", 0, func(ctx context.Context) {\n\t\t\teresp, err = r.executeAction(ctx)\n\t\t})\n\t\tif err != nil {\n\t\t\tlogger.Infof(\"execute err=%v\", err)\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tespan.Do(ctx, \"response\", 30*time.Second, func(ctx context.Context) {\n\t\tresp, err = r.newResp(ctx, eresp, cached)\n\t})\n\treturn resp, err\n}", "title": "" }, { "docid": "ab8c4c277bd2d8e6522356d7b767fa60", "score": "0.60797864", "text": "func (j *Jira) execRequest(method, aURL string, params map[string]interface{}) ([]byte, error) {\n\n\t// json string encode the params for the POST body if there are any\n\tvar body io.Reader\n\tif params != nil && method == mPost {\n\t\tb, err := json.Marshal(params)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Json error: \", err)\n\t\t}\n\t\tbody = bytes.NewBuffer(b)\n\t}\n\n\treq, err := http.NewRequest(method, aURL, body)\n\tif err != nil {\n\t\tfmt.Println(\"execRequest error: \", err)\n\t\treturn nil, err\n\t}\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.SetBasicAuth(j.auth.Username, j.auth.Password)\n\n\tresp, rerr := j.client.Do(req)\n\tif rerr != nil {\n\t\tfmt.Println(\"req error: \", rerr)\n\t\treturn nil, rerr\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != http.StatusOK && resp.StatusCode > 399 {\n\t\treturn nil, fmt.Errorf(\"HTTP Error Status returned: %d\", resp.StatusCode)\n\t}\n\n\tdata, derr := ioutil.ReadAll(resp.Body)\n\tif derr != nil {\n\t\tfmt.Println(\"Error reading response: \", derr)\n\t\treturn nil, derr\n\t}\n\n\treturn data, nil\n}", "title": "" }, { "docid": "bf516545a1cd8429e03c163c2da0985f", "score": "0.60778505", "text": "func (t *TaskRunsServerTransport) Do(req *http.Request) (*http.Response, error) {\n\trawMethod := req.Context().Value(runtime.CtxAPINameKey{})\n\tmethod, ok := rawMethod.(string)\n\tif !ok {\n\t\treturn nil, nonRetriableError{errors.New(\"unable to dispatch request, missing value for CtxAPINameKey\")}\n\t}\n\n\tvar resp *http.Response\n\tvar err error\n\n\tswitch method {\n\tcase \"TaskRunsClient.BeginCreate\":\n\t\tresp, err = t.dispatchBeginCreate(req)\n\tcase \"TaskRunsClient.BeginDelete\":\n\t\tresp, err = t.dispatchBeginDelete(req)\n\tcase \"TaskRunsClient.Get\":\n\t\tresp, err = t.dispatchGet(req)\n\tcase \"TaskRunsClient.GetDetails\":\n\t\tresp, err = t.dispatchGetDetails(req)\n\tcase \"TaskRunsClient.NewListPager\":\n\t\tresp, err = t.dispatchNewListPager(req)\n\tcase \"TaskRunsClient.BeginUpdate\":\n\t\tresp, err = t.dispatchBeginUpdate(req)\n\tdefault:\n\t\terr = fmt.Errorf(\"unhandled API %s\", method)\n\t}\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "69b746cd9e465ffb103c76130929ac56", "score": "0.60642105", "text": "func (wa WrapAction)Execute(w http.ResponseWriter, r *http.Request) {\n if wa.action == nil {\n log.Panicln(\"no action\")\n return\n }\n r.ParseForm()\n log.Printf(\"receive input:[%+v]\", r.Form)\n output := make(OutputType)\n err := wa.action.Execute(InputType(r.Form), output)\n if err != nil {\n log.Println(err)\n return\n }\n log.Printf(\"output:[%+v]\", output)\n //to print template or just output json data\n tplName, exist := output[\"template\"]\n if exist == true {\n tplNameStr, ok := tplName.(string)\n if ok != true {\n log.Panicln(\"error template name\")\n return\n }\n goPath := os.Getenv(\"GOPATH\")\n tpl, err := template.ParseFiles(goPath + \"/src/templates/\" + tplNameStr)\n if err != nil {\n log.Panicln(err)\n return\n }\n tpl.Execute(w, output)\n } else {\n log.Printf(\"output json\")\n outputByte, err := json.Marshal(output)\n if err != nil {\n log.Panicln(err)\n return\n }\n outputStr := string(outputByte)\n fmt.Fprint(w, outputStr)\n }\n return\n}", "title": "" }, { "docid": "dd343b74407711ace049fd14d9a8ae57", "score": "0.6056719", "text": "func (c *Command) Execute(ctx context.Context, response *accessverifier.Response) error {\n\tdata := response.Payload.Data\n\tapiEndpoints := data.ApiEndpoints\n\n\tif len(apiEndpoints) == 0 {\n\t\treturn errors.New(\"Custom action error: Empty API endpoints\")\n\t}\n\n\treturn c.processApiEndpoints(ctx, response)\n}", "title": "" }, { "docid": "9a0eaca9ac8d75b2a65f7f018ba36ba1", "score": "0.6044292", "text": "func (middleware *PrepareDownloadRequest) Execute(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tshortUrl := chi.URLParam(r, \"shortUrl\")\n\n\t\tif shortUrl == \"\" {\n\t\t\te := kerr.NewErr(\n\t\t\t\tkerr.ErrLvlError,\n\t\t\t\tErrorDomain,\n\t\t\t\tValidationErrorCode,\n\t\t\t\tfmt.Errorf(\"field 'shortUrl' must be set\"),\n\t\t\t\tnil)\n\n\t\t\t_ = presenter.JsonError(w, e, 402)\n\t\t\treturn\n\t\t}\n\n\t\tquery := file.DownloadFileQuery{\n\t\t\tShortUrl: shortUrl,\n\t\t}\n\n\t\tctx := context.WithValue(r.Context(), \"query\", query)\n\t\tnext.ServeHTTP(w, r.WithContext(ctx))\n\t})\n}", "title": "" }, { "docid": "f3a36acc90cb7faa3702b250bd6926ae", "score": "0.6033948", "text": "func (c *ConnectorAdapter) Execute(expr string,\n\targs interface{}) (*tarantool.Response, error) {\n\treturn c.pool.Execute(expr, args, c.mode)\n}", "title": "" }, { "docid": "8b80aa1a6457df1b967dd2fc74bd9fad", "score": "0.6032737", "text": "func executeGenericHttpRequest(request genericHttpRequest) (int, string, error) {\n\tclient := http.Client{}\n\n\t// define the request\n\tlog.Println(request.method, request.uri, request.uri, request.body)\n\treq, err := http.NewRequest(request.method, request.uri, bytes.NewBufferString(request.body))\n\n\tif err != nil {\n\t\treturn -1, \"\", err\n\t}\n\n\t// add the headers\n\tfor key, value := range request.headers {\n\t\treq.Header.Add(key, value)\n\t}\n\n\t// execute\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn -1, \"\", err\n\t}\n\n\tdefer resp.Body.Close()\n\tbody, err := ioutil.ReadAll(resp.Body)\n\n\treturn resp.StatusCode, string(body), err\n}", "title": "" }, { "docid": "ef0d442d012a097fc93c9ed30f2b4e36", "score": "0.6030835", "text": "func (bb *Controller) Execute(cmd interface{}) (resp Response, err error) {\n\t// prepare header\n\tcmdLine, err := stob.Marshal(&Header{\n\t\tControl: ControlHost,\n\t\tAddress: UINT8(bb.address),\n\t\tSeqNo: UINT16(bb.SeqNo()),\n\t})\n\tif err != nil {\n\t\treturn resp, err\n\t}\n\n\t// convert command structure to the bytes\n\tcmdPayload, err := stob.Marshal(cmd)\n\tif err != nil {\n\t\treturn resp, err\n\t}\n\n\t// append command and calculate crc\n\tcmdLine = append(cmdLine, cmdPayload...)\n\tcmdLine = append(cmdLine, bb.CRC(cmdLine)...)\n\tcmdLine = append(cmdLine, '\\r')\n\n\tlog.Debug(string(cmdLine))\n\n\tbb.Lock()\n\tdefer bb.Unlock()\n\n\t// write command line\n\tif _, err := bb.port.Write(cmdLine); err != nil {\n\t\treturn resp, err\n\t}\n\n\trespLine := bb.readResponse()\n\n\tlog.Debug(string(respLine))\n\n\terr = stob.Unmarshal(respLine, &resp)\n\treturn\n}", "title": "" }, { "docid": "48fa6ad7efe80c618422e17590234e44", "score": "0.60260314", "text": "func (client *yigimClient) Execute(paymentExecute *PaymentExecute) (*PaymentExecuteResult, error) {\n\treq, err := client.buildRequest(\"payment/execute\", paymentExecute)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresponse, err := client.executeRequest(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar result PaymentExecuteResult\n\terr = json.Unmarshal(response, &result)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"Cannot unmarshal the response\")\n\t}\n\treturn &result, nil\n}", "title": "" }, { "docid": "23a0639a877c8062aca523005c899938", "score": "0.59907264", "text": "func Execute() {\n\n\tgo func() {\n\t\tlog.Println(http.ListenAndServe(\"localhost:6060\", nil))\n\t}()\n\n\tvar mode = gin.DebugMode\n\tif production {\n\t\tmode = gin.ReleaseMode\n\t}\n\n\tr := api.CollectRouter(mode, static)\n\n\tif err := r.Run(fmt.Sprintf(\"0.0.0.0:%d\", port)); err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "8b59f31ab30bc7911dda313efa59c9e0", "score": "0.5972175", "text": "func (mhc *MultiHttpContext) Execute() (vrc int, erc int) {\n\tvrc = 0 // Mark valid response count to zero\n\terc = 0 // Mark invalid response count to zero\n\tif mhc.hccount <= 0 {\n\t\treturn\n\t}\n\n\tmhc.wg.Add(mhc.hccount) //Set waitgroup count\n\tfor i := 0; i < mhc.hccount; i++ {\n\t\tgo mhc.hclist[i].submit(&mhc.wg)\n\t}\n\tmhc.wg.Wait() //Wait for all go routines to finish\n\n\tfor i := 0; i < mhc.hccount; i++ { // validate each response\n\t\tif mhc.hclist[i].err == nil && mhc.hclist[i].respBody != \"\" {\n\t\t\tvrc += 1\n\t\t} else {\n\t\t\terc += 1\n\t\t}\n\t}\n\treturn vrc, erc\n}", "title": "" }, { "docid": "d1b7ead51b0e30c5f853401b126d9f08", "score": "0.59612805", "text": "func (f FinalURL) Execute(t *Test) error {\n\tif t.Response.Response == nil || t.Response.Response.Request == nil ||\n\t\tt.Response.Response.Request.URL == nil {\n\t\treturn fmt.Errorf(\"no request URL to analyze\")\n\t}\n\treturn Condition(f).Fullfilled(t.Response.Response.Request.URL.String())\n}", "title": "" }, { "docid": "315f877b726248d0f65a3350bd27cfae", "score": "0.5960134", "text": "func (p *GetItem) Execute() (result *GetItemResult, err error) {\n\treturn p.client.executor.GetItem(p)\n}", "title": "" }, { "docid": "979296fdc10976724e5d9f2bb5f374ea", "score": "0.5951726", "text": "func Execute() error {\n\treturn New().Execute()\n}", "title": "" }, { "docid": "c5e5dc7348079461065a9cfb355c60da", "score": "0.5949273", "text": "func (c *Cluster) Execute(f es.Fireable, response interface{}) (err error) {\n\tdefer func(began time.Time) {\n\t\tlabels := c.labels(\"execute\", err == nil)\n\t\tupdateRequestMetrics(labels, time.Since(began))\n\t}(time.Now())\n\n\treturn c.cluster.Execute(f, response)\n}", "title": "" }, { "docid": "3944cbd8396456c663ec1985260f7c8c", "score": "0.59350634", "text": "func (e *SettleTransaction) Execute(\n\tctx context.Context,\n) (*int, *svc.Resp, error) {\n\tswitch authentication.Get(ctx).Status {\n\tcase authentication.AutStSkipped:\n\t\treturn e.ExecutePropagated(ctx)\n\tcase authentication.AutStSucceeded:\n\t\treturn e.ExecuteCanonical(ctx)\n\t}\n\treturn nil, nil, errors.Trace(errors.Newf(\n\t\t\"Authentication status not expected: %s\",\n\t\tauthentication.Get(ctx).Status))\n}", "title": "" }, { "docid": "3d8aa486f909073643c6393db3e5c975", "score": "0.5914694", "text": "func (render *Render) Execute(name string, context interface{}, request *http.Request, writer http.ResponseWriter) error {\n\ttmpl := &Template{render: render}\n\treturn tmpl.Execute(name, context, request, writer)\n}", "title": "" }, { "docid": "46d40942175346654f1c1062e29167c7", "score": "0.591451", "text": "func (r apiFilesPostRequest) Execute() (*_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)\n\n\tlocalBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, \"ApplianceUpgradeApiService.FilesPost\")\n\tif err != nil {\n\t\treturn nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/files\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif r.authorization == nil {\n\t\treturn 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 := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := r.apiService.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn 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 == 400 {\n\t\t\tvar v Error\n\t\t\terr = r.apiService.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 localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v Error\n\t\t\terr = r.apiService.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 localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v Error\n\t\t\terr = r.apiService.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 localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 409 {\n\t\t\tvar v Error\n\t\t\terr = r.apiService.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 localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 422 {\n\t\t\tvar v ValidationError\n\t\t\terr = r.apiService.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 localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 500 {\n\t\t\tvar v Error\n\t\t\terr = r.apiService.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 localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "8812d9e696ca8ca8e95bda9ad1f0b8e6", "score": "0.5913669", "text": "func (c *Client) Perform (req *http.Request) (*http.Response, error) {\n\tfprintf(c.Logger, \"> Requesting %v\\n\", req.URL.String())\n\tclient := http.Client{}\n\tres, err := client.Do(req)\n\tif err != nil { return nil, err }\n\treturn res, nil\n}", "title": "" }, { "docid": "7547d46f995eeaccf251dfb0165d7349", "score": "0.5913576", "text": "func (q Query) Execute() interface{} {\n return q.Client.call_query(q)\n}", "title": "" }, { "docid": "ccfca294cb286652695e628e31fcd06e", "score": "0.5906674", "text": "func (r apiTriggerPipelineRequest) Execute() (*_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)\n\n\tlocalBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, \"PipelineControllerApiService.TriggerPipeline\")\n\tif err != nil {\n\t\treturn nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/pipelines/{application}/{pipelineName}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"application\"+\"}\", _neturl.QueryEscape(parameterToString(r.application, \"\")), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"pipelineName\"+\"}\", _neturl.QueryEscape(parameterToString(r.pipelineName, \"\")), -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{\"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{\"*/*\"}\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 = r.trigger\n\treq, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := r.apiService.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn 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 == 202 {\n\t\t\tvar v map[string]interface{}\n\t\t\terr = r.apiService.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 localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarHTTPResponse, newErr\n\t\t}\n\t\treturn localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "fc6133c88a8228d9e435e8ec0e2a8c57", "score": "0.59018123", "text": "func (cs *ChaincodeSupport) Execute(ctxt context.Context, cccid *ccprovider.CCContext, spec ccprovider.ChaincodeSpecGetter) (*pb.Response, *pb.ChaincodeEvent, error) {\n\tresp, err := cs.Invoke(ctxt, cccid, spec)\n\tif err != nil {\n\t\treturn nil, nil, errors.Wrapf(err, \"failed to execute transaction %s\", cccid.TxID)\n\t}\n\tif resp == nil {\n\t\treturn nil, nil, errors.Errorf(\"nil response from transaction %s\", cccid.TxID)\n\t}\n\n\tif resp.ChaincodeEvent != nil {\n\t\tresp.ChaincodeEvent.ChaincodeId = cccid.Name\n\t\tresp.ChaincodeEvent.TxId = cccid.TxID\n\t}\n\n\tswitch resp.Type {\n\tcase pb.ChaincodeMessage_COMPLETED:\n\t\tres := &pb.Response{}\n\t\terr := proto.Unmarshal(resp.Payload, res)\n\t\tif err != nil {\n\t\t\treturn nil, nil, errors.Wrapf(err, \"failed to unmarshal response for transaction %s\", cccid.TxID)\n\t\t}\n\t\treturn res, resp.ChaincodeEvent, nil\n\n\tcase pb.ChaincodeMessage_ERROR:\n\t\treturn nil, resp.ChaincodeEvent, errors.Errorf(\"transaction returned with failure: %s\", resp.Payload)\n\n\tdefault:\n\t\treturn nil, nil, errors.Errorf(\"unexpected response type %d for transaction %s\", resp.Type, cccid.TxID)\n\t}\n}", "title": "" }, { "docid": "7fbbd41e20faf6944ad1c6bfed6ea856", "score": "0.5890534", "text": "func (provider *ElasticSearchProvider) ExecRequest(request string) (*monitor.Hits, error) {\n\turl := fmt.Sprintf(provider.URL + \"/_search\")\n\telResponse := &ElasticResponse{}\n\n\treq, err := http.NewRequest(\"GET\", url, bytes.NewBufferString(request))\n\treq.Header.Set(\"Content-Type\", \"application/Json\")\n\n\tif err != nil {\n\t\tlog.Fatal(\"NewRequest: \", err)\n\t\treturn nil, err\n\t}\n\n\tclient := &http.Client{}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tlog.Fatal(\"Do: \", err)\n\t}\n\tdefer resp.Body.Close()\n\n\tif err := json.NewDecoder(resp.Body).Decode(elResponse); err != nil {\n\t\tlog.Println(err)\n\t}\n\n\treturn &monitor.Hits{\n\t\tTotal: elResponse.Hits.Total,\n\t\tResults: elResponse.Hits.Hits,\n\t}, err\n}", "title": "" }, { "docid": "cfe4e462914524598c78abac83a76491", "score": "0.5886875", "text": "func (p *StaticProcessor) Execute(ctx *HttpContext) {\n\tif ctx.Result != nil || ctx.Error != nil {\n\t\treturn\n\t}\n\n\tphysicalPath := path.Join(p.server.Config.PublicDir, ctx.RequestPath)\n\tinfo, err := os.Stat(physicalPath)\n\tif err != nil {\n\t\treturn\n\t}\n\tif (info.IsDir() && p.server.Config.IndexesEnable && ctx.RequestPath != \"/\") || !info.IsDir() {\n\t\tctx.PhysicalPath = physicalPath\n\t\tctx.Result = File(physicalPath)\n\t\treturn\n\t}\n\n}", "title": "" }, { "docid": "0e67068a979efe1b1f952e5bc1ea6189", "score": "0.5882886", "text": "func (d *DiscourseSite) PerformRequest(req *http.Request) (resp *http.Response, err error) {\n\treturn d.do(req)\n}", "title": "" }, { "docid": "0a9f4dcb14218bf099de52a29de471d7", "score": "0.58728874", "text": "func (r UpdateDatafeed) Perform(ctx context.Context) (*http.Response, error) {\n\treq, err := r.HttpRequest(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tres, err := r.transport.Perform(req)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"an error happened during the UpdateDatafeed query execution: %w\", err)\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "e5657579b819b390b3d7ff38acacb555", "score": "0.5866023", "text": "func (r httpMethodRule) Execute(req *http.Request) bool {\n\n\tif strings.ToUpper(r.method) == strings.ToUpper(req.Method) && !r.exclude {\n\t\tlogrus.WithFields(logrus.Fields{\n\t\t\t\"type\": \"rule\",\n\t\t\t\"app\": \"rigis\",\n\t\t}).Tracef(\"HTTPMethodRule:Success:%s\", r.method)\n\t\treturn true\n\t}\n\n\tlogrus.WithFields(logrus.Fields{\n\t\t\"type\": \"rule\",\n\t\t\"app\": \"rigis\",\n\t}).Tracef(\"HTTPMethodRule:Failed:%s\", r.method)\n\treturn false\n}", "title": "" }, { "docid": "a532d6ca310cfbfbd5b5cc83560a30f7", "score": "0.58548665", "text": "func (e *RetrieveOperation) Execute(\n\tctx context.Context,\n) (*int, *svc.Resp, error) {\n\tctx = db.Begin(ctx, \"mint\")\n\tdefer db.LoggedRollback(ctx)\n\n\toperation, err := model.LoadCanonicalOperationByOwnerToken(ctx,\n\t\te.Owner, e.Token)\n\tif err != nil {\n\t\treturn nil, nil, errors.Trace(err) // 500\n\t} else if operation == nil {\n\t\treturn nil, nil, errors.Trace(errors.NewUserErrorf(nil,\n\t\t\t404, \"operation_not_found\",\n\t\t\t\"The operation you are trying to retrieve does not exist: %s.\",\n\t\t\te.ID,\n\t\t))\n\t}\n\n\tdb.Commit(ctx)\n\n\treturn ptr.Int(http.StatusOK), &svc.Resp{\n\t\t\"operation\": format.JSONPtr(model.NewOperationResource(ctx, operation)),\n\t}, nil\n}", "title": "" }, { "docid": "19a3161aadce68885a8a05175baad863", "score": "0.58542484", "text": "func (r apiSavePipelineRequest) Execute() (*_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)\n\n\tlocalBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, \"PipelineControllerApiService.SavePipeline\")\n\tif err != nil {\n\t\treturn nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/pipelines\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif r.pipeline == nil {\n\t\treturn nil, reportError(\"pipeline 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{}\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 = r.pipeline\n\treq, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := r.apiService.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn 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 localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "5ae5a0f643c46f72d4888483bd115fa8", "score": "0.5853239", "text": "func (r apiFilesPutRequest) Execute() (*_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodPut\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t)\n\n\tlocalBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, \"ApplianceUpgradeApiService.FilesPut\")\n\tif err != nil {\n\t\treturn nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/files\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif r.authorization == nil {\n\t\treturn nil, reportError(\"authorization is required and must be specified\")\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"multipart/form-data\"}\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\tlocalVarFormFileName = \"file\"\n\tvar localVarFile *os.File\n\tif r.file != nil {\n\t\tlocalVarFile = *r.file\n\t}\n\tif localVarFile != nil {\n\t\tfbs, _ := _ioutil.ReadAll(localVarFile)\n\t\tlocalVarFileBytes = fbs\n\t\tlocalVarFileName = localVarFile.Name()\n\t\tlocalVarFile.Close()\n\t}\n\treq, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := r.apiService.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn 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 = r.apiService.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 localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v Error\n\t\t\terr = r.apiService.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 localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 409 {\n\t\t\tvar v Error\n\t\t\terr = r.apiService.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 localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 422 {\n\t\t\tvar v ValidationError\n\t\t\terr = r.apiService.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 localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 500 {\n\t\t\tvar v Error\n\t\t\terr = r.apiService.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 localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "49e00ae1eab61de0b23529a5776b14af", "score": "0.58512026", "text": "func ExecuteAPI(r *httprouter.Router) {\n\tvar dbm DbManager\n\n\tdbm = dbm.setupDB()\n\n\t//defer dbm.db.Close()\n\n\t// r = httprouter.New()\n\n\tr.GET(\"/newuser\", dbm.newuser)\n\tr.POST(\"/ws\", dbm.ws)\n\tr.POST(\"/createws\", dbm.createws)\n\tr.POST(\"/nbcard\", dbm.nbcard)\n\tr.POST(\"/load\", dbm.load)\n\tr.POST(\"/card\", dbm.card)\n\tr.POST(\"/save\", dbm.save)\n\tr.POST(\"/tag\", dbm.tag)\n\tr.POST(\"/gettag\", dbm.gettag)\n\t//log.Fatal(http.ListenAndServe(\":8080\", r))\n}", "title": "" }, { "docid": "b19af05633faeb703c587543f1a0882c", "score": "0.5835844", "text": "func (r *Request) Perform() ([]byte, error) {\n\tvar data []byte\n\tclient := &http.Client{}\n\n\treq, err := http.NewRequest(r.Method, r.URI, nil)\n\n\tif r.Method != \"GET\" {\n\t\tb := new(bytes.Buffer)\n\t\tjson.NewEncoder(b).Encode(r.Body)\n\t\treq, err = http.NewRequest(r.Method, r.URI, b)\n\t}\n\n\tfor k, v := range r.Headers {\n\t\treq.Header.Add(k, v)\n\t}\n\n\tquery := req.URL.Query()\n\tfor key, value := range r.QueryParams {\n\t\tquery.Add(key, value)\n\t}\n\treq.URL.RawQuery = query.Encode()\n\n\tif err != nil {\n\t\treturn data, err\n\t}\n\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn data, err\n\t}\n\n\tdefer resp.Body.Close()\n\n\treturn ioutil.ReadAll(resp.Body)\n}", "title": "" }, { "docid": "d4c353ee71e65d7115d4c67356d30f1f", "score": "0.58264434", "text": "func (m *applicationManagerObject) Execute( httpcontext httpmanager.HttpContext ) error {\n\tfmt.Println(\"ApplicationManager::Execute httpContext\", httpcontext)\n\n\t//\n\tfmt.Println(\"ApplicationManager::Execute ApplicationConfiguration:\", m.configuration)\n\n\t//Create the application context needed by all the managers\n\tcontext := applicationContext{}\n\tcontext.configuration = m.configuration\n\tcontext.httpContext = &httpcontext\n\tcontext.mongoDBContext = mongodbmanager.NewMongoDBContext()\n\tcontext.parameters = httpcontext.Params\n\tcontext.sliceParameters = httpcontext.QueryParams\n\n\tfmt.Println(\"ApplicationManager::Execute GetConfiguration:\", context.mongoDBContext.GetConfiguration())\n\tfmt.Println(\"ApplicationManager::Execute SetConfiguration:\", context.configuration.GetMongoDBConfiguration())\n\ttmp := context.configuration.GetMongoDBConfiguration()\n\tcontext.mongoDBContext.SetConfiguration( &tmp )\n\tfmt.Println(\"ApplicationManager::Execute GetConfiguration:\", context.mongoDBContext.GetConfiguration())\n\tfmt.Println(\"ApplicationManager::Execute MongoContext:\", context.GetMongoDBContext() )\n\tfmt.Println(\"ApplicationManager::Execute MongoConfiguration:\", context.mongoDBContext.GetConfiguration() )\n\n\t//use a factory method to get the processors specific data object\n\tfmt.Println(\"ApplicationManager::Execute Process\", m.registered[context.httpContext.ProcessorId])\n\n\t//Handle payload if it exists\n\tpayload, err := ioutil.ReadAll(context.httpContext.Request.Body)\n\tfmt.Println( payload, \": \", len(payload), \": \", err )\n\n\t//There is no body if body is nil or EOF err is returned\n\tvar theData interface{}\n\tif payload != nil && len(payload) > 0 && err == nil {\n\t\tfmt.Println(\"ApplicationManager::Execute Has Body:\", payload )\n\t\tdefer context.httpContext.Request.Body.Close() //make sure we clean up the steam\n\n\t\t//\n\t\ttheData, err = m.registered[context.httpContext.ProcessorId].Unmarshal( payload )\n\t\tfmt.Println(\"ApplicationManager::Execute TheData:\", theData )\n\t}\n\n\t//find the correct end point\n\t//TODO make this a map instead of list\n\tif err == nil {\n\t\tfmt.Println(\"ApplicationManager::Execute Finding router:\", context )\n\t\tfor _, method := range context.httpContext.RouteHandler.GetEndPointMethods() {\n\t\t\tif method.GetHttpMethod() == context.httpContext.Request.Method {\n\t\t\t\tfmt.Println(\"ApplicationManager::Execute Context:\", context)\n\t\t\t\tfmt.Println(\"ApplicationManager::Execute MongoContext:\", context.GetMongoDBContext())\n\t\t\t\t//Make sure the Mongo context is connected to the mongo configuration\n\t\t\t\tm.mongoDBManager.InitContext(&context)\n\t\t\t\tdefer m.mongoDBManager.CleanupContext(&context) //make sure the context for mongo is cleaned up\n\n\t\t\t\t//call data store\n\t\t\t\tresult, errX := m.mongoDBManager.Execute(&context, method.GetCallback(), theData)\n\t\t\t\terr = errX\n\t\t\t\tfmt.Println(\"ApplicationManager::Execute MongoContext:\", context.GetMongoDBContext())\n\t\t\t\tfmt.Println(\"ApplicationManager::Execute The Error:\", err)\n\t\t\t\tfmt.Println(\"ApplicationManager::Execute The Result:\", result)\n\n\t\t\t\tvar byteData []byte\n\t\t\t\tif result != nil && err == nil {\n\t\t\t\t\tbyteData, err = json.Marshal(result)\n\t\t\t\t\tcontext.httpContext.Writer.Write(byteData)\n\t\t\t\t}\n\n\t\t\t\tbreak; //no point in continuing to loop it found the method\n\t\t\t}\n\t\t}\n\t}\n\n\tfmt.Println(\"ApplicationManager::Execute The Error:\", err)\n\treturn err\n}", "title": "" }, { "docid": "99de5c79f43b949a12f1ab25c0b5743b", "score": "0.5817561", "text": "func (c *client) ExecuteCall(req *http.Request) (*http.Response, []byte, error) {\n\tctx, cancel := context.WithTimeout(context.Background(), c.timeout)\n\tdefer cancel()\n\n\treq = req.WithContext(ctx)\n\n\thttp.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{InsecureSkipVerify: true}\n\n\tif c.auth.Token != \"\" {\n\t\treq.Header.Add(\"Authorization\", fmt.Sprintf(\"Bearer %s\", c.auth.Token))\n\t}\n\n\treq.Header.Add(\"Content-type\", \"application/json\")\n\n\tif c.verbose {\n\t\tlog.Printf(\"REQUEST METHOD [%s] URL [%s]\", req.Method, req.URL)\n\t}\n\n\tresp, err := c.httpClient.Do(req)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tdefer resp.Body.Close()\n\n\tdata, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tif c.verbose {\n\t\tlog.Printf(\"RESPONSE [%v]\", string(data))\n\t}\n\n\treturn resp, data, nil\n}", "title": "" }, { "docid": "e44cf9ba18887ae3ceb3263c3d451a2f", "score": "0.5814824", "text": "func (connMulti *ConnectionMulti) Execute(expr string, args interface{}) (resp *tarantool.Response, err error) {\n\treturn connMulti.getCurrentConnection().Execute(expr, args)\n}", "title": "" }, { "docid": "54ab8d43fc05b3d2fb7bc5929dd57c8d", "score": "0.58147687", "text": "func (mod *Module) Run(req http.Request) *http.Status {\n\n\treturn mod.function(req, mod.arg)\n}", "title": "" }, { "docid": "fee25d6425f1bd86baddb37959a52d05", "score": "0.58136195", "text": "func (c *ccProviderImpl) Execute(ctxt context.Context, cccid interface{}, spec interface{}) (*pb.Response, *pb.ChaincodeEvent, error) {\n\treturn Execute(ctxt, cccid.(*ccProviderContextImpl).ctx, spec)\n}", "title": "" }, { "docid": "8f7672b66e05ee66d5a8181eb1c62a1e", "score": "0.5810275", "text": "func (r apiGetIAMPolicyRequest) Execute() (StackGetIAMPolicyResponse, *_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 StackGetIAMPolicyResponse\n\t)\n\n\tlocalBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, \"StackPoliciesApiService.GetIAMPolicy\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/stack/v1/stacks/{stack_id}/iam/policy\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"stack_id\"+\"}\", _neturl.QueryEscape(parameterToString(r.stackId, \"\")) , -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\t\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 := r.apiService.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 := r.apiService.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\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 StackpathapiStatus\n\t\t\terr = r.apiService.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 StackpathapiStatus\n\t\t\terr = r.apiService.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\t\tvar v StackpathapiStatus\n\t\t\terr = r.apiService.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\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = r.apiService.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": "616f9542ee204baa57235475560dac9a", "score": "0.5808015", "text": "func (r apiAppliancesIdUpgradeGetRequest) Execute() (InlineResponse20017, *_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 InlineResponse20017\n\t)\n\n\tlocalBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, \"ApplianceUpgradeApiService.AppliancesIdUpgradeGet\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/appliances/{id}/upgrade\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"id\"+\"}\", _neturl.QueryEscape(parameterToString(r.id, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\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{}\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\treq, err := r.apiService.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 := r.apiService.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\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 == 200 {\n\t\t\tvar v InlineResponse20017\n\t\t\terr = r.apiService.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 == 401 {\n\t\t\tvar v Error\n\t\t\terr = r.apiService.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 = r.apiService.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 == 404 {\n\t\t\tvar v Error\n\t\t\terr = r.apiService.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 = r.apiService.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 = r.apiService.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": "4bf61530b6c77ddd1101e26df2af4a54", "score": "0.5806091", "text": "func (h *jupyterHandler) HandleExecuteRequest(\n\tctx context.Context,\n\tr *gojupyterscaffold.ExecuteRequest,\n\tstream func(string, string),\n\tdisplay func(data *gojupyterscaffold.DisplayData, update bool)) *gojupyterscaffold.ExecuteResult {\n\th.execCount++\n\n\tresult := &gojupyterscaffold.ExecuteResult{\n\t\tStatus: \"ok\",\n\t\tExecutionCount: h.execCount,\n\t}\n\n\tvar (\n\t\tmimeType = \"text/html\"\n\n\t\t// TODO(saito) figure out a way to show data more incrementally.\n\t\tout = strings.Builder{}\n\t\tprintArgs = gql.PrintArgs{\n\t\t\tOut: termutil.NewHTMLPrinter(&out, 50000),\n\t\t\tMode: gql.PrintValues,\n\t\t\tTmpVars: h.tmpVars,\n\t\t}\n\t)\n\tif strings.HasPrefix(r.Code, \"?\") { // help requested.\n\t\tr.Code = r.Code[1:]\n\t\tprintArgs.Mode = gql.PrintDescription\n\t\tprintArgs.Out = termutil.NewBatchPrinter(&out)\n\t\tmimeType = \"text/markdown\"\n\t}\n\tif err := h.eval(ctx, r.Code, printArgs); err != nil {\n\t\tstream(\"stderr\", \"eval: `\"+r.Code+\"`: ` \"+err.Error())\n\t\tresult.Status = \"error\"\n\t\treturn result\n\t}\n\tsendJupyterResult(mimeType, out.String(), display)\n\th.tmpVars.Flush(h.sess)\n\treturn result\n}", "title": "" }, { "docid": "a13bffa81e75171998cf8914234b06ff", "score": "0.57684046", "text": "func (h *handlerState) execute(ctx context.Context, requestBag *attribute.MutableBag, responseBag *attribute.MutableBag,\n\tmethod aspect.APIMethod, ma aspect.APIMethodArgs) aspect.Output {\n\t// get a new context with the attribute bag attached\n\tctx = attribute.NewContext(ctx, requestBag)\n\n\tcfg, _ := h.cfg.Load().(config.Resolver)\n\tif cfg == nil {\n\t\t// config has not been loaded yet\n\t\tconst msg = \"Configuration is not yet available\"\n\t\tglog.Error(msg)\n\t\treturn aspect.Output{Status: status.WithInternal(msg)}\n\t}\n\n\tcfgs, err := cfg.Resolve(requestBag, h.methodMap[method])\n\tif err != nil {\n\t\tmsg := fmt.Sprintf(\"unable to resolve config: %v\", err)\n\t\tglog.Error(msg)\n\t\treturn aspect.Output{Status: status.WithInternal(msg)}\n\t}\n\n\tif glog.V(2) {\n\t\tglog.Infof(\"Resolved [%d] ==> %v \", len(cfgs), cfgs)\n\t}\n\n\treturn h.aspectExecutor.Execute(ctx, cfgs, requestBag, responseBag, ma)\n}", "title": "" }, { "docid": "c8bb97b99c1e6546fdf9cbb7c5353e7f", "score": "0.57655406", "text": "func (r andRule) Execute(req *http.Request) bool {\n\tlogrus.WithFields(logrus.Fields{\n\t\t\"type\": \"rule\",\n\t\t\"app\": \"rigis\",\n\t}).Trace(\"AndRule:Start\")\n\n\tif len(r.rules) == 0 {\n\t\tlogrus.WithFields(logrus.Fields{\n\t\t\t\"type\": \"rule\",\n\t\t\t\"app\": \"rigis\",\n\t\t}).Trace(\"AndRule:Failed\")\n\t\treturn false\n\t}\n\n\tfor i := 0; i < len(r.rules); i++ {\n\t\tif !(r.rules[i].Execute(req)) {\n\t\t\tlogrus.WithFields(logrus.Fields{\n\t\t\t\t\"type\": \"rule\",\n\t\t\t\t\"app\": \"rigis\",\n\t\t\t}).Trace(\"AndRule:Failed\")\n\t\t\treturn false\n\t\t}\n\t}\n\n\tlogrus.WithFields(logrus.Fields{\n\t\t\"type\": \"rule\",\n\t\t\"app\": \"rigis\",\n\t}).Trace(\"AndRule:Success\")\n\treturn true\n}", "title": "" }, { "docid": "1702ae0b77ef3f746e6c9ad958783d9f", "score": "0.5755565", "text": "func (r apiGetImageRequest) Execute() (V1GetImageResponse, *_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 V1GetImageResponse\n\t)\n\n\tlocalBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, \"VirtualMachineImagesApiService.GetImage\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/workload/v1/stacks/{stack_id}/images/{image_family}/{image_tag}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"stack_id\"+\"}\", _neturl.QueryEscape(parameterToString(r.stackId, \"\")) , -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"image_family\"+\"}\", _neturl.QueryEscape(parameterToString(r.imageFamily, \"\")) , -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"image_tag\"+\"}\", _neturl.QueryEscape(parameterToString(r.imageTag, \"\")) , -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\t\n\t\n\t\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 := r.apiService.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 := r.apiService.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\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 StackpathapiStatus\n\t\t\terr = r.apiService.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 StackpathapiStatus\n\t\t\terr = r.apiService.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\t\tvar v StackpathapiStatus\n\t\t\terr = r.apiService.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\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = r.apiService.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": "4bb894c51914b23e0cb45c16741c0c7b", "score": "0.5754848", "text": "func (p *Procedures) Execute(args *Args, resp *Response) error {\n\tresp.ExitCode = 0\n\tresp.Output = \"\"\n\treturn nil\n}", "title": "" }, { "docid": "5e8f113d92c47018ae57bf84ea4febbd", "score": "0.5754657", "text": "func (b *BaseExperimentController) Exec(ctx context.Context, expModel *spec.ExpModel) *spec.Response {\n\texperimentId := GetExperimentIdFromContext(ctx)\n\tlogrusField := logrus.WithField(\"experiment\", experimentId)\n\tlogrusField.Infof(\"start to execute: %+v\", expModel)\n\t// get action spec\n\tactionSpec := b.ResourceModelSpec.GetExpActionModelSpec(expModel.Target, expModel.ActionName)\n\tif actionSpec == nil {\n\t\terrMsg := \"can not find the action handler\"\n\t\tlogrusField.WithFields(logrus.Fields{\n\t\t\t\"target\": expModel.Target,\n\t\t\t\"action\": expModel.ActionName,\n\t\t}).Errorf(errMsg)\n\t\thandler := fmt.Sprintf(\"%s.%s\", expModel.Target, expModel.ActionName)\n\t\terrMsg = spec.HandlerExecNotFound.Sprintf(handler)\n\t\treturn spec.ResponseFailWithResult(spec.HandlerExecNotFound,\n\t\t\tv1alpha1.CreateFailExperimentStatus(errMsg, []v1alpha1.ResourceStatus{}), handler)\n\t}\n\texpModel.ActionPrograms = actionSpec.Programs()\n\t// invoke action executor\n\tresponse := actionSpec.Executor().Exec(experimentId, ctx, expModel)\n\treturn response\n}", "title": "" }, { "docid": "48c08ed68dd0fbc18578536c8c3c351d", "score": "0.57545006", "text": "func (h *handler) serveExec(w http.ResponseWriter, r *http.Request) {\n\tif h.isClosed() {\n\t\th.httpError(fmt.Errorf(\"server closed\"), w, http.StatusServiceUnavailable)\n\t\treturn\n\t}\n\n\t// Read the command from the request body.\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\th.httpError(err, w, http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\t// Make sure it's a valid command.\n\tif err := validateCommand(body); err != nil {\n\t\th.httpError(err, w, http.StatusBadRequest)\n\t\treturn\n\t}\n\n\t// Apply the command to the store.\n\tvar resp *internal.Response\n\tif err := h.store.apply(body); err != nil {\n\t\t// If we aren't the leader, redirect client to the leader.\n\t\tif err == raft.ErrNotLeader {\n\t\t\tl := h.store.leaderHTTP()\n\t\t\tif l == \"\" {\n\t\t\t\t// No cluster leader. Client will have to try again later.\n\t\t\t\th.httpError(errors.New(\"no leader\"), w, http.StatusServiceUnavailable)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tscheme := \"http://\"\n\t\t\tif h.config.HTTPSEnabled {\n\t\t\t\tscheme = \"https://\"\n\t\t\t}\n\n\t\t\tl = scheme + l + \"/execute\"\n\t\t\thttp.Redirect(w, r, l, http.StatusTemporaryRedirect)\n\t\t\treturn\n\t\t}\n\n\t\t// Error wasn't a leadership error so pass it back to client.\n\t\tresp = &internal.Response{\n\t\t\tOK: proto.Bool(false),\n\t\t\tError: proto.String(err.Error()),\n\t\t}\n\t} else {\n\t\t// Apply was successful. Return the new store index to the client.\n\t\tresp = &internal.Response{\n\t\t\tOK: proto.Bool(false),\n\t\t\tIndex: proto.Uint64(h.store.index()),\n\t\t}\n\t}\n\n\t// Marshal the response.\n\tb, err := proto.Marshal(resp)\n\tif err != nil {\n\t\th.httpError(err, w, http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\t// Send response to client.\n\tw.Header().Add(\"Content-Type\", \"application/octet-stream\")\n\tw.Write(b)\n}", "title": "" }, { "docid": "e322478bb3fd829ae7c426740acdd096", "score": "0.57519954", "text": "func (r *UpdateListRequest) Execute() error {\n\treturn r.request.Execute(\"updateList\", nil)\n}", "title": "" }, { "docid": "27e074b7d7f47b6477d483a1e1d0d6c3", "score": "0.5738395", "text": "func (r apiGetEventRequest) Execute() (EventResponse, *_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 EventResponse\n\t)\n\n\tlocalBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, \"EventsApiService.GetEvent\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v1/events/{event_id}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"event_id\"+\"}\", _neturl.PathEscape(parameterToString(r.eventId, \"\")), -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\n\t// Set Operation-ID header for telemetry\n\tlocalVarHeaderParams[\"DD-OPERATION-ID\"] = \"GetEvent\"\n\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 auth, ok := auth[\"apiKeyAuth\"]; ok {\n\t\t\t\tvar key string\n\t\t\t\tif auth.Prefix != \"\" {\n\t\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t\t} else {\n\t\t\t\t\tkey = auth.Key\n\t\t\t\t}\n\t\t\t\tlocalVarHeaderParams[\"DD-API-KEY\"] = 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 auth, ok := auth[\"appKeyAuth\"]; ok {\n\t\t\t\tvar key string\n\t\t\t\tif auth.Prefix != \"\" {\n\t\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t\t} else {\n\t\t\t\t\tkey = auth.Key\n\t\t\t\t}\n\t\t\t\tlocalVarHeaderParams[\"DD-APPLICATION-KEY\"] = key\n\t\t\t}\n\t\t}\n\t}\n\treq, err := r.apiService.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 := r.apiService.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\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 == 403 {\n\t\t\tvar v APIErrorResponse\n\t\t\terr = r.apiService.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 == 404 {\n\t\t\tvar v APIErrorResponse\n\t\t\terr = r.apiService.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 = r.apiService.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": "98041197d1183c1ad9fe424c21646c01", "score": "0.57363933", "text": "func (s *SecurityGroupsServerTransport) Do(req *http.Request) (*http.Response, error) {\n\trawMethod := req.Context().Value(runtime.CtxAPINameKey{})\n\tmethod, ok := rawMethod.(string)\n\tif !ok {\n\t\treturn nil, nonRetriableError{errors.New(\"unable to dispatch request, missing value for CtxAPINameKey\")}\n\t}\n\n\tvar resp *http.Response\n\tvar err error\n\n\tswitch method {\n\tcase \"SecurityGroupsClient.BeginCreateOrUpdate\":\n\t\tresp, err = s.dispatchBeginCreateOrUpdate(req)\n\tcase \"SecurityGroupsClient.BeginDelete\":\n\t\tresp, err = s.dispatchBeginDelete(req)\n\tcase \"SecurityGroupsClient.Get\":\n\t\tresp, err = s.dispatchGet(req)\n\tcase \"SecurityGroupsClient.NewListPager\":\n\t\tresp, err = s.dispatchNewListPager(req)\n\tcase \"SecurityGroupsClient.NewListAllPager\":\n\t\tresp, err = s.dispatchNewListAllPager(req)\n\tcase \"SecurityGroupsClient.UpdateTags\":\n\t\tresp, err = s.dispatchUpdateTags(req)\n\tdefault:\n\t\terr = fmt.Errorf(\"unhandled API %s\", method)\n\t}\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "4d2305dfd24675a010c8a21ff6ccf012", "score": "0.5733082", "text": "func (r *RestCommand) Execute(e Executor) error {\n\treturn e.EmitRest(r.Length, r.Dot)\n}", "title": "" } ]
cd1eafb4e007e140831f319691cbf9d1
BoolVar binding an bool option flag
[ { "docid": "55c6a1c8fb6f3183bae86de45eadf95a", "score": "0.70647347", "text": "func (fs *Flags) BoolVar(p *bool, meta *FlagMeta) {\n\tfs.boolOpt(p, meta)\n}", "title": "" } ]
[ { "docid": "2770c6b7a662fca1e98266074ab9367e", "score": "0.77543545", "text": "func BoolVar(v *bool, name string, value bool, usage string, options ...predict.Option) {\n\tCommandLine.BoolVar(v, name, value, usage, options...)\n}", "title": "" }, { "docid": "83adb18470409bf1ba2587e9a71b4cfe", "score": "0.76631725", "text": "func (gopt *GetOpt) BoolVar(p *bool, name string, def bool, fns ...ModifyFn) {\n\tgopt.Bool(name, def, fns...)\n\t*p = def\n\tgopt.Option(name).SetBoolPtr(p)\n}", "title": "" }, { "docid": "26960aa8ee1dc6053f0862ad6ddbea43", "score": "0.7549478", "text": "func BoolVar(p *bool, name string, value bool, usage string) {\n\tCommandLine.Var(newBoolValue(value, p), name, usage)\n}", "title": "" }, { "docid": "5458c1e17c2d710abdf1d3c6be2ee7f9", "score": "0.74700636", "text": "func (cmd *Command) BoolVar(p *bool, name string, value bool, usage string) {\n\tcmd.flags.BoolVar(p, name, value, usage)\n}", "title": "" }, { "docid": "f2eb0a51c1afe6dfdce4b5ce5caef9f8", "score": "0.73561275", "text": "func (fs *FlagSet) BoolVar(p *bool, name string, value bool, usage string, options ...predict.Option) {\n\t(*flag.FlagSet)(fs).Var(newBoolValue(value, p, predict.Options(options...)), name, usage)\n}", "title": "" }, { "docid": "a820ee95ab328fdc5da2525518798c67", "score": "0.7192794", "text": "func BoolVar(p *bool, name string, value bool, usage string) {\n\tEnviron.Var(newBoolValue(value, p), name, usage)\n}", "title": "" }, { "docid": "1ed3922aaec237073b1a00702fc9ea15", "score": "0.71580595", "text": "func (f *FlagSet) BoolVar(p *bool, name string, value bool, usage string) {\n\tf.Var(newBoolValue(value, p), name, usage)\n}", "title": "" }, { "docid": "62eb6c3ebfe6a8a9375b1f1e62619e8b", "score": "0.710043", "text": "func BoolVar(register Register, p *bool, name string, options ...FlagOptionApplyer) error {\n\treturn Var(register, newBoolValue(p), name, options...)\n}", "title": "" }, { "docid": "1c66b4c4399a5b2f1fb95099051627d1", "score": "0.6892622", "text": "func OptBool(envVar string) opt.Bool {\n\tassertNotInInit()\n\tb, ok := LookupBool(envVar)\n\tif !ok {\n\t\treturn \"\"\n\t}\n\tvar ret opt.Bool\n\tret.Set(b)\n\treturn ret\n}", "title": "" }, { "docid": "038f5621c7d2ad98cda7d76d61fd8b43", "score": "0.688959", "text": "func (s *SnakeCharmer) Bool(flagName, fieldName string, value bool, usage string) {\n\ts.Fset.Bool(flagName, value, usage)\n\ts.addBind(flagName, fieldName)\n}", "title": "" }, { "docid": "ba4870f85d7a33c4c644ec759c964ec1", "score": "0.68258893", "text": "func (y *Parser) Bool(b *bool, name, help string, options ...VarOption) {\n\ty.Value(value.Bool(b), name, help, options...)\n}", "title": "" }, { "docid": "d68850c4b2d066cd12e1fbc0751b8c3b", "score": "0.6810106", "text": "func (f *prefixedFlagSet) BoolVar(p *bool, name string, value bool, usage string) {\n\tf.FlagSet.BoolVar(p, f.prefix+name, value, f.mkUsage(usage))\n}", "title": "" }, { "docid": "391f15712e3a10996a3c3c3c19c46f3a", "score": "0.6792319", "text": "func (gopt *GetOpt) NBoolVar(p *bool, name string, def bool, fns ...ModifyFn) {\n\tgopt.NBool(name, def, fns...)\n\t*p = def\n\tgopt.Option(name).SetBoolPtr(p)\n}", "title": "" }, { "docid": "4931b30c0e356b40ef107c7a50ee61c4", "score": "0.6771527", "text": "func boundBoolFlag(name string, d bool, desc string) {\n\tfname := strings.Replace(name, \".\", \"-\", -1)\n\tpflag.Bool(fname, d, desc)\n\tviper.BindPFlag(name, pflag.Lookup(fname))\n}", "title": "" }, { "docid": "7ab36fa1950d3f450a671e74cb78b09b", "score": "0.6742489", "text": "func BoolVar() *varBool {\n\treturn &varBool{}\n}", "title": "" }, { "docid": "b64df722cda2df076163cd6de599baf2", "score": "0.6720985", "text": "func Bool(register Register, name string, options ...FlagOptionApplyer) *bool {\n\tp := new(bool)\n\t_ = BoolVar(register, p, name, options...)\n\treturn p\n}", "title": "" }, { "docid": "396c8b13c9594a935fa1aa82fad8848e", "score": "0.665961", "text": "func (e *EnvSet) BoolVar(p *bool, name string, value bool, usage string) {\n\te.Var(newBoolValue(value, p), name, usage)\n}", "title": "" }, { "docid": "89538f079e347edb989f2093aed6735f", "score": "0.66307396", "text": "func OptBool(v bool) *bool {\n\treturn &v\n}", "title": "" }, { "docid": "3f543db9d22654e50bbe298def96765e", "score": "0.6628187", "text": "func Bool(g *types.Cmd) {\n\tg.AddOptions(\"--bool\")\n}", "title": "" }, { "docid": "8b1b32ebab88aaf384681f6d08fa28a1", "score": "0.65559965", "text": "func (fs *FlagSet) Bool(name string, value bool, usage string, options ...predict.Option) *bool {\n\tp := new(bool)\n\tfs.BoolVar(p, name, value, usage, options...)\n\treturn p\n}", "title": "" }, { "docid": "5b04fd99ccbdd4980ee65d440c1dc8aa", "score": "0.6497828", "text": "func Bool(key string, defVal ...bool) bool { return dc.Bool(key, defVal...) }", "title": "" }, { "docid": "db34cc74135889e48e7de6201df5e2bc", "score": "0.6495045", "text": "func (gopt *GetOpt) Bool(name string, def bool, fns ...ModifyFn) *bool {\n\tgopt.failIfDefined([]string{name})\n\topt := option.New(name, option.BoolType)\n\topt.DefaultStr = fmt.Sprintf(\"%t\", def)\n\topt.SetBoolPtr(&def)\n\topt.Handler = gopt.handleBool\n\tfor _, fn := range fns {\n\t\tfn(opt)\n\t}\n\tgopt.completionAppendAliases(opt.Aliases)\n\tgopt.setOption(opt)\n\treturn &def\n}", "title": "" }, { "docid": "2f581835cb61dd4c730a8d131fe575fd", "score": "0.64946157", "text": "func (e *Env) Bool(key string, ptr *bool, desc string) {\n\te.vars = append(e.vars, &boolVar{\n\t\tbasicVariable: basicVariable{key, desc, false},\n\t\tptr: ptr,\n\t})\n}", "title": "" }, { "docid": "07adee6a687e6e9993843d234919bbb0", "score": "0.64850724", "text": "func (s *SnakeCharmer) BoolP(flagName, shorthand, fieldName string, value bool, usage string) {\n\ts.Fset.BoolP(flagName, shorthand, value, usage)\n\ts.addBind(flagName, fieldName)\n}", "title": "" }, { "docid": "a189745eb0534fc2ea9eb4a895fd6b25", "score": "0.64824414", "text": "func BoolOption(value *bool, longOpt string, shortOpt string, envVarName string, defaultVal bool, desc string, fail ErrorHandler) {\n\n\tdefaultFlagVal := defaultVal\n\n\tenvVar := EnvPrefix + envVarName\n\tenvValue := os.Getenv(envVar)\n\tif trueRegexp.MatchString(envValue) {\n\t\tdefaultFlagVal = true\n\t} else if falseRegexp.MatchString(envValue) {\n\t\tdefaultFlagVal = false\n\t} else if envValue != \"\" {\n\t\tfail(1, fmt.Sprintf(\"environment variable $%s must be one of: 0, n, no, f, false, 1, y, yes, t, true\", envVar))\n\t}\n\n\tflag.BoolVarP(value, longOpt, shortOpt, defaultFlagVal, desc)\n}", "title": "" }, { "docid": "c052bc4f1e3557805757164762457a39", "score": "0.6482136", "text": "func (e *Env) OptionalBool(key string, ptr *bool, dflt bool, desc string) {\n\te.vars = append(e.vars, &boolVar{\n\t\tbasicVariable: basicVariable{key, desc, true},\n\t\tdflt: dflt,\n\t\tptr: ptr,\n\t})\n}", "title": "" }, { "docid": "507586db9eefc863cf4d7a5052ce1f8f", "score": "0.64702", "text": "func Bool(envVar string) bool {\n\treturn boolOr(envVar, false)\n}", "title": "" }, { "docid": "6be8301d74478cf6476c642995290785", "score": "0.64255667", "text": "func OptBool(val string, def bool) bool {\n\tif val == \"\" {\n\t\treturn def\n\t}\n\trv, err := ParseBool(val)\n\tif err != nil {\n\t\treturn def\n\t}\n\treturn rv\n}", "title": "" }, { "docid": "fe5c0dd2b8bcff7c498e9d790e2aa36c", "score": "0.6423992", "text": "func Bool(name string, value bool, usage string, options ...predict.Option) *bool {\n\treturn CommandLine.Bool(name, value, usage, options...)\n}", "title": "" }, { "docid": "ea1c203f9db18cbfcdadb8890717e59b", "score": "0.64121145", "text": "func SelectBool(opt, def bool) bool {\n\tif opt == false {\n\t\treturn def\n\t}\n\treturn opt\n}", "title": "" }, { "docid": "46a665371625bc4bb960f2d22a1e6e79", "score": "0.6383589", "text": "func BoolFlag(ptr *bool, name, desc string) {\n\tflag.BoolVar(ptr, name, *ptr, desc)\n\tflag.BoolVar(ptr, name[:1], *ptr, desc)\n}", "title": "" }, { "docid": "e7824153e891ed508682d709add6b0a9", "score": "0.63804257", "text": "func (gopt *GetOpt) NBool(name string, def bool, fns ...ModifyFn) *bool {\n\tgopt.failIfDefined([]string{name})\n\topt := option.New(name, option.BoolType)\n\topt.DefaultStr = fmt.Sprintf(\"%t\", def)\n\topt.SetBoolPtr(&def)\n\topt.Handler = gopt.handleNBool\n\tfor _, fn := range fns {\n\t\tfn(opt)\n\t}\n\tvar aliases []string\n\tfor _, a := range opt.Aliases {\n\t\taliases = append(aliases, \"no\"+a)\n\t\taliases = append(aliases, \"no-\"+a)\n\t}\n\tgopt.failIfDefined(aliases)\n\topt.SetAlias(aliases...)\n\tgopt.completionAppendAliases(opt.Aliases)\n\tgopt.setOption(opt)\n\treturn &def\n}", "title": "" }, { "docid": "3a8dd0b6574215ccee7f6fead0790209", "score": "0.63487136", "text": "func (fs *Flags) Bool(name, shorts string, defValue bool, desc string) *bool {\n\tmeta := newFlagMeta(name, desc, defValue, splitShortcut(shorts))\n\tname = fs.checkFlagInfo(meta)\n\n\t// binding option to flag.FlagSet\n\tp := fs.fSet.Bool(name, defValue, meta.Desc)\n\n\t// binding all short name options to flag.FlagSet\n\tfor _, s := range meta.Shorts {\n\t\tfs.fSet.BoolVar(p, s, defValue, \"\") // dont add description for short name\n\t}\n\treturn p\n}", "title": "" }, { "docid": "d82fe3792d814349f4b56285f7afa588", "score": "0.6314605", "text": "func (s *Bool) Bind(dst *bool) Handle {\n\th := s.Property.Observe(func(old, new interface{}) {\n\t\t*dst = new.(bool)\n\t})\n\n\ts.Set(*dst)\n\n\treturn h\n}", "title": "" }, { "docid": "c1bad67b98ef31fbc006f0eaa3bab591", "score": "0.62763387", "text": "func (f *FlagSet) Bool(name string, value bool, usage string) *bool {\n\tp := new(bool)\n\tf.BoolVar(p, name, value, usage)\n\treturn p\n}", "title": "" }, { "docid": "b79b9cfb628191d9c30ed0e29a303801", "score": "0.6262714", "text": "func Bool(name string, def bool, usage string) *bool {\n\tfd := &boolFlagDef{\n\t\tname: name,\n\t\tusage: usage,\n\t\tvalueDefault: def,\n\t}\n\tflagMap[name] = fd\n\treturn &fd.value\n}", "title": "" }, { "docid": "1bc1f4003058f13859b82b6c789a76e0", "score": "0.6262174", "text": "func (fs *Flags) boolOpt(p *bool, meta *FlagMeta) {\n\tdefVal := meta.DValue().Bool()\n\tfmtName := fs.checkFlagInfo(meta)\n\n\t// binding option to flag.FlagSet\n\tfs.fSet.BoolVar(p, fmtName, defVal, meta.Desc)\n\n\t// binding all short name options to flag.FlagSet\n\tfor _, s := range meta.Shorts {\n\t\tfs.fSet.BoolVar(p, s, defVal, \"\") // dont add description for short name\n\t}\n}", "title": "" }, { "docid": "d8626a14439b3fdc893238de2c6d85f3", "score": "0.6234022", "text": "func (f Flags) Bool(name string) bool {\n\tval, _ := strconv.ParseBool(f.String(name))\n\treturn val\n}", "title": "" }, { "docid": "37b795e3ffd75e6b72cda82d28aa9e41", "score": "0.6232134", "text": "func (v *VarSet) Bool(name string) (bool, error) {\n\tval, ok := v.Lookup(name)\n\tif !ok {\n\t\treturn false, nil\n\t}\n\trv, err := strconv.ParseBool(val)\n\tif err != nil {\n\t\treturn false, &varNotParsableError{name: name}\n\t}\n\treturn rv, nil\n}", "title": "" }, { "docid": "3d00be36f5134c24ca04fe34e31cc4a4", "score": "0.6216773", "text": "func (_ basisType) Bool(v bool) *bool {\n\tp := new(bool)\n\t*p = v\n\treturn p\n}", "title": "" }, { "docid": "3c3f9c11d52a181f47f680041381a910", "score": "0.61902905", "text": "func pyBool(flag bool) int {\n\tif flag {\n\t\treturn 1\n\t}\n\treturn 0\n}", "title": "" }, { "docid": "c5ea1067c6185c34adac1a922a07215f", "score": "0.6188884", "text": "func (b *Factory) setOptionBool(field reflect.Value, value any) error {\n\tswitch v := value.(type) {\n\tcase bool:\n\t\tfield.SetBool(v)\n\t\treturn nil\n\tcase string:\n\t\tif v != \"true\" && v != \"false\" {\n\t\t\treturn fmt.Errorf(\"%w: %s\", ErrInvalidStringRepresentationOfBool, v)\n\t\t}\n\t\tfield.SetBool(v == \"true\")\n\t\treturn nil\n\tdefault:\n\t\treturn fmt.Errorf(\"%w from a value of type %T\", ErrCannotSetBoolOption, value)\n\t}\n}", "title": "" }, { "docid": "7fc5afb090b592324dd5218818cbc32f", "score": "0.61791193", "text": "func Bool(v BuildVar) bool {\n\tenv := os.Getenv(string(v))\n\tval, _ := strconv.ParseBool(env)\n\treturn val\n}", "title": "" }, { "docid": "61f7639ac22106e3dfe022ca6c77d86e", "score": "0.6174137", "text": "func (*HelpOpt) Bool() bool {\n\treturn true\n}", "title": "" }, { "docid": "983f35cd615e38b04f495d855e73c341", "score": "0.61732984", "text": "func Bool(name string, val bool) Field {\n\treturn Field(zap.Bool(name, val))\n}", "title": "" }, { "docid": "82fcd68a28de282c33cc839db7292c18", "score": "0.61606264", "text": "func (e *EnvSet) Bool(name string, value bool, usage string) *bool {\n\tp := new(bool)\n\te.BoolVar(p, name, value, usage)\n\treturn p\n}", "title": "" }, { "docid": "c7fdcbd7ff9dff72fb231ee7434f63fc", "score": "0.6150496", "text": "func (s *BaseMooncakeListener) EnterBoolLiteral(ctx *BoolLiteralContext) {}", "title": "" }, { "docid": "7d98b1c4972a057e8457e0c6309eec28", "score": "0.6144937", "text": "func (v *Value) Bool() bool {\n switch v.varType {\n case VAR_BOOL:\n return v.boolVal\n case VAR_INT:\n if v.intVal == 0 {\n return false\n }\n return true\n case VAR_FLOAT:\n if v.floatVal == 0 {\n return false\n }\n return true\n case VAR_COMPLEX:\n if v.complexVal == 0 + 0i {\n return false\n }\n return true\n case VAR_STRING:\n if v.stringVal == \"\" || v.stringVal[0]=='f' || v.stringVal[0]=='F' {\n return false\n }\n return true\n default:\n return false\n }\n}", "title": "" }, { "docid": "7f11c3f73a12c20f1e769da2f478e0bc", "score": "0.6142739", "text": "func Bool(name string, shortName string, description string,\n\t\tvalue bool) *bool {\n\t// Register long name\n\tresult := flags.Bool(name, value, \"\")\n\t\n\t// Register short name\n\tif shortName != \"\" {\n\t\tflags.BoolVar(result, shortName, value, \"\")\n\t}\n\t\n\t// Add help message\n\taddHelpMessage(name, shortName, \"\", description)\n\t\n\treturn result\n}", "title": "" }, { "docid": "d4fd0ad7538609eb3907d35f6fb63442", "score": "0.61222947", "text": "func (fs *Flags) BoolOpt(p *bool, name, shorts string, defValue bool, desc string) {\n\tfs.boolOpt(p, newFlagMeta(name, desc, defValue, splitShortcut(shorts)))\n}", "title": "" }, { "docid": "408d0149f091a2d2d0898d722d2dda0b", "score": "0.6117918", "text": "func Command_Bool(script *rex.Script, params []*rex.Value) {\n\tif len(params) != 1 {\n\t\trex.ErrorParamCount(\"convert:bool\", \"1\")\n\t}\n\n\tscript.RetVal = rex.NewValueBool(params[0].Bool())\n}", "title": "" }, { "docid": "8dd97e02657e030b92d654b847f70336", "score": "0.6098244", "text": "func (v *Variable) Bool() bool {\n\tswitch val := (*v.value).(type) {\n\tcase *objects.Bool:\n\t\treturn val.Value\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "d7513db841b21c99a191ac71cdc370ad", "score": "0.60907", "text": "func LitBool(v bool) Literal {\n\treturn Literal{b: v, which: 3}\n}", "title": "" }, { "docid": "be56a2428cb2c5c80567fb60f35843e5", "score": "0.60884106", "text": "func (_m *LiveVectorParty) SetBool(offset int, val bool, valid bool) {\n\t_m.Called(offset, val, valid)\n}", "title": "" }, { "docid": "6a92ba78e2a276b7ed2bd2e8c5a1ea42", "score": "0.60775673", "text": "func BoolFunc(fn func(bool), name, usage string) {\n\tflag.Var(BoolFunction(fn), name, usage)\n}", "title": "" }, { "docid": "896ed9e7390be5a0ab8456cd9377f1dc", "score": "0.6070216", "text": "func Bool(name string, value bool, usage string) *bool {\n\treturn CommandLine.Bool(name, value, usage)\n}", "title": "" }, { "docid": "c520920bf387a371c9349fc5a0256fb0", "score": "0.60593694", "text": "func (o *option) Bool() (bool, error) {\n\t// Allow for both expressions, and it must be required because its bool\n\tif (o.i.Value == \"true\" || o.i.Value == \"yes\") && o.i.Required {\n\t\treturn true, nil\n\t}\n\treturn false, fmt.Errorf(\"option %s is not a boolean, or uncorrectly set (should not happen)\", o.Name)\n}", "title": "" }, { "docid": "ac8ca63e35c1d97c4f356a3c7a8e589a", "score": "0.6059304", "text": "func (cmd *Command) Bool(name string, value bool, usage string) *bool {\n\treturn cmd.flags.Bool(name, value, usage)\n}", "title": "" }, { "docid": "d984c95ea334de7b933a57af0dce9ac4", "score": "0.60331964", "text": "func (p *PropertiesConfFile) Bool(name string) bool { return p.Doc.Bool(name) }", "title": "" }, { "docid": "470829f924bd157c6e0f3dc121df6889", "score": "0.60264105", "text": "func setHTTPConfBool(key string, value string, conf *HTTPConf) {\n if value == \"true\" {\n conf.B[key] = true;\n } else if value == \"false\" {\n conf.B[key] = false;\n } else {\n util.PrintPrefix(util.UID{uint8(0), uint64(0), uint64(0)}, \"error\");\n fmt.Printf(\"Directive %s: expected boolean, got %s\\n\", key, value);\n }\n}", "title": "" }, { "docid": "227315b25dcf1b7d6a76a81743167a45", "score": "0.6003868", "text": "func Bool(v bool, o ...FieldOption) *bool {\n\tfor _, fo := range o {\n\t\tif fo == FieldRequired && !v {\n\t\t\treturn aws.Bool(v)\n\t\t}\n\t}\n\n\tif !v {\n\t\treturn nil\n\t}\n\treturn aws.Bool(v)\n}", "title": "" }, { "docid": "49d40c1d2099040d2819537af3f66aee", "score": "0.59944755", "text": "func FromBool(val bool) Bool {\n\treturn b(val)\n}", "title": "" }, { "docid": "d7becae4d5abcb3ebb8703ef765de966", "score": "0.5993397", "text": "func (r RawStyle) Bool(key string, def bool) (v bool) {\n\tv = def\n\tval, ok := r.Style[key]\n\tif !ok {\n\t\treturn\n\t}\n\n\tswitch v := val[0].(type) {\n\tcase bool:\n\t\treturn v\n\tcase int:\n\t\treturn v == 1\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "79e6cb2debbf4dc2c427a59eeb13a627", "score": "0.5986559", "text": "func BoolOpt(name string, help string) Opt {\n\treturn NewOpt(name, help, false, func(v interface{}) (interface{}, error) {\n\t\treturn ToBool(v)\n\t})\n}", "title": "" }, { "docid": "a3aa69f6a2c86870cce6bb3d53157655", "score": "0.5983878", "text": "func (s *BaseRippletParserListener) EnterBoolLiteral(ctx *BoolLiteralContext) {}", "title": "" }, { "docid": "7caaa930899637bcb1098078d4d85762", "score": "0.5981039", "text": "func LoadBool(holder *bool, envKey string, flagName string, flagDescription string) {\n\n\tenvVal := os.Getenv(envKey)\n\n\tif envVal != \"\" {\n\t\tswitch strings.ToLower(envVal) {\n\t\tcase \"1\", \"true\":\n\t\t\t*holder = true\n\t\t\tbreak\n\t\tdefault:\n\t\t\t*holder = false\n\t\t}\n\t}\n\n\tflag.BoolVar(holder, flagName, *holder, flagDescription)\n\n}", "title": "" }, { "docid": "88fb20e92fce98bf23ab3fa4a0f7f457", "score": "0.5962181", "text": "func Bool(name string, value bool, usage string) *bool {\n\treturn Environ.Bool(name, value, usage)\n}", "title": "" }, { "docid": "98623de4a22ffee0d2a3cbe2eac42f6b", "score": "0.59579647", "text": "func Bool(b bool) Value {\n\treturn BoolValue(b)\n}", "title": "" }, { "docid": "3574eeea22cf0ad387c5d231c38d9bcc", "score": "0.5952094", "text": "func Bool(v bool) *bool { return &v }", "title": "" }, { "docid": "3574eeea22cf0ad387c5d231c38d9bcc", "score": "0.5952094", "text": "func Bool(v bool) *bool { return &v }", "title": "" }, { "docid": "3574eeea22cf0ad387c5d231c38d9bcc", "score": "0.5952094", "text": "func Bool(v bool) *bool { return &v }", "title": "" }, { "docid": "3574eeea22cf0ad387c5d231c38d9bcc", "score": "0.5952094", "text": "func Bool(v bool) *bool { return &v }", "title": "" }, { "docid": "3574eeea22cf0ad387c5d231c38d9bcc", "score": "0.5952094", "text": "func Bool(v bool) *bool { return &v }", "title": "" }, { "docid": "3574eeea22cf0ad387c5d231c38d9bcc", "score": "0.5952094", "text": "func Bool(v bool) *bool { return &v }", "title": "" }, { "docid": "0eb2c6a9ba2f28e1fc1f590b6e28caae", "score": "0.5951013", "text": "func (c *Cmd) BoolOpt(name string, value bool, desc string) *bool {\n\treturn c.Bool(BoolOpt{\n\t\tName: name,\n\t\tValue: value,\n\t\tDesc: desc,\n\t})\n}", "title": "" }, { "docid": "f1ae1fa090d8cacf59bca6880fab0947", "score": "0.5946305", "text": "func (v *boolValue) IsBoolFlag() bool { return true }", "title": "" }, { "docid": "421c5eff8e5e288f01b0780bc464283e", "score": "0.59404135", "text": "func Bool(in bool) *bool {\n\treturn &in\n}", "title": "" }, { "docid": "688f0aaf0517340ac737c782cc5d9cff", "score": "0.5936695", "text": "func BoolField(name string, value bool) FieldOpt {\n\treturn func(em *EventMetadata, ed *EventData) {\n\t\tem.WriteField(name, InTypeUint8, OutTypeBoolean, 0)\n\t\tbool8 := uint8(0)\n\t\tif value {\n\t\t\tbool8 = uint8(1)\n\t\t}\n\t\ted.WriteUint8(bool8)\n\t}\n}", "title": "" }, { "docid": "ac738bbd0093fe1e05eecde7cf880807", "score": "0.59210056", "text": "func Bool(env string, def bool) bool {\n\tev := os.Getenv(env)\n\tif ev == \"\" {\n\t\tnotifier.Notify(errVariableNotSet, env)\n\t\treturn def\n\t}\n\n\tb, err := strconv.ParseBool(ev)\n\tif err != nil {\n\t\tnotifier.Notify(errParseVariable, env, err)\n\t\treturn def\n\t}\n\n\treturn b\n}", "title": "" }, { "docid": "594a0913c8ced370db45088b7715dccc", "score": "0.5920115", "text": "func Boolval(b bool) *gnmi.TypedValue {\n\treturn &gnmi.TypedValue{\n\t\tValue: &gnmi.TypedValue_BoolVal{\n\t\t\tBoolVal: b,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "70fd6b263f46a5594cbaec1ab6ad0202", "score": "0.59174824", "text": "func (stmt *Stmt) BindBool(param int, value bool) {\n\tif stmt.stmt == nil {\n\t\treturn\n\t}\n\tv := 0\n\tif value {\n\t\tv = 1\n\t}\n\tres := C.sqlite3_bind_int64(stmt.stmt, C.int(param), C.sqlite3_int64(v))\n\tstmt.handleBindErr(\"BindBool\", res)\n}", "title": "" }, { "docid": "9ad67ede79a62b1ac04bd556cc7a8fd1", "score": "0.5910689", "text": "func WriteBool(w Writer, b bool) { writeBool(w, b) }", "title": "" }, { "docid": "8777644e35533e52da4a86f2d1e06e78", "score": "0.5899977", "text": "func RegisterOptBool(envVar string) func() opt.Bool {\n\tmu.Lock()\n\tdefer mu.Unlock()\n\tp, ok := regOptBool[envVar]\n\tif !ok {\n\t\tvar b opt.Bool\n\t\tp = &b\n\t\tsetOptBoolLocked(p, envVar, os.Getenv(envVar))\n\t\tregOptBool[envVar] = p\n\t}\n\treturn func() opt.Bool { return *p }\n}", "title": "" }, { "docid": "5c5133f37bec26f94f1ee3aa60790b39", "score": "0.58914685", "text": "func (v Variables) SetBool(key string, value *bool, defaultValue bool) (err error) {\n\tvar t interface{}\n\tvar ok bool\n\tif t, ok = v[key]; !ok {\n\t\toutput.Err(errors.New(\"Can not get value of %s\", key))\n\t\t*value = defaultValue\n\t\treturn\n\t}\n\tif *value, ok = t.(bool); !ok {\n\t\terr = errors.New(\"Value of %s is %s %T, not %t\", key, t, *value)\n\t\treturn\n\t}\n\treturn err\n}", "title": "" }, { "docid": "6c77e3b44209c9fda18e16ad3e4eae46", "score": "0.5880607", "text": "func Bool(longName, usage string) *core.BoolFlag {\n\treturn DefaultBucket.Bool(longName, usage)\n}", "title": "" }, { "docid": "94d6ff4e899a1ba5ae3bb54af608cf77", "score": "0.58645153", "text": "func (c *Config) Bool(key string, defaultValue bool) bool {\n\tv, ok := c.Values[key]\n\tif ok {\n\t\treturn v == \"true\"\n\t}\n\n\treturn defaultValue\n}", "title": "" }, { "docid": "57e9fca3e584ecbdc48365c6fb1054b8", "score": "0.58608264", "text": "func BoolVal(n Node) bool {\n\tif !IsConst(n, constant.Bool) {\n\t\tbase.Fatalf(\"BoolVal(%v)\", n)\n\t}\n\treturn constant.BoolVal(n.Val())\n}", "title": "" }, { "docid": "6fda7a0286161c9e35a1d42b84d6f538", "score": "0.5859517", "text": "func Bool(v bool) *bool {\n\tp := new(bool)\n\t*p = v\n\treturn p\n}", "title": "" }, { "docid": "6fda7a0286161c9e35a1d42b84d6f538", "score": "0.5859517", "text": "func Bool(v bool) *bool {\n\tp := new(bool)\n\t*p = v\n\treturn p\n}", "title": "" }, { "docid": "673beeb707ef825a06d331d3a25223f3", "score": "0.58569515", "text": "func Bool(b bool) *bool { return Ptr(b) }", "title": "" }, { "docid": "2577fe4cb07579a4dce2ab1b7b52246d", "score": "0.5854005", "text": "func BoolFlag(fs *flag.FlagSet, name string) bool {\n\treturn fs.Lookup(name).Value.(flag.Getter).Get().(bool)\n}", "title": "" }, { "docid": "0403f67724fda8520ffad5d381dd2f5a", "score": "0.58470494", "text": "func (c *Config) Bool(key string, defVal ...bool) (value bool) {\n\trawVal, ok := c.getString(key)\n\tif !ok {\n\t\tif len(defVal) > 0 {\n\t\t\treturn defVal[0]\n\t\t}\n\t\treturn\n\t}\n\n\tlowerCase := strings.ToLower(rawVal)\n\tswitch lowerCase {\n\tcase \"\", \"0\", \"false\", \"no\":\n\t\tvalue = false\n\tcase \"1\", \"true\", \"yes\":\n\t\tvalue = true\n\tdefault:\n\t\tc.addErrorf(\"the value '%s' cannot be convert to bool\", lowerCase)\n\t}\n\treturn\n}", "title": "" }, { "docid": "9d2f4a888dfde89ae1451907fd939732", "score": "0.5845733", "text": "func (a Arguments) Bool(key string) bool {\n\treturn a[key] != \"\"\n}", "title": "" }, { "docid": "3480746963eed3b5b24a4aa5ec67489f", "score": "0.58354187", "text": "func (e Event) Bool(index uint, dflt ...bool) bool {\n\tvar d bool\n\tfor _, first := range dflt {\n\t\td = first\n\t\tbreak\n\t}\n\tif len(e.Args) > int(index) {\n\t\tif casted, okey := e.Args[index].(bool); okey {\n\t\t\td = casted\n\t\t}\n\t}\n\treturn d\n}", "title": "" }, { "docid": "ae2d44a6be82051e907dab2219969afb", "score": "0.5834859", "text": "func (stmt *Stmt) SetBool(param string, value bool) {\n\tstmt.BindBool(stmt.findBindName(\"SetBool\", param), value)\n}", "title": "" }, { "docid": "b2471015a3013436366729ef534c7ca9", "score": "0.5830741", "text": "func NBool(value bool) BoolAccessor {\n\treturn &NullBool{BoolCommon{P: &value}}\n}", "title": "" }, { "docid": "26d89e1e0b1f7545e36c8708bc7d1352", "score": "0.58247995", "text": "func Bool(v any) bool {\n\tbl, _ := comfunc.ToBool(v)\n\treturn bl\n}", "title": "" }, { "docid": "2a63064b4f035c933dfcbb7742e4aee5", "score": "0.58154666", "text": "func Bool(v bool) *bool {\r\n\tp := new(bool)\r\n\t*p = v\r\n\treturn p\r\n}", "title": "" }, { "docid": "f7eab03b00535311e6d0068b11a6de39", "score": "0.5814823", "text": "func Bool(val string, def bool) bool {\n\tb, err := strconv.ParseBool(val)\n\tif err != nil {\n\t\treturn def\n\t}\n\treturn b\n}", "title": "" }, { "docid": "aaad3c5c63c16dfdfeba0ef6d0d40400", "score": "0.58129346", "text": "func Bool(value bool) BoolExpression {\n\treturn CAST(jet.Bool(value)).AS_BOOL()\n}", "title": "" } ]
3ea2869d7bf99783637f4efb986d0a7b
Put a message to this topic.
[ { "docid": "7bcd8b42b49698c8722f5b4b268c5982", "score": "0.7491318", "text": "func (t *Topic) Put(m *Message) (err error) {\n\tif len(m.Data()) > t.q.MsgCap {\n\t\terr = ErrTooLargeMsg\n\t\treturn\n\t}\n\n\tt.l.Lock()\n\tdefer t.l.Unlock()\n\n\tif t.closed {\n\t\terr = ErrClosedTopic\n\t\treturn\n\t}\n\n\tif len(t.msgs) >= t.q.TopicCap {\n\t\terr = ErrFullTopic\n\t\treturn\n\t}\n\n\tt.cnt++\n\tt.msgs = append(t.msgs, m)\n\treturn\n}", "title": "" } ]
[ { "docid": "3ae77ee3e3f2beb2b29a85c10221ae69", "score": "0.76226443", "text": "func (t *Topic) PutMessage(m *Message) error {\n\tt.Lock()\n\tdefer t.Unlock()\n\n\tif atomic.LoadInt32(&t.exitFlag) == 1 {\n\t\treturn errors.New(\"exiting\")\n\t}\n\t_, err := t.put(m)\n\tif err != nil {\n\t\treturn err\n\t}\n\tatomic.AddUint64(&t.messageCount, 1)\n\tatomic.AddUint64(&t.messageBytes, uint64(len(m.Body)))\n\n\treturn nil\n}", "title": "" }, { "docid": "e5c399b73335ef1e2007df6e3d9fb6f5", "score": "0.71118414", "text": "func PutMessage(msg SlackRtmMessage, putChan chan<- SlackRtmMessage) {\n\tputChan <- msg\n}", "title": "" }, { "docid": "56ac3f2a421e1d29f6bed57db3e0d166", "score": "0.693505", "text": "func TestPutMessage(t *testing.T) {\n\topts := NewOptions()\n\topts.Logger = test.NewTestLogger(t)\n\t_, _, nsqd := mustStartNSQD(opts)\n\tdefer os.RemoveAll(opts.DataPath)\n\tdefer nsqd.Exit()\n\n\ttopicName := \"test_put_message\" + strconv.Itoa(int(time.Now().Unix()))\n\ttopic := nsqd.GetTopic(topicName)\n\tchannel1 := topic.GetChannel(\"ch\")\n\n\tvar id MessageID\n\tmsg := NewMessage(id, []byte(\"test\"))\n\ttopic.PutMessage(msg)\n\n\toutputMsg := <-channel1.memoryMsgChan\n\ttest.Equal(t, msg.ID, outputMsg.ID)\n\ttest.Equal(t, msg.Body, outputMsg.Body)\n}", "title": "" }, { "docid": "386a199d6ed7f709403397ec927a406d", "score": "0.6805079", "text": "func (s *Session) PutMessage(id uint64, msg string) (err error) {\n\tvar timeslot Timeslot\n\tmsg = \"message=\" + msg\n\terr = s.putf(\"/timeslot/%d/sendmessage\", *bytes.NewBufferString(msg), id).Into(&timeslot)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = timeslot.populateTimeslotTimes()\n\treturn\n}", "title": "" }, { "docid": "29aa272f93b9f82f4852c9938965991e", "score": "0.6788302", "text": "func (dp *Dispatcher) PutMessage(msg *Message) {\n\tselect {\n\tcase dp.receivedMessageCh <- msg:\n\tdefault:\n\t\tdp.logger.Debugf(\"dispatcher receive message chan expire\")\n\t}\n}", "title": "" }, { "docid": "c5154724b6a53e58cdb8d3be307ab0c9", "score": "0.6210742", "text": "func (t *KVProto) Put(key []byte, msg proto.Message) error {\n\trec, err := proto.Marshal(msg)\n\tif err != nil {\n\t\treturn err\n\t}\n\twr, err := t.Writer()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer wr.Close()\n\treturn wr.Write(key, rec)\n}", "title": "" }, { "docid": "ed073480bdf3a1a555a18d18d17d3643", "score": "0.61999005", "text": "func (producer *SyncProducer) SendMessage(topic string, content string) {\n\tmessage := &sarama.ProducerMessage{\n\t\tTopic: topic,\n\t\tKey: sarama.StringEncoder(MakeKey()),\n\t\tValue: sarama.StringEncoder(content),\n\t\tTimestamp: time.Now().UTC(),\n\t}\n\n\tpartition, offset, err := producer.Parent.SendMessage(message)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Printf(\"Message is stored in topic(%s), partition(%d) and offset(%d).\\n\", topic, partition, offset)\n}", "title": "" }, { "docid": "6624c13ed1c0d30a94a1b14fdba8bc5e", "score": "0.6194535", "text": "func (repository *MessageDatabaseRepository) PutMessage(now time.Time, message entities.Message) (uint, time.Time, error) {\n\tcontent, err := json.Marshal(message.Content)\n\tif err != nil {\n\t\treturn 0, time.Time{}, err\n\t}\n\tmessage.ContentString = string(content)\n\tmessage.Timestamp = now\n\tif err := repository.database.Create(&message).Error; err != nil {\n\t\treturn 0, time.Time{}, err\n\t}\n\treturn message.ID, message.Timestamp, nil\n}", "title": "" }, { "docid": "4fc5a224cdf76645e6c8011f9463d302", "score": "0.61719936", "text": "func (rConn *RabbitConnection) SendMessageOnTopic(message interface{}, topic string) {\n\tswitch message.(type) {\n\tcase error:\n\t\treturn\n\t}\n\tbitifyMessage, err := json.Marshal(message)\n\tif err != nil {\n\t\tlogger.Error(\"while marshaling \\\"get\\\" :\", err)\n\t\treturn\n\t}\n\terr = rConn.partiesChannel.Publish(\n\t\t\"parties_topic\", // exchange\n\t\ttopic, // routing key\n\t\tfalse, // mandatory\n\t\tfalse, // immediate\n\t\tamqp.Publishing{\n\t\t\tContentType: \"application/json\",\n\t\t\tBody: bitifyMessage,\n\t\t})\n\tif err != nil {\n\t\tlogger.Error(\"error while sending message :\", err)\n\t}\n}", "title": "" }, { "docid": "b970953deaf973de9e21ca60ea933807", "score": "0.5966347", "text": "func (p *PublisherZmq) SendMessage(msg []byte, topic string) {\n\tp.socket.SendBytes([]byte(topic), zmq.SNDMORE)\n\tp.socket.SendBytes(msg, 0)\n}", "title": "" }, { "docid": "8e80958b9c0fa4a11a8acc4d7a12e69b", "score": "0.59635174", "text": "func (m *MembershipStore) Put(pkiID common.PKIidType, msg *protoext.SignedGossipMessage) {\n\tm.Lock()\n\tdefer m.Unlock()\n\tm.m[string(pkiID)] = msg\n}", "title": "" }, { "docid": "34921bcc40ee4910b63dd96c22ae6a8c", "score": "0.59518784", "text": "func (dp *Dispatcher) PutSyncMessage(msg *Message) {\n\tselect {\n\tcase dp.syncMessageCh <- msg:\n\tdefault:\n\t\tdp.logger.Debugf(\"dispatcher sync message chan expire\")\n\t}\n}", "title": "" }, { "docid": "49c8c0c6748b5df0e34f24b977276701", "score": "0.59475476", "text": "func (client *Client) Publish(topic *pubsub.Topic, msg string) (err error) {\n result := topic.Publish(client.ctx, &pubsub.Message{\n Data: []byte(msg),\n })\n id, err := result.Get(client.ctx)\n fmt.Printf(\"Published a message; msg ID: %v\\n\", id)\n return err\n}", "title": "" }, { "docid": "5ba5eda269ae37c0413bf20313a4bec6", "score": "0.5873757", "text": "func (c *Connection) SendMessage(ex, key, msg string) error {\n\tch, err := c.c.Channel()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = ch.Publish(ex, key, false, false,\n\t\tamqp.Publishing{\n\t\t\tDeliveryMode: amqp.Persistent,\n\t\t\tContentType: \"text/plain\",\n\t\t\tBody: []byte(msg),\n\t\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn ch.Close()\n}", "title": "" }, { "docid": "07eb521428dbea2902fed4b4ec2d6368", "score": "0.58630234", "text": "func (p *Producer) Send(topic, key string, message interface{}) error {\n\tbytes, err := p.encode(message)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"%w:%v\", errSendProducer, err)\n\t}\n\n\tproducerMessage := &sarama.ProducerMessage{\n\t\tTopic: topic,\n\t\tValue: sarama.ByteEncoder(bytes),\n\t\tKey: sarama.ByteEncoder(key),\n\t\tHeaders: []sarama.RecordHeader{messageTypeHeader(message)},\n\t\tTimestamp: time.Now(),\n\t}\n\n\t_, _, err = p.producer.SendMessage(producerMessage)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"%w:%v\", errSendProducer, err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "afdc100e83abbfa84ce63b2bb49f7ca1", "score": "0.58495384", "text": "func (r *Receiver) Put(e *Envelope) {\n\tselect {\n\tcase r.msgs <- e:\n\tcase <-r.Closed():\n\t}\n}", "title": "" }, { "docid": "2714fc15a70ff4a07fcc021119cc7563", "score": "0.58117706", "text": "func (t *Topic) Publish(msg string) error {\n\treturn t.svc.Publish(t.arn, msg, nil)\n}", "title": "" }, { "docid": "89b81cc3c765df498d2ef8b818be831d", "score": "0.57646257", "text": "func (tc *TrainControl) PublishMessage(msg Message) {\n\ttc.message <- msg\n}", "title": "" }, { "docid": "bc9fc29358845c085dd461b6ec95e113", "score": "0.5714767", "text": "func (d *kafkaDao) PublishMessage(topic, ackInbox string, key string, value []byte) error {\n\n\tm := &kafka.ProducerMessage{\n\t\tKey: sarama.StringEncoder(key),\n\t\tTopic: d.c.Kafka.Topic,\n\t\tValue: sarama.ByteEncoder(value),\n\t}\n\t_, _, err := d.push.SendMessage(m)\n\n\treturn err\n}", "title": "" }, { "docid": "4f244fb56832b262038211a321afa3c9", "score": "0.5709907", "text": "func (q *Queue) Push(msg string) error {\n\t_, err := q.redisClient.RPush(\"messages\", msg).Result()\n\treturn err\n}", "title": "" }, { "docid": "2777e0d285a84b08ef09b746374f5cdb", "score": "0.57094616", "text": "func (p *MessageProducer) Send(topic string, key []byte, message []byte, flush bool) error {\n\n err := p.producer.Produce(&kafka.Message{\n TopicPartition: kafka.TopicPartition{Topic: &topic, Partition: kafka.PartitionAny},\n Key: key,\n Value: message,\n }, nil)\n\n if err != nil {\n return errors.Wrapf(err, \"Error sending message to topic %s\", topic)\n }\n\n if flush {\n p.producer.Flush(flushTimeout)\n }\n return nil\n}", "title": "" }, { "docid": "a1e935eaef3814e29467162d334b1e10", "score": "0.56458366", "text": "func (su *BufferedStream) EnqueueMessage(topic string, msg *fimpgo.FimpMessage) {\n\ttopic = strings.ReplaceAll(topic,\"pt:j1/mt:evt\",\"\")\n\ttopic = strings.ReplaceAll(topic,\"pt:j1/mt:cmd\",\"\")\n\tmsg.Topic = topic\n\tif len(su.buffer) >= su.bufferMaxSize {\n\t\tsu.FlushBuffer()\n\t}\n\tsu.lock.Lock()\n\tsu.buffer = append(su.buffer, *msg)\n\tsu.lock.Unlock()\n\tlog.Debugf(\"Msg queued. Buffer size=%d , maxSize = %d\",len(su.buffer),su.bufferMaxSize)\n}", "title": "" }, { "docid": "6fc023082479d96a9d081c72049ee0da", "score": "0.5603766", "text": "func (r *Run) PushKafkaMsg(msg string) error {\n\tkafkaMsg := &sarama.ProducerMessage{\n\t\tTopic: *kafkaTopic,\n\t\tValue: sarama.StringEncoder(msg),\n\t}\n\n\tpartition, offset, err := r.KafkaClient.SendMessage(kafkaMsg)\n\tif err != nil {\n\t\treturn errors.Trace(err)\n\t}\n\tlog.Infof(\"Produced message %s to kafka cluster partition %d with offset %d\", msg, partition, offset)\n\treturn nil\n}", "title": "" }, { "docid": "0e4452b17df49ff80159ed62fe32e1a6", "score": "0.5593008", "text": "func (m *PinnedChatMessageInfo) SetMessage(value ChatMessageable)() {\n m.message = value\n}", "title": "" }, { "docid": "e0ad270d843fb0d8e4fd785676c84c87", "score": "0.55853415", "text": "func (l *Leader) onPut(msg *Message, route []byte) error {\n\t// Store the message and increment the state sequence\n\tl.sequence++\n\tmsg.sequence = l.sequence\n\n\t// Publish the message to all replicas\n\tif err := msg.Send(l.updates, nil); err != nil {\n\t\treturn err\n\t}\n\n\t// Store the state locally\n\tl.store[msg.key] = msg\n\tinfo(\"published state %d updated %s=%s\", l.sequence, msg.key, msg.body)\n\n\t// Respond to the client\n\treturn msg.Send(l.requests, route)\n}", "title": "" }, { "docid": "b8f9031c5b2c65acce9c3db338f9c334", "score": "0.5555111", "text": "func (c *Cache) InsertMessage(s string, m *dns.Msg, mTTL uint32) {\n\tif c.capacity <= 0 || m == nil {\n\t\treturn\n\t}\n\tvar err error\n\tif c.redisClient == nil {\n\t\tc.InsertMessageToLocal(s, m, mTTL)\n\t} else {\n\t\terr = c.InsertMessageToRedis(s, m, mTTL)\n\t}\n\tif err != nil {\n\t\tlog.Warn(\"Insert cache failed\", s, err)\n\t} else {\n\t\tlog.Debugf(\"Cached: %s\", s)\n\t}\n}", "title": "" }, { "docid": "ddc523c04f58692eec0957f763a0ca45", "score": "0.5538855", "text": "func (lr *RoomRouter) PutAppRoomMessage(params martini.Params, r *http.Request, w http.ResponseWriter, roomModel *models.RoomModel, conn *ninja.Connection, rconn redis.Conn) {\n\n\troom, err := roomModel.Fetch(params[\"id\"], rconn)\n\n\tlog.Infof(spew.Sprintf(\"room: %v\", room))\n\n\tif err == models.RecordNotFound {\n\t\tWriteServerErrorResponse(fmt.Sprintf(\"Unknown room id: %s\", params[\"id\"]), http.StatusNotFound, w)\n\t\treturn\n\t}\n\n\tif err != nil {\n\t\tWriteServerErrorResponse(\"Unable to retrieve room\", http.StatusInternalServerError, w)\n\t\treturn\n\t}\n\n\tappName := params[\"appName\"]\n\n\tif appName == \"\" {\n\t\tWriteServerErrorResponse(\"appName required\", http.StatusBadRequest, w)\n\t\treturn\n\t}\n\n\t// get the request body\n\tbody, err := GetJsonPayload(r)\n\n\tif err != nil {\n\t\tWriteServerErrorResponse(\"unable to parse json body\", http.StatusBadRequest, w)\n\t\treturn\n\t}\n\n\ttopic := fmt.Sprintf(\"$node/%s/app/%s\", NodeID, params[\"appName\"])\n\n\t// TODO: Need to send message over an RPC thing\n\t// req.bus.publish(topic,req.params.id,message,function(err,response){\n\tconn.SendNotification(topic, room.ID, appName, body)\n\n\tw.WriteHeader(http.StatusOK)\n}", "title": "" }, { "docid": "32edf324e78c6667f5a903c23e5f317b", "score": "0.5525437", "text": "func (k Keeper) SetMsg(ctx sdk.Context, msgID uint64, msg sdk.Msg) {\n\tstore := ctx.KVStore(k.storeKey)\n\tm := k.cdc.MustMarshalBinaryBare(msg)\n\tstore.Set(types.MsgStoreKey(msgID), m)\n}", "title": "" }, { "docid": "2b86652d1ed69d842c233a4490a87f66", "score": "0.5502154", "text": "func (a *APIClient) PublishMessage(req *PublishMessageRequestV3) (*NoContentResponse, error) {\n\tpayload, err := json.Marshal(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar resp NoContentResponse\n\terr = a.makeRequest(http.MethodPost, \"api/v3/mqtt/publish\", payload, &resp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resp, nil\n}", "title": "" }, { "docid": "9430ebf153f3da0944e340eb14b29573", "score": "0.5493573", "text": "func (q *QueueClient) SendMessage(msg *Message) error {\n\treq, err := q.createRequestFromMessage(\"messages/\", \"POST\", msg)\n\n\tif err != nil {\n\t\treturn wrap(err, \"Request create failed\")\n\t}\n\n\tresp, err := q.getClient().Do(req)\n\n\tif err != nil {\n\t\treturn wrap(err, \"Sending POST createRequest failed\")\n\t}\n\n\tdefer resp.Body.Close()\n\n\treturn handleStatusCode(resp)\n}", "title": "" }, { "docid": "dfaad0f0e6504daa3b72b992f15fa01d", "score": "0.54878145", "text": "func (t *Topic) Send(ctx context.Context, m *Message) (err error) {\n\tctx = t.tracer.Start(ctx, \"Topic.Send\")\n\tdefer func() { t.tracer.End(ctx, err) }()\n\n\t// Check for doneness before we do any work.\n\tif err := ctx.Err(); err != nil {\n\t\treturn err // Return context errors unwrapped.\n\t}\n\tt.mu.Lock()\n\terr = t.err\n\tt.mu.Unlock()\n\tif err != nil {\n\t\treturn err // t.err wrapped when set\n\t}\n\tif m.LoggableID != \"\" {\n\t\treturn gcerr.Newf(gcerr.InvalidArgument, nil, \"pubsub: Message.LoggableID should not be set when sending a message\")\n\t}\n\tfor k, v := range m.Metadata {\n\t\tif !utf8.ValidString(k) {\n\t\t\treturn gcerr.Newf(gcerr.InvalidArgument, nil, \"pubsub: Message.Metadata keys must be valid UTF-8 strings: %q\", k)\n\t\t}\n\t\tif !utf8.ValidString(v) {\n\t\t\treturn gcerr.Newf(gcerr.InvalidArgument, nil, \"pubsub: Message.Metadata values must be valid UTF-8 strings: %q\", v)\n\t\t}\n\t}\n\tdm := &driver.Message{\n\t\tBody: m.Body,\n\t\tMetadata: m.Metadata,\n\t\tBeforeSend: m.BeforeSend,\n\t\tAfterSend: m.AfterSend,\n\t}\n\treturn t.batcher.Add(ctx, dm)\n}", "title": "" }, { "docid": "28b8c1876333becdef5897dd640c6ba0", "score": "0.5471199", "text": "func publishSingleMessage(ctx context.Context, t *Topic, data string) *PublishResult {\n\treturn t.Publish(ctx, &Message{\n\t\tData: []byte(data),\n\t})\n}", "title": "" }, { "docid": "a0509b1e669d2c943911bf66f00b7912", "score": "0.54627657", "text": "func (r RmqDriver) SetTopic(mbs mba.Subscriber, topic string, f func(msg interface{}) error) error {\n\n\tmms := mbs.(*RmqSubscriber)\n\n\tq, err := mms.channel.QueueDeclare(\n\t\ttopic, // queue name\n\t\tfalse, // durable\n\t\tfalse, // delete when usused\n\t\tfalse, // exclusive\n\t\tfalse, // no-wait\n\t\tnil, // arguments\n\t)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tmms.queue = &q\n\tmms.do = f\n\n\tdeliveries, err := mms.channel.Consume(\n\t\tmms.queue.Name, // queue\n\t\t\"\", // consumer\n\t\ttrue, // auto-ack\n\t\tfalse, // exclusive\n\t\tfalse, // no-local\n\t\tfalse, // no-wait\n\t\tnil, // args\n\t)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tmms.deliveries = deliveries\n\n\treturn nil\n}", "title": "" }, { "docid": "a7cb481a76beac2b660b4f31ac1c4458", "score": "0.5426264", "text": "func (s *LogEntry) SetMessage(msg string) {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\ts.msg = msg\n}", "title": "" }, { "docid": "16a7ac58b854c015ed9ea7a5fda26145", "score": "0.5417503", "text": "func (h *httpservice) SetMessage(msg string) {\n\th.MessageText = msg\n}", "title": "" }, { "docid": "053a3683d1b22ad972e1d9d26c5995e4", "score": "0.5411025", "text": "func (t *Topic) PutMessages(msgs []*Message) error {\n\tt.RLock()\n\tdefer t.RUnlock()\n\tif atomic.LoadInt32(&t.exitFlag) == 1 {\n\t\treturn errors.New(\"exiting\")\n\t}\n\n\tmessageTotalBytes := 0\n\n\tfor i, m := range msgs {\n\t\t_, err := t.put(m)\n\t\tif err != nil {\n\t\t\tatomic.AddUint64(&t.messageCount, uint64(i))\n\t\t\tatomic.AddUint64(&t.messageBytes, uint64(messageTotalBytes))\n\t\t\treturn err\n\t\t}\n\t\tmessageTotalBytes += len(m.Body)\n\t}\n\n\tatomic.AddUint64(&t.messageBytes, uint64(messageTotalBytes))\n\tatomic.AddUint64(&t.messageCount, uint64(len(msgs)))\n\treturn nil\n}", "title": "" }, { "docid": "5eca3b2eac18319f8fab486f6140792b", "score": "0.5409907", "text": "func publishSingleMessageWithKey(ctx context.Context, t *Topic, data, key string) *PublishResult {\n\treturn t.Publish(ctx, &Message{\n\t\tData: []byte(data),\n\t\tOrderingKey: key,\n\t})\n}", "title": "" }, { "docid": "56b159c4979568ef8f0a7b842ae5cb94", "score": "0.5393028", "text": "func (c *Client) PublishMessage(ctx context.Context, message interface{}, topicName string) (*string, error) {\n\treturn PublishPubSubMessage(ctx, c.Client, message, topicName)\n}", "title": "" }, { "docid": "9390cc70bdb84ee4a8d0bdedb51b1004", "score": "0.53720826", "text": "func (m *ForwardPostRequestBody) SetMessage(value iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.Messageable)() {\n m.message = value\n}", "title": "" }, { "docid": "9fa71a51607f1b58b36581b8a29c43b7", "score": "0.5370839", "text": "func (a *Acceptor) SendMessage(message Message) {\n\ta.messageChannel <- message\n}", "title": "" }, { "docid": "a0ef6866e81d9c1c3948ddf6dc91eb8a", "score": "0.5345228", "text": "func (cl *ChordLibrary) Put(key string, value []byte) error {\n\taddr, nodeID, err := cl.Lookup(key)\n\tif err != nil {\n\t\tlog.Printf(\"Put: Lookup failed\")\n\t\treturn err\n\t}\n\tmsg := &netlib.TCPMessage{Op: netlib.PUT, TargetAddr: addr, TargetNodeID: nodeID, Key: key, PayloadValue: value}\n\tresponse := cl.send(msg)\n\tresponse = response\n\t//log.Printf(\"Put succeeded with key %s\\n\", response.Key)\n\treturn nil\n}", "title": "" }, { "docid": "bb6b97d615c8a8149b35e58323ddd700", "score": "0.5337502", "text": "func (p *publisher) Publish(m pubsub.Message, topic string, routingKey ...string) error {\n\tp.mutex.Lock()\n\tdefer p.mutex.Unlock()\n\n\treturn p.getConnection().GetChannel().Publish(\n\t\ttopic,\n\t\tp.extractFirstRoutingKeyOrDefault(routingKey),\n\t\tfalse,\n\t\tfalse,\n\t\tamqp.Publishing{\n\t\t\tHeaders: m.Headers(),\n\t\t\tContentType: m.ContentType(),\n\t\t\tContentEncoding: m.ContentEncoding(),\n\t\t\tDeliveryMode: m.DeliveryMode(),\n\t\t\tPriority: m.Priority(),\n\t\t\tCorrelationId: m.CorrelationID().String(),\n\t\t\tReplyTo: m.ReplyTo(),\n\t\t\tExpiration: p.getExpirationStringInMillisecondsOrDefault(m.Expiration()),\n\t\t\tMessageId: m.ID().String(),\n\t\t\tTimestamp: m.Timestamp(),\n\t\t\tType: m.Type(),\n\t\t\tUserId: m.UserID(),\n\t\t\tAppId: m.AppID(),\n\t\t\tBody: m.Body(),\n\t\t})\n}", "title": "" }, { "docid": "5092edc7b0da7f56695a12759318474b", "score": "0.53355235", "text": "func (r *HashStorageType2RedisController) SetSomeMessage(key string, someMessage *HashStorageType) error {\n\t// redis conn\n\tconn := r.pool.Get()\n\tdefer conn.Close()\n\n\t// marshal SomeMessage\n\tr.m.SomeMessage = someMessage\n\tif data, err := proto.Marshal(r.m.SomeMessage); err != nil {\n\t\treturn err\n\t} else {\n\t\t// set SomeMessage field\n\t\t_, err = conn.Do(\"HSET\", key, \"SomeMessage\", data)\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "960ccb8e14ed2a1ec8d9196373a8092c", "score": "0.53231144", "text": "func (p *Producer) publish(ctx context.Context, msg api.Message) {\n\tpayload, err := cloudevents.AsJSON(ctx, msg)\n\tif err != nil {\n\t\tmsg.SetError(errors.Wrap(err, \"error converting message to CloudEvent JSON format\"))\n\t\treturn\n\t}\n\n\tt := p.client.Publish(\n\t\tp.endpoint.config.Remaining,\n\t\tp.endpoint.config.QoS,\n\t\tp.endpoint.config.Retained,\n\t\tpayload)\n\n\tt.Wait()\n\n\tif err := t.Error(); err != nil {\n\t\tmsg.SetError(errors.Wrapf(\n\t\t\terr,\n\t\t\t\"error while publishing to topic '%s' on server '%s'\",\n\t\t\tp.endpoint.config.Remaining,\n\t\t\tp.endpoint.config.Broker),\n\t\t)\n\t}\n}", "title": "" }, { "docid": "63adce6a0b705817d274d9acfe30331b", "score": "0.5322613", "text": "func (db *DB) SetMessage(ctx context.Context, jetID core.RecordID, pulseNumber core.PulseNumber, genericMessage core.Message) error {\n\t_, prefix := jet.Jet(jetID)\n\tmessageBytes := message.ToBytes(genericMessage)\n\thw := db.PlatformCryptographyScheme.ReferenceHasher()\n\t_, err := hw.Write(messageBytes)\n\tif err != nil {\n\t\treturn err\n\t}\n\thw.Sum(nil)\n\n\treturn db.set(\n\t\tctx,\n\t\tprefixkey(scopeIDMessage, prefix, pulseNumber.Bytes(), hw.Sum(nil)),\n\t\tmessageBytes,\n\t)\n}", "title": "" }, { "docid": "6b4a8f6e14350b0b5e5659f009b1dc7b", "score": "0.53141767", "text": "func (c *client) SendMessage(msg string) error {\n\tif c.slackChannelID == \"\" {\n\t\treturn errors.New(\"no channel found\")\n\t}\n\tif _, _, err := c.slackClient.PostMessageContext(context.Background(),\n\t\tc.slackChannelID,\n\t\tslack.MsgOptionText(msg, false),\n\t\tslack.MsgOptionAsUser(false),\n\t); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "47d38d995369c14416815969ea46dd5e", "score": "0.5302598", "text": "func (wq *memWQ) Publish(msg *Message) error {\n\tif !wq.open {\n\t\treturn errors.New(\"queue is not open\")\n\t}\n\tdata, err := msg.ToJSON()\n\tif err != nil {\n\t\treturn err\n\t}\n\tselect {\n\tcase wq.topic.Incoming <- data:\n\t\treturn nil\n\tdefault:\n\t\treturn errors.New(\"queue is full\")\n\t}\n}", "title": "" }, { "docid": "e0700309b3982751636c8819c66b1859", "score": "0.5297967", "text": "func (store *Datastore) Put(ctx context.Context, key ds.Key, value []byte) error {\n\tdelta := store.set.Add(ctx, key.String(), value)\n\treturn store.publish(ctx, delta)\n}", "title": "" }, { "docid": "fd634653cb638793c3261f06dbab66df", "score": "0.52899045", "text": "func (m *SendActivityNotificationToRecipientsPostRequestBody) SetTopic(value iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.TeamworkActivityTopicable)() {\n err := m.GetBackingStore().Set(\"topic\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "da0870d23893178d7ad4d622d250bdd7", "score": "0.5286542", "text": "func (object MQObject) Put(gomd *MQMD,\n\tgopmo *MQPMO, buffer []byte) error {\n\tvar mqrc C.MQLONG\n\tvar mqcc C.MQLONG\n\tvar mqmd C.MQMD\n\tvar mqpmo C.MQPMO\n\tvar ptr C.PMQVOID\n\n\tbufflen := len(buffer)\n\n\tcopyMDtoC(&mqmd, gomd)\n\tcopyPMOtoC(&mqpmo, gopmo)\n\n\tif bufflen > 0 {\n\t\tptr = (C.PMQVOID)(unsafe.Pointer(&buffer[0]))\n\t} else {\n\t\tptr = nil\n\t}\n\n\tC.MQPUT(object.qMgr.hConn, object.hObj, (C.PMQVOID)(unsafe.Pointer(&mqmd)),\n\t\t(C.PMQVOID)(unsafe.Pointer(&mqpmo)),\n\t\t(C.MQLONG)(bufflen),\n\t\tptr,\n\t\t&mqcc, &mqrc)\n\n\tcopyMDfromC(&mqmd, gomd)\n\tcopyPMOfromC(&mqpmo, gopmo)\n\n\tmqreturn := MQReturn{MQCC: int32(mqcc),\n\t\tMQRC: int32(mqrc),\n\t\tverb: \"MQPUT\",\n\t}\n\n\tif mqcc != C.MQCC_OK {\n\t\treturn &mqreturn\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6bcd62f3ac9e57d846fc6dc55189f3a4", "score": "0.5284028", "text": "func (rc *RaftClient) Put(key string, value string) {\n\trc.PutAppend(key, value, \"Put\")\n}", "title": "" }, { "docid": "d3fa5bb93aecadcc912a8f21121fc7ac", "score": "0.5283568", "text": "func (mb *MyBroker) SendMsg(objectToSend []byte, header map[string]string, topic string) error {\n\n\tvar message broker.Message\n\tmessage.Header = header\n\tmessage.Body = objectToSend\n\n\tif mb.Br == nil {\n\t\terr1 := errors.New(\"broker is not defined or connected\")\n\t\tlog.Printf(glErr.BrkNoMessageSent(topic, err1))\n\t\treturn err1\n\n\t}\n\terr := mb.Br.Connect()\n\tif err != nil {\n\t\t// log.Printf(\"unable to connect to broker: Error: %v\" , err)\n\t\treturn err\n\t}\n\n\terr = mb.Br.Publish(topic, &message)\n\tif err != nil {\n\t\tlog.Printf(glErr.BrkNoMessageSent(topic, err))\n\t\treturn err\n\t}\n\tlog.Printf(\"sent message to Topic %s. Message %v\", topic, &header)\n\treturn nil\n}", "title": "" }, { "docid": "9e0db2a623ba13262a74a16fb896b1f9", "score": "0.52766985", "text": "func (connection *Connection) SendMessage(message protocol.Message) {\n\n\t// Add the message to the outbound queue.\n\tconnection.OutboundMessageQueue <- message\n}", "title": "" }, { "docid": "cbe86271b7ef27b390325343a6e49432", "score": "0.5271975", "text": "func (c Client) Publish(message types.MessageEnvelope, topic string) error {\n\tif c.publishClient == nil {\n\t\treturn pkg.NewMissingConfigurationErr(\"PublishHostInfo\", \"Unable to create a connection for publishing\")\n\t}\n\n\tif topic == \"\" {\n\t\t// Empty streams are not allowed for Redis\n\t\treturn pkg.NewInvalidTopicErr(\"\", \"Unable to publish to the invalid topic\")\n\t}\n\tvalues := map[string]interface{}{\n\t\t\"CorrelationID\": message.CorrelationID,\n\t\t\"Payload\": message.Payload,\n\t\t\"Checksum\": message.Checksum,\n\t\t\"ContentType\": message.ContentType,\n\t}\n\n\treturn c.publishClient.AddToStream(fmt.Sprintf(GoModMessagingNamespaceFormat, topic), values)\n}", "title": "" }, { "docid": "5109cd4c553652292fa4b72fce788794", "score": "0.5269158", "text": "func (sl SlackClient) SendMessage(service, msg, emoji string) error {\n\t// emoji\n\t// https://www.webfx.com/tools/emoji-cheat-sheet/\n\tchannelID, timestamp, err := sl.client.PostMessage(sl.channel, slack.MsgOptionText(msg, false), slack.MsgOptionUsername(service+\"-Bot\"), slack.MsgOptionIconEmoji(emoji))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to send message: %s\", err)\n\t}\n\tlog.Printf(\"Message successfully sent to channel %s at %s\", channelID, timestamp)\n\treturn nil\n}", "title": "" }, { "docid": "6059bfe89221d554ee8a87da5b1b0dfc", "score": "0.5258962", "text": "func (r *Room) PushMessage(from, msg string) error {\n\tmsg = r.formatMessage(msg)\n\tresponse := msgFromUserToChatroom{\n\t\tmsgCommon{\n\t\t\tCmd: \"newchatmsg\",\n\t\t\tData: msg,\n\t\t},\n\t\tuuid.NewV4().String(),\n\t\ttime.Now().Unix(),\n\t\tfrom,\n\t}\n\ttoSend, err := json.Marshal(response)\n\tif err != nil {\n\t\treturn err\n\t}\n\tr.archive(toSend)\n\tfor e := r.subscribers.Front(); e != nil; e = e.Next() {\n\t\tgo func(sub *subscriber) {\n\t\t\tif _, err := sub.WS.Write(toSend); err != nil {\n\t\t\t\tr.Unsub(sub.Nic)\n\t\t\t}\n\t\t}(e.Value.(*subscriber))\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "464e456a16f5b62ed042dd2a7fb5b38f", "score": "0.5256159", "text": "func (c *InnerChannel) PushMsg(m *Message, key string) error {\n\tc.mutex.Lock()\n\tdefer c.mutex.Unlock()\n\tsubscriberStats.IncrAddedMessage()\n\t// check message expired\n\tif m.Expired() {\n\t\tsubscriberStats.IncrExpiredMessage()\n\t\tLog.Printf(\"device %s: message %d has already expired\", key, m.MsgID)\n\t\treturn ErrMsgExpired\n\t}\n\n\t// check exceed the max message length\n\tif c.message.Length+1 > c.MaxMessage {\n\t\t// remove the first node cause that's the smallest node\n\t\tn := c.message.Head.Next()\n\t\tif n == nil {\n\t\t\t// never happen\n\t\t\tLog.Printf(\"the subscriber touch a impossiable place\")\n\t\t\tpanic(\"Skiplist head nil\")\n\t\t}\n\n\t\tc.message.Delete(n.Score)\n\t\tLog.Printf(\"device %s: message %d exceed the max message (%d) setting, trim the subscriber\", key, n.Score, c.MaxMessage)\n\t\tsubscriberStats.IncrDeletedMessage()\n\t}\n\n\terr := c.message.Insert(m.MsgID, m)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// send message to all the clients\n\tfor conn, _ := range c.conn {\n\t\tif err := subRetWrite(conn, m.Msg, m.MsgID, key); err != nil {\n\t\t\t// remove exists conn\n\t\t\tsubscriberStats.IncrFailedMessage()\n\t\t\tLog.Printf(\"subRetWrite() failed (%s)\", err.Error())\n\t\t\tcontinue\n\t\t}\n\n\t\tsubscriberStats.IncrSentMessage()\n\t\tLog.Printf(\"push message \\\"%s\\\":%d to device %s\", m.Msg, m.MsgID, key)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6b497663b231c28c4ccb87ff6ad2984a", "score": "0.5253396", "text": "func (r *RedisSMQ) SendMessage(queueName string, message string) (string, error) {\n\treturn r.sendMessage(queueName, message, 0, true)\n}", "title": "" }, { "docid": "cc0adaf17d4ed4f7da8d8fa4eea6611c", "score": "0.52434695", "text": "func (ac *Client) SendMessage(channelName string, channelID int, content string) {\n\tdata, _ := json.Marshal(identifier{\n\t\tChannel: channelName,\n\t\tID: channelID,\n\t})\n\tac.emit <- &message{\n\t\tCommand: \"message\",\n\t\tIdentifier: string(data),\n\t\tData: content,\n\t}\n}", "title": "" }, { "docid": "ab1f47cd994a0546d19bd413de07b183", "score": "0.5230152", "text": "func (m *InvitePostRequestBody) SetMessage(value *string)() {\n m.message = value\n}", "title": "" }, { "docid": "a6867b7d72fcbdd9b6ff6631966ce307", "score": "0.52271914", "text": "func (ps PubSub) publish(topic string, msg string) {\n\tps.mu.Lock()\n\t//defer ps.mu.Unlock()\n\tfor _, ch := range ps.topics[topic] {\n\t\t//ps.topics[topic] = append(ps.topics[topic], ch)\n\t\tgo func(chl chan string) {\n\t\t\tchl <- msg\n\t\t}(ch)\n\t}\n\tps.mu.Unlock()\n}", "title": "" }, { "docid": "9c226f554a3cc736acc42cae9eaaae2f", "score": "0.5215266", "text": "func SendMessage(id string, namespace string, typ string, data interface{}) error {\n\treq, err := json.Marshal(Message{\n\t\tID: id,\n\t\tNamespace: namespace,\n\t\tType: typ,\n\t\tData: data,\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = GetWorker().SendBytes(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "56d3bbc0399496155d28cfe70f765778", "score": "0.5213688", "text": "func (q *Q) Write(message []byte) error {\n\treturn q.channel.Publish(\"\", q.queue.Name, false, false,\n\t\tamqp.Publishing{\n\t\t\tDeliveryMode: amqp.Persistent,\n\t\t\tContentType: \"application/octet-stream\",\n\t\t\tBody: message,\n\t\t},\n\t)\n}", "title": "" }, { "docid": "cd82bcb16ac4da14f0d19fb3b391a460", "score": "0.5210633", "text": "func (q *queue) push(msg *message) {\n\tq.mu.Lock()\n\t// finds index according to key (timestamp)\n\ti := q.index(msg.key)\n\t// appends message to queue\n\tq.data = append(q.data, msg)\n\t// shifts rest of messages after index by one\n\tcopy(q.data[i+1:], q.data[i:])\n\t// sets a message to the specific position\n\tq.data[i] = msg\n\tq.mu.Unlock()\n}", "title": "" }, { "docid": "857e8739049c0c7312afdb03edd6bd0f", "score": "0.52015007", "text": "func (this *Kafka) PutRecord(channel string, data []byte) ResultType {\n\t//key := RandomString(8)\n\tmsg := sarama.ProducerMessage{Topic: channel,\n\t\t//Key: sarama.StringEncoder(key),\n\t\tValue: sarama.ByteEncoder(data)}\n\tpartition, offset, err := this.sp.SendMessage(&msg)\n\tlog.Printf(\"Message is stored in topic(%s)/partition(%d)/offset(%d)\\n\", channel, partition, offset)\n\tif err != nil {\n\t\treturn ResultType(\"failed\")\n\t}\n\treturn ResultType(\"sent\")\n}", "title": "" }, { "docid": "b052df92892b0f21e05c25055219846f", "score": "0.51954883", "text": "func (p *KafkaProducer) Publish(topic string, value string) error {\n\tmessage := &sarama.ProducerMessage{\n\t\tTopic: p.applySuffix(topic),\n\t\tValue: sarama.StringEncoder(value),\n\t\tTimestamp: time.Now(),\n\t}\n\n\t_, _, err := p.producer.SendMessage(message)\n\n\treturn err\n}", "title": "" }, { "docid": "55e278c0b591212639702fd2751bc5d4", "score": "0.51869595", "text": "func (client *Client) SendMessage(channel, text string) error {\n\tmsg := struct {\n\t\tID int `json:\"id\"`\n\t\tType string `json:\"type\"`\n\t\tChannel string `json:\"channel\"`\n\t\tText string `json:\"text\"`\n\t}{client.messageID, \"message\", channel, text}\n\n\tif err := client.conn.WriteJSON(msg); err != nil {\n\t\treturn err\n\t}\n\n\tclient.messageID++\n\n\treturn nil\n}", "title": "" }, { "docid": "effba4150d7925b2829a353b401c5b2e", "score": "0.5173552", "text": "func (c *YamqClient) Publish(name string, value []byte) {\n\t// TODO\n}", "title": "" }, { "docid": "b592b69fb73c638f381c87007c86f09d", "score": "0.51729596", "text": "func publishMessage(ctx context.Context, svc *sns.SNS, topic, msg string) (*RequestTrace, error) {\n\ttrace := &RequestTrace{}\n\n\t_, err := svc.PublishWithContext(ctx, &sns.PublishInput{\n\t\tTopicArn: &topic,\n\t\tMessage: &msg,\n\t}, trace.TraceRequest)\n\tif err != nil {\n\t\treturn trace, err\n\t}\n\n\treturn trace, nil\n}", "title": "" }, { "docid": "7170a06646488e6cea70fca6e984ee54", "score": "0.5170769", "text": "func (p *Service) PublishMsg(message string) (err error) {\n\tnotification := Notification{\n\t\tAppName: \"Go Prowl\",\n\t\tEventName: \"Message\",\n\t\tMessage: message,\n\t}\n\n\treturn p.Publish(notification)\n}", "title": "" }, { "docid": "7b0a60b36b7d9635d78745bbae5ace7c", "score": "0.5169321", "text": "func (mh *MessagesHub) SendMessage(sender MessageSender, typ MessageType, args ...MessageArg) {\n\tmh.messages <- &Message{typ, sender, args}\n}", "title": "" }, { "docid": "32e80ecc05c3eef6e0372acba4ca9afd", "score": "0.51681453", "text": "func (g Game) SendMessage(msg string) {\n\t_, _ = g.session.ChannelMessageSend(g.channel.ID, msg)\n}", "title": "" }, { "docid": "949efa417f4462bf2ebb6086a70e7cbc", "score": "0.51666814", "text": "func (s *Session) PushMessage(msg *message.Message) {\n\ts.msgHandler.PushMessage(msg)\n}", "title": "" }, { "docid": "53a8f9b83fb1c92b5b93bc12be6f5ddc", "score": "0.5158983", "text": "func (ns natsSession) SendMessage(subject string, msg pkg.Message) error {\n\tif err := ns.connection.Publish(subject, msg); err != nil {\n\t\treturn fmt.Errorf(\"error on SendMessage: %s\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "40776ac016f948b7e24dca0bc7293135", "score": "0.5156303", "text": "func (c *Client) SendMessage(msg Message) error {\n\tdeadline := time.Now().Add(time.Minute)\n\tif err := c.conn.SetWriteDeadline(deadline); err != nil {\n\t\treturn err\n\t}\n\tbs := msg.Bytes()\n\tif len(bs) > MaxBytes {\n\t\treturn TooLongError{Message: bs[:MaxBytes], NTrunc: len(bs) - MaxBytes}\n\t}\n\t_, err := c.conn.Write(bs)\n\treturn err\n}", "title": "" }, { "docid": "6cd7785bb9c53168dc4c3647bea26054", "score": "0.5155775", "text": "func (t *Topic) Publish(ctx context.Context, data []byte) error {\n\t_, err := t.topic.Publish(ctx, &Message{Data: data}).Get(ctx)\n\tif err != nil {\n\t\treturn merr.Wrap(err, t.ctx, ctx)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c4bbb34110ab6075fc923d86326380f5", "score": "0.51449835", "text": "func SendMessage(address string, msg string) {\n\tSend(address, TextMsg, []byte(msg))\n}", "title": "" }, { "docid": "f0dd0957f32956123eef588943482070", "score": "0.51443106", "text": "func (h *historyTopic) Publish(msg []byte) error {\n\th.add(msg)\n\th.Topic.Publish(msg)\n\treturn nil\n}", "title": "" }, { "docid": "247a4e72ba14fc96111bbe8303a8fbf7", "score": "0.5143429", "text": "func (client *Client) Put() {\n\tclient.put()\n}", "title": "" }, { "docid": "12bab0ef85f98f4a6b3b030df002961a", "score": "0.5142387", "text": "func (q *SendQueue) Push(message Message) {\n\tq.messages = append(q.messages, message)\n}", "title": "" }, { "docid": "8a2c00a9980471bc5493caf05369ce66", "score": "0.5141323", "text": "func (p *Producer) Publish(exchange string, msg *core.Message) error {\n\traw, err := json.Marshal(msg)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Error marshalling message\")\n\t}\n\n\treturn p.client.Publish(exchange, msg.Key, raw)\n}", "title": "" }, { "docid": "8da8d4d257a378054de3178fe3ffa7a3", "score": "0.5134551", "text": "func (service *Service) SendMessage(exchangename, msg string){\n\tservice.amqp.Send(exchangename, msg)\n}", "title": "" }, { "docid": "c9221c1196a903a27dc3d4ac3c102486", "score": "0.512907", "text": "func (p *SQSPlugin) Put(v lib.Msg) error {\n\treturn nil\n}", "title": "" }, { "docid": "e3b37fb6a77eb7c40443f13013622cfd", "score": "0.5126426", "text": "func (p *Player) SendMessage(message string) {\n\tpkt := &packet.ChatMessage{message}\n\tpkt.WriteTo(p.Conn)\n}", "title": "" }, { "docid": "1fc8183c2d6b9a0d2528792bce09e148", "score": "0.51246667", "text": "func (self *Peer) SendMessage(msg *Message) {\n\t// Here I will create the message from the data...\n\tself.send_chan <- msg\n}", "title": "" }, { "docid": "8e6a4444708aef7f87e43a7fad05b21a", "score": "0.51181746", "text": "func publish(object string, topicID string) {\n\n\t// Pubsub client\n\tctx := context.Background()\n\tclient, err := pubsub.NewClient(ctx, projectID)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"Error creating pubsub client: %v\\n\", err))\n\t}\n\tt := client.Topic(topicID)\n\n\t// Publish\n\tresult := t.Publish(ctx, &pubsub.Message{\n\t\tData: []byte(object),\n\t})\n\n\t// The Get method blocks until a server-generated ID or\n\t// an error is returned for the published message.\n\tid, err := result.Get(ctx)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"Error publishing %s: %v\\n\", object, err))\n\t}\n\tfmt.Printf(\"Published message to %s for %s. Msg ID: %v\\n\", topicID, object, id)\n}", "title": "" }, { "docid": "4d7431f15177a7f2382eabdc4afecdf2", "score": "0.5115607", "text": "func (m *Message) SendMessage(query *ReqMessage) error {\n\tres, err := m.client.doPostJson(\"/message\", map[string]string{}, query)\n\tif res != nil {\n\t\tres.Body.Close()\n\t}\n\treturn err\n}", "title": "" }, { "docid": "6d661b7dca78f4e751f0b53632a22db2", "score": "0.51084316", "text": "func (app *App[Model]) SendMessage(msg Message[Model]) {\n\tapp.msgs <- msg\n}", "title": "" }, { "docid": "33e113fd15fe9f218e09f4f64df96e9f", "score": "0.51046735", "text": "func (metadataFsm *MetadataFsm) Put(key, val []byte) error {\n\treturn metadataFsm.store.Put(key, val)\n}", "title": "" }, { "docid": "d98bd100ff9dcbfc123776e4a1c34914", "score": "0.51040375", "text": "func (c *Client) SendMessage(msg string) error {\n\treturn c.conn.WritePacket(\n\t\tpk.Marshal(\n\t\t\tdata.ChatServerbound,\n\t\t\tpk.String(msg),\n\t\t),\n\t)\n}", "title": "" }, { "docid": "6047ff196db0127c9153c21e920bf1f2", "score": "0.5103326", "text": "func (fw *SSTWriter) Put(key MVCCKey, value []byte) error {\n\tif fw.fw == nil {\n\t\treturn errors.New(\"cannot call Put on a closed writer\")\n\t}\n\tfw.DataSize += int64(len(key.Key)) + int64(len(value))\n\tfw.scratch = EncodeKeyToBuf(fw.scratch[:0], key)\n\treturn fw.fw.Set(fw.scratch, value)\n}", "title": "" }, { "docid": "85d8cf6f44d45ca351b267f8f957950f", "score": "0.5099227", "text": "func (p *Pub) Send(msg interface{}) {\n\tp.messages <- msg\n}", "title": "" }, { "docid": "a7b45248121ab9a930b9f462138852cf", "score": "0.5099054", "text": "func (c *Client) Publish(message string) error {\n\tc.commLock.Lock()\n\tpkt := packet{}\n\tpkt.configurePublish(c.topic, message, false, c.qos)\n\tsendBytes := pkt.FormulateMQTTOutputData()\n\tc.conn.Write(sendBytes)\n\tc.commLock.Unlock()\n\treturn nil\n}", "title": "" }, { "docid": "532e2cbd165e2779c58533c7d9d790d1", "score": "0.5094363", "text": "func (m *Manager) SendMessage(msgData []byte, to ...identity.ID) {\n\tmsg := &pb.Message{Data: msgData}\n\tm.log.Debugw(\"send packet\", \"type\", msg.Type(), \"to\", to)\n\tm.send(marshal(msg), to...)\n}", "title": "" }, { "docid": "23a8d9c8070792366e69b03c64d0096e", "score": "0.5092473", "text": "func publish(message domain.TtnMessage, bus domain.MessageBus) error {\n\tid, err := uuid.NewUUID()\n\tif err != nil {\n\t\tlogrus.Errorf(\"unable to generate uuid: %v\", err)\n\t\treturn err\n\t}\n\n\tloraEvent := cloudevents.NewEvent()\n\tloraEvent.SetID(id.String())\n\tloraEvent.SetSource(fmt.Sprintf(cloudEventSource, message.AppID))\n\tloraEvent.SetType(\"lora.ttn.message\")\n\tloraEvent.SetTime(message.Metadata.Time)\n\n\terr = loraEvent.SetData(cloudevents.ApplicationJSON, message)\n\tif err != nil {\n\t\tlogrus.Errorf(\"unable to set CloudEvent data: %v\", err)\n\t\treturn err\n\t}\n\n\tdata, err := loraEvent.MarshalJSON()\n\tif err != nil {\n\t\tlogrus.Errorf(\"unable to marshal the cloud event: %v\", err)\n\t\treturn err\n\t}\n\treturn bus.Send(loraEvent.ID(), data)\n}", "title": "" }, { "docid": "ba4c6156add00c2d148188f6313d8afd", "score": "0.50880146", "text": "func (mc *MessageCreate) SetMessage(s string) *MessageCreate {\n\tmc.mutation.SetMessage(s)\n\treturn mc\n}", "title": "" }, { "docid": "cd3bffd464eeecb4952661aa1447c6a9", "score": "0.507872", "text": "func (c *Channel) SendMessage(msg string) {\r\n\tchat := \"PRIVMSG \" + c.Name + \" :\" + msg + \"\\r\\n\"\r\n\r\n\t_, err := c.writer.WriteString(chat)\r\n\tif err != nil {\r\n\t\tlog.Printf(\"Channel writing error %s\", err.Error())\r\n\t}\r\n\r\n\tif c.writer.Buffered() > 0 {\r\n\t\tc.writer.Flush()\r\n\t}\r\n}", "title": "" }, { "docid": "203c2f54f4a9bb7e1600e9ae146f776e", "score": "0.5066572", "text": "func (c *connector) writeMessage(msg *dns.Msg, addr *net.UDPAddr) error {\n\tbuf, err := msg.Pack()\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = c.WriteToUDP(buf, addr)\n\treturn err\n}", "title": "" }, { "docid": "c5f8dc8f5440699d1ed3ecf4404f3140", "score": "0.5065515", "text": "func (r *Ref) Publish(msg interface{}) {\n\tr.inbox <- msg\n}", "title": "" }, { "docid": "40bc6fde632470c32b4cb5072ddcc3c9", "score": "0.5063591", "text": "func (c *Channel) Publish(ctx context.Context, message string) error {\n\tmsg := &pb.ChannelMessage{\n\t\tMessage: message,\n\t\tTopic: c.topic,\n\t\tPeerID: c.identity.Pretty(),\n\t\tTimestamp: ptypes.TimestampNow(),\n\t}\n\tser, err := proto.Marshal(msg)\n\tif err != nil {\n\t\treturn err\n\t}\n\tsig, err := c.privKey.Sign(ser)\n\tif err != nil {\n\t\treturn err\n\t}\n\tmsg.Signature = sig\n\n\tserializedMsg, err := proto.Marshal(msg)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tnd, err := c.object.New(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tpth, err := c.object.SetData(ctx, path.IpldPath(nd.Cid()), bytes.NewReader(serializedMsg))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar channelRec models.Channel\n\terr = c.db.View(func(tx database.Tx) error {\n\t\treturn tx.Read().Where(\"topic=?\", c.topic).First(&channelRec).Error\n\t})\n\tif err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {\n\t\treturn err\n\t}\n\tif err == nil {\n\t\tlinks, err := channelRec.GetHead()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor i, link := range links {\n\t\t\tpth, err = c.object.AddLink(ctx, pth, \"previousMessage\"+strconv.Itoa(i), path.IpldPath(link))\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tind, err := c.object.Get(ctx, pth)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tpnd, ok := ind.(*merkledag.ProtoNode)\n\tif !ok {\n\t\treturn errors.New(\"protoNode type assertion error\")\n\t}\n\tserializedObj, err := pnd.Marshal()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn c.pubsub.Publish(ctx, topicPrefix+c.topic, serializedObj)\n}", "title": "" } ]
e992f85c54e00b3f8b967d90c0dd78af
NewSyncConfStatus instantiates a new SyncConfStatus 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": "c0f3adcba065dfc1d0a01199524bcbe2", "score": "0.6475595", "text": "func NewSyncConfStatus() *SyncConfStatus {\n\tthis := SyncConfStatus{}\n\treturn &this\n}", "title": "" } ]
[ { "docid": "97f44a1696b60d956be3833cda12bc2c", "score": "0.59270716", "text": "func New() (*Status, error) { return newStatus(context.Background()) }", "title": "" }, { "docid": "d8d088b5d0893069c1b2ec645059be7e", "score": "0.5880151", "text": "func (b *Backend) SyncStatus(ctx context.Context, loadTest loadTestV1.LoadTest, loadTestStatus *loadTestV1.LoadTestStatus) error {\n\tif loadTestStatus.Phase == \"\" {\n\t\tloadTestStatus.Phase = loadTestV1.LoadTestCreating\n\t}\n\n\tif loadTestStatus.Phase == loadTestV1.LoadTestErrored {\n\t\treturn nil\n\t}\n\n\t_, err := b.kubeClientSet.\n\t\tCoreV1().\n\t\tConfigMaps(loadTestStatus.Namespace).\n\t\tGet(ctx, newConfigMapName(loadTest), metaV1.GetOptions{})\n\tif err != nil {\n\t\tif k8sAPIErrors.IsNotFound(err) {\n\t\t\tloadTestStatus.Phase = loadTestV1.LoadTestFinished\n\t\t\treturn nil\n\t\t}\n\t\treturn err\n\t}\n\n\tworkerJob, err := b.kubeClientSet.\n\t\tBatchV1().\n\t\tJobs(loadTestStatus.Namespace).\n\t\tGet(ctx, newWorkerJobName(loadTest), metaV1.GetOptions{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tmasterJob, err := b.kubeClientSet.\n\t\tBatchV1().\n\t\tJobs(loadTestStatus.Namespace).\n\t\tGet(ctx, newMasterJobName(loadTest), metaV1.GetOptions{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tloadTestStatus.Phase = determineLoadTestStatusFromJobs(masterJob, workerJob)\n\tloadTestStatus.JobStatus = masterJob.Status\n\n\treturn nil\n}", "title": "" }, { "docid": "d3f9ff2f117828ac4efa7a7be77121ac", "score": "0.5773416", "text": "func newCephStatusChecker(context *clusterd.Context, clusterInfo *cephclient.ClusterInfo, clusterSpec *cephv1.ClusterSpec) *cephStatusChecker {\n\tc := &cephStatusChecker{\n\t\tcontext: context,\n\t\tclusterInfo: clusterInfo,\n\t\tinterval: &defaultStatusCheckInterval,\n\t\tclient: context.Client,\n\t\tisExternal: clusterSpec.External.Enable,\n\t}\n\n\t// allow overriding the check interval with an env var on the operator\n\t// Keep the existing behavior\n\tvar checkInterval *time.Duration\n\tcheckIntervalCRSetting := clusterSpec.HealthCheck.DaemonHealth.Status.Interval\n\tcheckIntervalEnv := os.Getenv(\"ROOK_CEPH_STATUS_CHECK_INTERVAL\")\n\tif checkIntervalEnv != \"\" {\n\t\tif duration, err := time.ParseDuration(checkIntervalEnv); err == nil {\n\t\t\tcheckInterval = &duration\n\t\t}\n\t} else if checkIntervalCRSetting != nil {\n\t\tcheckInterval = &checkIntervalCRSetting.Duration\n\t}\n\tif checkInterval != nil {\n\t\tlogger.Infof(\"ceph status check interval is %s\", checkInterval.String())\n\t\tc.interval = checkInterval\n\t}\n\n\treturn c\n}", "title": "" }, { "docid": "b24a1df08d9c2efe6c6c38af93d9b03e", "score": "0.576549", "text": "func SyncStatus(operatorConfigClient v1.ConsoleInterface, operatorConfig *operatorsv1.Console) (*operatorsv1.Console, error) {\n\tlogConditions(operatorConfig.Status.Conditions)\n\tupdatedConfig, err := operatorConfigClient.UpdateStatus(operatorConfig)\n\tif err != nil {\n\t\terrMsg := fmt.Errorf(\"status update error: %v\", err)\n\t\tklog.Error(errMsg)\n\t\treturn nil, errMsg\n\t}\n\treturn updatedConfig, nil\n}", "title": "" }, { "docid": "619bd6c1ba2a37c7bdcae9262fcfe875", "score": "0.57638764", "text": "func (r *ClusterOperatorStatusClient) syncStatus(ctx context.Context, co *configv1.ClusterOperator, conds, overrides []configv1.ClusterOperatorStatusCondition) error {\n\tfor _, c := range conds {\n\t\tv1helpers.SetStatusCondition(&co.Status.Conditions, c)\n\t}\n\n\t// These overrides came from the operator controller and override anything set by the setAvaialble, setProgressing, or setDegraded methods.\n\tfor _, c := range overrides {\n\t\tv1helpers.SetStatusCondition(&co.Status.Conditions, c)\n\t}\n\n\tif !equality.Semantic.DeepEqual(co.Status.RelatedObjects, r.relatedObjects()) {\n\t\tco.Status.RelatedObjects = r.relatedObjects()\n\t}\n\n\treturn r.Status().Update(ctx, co)\n}", "title": "" }, { "docid": "afc3236bd9ee8754bbdfab1b6b05d640", "score": "0.5739019", "text": "func NewStatus() Status {\n\treturn Status{\n\t\tState: Init,\n\t\terrors: make([]string, 0, 1),\n\t\tStartTime: time.Now(),\n\t}\n}", "title": "" }, { "docid": "9ba8ad9b50871600f39b6ddd5263c7c0", "score": "0.56903714", "text": "func (optr *Operator) syncStatus(cond osconfigv1.ClusterOperatorStatusCondition) error {\n\t// to report the status of all the managed components.\n\tclusterOperator := &osconfigv1.ClusterOperator{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tNamespace: optr.namespace,\n\t\t\tName: optr.name,\n\t\t},\n\t\tStatus: osconfigv1.ClusterOperatorStatus{\n\t\t\tVersion: version.Raw,\n\t\t},\n\t}\n\tcvoresourcemerge.SetOperatorStatusCondition(&clusterOperator.Status.Conditions, cond)\n\t_, _, err := ApplyClusterOperator(optr.osClient.ConfigV1(), clusterOperator)\n\treturn err\n}", "title": "" }, { "docid": "188228154dbe0224cf2a833c09625383", "score": "0.5678134", "text": "func (c *consoleOperator) SyncStatus(operatorConfig *operatorsv1.Console) (*operatorsv1.Console, error) {\n\tc.logConditions(operatorConfig.Status.Conditions)\n\tupdatedConfig, err := c.operatorConfigClient.UpdateStatus(operatorConfig)\n\tif err != nil {\n\t\terrMsg := fmt.Errorf(\"status update error: %v\", err)\n\t\tklog.Error(errMsg)\n\t\treturn nil, errMsg\n\t}\n\treturn updatedConfig, nil\n}", "title": "" }, { "docid": "8f15a8ea8c176a2bb9319098df1f1880", "score": "0.56148595", "text": "func newStatus(err, value, content string) Status {\n\treturn Status{Response{err, value, content}}\n}", "title": "" }, { "docid": "1d9e3d14ddd79fc07f24db636616293b", "score": "0.5610978", "text": "func (c *FakeStatusSyncs) Create(ctx context.Context, statusSync *v1alpha1.StatusSync, opts v1.CreateOptions) (result *v1alpha1.StatusSync, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewCreateAction(statussyncsResource, c.ns, statusSync), &v1alpha1.StatusSync{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*v1alpha1.StatusSync), err\n}", "title": "" }, { "docid": "54aad60c92a67b902af97f94495cfb37", "score": "0.5609746", "text": "func NewSyncConfStatusWithDefaults() *SyncConfStatus {\n\tthis := SyncConfStatus{}\n\treturn &this\n}", "title": "" }, { "docid": "d5e2c6333666d8ae4b75cfc8ee4cfe1e", "score": "0.554748", "text": "func NewStatus(c *types.Config) *Status {\n\tmods := make([]types.Module, 0)\n\tfor _, m := range c.Modules {\n\t\tname, ok := m[\"name\"].(string)\n\t\tif !ok {\n\t\t\tlog.Fatalf(\"module name not defined\")\n\t\t}\n\t\tmc, _ := m[\"config\"].(map[interface{}]interface{})\n\t\tmod, err := modules.GetModule(name, mc)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"failed to load module: %v, %v\", name, err)\n\t\t\tcontinue\n\t\t}\n\t\tmods = append(mods, mod)\n\t}\n\tcache := make([][]*types.Block, len(mods))\n\tupdate := make(chan struct{})\n\tdone := make(chan struct{})\n\ts := &Status{modules: mods, cache: cache, config: c, update: update, done: done}\n\n\ts.updateCache()\n\n\tgo s.render(done)\n\tgo s.watchModules(done)\n\n\treturn s\n}", "title": "" }, { "docid": "1f2ead273072fbad0ebfd0ab52ad0855", "score": "0.54867154", "text": "func (vsp *VodStatusPollableImpl) New(args ...interface{}) bp.Pollable {\n\treturn &VodStatusPollableImpl{\n\t\tcompleted: false,\n\t\thost: args[0].(string),\n\t\taccountID: args[1].(string),\n\t\townerID: args[2].(string),\n\t\tvideoID: args[3].(string),\n\t\tgID: args[4].(string),\n\t\tAppContext: vsp.AppContext,\n\t}\n}", "title": "" }, { "docid": "7123fe97d126a06edd4c2f0e9e90ad5c", "score": "0.54597384", "text": "func NewStatus() *Status {\n\ts := &Status{\n\t\tspinner: NewSpinner(os.Stdout),\n\t\tsuccessFormat: \" \\x1b[32m✓\\x1b[0m %s\\n\",\n\t\tfailureFormat: \" \\x1b[31m✗\\x1b[0m %s\\n\",\n\t}\n\treturn s\n}", "title": "" }, { "docid": "a3865c2385435e8865cc82482f1a2ea0", "score": "0.54331726", "text": "func toCustomResourceStatus(currentStatus cephv1.ClusterStatus, newStatus *cephclient.CephStatus) *cephv1.CephStatus {\n\ts := &cephv1.CephStatus{\n\t\tHealth: newStatus.Health.Status,\n\t\tLastChecked: formatTime(time.Now().UTC()),\n\t\tDetails: make(map[string]cephv1.CephHealthMessage),\n\t}\n\tfor name, message := range newStatus.Health.Checks {\n\t\ts.Details[name] = cephv1.CephHealthMessage{\n\t\t\tSeverity: message.Severity,\n\t\t\tMessage: message.Summary.Message,\n\t\t}\n\t}\n\n\tif newStatus.PgMap.TotalBytes != 0 {\n\t\ts.Capacity.TotalBytes = newStatus.PgMap.TotalBytes\n\t\ts.Capacity.UsedBytes = newStatus.PgMap.UsedBytes\n\t\ts.Capacity.AvailableBytes = newStatus.PgMap.AvailableBytes\n\t\ts.Capacity.LastUpdated = formatTime(time.Now().UTC())\n\t}\n\n\tif currentStatus.CephStatus != nil {\n\t\ts.PreviousHealth = currentStatus.CephStatus.PreviousHealth\n\t\ts.LastChanged = currentStatus.CephStatus.LastChanged\n\t\tif currentStatus.CephStatus.Health != s.Health {\n\t\t\ts.PreviousHealth = currentStatus.CephStatus.Health\n\t\t\ts.LastChanged = s.LastChecked\n\t\t}\n\t\tif newStatus.PgMap.TotalBytes == 0 {\n\t\t\ts.Capacity = currentStatus.CephStatus.Capacity\n\t\t}\n\t}\n\t// update fsid on cephcluster Status\n\ts.FSID = newStatus.FSID\n\n\treturn s\n}", "title": "" }, { "docid": "af9fe280b4ce379a705c7d516443de22", "score": "0.54202104", "text": "func (configuration *WorkspaceRepositoryConfiguration) Initialize_From_WorkspaceRepositoryConfiguration_STATUS(source *WorkspaceRepositoryConfiguration_STATUS) error {\n\n\t// AccountName\n\tconfiguration.AccountName = genruntime.ClonePointerToString(source.AccountName)\n\n\t// CollaborationBranch\n\tconfiguration.CollaborationBranch = genruntime.ClonePointerToString(source.CollaborationBranch)\n\n\t// HostName\n\tconfiguration.HostName = genruntime.ClonePointerToString(source.HostName)\n\n\t// LastCommitId\n\tconfiguration.LastCommitId = genruntime.ClonePointerToString(source.LastCommitId)\n\n\t// ProjectName\n\tconfiguration.ProjectName = genruntime.ClonePointerToString(source.ProjectName)\n\n\t// RepositoryName\n\tconfiguration.RepositoryName = genruntime.ClonePointerToString(source.RepositoryName)\n\n\t// RootFolder\n\tconfiguration.RootFolder = genruntime.ClonePointerToString(source.RootFolder)\n\n\t// TenantId\n\tif source.TenantId != nil {\n\t\ttenantId := *source.TenantId\n\t\tconfiguration.TenantId = &tenantId\n\t} else {\n\t\tconfiguration.TenantId = nil\n\t}\n\n\t// Type\n\tconfiguration.Type = genruntime.ClonePointerToString(source.Type)\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "7807fda2363f1d7365a3c03b42bb3493", "score": "0.53871095", "text": "func NewStatus() *Status {\n\treturn &Status{\n\t\tSentenceDetection: SentenceDetection{\n\t\t\tDetector: &detect.SentenceDetector{\n\t\t\t\tQuestion: detect.QuestionOnly,\n\t\t\t\tGroups: []detect.WordGroup{\n\t\t\t\t\t{Words: []string{\"server\"}},\n\t\t\t\t\t{Words: []string{\"up\", \"down\", \"on\", \"off\"}},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\thttpClient: &http.Client{\n\t\t\tTimeout: time.Second * 5,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "45f2f1f9dfbe8efcd6f73a835ff722dc", "score": "0.53733325", "text": "func (p Proc) NewStatus() (ProcStatus, error) {\n\tf, err := os.Open(p.path(\"status\"))\n\tif err != nil {\n\t\treturn ProcStatus{}, err\n\t}\n\tdefer f.Close()\n\n\treturn psb.readStatus(f)\n}", "title": "" }, { "docid": "62b428b6f7a948bc1d39f4e896865edd", "score": "0.5363656", "text": "func NewStatus(status string) *Status {\n\ts := new(Status)\n\ts.Time = time.Now().Unix()\n\ts.Message = status\n\treturn s\n}", "title": "" }, { "docid": "0f2bc61f7a07b6dff386f84494845c34", "score": "0.5360712", "text": "func NewStatus(appName string) *commander.CommandWrapper {\n\treturn &commander.CommandWrapper{\n\t\tHandler: &Status{},\n\t\tHelp: &commander.CommandDescriptor{\n\t\t\tName: \"status\",\n\t\t\tShortDescription: \"Status of a stack.\",\n\t\t\tLongDescription: `Get detailed status of the stack.`,\n\t\t\tArguments: \"\",\n\t\t\tExamples: []string{\"status\"},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "3eae31877cfc2f555c2c3e842e5f92b7", "score": "0.53602177", "text": "func (in *StatusSyncStatus) DeepCopy() *StatusSyncStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(StatusSyncStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "dfa0aeeae77bde1ea2ba288c642744c1", "score": "0.5354903", "text": "func (in *StatusSync) DeepCopy() *StatusSync {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(StatusSync)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "b3b57f47ef9b1b217b05ac9c391e6e48", "score": "0.53442574", "text": "func (wc *rpcClient) syncStatus() (*syncStatus, error) {\n\tchainInfo, err := wc.getBlockchainInfo()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"getblockchaininfo error: %w\", err)\n\t}\n\treturn &syncStatus{\n\t\tTarget: int32(chainInfo.Headers),\n\t\tHeight: int32(chainInfo.Blocks),\n\t\tSyncing: chainInfo.InitialBlockDownload || chainInfo.Headers-chainInfo.Blocks > 1,\n\t}, nil\n}", "title": "" }, { "docid": "b1b32491b27cc0a441c39e3e79ca62bc", "score": "0.53419864", "text": "func (properties *CspWorkspaceAdminProperties) Initialize_From_CspWorkspaceAdminProperties_STATUS(source *CspWorkspaceAdminProperties_STATUS) error {\n\n\t// InitialWorkspaceAdminObjectId\n\tproperties.InitialWorkspaceAdminObjectId = genruntime.ClonePointerToString(source.InitialWorkspaceAdminObjectId)\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "d5cfaeb99993b61078c910f1848cc481", "score": "0.5327561", "text": "func (component *Component) NewEmptyStatus() genruntime.ConvertibleStatus {\n\treturn &Component_STATUS{}\n}", "title": "" }, { "docid": "aba2ba41bcc7d2b8223acd338a50630c", "score": "0.5303666", "text": "func newDefaultChainStatus() *Status {\n\treturn &Status{\n\t\tValidatedHead: types.UndefTipSet.Key(),\n\t\tValidatedHeadHeight: 0,\n\t\tSyncingHead: types.UndefTipSet.Key(),\n\t\tSyncingHeight: 0,\n\t\tSyncingTrusted: false,\n\t\tSyncingStarted: 0,\n\t\tSyncingComplete: true,\n\t\tSyncingFetchComplete: true,\n\t\tFetchingHead: types.UndefTipSet.Key(),\n\t\tFetchingHeight: 0,\n\t}\n}", "title": "" }, { "docid": "416da660c517107ec652014fe0148beb", "score": "0.5282285", "text": "func NewStatusImpl(g *GlobalImpl, b *StatusOptions) *StatusImpl {\n\treturn &StatusImpl{\n\t\tGlobalImpl: g,\n\t\tStatusOptions: b,\n\t}\n}", "title": "" }, { "docid": "f488d919978479547598e115b37640a2", "score": "0.5276107", "text": "func newSyncConfig() syncConfig {\n\treturn syncConfig{\n\t\t// by default namespace name is a string containing just keystone project id\n\t\tNamespaceFormat: \"%i\",\n\t}\n}", "title": "" }, { "docid": "659003319c2ad16fe33bd63fbf961700", "score": "0.52728873", "text": "func (configuration *Configuration) NewEmptyStatus() genruntime.ConvertibleStatus {\n\treturn &Servers_Configuration_STATUS{}\n}", "title": "" }, { "docid": "572d49bda715e8a6c5c76ed16059e82b", "score": "0.5272724", "text": "func (in *SyncStatus) DeepCopy() *SyncStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SyncStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "24c4fdf8580abee11d97c6b286402df8", "score": "0.527228", "text": "func NewStatus() *Status {\n\tthis := Status{}\n\treturn &this\n}", "title": "" }, { "docid": "7bad2545c7a381bb2e0643c7646e7ba8", "score": "0.5245133", "text": "func NewStatusCommand(rootSettings *environment.AirshipCTLSettings, factory client.Factory) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: \"status\",\n\t\tShort: \"Retrieve statuses of deployed cluster components\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tconf := rootSettings.Config\n\t\t\tif err := conf.EnsureComplete(); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tmanifest, err := conf.CurrentContextManifest()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tdocBundle, err := document.NewBundleByPath(manifest.TargetPath)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tdocs, err := docBundle.GetAllDocuments()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tclient, err := factory(rootSettings)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tstatusMap, err := cluster.NewStatusMap(client)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\ttw := util.NewTabWriter(cmd.OutOrStdout())\n\t\t\tfmt.Fprintf(tw, \"Kind\\tName\\tStatus\\n\")\n\t\t\tfor _, doc := range docs {\n\t\t\t\tstatus, err := statusMap.GetStatusForResource(doc)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Debug(err)\n\t\t\t\t} else {\n\t\t\t\t\tfmt.Fprintf(tw, \"%s\\t%s\\t%s\\n\", doc.GetKind(), doc.GetName(), status)\n\t\t\t\t}\n\t\t\t}\n\t\t\ttw.Flush()\n\t\t\treturn nil\n\t\t},\n\t}\n\n\treturn cmd\n}", "title": "" }, { "docid": "56b446044ccb22ac5dac6402a95096cc", "score": "0.52336985", "text": "func (properties *UserAssignedIdentityProperties) Initialize_From_UserAssignedIdentityProperties_STATUS(source *UserAssignedIdentityProperties_STATUS) error {\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "1c7d417526453cf84b80287d6e97fcda", "score": "0.52289474", "text": "func (r *ParameterSetReconciler) syncStatus(ctx context.Context, log logr.Logger, ps *porterv1.ParameterSet, action *porterv1.AgentAction) error {\n\torigStatus := ps.Status\n\n\tapplyAgentAction(log, ps, action)\n\n\tif !reflect.DeepEqual(origStatus, ps.Status) {\n\t\treturn r.saveStatus(ctx, log, ps)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b3c6438a0bcf74dcac810cb465c0a7f3", "score": "0.52264977", "text": "func New(config Config) (Syncer, error) {\n\tk8sClient, err := createK8sClient(config.KubeConfig, config.Agent)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"cannot create Kubernetes client: %w\", err)\n\t}\n\tcsClient, err := createCloudStackClient(config.CloudStackConfig)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"cannot create CloudStack client: %w\", err)\n\t}\n\n\treturn syncer{\n\t\tk8sClient: k8sClient,\n\t\tcsClient: csClient,\n\t\tlabelsSet: createLabelsSet(config.Label),\n\t\tnamePrefix: config.NamePrefix,\n\t\tdelete: config.Delete,\n\t}, nil\n}", "title": "" }, { "docid": "ebe3292ead05109a4fd769c0eba5ccc2", "score": "0.52226377", "text": "func (r *Reconciler) syncInitialStatus(subscription *eventingv1alpha2.Subscription) {\n\tif subscription.Status.Types == nil {\n\t\tsubscription.Status.InitializeEventTypes()\n\t}\n\n\texpectedStatus := eventingv1alpha2.SubscriptionStatus{}\n\texpectedStatus.InitializeConditions()\n\n\t// case: conditions are already initialized and there is no change in the Ready status\n\tif eventingv1alpha2.ContainSameConditionTypes(subscription.Status.Conditions, expectedStatus.Conditions) &&\n\t\t!subscription.Status.ShouldUpdateReadyStatus() {\n\t\treturn\n\t}\n\n\tif len(subscription.Status.Conditions) == 0 {\n\t\texpectedStatus.Backend.CopyHashes(subscription.Status.Backend)\n\t\tsubscription.Status = expectedStatus\n\t} else {\n\t\trequiredConditions := getRequiredConditions(subscription.Status.Conditions, expectedStatus.Conditions)\n\t\tsubscription.Status.Conditions = requiredConditions\n\t\tsubscription.Status.Ready = !subscription.Status.Ready\n\t}\n\n\t// reset the status for apiRule\n\tsubscription.Status.Backend.APIRuleName = \"\"\n\tsubscription.Status.Backend.ExternalSink = \"\"\n}", "title": "" }, { "docid": "20054206ac0c3145409dd388de9b8d52", "score": "0.52036935", "text": "func NewStatus(statusString string) (Status, error) {\n\tswitch statusString {\n\tcase \"For Sale\", \"for sale\", \"ForSale\":\n\t\treturn ForSale, nil\n\tcase \"Pending\", \"pending\", \"Under Contract\":\n\t\treturn Pending, nil\n\tcase \"Sold\", \"sold\":\n\t\treturn Sold, nil\n\tcase \"Off Market\", \"OffMarket\", \"off market\":\n\t\treturn OffMarket, nil\n\tdefault:\n\t\treturn Status(0), perr.NewErrInvalid(\"provided string is not a valid Status string\")\n\t}\n}", "title": "" }, { "docid": "6318e02aeac88f2dbd5e9acbeac0f4a9", "score": "0.51889473", "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": "f9502ff5d70226f7759bb804b2d929c0", "score": "0.5188814", "text": "func (signalR *SignalR) NewEmptyStatus() genruntime.ConvertibleStatus {\n\treturn &SignalR_STATUS{}\n}", "title": "" }, { "docid": "373cb56778b4225770dae9387aaae10c", "score": "0.5188016", "text": "func TestNewConfStatus(t *testing.T) {\n\tcases := []struct {\n\t\tC Conf\n\t\tB []byte\n\t}{\n\t\t{\n\t\t\tConf{},\n\t\t\t[]byte(``),\n\t\t}, {\n\t\t\tConf{\n\t\t\t\tInterface{\n\t\t\t\t\tListenPort: 52274,\n\t\t\t\t\tPublicKey: \"this_is_a_public_key\",\n\t\t\t\t\tPrivateKey: \"(hidden)\",\n\t\t\t\t\tFwMark: \"0xca6c\",\n\t\t\t\t},\n\t\t\t\t[]Peer{\n\t\t\t\t\t{\n\t\t\t\t\t\tPublicKey: \"another_public_key\",\n\t\t\t\t\t\tEndpoint: \"1.2.3.4:51820\",\n\t\t\t\t\t\tAllowedIPs: []string{\"0.0.0.0/0\"},\n\t\t\t\t\t\tLatestHandshake: 5,\n\t\t\t\t\t\tReceived: 13631488,\n\t\t\t\t\t\tSent: 13680,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t[]byte(`\ninterface: wg0\n public key: this_is_a_public_key\n private key: (hidden)\n listening port: 52274\n fwmark: 0xca6c\n\npeer: another_public_key\n endpoint: 1.2.3.4:51820\n allowed ips: 0.0.0.0/0\n latest handshake: 5 seconds ago\n transfer: 13.00 MiB received, 13.36 KiB sent\n`),\n\t\t},\n\t}\n\tfor i, c := range cases {\n\t\tconf, err := NewConfStatus(c.B)\n\t\tif err != nil {\n\t\t\tt.Errorf(se, \"NewConfStatus\", i, err)\n\t\t\tcontinue\n\t\t}\n\t\tif !reflect.DeepEqual(conf, c.C) {\n\t\t\tt.Errorf(sf, \"NewConfStatus\", i, c.C, conf)\n\t\t}\n\t}\n\n}", "title": "" }, { "docid": "e1685f8e63a8269fff15e31923bf5f9d", "score": "0.51707745", "text": "func NewRpcStatus() *RpcStatus {\n\tthis := RpcStatus{}\n\treturn &this\n}", "title": "" }, { "docid": "eb098dcca09eaffc9a8267d5ed5d1109", "score": "0.5170325", "text": "func New(c Code, msg string) *Status {\n\treturn &Status{code: c, message: msg}\n}", "title": "" }, { "docid": "a5ad141571b39e4f7f4b382ba65fd8c5", "score": "0.51533824", "text": "func (config *SysctlConfig_STATUS) AssignProperties_From_SysctlConfig_STATUS(source *v20210501s.SysctlConfig_STATUS) error {\n\n\t// FsAioMaxNr\n\tconfig.FsAioMaxNr = genruntime.ClonePointerToInt(source.FsAioMaxNr)\n\n\t// FsFileMax\n\tconfig.FsFileMax = genruntime.ClonePointerToInt(source.FsFileMax)\n\n\t// FsInotifyMaxUserWatches\n\tconfig.FsInotifyMaxUserWatches = genruntime.ClonePointerToInt(source.FsInotifyMaxUserWatches)\n\n\t// FsNrOpen\n\tconfig.FsNrOpen = genruntime.ClonePointerToInt(source.FsNrOpen)\n\n\t// KernelThreadsMax\n\tconfig.KernelThreadsMax = genruntime.ClonePointerToInt(source.KernelThreadsMax)\n\n\t// NetCoreNetdevMaxBacklog\n\tconfig.NetCoreNetdevMaxBacklog = genruntime.ClonePointerToInt(source.NetCoreNetdevMaxBacklog)\n\n\t// NetCoreOptmemMax\n\tconfig.NetCoreOptmemMax = genruntime.ClonePointerToInt(source.NetCoreOptmemMax)\n\n\t// NetCoreRmemDefault\n\tconfig.NetCoreRmemDefault = genruntime.ClonePointerToInt(source.NetCoreRmemDefault)\n\n\t// NetCoreRmemMax\n\tconfig.NetCoreRmemMax = genruntime.ClonePointerToInt(source.NetCoreRmemMax)\n\n\t// NetCoreSomaxconn\n\tconfig.NetCoreSomaxconn = genruntime.ClonePointerToInt(source.NetCoreSomaxconn)\n\n\t// NetCoreWmemDefault\n\tconfig.NetCoreWmemDefault = genruntime.ClonePointerToInt(source.NetCoreWmemDefault)\n\n\t// NetCoreWmemMax\n\tconfig.NetCoreWmemMax = genruntime.ClonePointerToInt(source.NetCoreWmemMax)\n\n\t// NetIpv4IpLocalPortRange\n\tconfig.NetIpv4IpLocalPortRange = genruntime.ClonePointerToString(source.NetIpv4IpLocalPortRange)\n\n\t// NetIpv4NeighDefaultGcThresh1\n\tconfig.NetIpv4NeighDefaultGcThresh1 = genruntime.ClonePointerToInt(source.NetIpv4NeighDefaultGcThresh1)\n\n\t// NetIpv4NeighDefaultGcThresh2\n\tconfig.NetIpv4NeighDefaultGcThresh2 = genruntime.ClonePointerToInt(source.NetIpv4NeighDefaultGcThresh2)\n\n\t// NetIpv4NeighDefaultGcThresh3\n\tconfig.NetIpv4NeighDefaultGcThresh3 = genruntime.ClonePointerToInt(source.NetIpv4NeighDefaultGcThresh3)\n\n\t// NetIpv4TcpFinTimeout\n\tconfig.NetIpv4TcpFinTimeout = genruntime.ClonePointerToInt(source.NetIpv4TcpFinTimeout)\n\n\t// NetIpv4TcpKeepaliveProbes\n\tconfig.NetIpv4TcpKeepaliveProbes = genruntime.ClonePointerToInt(source.NetIpv4TcpKeepaliveProbes)\n\n\t// NetIpv4TcpKeepaliveTime\n\tconfig.NetIpv4TcpKeepaliveTime = genruntime.ClonePointerToInt(source.NetIpv4TcpKeepaliveTime)\n\n\t// NetIpv4TcpMaxSynBacklog\n\tconfig.NetIpv4TcpMaxSynBacklog = genruntime.ClonePointerToInt(source.NetIpv4TcpMaxSynBacklog)\n\n\t// NetIpv4TcpMaxTwBuckets\n\tconfig.NetIpv4TcpMaxTwBuckets = genruntime.ClonePointerToInt(source.NetIpv4TcpMaxTwBuckets)\n\n\t// NetIpv4TcpTwReuse\n\tif source.NetIpv4TcpTwReuse != nil {\n\t\tnetIpv4TcpTwReuse := *source.NetIpv4TcpTwReuse\n\t\tconfig.NetIpv4TcpTwReuse = &netIpv4TcpTwReuse\n\t} else {\n\t\tconfig.NetIpv4TcpTwReuse = nil\n\t}\n\n\t// NetIpv4TcpkeepaliveIntvl\n\tconfig.NetIpv4TcpkeepaliveIntvl = genruntime.ClonePointerToInt(source.NetIpv4TcpkeepaliveIntvl)\n\n\t// NetNetfilterNfConntrackBuckets\n\tconfig.NetNetfilterNfConntrackBuckets = genruntime.ClonePointerToInt(source.NetNetfilterNfConntrackBuckets)\n\n\t// NetNetfilterNfConntrackMax\n\tconfig.NetNetfilterNfConntrackMax = genruntime.ClonePointerToInt(source.NetNetfilterNfConntrackMax)\n\n\t// VmMaxMapCount\n\tconfig.VmMaxMapCount = genruntime.ClonePointerToInt(source.VmMaxMapCount)\n\n\t// VmSwappiness\n\tconfig.VmSwappiness = genruntime.ClonePointerToInt(source.VmSwappiness)\n\n\t// VmVfsCachePressure\n\tconfig.VmVfsCachePressure = genruntime.ClonePointerToInt(source.VmVfsCachePressure)\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "666863b99c86a2adb3054ed178634623", "score": "0.5150155", "text": "func NewStatusClient(t mockConstructorTestingTNewStatusClient) *StatusClient {\n\tmock := &StatusClient{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "title": "" }, { "docid": "2f4d72906171757d3abe83aecb35a362", "score": "0.51245135", "text": "func (namespace *Namespace_Spec) Initialize_From_Namespace_STATUS(source *Namespace_STATUS) error {\n\n\t// AlternateName\n\tnamespace.AlternateName = genruntime.ClonePointerToString(source.AlternateName)\n\n\t// ClusterArmReference\n\tif source.ClusterArmId != nil {\n\t\tclusterArmReference := genruntime.CreateResourceReferenceFromARMID(*source.ClusterArmId)\n\t\tnamespace.ClusterArmReference = &clusterArmReference\n\t} else {\n\t\tnamespace.ClusterArmReference = nil\n\t}\n\n\t// DisableLocalAuth\n\tif source.DisableLocalAuth != nil {\n\t\tdisableLocalAuth := *source.DisableLocalAuth\n\t\tnamespace.DisableLocalAuth = &disableLocalAuth\n\t} else {\n\t\tnamespace.DisableLocalAuth = nil\n\t}\n\n\t// Encryption\n\tif source.Encryption != nil {\n\t\tvar encryption Encryption\n\t\terr := encryption.Initialize_From_Encryption_STATUS(source.Encryption)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling Initialize_From_Encryption_STATUS() to populate field Encryption\")\n\t\t}\n\t\tnamespace.Encryption = &encryption\n\t} else {\n\t\tnamespace.Encryption = nil\n\t}\n\n\t// Identity\n\tif source.Identity != nil {\n\t\tvar identity Identity\n\t\terr := identity.Initialize_From_Identity_STATUS(source.Identity)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling Initialize_From_Identity_STATUS() to populate field Identity\")\n\t\t}\n\t\tnamespace.Identity = &identity\n\t} else {\n\t\tnamespace.Identity = nil\n\t}\n\n\t// IsAutoInflateEnabled\n\tif source.IsAutoInflateEnabled != nil {\n\t\tisAutoInflateEnabled := *source.IsAutoInflateEnabled\n\t\tnamespace.IsAutoInflateEnabled = &isAutoInflateEnabled\n\t} else {\n\t\tnamespace.IsAutoInflateEnabled = nil\n\t}\n\n\t// KafkaEnabled\n\tif source.KafkaEnabled != nil {\n\t\tkafkaEnabled := *source.KafkaEnabled\n\t\tnamespace.KafkaEnabled = &kafkaEnabled\n\t} else {\n\t\tnamespace.KafkaEnabled = nil\n\t}\n\n\t// Location\n\tnamespace.Location = genruntime.ClonePointerToString(source.Location)\n\n\t// MaximumThroughputUnits\n\tnamespace.MaximumThroughputUnits = genruntime.ClonePointerToInt(source.MaximumThroughputUnits)\n\n\t// Sku\n\tif source.Sku != nil {\n\t\tvar sku Sku\n\t\terr := sku.Initialize_From_Sku_STATUS(source.Sku)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling Initialize_From_Sku_STATUS() to populate field Sku\")\n\t\t}\n\t\tnamespace.Sku = &sku\n\t} else {\n\t\tnamespace.Sku = nil\n\t}\n\n\t// Tags\n\tnamespace.Tags = genruntime.CloneMapOfStringToString(source.Tags)\n\n\t// ZoneRedundant\n\tif source.ZoneRedundant != nil {\n\t\tzoneRedundant := *source.ZoneRedundant\n\t\tnamespace.ZoneRedundant = &zoneRedundant\n\t} else {\n\t\tnamespace.ZoneRedundant = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "ba4f2c3b1a04bd448939bb05fd52c7ad", "score": "0.5113705", "text": "func NewStatus(subStatus SubStatus) *Status {\n\treturn &Status{\n\t\tCreatedAt: time.Now(),\n\t\tSubStatus: subStatus,\n\t}\n}", "title": "" }, { "docid": "6e7341d34b5143e07e410d7ce84bc700", "score": "0.50973403", "text": "func NewStatus(status string) (Status, error) {\n\tsts := Status(status)\n\tif !sts.IsValid() {\n\t\treturn Status(\"\"), ErrInvalidStatus\n\t}\n\n\treturn sts, nil\n}", "title": "" }, { "docid": "3f9cf4bb33752549e0712af18aa18e58", "score": "0.50936705", "text": "func (settings *AutoscaleSettings) Initialize_From_AutoscaleSettings_STATUS(source *AutoscaleSettings_STATUS) error {\n\n\t// MaxThroughput\n\tsettings.MaxThroughput = genruntime.ClonePointerToInt(source.MaxThroughput)\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "b7b10927c06bc769a44d5249d2daeb54", "score": "0.5092965", "text": "func (e *Executor) newStatus(taskID mesos.TaskID) mesos.TaskStatus {\n\treturn mesos.TaskStatus{\n\t\tExecutorID: &e.ExecutorInfo.ExecutorID,\n\t\tSource: mesos.SOURCE_EXECUTOR.Enum(),\n\t\tTaskID: taskID,\n\t\tUUID: []byte(uuid.NewRandom()),\n\t}\n}", "title": "" }, { "docid": "42dcf84341d0a22d43cf8d1086f90692", "score": "0.5078691", "text": "func (r *ClusterOperatorStatusClient) setStatusProgressing(ctx context.Context, overrides []configv1.ClusterOperatorStatusCondition) error {\n\tco, err := r.getOrCreateClusterOperator(ctx)\n\tif err != nil {\n\t\tklog.Errorf(\"Failed to get or create Cluster Operator: %v\", err)\n\t\treturn err\n\t}\n\n\tdesiredVersions := []configv1.OperandVersion{{Name: operatorVersionKey, Version: r.ReleaseVersion}}\n\tcurrentVersions := co.Status.Versions\n\n\tvar message, reason string\n\tif !reflect.DeepEqual(desiredVersions, currentVersions) {\n\t\tmessage = fmt.Sprintf(\"Progressing towards %s\", printOperandVersions(desiredVersions))\n\t\tklog.V(2).Infof(\"Syncing status: %s\", message)\n\t\tr.Recorder.Eventf(co, corev1.EventTypeNormal, \"Status upgrade\", message)\n\t\treason = ReasonSyncing\n\t} else {\n\t\tklog.V(2).Info(\"Syncing status: re-syncing\")\n\t\treason = ReasonAsExpected\n\t}\n\n\tconds := []configv1.ClusterOperatorStatusCondition{\n\t\tnewClusterOperatorStatusCondition(configv1.OperatorProgressing, configv1.ConditionTrue, reason, message),\n\t\tnewClusterOperatorStatusCondition(configv1.OperatorUpgradeable, configv1.ConditionTrue, ReasonAsExpected, \"\"),\n\t}\n\n\treturn r.syncStatus(ctx, co, conds, overrides)\n}", "title": "" }, { "docid": "7a6cf25d9ef1579ce136dd5a6e0bdd4a", "score": "0.5074031", "text": "func (settings *ManagedVirtualNetworkSettings) Initialize_From_ManagedVirtualNetworkSettings_STATUS(source *ManagedVirtualNetworkSettings_STATUS) error {\n\n\t// AllowedAadTenantIdsForLinking\n\tsettings.AllowedAadTenantIdsForLinking = genruntime.CloneSliceOfString(source.AllowedAadTenantIdsForLinking)\n\n\t// LinkedAccessCheckOnTargetResource\n\tif source.LinkedAccessCheckOnTargetResource != nil {\n\t\tlinkedAccessCheckOnTargetResource := *source.LinkedAccessCheckOnTargetResource\n\t\tsettings.LinkedAccessCheckOnTargetResource = &linkedAccessCheckOnTargetResource\n\t} else {\n\t\tsettings.LinkedAccessCheckOnTargetResource = nil\n\t}\n\n\t// PreventDataExfiltration\n\tif source.PreventDataExfiltration != nil {\n\t\tpreventDataExfiltration := *source.PreventDataExfiltration\n\t\tsettings.PreventDataExfiltration = &preventDataExfiltration\n\t} else {\n\t\tsettings.PreventDataExfiltration = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "73cabe2857dc4ea2d04d73c24fc6ba0c", "score": "0.50581527", "text": "func (parameters *HttpVersionMatchConditionParameters) Initialize_From_HttpVersionMatchConditionParameters_STATUS(source *HttpVersionMatchConditionParameters_STATUS) error {\n\n\t// MatchValues\n\tparameters.MatchValues = genruntime.CloneSliceOfString(source.MatchValues)\n\n\t// NegateCondition\n\tif source.NegateCondition != nil {\n\t\tnegateCondition := *source.NegateCondition\n\t\tparameters.NegateCondition = &negateCondition\n\t} else {\n\t\tparameters.NegateCondition = nil\n\t}\n\n\t// Operator\n\tif source.Operator != nil {\n\t\toperator := HttpVersionMatchConditionParameters_Operator(*source.Operator)\n\t\tparameters.Operator = &operator\n\t} else {\n\t\tparameters.Operator = nil\n\t}\n\n\t// Transforms\n\tif source.Transforms != nil {\n\t\ttransformList := make([]Transform, len(source.Transforms))\n\t\tfor transformIndex, transformItem := range source.Transforms {\n\t\t\t// Shadow the loop variable to avoid aliasing\n\t\t\ttransformItem := transformItem\n\t\t\ttransform := Transform(transformItem)\n\t\t\ttransformList[transformIndex] = transform\n\t\t}\n\t\tparameters.Transforms = transformList\n\t} else {\n\t\tparameters.Transforms = nil\n\t}\n\n\t// TypeName\n\tif source.TypeName != nil {\n\t\ttypeName := HttpVersionMatchConditionParameters_TypeName(*source.TypeName)\n\t\tparameters.TypeName = &typeName\n\t} else {\n\t\tparameters.TypeName = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "fe89cdbe6c6bd00a8a5ed8d2abf441b3", "score": "0.5056328", "text": "func (workspace *Workspace_Spec) Initialize_From_Workspace_STATUS(source *Workspace_STATUS) error {\n\n\t// AzureADOnlyAuthentication\n\tif source.AzureADOnlyAuthentication != nil {\n\t\tazureADOnlyAuthentication := *source.AzureADOnlyAuthentication\n\t\tworkspace.AzureADOnlyAuthentication = &azureADOnlyAuthentication\n\t} else {\n\t\tworkspace.AzureADOnlyAuthentication = nil\n\t}\n\n\t// CspWorkspaceAdminProperties\n\tif source.CspWorkspaceAdminProperties != nil {\n\t\tvar cspWorkspaceAdminProperty CspWorkspaceAdminProperties\n\t\terr := cspWorkspaceAdminProperty.Initialize_From_CspWorkspaceAdminProperties_STATUS(source.CspWorkspaceAdminProperties)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling Initialize_From_CspWorkspaceAdminProperties_STATUS() to populate field CspWorkspaceAdminProperties\")\n\t\t}\n\t\tworkspace.CspWorkspaceAdminProperties = &cspWorkspaceAdminProperty\n\t} else {\n\t\tworkspace.CspWorkspaceAdminProperties = nil\n\t}\n\n\t// DefaultDataLakeStorage\n\tif source.DefaultDataLakeStorage != nil {\n\t\tvar defaultDataLakeStorage DataLakeStorageAccountDetails\n\t\terr := defaultDataLakeStorage.Initialize_From_DataLakeStorageAccountDetails_STATUS(source.DefaultDataLakeStorage)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling Initialize_From_DataLakeStorageAccountDetails_STATUS() to populate field DefaultDataLakeStorage\")\n\t\t}\n\t\tworkspace.DefaultDataLakeStorage = &defaultDataLakeStorage\n\t} else {\n\t\tworkspace.DefaultDataLakeStorage = nil\n\t}\n\n\t// Encryption\n\tif source.Encryption != nil {\n\t\tvar encryption EncryptionDetails\n\t\terr := encryption.Initialize_From_EncryptionDetails_STATUS(source.Encryption)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling Initialize_From_EncryptionDetails_STATUS() to populate field Encryption\")\n\t\t}\n\t\tworkspace.Encryption = &encryption\n\t} else {\n\t\tworkspace.Encryption = nil\n\t}\n\n\t// Identity\n\tif source.Identity != nil {\n\t\tvar identity ManagedIdentity\n\t\terr := identity.Initialize_From_ManagedIdentity_STATUS(source.Identity)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling Initialize_From_ManagedIdentity_STATUS() to populate field Identity\")\n\t\t}\n\t\tworkspace.Identity = &identity\n\t} else {\n\t\tworkspace.Identity = nil\n\t}\n\n\t// Location\n\tworkspace.Location = genruntime.ClonePointerToString(source.Location)\n\n\t// ManagedResourceGroupName\n\tworkspace.ManagedResourceGroupName = genruntime.ClonePointerToString(source.ManagedResourceGroupName)\n\n\t// ManagedVirtualNetwork\n\tworkspace.ManagedVirtualNetwork = genruntime.ClonePointerToString(source.ManagedVirtualNetwork)\n\n\t// ManagedVirtualNetworkSettings\n\tif source.ManagedVirtualNetworkSettings != nil {\n\t\tvar managedVirtualNetworkSetting ManagedVirtualNetworkSettings\n\t\terr := managedVirtualNetworkSetting.Initialize_From_ManagedVirtualNetworkSettings_STATUS(source.ManagedVirtualNetworkSettings)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling Initialize_From_ManagedVirtualNetworkSettings_STATUS() to populate field ManagedVirtualNetworkSettings\")\n\t\t}\n\t\tworkspace.ManagedVirtualNetworkSettings = &managedVirtualNetworkSetting\n\t} else {\n\t\tworkspace.ManagedVirtualNetworkSettings = nil\n\t}\n\n\t// PublicNetworkAccess\n\tif source.PublicNetworkAccess != nil {\n\t\tpublicNetworkAccess := WorkspaceProperties_PublicNetworkAccess(*source.PublicNetworkAccess)\n\t\tworkspace.PublicNetworkAccess = &publicNetworkAccess\n\t} else {\n\t\tworkspace.PublicNetworkAccess = nil\n\t}\n\n\t// PurviewConfiguration\n\tif source.PurviewConfiguration != nil {\n\t\tvar purviewConfiguration PurviewConfiguration\n\t\terr := purviewConfiguration.Initialize_From_PurviewConfiguration_STATUS(source.PurviewConfiguration)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling Initialize_From_PurviewConfiguration_STATUS() to populate field PurviewConfiguration\")\n\t\t}\n\t\tworkspace.PurviewConfiguration = &purviewConfiguration\n\t} else {\n\t\tworkspace.PurviewConfiguration = nil\n\t}\n\n\t// SqlAdministratorLogin\n\tworkspace.SqlAdministratorLogin = genruntime.ClonePointerToString(source.SqlAdministratorLogin)\n\n\t// Tags\n\tworkspace.Tags = genruntime.CloneMapOfStringToString(source.Tags)\n\n\t// TrustedServiceBypassEnabled\n\tif source.TrustedServiceBypassEnabled != nil {\n\t\ttrustedServiceBypassEnabled := *source.TrustedServiceBypassEnabled\n\t\tworkspace.TrustedServiceBypassEnabled = &trustedServiceBypassEnabled\n\t} else {\n\t\tworkspace.TrustedServiceBypassEnabled = nil\n\t}\n\n\t// VirtualNetworkProfile\n\tif source.VirtualNetworkProfile != nil {\n\t\tvar virtualNetworkProfile VirtualNetworkProfile\n\t\terr := virtualNetworkProfile.Initialize_From_VirtualNetworkProfile_STATUS(source.VirtualNetworkProfile)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling Initialize_From_VirtualNetworkProfile_STATUS() to populate field VirtualNetworkProfile\")\n\t\t}\n\t\tworkspace.VirtualNetworkProfile = &virtualNetworkProfile\n\t} else {\n\t\tworkspace.VirtualNetworkProfile = nil\n\t}\n\n\t// WorkspaceRepositoryConfiguration\n\tif source.WorkspaceRepositoryConfiguration != nil {\n\t\tvar workspaceRepositoryConfiguration WorkspaceRepositoryConfiguration\n\t\terr := workspaceRepositoryConfiguration.Initialize_From_WorkspaceRepositoryConfiguration_STATUS(source.WorkspaceRepositoryConfiguration)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling Initialize_From_WorkspaceRepositoryConfiguration_STATUS() to populate field WorkspaceRepositoryConfiguration\")\n\t\t}\n\t\tworkspace.WorkspaceRepositoryConfiguration = &workspaceRepositoryConfiguration\n\t} else {\n\t\tworkspace.WorkspaceRepositoryConfiguration = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "059cfbc2cedaafacff3886846eadde1d", "score": "0.5050678", "text": "func New(c *Config) (GoSync, error) {\n\tif err := c.validate(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tr := newRSync(c)\n\treturn r, nil\n}", "title": "" }, { "docid": "3ad890290c953f5a761a478f24e482bc", "score": "0.5050327", "text": "func New(api app.BaseConfig) status.Service {\n\treturn &service{api.Service(\"status\")}\n}", "title": "" }, { "docid": "bf123d92ce9c215d19bb993d7b3f3f9b", "score": "0.5038602", "text": "func (s *Syncer) Status() interface{} {\n\ttotal := s.count.Load()\n\ttotalTps := s.totalTps.Load()\n\ttps := s.tps.Load()\n\n\tsyncerLocation := s.checkpoint.FlushedGlobalPoint()\n\tst := &pb.SyncStatus{\n\t\tTotalEvents: total,\n\t\tTotalTps: totalTps,\n\t\tRecentTps: tps,\n\t\tSyncerBinlog: syncerLocation.Position.String(),\n\t}\n\n\tif syncerLocation.GetGTID() != nil {\n\t\tst.SyncerBinlogGtid = syncerLocation.GetGTID().String()\n\t}\n\n\tst.BinlogType = \"unknown\"\n\tif s.streamerController != nil {\n\t\tst.BinlogType = binlogTypeToString(s.streamerController.GetBinlogType())\n\t}\n\n\t// only support to show `UnresolvedGroups` in pessimistic mode now.\n\tif s.cfg.ShardMode == config.ShardPessimistic {\n\t\tst.UnresolvedGroups = s.sgk.UnresolvedGroups()\n\t}\n\n\tpendingShardInfo := s.pessimist.PendingInfo()\n\tif pendingShardInfo != nil {\n\t\tst.BlockingDDLs = pendingShardInfo.DDLs\n\t}\n\n\tfailpoint.Inject(\"BlockSyncStatus\", func(val failpoint.Value) {\n\t\tinterval, err := time.ParseDuration(val.(string))\n\t\tif err != nil {\n\t\t\ts.tctx.L().Warn(\"inject failpoint BlockSyncStatus failed\", zap.Reflect(\"value\", val), zap.Error(err))\n\t\t} else {\n\t\t\ts.tctx.L().Info(\"set BlockSyncStatus\", zap.String(\"failpoint\", \"BlockSyncStatus\"), zap.Duration(\"value\", interval))\n\t\t\ttime.Sleep(interval)\n\t\t}\n\t})\n\treturn st\n}", "title": "" }, { "docid": "d07f3294a45ccbf07ca00c00a84917d3", "score": "0.5024951", "text": "func (in *ApigeeSyncAuthorizationStatus) DeepCopy() *ApigeeSyncAuthorizationStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ApigeeSyncAuthorizationStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "335aff7e08e3838a270815c8f3e1acac", "score": "0.5000772", "text": "func (c *StatusClient) Create() *StatusCreate {\n\tmutation := newStatusMutation(c.config, OpCreate)\n\treturn &StatusCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "7ac3cd989f3d5155673fb64c0a870c3e", "score": "0.49878308", "text": "func NewStatusClient(c config) *StatusClient {\n\treturn &StatusClient{config: c}\n}", "title": "" }, { "docid": "7bf16eb18c7f2303961e310ee01a6b02", "score": "0.49815622", "text": "func (server *FlexibleServer) NewEmptyStatus() genruntime.ConvertibleStatus {\n\treturn &FlexibleServer_STATUS{}\n}", "title": "" }, { "docid": "7bf16eb18c7f2303961e310ee01a6b02", "score": "0.49815622", "text": "func (server *FlexibleServer) NewEmptyStatus() genruntime.ConvertibleStatus {\n\treturn &FlexibleServer_STATUS{}\n}", "title": "" }, { "docid": "9f6cafce55bf20825f20eb1d80c36ad0", "score": "0.49796396", "text": "func (in *StatusSyncSpec) DeepCopy() *StatusSyncSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(StatusSyncSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "84336199109bcc7a529b1bf9c4ccf4b2", "score": "0.49663612", "text": "func newK8sStatusCollector(client k8s.Interface, params Args) *k8sStatusCollector {\n\treturn &k8sStatusCollector{\n\t\tclient: client,\n\t\tparams: params,\n\t\tcheckers: []Checker{\n\t\t\tnewNamespaceChecker(params.Namespace, client),\n\t\t\tnewPodChecker(params.Namespace, liqoDeployments, liqoDaemonSets, client),\n\t\t},\n\t}\n}", "title": "" }, { "docid": "8aa2ff3bc0e26d871a04294aa8a4ed7d", "score": "0.49623102", "text": "func (config *KubeletConfig_STATUS) AssignProperties_From_KubeletConfig_STATUS(source *v20210501s.KubeletConfig_STATUS) error {\n\n\t// AllowedUnsafeSysctls\n\tconfig.AllowedUnsafeSysctls = genruntime.CloneSliceOfString(source.AllowedUnsafeSysctls)\n\n\t// ContainerLogMaxFiles\n\tconfig.ContainerLogMaxFiles = genruntime.ClonePointerToInt(source.ContainerLogMaxFiles)\n\n\t// ContainerLogMaxSizeMB\n\tconfig.ContainerLogMaxSizeMB = genruntime.ClonePointerToInt(source.ContainerLogMaxSizeMB)\n\n\t// CpuCfsQuota\n\tif source.CpuCfsQuota != nil {\n\t\tcpuCfsQuota := *source.CpuCfsQuota\n\t\tconfig.CpuCfsQuota = &cpuCfsQuota\n\t} else {\n\t\tconfig.CpuCfsQuota = nil\n\t}\n\n\t// CpuCfsQuotaPeriod\n\tconfig.CpuCfsQuotaPeriod = genruntime.ClonePointerToString(source.CpuCfsQuotaPeriod)\n\n\t// CpuManagerPolicy\n\tconfig.CpuManagerPolicy = genruntime.ClonePointerToString(source.CpuManagerPolicy)\n\n\t// FailSwapOn\n\tif source.FailSwapOn != nil {\n\t\tfailSwapOn := *source.FailSwapOn\n\t\tconfig.FailSwapOn = &failSwapOn\n\t} else {\n\t\tconfig.FailSwapOn = nil\n\t}\n\n\t// ImageGcHighThreshold\n\tconfig.ImageGcHighThreshold = genruntime.ClonePointerToInt(source.ImageGcHighThreshold)\n\n\t// ImageGcLowThreshold\n\tconfig.ImageGcLowThreshold = genruntime.ClonePointerToInt(source.ImageGcLowThreshold)\n\n\t// PodMaxPids\n\tconfig.PodMaxPids = genruntime.ClonePointerToInt(source.PodMaxPids)\n\n\t// TopologyManagerPolicy\n\tconfig.TopologyManagerPolicy = genruntime.ClonePointerToString(source.TopologyManagerPolicy)\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "4603a3e3cc9008f30d6b34e210b266c5", "score": "0.49560776", "text": "func New(v string) *Config {\n\treturn &Config{\n\t\tMinVersion: v,\n\t\tModes: map[Mode]Settings{\n\t\t\tPreCommit: {\n\t\t\t\tOptions: Options{MaxDuration: 5},\n\t\t\t\tChecks: Checks{\n\t\t\t\t\t\"gofmt\": {\n\t\t\t\t\t\t&Gofmt{},\n\t\t\t\t\t},\n\t\t\t\t\t\"test\": {\n\t\t\t\t\t\t&Test{\n\t\t\t\t\t\t\tExtraArgs: []string{\"-short\"},\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\tPrePush: {\n\t\t\t\tOptions: Options{MaxDuration: 15},\n\t\t\t\tChecks: Checks{\n\t\t\t\t\t\"goimports\": {\n\t\t\t\t\t\t&Goimports{},\n\t\t\t\t\t},\n\t\t\t\t\t\"coverage\": {\n\t\t\t\t\t\t&Coverage{\n\t\t\t\t\t\t\tUseCoveralls: false,\n\t\t\t\t\t\t\tGlobal: CoverageSettings{\n\t\t\t\t\t\t\t\tMinCoverage: 50,\n\t\t\t\t\t\t\t\tMaxCoverage: 100,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tPerDirDefault: CoverageSettings{\n\t\t\t\t\t\t\t\tMinCoverage: 1,\n\t\t\t\t\t\t\t\tMaxCoverage: 100,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tPerDir: map[string]*CoverageSettings{},\n\t\t\t\t\t\t\tIgnorePathPatterns: []string{},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\t\"test\": {\n\t\t\t\t\t\t&Test{\n\t\t\t\t\t\t\tExtraArgs: []string{\"-v\", \"-race\"},\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\tContinuousIntegration: {\n\t\t\t\tOptions: Options{MaxDuration: 120},\n\t\t\t\tChecks: Checks{\n\t\t\t\t\t\"gofmt\": {\n\t\t\t\t\t\t&Gofmt{},\n\t\t\t\t\t},\n\t\t\t\t\t\"goimports\": {\n\t\t\t\t\t\t&Goimports{},\n\t\t\t\t\t},\n\t\t\t\t\t\"coverage\": {\n\t\t\t\t\t\t&Coverage{\n\t\t\t\t\t\t\tUseCoveralls: true,\n\t\t\t\t\t\t\tGlobal: CoverageSettings{\n\t\t\t\t\t\t\t\tMinCoverage: 50,\n\t\t\t\t\t\t\t\tMaxCoverage: 100,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tPerDirDefault: CoverageSettings{\n\t\t\t\t\t\t\t\tMinCoverage: 1,\n\t\t\t\t\t\t\t\tMaxCoverage: 100,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tPerDir: map[string]*CoverageSettings{},\n\t\t\t\t\t\t\tIgnorePathPatterns: []string{},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\t\"test\": {\n\t\t\t\t\t\t&Test{\n\t\t\t\t\t\t\tExtraArgs: []string{\"-v\", \"-race\"},\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\tLint: {\n\t\t\t\tOptions: Options{MaxDuration: 15},\n\t\t\t\tChecks: Checks{\n\t\t\t\t\t\"errcheck\": {\n\t\t\t\t\t\t&Errcheck{\n\t\t\t\t\t\t\t// \"Close|Write.*|Flush|Seek|Read.*\"\n\t\t\t\t\t\t\tIgnores: \"Close\",\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\t\"golint\": {\n\t\t\t\t\t\t&Golint{\n\t\t\t\t\t\t\tBlacklist: []string{},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\t\"govet\": {\n\t\t\t\t\t\t&Govet{\n\t\t\t\t\t\t\tBlacklist: []string{\" composite literal uses unkeyed 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\tIgnorePatterns: []string{\n\t\t\t\"vendor\", // https://github.com/golang/go/wiki/PackageManagementTools\n\t\t\t\".*\", // SCM\n\t\t\t\"_*\", // Godeps\n\t\t\t\"*.pb.go\", // protobuf\n\t\t\t\"*_string.go\", // stringer\n\t\t},\n\t}\n}", "title": "" }, { "docid": "7fd7d78305fb1b5d2d27fa136f8ecdde", "score": "0.49550667", "text": "func (s *StartEdgeConfigurationUpdateOutput) SetSyncStatus(v string) *StartEdgeConfigurationUpdateOutput {\n\ts.SyncStatus = &v\n\treturn s\n}", "title": "" }, { "docid": "66ed3cbc39b679f06ffab69cdff4c7a5", "score": "0.49549854", "text": "func (r *ServiceClusterPollRequest) Status(value int) *ServiceClusterPollRequest {\n\tr.statuses = append(r.statuses, value)\n\treturn r\n}", "title": "" }, { "docid": "ce98c5a72a2a160c2820b8fd91036846", "score": "0.49434647", "text": "func (parameters *ServerPortMatchConditionParameters) Initialize_From_ServerPortMatchConditionParameters_STATUS(source *ServerPortMatchConditionParameters_STATUS) error {\n\n\t// MatchValues\n\tparameters.MatchValues = genruntime.CloneSliceOfString(source.MatchValues)\n\n\t// NegateCondition\n\tif source.NegateCondition != nil {\n\t\tnegateCondition := *source.NegateCondition\n\t\tparameters.NegateCondition = &negateCondition\n\t} else {\n\t\tparameters.NegateCondition = nil\n\t}\n\n\t// Operator\n\tif source.Operator != nil {\n\t\toperator := ServerPortMatchConditionParameters_Operator(*source.Operator)\n\t\tparameters.Operator = &operator\n\t} else {\n\t\tparameters.Operator = nil\n\t}\n\n\t// Transforms\n\tif source.Transforms != nil {\n\t\ttransformList := make([]Transform, len(source.Transforms))\n\t\tfor transformIndex, transformItem := range source.Transforms {\n\t\t\t// Shadow the loop variable to avoid aliasing\n\t\t\ttransformItem := transformItem\n\t\t\ttransform := Transform(transformItem)\n\t\t\ttransformList[transformIndex] = transform\n\t\t}\n\t\tparameters.Transforms = transformList\n\t} else {\n\t\tparameters.Transforms = nil\n\t}\n\n\t// TypeName\n\tif source.TypeName != nil {\n\t\ttypeName := ServerPortMatchConditionParameters_TypeName(*source.TypeName)\n\t\tparameters.TypeName = &typeName\n\t} else {\n\t\tparameters.TypeName = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "15921e0dba43a6acc8aa696c3270dcdb", "score": "0.49433553", "text": "func (parameters *ClientPortMatchConditionParameters) Initialize_From_ClientPortMatchConditionParameters_STATUS(source *ClientPortMatchConditionParameters_STATUS) error {\n\n\t// MatchValues\n\tparameters.MatchValues = genruntime.CloneSliceOfString(source.MatchValues)\n\n\t// NegateCondition\n\tif source.NegateCondition != nil {\n\t\tnegateCondition := *source.NegateCondition\n\t\tparameters.NegateCondition = &negateCondition\n\t} else {\n\t\tparameters.NegateCondition = nil\n\t}\n\n\t// Operator\n\tif source.Operator != nil {\n\t\toperator := ClientPortMatchConditionParameters_Operator(*source.Operator)\n\t\tparameters.Operator = &operator\n\t} else {\n\t\tparameters.Operator = nil\n\t}\n\n\t// Transforms\n\tif source.Transforms != nil {\n\t\ttransformList := make([]Transform, len(source.Transforms))\n\t\tfor transformIndex, transformItem := range source.Transforms {\n\t\t\t// Shadow the loop variable to avoid aliasing\n\t\t\ttransformItem := transformItem\n\t\t\ttransform := Transform(transformItem)\n\t\t\ttransformList[transformIndex] = transform\n\t\t}\n\t\tparameters.Transforms = transformList\n\t} else {\n\t\tparameters.Transforms = nil\n\t}\n\n\t// TypeName\n\tif source.TypeName != nil {\n\t\ttypeName := ClientPortMatchConditionParameters_TypeName(*source.TypeName)\n\t\tparameters.TypeName = &typeName\n\t} else {\n\t\tparameters.TypeName = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "3ccaac5f5235b03a49c3f40aff8b2c5a", "score": "0.49419415", "text": "func (alias *Alias) NewEmptyStatus() genruntime.ConvertibleStatus {\n\treturn &Alias_STATUS{}\n}", "title": "" }, { "docid": "974981c35f1f695b8e7c7a5e8ec6de45", "score": "0.49369913", "text": "func (namespace *Namespace_STATUS) AssignProperties_From_Namespace_STATUS(source *v20211101s.Namespace_STATUS) error {\n\n\t// AlternateName\n\tnamespace.AlternateName = genruntime.ClonePointerToString(source.AlternateName)\n\n\t// ClusterArmId\n\tnamespace.ClusterArmId = genruntime.ClonePointerToString(source.ClusterArmId)\n\n\t// Conditions\n\tnamespace.Conditions = genruntime.CloneSliceOfCondition(source.Conditions)\n\n\t// CreatedAt\n\tnamespace.CreatedAt = genruntime.ClonePointerToString(source.CreatedAt)\n\n\t// DisableLocalAuth\n\tif source.DisableLocalAuth != nil {\n\t\tdisableLocalAuth := *source.DisableLocalAuth\n\t\tnamespace.DisableLocalAuth = &disableLocalAuth\n\t} else {\n\t\tnamespace.DisableLocalAuth = nil\n\t}\n\n\t// Encryption\n\tif source.Encryption != nil {\n\t\tvar encryption Encryption_STATUS\n\t\terr := encryption.AssignProperties_From_Encryption_STATUS(source.Encryption)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_Encryption_STATUS() to populate field Encryption\")\n\t\t}\n\t\tnamespace.Encryption = &encryption\n\t} else {\n\t\tnamespace.Encryption = nil\n\t}\n\n\t// Id\n\tnamespace.Id = genruntime.ClonePointerToString(source.Id)\n\n\t// Identity\n\tif source.Identity != nil {\n\t\tvar identity Identity_STATUS\n\t\terr := identity.AssignProperties_From_Identity_STATUS(source.Identity)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_Identity_STATUS() to populate field Identity\")\n\t\t}\n\t\tnamespace.Identity = &identity\n\t} else {\n\t\tnamespace.Identity = nil\n\t}\n\n\t// IsAutoInflateEnabled\n\tif source.IsAutoInflateEnabled != nil {\n\t\tisAutoInflateEnabled := *source.IsAutoInflateEnabled\n\t\tnamespace.IsAutoInflateEnabled = &isAutoInflateEnabled\n\t} else {\n\t\tnamespace.IsAutoInflateEnabled = nil\n\t}\n\n\t// KafkaEnabled\n\tif source.KafkaEnabled != nil {\n\t\tkafkaEnabled := *source.KafkaEnabled\n\t\tnamespace.KafkaEnabled = &kafkaEnabled\n\t} else {\n\t\tnamespace.KafkaEnabled = nil\n\t}\n\n\t// Location\n\tnamespace.Location = genruntime.ClonePointerToString(source.Location)\n\n\t// MaximumThroughputUnits\n\tnamespace.MaximumThroughputUnits = genruntime.ClonePointerToInt(source.MaximumThroughputUnits)\n\n\t// MetricId\n\tnamespace.MetricId = genruntime.ClonePointerToString(source.MetricId)\n\n\t// Name\n\tnamespace.Name = genruntime.ClonePointerToString(source.Name)\n\n\t// PrivateEndpointConnections\n\tif source.PrivateEndpointConnections != nil {\n\t\tprivateEndpointConnectionList := make([]PrivateEndpointConnection_STATUS, 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\n\t\t\terr := privateEndpointConnection.AssignProperties_From_PrivateEndpointConnection_STATUS(&privateEndpointConnectionItem)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_PrivateEndpointConnection_STATUS() to populate field PrivateEndpointConnections\")\n\t\t\t}\n\t\t\tprivateEndpointConnectionList[privateEndpointConnectionIndex] = privateEndpointConnection\n\t\t}\n\t\tnamespace.PrivateEndpointConnections = privateEndpointConnectionList\n\t} else {\n\t\tnamespace.PrivateEndpointConnections = nil\n\t}\n\n\t// ProvisioningState\n\tnamespace.ProvisioningState = genruntime.ClonePointerToString(source.ProvisioningState)\n\n\t// ServiceBusEndpoint\n\tnamespace.ServiceBusEndpoint = genruntime.ClonePointerToString(source.ServiceBusEndpoint)\n\n\t// Sku\n\tif source.Sku != nil {\n\t\tvar sku Sku_STATUS\n\t\terr := sku.AssignProperties_From_Sku_STATUS(source.Sku)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_Sku_STATUS() to populate field Sku\")\n\t\t}\n\t\tnamespace.Sku = &sku\n\t} else {\n\t\tnamespace.Sku = nil\n\t}\n\n\t// Status\n\tnamespace.Status = genruntime.ClonePointerToString(source.Status)\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\tnamespace.SystemData = &systemDatum\n\t} else {\n\t\tnamespace.SystemData = nil\n\t}\n\n\t// Tags\n\tnamespace.Tags = genruntime.CloneMapOfStringToString(source.Tags)\n\n\t// Type\n\tnamespace.Type = genruntime.ClonePointerToString(source.Type)\n\n\t// UpdatedAt\n\tnamespace.UpdatedAt = genruntime.ClonePointerToString(source.UpdatedAt)\n\n\t// ZoneRedundant\n\tif source.ZoneRedundant != nil {\n\t\tzoneRedundant := *source.ZoneRedundant\n\t\tnamespace.ZoneRedundant = &zoneRedundant\n\t} else {\n\t\tnamespace.ZoneRedundant = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "a37e40aba9e5ee3dfff45dad36e571b2", "score": "0.49342453", "text": "func (parameters *UrlPathMatchConditionParameters) Initialize_From_UrlPathMatchConditionParameters_STATUS(source *UrlPathMatchConditionParameters_STATUS) error {\n\n\t// MatchValues\n\tparameters.MatchValues = genruntime.CloneSliceOfString(source.MatchValues)\n\n\t// NegateCondition\n\tif source.NegateCondition != nil {\n\t\tnegateCondition := *source.NegateCondition\n\t\tparameters.NegateCondition = &negateCondition\n\t} else {\n\t\tparameters.NegateCondition = nil\n\t}\n\n\t// Operator\n\tif source.Operator != nil {\n\t\toperator := UrlPathMatchConditionParameters_Operator(*source.Operator)\n\t\tparameters.Operator = &operator\n\t} else {\n\t\tparameters.Operator = nil\n\t}\n\n\t// Transforms\n\tif source.Transforms != nil {\n\t\ttransformList := make([]Transform, len(source.Transforms))\n\t\tfor transformIndex, transformItem := range source.Transforms {\n\t\t\t// Shadow the loop variable to avoid aliasing\n\t\t\ttransformItem := transformItem\n\t\t\ttransform := Transform(transformItem)\n\t\t\ttransformList[transformIndex] = transform\n\t\t}\n\t\tparameters.Transforms = transformList\n\t} else {\n\t\tparameters.Transforms = nil\n\t}\n\n\t// TypeName\n\tif source.TypeName != nil {\n\t\ttypeName := UrlPathMatchConditionParameters_TypeName(*source.TypeName)\n\t\tparameters.TypeName = &typeName\n\t} else {\n\t\tparameters.TypeName = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "8be17d65c3eb32b795183e7c39c4c028", "score": "0.49330172", "text": "func (cfg *Config) RecordStatus(status string) {\n\tcfg.mu.Lock()\n\tdefer cfg.mu.Unlock()\n\n\tif cfg.Status == nil {\n\t\tcfg.Status = &Status{}\n\t}\n\tcfg.Status.ClusterStatusCurrent = status\n\tswitch status {\n\tcase ClusterStatusDELETEDORNOTEXIST:\n\t\tcfg.Status.Up = false\n\tcase aws_eks.ClusterStatusActive:\n\t\tcfg.Status.Up = true\n\t}\n\n\tsv := ClusterStatus{Time: time.Now(), Status: status}\n\tn := len(cfg.Status.ClusterStatus)\n\tif n == 0 {\n\t\tcfg.Status.ClusterStatus = []ClusterStatus{sv}\n\t\tcfg.unsafeSync()\n\t\treturn\n\t}\n\n\tcopied := make([]ClusterStatus, n+1)\n\tcopy(copied[1:], cfg.Status.ClusterStatus)\n\tcopied[0] = sv\n\tcfg.Status.ClusterStatus = copied\n\tcfg.unsafeSync()\n}", "title": "" }, { "docid": "8b4e0f77750c6f627feace7331d7dd4f", "score": "0.4932301", "text": "func new(c codes.Code, message I18nMessageID) *Status {\n\treturn &Status{code: int32(c), message: message}\n}", "title": "" }, { "docid": "b53bfe6078c3bda4c464182af071f35d", "score": "0.4923431", "text": "func (s *DescribeEdgeConfigurationOutput) SetSyncStatus(v string) *DescribeEdgeConfigurationOutput {\n\ts.SyncStatus = &v\n\treturn s\n}", "title": "" }, { "docid": "1db4c50f7c9e2bbed9929ad935efc4cb", "score": "0.49134913", "text": "func (configuration *CacheConfiguration) Initialize_From_CacheConfiguration_STATUS(source *CacheConfiguration_STATUS) error {\n\n\t// CacheBehavior\n\tif source.CacheBehavior != nil {\n\t\tcacheBehavior := CacheConfiguration_CacheBehavior(*source.CacheBehavior)\n\t\tconfiguration.CacheBehavior = &cacheBehavior\n\t} else {\n\t\tconfiguration.CacheBehavior = nil\n\t}\n\n\t// CacheDuration\n\tconfiguration.CacheDuration = genruntime.ClonePointerToString(source.CacheDuration)\n\n\t// IsCompressionEnabled\n\tif source.IsCompressionEnabled != nil {\n\t\tisCompressionEnabled := CacheConfiguration_IsCompressionEnabled(*source.IsCompressionEnabled)\n\t\tconfiguration.IsCompressionEnabled = &isCompressionEnabled\n\t} else {\n\t\tconfiguration.IsCompressionEnabled = nil\n\t}\n\n\t// QueryParameters\n\tconfiguration.QueryParameters = genruntime.ClonePointerToString(source.QueryParameters)\n\n\t// QueryStringCachingBehavior\n\tif source.QueryStringCachingBehavior != nil {\n\t\tqueryStringCachingBehavior := CacheConfiguration_QueryStringCachingBehavior(*source.QueryStringCachingBehavior)\n\t\tconfiguration.QueryStringCachingBehavior = &queryStringCachingBehavior\n\t} else {\n\t\tconfiguration.QueryStringCachingBehavior = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "bcfccc662fd4095ae3ea5b88c90c24ff", "score": "0.49011728", "text": "func (a *Action) CreateStatus(status string) *ActionStatus {\n\treturn &ActionStatus{\n\t\taction: a,\n\t\tActionID: a.Name,\n\t\tDeviceID: a.GetDevice().ID,\n\t\tStatus: status,\n\t}\n}", "title": "" }, { "docid": "5fb1bbd001f64a31b3eb4afc53f8cccd", "score": "0.4898658", "text": "func (parameters *RequestUriMatchConditionParameters) Initialize_From_RequestUriMatchConditionParameters_STATUS(source *RequestUriMatchConditionParameters_STATUS) error {\n\n\t// MatchValues\n\tparameters.MatchValues = genruntime.CloneSliceOfString(source.MatchValues)\n\n\t// NegateCondition\n\tif source.NegateCondition != nil {\n\t\tnegateCondition := *source.NegateCondition\n\t\tparameters.NegateCondition = &negateCondition\n\t} else {\n\t\tparameters.NegateCondition = nil\n\t}\n\n\t// Operator\n\tif source.Operator != nil {\n\t\toperator := RequestUriMatchConditionParameters_Operator(*source.Operator)\n\t\tparameters.Operator = &operator\n\t} else {\n\t\tparameters.Operator = nil\n\t}\n\n\t// Transforms\n\tif source.Transforms != nil {\n\t\ttransformList := make([]Transform, len(source.Transforms))\n\t\tfor transformIndex, transformItem := range source.Transforms {\n\t\t\t// Shadow the loop variable to avoid aliasing\n\t\t\ttransformItem := transformItem\n\t\t\ttransform := Transform(transformItem)\n\t\t\ttransformList[transformIndex] = transform\n\t\t}\n\t\tparameters.Transforms = transformList\n\t} else {\n\t\tparameters.Transforms = nil\n\t}\n\n\t// TypeName\n\tif source.TypeName != nil {\n\t\ttypeName := RequestUriMatchConditionParameters_TypeName(*source.TypeName)\n\t\tparameters.TypeName = &typeName\n\t} else {\n\t\tparameters.TypeName = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "ac7928d81b96b672f2e8988abd5e0552", "score": "0.48963204", "text": "func initializeResourceStatus(ac appcontext.AppContext, acStatus appcontext.AppContextStatus) error {\n\tstatusPending := resourcestatus.ResourceStatus{\n\t\tStatus: resourcestatus.RsyncStatusEnum.Pending,\n\t}\n\tstatusDeleted := resourcestatus.ResourceStatus{\n\t\tStatus: resourcestatus.RsyncStatusEnum.Deleted,\n\t}\n\n\tappsOrder, err := ac.GetAppInstruction(\"order\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tvar appList map[string][]string\n\tjson.Unmarshal([]byte(appsOrder.(string)), &appList)\n\n\tfor _, app := range appList[\"apporder\"] {\n\t\tclusterNames, err := ac.GetClusterNames(app)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor k := 0; k < len(clusterNames); k++ {\n\t\t\tcluster := clusterNames[k]\n\t\t\tresorder, err := ac.GetResourceInstruction(app, cluster, \"order\")\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tvar aov map[string][]string\n\t\t\tjson.Unmarshal([]byte(resorder.(string)), &aov)\n\t\t\tfor _, res := range aov[\"resorder\"] {\n\t\t\t\trh, err := ac.GetResourceHandle(app, cluster, res)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tsh, err := ac.GetLevelHandle(rh, \"status\")\n\t\t\t\tif acStatus.Status == appcontext.AppContextStatusEnum.Instantiating {\n\t\t\t\t\tif sh == nil {\n\t\t\t\t\t\t_, err = ac.AddLevelValue(rh, \"status\", statusPending)\n\t\t\t\t\t} else {\n\t\t\t\t\t\terr = ac.UpdateStatusValue(sh, statusPending)\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\t\t\t\t} else if acStatus.Status == appcontext.AppContextStatusEnum.Terminating {\n\t\t\t\t\tif sh == nil {\n\t\t\t\t\t\t_, err = ac.AddLevelValue(rh, \"status\", statusDeleted)\n\t\t\t\t\t} else {\n\t\t\t\t\t\ts, err := ac.GetValue(sh)\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\trStatus := resourcestatus.ResourceStatus{}\n\t\t\t\t\t\tjs, _ := json.Marshal(s)\n\t\t\t\t\t\tjson.Unmarshal(js, &rStatus)\n\t\t\t\t\t\tif rStatus.Status == resourcestatus.RsyncStatusEnum.Applied {\n\t\t\t\t\t\t\terr = ac.UpdateStatusValue(sh, statusPending)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\terr = ac.UpdateStatusValue(sh, statusDeleted)\n\t\t\t\t\t\t}\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}\n\t\t\t\t} else {\n\t\t\t\t\treturn pkgerrors.Errorf(\"Error intializing AppContext Resource Statuses\")\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8812b248551522a62fed2c52cbd5577a", "score": "0.48956126", "text": "func (snapshot *Snapshot_Spec) Initialize_From_Snapshot_STATUS(source *Snapshot_STATUS) error {\n\n\t// CreationData\n\tif source.CreationData != nil {\n\t\tvar creationDatum CreationData\n\t\terr := creationDatum.Initialize_From_CreationData_STATUS(source.CreationData)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling Initialize_From_CreationData_STATUS() to populate field CreationData\")\n\t\t}\n\t\tsnapshot.CreationData = &creationDatum\n\t} else {\n\t\tsnapshot.CreationData = nil\n\t}\n\n\t// DiskAccessReference\n\tif source.DiskAccessId != nil {\n\t\tdiskAccessReference := genruntime.CreateResourceReferenceFromARMID(*source.DiskAccessId)\n\t\tsnapshot.DiskAccessReference = &diskAccessReference\n\t} else {\n\t\tsnapshot.DiskAccessReference = nil\n\t}\n\n\t// DiskSizeGB\n\tsnapshot.DiskSizeGB = genruntime.ClonePointerToInt(source.DiskSizeGB)\n\n\t// DiskState\n\tif source.DiskState != nil {\n\t\tdiskState := DiskState(*source.DiskState)\n\t\tsnapshot.DiskState = &diskState\n\t} else {\n\t\tsnapshot.DiskState = nil\n\t}\n\n\t// Encryption\n\tif source.Encryption != nil {\n\t\tvar encryption Encryption\n\t\terr := encryption.Initialize_From_Encryption_STATUS(source.Encryption)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling Initialize_From_Encryption_STATUS() to populate field Encryption\")\n\t\t}\n\t\tsnapshot.Encryption = &encryption\n\t} else {\n\t\tsnapshot.Encryption = nil\n\t}\n\n\t// EncryptionSettingsCollection\n\tif source.EncryptionSettingsCollection != nil {\n\t\tvar encryptionSettingsCollection EncryptionSettingsCollection\n\t\terr := encryptionSettingsCollection.Initialize_From_EncryptionSettingsCollection_STATUS(source.EncryptionSettingsCollection)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling Initialize_From_EncryptionSettingsCollection_STATUS() to populate field EncryptionSettingsCollection\")\n\t\t}\n\t\tsnapshot.EncryptionSettingsCollection = &encryptionSettingsCollection\n\t} else {\n\t\tsnapshot.EncryptionSettingsCollection = nil\n\t}\n\n\t// ExtendedLocation\n\tif source.ExtendedLocation != nil {\n\t\tvar extendedLocation ExtendedLocation\n\t\terr := extendedLocation.Initialize_From_ExtendedLocation_STATUS(source.ExtendedLocation)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling Initialize_From_ExtendedLocation_STATUS() to populate field ExtendedLocation\")\n\t\t}\n\t\tsnapshot.ExtendedLocation = &extendedLocation\n\t} else {\n\t\tsnapshot.ExtendedLocation = nil\n\t}\n\n\t// HyperVGeneration\n\tif source.HyperVGeneration != nil {\n\t\thyperVGeneration := SnapshotProperties_HyperVGeneration(*source.HyperVGeneration)\n\t\tsnapshot.HyperVGeneration = &hyperVGeneration\n\t} else {\n\t\tsnapshot.HyperVGeneration = nil\n\t}\n\n\t// Incremental\n\tif source.Incremental != nil {\n\t\tincremental := *source.Incremental\n\t\tsnapshot.Incremental = &incremental\n\t} else {\n\t\tsnapshot.Incremental = nil\n\t}\n\n\t// Location\n\tsnapshot.Location = genruntime.ClonePointerToString(source.Location)\n\n\t// NetworkAccessPolicy\n\tif source.NetworkAccessPolicy != nil {\n\t\tnetworkAccessPolicy := NetworkAccessPolicy(*source.NetworkAccessPolicy)\n\t\tsnapshot.NetworkAccessPolicy = &networkAccessPolicy\n\t} else {\n\t\tsnapshot.NetworkAccessPolicy = nil\n\t}\n\n\t// OsType\n\tif source.OsType != nil {\n\t\tosType := SnapshotProperties_OsType(*source.OsType)\n\t\tsnapshot.OsType = &osType\n\t} else {\n\t\tsnapshot.OsType = nil\n\t}\n\n\t// PurchasePlan\n\tif source.PurchasePlan != nil {\n\t\tvar purchasePlan PurchasePlan\n\t\terr := purchasePlan.Initialize_From_PurchasePlan_STATUS(source.PurchasePlan)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling Initialize_From_PurchasePlan_STATUS() to populate field PurchasePlan\")\n\t\t}\n\t\tsnapshot.PurchasePlan = &purchasePlan\n\t} else {\n\t\tsnapshot.PurchasePlan = nil\n\t}\n\n\t// Sku\n\tif source.Sku != nil {\n\t\tvar sku SnapshotSku\n\t\terr := sku.Initialize_From_SnapshotSku_STATUS(source.Sku)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling Initialize_From_SnapshotSku_STATUS() to populate field Sku\")\n\t\t}\n\t\tsnapshot.Sku = &sku\n\t} else {\n\t\tsnapshot.Sku = nil\n\t}\n\n\t// Tags\n\tsnapshot.Tags = genruntime.CloneMapOfStringToString(source.Tags)\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "0f2dc52c239f9ce25b095737e86359a4", "score": "0.48953766", "text": "func (setting *Servers_AuditingSetting_Spec) Initialize_From_Servers_AuditingSetting_STATUS(source *Servers_AuditingSetting_STATUS) error {\n\n\t// AuditActionsAndGroups\n\tsetting.AuditActionsAndGroups = genruntime.CloneSliceOfString(source.AuditActionsAndGroups)\n\n\t// IsAzureMonitorTargetEnabled\n\tif source.IsAzureMonitorTargetEnabled != nil {\n\t\tisAzureMonitorTargetEnabled := *source.IsAzureMonitorTargetEnabled\n\t\tsetting.IsAzureMonitorTargetEnabled = &isAzureMonitorTargetEnabled\n\t} else {\n\t\tsetting.IsAzureMonitorTargetEnabled = nil\n\t}\n\n\t// IsDevopsAuditEnabled\n\tif source.IsDevopsAuditEnabled != nil {\n\t\tisDevopsAuditEnabled := *source.IsDevopsAuditEnabled\n\t\tsetting.IsDevopsAuditEnabled = &isDevopsAuditEnabled\n\t} else {\n\t\tsetting.IsDevopsAuditEnabled = nil\n\t}\n\n\t// IsManagedIdentityInUse\n\tif source.IsManagedIdentityInUse != nil {\n\t\tisManagedIdentityInUse := *source.IsManagedIdentityInUse\n\t\tsetting.IsManagedIdentityInUse = &isManagedIdentityInUse\n\t} else {\n\t\tsetting.IsManagedIdentityInUse = nil\n\t}\n\n\t// IsStorageSecondaryKeyInUse\n\tif source.IsStorageSecondaryKeyInUse != nil {\n\t\tisStorageSecondaryKeyInUse := *source.IsStorageSecondaryKeyInUse\n\t\tsetting.IsStorageSecondaryKeyInUse = &isStorageSecondaryKeyInUse\n\t} else {\n\t\tsetting.IsStorageSecondaryKeyInUse = nil\n\t}\n\n\t// QueueDelayMs\n\tsetting.QueueDelayMs = genruntime.ClonePointerToInt(source.QueueDelayMs)\n\n\t// RetentionDays\n\tsetting.RetentionDays = genruntime.ClonePointerToInt(source.RetentionDays)\n\n\t// State\n\tif source.State != nil {\n\t\tstate := ServerBlobAuditingPolicyProperties_State(*source.State)\n\t\tsetting.State = &state\n\t} else {\n\t\tsetting.State = nil\n\t}\n\n\t// StorageAccountSubscriptionId\n\tif source.StorageAccountSubscriptionId != nil {\n\t\tstorageAccountSubscriptionId := *source.StorageAccountSubscriptionId\n\t\tsetting.StorageAccountSubscriptionId = &storageAccountSubscriptionId\n\t} else {\n\t\tsetting.StorageAccountSubscriptionId = nil\n\t}\n\n\t// StorageEndpoint\n\tsetting.StorageEndpoint = genruntime.ClonePointerToString(source.StorageEndpoint)\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "a47df7ddab268d0037f37566d5c16e5e", "score": "0.4891318", "text": "func StartStatusUpdate(c client.Client, instance *mcov1beta2.MultiClusterObservability) {\n\tif !updateStatusIsRunnning {\n\t\tgo func() {\n\t\t\tupdateStatusIsRunnning = true\n\t\t\t// defer close(stopStatusUpdate)\n\t\t\t// defer close(requeueStatusUpdate)\n\t\t\tfor {\n\t\t\t\tselect {\n\t\t\t\tcase <-stopStatusUpdate:\n\t\t\t\t\tupdateStatusIsRunnning = false\n\t\t\t\t\tclose(stopCheckReady)\n\t\t\t\t\tlog.V(1).Info(\"status update goroutine is stopped.\")\n\t\t\t\t\treturn\n\t\t\t\tcase <-requeueStatusUpdate:\n\t\t\t\t\tlog.V(1).Info(\"status update goroutine is triggered.\")\n\t\t\t\t\tupdateStatus(c)\n\t\t\t\t\tif updateReadyStatusIsRunnning && checkReadyStatus(c, instance) {\n\t\t\t\t\t\tlog.V(1).Info(\"send singal to stop status check ready goroutine because MCO status is ready\")\n\t\t\t\t\t\tstopCheckReady <- struct{}{}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\t\tif !updateReadyStatusIsRunnning {\n\t\t\t// init the stop ready check channel\n\t\t\tstopCheckReady = make(chan struct{})\n\t\t\tgo func() {\n\t\t\t\tupdateReadyStatusIsRunnning = true\n\t\t\t\t// defer close(stopCheckReady)\n\t\t\t\tfor {\n\t\t\t\t\tselect {\n\t\t\t\t\tcase <-stopCheckReady:\n\t\t\t\t\t\tupdateReadyStatusIsRunnning = false\n\t\t\t\t\t\tlog.V(1).Info(\"check status ready goroutine is stopped.\")\n\t\t\t\t\t\treturn\n\t\t\t\t\tcase <-time.After(2 * time.Second):\n\t\t\t\t\t\tlog.V(1).Info(\"check status ready goroutine is triggered.\")\n\t\t\t\t\t\tif checkReadyStatus(c, instance) {\n\t\t\t\t\t\t\trequeueStatusUpdate <- struct{}{}\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}", "title": "" }, { "docid": "c65e11748ffcffdc734a62659077868b", "score": "0.48882613", "text": "func (parameters *RequestBodyMatchConditionParameters) Initialize_From_RequestBodyMatchConditionParameters_STATUS(source *RequestBodyMatchConditionParameters_STATUS) error {\n\n\t// MatchValues\n\tparameters.MatchValues = genruntime.CloneSliceOfString(source.MatchValues)\n\n\t// NegateCondition\n\tif source.NegateCondition != nil {\n\t\tnegateCondition := *source.NegateCondition\n\t\tparameters.NegateCondition = &negateCondition\n\t} else {\n\t\tparameters.NegateCondition = nil\n\t}\n\n\t// Operator\n\tif source.Operator != nil {\n\t\toperator := RequestBodyMatchConditionParameters_Operator(*source.Operator)\n\t\tparameters.Operator = &operator\n\t} else {\n\t\tparameters.Operator = nil\n\t}\n\n\t// Transforms\n\tif source.Transforms != nil {\n\t\ttransformList := make([]Transform, len(source.Transforms))\n\t\tfor transformIndex, transformItem := range source.Transforms {\n\t\t\t// Shadow the loop variable to avoid aliasing\n\t\t\ttransformItem := transformItem\n\t\t\ttransform := Transform(transformItem)\n\t\t\ttransformList[transformIndex] = transform\n\t\t}\n\t\tparameters.Transforms = transformList\n\t} else {\n\t\tparameters.Transforms = nil\n\t}\n\n\t// TypeName\n\tif source.TypeName != nil {\n\t\ttypeName := RequestBodyMatchConditionParameters_TypeName(*source.TypeName)\n\t\tparameters.TypeName = &typeName\n\t} else {\n\t\tparameters.TypeName = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "a45c239136c0499c5aefc3f5ef32b530", "score": "0.48835737", "text": "func NewManagedAppDiagnosticStatus()(*ManagedAppDiagnosticStatus) {\n m := &ManagedAppDiagnosticStatus{\n }\n m.SetAdditionalData(make(map[string]interface{}));\n return m\n}", "title": "" }, { "docid": "14b2791f44bb3759ba6c9f311ad96dcd", "score": "0.4880621", "text": "func NewRpcStatusWithDefaults() *RpcStatus {\n\tthis := RpcStatus{}\n\treturn &this\n}", "title": "" }, { "docid": "f8482a4bbd9818942cd1bb7fbb186035", "score": "0.48763445", "text": "func (record *MxRecord) Initialize_From_MxRecord_STATUS(source *MxRecord_STATUS) error {\n\n\t// Exchange\n\trecord.Exchange = genruntime.ClonePointerToString(source.Exchange)\n\n\t// Preference\n\trecord.Preference = genruntime.ClonePointerToInt(source.Preference)\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "d1f1a571e4c53a33f15f92e57ba5d4f9", "score": "0.48754483", "text": "func NewStatusFromStr(st string) Status {\n\tswitch st {\n\tcase statusString[StatusWaitDeposit]:\n\t\treturn StatusWaitDeposit\n\tcase statusString[StatusWaitSend]:\n\t\treturn StatusWaitSend\n\tcase statusString[StatusWaitConfirm]:\n\t\treturn StatusWaitConfirm\n\tcase statusString[StatusDone]:\n\t\treturn StatusDone\n\tdefault:\n\t\treturn StatusUnknow\n\t}\n}", "title": "" }, { "docid": "641da7204fdfcac88568a57c8972755a", "score": "0.4873423", "text": "func (setting *ServersAuditingSetting) NewEmptyStatus() genruntime.ConvertibleStatus {\n\treturn &Servers_AuditingSetting_STATUS{}\n}", "title": "" }, { "docid": "0a27719d8658b2f93c4ed7e5833d9121", "score": "0.48676416", "text": "func (in *StatusSyncList) DeepCopy() *StatusSyncList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(StatusSyncList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "5bf1443e7f6cd8c2f86eb7d26e65d69e", "score": "0.48642877", "text": "func (properties *KeyVaultProperties) Initialize_From_KeyVaultProperties_STATUS(source *KeyVaultProperties_STATUS) error {\n\n\t// Identity\n\tif source.Identity != nil {\n\t\tvar identity UserAssignedIdentityProperties\n\t\terr := identity.Initialize_From_UserAssignedIdentityProperties_STATUS(source.Identity)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling Initialize_From_UserAssignedIdentityProperties_STATUS() 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// KeyName\n\tproperties.KeyName = genruntime.ClonePointerToString(source.KeyName)\n\n\t// KeyVaultUri\n\tproperties.KeyVaultUri = genruntime.ClonePointerToString(source.KeyVaultUri)\n\n\t// KeyVersion\n\tproperties.KeyVersion = genruntime.ClonePointerToString(source.KeyVersion)\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "6c565148397f1488a69ddef6c1416156", "score": "0.48626155", "text": "func NewDefaultStatusCall(deployID string) *DefaultStatusCall {\n\treturn &DefaultStatusCall{\n\t\tEndpoint: NewDefaultEndpoint(\"GET\"),\n\n\t\tdeployID: deployID,\n\t}\n}", "title": "" }, { "docid": "135eae30f5d769d55cb9a4a3d72a6c5f", "score": "0.48592016", "text": "func (cuo *ConfigurationUpdateOne) AddStatus(s schema.Status) *ConfigurationUpdateOne {\n\tcuo.mutation.AddStatus(s)\n\treturn cuo\n}", "title": "" }, { "docid": "5efc71d5f454d2047276c8f58f018166", "score": "0.4845445", "text": "func (parameters *UrlRedirectActionParameters) Initialize_From_UrlRedirectActionParameters_STATUS(source *UrlRedirectActionParameters_STATUS) error {\n\n\t// CustomFragment\n\tparameters.CustomFragment = genruntime.ClonePointerToString(source.CustomFragment)\n\n\t// CustomHostname\n\tparameters.CustomHostname = genruntime.ClonePointerToString(source.CustomHostname)\n\n\t// CustomPath\n\tparameters.CustomPath = genruntime.ClonePointerToString(source.CustomPath)\n\n\t// CustomQueryString\n\tparameters.CustomQueryString = genruntime.ClonePointerToString(source.CustomQueryString)\n\n\t// DestinationProtocol\n\tif source.DestinationProtocol != nil {\n\t\tdestinationProtocol := UrlRedirectActionParameters_DestinationProtocol(*source.DestinationProtocol)\n\t\tparameters.DestinationProtocol = &destinationProtocol\n\t} else {\n\t\tparameters.DestinationProtocol = nil\n\t}\n\n\t// RedirectType\n\tif source.RedirectType != nil {\n\t\tredirectType := UrlRedirectActionParameters_RedirectType(*source.RedirectType)\n\t\tparameters.RedirectType = &redirectType\n\t} else {\n\t\tparameters.RedirectType = nil\n\t}\n\n\t// TypeName\n\tif source.TypeName != nil {\n\t\ttypeName := UrlRedirectActionParameters_TypeName(*source.TypeName)\n\t\tparameters.TypeName = &typeName\n\t} else {\n\t\tparameters.TypeName = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "1c113995857895e7c993ffb196482f25", "score": "0.48410252", "text": "func (rm *resourceManager) setStatusDefaults(\n\tko *svcapitypes.ClientVPNEndpoint,\n) {\n\tif ko.Status.ACKResourceMetadata == nil {\n\t\tko.Status.ACKResourceMetadata = &ackv1alpha1.ResourceMetadata{}\n\t}\n\tif ko.Status.ACKResourceMetadata.OwnerAccountID == nil {\n\t\tko.Status.ACKResourceMetadata.OwnerAccountID = &rm.awsAccountID\n\t}\n\tif ko.Status.Conditions == nil {\n\t\tko.Status.Conditions = []*ackv1alpha1.Condition{}\n\t}\n}", "title": "" }, { "docid": "6debb2f218120b87a2a6805aee06dd20", "score": "0.48304257", "text": "func (condition *DeliveryRuleCondition) Initialize_From_DeliveryRuleCondition_STATUS(source *DeliveryRuleCondition_STATUS) error {\n\n\t// ClientPort\n\tif source.ClientPort != nil {\n\t\tvar clientPort DeliveryRuleClientPortCondition\n\t\terr := clientPort.Initialize_From_DeliveryRuleClientPortCondition_STATUS(source.ClientPort)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling Initialize_From_DeliveryRuleClientPortCondition_STATUS() to populate field ClientPort\")\n\t\t}\n\t\tcondition.ClientPort = &clientPort\n\t} else {\n\t\tcondition.ClientPort = nil\n\t}\n\n\t// Cookies\n\tif source.Cookies != nil {\n\t\tvar cookie DeliveryRuleCookiesCondition\n\t\terr := cookie.Initialize_From_DeliveryRuleCookiesCondition_STATUS(source.Cookies)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling Initialize_From_DeliveryRuleCookiesCondition_STATUS() to populate field Cookies\")\n\t\t}\n\t\tcondition.Cookies = &cookie\n\t} else {\n\t\tcondition.Cookies = nil\n\t}\n\n\t// HostName\n\tif source.HostName != nil {\n\t\tvar hostName DeliveryRuleHostNameCondition\n\t\terr := hostName.Initialize_From_DeliveryRuleHostNameCondition_STATUS(source.HostName)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling Initialize_From_DeliveryRuleHostNameCondition_STATUS() to populate field HostName\")\n\t\t}\n\t\tcondition.HostName = &hostName\n\t} else {\n\t\tcondition.HostName = nil\n\t}\n\n\t// HttpVersion\n\tif source.HttpVersion != nil {\n\t\tvar httpVersion DeliveryRuleHttpVersionCondition\n\t\terr := httpVersion.Initialize_From_DeliveryRuleHttpVersionCondition_STATUS(source.HttpVersion)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling Initialize_From_DeliveryRuleHttpVersionCondition_STATUS() to populate field HttpVersion\")\n\t\t}\n\t\tcondition.HttpVersion = &httpVersion\n\t} else {\n\t\tcondition.HttpVersion = nil\n\t}\n\n\t// IsDevice\n\tif source.IsDevice != nil {\n\t\tvar isDevice DeliveryRuleIsDeviceCondition\n\t\terr := isDevice.Initialize_From_DeliveryRuleIsDeviceCondition_STATUS(source.IsDevice)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling Initialize_From_DeliveryRuleIsDeviceCondition_STATUS() to populate field IsDevice\")\n\t\t}\n\t\tcondition.IsDevice = &isDevice\n\t} else {\n\t\tcondition.IsDevice = nil\n\t}\n\n\t// PostArgs\n\tif source.PostArgs != nil {\n\t\tvar postArg DeliveryRulePostArgsCondition\n\t\terr := postArg.Initialize_From_DeliveryRulePostArgsCondition_STATUS(source.PostArgs)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling Initialize_From_DeliveryRulePostArgsCondition_STATUS() to populate field PostArgs\")\n\t\t}\n\t\tcondition.PostArgs = &postArg\n\t} else {\n\t\tcondition.PostArgs = nil\n\t}\n\n\t// QueryString\n\tif source.QueryString != nil {\n\t\tvar queryString DeliveryRuleQueryStringCondition\n\t\terr := queryString.Initialize_From_DeliveryRuleQueryStringCondition_STATUS(source.QueryString)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling Initialize_From_DeliveryRuleQueryStringCondition_STATUS() to populate field QueryString\")\n\t\t}\n\t\tcondition.QueryString = &queryString\n\t} else {\n\t\tcondition.QueryString = nil\n\t}\n\n\t// RemoteAddress\n\tif source.RemoteAddress != nil {\n\t\tvar remoteAddress DeliveryRuleRemoteAddressCondition\n\t\terr := remoteAddress.Initialize_From_DeliveryRuleRemoteAddressCondition_STATUS(source.RemoteAddress)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling Initialize_From_DeliveryRuleRemoteAddressCondition_STATUS() to populate field RemoteAddress\")\n\t\t}\n\t\tcondition.RemoteAddress = &remoteAddress\n\t} else {\n\t\tcondition.RemoteAddress = nil\n\t}\n\n\t// RequestBody\n\tif source.RequestBody != nil {\n\t\tvar requestBody DeliveryRuleRequestBodyCondition\n\t\terr := requestBody.Initialize_From_DeliveryRuleRequestBodyCondition_STATUS(source.RequestBody)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling Initialize_From_DeliveryRuleRequestBodyCondition_STATUS() to populate field RequestBody\")\n\t\t}\n\t\tcondition.RequestBody = &requestBody\n\t} else {\n\t\tcondition.RequestBody = nil\n\t}\n\n\t// RequestHeader\n\tif source.RequestHeader != nil {\n\t\tvar requestHeader DeliveryRuleRequestHeaderCondition\n\t\terr := requestHeader.Initialize_From_DeliveryRuleRequestHeaderCondition_STATUS(source.RequestHeader)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling Initialize_From_DeliveryRuleRequestHeaderCondition_STATUS() to populate field RequestHeader\")\n\t\t}\n\t\tcondition.RequestHeader = &requestHeader\n\t} else {\n\t\tcondition.RequestHeader = nil\n\t}\n\n\t// RequestMethod\n\tif source.RequestMethod != nil {\n\t\tvar requestMethod DeliveryRuleRequestMethodCondition\n\t\terr := requestMethod.Initialize_From_DeliveryRuleRequestMethodCondition_STATUS(source.RequestMethod)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling Initialize_From_DeliveryRuleRequestMethodCondition_STATUS() to populate field RequestMethod\")\n\t\t}\n\t\tcondition.RequestMethod = &requestMethod\n\t} else {\n\t\tcondition.RequestMethod = nil\n\t}\n\n\t// RequestScheme\n\tif source.RequestScheme != nil {\n\t\tvar requestScheme DeliveryRuleRequestSchemeCondition\n\t\terr := requestScheme.Initialize_From_DeliveryRuleRequestSchemeCondition_STATUS(source.RequestScheme)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling Initialize_From_DeliveryRuleRequestSchemeCondition_STATUS() to populate field RequestScheme\")\n\t\t}\n\t\tcondition.RequestScheme = &requestScheme\n\t} else {\n\t\tcondition.RequestScheme = nil\n\t}\n\n\t// RequestUri\n\tif source.RequestUri != nil {\n\t\tvar requestUri DeliveryRuleRequestUriCondition\n\t\terr := requestUri.Initialize_From_DeliveryRuleRequestUriCondition_STATUS(source.RequestUri)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling Initialize_From_DeliveryRuleRequestUriCondition_STATUS() to populate field RequestUri\")\n\t\t}\n\t\tcondition.RequestUri = &requestUri\n\t} else {\n\t\tcondition.RequestUri = nil\n\t}\n\n\t// ServerPort\n\tif source.ServerPort != nil {\n\t\tvar serverPort DeliveryRuleServerPortCondition\n\t\terr := serverPort.Initialize_From_DeliveryRuleServerPortCondition_STATUS(source.ServerPort)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling Initialize_From_DeliveryRuleServerPortCondition_STATUS() to populate field ServerPort\")\n\t\t}\n\t\tcondition.ServerPort = &serverPort\n\t} else {\n\t\tcondition.ServerPort = nil\n\t}\n\n\t// SocketAddr\n\tif source.SocketAddr != nil {\n\t\tvar socketAddr DeliveryRuleSocketAddrCondition\n\t\terr := socketAddr.Initialize_From_DeliveryRuleSocketAddrCondition_STATUS(source.SocketAddr)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling Initialize_From_DeliveryRuleSocketAddrCondition_STATUS() to populate field SocketAddr\")\n\t\t}\n\t\tcondition.SocketAddr = &socketAddr\n\t} else {\n\t\tcondition.SocketAddr = nil\n\t}\n\n\t// SslProtocol\n\tif source.SslProtocol != nil {\n\t\tvar sslProtocol DeliveryRuleSslProtocolCondition\n\t\terr := sslProtocol.Initialize_From_DeliveryRuleSslProtocolCondition_STATUS(source.SslProtocol)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling Initialize_From_DeliveryRuleSslProtocolCondition_STATUS() to populate field SslProtocol\")\n\t\t}\n\t\tcondition.SslProtocol = &sslProtocol\n\t} else {\n\t\tcondition.SslProtocol = nil\n\t}\n\n\t// UrlFileExtension\n\tif source.UrlFileExtension != nil {\n\t\tvar urlFileExtension DeliveryRuleUrlFileExtensionCondition\n\t\terr := urlFileExtension.Initialize_From_DeliveryRuleUrlFileExtensionCondition_STATUS(source.UrlFileExtension)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling Initialize_From_DeliveryRuleUrlFileExtensionCondition_STATUS() to populate field UrlFileExtension\")\n\t\t}\n\t\tcondition.UrlFileExtension = &urlFileExtension\n\t} else {\n\t\tcondition.UrlFileExtension = nil\n\t}\n\n\t// UrlFileName\n\tif source.UrlFileName != nil {\n\t\tvar urlFileName DeliveryRuleUrlFileNameCondition\n\t\terr := urlFileName.Initialize_From_DeliveryRuleUrlFileNameCondition_STATUS(source.UrlFileName)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling Initialize_From_DeliveryRuleUrlFileNameCondition_STATUS() to populate field UrlFileName\")\n\t\t}\n\t\tcondition.UrlFileName = &urlFileName\n\t} else {\n\t\tcondition.UrlFileName = nil\n\t}\n\n\t// UrlPath\n\tif source.UrlPath != nil {\n\t\tvar urlPath DeliveryRuleUrlPathCondition\n\t\terr := urlPath.Initialize_From_DeliveryRuleUrlPathCondition_STATUS(source.UrlPath)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling Initialize_From_DeliveryRuleUrlPathCondition_STATUS() to populate field UrlPath\")\n\t\t}\n\t\tcondition.UrlPath = &urlPath\n\t} else {\n\t\tcondition.UrlPath = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "7ccbeb2d4fe2707d751d45e7ec16c5ab", "score": "0.48285088", "text": "func (condition *DeliveryRuleHttpVersionCondition) Initialize_From_DeliveryRuleHttpVersionCondition_STATUS(source *DeliveryRuleHttpVersionCondition_STATUS) error {\n\n\t// Name\n\tif source.Name != nil {\n\t\tname := DeliveryRuleHttpVersionCondition_Name(*source.Name)\n\t\tcondition.Name = &name\n\t} else {\n\t\tcondition.Name = nil\n\t}\n\n\t// Parameters\n\tif source.Parameters != nil {\n\t\tvar parameter HttpVersionMatchConditionParameters\n\t\terr := parameter.Initialize_From_HttpVersionMatchConditionParameters_STATUS(source.Parameters)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling Initialize_From_HttpVersionMatchConditionParameters_STATUS() to populate field Parameters\")\n\t\t}\n\t\tcondition.Parameters = &parameter\n\t} else {\n\t\tcondition.Parameters = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "519a560b6a9fa29ceccce4638b449bda", "score": "0.4819052", "text": "func (parameters *RequestMethodMatchConditionParameters) Initialize_From_RequestMethodMatchConditionParameters_STATUS(source *RequestMethodMatchConditionParameters_STATUS) error {\n\n\t// MatchValues\n\tif source.MatchValues != nil {\n\t\tmatchValueList := make([]RequestMethodMatchConditionParameters_MatchValues, len(source.MatchValues))\n\t\tfor matchValueIndex, matchValueItem := range source.MatchValues {\n\t\t\t// Shadow the loop variable to avoid aliasing\n\t\t\tmatchValueItem := matchValueItem\n\t\t\tmatchValue := RequestMethodMatchConditionParameters_MatchValues(matchValueItem)\n\t\t\tmatchValueList[matchValueIndex] = matchValue\n\t\t}\n\t\tparameters.MatchValues = matchValueList\n\t} else {\n\t\tparameters.MatchValues = nil\n\t}\n\n\t// NegateCondition\n\tif source.NegateCondition != nil {\n\t\tnegateCondition := *source.NegateCondition\n\t\tparameters.NegateCondition = &negateCondition\n\t} else {\n\t\tparameters.NegateCondition = nil\n\t}\n\n\t// Operator\n\tif source.Operator != nil {\n\t\toperator := RequestMethodMatchConditionParameters_Operator(*source.Operator)\n\t\tparameters.Operator = &operator\n\t} else {\n\t\tparameters.Operator = nil\n\t}\n\n\t// Transforms\n\tif source.Transforms != nil {\n\t\ttransformList := make([]Transform, len(source.Transforms))\n\t\tfor transformIndex, transformItem := range source.Transforms {\n\t\t\t// Shadow the loop variable to avoid aliasing\n\t\t\ttransformItem := transformItem\n\t\t\ttransform := Transform(transformItem)\n\t\t\ttransformList[transformIndex] = transform\n\t\t}\n\t\tparameters.Transforms = transformList\n\t} else {\n\t\tparameters.Transforms = nil\n\t}\n\n\t// TypeName\n\tif source.TypeName != nil {\n\t\ttypeName := RequestMethodMatchConditionParameters_TypeName(*source.TypeName)\n\t\tparameters.TypeName = &typeName\n\t} else {\n\t\tparameters.TypeName = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "66a9d3bc88d382299996dd922c819074", "score": "0.4815091", "text": "func (parameters *RemoteAddressMatchConditionParameters) Initialize_From_RemoteAddressMatchConditionParameters_STATUS(source *RemoteAddressMatchConditionParameters_STATUS) error {\n\n\t// MatchValues\n\tparameters.MatchValues = genruntime.CloneSliceOfString(source.MatchValues)\n\n\t// NegateCondition\n\tif source.NegateCondition != nil {\n\t\tnegateCondition := *source.NegateCondition\n\t\tparameters.NegateCondition = &negateCondition\n\t} else {\n\t\tparameters.NegateCondition = nil\n\t}\n\n\t// Operator\n\tif source.Operator != nil {\n\t\toperator := RemoteAddressMatchConditionParameters_Operator(*source.Operator)\n\t\tparameters.Operator = &operator\n\t} else {\n\t\tparameters.Operator = nil\n\t}\n\n\t// Transforms\n\tif source.Transforms != nil {\n\t\ttransformList := make([]Transform, len(source.Transforms))\n\t\tfor transformIndex, transformItem := range source.Transforms {\n\t\t\t// Shadow the loop variable to avoid aliasing\n\t\t\ttransformItem := transformItem\n\t\t\ttransform := Transform(transformItem)\n\t\t\ttransformList[transformIndex] = transform\n\t\t}\n\t\tparameters.Transforms = transformList\n\t} else {\n\t\tparameters.Transforms = nil\n\t}\n\n\t// TypeName\n\tif source.TypeName != nil {\n\t\ttypeName := RemoteAddressMatchConditionParameters_TypeName(*source.TypeName)\n\t\tparameters.TypeName = &typeName\n\t} else {\n\t\tparameters.TypeName = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "29ed4cde7f87da1f80e6bd5b2750cb56", "score": "0.4809129", "text": "func (parameters *UrlFileNameMatchConditionParameters) Initialize_From_UrlFileNameMatchConditionParameters_STATUS(source *UrlFileNameMatchConditionParameters_STATUS) error {\n\n\t// MatchValues\n\tparameters.MatchValues = genruntime.CloneSliceOfString(source.MatchValues)\n\n\t// NegateCondition\n\tif source.NegateCondition != nil {\n\t\tnegateCondition := *source.NegateCondition\n\t\tparameters.NegateCondition = &negateCondition\n\t} else {\n\t\tparameters.NegateCondition = nil\n\t}\n\n\t// Operator\n\tif source.Operator != nil {\n\t\toperator := UrlFileNameMatchConditionParameters_Operator(*source.Operator)\n\t\tparameters.Operator = &operator\n\t} else {\n\t\tparameters.Operator = nil\n\t}\n\n\t// Transforms\n\tif source.Transforms != nil {\n\t\ttransformList := make([]Transform, len(source.Transforms))\n\t\tfor transformIndex, transformItem := range source.Transforms {\n\t\t\t// Shadow the loop variable to avoid aliasing\n\t\t\ttransformItem := transformItem\n\t\t\ttransform := Transform(transformItem)\n\t\t\ttransformList[transformIndex] = transform\n\t\t}\n\t\tparameters.Transforms = transformList\n\t} else {\n\t\tparameters.Transforms = nil\n\t}\n\n\t// TypeName\n\tif source.TypeName != nil {\n\t\ttypeName := UrlFileNameMatchConditionParameters_TypeName(*source.TypeName)\n\t\tparameters.TypeName = &typeName\n\t} else {\n\t\tparameters.TypeName = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "acb91b094f92efb6068fca369cfaf8f8", "score": "0.48084304", "text": "func (s *noopPodNetwork) Status(_ context.Context, _ *PropertiesRunning) (*Status, error) {\n\treturn nil, nil\n}", "title": "" } ]
00410598bacaf9316b2c6b889aa96480
GoString 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": "2340118c44d2945bfb594c85950a554b", "score": "0.0", "text": "func (s BillingGroupProperties) GoString() string {\n\treturn s.String()\n}", "title": "" } ]
[ { "docid": "4ef987fe3192563c6dca972fb1a50812", "score": "0.62656575", "text": "func (v *ParamsStruct) String() string {\n\tif v == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\tvar fields [1]string\n\ti := 0\n\tfields[i] = fmt.Sprintf(\"UserUUID: %v\", v.UserUUID)\n\ti++\n\n\treturn fmt.Sprintf(\"ParamsStruct{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" }, { "docid": "242e82a0a19dcbc9b6c9d9c9435dd219", "score": "0.5867492", "text": "func (p Param) String() string {\n\treturn p.name\n}", "title": "" }, { "docid": "7422e92ddcee98e4ae227fd7e12e513f", "score": "0.5856708", "text": "func (s GroupMember) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "01aa6964793db8db3a8d2bb1e94f5a82", "score": "0.57521623", "text": "func (p InvParam) String() string {\n\tswitch p {\n\tcase BytesSize:\n\t\treturn \"BytesSize\"\n\tcase KeysCount:\n\t\treturn \"KeysCount\"\n\t}\n\n\tpanic(\"Unknown InvParam: \" + strconv.Itoa(int(p)))\n}", "title": "" }, { "docid": "2719e5463c4a14b720950dc7b5311de5", "score": "0.5740663", "text": "func (c SandstormApi) String() string {\n\treturn fmt.Sprintf(\"%T(%v)\", c, capnp.Client(c))\n}", "title": "" }, { "docid": "a38e5940fa335dd8c89de4e6f6fe0c13", "score": "0.57184905", "text": "func (p *param) string() string {\n\tres := []byte(p.name + \" \")\n\n\tres = append(res, p.typ()...)\n\n\treturn string(res)\n}", "title": "" }, { "docid": "e988010bbe0a9e1db934209b8b5bcc6f", "score": "0.5679733", "text": "func (v *QueryParamsOptsStruct) String() string {\n\tif v == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\tvar fields [4]string\n\ti := 0\n\tfields[i] = fmt.Sprintf(\"Name: %v\", v.Name)\n\ti++\n\tif v.UserUUID != nil {\n\t\tfields[i] = fmt.Sprintf(\"UserUUID: %v\", *(v.UserUUID))\n\t\ti++\n\t}\n\tif v.AuthUUID != nil {\n\t\tfields[i] = fmt.Sprintf(\"AuthUUID: %v\", *(v.AuthUUID))\n\t\ti++\n\t}\n\tif v.AuthUUID2 != nil {\n\t\tfields[i] = fmt.Sprintf(\"AuthUUID2: %v\", *(v.AuthUUID2))\n\t\ti++\n\t}\n\n\treturn fmt.Sprintf(\"QueryParamsOptsStruct{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" }, { "docid": "8a5a12466c6811f56a7bcda917f55a4a", "score": "0.5655695", "text": "func (s *Systemmember) String() string {\n\tvar builder strings.Builder\n\tbuilder.WriteString(\"Systemmember(\")\n\tbuilder.WriteString(fmt.Sprintf(\"id=%v\", s.ID))\n\tbuilder.WriteString(\", Systemmember_Name=\")\n\tbuilder.WriteString(s.SystemmemberName)\n\tbuilder.WriteString(\", Password=\")\n\tbuilder.WriteString(s.Password)\n\tbuilder.WriteByte(')')\n\treturn builder.String()\n}", "title": "" }, { "docid": "540636a34adb1a7967a6f8d5aa0c8445", "score": "0.5650103", "text": "func (s UpdateParam) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "9a2a32846e9d15057aac9e2f35e87213", "score": "0.5631039", "text": "func String(name, val string) Field {\n\treturn Field(zap.String(name, val))\n}", "title": "" }, { "docid": "1050fda86d17f688f12ea9cf1ca474f4", "score": "0.5628368", "text": "func (s StringParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "cfc98ba8f406e0de96c081f52e983752", "score": "0.5607587", "text": "func (a Args) String() string {\n\tdata, _ := json.Marshal(a)\n\treturn string(data)\n}", "title": "" }, { "docid": "3818edbf94c07e4b9093a385052a9d8e", "score": "0.5539174", "text": "func (s KeyUsagePropertyFlags) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3ffc25a4edc5ca7652c4750de89130eb", "score": "0.55239683", "text": "func (s Parameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "612662a0b4743ca8d4d9be2102cb5d6b", "score": "0.55160624", "text": "func (o SnapmirrorInfoType) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "34f1f867fecec19b72af28de6ea47689", "score": "0.55132836", "text": "func (*cmdParams) String() string { return \"\\\"key=value\\\"\" }", "title": "" }, { "docid": "a98344e2ba45867a1c7a2aba22eb9436", "score": "0.5497599", "text": "func (i invocation) String() string {\n\treturn fmt.Sprintf(\"%s %s\", i.name, strings.Join(i.allArgs(), \" \"))\n}", "title": "" }, { "docid": "2537643a4d071d1910ad417707ce36dd", "score": "0.5488582", "text": "func (s DecimalParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "7cf6afcaafed5a4baa194589343e9b35", "score": "0.5482331", "text": "func wktgoogleProtobufString(pname, gname, ftype string) *Field {\n\tg := strcase.ToCamel(strings.Replace(ftype, \".\", \"\", -1))\n\tp := \"StringValue\"\n\n\treturn &Field{\n\t\tName: gname,\n\t\tProtoName: pname,\n\t\tProtoToGoType: fmt.Sprintf(\"%sTo%s\", p, g),\n\t\tGoToProtoType: fmt.Sprintf(\"%sTo%s\", g, p),\n\t\tUsePackage: true,\n\t}\n}", "title": "" }, { "docid": "e08907aa8e2343abbd146a2fa2d11ddd", "score": "0.54713464", "text": "func (v *Bar_ArgNotStruct_Args) String() string {\n\tif v == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\tvar fields [1]string\n\ti := 0\n\tfields[i] = fmt.Sprintf(\"Request: %v\", v.Request)\n\ti++\n\n\treturn fmt.Sprintf(\"Bar_ArgNotStruct_Args{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" }, { "docid": "d4b2d1752651c430f389fb8fdb8d0625", "score": "0.5469254", "text": "func (p Params) String() string {\n\treturn fmt.Sprintf(`Params:\n Unbonding Time: %s\n Max Validators: %d\n Max Entries: %d\n Bonded Coin Denom: %s`, p.UnbondingTime,\n\t\tp.MaxValidators, p.MaxEntries, p.BondDenom)\n}", "title": "" }, { "docid": "70654039945d2320f4eee3aa3a793d94", "score": "0.54627854", "text": "func (s KeyValuePair) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "70654039945d2320f4eee3aa3a793d94", "score": "0.54627854", "text": "func (s KeyValuePair) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "76891d2ef105ca81babcca9ea7376bca", "score": "0.54584885", "text": "func (v ParamType) String() string {\n\tswitch v {\n\tcase ParamBody:\n\t\treturn \"body\"\n\tcase ParamParam:\n\t\treturn \"param\"\n\tcase ParamQuery:\n\t\treturn \"query\"\n\tcase ParamHeader:\n\t\treturn \"header\"\n\tcase ParamCookie:\n\t\treturn \"cookie\"\n\t}\n\treturn \"unknown\"\n}", "title": "" }, { "docid": "e70264b5141f287728d8cca08f161d9f", "score": "0.5446395", "text": "func (o NvmeInterfaceInfoType) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "5645b98d27ab43fcddf45cf0f14ffaee", "score": "0.5439921", "text": "func (v Version) String() string {\n\tjv, _ := json.Marshal(v)\n\treturn string(jv)\n}", "title": "" }, { "docid": "a102628683574cfd3b9b626c5ef060f3", "score": "0.5429176", "text": "func (v *QueryParamsStruct) String() string {\n\tif v == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\tvar fields [5]string\n\ti := 0\n\tfields[i] = fmt.Sprintf(\"Name: %v\", v.Name)\n\ti++\n\tif v.UserUUID != nil {\n\t\tfields[i] = fmt.Sprintf(\"UserUUID: %v\", *(v.UserUUID))\n\t\ti++\n\t}\n\tif v.AuthUUID != nil {\n\t\tfields[i] = fmt.Sprintf(\"AuthUUID: %v\", *(v.AuthUUID))\n\t\ti++\n\t}\n\tif v.AuthUUID2 != nil {\n\t\tfields[i] = fmt.Sprintf(\"AuthUUID2: %v\", *(v.AuthUUID2))\n\t\ti++\n\t}\n\tfields[i] = fmt.Sprintf(\"Foo: %v\", v.Foo)\n\ti++\n\n\treturn fmt.Sprintf(\"QueryParamsStruct{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" }, { "docid": "ea98e45b6b5627266bea3540df3580ff", "score": "0.5425174", "text": "func (api *API) String() string {\n\treturn fmt.Sprintf(\"API(ID=%v, URL=%v, APIVerb=%v)\", api.ID, api.URL, api.APIVerb)\n}", "title": "" }, { "docid": "4955b421d876a48729de174a3ae9599e", "score": "0.5421498", "text": "func (c Checkpoints) String() string {\n\tjc, _ := json.Marshal(c)\n\treturn string(jc)\n}", "title": "" }, { "docid": "b94dc708cf884aaff1358adbf52dc726", "score": "0.54041576", "text": "func String() string {\n\treturn fmt.Sprintf(\"%s %v Protocol %s %s\", Name, Version,\n\t\tprotocol.ProtocolCompat, Additional)\n}", "title": "" }, { "docid": "f1b758e5865c8ab1a46d5df02c34efbf", "score": "0.5401839", "text": "func (af additionalField) String() string {\n\tkey := strings.TrimPrefix(af.key, \"_\")\n\treturn fmt.Sprintf(\"%s=%v\", color.MagentaString(key), af.value)\n}", "title": "" }, { "docid": "cf2556e7d19d4db94ba897ec78eb8ce8", "score": "0.5401651", "text": "func (s BackendAPIAuthType) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "f1562905de983ed2b0459de7a2f88a77", "score": "0.53991425", "text": "func (v value) String() string {\n\tif v.ptr {\n\t\treturn \"*\" + v.name\n\t} else {\n\t\treturn v.name\n\t}\n}", "title": "" }, { "docid": "d030f6c1af52051a810bef1a6952ce4b", "score": "0.53953767", "text": "func (v Value) String() string {\n\tif sp, ok := v.any.(stringptr); ok {\n\t\t// Inlining this code makes a huge difference.\n\t\tvar s string\n\t\thdr := (*reflect.StringHeader)(unsafe.Pointer(&s))\n\t\thdr.Data = uintptr(sp)\n\t\thdr.Len = int(v.num)\n\t\treturn s\n\t}\n\treturn string(v.append(nil))\n}", "title": "" }, { "docid": "286064e80913533aad7620158553a8ab", "score": "0.5394602", "text": "func (k *StructMapKey) String() string {\n var sb strings.Builder\n sb.WriteString(\"StructMapKey(\")\n sb.WriteString(\")\")\n return sb.String()\n}", "title": "" }, { "docid": "e727fa0658f75ea852d6b58e960ddaa3", "score": "0.5394196", "text": "func (o AggrCheckAttributesType) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "7bf2142dd8fe6027f4df2f44dfc5a04d", "score": "0.5393138", "text": "func (params Params) String() string {\n\tbuf := bufferPool.Get().(*bytes.Buffer)\n\tbuf.Reset()\n\tdefer bufferPool.Put(buf)\n\tparams.toBuffer(buf)\n\treturn buf.String()\n}", "title": "" }, { "docid": "7176b5fbd92b92fb6d7692b988128610", "score": "0.5388121", "text": "func (p Params) String() string {\n\treturn fmt.Sprintf(`Params:\n UnbondingTime: %s\n MaxValidators: %d\n MaxKeyNodes: %d\n MaxEntries: %d\n MaxCandidateKeyNodeHeartbeatInterval: %d\n BondDenom: %s\n MinValidatorDelegation: %s\n MinKeyNodeDelegation: %s`,\n\t\tp.UnbondingTime, p.MaxValidators, p.MaxKeyNodes, p.MaxEntries, p.MaxCandidateKeyNodeHeartbeatInterval,\n\t\tp.BondDenom, p.MinValidatorDelegation.String(), p.MinKeyNodeDelegation.String())\n}", "title": "" }, { "docid": "34860eac8f0530c1a711a521f26b0e04", "score": "0.538576", "text": "func String() string {\n\treturn fmt.Sprintf(\"release=%s, revision=%s, user=%s, build=%s, go=%s\",\n\t\trelease, revision, buildUser, buildDate, goVersion)\n}", "title": "" }, { "docid": "3a3390315c93355349074eda135b0709", "score": "0.5383251", "text": "func (m Metadata) String() string {\n\treturn pointer.DumpPStruct(m, false)\n}", "title": "" }, { "docid": "107d9ae25b5bb5f0efc1b21eb657e2e8", "score": "0.5383153", "text": "func (s ServiceNowParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "715791314bd9e0366f195553f4c67343", "score": "0.5381296", "text": "func (req *UpdateBCSCollectorReq) String() string {\n\tb, err := json.Marshal(req)\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\treturn string(b)\n}", "title": "" }, { "docid": "3622035dd78be1c999194c94b8e448bc", "score": "0.5373749", "text": "func (o VserverPeerGetIterRequestDesiredAttributes) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "7184871a6ec6ae71d103531a87c02eb9", "score": "0.5372175", "text": "func (m *Message) String() string {\n\tif len(m.additional) == 0 {\n\t\tbaseMessageFields, _ := json.Marshal(m)\n\t\treturn string(baseMessageFields)\n\t}\n\n\t// Maps do not marshal to JSON as top-level objects.\n\t// To work around we marshal the map of additional fields, modify the string\n\t// and append to the outbound JSON encoded struct.\n\tadditionalFields, _ := json.Marshal(m.additional)\n\tfilteredFields := strings.Replace(string(additionalFields[1:]), \"\\\\\\\"\", \"\\\"\", -1)\n\n\tbaseMessageFields, _ := json.Marshal(m)\n\ttrimBaseMessageFields := strings.TrimRight(string(baseMessageFields), \"}\")\n\n\treturn trimBaseMessageFields + \",\" + filteredFields\n}", "title": "" }, { "docid": "2bf29bb7788b0325d56f79f403b0399c", "score": "0.5369346", "text": "func (s GroupConfigurationParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b97895ab172f3c3bfc19eea555032fed", "score": "0.53685445", "text": "func (s VirtualGateway) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "6c2079aa9a43306556dcdb122c5d7a36", "score": "0.53639525", "text": "func (p Params) String() string {\n\tvar sb strings.Builder\n\tsb.WriteString(\"Params: \\n\")\n\tsb.WriteString(fmt.Sprintf(\"PeggyID: %d\\n\", p.PeggyID))\n\tsb.WriteString(fmt.Sprintf(\"ContractHash: %d\\n\", p.ContractHash))\n\tsb.WriteString(fmt.Sprintf(\"StartThreshold: %d\\n\", p.StartThreshold))\n\tsb.WriteString(fmt.Sprintf(\"BridgeContractAddress: %s\\n\", p.BridgeContractAddress.String()))\n\tsb.WriteString(fmt.Sprintf(\"BridgeChainID: %d\\n\", p.BridgeChainID))\n\treturn sb.String()\n}", "title": "" }, { "docid": "10990a926874191a7cacdf35f216c5c1", "score": "0.53612596", "text": "func (req *CreateBCSCollectorReq) String() string {\n\tb, err := json.Marshal(req)\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\treturn string(b)\n}", "title": "" }, { "docid": "331e80b9a14ec326002f0a9e02dba246", "score": "0.5361184", "text": "func String(val string) *wrapperspb.StringValue {\n\treturn &wrapperspb.StringValue{Value: val}\n}", "title": "" }, { "docid": "dc759288f4083b2145ced681b7b978a8", "score": "0.5360724", "text": "func (s VpcInformation) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d1caa010fbba5043ac90bdc7f9b17519", "score": "0.53563994", "text": "func (a Achievements) String() string {\n\tja, _ := json.Marshal(a)\n\treturn string(ja)\n}", "title": "" }, { "docid": "da6270b609c9eb834149433d1f7b9d17", "score": "0.53552574", "text": "func (p Params) String() string {\n\treturn fmt.Sprintf(`Params:\n Unstaking Time: %s\n Max Validators: %d\n Stake Coin Denom: %s\n Minimum Stake: \t %d\n MaxEvidenceAge: %s\n SignedBlocksWindow: %d\n MinSignedPerWindow: %s\n DowntimeJailDuration: %s\n SlashFractionDoubleSign: %s\n SlashFractionDowntime: %s\n SessionBlockFrequency %d\n Proposer Allocation %d\n DAO allocation %d`,\n\t\tp.UnstakingTime,\n\t\tp.MaxValidators,\n\t\tp.StakeDenom,\n\t\tp.StakeMinimum,\n\t\tp.MaxEvidenceAge,\n\t\tp.SignedBlocksWindow,\n\t\tp.MinSignedPerWindow,\n\t\tp.DowntimeJailDuration,\n\t\tp.SlashFractionDoubleSign,\n\t\tp.SlashFractionDowntime,\n\t\tp.SessionBlockFrequency,\n\t\tp.ProposerAllocation,\n\t\tp.DAOAllocation)\n}", "title": "" }, { "docid": "eed1c17e8f90cb82d64a1d8a2a89cdec", "score": "0.53545266", "text": "func (s ModifyVpcTenancyInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "f03e58b3a35627fc881a91f47d0bca1c", "score": "0.5345875", "text": "func (s NiftyModifyCustomerGatewayAttributeOutput) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "ea3d57b049b0b3b2861e263d7782f5f0", "score": "0.53453743", "text": "func (s VpcInterfaceRequest) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "39f554b5c6dc2b7458bea3e14cf30e00", "score": "0.5341496", "text": "func (m *Module) String(name, value string) {\n\tm.fields[name] = lua.LString(value)\n}", "title": "" }, { "docid": "83a48869e3bb5dba0451156bdd56f062", "score": "0.53280586", "text": "func (s ApiGatewayProxyInput_) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "773ad15412af46740aafdd1afa28c4c8", "score": "0.5327271", "text": "func (s SigningProfileParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "538a7916723e535a9a8227f223b9f979", "score": "0.5320412", "text": "func (c *keyValuePair) String() string {\n\treturn fmt.Sprintf(\"%v.WithValue(%#v, %#v)\", c.Config, c.key, c.val)\n}", "title": "" }, { "docid": "d570756b9c8bcdd8e9fe12ce4ea571a1", "score": "0.5315573", "text": "func (v *TransStruct) 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(\"Message: %v\", v.Message)\n\ti++\n\tif v.Driver != nil {\n\t\tfields[i] = fmt.Sprintf(\"Driver: %v\", v.Driver)\n\t\ti++\n\t}\n\tfields[i] = fmt.Sprintf(\"Rider: %v\", v.Rider)\n\ti++\n\n\treturn fmt.Sprintf(\"TransStruct{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" }, { "docid": "4de885385fadb3f25df3d3b83ac9c3ef", "score": "0.53154594", "text": "func (v Value) String() string {\n\treturn v.Format(OutFormatDebug)\n}", "title": "" }, { "docid": "1d4e7d34766971f14676e1ed1bb0333d", "score": "0.53104794", "text": "func (s DocumentParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "1d4e7d34766971f14676e1ed1bb0333d", "score": "0.53104794", "text": "func (s DocumentParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "1caeb3ab683d0800086cc734d6225522", "score": "0.53076583", "text": "func (c Checkpoint) String() string {\n\tjc, _ := json.Marshal(c)\n\treturn string(jc)\n}", "title": "" }, { "docid": "e55432f2b6c24b3239fe5612ab8e466f", "score": "0.5305569", "text": "func (b *binding) String() string {\n\tindex := fmt.Sprintf(\"%d\", b.Input.Index)\n\tif len(b.Input.StructFieldIndex) > 0 {\n\t\tfor j, i := range b.Input.StructFieldIndex {\n\t\t\tif j == 0 {\n\t\t\t\tindex = fmt.Sprintf(\"%d\", i)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tindex += fmt.Sprintf(\".%d\", i)\n\t\t}\n\t}\n\n\treturn fmt.Sprintf(\"[%s:%s] maps to [%s]\", index, b.Input.Type.String(), b.Dependency)\n}", "title": "" }, { "docid": "d8ba17d9b5ba0dc43a826e97e50277cf", "score": "0.5302432", "text": "func String(vm *otto.Otto, v otto.Value) string {\n\tif !v.IsDefined() {\n\t\treturn \"\"\n\t}\n\ts, err := v.ToString()\n\tif err != nil {\n\t\tThrow(vm, err.Error())\n\t}\n\treturn s\n}", "title": "" }, { "docid": "d527782021b072234380cbef774ba31c", "score": "0.53002286", "text": "func (s NiftyModifyCustomerGatewayAttributeInput) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "d2dedaf54ce114bf49126de8b61dca4d", "score": "0.5298942", "text": "func (s VpcInterface) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "e53d73a1f0b48ee97950cf87755a5aa4", "score": "0.529614", "text": "func (p MemberPhase) String() string {\n\treturn string(p)\n}", "title": "" }, { "docid": "7636368760d495cf80bff6d187b32e57", "score": "0.52940863", "text": "func (s KeyUsageFlags) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "66ebc87b4e75eda9bf0651c1bcfe4731", "score": "0.52929294", "text": "func (s UpdateCaseOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "cca945207fb00f0f36c707031770f15c", "score": "0.5287838", "text": "func (s FindMatchesParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "bee1fb6bd8a93238c04f815d04cc864e", "score": "0.52787066", "text": "func (f *Field) String() string {\n\treturn `{\"name\":\"` + f.name + `\",\"type\":` + f.typ.String() + `}`\n}", "title": "" }, { "docid": "6c28c8aaca1d6e615b02ba1a0fe23fa4", "score": "0.52763134", "text": "func (ba SettingsAttributes) String(name string) string {\n\tif val, ok := ba[name]; ok {\n\t\treturn fmt.Sprintf(\"%v\", val)\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "e179ec49ab8771aae98e0470b0d33256", "score": "0.5272704", "text": "func formatGoName(name string) string {\n\tvar fieldName string\n\n\tswitch strings.ToLower(name) {\n\tcase \"ids\":\n\t\t// special case to avoid the struct field Ids, and prefer IDs instead\n\t\tfieldName = \"IDs\"\n\tcase \"id\":\n\t\tfieldName = \"ID\"\n\tcase \"accountid\":\n\t\tfieldName = \"AccountID\"\n\tcase \"accountids\":\n\t\tfieldName = \"AccountIDs\"\n\tcase \"userid\":\n\t\tfieldName = \"UserID\"\n\tcase \"userids\":\n\t\tfieldName = \"UserIDs\"\n\tcase \"ingestkeyids\":\n\t\tfieldName = \"IngestKeyIDs\"\n\tcase \"userkeyids\":\n\t\tfieldName = \"UserKeyIDs\"\n\tcase \"keyid\":\n\t\tfieldName = \"KeyID\"\n\tcase \"policyid\":\n\t\tfieldName = \"PolicyID\"\n\tdefault:\n\t\tfieldName = strings.Title(name)\n\t}\n\n\tr := strings.NewReplacer(\n\t\t\"Api\", \"API\",\n\t\t\"Guid\", \"GUID\",\n\t\t\"Nrql\", \"NRQL\",\n\t\t\"Nrdb\", \"NRDB\",\n\t\t\"Url\", \"URL\",\n\t\t\"ApplicationId\", \"ApplicationID\",\n\t)\n\n\tfieldName = r.Replace(fieldName)\n\n\treturn fieldName\n}", "title": "" }, { "docid": "27cdd9d7c54d5bf70d65a87059a69fe5", "score": "0.526561", "text": "func (p Purpose) String() string {\n\tif value, ok := purposeMarshal[p]; ok {\n\t\treturn value\n\t}\n\n\treturn purposeMarshal[PurposeVerify]\n}", "title": "" }, { "docid": "5370a3268852f6091878ea71d78f9260", "score": "0.5260121", "text": "func (o LunUnmapRequest) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "f22d9114d24746c8de07c97a5a480a3f", "score": "0.5259241", "text": "func (s MariaDbParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "4aefa73b0e0f98b281401c5b6581942e", "score": "0.5242644", "text": "func (b Base) StringParam(c buffalo.Context, name, defalt string) string {\n\tret := c.Param(name)\n\tif ret == \"\" {\n\t\treturn defalt\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "37f061fd711936c7a11d7a95bdf4fbde", "score": "0.5241911", "text": "func (s UpdateProvisioningParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "616c59be49cafc3f5f9f567f71123063", "score": "0.5237037", "text": "func (v *NestedStruct) String() string {\n\tif v == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\tvar fields [2]string\n\ti := 0\n\tfields[i] = fmt.Sprintf(\"Msg: %v\", v.Msg)\n\ti++\n\tif v.Check != nil {\n\t\tfields[i] = fmt.Sprintf(\"Check: %v\", *(v.Check))\n\t\ti++\n\t}\n\n\treturn fmt.Sprintf(\"NestedStruct{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" }, { "docid": "d909c84ef0ccaff3dbc2199ccb600478", "score": "0.52353716", "text": "func (p Params) String(key string) string {\n\treturn p[key]\n}", "title": "" }, { "docid": "ca29fbc1a575548f44bfd0599e9b91de", "score": "0.52342963", "text": "func (s AccessPoint) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "697c9457ce5c0cd78183efeecb4cd1eb", "score": "0.523017", "text": "func (s ModifyVpcTenancyOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "14bb225a5bc3c710e0542334cfbc5d8b", "score": "0.52269363", "text": "func (msg MsgUpdateAttributeRequest) String() string {\n\tout, _ := yaml.Marshal(msg)\n\treturn string(out)\n}", "title": "" }, { "docid": "8d48c57c2e39f7e817635ff89b0933c7", "score": "0.5225815", "text": "func (pv *MockPV) String() string {\n\treturn fmt.Sprintf(\"MockPV{%v}\", pv.GetAddress())\n}", "title": "" }, { "docid": "9a4007cbf4e496cd77c54b16523b199e", "score": "0.52221847", "text": "func (s ProvisioningParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "a54c1f91f782c89d4393de11ade228e9", "score": "0.5219743", "text": "func String(value reflect.Value) string {\n\treturn value.Interface().(string)\n}", "title": "" }, { "docid": "ebe7b2bf06a5482814588f5b15ea7df6", "score": "0.52188545", "text": "func (o Object) String() string {\n\treturn fmt.Sprintf(\"OT:%d OV:%v\", o.Type, o.Value)\n}", "title": "" }, { "docid": "2f7820e821041f9829c4fdd36133b3ae", "score": "0.5218105", "text": "func (s SnowflakeParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "c3bbd5dae6f605d5554fa7ae6f1b15bc", "score": "0.52131224", "text": "func (v *Field) String() string {\n\tif v == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\tvar fields [2]string\n\ti := 0\n\tif v.Name != nil {\n\t\tfields[i] = fmt.Sprintf(\"Name: %v\", *(v.Name))\n\t\ti++\n\t}\n\tif v.Value != nil {\n\t\tfields[i] = fmt.Sprintf(\"Value: %v\", v.Value)\n\t\ti++\n\t}\n\n\treturn fmt.Sprintf(\"Field{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" }, { "docid": "ccd77ea2aa2fce77c72da34f4e7437f2", "score": "0.5211221", "text": "func (s UpdateCaseInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "a8e39a951781efea0d9e3d980ee428a8", "score": "0.520975", "text": "func (mt *methodType) String() string {\n\treturn maps[mt.value]\n}", "title": "" }, { "docid": "3455d0387ed4cba9531b898cf0eb6319", "score": "0.5208532", "text": "func (o *Campaignruleparameters) String() string {\n \n \n \n \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "title": "" }, { "docid": "688c90c02e605d9d4d7bd3536d8860ce", "score": "0.5205216", "text": "func (p Params) String() string {\n\treturn fmt.Sprintf(`Auction Params:\n\tMax Auction Duration: %s\n\tBid Duration: %s\n\tIncrement Surplus: %s\n\tIncrement Debt: %s\n\tIncrement Collateral: %s`,\n\t\tp.MaxAuctionDuration, p.BidDuration, p.IncrementSurplus, p.IncrementDebt, p.IncrementCollateral)\n}", "title": "" }, { "docid": "9fabcb7f46be5a3190d0f03070d02857", "score": "0.52030116", "text": "func (s TeradataParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "f1a40ab325a6e449130e924039aa53a2", "score": "0.52028626", "text": "func (c *CachedIndividuallyMappedMessage) String() string {\n\treturn stringify.Struct(\"CachedIndividuallyMappedMessage\",\n\t\tstringify.StructField(\"CachedObject\", c.Unwrap()),\n\t)\n}", "title": "" }, { "docid": "b82daa42075d9552a51df39c0b827bc3", "score": "0.5202564", "text": "func (s ActionParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "9ef5e2dda42ffa38cd7f17febde080e3", "score": "0.5201922", "text": "func (s ModifyCacheParameterGroupOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "7b572d1dd548d4ba49cc430ebe9d6ad1", "score": "0.5187733", "text": "func String(name string, value string) FieldString {\n\treturn FieldString{Name: name, Value: value}\n}", "title": "" }, { "docid": "09f7ce18aea17bf1bcad8ac40763016b", "score": "0.5187534", "text": "func (v *Bar_ArgWithParams_Args) String() string {\n\tif v == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\tvar fields [2]string\n\ti := 0\n\tfields[i] = fmt.Sprintf(\"UUID: %v\", v.UUID)\n\ti++\n\tif v.Params != nil {\n\t\tfields[i] = fmt.Sprintf(\"Params: %v\", v.Params)\n\t\ti++\n\t}\n\n\treturn fmt.Sprintf(\"Bar_ArgWithParams_Args{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" } ]
789a2347dcc6406ddb5cdb50fc9d0f39
replace will replace a placeholder
[ { "docid": "4657523386a1fe42e6b1fbc1e1572089", "score": "0.0", "text": "func replace(s string, m *discordgo.MessageCreate) (res string) {\n\tswitch s {\n\tcase \"NAME\": // Command author's name\n\t\tres = m.Author.Username\n\tcase \"HL_NAME\": // Highlight command author\n\t\tres = \"<@\" + m.Author.ID + \">\"\n\tcase \"ID\": // Author ID\n\t\tres = m.Author.ID\n\tcase \"ARG1\": // argument 1 of author's message\n\t\tparts := strings.Split(m.Content, \" \")\n\t\tres = parts[1]\n\tdefault:\n\t\tres = s\n\t}\n\n\treturn\n}", "title": "" } ]
[ { "docid": "8434b0050df607723f1ce20a4358847a", "score": "0.6977152", "text": "func replace(tmpl string, v interface{}) string {\n\tt := template.Must(template.New(\"test\").Parse(tmpl))\n\tbuf := bytes.NewBuffer(nil)\n\tt.Execute(buf, &v)\n\tret := buf.String()\n\tklog.V(4).Infof(\"Replaced: %v into: %v\", tmpl, ret)\n\treturn ret\n}", "title": "" }, { "docid": "aac49834f5b2bcbf5b776bde165eeac9", "score": "0.6946295", "text": "func (p *partialGroup) replace(v interface{}) {\n\tp.values = []Partial{v}\n}", "title": "" }, { "docid": "a90bb2063e409bc718b2801b132e4d1c", "score": "0.69003123", "text": "func (r *Render) replace(fstTmpl *fasttemplate.Template, replaceMap map[string]string, allowUnresolved bool) (string, error) {\n\tvar unresolvedErr error\n\treplacedTmpl := fstTmpl.ExecuteFuncString(func(w io.Writer, tag string) (int, error) {\n\n\t\ttrimmedTag := strings.TrimSpace(tag)\n\n\t\treplacement, ok := replaceMap[trimmedTag]\n\t\tif len(trimmedTag) == 0 || !ok {\n\t\t\tif allowUnresolved {\n\t\t\t\t// just write the same string back\n\t\t\t\treturn w.Write([]byte(fmt.Sprintf(\"{{%s}}\", tag)))\n\t\t\t}\n\t\t\tunresolvedErr = errors.Errorf(\"failed to resolve {{%s}}\", tag)\n\t\t\treturn 0, nil\n\t\t}\n\t\t// The following escapes any special characters (e.g. newlines, tabs, etc...)\n\t\t// in preparation for substitution\n\t\treplacement = strconv.Quote(replacement)\n\t\treplacement = replacement[1 : len(replacement)-1]\n\t\treturn w.Write([]byte(replacement))\n\t})\n\tif unresolvedErr != nil {\n\t\treturn \"\", unresolvedErr\n\t}\n\n\treturn replacedTmpl, nil\n}", "title": "" }, { "docid": "de75b680ffe2d3fb609f5f73a284f911", "score": "0.6887739", "text": "func (t RqlTerm) Replace(arg interface{}, optArgs ...interface{}) RqlTerm {\n\toptArgM := optArgsToMap([]string{\"durability\", \"return_vals\", \"non_atomic\"}, optArgs)\n\treturn newRqlTermFromPrevVal(t, \"Replace\", p.Term_REPLACE, []interface{}{funcWrap(arg)}, optArgM)\n}", "title": "" }, { "docid": "eb7f47e80e146aea480ca0835995e734", "score": "0.66634095", "text": "func stingReplace(pattern *regexp.Regexp, input string) string {\n\tmatch := pattern.FindStringSubmatch(input)\n\tif len(match) == 1 {\n\t}\n\twordSwap := match[1]\n\twordSwap = mapSubstitutions(wordSwap)\n\treturn wordSwap\n}", "title": "" }, { "docid": "abbc84389dc794db143a4e1200f8caff", "score": "0.656595", "text": "func ReplacePlaceholder(str string, args []string) string {\n\t/*\n\t\tfor example:\n\t\tstr is \"a > ? AND a < ?\", args is {'1', '2'},\n\t\tthis function will return \"a > '1' AND a < '2'\"\n\t*/\n\tnewStr := strings.ReplaceAll(str, \"?\", \"'%s'\")\n\treturn fmt.Sprintf(newStr, util.StringsToInterfaces(args)...)\n}", "title": "" }, { "docid": "c09122cee0acfb914203389de931c0da", "score": "0.65366375", "text": "func Replace(pan string) string {\n\treturn ReplaceWithSymbol(pan, \"*\")\n}", "title": "" }, { "docid": "9a16e591b11c1372812a013ca9a02c9a", "score": "0.6524329", "text": "func replace(message string, params []interface{}) string {\n\tfor i, item := range params {\n\t\ttoken := fmt.Sprintf(\"{%d}\", i)\n\t\tvalue := fmt.Sprintf(\"%v\", item)\n\t\tmessage = strings.Replace(message, token, value, -1)\n\t}\n\treturn message\n}", "title": "" }, { "docid": "19c4c521ddb4140282ee6891e9da7d2d", "score": "0.63603425", "text": "func replace_values(pattern string, orig_str string, rep_char string) string {\r\n\trepl,_:=regexp.Compile(pattern)\r\n\tnew_str:=repl.ReplaceAllLiteralString(orig_str, rep_char)\r\n\r\n\treturn new_str\r\n}", "title": "" }, { "docid": "5ff55bdb935690e0397a483287919a4f", "score": "0.6359121", "text": "func (lv *LocalVars) Replace(value string) string {\n\tif lv == nil {\n\t\treturn value\n\t}\n\n\tfor k, v := range *lv {\n\t\tvalue = strings.ReplaceAll(value, \"$\"+k, v)\n\t}\n\n\treturn value\n}", "title": "" }, { "docid": "dc1ce180ac415fd4ff94f6d8adfbafc4", "score": "0.6317778", "text": "func (l *Repeat) InternalReplace(oldToken, newToken token.Token) error {\n\tif l.token == oldToken {\n\t\tl.token = newToken\n\n\t\tfor i := range l.value {\n\t\t\tl.value[i] = l.token.Clone()\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a44a93f08499bc3bea3f73baf7bfdaa1", "score": "0.6306699", "text": "func replace (failLength int ,local int ,preWord string) string{\n\tvar replaceWord bytes.Buffer\n\tfor j := 0 ; j < failLength ; j++ {\n\t\treplaceWord.WriteString(\"*\")\n\t}\n\tprefix := string([]rune(preWord)[0:local-(failLength-1)])\n\tsuffix := string([]rune(preWord)[local+1:len([]rune(preWord))])\n\treturn strings.Join([]string{prefix , replaceWord.String() , suffix},\"\")\n}", "title": "" }, { "docid": "4034424b48996546ce503e23ff49d136", "score": "0.6257075", "text": "func (r *reduceWorkspace) replace(key ReduceKey, value Partial) {\n\tpartialGroup := r.getPartialGroup(key)\n\n\tpartialGroup.Lock()\n\tpartialGroup.replace(value)\n\tpartialGroup.Unlock()\n}", "title": "" }, { "docid": "923b38f1069cd15a009c3ba6dfe93d77", "score": "0.6235437", "text": "func TestReplace(t *testing.T) {\n\tvariables := make(map[string]interface{})\n\tvariables[\"one\"] = \"uno\"\n\tvariables[\"two\"] = \"dos\"\n\tvariables[\"three\"] = \"tres\"\n\n\tparser := Parser{\n\t\tVariables: variables,\n\t\tDelimeter: \"$\",\n\t}\n\n\tvar testTable = []struct {\n\t\tVar string\n\t\tExpected string\n\t}{\n\t\t{\"$one$\", \"uno\"},\n\t\t{\"two\", \"dos\"},\n\t\t{\"three$\", \"tres\"},\n\t\t{\"$$one\", \"uno\"},\n\t\t{\"$$\", \"\"},\n\t}\n\n\tfor _, tt := range testTable {\n\t\tw, err := parser.Replace(tt.Var)\n\t\tif err != nil {\n\t\t\tif tt.Var != \"$$\" {\n\t\t\t\tt.Error(err)\n\t\t\t}\n\t\t}\n\t\tif tt.Expected != w {\n\t\t\tt.Fatalf(\"%s != %s\", tt.Expected, w)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "caef2201215bb35c95acbea8b26a67c9", "score": "0.62109303", "text": "func (m Matcher) Replace(fn func() ast.Node) Matcher {\n\treturn m.And(Replace(fn))\n}", "title": "" }, { "docid": "b42f5bf284544d2d012f5ed4f42cb32f", "score": "0.6177384", "text": "func (s *scope) replace() *scope {\n\tif s == nil {\n\t\treturn &scope{}\n\t}\n\treturn &scope{\n\t\tb: s.b,\n\t\tparent: s.parent,\n\t}\n}", "title": "" }, { "docid": "01c6bc8e398243378b0904b146a6d385", "score": "0.6151373", "text": "func (s *sanitizer) Replace(val string) string {\n\tfor _, replacer := range s.replacers {\n\t\tval = replacer(val)\n\t}\n\treturn val\n}", "title": "" }, { "docid": "94093000400af6b734e3cc60e2502923", "score": "0.6045103", "text": "func execReplace(_ int, p *gop.Context) {\n\targs := p.GetArgs(4)\n\tret := strings.Replace(args[0].(string), args[1].(string), args[2].(string), args[3].(int))\n\tp.Ret(4, ret)\n}", "title": "" }, { "docid": "b3a92d40356fafced60682f29e7e2846", "score": "0.6025274", "text": "func (m *Match) Replace() string {\n\treturn toRaw(m.replace)\n}", "title": "" }, { "docid": "fff8467c0375510688cbd65b6a8f52cf", "score": "0.6022203", "text": "func (p *Scope) InternalReplace(oldToken, newToken token.Token) error {\n\tif p.token == oldToken {\n\t\tp.token = newToken\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "969dac4d711ab0ef812220c3edef7c17", "score": "0.5995564", "text": "func (b *branch) replace(n *node.Node) (res *node.Node, ok bool) {\n\tif !b.matcher.match(n) {\n\t\treturn nil, false\n\t}\n\tbuilder := builder{\n\t\tid: make(map[string]*node.Node),\n\t\tvariadic: nil,\n\t}\n\tb.matcher.retrieve(n, &builder)\n\treturn builder.buildTarget(b.target), true\n}", "title": "" }, { "docid": "8dc1699d348c6a5015dcd1cbdabc4d10", "score": "0.5974608", "text": "func Replace(fn func() ast.Node) Matcher {\n\treturn func(np *ast.Node, tx *Tx) bool {\n\t\t*np = fn()\n\t\treturn true\n\t}\n}", "title": "" }, { "docid": "ebf2f04a25f07105c74b3eadc8d5c747", "score": "0.5952378", "text": "func Replace(origin, search, replace string, count ...int) string {\n\tn := -1\n\tif len(count) > 0 {\n\t\tn = count[0]\n\t}\n\treturn strings.Replace(origin, search, replace, n)\n}", "title": "" }, { "docid": "732fa6ae1699cf310c5ec3e4ae54961b", "score": "0.5940434", "text": "func (nd *NetworkDescription) Replace(p data.Clonable) data.Clonable {\n\t*nd = *p.(*NetworkDescription)\n\treturn nd\n}", "title": "" }, { "docid": "39dc7b40e9ff8de6afbe502970a269aa", "score": "0.5933043", "text": "func (e *MulArithmetic) InternalReplace(oldToken, newToken token.Token) error {\n\tif oldToken == e.a {\n\t\te.a = newToken\n\t}\n\tif oldToken == e.b {\n\t\te.b = newToken\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a42d7c7f2919795e9117b2901c0774ba", "score": "0.589857", "text": "func Replace(str, substr, replace cty.Value) (cty.Value, error) {\n\treturn ReplaceFunc.Call([]cty.Value{str, substr, replace})\n}", "title": "" }, { "docid": "9d3ac9044e27d9255febb350b5dbeedb", "score": "0.5875114", "text": "func (c *Cursor) Replace(n nodes.Node) {\n\tv := c.field()\n\tif i := c.Index(); i >= 0 {\n\t\tv = v.Index(i)\n\t}\n\tv.Set(reflect.ValueOf(n))\n}", "title": "" }, { "docid": "9545b2ae23c67ec669b8d9ed728105ba", "score": "0.58733755", "text": "func (replacer *requestGUIDReplacer) replace() string {\n\treturn replacer.prefix + uuid.New().String() + replacer.suffix\n}", "title": "" }, { "docid": "98725f8582edc59317ee76e405c1ee7d", "score": "0.5867441", "text": "func ResolvePlaceholderString(str string, arguments map[string]string) string {\n\toldnews := make([]string, 0, len(arguments)*4)\n\tfor key, value := range arguments {\n\t\toldnews = append(oldnews,\n\t\t\t\"{{\"+key+\"}}\", value,\n\t\t\t\"{{.\"+key+\"}}\", value,\n\t\t)\n\t}\n\treturn strings.NewReplacer(oldnews...).Replace(str)\n}", "title": "" }, { "docid": "61acba31b0361ed073af95c57edabef7", "score": "0.58644515", "text": "func Replace(old, new, src string) string {\n\treturn strings.Replace(src, old, new, -1)\n}", "title": "" }, { "docid": "9ea9ee2b4956951325d5156ba2cb7e0f", "score": "0.5834642", "text": "func execmReplacerReplace(_ int, p *gop.Context) {\n\targs := p.GetArgs(2)\n\tret := args[0].(*strings.Replacer).Replace(args[1].(string))\n\tp.Ret(2, ret)\n}", "title": "" }, { "docid": "65d495b39c6992685faf724b968a6618", "score": "0.5820238", "text": "func Replace(old, new, value string) string {\n\treturn strings.Replace(value, old, new, -1)\n}", "title": "" }, { "docid": "e4c1e751bf00a50e77f90655bb0fa308", "score": "0.58118594", "text": "func (q *Query) replaceArgPlaceholders() {\n\t// Match ? and replace with argument placeholder from database\n\tfor i := range q.args {\n\t\tq.sql = strings.Replace(q.sql, \"?\", database.Placeholder(i+1), 1)\n\t}\n}", "title": "" }, { "docid": "d9e294e4aec78b8efbc7798c81f54066", "score": "0.580899", "text": "func (e *DivArithmetic) InternalReplace(oldToken, newToken token.Token) error {\n\tif oldToken == e.a {\n\t\te.a = newToken\n\t}\n\tif oldToken == e.b {\n\t\te.b = newToken\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "380f81b3a89a98ba2af820ffe57a6a51", "score": "0.57886785", "text": "func (this String) Replace(val string) <-chan string {\n\treturn StringCommand(this, this.args(\"getset\", val)...)\n}", "title": "" }, { "docid": "2809f5ae068ba67120523bcc01700384", "score": "0.5776004", "text": "func (e *AddArithmetic) InternalReplace(oldToken, newToken token.Token) error {\n\tif oldToken == e.a {\n\t\te.a = newToken\n\t}\n\tif oldToken == e.b {\n\t\te.b = newToken\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "7794acc1e81d566e00cfd128b9eceffb", "score": "0.5754218", "text": "func replacePattern(text, pattern, replace string) string {\n\treturn regexp.MustCompile(pattern).ReplaceAllString(text, replace)\n}", "title": "" }, { "docid": "d85d0b3f141d64faaa57184189ad4c5e", "score": "0.5748886", "text": "func (e *SubArithmetic) InternalReplace(oldToken, newToken token.Token) error {\n\tif oldToken == e.a {\n\t\te.a = newToken\n\t}\n\tif oldToken == e.b {\n\t\te.b = newToken\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "5a46079da17aa65088a472a1e31b06f8", "score": "0.5743984", "text": "func (obj *Secret) Replace(sec *v1.Secret) *Secret {\n\tif sec != nil {\n\t\tobj.sc = sec\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "0e57f83dc631594bf18e4c89c69fb98e", "score": "0.5725164", "text": "func (c *Class) Replace() error {\n\treturn ErrNotImplemented\n}", "title": "" }, { "docid": "ce694ef830a150c112da81bc0e5870cc", "score": "0.566112", "text": "func (b *Bench4) Replace(db XODB) error {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `REPLACE INTO public.bench4 (` +\n\t\t`Text, Time, Name, Indexed` +\n\t\t`) VALUES (` +\n\t\t`$1, $2, $3, $4` +\n\t\t`)`\n\n\t// run query\n\tXOLog(sqlstr, b.Text, b.Time, b.Name, b.Indexed)\n\tres, err := db.Exec(sqlstr, b.Text, b.Time, b.Name, b.Indexed)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// retrieve id\n\tid, err := res.LastInsertId()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// set primary key and existence\n\tb.Id = int(id)\n\tb._exists = true\n\n\treturn nil\n}", "title": "" }, { "docid": "3d58f598e879a0e27acfde86346b2664", "score": "0.5658259", "text": "func ReplaceLiteral(replacement string) Editor {\n\treturn replaceLiteralEditor(replacement)\n}", "title": "" }, { "docid": "b8966314c4cd9b40720ae00ef97d76a5", "score": "0.5636904", "text": "func replaceRegistry(input, registryType, namespace string) string {\n\t// Check if the registryType is the start of the sentence or has a whitespace before it\n\tvar re = regexp.MustCompile(fmt.Sprintf(`(^|\\s)(%s)`, registryType))\n\tif re.MatchString(input) {\n\t\treturn strings.Replace(input, registryType, fmt.Sprintf(\"%s/%s\", okteto.Context().Registry, namespace), 1)\n\t}\n\treturn input\n}", "title": "" }, { "docid": "f2597dc60d768ea905c84ff53882e354", "score": "0.56197953", "text": "func (def *MeterDefinitionDictionary) Replace(in []interface{}, str string) error {\n\tdef.Lock()\n\tdefer def.Unlock()\n\n\tobjs := []interface{}{}\n\n\tfor _, obj := range in {\n\t\tlocalObj := obj\n\t\taddObj, err := def.newMeterDefinitionExtended(localObj)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tobjs = append(objs, addObj)\n\t}\n\n\tif err := def.cache.Replace(objs, str); err != nil {\n\t\treturn err\n\t}\n\n\tif err := def.delta.Replace(objs, str); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "124edd99d6a8a72383bc3a8200454d56", "score": "0.5613996", "text": "func (s *Sphere) Replace(template Sphere, transform Transform) {\n\ts.position = transform.Vector(template.position)\n\ts.radius = template.radius\n}", "title": "" }, { "docid": "e5ffce9678ad9db9bc11e4737c02e46c", "score": "0.55986667", "text": "func (be badgerBackend) Replace(key []byte, value []byte) error {\n\treturn be.Put(key, value, true, false)\n}", "title": "" }, { "docid": "d8e9d496dc67e26b3109d2900a42f22f", "score": "0.558965", "text": "func (conn *Connection) Replace(space interface{}, tuple interface{}) (*Response, error) {\n\treturn conn.ReplaceAsync(space, tuple).Get()\n}", "title": "" }, { "docid": "3777252d119ccb3be6d9e86cf0d9430d", "score": "0.557386", "text": "func WikiReplace(src string) string {\n\t//return r.Replace(src)\n\treturn strings.Replace(src, \" \", \"\", -1)\n}", "title": "" }, { "docid": "fd7a603d5ef170296feeb1dcd173f966", "score": "0.55501455", "text": "func TestReplace(t *testing.T) {\n\n\tinputTokenStream := analysis.TokenStream{\n\t\t&analysis.Token{\n\t\t\tTerm: []byte(\"walk\"),\n\t\t},\n\t\t&analysis.Token{\n\t\t\tTerm: []byte(\"park\"),\n\t\t},\n\t}\n\n\texpectedTokenStream := analysis.TokenStream{\n\t\t&analysis.Token{\n\t\t\tTerm: []byte(\"walk\"),\n\t\t},\n\t\t&analysis.Token{\n\t\t\tTerm: []byte(\"spark\"),\n\t\t},\n\t}\n\n\tregistry.RegisterTokenFilter(ReplaceTokenFilterID, ReplaceTokenFilterCtor)\n\tcache := registry.NewCache()\n\tmapping := map[string]string{\n\t\t\"park\": \"spark\",\n\t}\n\tvar replaceTokenFilter analysis.TokenFilter\n\tvar err error\n\tvar outputTokenStream analysis.TokenStream\n\t// The expected way to configure a TokenFilter - by passing the ctor args in a map\n\treplaceTokenFilter, err = cache.DefineTokenFilter(ReplaceTokenFilterID, ReplaceTokenFilterCtorArgs(mapping))\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\toutputTokenStream = replaceTokenFilter.Filter(inputTokenStream)\n\n\tif !reflect.DeepEqual(outputTokenStream, expectedTokenStream) {\n\t\tt.Errorf(\"expected %#v got %#v\", expectedTokenStream, outputTokenStream)\n\t}\n\n\t// The easy way to configure a TokenFilter, which can never be used in Bleve\n\treplaceTokenFilter = NewReplaceTokenFilter(mapping)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\toutputTokenStream = replaceTokenFilter.Filter(inputTokenStream)\n\n\tif !reflect.DeepEqual(outputTokenStream, expectedTokenStream) {\n\t\tt.Errorf(\"expected %#v got %#v\", expectedTokenStream, outputTokenStream)\n\t}\n}", "title": "" }, { "docid": "a316543cf8799e4a5290450989a7cb9f", "score": "0.5542162", "text": "func normalizeInterpolation(v interface{}) interface{} {\n\tif s, ok := v.(string); ok {\n\t\treturn iamInternpolationRe.ReplaceAllString(s, `$$$1`)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "bb0f4b8711aabfa6a6a7331ad83ba8e0", "score": "0.5534505", "text": "func findReplace(conf []byte, sep string, kv map[string]string) []byte {\n\tlines := strings.Split(string(conf), \"\\n\")\n\tfor k, v := range kv {\n\t\tfound := false\n\t\tfor i, l := range lines {\n\t\t\tif !strings.HasPrefix(l, \"#\") && strings.Contains(l, k) {\n\t\t\t\tlines[i] = fmt.Sprintf(\"%s%s%s\", k, sep, v)\n\t\t\t\tfound = true\n\t\t\t}\n\t\t}\n\t\tif !found {\n\t\t\tlines = append(lines, fmt.Sprintf(\"%s%s%s\", k, sep, v))\n\t\t}\n\t}\n\tout := strings.Join(lines, \"\\n\")\n\treturn []byte(out)\n}", "title": "" }, { "docid": "982345b0adbd62f4fbd1d882a5dad303", "score": "0.55341554", "text": "func ReplaceByPattern(input, pattern, replacement string) string {\n\tre := regexp.MustCompile(pattern)\n\treturn re.ReplaceAllString(input, replacement)\n}", "title": "" }, { "docid": "6b3b9c800271532dfaeed875fddf501b", "score": "0.5533587", "text": "func (tc *TestChat) Replace(db XODB) error {\n\tvar err error\n\n\t// sql query\n\n\tconst sqlstr = `REPLACE INTO ms.test_chat (` +\n\t\t`Id, TimeMs, Text, Name, UserId, C2, C3, C4, C5` +\n\t\t`) VALUES (` +\n\t\t`?, ?, ?, ?, ?, ?, ?, ?, ?` +\n\t\t`)`\n\n\t// run query\n\tXOLog(sqlstr, tc.Id, tc.TimeMs, tc.Text, tc.Name, tc.UserId, tc.C2, tc.C3, tc.C4, tc.C5)\n\tres, err := db.Exec(sqlstr, tc.Id, tc.TimeMs, tc.Text, tc.Name, tc.UserId, tc.C2, tc.C3, tc.C4, tc.C5)\n\tif err != nil {\n\t\tXOLogErr(err)\n\t\treturn err\n\t}\n\n\t// retrieve id\n\tid, err := res.LastInsertId()\n\tif err != nil {\n\t\tXOLogErr(err)\n\t\treturn err\n\t}\n\n\t// set primary key and existence\n\ttc.Id4 = int(id)\n\ttc._exists = true\n\n\tOnTestChat_AfterInsert(tc)\n\n\treturn nil\n}", "title": "" }, { "docid": "017e6413eee6f4a33db5c9efe4007121", "score": "0.55306786", "text": "func Replace(table string, cols []string, vals []interface{}) *Mutation {\n\treturn &Mutation{\n\t\top: opReplace,\n\t\ttable: table,\n\t\tcolumns: cols,\n\t\tvalues: vals,\n\t}\n}", "title": "" }, { "docid": "f6d9676e5ae928f64cbe5afe8e3fde56", "score": "0.5528731", "text": "func (self *Group) ReplaceI(args ...interface{}) interface{}{\n return self.Object.Call(\"replace\", args)\n}", "title": "" }, { "docid": "81ab0129f4d8538fafc0fb91c5fe843d", "score": "0.5515736", "text": "func (u *User) Replace(user *User) {\n\tLogger.WithField(\"from\", user).Debug(\"[User.Replace]: Replacing User\")\n\t*u = *user\n}", "title": "" }, { "docid": "06461196eb7e6f1b267b0c81d7724475", "score": "0.55049795", "text": "func (c *Clause) PlaceHolder(placeholder string) *Clause {\n\tc.placeholder = placeholder\n\treturn c\n}", "title": "" }, { "docid": "393f48953d8112d7261eccf98c34731a", "score": "0.55039006", "text": "func (s *scope) replace() *scope {\n\tr := s.builder.allocScope()\n\tr.parent = s.parent\n\treturn r\n}", "title": "" }, { "docid": "d9c47dfcc17e8a9aa303ff1bbfeb318a", "score": "0.55032724", "text": "func (f *FlagClause) PlaceHolder(placeholder string) *FlagClause {\n\tf.placeholder = placeholder\n\treturn f\n}", "title": "" }, { "docid": "e0831bc19a1f52aac1f115d11d8e7ccc", "score": "0.5499931", "text": "func (s *Step) ReplaceInURL(vals map[string]interface{}, stepNB int) error {\n\ttpl, err := template.New(s.Name).Parse(s.Request.URL)\n\tif err != nil {\n\t\treturn err\n\t}\n\tvar buffer bytes.Buffer\n\tif err := tpl.Execute(&buffer, vals); err != nil {\n\t\treturn err\n\t}\n\toutput := buffer.String()\n\ts.Request.URL = output\n\treturn nil\n}", "title": "" }, { "docid": "e5effa92303a386330210cd8f6592de7", "score": "0.5496922", "text": "func Replace() ConfigureOption {\n\treturn func(cfg *configureConfig) {\n\t\tcfg.replace = true\n\t}\n}", "title": "" }, { "docid": "7d2e83aeb84d1095bb241a9dab602e8b", "score": "0.54949796", "text": "func (cd *ClusterDefaults) Replace(p data.Clonable) (data.Clonable, error) {\n\tif cd == nil || p == nil {\n\t\treturn nil, fail.InvalidInstanceError()\n\t}\n\n\tsrc, ok := p.(*ClusterDefaults)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"p is not a *ClusterDefaults\")\n\t}\n\n\t*cd = *src\n\tlength := len(src.FeatureParameters)\n\tif length > 0 {\n\t\tcd.FeatureParameters = make([]string, len(src.FeatureParameters))\n\t\tcopy(cd.FeatureParameters, src.FeatureParameters)\n\t}\n\treturn cd, nil\n}", "title": "" }, { "docid": "152c477599ed3ea37ec23f6f55d84de9", "score": "0.54833066", "text": "func (c *apiClient) replace(link string, body, ret interface{}, opts ...CallOption) (*Response, error) {\n\tdata, err := stringify(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbuf := bytes.NewBuffer(data)\n\tif c.config.PartitionKeyStructField != \"\" {\n\t\tpartKey := reflect.ValueOf(body).Elem().FieldByName(c.config.PartitionKeyStructField)\n\t\tpartKeyI := partKey.Interface()\n\t\topts = append(opts, PartitionKey(partKeyI))\n\t}\n\treturn c.method(\"PUT\", link, http.StatusOK, ret, buf, opts...)\n}", "title": "" }, { "docid": "cabecbd0337818ced49bd89f2d38641e", "score": "0.5481585", "text": "func (l *One) InternalReplace(oldToken, newToken token.Token) error {\n\tfor i := 0; i < len(l.tokens); i++ {\n\t\tif l.tokens[i] == oldToken {\n\t\t\tl.tokens[i] = newToken\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d470822c2382bbbcbe3bb36e40d5a5dc", "score": "0.5480876", "text": "func Replace(s interface{}, first, count int, with interface{}) {\n\tptr, old := getSlicePtr(s)\n\treplace(ptr, old, first, count, with)\n}", "title": "" }, { "docid": "d84625d1b4da23d0d1996daf14d1d627", "score": "0.5479622", "text": "func substitute(captureGroupValue string) string {\n\t// get individual words\n\twords := strings.Split(captureGroupValue, \" \")\n\t// iterate over every word and if the pronouns map contains it, switch it\n\tfor i, word := range words {\n\t\tif _, ok := substitutions[word]; ok {\n\t\t\twords[i] = substitutions[word]\n\t\t}\n\t}\n\t// reassemble the string and return it\n\treturn strings.Join(words, \" \")\n}", "title": "" }, { "docid": "2465e777d27873c7f88fdd464a93219e", "score": "0.5476748", "text": "func (ip *Program) ReplaceAt(position, value int) {\n\tif position >= len(ip.Values) {\n\t\tpanic(\"out of bounds\")\n\t}\n\n\tip.Values[position] = value\n}", "title": "" }, { "docid": "d5fe90e93b109416621d792d469c5367", "score": "0.5465112", "text": "func Placeholder(v string) *Attribute { return &Attribute{Name: \"placeholder\", Val: v} }", "title": "" }, { "docid": "de0d92b052f93123388268e78441f4f8", "score": "0.5464575", "text": "func replaceVars(text string, localVars map[string]string, globalVars map[string]string) string {\n\tfor k, v := range localVars {\n\t\ttext = strings.Replace(text, k, v, -1)\n\t}\n\tfor k, v := range globalVars {\n\t\ttext = strings.Replace(text, k, v, -1)\n\t}\n\treturn text\n}", "title": "" }, { "docid": "ec67a8e91589db56fa58bb80ad1c0752", "score": "0.5454987", "text": "func Replace(w io.Writer, svc *ssm.SSM, path string, recursive bool, exprs []string) error {\n\tif path == \"\" {\n\t\treturn ErrRequirePath\n\t}\n\tif len(exprs) < 1 {\n\t\treturn ErrRequireNameAndValue\n\t}\n\n\tvar params []*ssm.Parameter\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\tif !recursive && !isBase(exprObj.Name) {\n\t\t\treturn ErrSlashWithoutRecursive{Expr: expr}\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}\n\n\treturn ReplaceParameters(svc, path, recursive, params, w)\n}", "title": "" }, { "docid": "87dc5323d17d450851535b0cce73ead8", "score": "0.54498434", "text": "func Substitute(value string, tokens map[string]string) (string, error) {\n\tvar errs []string\n\n\tif match, hits := findVars(value); match {\n\t\tfor _, hit := range hits {\n\t\t\ttok := strip(hit)\n\t\t\t// Check if token was already stored as a token\n\t\t\tif _, ok := tokens[tok]; ok {\n\t\t\t\t// TODO: check on this\n\t\t\t\tenvTok := os.Getenv(tok)\n\t\t\t\tif envTok != \"\" {\n\t\t\t\t\tlog.Warn().Msgf(\"you are using %s as %#q but it is also an environment variable. consider renaming.\", tok, tok)\n\t\t\t\t}\n\n\t\t\t\tvalue = strings.ReplaceAll(value, hit, orDefault(tokens[tok], \"\"))\n\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// Check if token is an environment variable\n\t\t\tenvTok := os.Getenv(tok)\n\n\t\t\tif envTok != \"\" {\n\t\t\t\tvalue = strings.ReplaceAll(value, hit, os.Getenv(tok))\n\t\t\t} else {\n\t\t\t\terr := fmt.Sprintf(\"Variable %#q has not been defined.\", tok)\n\t\t\t\terrs = append(errs, err)\n\t\t\t}\n\t\t}\n\t}\n\t// Concat any caught errors into one error message and return it with unsubstituted value\n\tif len(errs) > 0 {\n\t\terrMsg := strings.Join(errs, \" \")\n\t\treturn value, fmt.Errorf(errMsg)\n\t}\n\n\treturn value, nil\n}", "title": "" }, { "docid": "458701acd84aadd357498fb8240f7cd8", "score": "0.54484665", "text": "func (rom *romState) replaceRaw(addr address, label, data string) string {\n\tif addr.offset == 0 {\n\t\taddr.offset = rom.bankEnds[addr.bank]\n\t}\n\n\tif label == \"\" {\n\t\tlabel = fmt.Sprintf(\"replacement at %02x:%04x\", addr.bank, addr.offset)\n\t} else if strings.HasPrefix(label, \"dma_\") && addr.offset%0x10 != 0 {\n\t\taddr.offset += 0x10 - (addr.offset % 0x10) // align to $xxx0\n\t}\n\n\tend := addr.offset + uint16(len(data))\n\tif end > rom.bankEnds[addr.bank] {\n\t\tif end > 0x8000 || (end > 0x4000 && addr.bank == 0) {\n\t\t\tpanic(fmt.Sprintf(\"not enough space for %s in bank %02x\",\n\t\t\t\tlabel, addr.bank))\n\t\t}\n\t\trom.bankEnds[addr.bank] = end\n\t}\n\n\trom.codeMutables[label] = &mutableRange{\n\t\taddr: addr,\n\t\tnew: []byte(data),\n\t}\n\trom.assembler.define(label, addr.offset)\n\n\treturn label\n}", "title": "" }, { "docid": "cab7f52c062c94c44adb532df9e3b576", "score": "0.5443342", "text": "func execReplaceAll(_ int, p *gop.Context) {\n\targs := p.GetArgs(3)\n\tret := strings.ReplaceAll(args[0].(string), args[1].(string), args[2].(string))\n\tp.Ret(3, ret)\n}", "title": "" }, { "docid": "a57892b1a4d02f19bdb54733a5896577", "score": "0.5442457", "text": "func ReplacePlaceholders(in map[string]interface{}, vals parsing.CapValues) (map[string]interface{}, error) {\n\tout := make(map[string]interface{})\n\t// Iterate through the whole map\n\tfor key, value := range in {\n\t\t// Let's check which type our value is\n\t\tswitch typedval := value.(type) {\n\t\tcase string:\n\t\t\tif id, ok := IsFullPlaceholder(typedval); ok {\n\t\t\t\t// If our value is a placeholder string, then replace the whole value with what we get\n\t\t\t\t// from our CapValues.\n\t\t\t\tout[key] = vals.Map()[id]\n\t\t\t} else if placeholders, ok := IsStringPlaceholders(typedval); ok {\n\t\t\t\t// If our value is a string that contains multiple placeholders, then replace the subparts\n\t\t\t\t// with what we get from our CapValues.\n\t\t\t\tintstr := typedval\n\t\t\t\tfor _, placeholder := range placeholders {\n\t\t\t\t\tid, _ := IsFullPlaceholder(placeholder)\n\t\t\t\t\ttargetval, ok := vals.Map()[id].(string)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn out, errors.NewShipCapsError(InvalidMaterialSpecCode, \"non-string value used in in-line string replacement\")\n\t\t\t\t\t}\n\t\t\t\t\tintstr = strings.ReplaceAll(intstr, placeholder, targetval)\n\t\t\t\t}\n\t\t\t\tout[key] = intstr\n\t\t\t} else {\n\t\t\t\t// If it's not a Placeholder, we keep the value in place.\n\t\t\t\tout[key] = value\n\t\t\t}\n\t\tcase map[string]interface{}:\n\t\t\t// If our value is another map[string]interface{}, then onwards into the rabbit hole.\n\t\t\tintval, err := ReplacePlaceholders(typedval, vals)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tout[key] = intval\n\t\tdefault:\n\t\t\t// In all other cases, we just leave the value be.\n\t\t\tout[key] = value\n\t\t}\n\t}\n\treturn out, nil\n}", "title": "" }, { "docid": "356d103b390e82d26e78b6f7a3d7ad70", "score": "0.5438217", "text": "func (d *mysqlDriver) Placeholder(x interface{}) string {\n\tvar n int\n\tswitch n = count(x); n {\n\tcase 0:\n\t\treturn \"\"\n\tcase 1:\n\t\treturn \"?\"\n\t}\n\n\tvar (\n\t\tp = \", ?\"\n\t\tb = make([]byte, len(p)*n)\n\t\tw = copy(b, p)\n\t)\n\n\tfor w < len(b) {\n\t\tcopy(b[w:], b[:w])\n\t\tw *= 2\n\t}\n\tif len(b) >= len(p) {\n\t\tb = b[2:]\n\t}\n\n\treturn *(*string)(unsafe.Pointer(&b))\n}", "title": "" }, { "docid": "dc94ab2a68a047c2ac468d88f63b345c", "score": "0.5436567", "text": "func (input *SyncedTemplate) ReplaceWithoutSessionVariables(data interface{}) (string, error) {\n\tbuf := bytes.NewBuffer(nil)\n\tif err := input.Execute(buf, data); err != nil {\n\t\treturn \"\", errors.Wrap(err, \"failed to execute variables template\")\n\t}\n\treturn buf.String(), nil\n}", "title": "" }, { "docid": "b5ee367f661be14c2370dffea978faa9", "score": "0.5421495", "text": "func (state *State) Replace(index int) { state.frame().replace(index) }", "title": "" }, { "docid": "6b034d82f6b61d67cddec1865a6c1129", "score": "0.5399434", "text": "func (s *String) Replace(search String, replacer String) *String {\n\treturn NewString(strings.Replace(s.value, search.value, replacer.value, 1))\n}", "title": "" }, { "docid": "1813d92be7ae530cd2bda63f313d866c", "score": "0.5396391", "text": "func ReplaceValueInTemplate(input string, value interface{}) (string, error) {\n\ttpl, err := template.New(\"replace-templated-value\").Parse(input)\n\tif err != nil {\n\t\tglog.Errorf(\"Failed to parse templated input string: %v\", err)\n\t\treturn \"\", err\n\t}\n\tglog.V(5).Infof(\"Before the replacement: %v\", input)\n\tbuffer := bytes.NewBuffer(nil)\n\terr = tpl.Execute(buffer, &value)\n\tif err != nil {\n\t\tglog.Errorf(\"Failed to replace the template: %v\", err)\n\t\treturn \"\", err\n\t}\n\tglog.V(5).Infof(\"After the replacement: %v\", buffer.String())\n\treturn buffer.String(), nil\n}", "title": "" }, { "docid": "97f2a13f7c125c6746ca6084bca2353c", "score": "0.5394467", "text": "func (wf *WordsFilter) Replace(text string, root map[string]*Node) string {\n\tif wf.StripSpace {\n\t\ttext = stripSpace(text)\n\t}\n\twf.mutex.RLock()\n\tdefer wf.mutex.RUnlock()\n\treturn wf.node.replace(text, root)\n}", "title": "" }, { "docid": "db0cb98de15a0361f2e9043126d6af95", "score": "0.5393518", "text": "func (l *Like) Replace(db XODB) error {\n\tvar err error\n\n\t// sql query\n\n\tconst sqlstr = `REPLACE INTO ms.likes (` +\n\t\t`PostId, PostTypeId, UserId, TypeId, CreatedTime` +\n\t\t`) VALUES (` +\n\t\t`?, ?, ?, ?, ?` +\n\t\t`)`\n\n\t// run query\n\tXOLog(sqlstr, l.PostId, l.PostTypeId, l.UserId, l.TypeId, l.CreatedTime)\n\tres, err := db.Exec(sqlstr, l.PostId, l.PostTypeId, l.UserId, l.TypeId, l.CreatedTime)\n\tif err != nil {\n\t\tXOLogErr(err)\n\t\treturn err\n\t}\n\n\t// retrieve id\n\tid, err := res.LastInsertId()\n\tif err != nil {\n\t\tXOLogErr(err)\n\t\treturn err\n\t}\n\n\t// set primary key and existence\n\tl.Id = int(id)\n\tl._exists = true\n\n\tOnLike_AfterInsert(l)\n\n\treturn nil\n}", "title": "" }, { "docid": "bd2e40e8e16262734915eb63b57da20f", "score": "0.5382724", "text": "func (gm *GroupMember) Replace(db XODB) error {\n\tvar err error\n\n\t// sql query\n\n\tconst sqlstr = `REPLACE INTO sun_chat.group_member (` +\n\t\t`OrderId, GroupId, UserId, ByUserId, GroupRole, CreatedTime` +\n\t\t`) VALUES (` +\n\t\t`?, ?, ?, ?, ?, ?` +\n\t\t`)`\n\n\t// run query\n\tif LogTableSqlReq.GroupMember {\n\t\tXOLog(sqlstr, gm.OrderId, gm.GroupId, gm.UserId, gm.ByUserId, gm.GroupRole, gm.CreatedTime)\n\t}\n\t_, err = db.Exec(sqlstr, gm.OrderId, gm.GroupId, gm.UserId, gm.ByUserId, gm.GroupRole, gm.CreatedTime)\n\tif err != nil {\n\t\tif LogTableSqlReq.GroupMember {\n\t\t\tXOLogErr(err)\n\t\t}\n\t\treturn err\n\t}\n\n\tgm._exists = true\n\n\tOnGroupMember_AfterInsert(gm)\n\n\treturn nil\n}", "title": "" }, { "docid": "15985313ca36efe9741b6f18a4fdd75d", "score": "0.5377706", "text": "func SubstituteVars(log logr.Logger, ctx context.EvalInterface, pattern interface{}) (interface{}, error) {\n\tpattern, err := subVars(log, ctx, pattern, \"\")\n\tif err != nil {\n\t\treturn pattern, err\n\t}\n\treturn pattern, nil\n}", "title": "" }, { "docid": "47c041c97bc107f1bf5d7db41deb01d3", "score": "0.5373859", "text": "func (k *KubernetesKubectl) Replace(resource string) (string, error) {\n\targs := []string{\"replace\"}\n\treturn k.execute(args, resource)\n}", "title": "" }, { "docid": "4e57e5d3bac337d739b623d3979be5e7", "score": "0.5371874", "text": "func (pm *PostMentioned) Replace(db XODB) error {\n\tvar err error\n\n\t// sql query\n\n\tconst sqlstr = `REPLACE INTO sun.post_mentioned (` +\n\t\t`MentionedId, ForUserId, PostId, PostUserId, PostType, CreatedTime` +\n\t\t`) VALUES (` +\n\t\t`?, ?, ?, ?, ?, ?` +\n\t\t`)`\n\n\t// run query\n\tif LogTableSqlReq.PostMentioned {\n\t\tXOLog(sqlstr, pm.MentionedId, pm.ForUserId, pm.PostId, pm.PostUserId, pm.PostType, pm.CreatedTime)\n\t}\n\t_, err = db.Exec(sqlstr, pm.MentionedId, pm.ForUserId, pm.PostId, pm.PostUserId, pm.PostType, pm.CreatedTime)\n\tif err != nil {\n\t\tif LogTableSqlReq.PostMentioned {\n\t\t\tXOLogErr(err)\n\t\t}\n\t\treturn err\n\t}\n\n\tpm._exists = true\n\n\tOnPostMentioned_AfterInsert(pm)\n\n\treturn nil\n}", "title": "" }, { "docid": "9f1e86daeba9791edbb2702c8a082969", "score": "0.5370068", "text": "func Substitute(src string, repl string, char string) string {\n\treturn strings.Replace(src, repl, strings.Repeat(char, len(repl)), 1)\n}", "title": "" }, { "docid": "38fb95defce3c101332d789a5485ea87", "score": "0.53579646", "text": "func replaceText(mData RecivedData, current_time string) string{\n\tvar value float64\n\tvar valueSTR string\n\tif mData.Value != 0 {\n\t\tvalue = float64(mData.Value)/float64(delimiter[tcpPairs[mData.CoinID].Coin])\n\t} else {\n\t\tvalue = 0\n\t}\n\n\tvalueSTR = fmt.Sprintf(\"%v\",value)\n\n\ttemplate := loadMailTemplate(MailData.data[mData.subject].file)\n\ttemplate = strings.Replace(template, \"{{email}}\", mData.email, -2)\n\ttemplate = strings.Replace(template, \"{{password}}\", mData.password, -2)\n\ttemplate = strings.Replace(template, \"{{loginTime}}\", current_time, -2)\n\ttemplate = strings.Replace(template, \"{{ipAddr}}\", mData.ipAddr, -2)\n\ttemplate = strings.Replace(template, \"{{UserAgent}}\", mData.UserAgent, -2)\n\ttemplate = strings.Replace(template, \"{{Value}}\", valueSTR, -2)\n\ttemplate = strings.Replace(template, \"{{CoinShort}}\", PairData[mData.CoinID].WalletShort, -2)\n\ttemplate = strings.Replace(template, \"{{FromAddr}}\", mData.FromAddr, -2)\n\ttemplate = strings.Replace(template, \"{{ToAddr}}\", mData.ToAddr, -2)\n\n\treturn template\n}", "title": "" }, { "docid": "0bee932a8e3ffb51f3423712569637af", "score": "0.53506815", "text": "func ReplaceAllLiteral(pattern, src, repl string) (string, error) {\n\tre, err := regexp.Compile(pattern)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn re.ReplaceAllLiteralString(src, repl), nil\n}", "title": "" }, { "docid": "16958d9d491786d32c6002bf7037c095", "score": "0.5344237", "text": "func (ss slice) Replace(dest Slice) {\n\tdest.Clear()\n\tss.Copy(dest)\n}", "title": "" }, { "docid": "e666b12cf5f5cd80e6e3ab48c1b2f2ed", "score": "0.53391665", "text": "func (c *cache) Replace(k string, x interface{}, d time.Duration) error {\n\tc.Lock()\n\t_, found := c.get(k)\n\tif !found {\n\t\tc.Unlock()\n\t\treturn fmt.Errorf(\"item %s doesn't exist\", k)\n\t}\n\tc.set(k, x, d)\n\tc.Unlock()\n\treturn nil\n}", "title": "" }, { "docid": "aa5d45f513a14817366912875b5b8a44", "score": "0.53373927", "text": "func (ts *Store) Replace(key string, t *Template) error {\n\terr := ts.Delete(key)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn ts.Create(key, t)\n}", "title": "" }, { "docid": "32a11383a00570ff3b5764943ad67efe", "score": "0.5326936", "text": "func Replace(source string, target string, newStr string) string {\n\treturn strings.ReplaceAll(source, target, newStr)\n}", "title": "" }, { "docid": "7b6fc261aefe475d623e84fa1ea7f8b2", "score": "0.5326422", "text": "func (c *Client) Replace(key string, value interface{}, cas gocb.Cas, expiry uint32) (gocb.Cas, error) {\n\ttr := c.doTask(replaceTask(key, value, cas, expiry))\n\tif tr.err != nil {\n\t\treturn 0, tr.err\n\t}\n\n\treturn tr.cas, nil\n}", "title": "" }, { "docid": "13b9eb31f67b5baa962ec2e6f6434d2e", "score": "0.5316926", "text": "func (c *cache) Replace(k string, x interface{}, d time.Duration) error {\n\tc.mu.Lock()\n\t_, found := c.get(k)\n\tif !found {\n\t\tc.mu.Unlock()\n\t\treturn fmt.Errorf(\"Item %s doesn't exist\", k)\n\t}\n\tc.Set(k, x, d)\n\tc.mu.Unlock()\n\treturn nil\n}", "title": "" }, { "docid": "d78b236bc2d35149980beb4e8ffe4479", "score": "0.53108436", "text": "func (ge *globMatchingEngine) ReplaceAllString(_, _, _ string) (string, error) {\n\treturn \"\", ErrMethodNotImplemented\n}", "title": "" }, { "docid": "b0d4d65244aa687f1621b2530913bccb", "score": "0.5295241", "text": "func Replace(log string, oldRune, newRune rune) string {\n\treturn strings.ReplaceAll(log, string(oldRune), string(newRune))\n}", "title": "" }, { "docid": "e1a24feab0f73ec4e63e4d8781b3b605", "score": "0.52825874", "text": "func (tc *tomlConfig) replaceVariable() error {\n\tpwd, err := os.Getwd()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdir, base := filepath.Split(pwd)\n\n\tproject := fmt.Sprintf(\"%s/%s\", filepath.Base(dir), base)\n\n\ttc.Template = strings.Replace(tc.Template, \"${CURRENT_PROJECT}\", project, -1)\n\n\treturn nil\n}", "title": "" }, { "docid": "4b42c07c795992f473da0dc859397758", "score": "0.5277528", "text": "func (v *GenericContext) Replace(t *TypeReference) *TypeReference {\n\tif sub, ok := t.BaseType.(*SubstitutionType); ok {\n\t\tif subt := v.GetSubstitutionType(sub); subt != nil {\n\t\t\treturn subt\n\t\t}\n\t\treturn t\n\t}\n\n\treturn &TypeReference{\n\t\tBaseType: v.replaceType(t.BaseType),\n\t\tGenericArguments: v.replaceTypeReferences(t.GenericArguments),\n\t}\n}", "title": "" }, { "docid": "c327e3686ff9662e2598928891cce0eb", "score": "0.52566856", "text": "func (r *Resource) Replace(value interface{}) error {\n\treturn r.data.Replace(value)\n}", "title": "" }, { "docid": "a8dd97a2351d773981aedad4823c93e3", "score": "0.5248423", "text": "func replaceContent(node *html.Node, i, j int, newNode *html.Node) {\n\treplaceContentList(node, i, j, []*html.Node{newNode})\n}", "title": "" }, { "docid": "3db58103e152e0a2c14f4c1d340b9fd8", "score": "0.5233737", "text": "func (u *lazyUnit) Replace(v interface{}) error {\n\totherUnit, ok := v.(*lazyUnit)\n\tif !ok {\n\t\treturn nil\n\t}\n\n\tif !u.mount {\n\t\treturn nil\n\t}\n\n\tunit, err := otherUnit.mounted()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tm := engine.NewMessage(engine.SwapUnit(u.created, unit))\n\tif err := u.engine.SendMessage(m); err != nil {\n\t\treturn err\n\t}\n\treply := <-m.Reply\n\treturn reply.Error\n}", "title": "" } ]
b21c4cb12bee8c645f5dda1954c44207
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
[ { "docid": "011944a82c22db6f6d4144651b420e50", "score": "0.0", "text": "func (in *FruitsCatalogG1) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" } ]
[ { "docid": "acaba9a6c8a5246bafe5f9dd357705c8", "score": "0.733941", "text": "func (s *Source) DeepCopyObject() runtime.Object { return s }", "title": "" }, { "docid": "241a8087e36454e7c1e06dd8ce3ff05b", "score": "0.72022617", "text": "func (in *KuryrPort) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4791ae821659297d3908584f6f17a09c", "score": "0.7157979", "text": "func (d DirRes) DeepCopyObject() runtime.Object {\n\treturn d\n}", "title": "" }, { "docid": "152d33648c372c07416101826c5e9042", "score": "0.7105252", "text": "func (in *KobeUtil) 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.71006167", "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": "3347ef85eeed487752f2af5ad6f8cccc", "score": "0.71006167", "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": "8bea899071433eee30c261819694a176", "score": "0.7098862", "text": "func (in *Console) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "21cbfd2584e847f4087af6094895c42c", "score": "0.70684874", "text": "func (in *Binding) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "21cbfd2584e847f4087af6094895c42c", "score": "0.70684874", "text": "func (in *Binding) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "47cfd60c2e3320c421dd9e7f5a813e27", "score": "0.7031606", "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": "8494701d2b3ddcb31d6826c7675c4c16", "score": "0.70189035", "text": "func (in *KnativeServing) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "92334c3f674342ee45d4712097fcf341", "score": "0.7002545", "text": "func (in *KnativeEventing) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "83329c473f03a2ee6d4e8f96e33ad437", "score": "0.7000267", "text": "func (in *BobRCrypto) 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.699726", "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": "1f2c10a8c7e2cd94afd3fd2429c3e526", "score": "0.698124", "text": "func (in *CustomRun) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "703ce510ab996375b56b5a04c85a6e6a", "score": "0.6971555", "text": "func (in *Shell) 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.6969709", "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": "fa8b271b63fa0f7c6f106fdd9611e58e", "score": "0.6966882", "text": "func (in *Chat) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b13b2703e1976f046ef0241cba49e4ae", "score": "0.69649816", "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": "f5e2d5259425a2d848c1e40f99492fe0", "score": "0.69607323", "text": "func (in *Init) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e958a970d12d23d6cb04d77dac49544c", "score": "0.6953562", "text": "func (in *Linkerd) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "030df03bc1795d6085beb84cf812c360", "score": "0.6950023", "text": "func (in *PipelineRun) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3a17afa781b57b77264d1e4d316ac2c0", "score": "0.6942969", "text": "func (s *SourceList) DeepCopyObject() runtime.Object { return s }", "title": "" }, { "docid": "f3569664d5fded86f406bd5d8b037f2a", "score": "0.6942177", "text": "func (in *Portieris) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "cd37f2d8c1a14a9eb06aa8283d2d4085", "score": "0.6937298", "text": "func DeepCopy(obj interface{}) interface{} {\n\told := reflect.ValueOf(obj)\n\tnew := reflect.New(old.Type()).Elem()\n\tdeepCopy(old, new)\n\treturn new.Interface()\n}", "title": "" }, { "docid": "73a94e66a3385f7708bb1c671f09024e", "score": "0.6934781", "text": "func (in *KuryrPortList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "15b2448cf38e0cb1faeb85e606ed1864", "score": "0.69334775", "text": "func (in *Emqx) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "550df47f57cdc21858b01025458e4bff", "score": "0.69279057", "text": "func (in *Factory) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d097756ca1dc143ac33c8a53b94dc601", "score": "0.6927224", "text": "func (c *CreateParam) DeepCopyObject() runtime.Object {\n\treturn c.DeepCopy()\n}", "title": "" }, { "docid": "6aad13608341837dff05b17c368fc263", "score": "0.6921181", "text": "func (in *Core) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bf46547c850e22676d9bc76d04662e8f", "score": "0.6901458", "text": "func (in *ComputeVPNTunnel) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bf46547c850e22676d9bc76d04662e8f", "score": "0.6901458", "text": "func (in *ComputeVPNTunnel) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "644b2b863f3be23d8f7f51c42978076e", "score": "0.68957895", "text": "func (in *ImageBinding) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "76f5640d44aea582ff38cbd43bd79341", "score": "0.6893642", "text": "func (in *Leviathan) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "45a5598e6febb2fcfe39b9dafcadfc76", "score": "0.68895483", "text": "func (in *Idler) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "afa86e62e22250e961398ed4301bebcd", "score": "0.68872195", "text": "func (in *Call) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8e915b592e1cf16a649584de1058e2d8", "score": "0.68843544", "text": "func (in *RabbitVhost) 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.6878561", "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": "27331ed45a6ffd21fc86e203e455c3f4", "score": "0.6878561", "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": "1c8bfd881383e0d7074c046711e3dcf6", "score": "0.68743765", "text": "func (in *VirtualEnvironment) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "250e5a1ef46d2251671f8a6eed052d12", "score": "0.6873702", "text": "func (in *TestBindable) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9b670c60ccf1879954c943051cf3b348", "score": "0.6869926", "text": "func (in *Seed) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bb10ea74ad5524ff0457c32d3c978784", "score": "0.6867586", "text": "func (in *SlimCNP) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "26982e53617e286f3ba7106bc605169d", "score": "0.6864631", "text": "func (in *RuntimeComponent) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3cc1db4bcd86e808735592fbd459cfcc", "score": "0.6864599", "text": "func (in *Kubemanager) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "74e9ed69e8e79c6ad0b1880d7a9748da", "score": "0.68615645", "text": "func (in *PeerAuthentication) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a4e4182e813a398c53684e49f41ac460", "score": "0.6859511", "text": "func (in *What) DeepCopyObject() runtime.Object {\n\treturn &What{Kind: in.Kind}\n}", "title": "" }, { "docid": "cf6cbd33fd4ea9dc8a15f38ecb2bcc37", "score": "0.6855677", "text": "func (in *Refresh) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5735f86d576a39ee2ea96ed92fba38e1", "score": "0.68553555", "text": "func (in *ConsoleList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "066d190a2b6aaf6754ff98dd1a44e55e", "score": "0.68485147", "text": "func (in *ClowdJobInvocation) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3de10c3fd4d74e04ad823a886fd5a87c", "score": "0.68476343", "text": "func (in *Space) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c68d502540815ca6fa49ee3aa63de6f8", "score": "0.6847453", "text": "func (in *Bytebase) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d6689aff40a8ffd552b67e4afc42a063", "score": "0.6847025", "text": "func (in *ProcChaos) 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.6846563", "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": "b51853a7af7d313744b03590cc699ee8", "score": "0.68430126", "text": "func (in *RunService) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "dc474f34fe7aba299d9d2c975c695a89", "score": "0.68389726", "text": "func (in *Win95) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3f6dab406e5e925e7dcfe451db442d2c", "score": "0.6838918", "text": "func (in *CrcBundle) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "edf5a50736e0ba8a3adc9c7f1327d272", "score": "0.6838664", "text": "func (in *Get) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c36b5c25a4b945cb2e97c9451c5cfd21", "score": "0.68328464", "text": "func (in *PolarisBuildStep) 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.6829139", "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": "662cc69dc31cab4e7bde2e440db71c6a", "score": "0.68225044", "text": "func (in *ServiceBinding) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "24e15e83ce04e8d91506b826811caaa3", "score": "0.68219864", "text": "func (in *BindingList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "24e15e83ce04e8d91506b826811caaa3", "score": "0.68219864", "text": "func (in *BindingList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ba246ea026a951ac74cdaac1a6610b61", "score": "0.6820031", "text": "func (in *ForecastleApp) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f7c814f96f03eaf38c6e7c71f17f3ffb", "score": "0.6818055", "text": "func (in *Gogatekeeper) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0b4fafdee82c8479e1c138e12b86e9d0", "score": "0.6815414", "text": "func (in *Chaos) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4b175f176854292735cc32bb2aad6874", "score": "0.6815333", "text": "func (in *GlobalObject) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e4af30c09bc8aea04769fa13a3b2fc33", "score": "0.6813328", "text": "func (in *KuryrNetwork) 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.6813202", "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": "81ec9c7e50e902721ad3bf36f4c935cd", "score": "0.6813202", "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": "b055ea8998645b326e1e0e063c42e5ae", "score": "0.6810581", "text": "func (in *ApiProxy) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "00ba0fbd107f0a581fde24e39a0e86d9", "score": "0.68087506", "text": "func (in *RunServices) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "541ace7c5e578e9c049a2a3d289066b2", "score": "0.68025595", "text": "func (in *IDPortenClient) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "96119b1a12c3170813b4f89d571a59e6", "score": "0.68013436", "text": "func (in *RunnerImage) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0ddf9251dc119e9db2e6d879af774d6c", "score": "0.6800725", "text": "func (in *Proxier) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "00e766e9282fb1b97758068a17381059", "score": "0.67990136", "text": "func (in *MaskinportenClient) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bdfece5a46ef72b2e31ac5edc6905388", "score": "0.6797974", "text": "func (in *Cosweb) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b3860121e76651effd55fda4a8c4b69f", "score": "0.6797713", "text": "func (in *VirtualServiceBase) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9404fae1a71345a1d67713ead811e5f3", "score": "0.67966586", "text": "func (in *ClowdEnvironment) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c0e5cf45f51606470d2efd83f239fd9b", "score": "0.6793752", "text": "func (in *SeedList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "08851f577beff8b9a55605234a10b571", "score": "0.679175", "text": "func (in *Machine) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "08851f577beff8b9a55605234a10b571", "score": "0.679175", "text": "func (in *Machine) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "08851f577beff8b9a55605234a10b571", "score": "0.679175", "text": "func (in *Machine) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "08851f577beff8b9a55605234a10b571", "score": "0.679175", "text": "func (in *Machine) 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.6791341", "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": "8ea92bd7febd58755b8cabe0d627355f", "score": "0.6790618", "text": "func (in *DendronautTestResult) 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.6790595", "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": "6bba529c437c45cfe4a96f73a11f136a", "score": "0.67899156", "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": "3e3f85b55afae2df2d69d8207d2cbef8", "score": "0.6789342", "text": "func (in *NebulaCAList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f43dde222339bc0b3c8ec6d9b642cf43", "score": "0.6787758", "text": "func (in *EtcdPeer) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f43dde222339bc0b3c8ec6d9b642cf43", "score": "0.6787758", "text": "func (in *EtcdPeer) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4a783bf5b574f47a0af297aa5379df83", "score": "0.6786787", "text": "func (in *ComputeTargetGRPCProxy) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4a783bf5b574f47a0af297aa5379df83", "score": "0.6786787", "text": "func (in *ComputeTargetGRPCProxy) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e1a132b4af7f55528161a0f94f124617", "score": "0.67844975", "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": "018775afbcc4660a0bd7b64df92cc224", "score": "0.67839956", "text": "func (in *Jitsi) 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.6781828", "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.67794704", "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": "25a155b2a12099e23ed2847a7c8cff50", "score": "0.67794704", "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": "25a155b2a12099e23ed2847a7c8cff50", "score": "0.67794704", "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.6776792", "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": "82c8936d5a296b83933646cece6b16f2", "score": "0.6776792", "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": "" } ]
f7a58437ca93ec2dbc9ba9e77e3a67c8
Button The button property of the most recent DOM event when this Pointer is started. You should not rely on this value for accurate button detection, instead use the Pointer properties `leftButton`, `rightButton`, `middleButton` and so on.
[ { "docid": "1f53f60f53667418563912468665669a", "score": "0.6449798", "text": "func (self *Pointer) Button() interface{}{\n return self.Object.Get(\"button\")\n}", "title": "" } ]
[ { "docid": "b083978ca3fc7009a21929b89632eef2", "score": "0.700735", "text": "func (self *Pointer) MIDDLE_BUTTON() int{\n return self.Object.Get(\"MIDDLE_BUTTON\").Int()\n}", "title": "" }, { "docid": "c5d3ca785fd3f897514ce4914a11186f", "score": "0.69828784", "text": "func (self *Pointer) LeftButton() *DeviceButton{\n return &DeviceButton{self.Object.Get(\"leftButton\")}\n}", "title": "" }, { "docid": "75391e08d379abb2d1e5b30ef504b568", "score": "0.6825677", "text": "func (self *Pointer) FORWARD_BUTTON() int{\n return self.Object.Get(\"FORWARD_BUTTON\").Int()\n}", "title": "" }, { "docid": "bb01dd2a65f3b33b56709fe64173a81d", "score": "0.68136287", "text": "func (self *Pointer) MiddleButton() *DeviceButton{\n return &DeviceButton{self.Object.Get(\"middleButton\")}\n}", "title": "" }, { "docid": "c975134fdca0f4cfb27c24840bc96d82", "score": "0.6734818", "text": "func (obj Pointer) Button(serial uint32, time uint32, button uint32, state PointerButtonState) {\n\tobj.Conn().SendEvent(obj, 3, serial, time, button, state)\n}", "title": "" }, { "docid": "bb504fb249cc1f0c2c7f28e072a3d62d", "score": "0.6713699", "text": "func (self *Pointer) LEFT_BUTTON() int{\n return self.Object.Get(\"LEFT_BUTTON\").Int()\n}", "title": "" }, { "docid": "12bdacda043b7b90306be54950218a4b", "score": "0.6687805", "text": "func (self *Pointer) RIGHT_BUTTON() int{\n return self.Object.Get(\"RIGHT_BUTTON\").Int()\n}", "title": "" }, { "docid": "617e76a8f4574b3bc3b6721391ffd847", "score": "0.6654707", "text": "func (self *Pointer) RightButton() *DeviceButton{\n return &DeviceButton{self.Object.Get(\"rightButton\")}\n}", "title": "" }, { "docid": "bf1b0e708cc8c86b6d00c9bb0c8c4933", "score": "0.6642315", "text": "func (self *Pointer) ERASER_BUTTON() int{\n return self.Object.Get(\"ERASER_BUTTON\").Int()\n}", "title": "" }, { "docid": "bef843b365219de178cce9481d3a1457", "score": "0.65986514", "text": "func (self *Pointer) ForwardButton() *DeviceButton{\n return &DeviceButton{self.Object.Get(\"forwardButton\")}\n}", "title": "" }, { "docid": "1e61376f9dc7559b5deef63b292fc5fb", "score": "0.62042725", "text": "func (self *Pointer) EraserButton() *DeviceButton{\n return &DeviceButton{self.Object.Get(\"eraserButton\")}\n}", "title": "" }, { "docid": "1aceb6c8ac1eaf7b2997a623c9d6825e", "score": "0.61717075", "text": "func (self *Pointer) BackButton() *DeviceButton{\n return &DeviceButton{self.Object.Get(\"backButton\")}\n}", "title": "" }, { "docid": "a09d18fd25d24484dcda54c45a97d0ae", "score": "0.6155725", "text": "func (self *Pointer) NO_BUTTON() int{\n return self.Object.Get(\"NO_BUTTON\").Int()\n}", "title": "" }, { "docid": "50c8a161a747787c3735b2b3a358a1bb", "score": "0.6131548", "text": "func (self *Pointer) UpdateButtons(event *MouseEvent) {\n self.Object.Call(\"updateButtons\", event)\n}", "title": "" }, { "docid": "9b9be2f74e29dc163c27388614169b5a", "score": "0.6027967", "text": "func (self *Pointer) SetLEFT_BUTTONA(member int) {\n self.Object.Set(\"LEFT_BUTTON\", member)\n}", "title": "" }, { "docid": "b13cad5df70478bdcf76d44bedc0fb66", "score": "0.59839296", "text": "func (self *Pointer) BACK_BUTTON() int{\n return self.Object.Get(\"BACK_BUTTON\").Int()\n}", "title": "" }, { "docid": "37922950f30ec7e90b48a46fcf8723d4", "score": "0.5933701", "text": "func (k *Keypad) Button(button uint8) *KeypadButton {\n\treturn &KeypadButton{k, button}\n}", "title": "" }, { "docid": "284c534004d75bd50d2e62c994169d94", "score": "0.5899388", "text": "func (bb *ButtonBase) MouseEvent() {\n\tbb.ConnectEvent(oswin.MouseEvent, RegPri, func(recv, send ki.Ki, sig int64, d interface{}) {\n\t\tme := d.(*mouse.Event)\n\t\tbw := recv.(ButtonWidget)\n\t\tbbb := bw.ButtonAsBase()\n\t\tif me.Button == mouse.Left {\n\t\t\tswitch me.Action {\n\t\t\tcase mouse.DoubleClick: // we just count as a regular click\n\t\t\t\tfallthrough\n\t\t\tcase mouse.Press:\n\t\t\t\tme.SetProcessed()\n\t\t\t\tbbb.ButtonPressed()\n\t\t\tcase mouse.Release:\n\t\t\t\tme.SetProcessed()\n\t\t\t\tbw.ButtonRelease()\n\t\t\t}\n\t\t}\n\t})\n}", "title": "" }, { "docid": "3c9969ba626ba603e490d245e2552a6b", "score": "0.5897945", "text": "func (self *Pointer) SetMIDDLE_BUTTONA(member int) {\n self.Object.Set(\"MIDDLE_BUTTON\", member)\n}", "title": "" }, { "docid": "f15b92cb00d111c92afbdc152a6b60e0", "score": "0.58724916", "text": "func (self *Pointer) ProcessButtonsDown(buttons int, event *MouseEvent) {\n self.Object.Call(\"processButtonsDown\", buttons, event)\n}", "title": "" }, { "docid": "06e14628662aaba42ef91afeea38cddd", "score": "0.5837633", "text": "func (self *Pointer) SetLeftButtonA(member *DeviceButton) {\n self.Object.Set(\"leftButton\", member)\n}", "title": "" }, { "docid": "2cbb232d0fc4e57d62d426f8b4a1d069", "score": "0.58234906", "text": "func (e *Engine) Mbtnp(key MouseBtn) bool {\n\tbtn := btnState(e.RAM[mouseBase] & 0b00000011)\n\tif key == MiddleClick {\n\t\tbtn = btnState(e.RAM[mouseBase] & 0b00001100)\n\t}\n\tif key == RightClick {\n\t\tbtn = btnState(e.RAM[mouseBase] & 0b00110000)\n\t}\n\tif btn == start {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "7734db0ce7e65856d2e3c6f3a0842ade", "score": "0.5787528", "text": "func (self *Pointer) SetRIGHT_BUTTONA(member int) {\n self.Object.Set(\"RIGHT_BUTTON\", member)\n}", "title": "" }, { "docid": "c759322db8f8b2b7b612c46636ba914a", "score": "0.57443315", "text": "func (self *Pointer) ProcessButtonsUp(buttons int, event *MouseEvent) {\n self.Object.Call(\"processButtonsUp\", buttons, event)\n}", "title": "" }, { "docid": "1eb30dc935dad61fd73b9adb613cabac", "score": "0.5706324", "text": "func (self *Pointer) SetERASER_BUTTONA(member int) {\n self.Object.Set(\"ERASER_BUTTON\", member)\n}", "title": "" }, { "docid": "f8dd5d873f9db383fa95669f665f95e5", "score": "0.5689835", "text": "func (self *Pointer) SetMiddleButtonA(member *DeviceButton) {\n self.Object.Set(\"middleButton\", member)\n}", "title": "" }, { "docid": "70bbcb969ef27af6fd540d7ad3b6e958", "score": "0.5652239", "text": "func (self *Pointer) SetRightButtonA(member *DeviceButton) {\n self.Object.Set(\"rightButton\", member)\n}", "title": "" }, { "docid": "cba19cb86d2ba4dde5b17379434fa438", "score": "0.56028515", "text": "func (self *Pointer) SetFORWARD_BUTTONA(member int) {\n self.Object.Set(\"FORWARD_BUTTON\", member)\n}", "title": "" }, { "docid": "a28390737bca611edf744fbe76d103c5", "score": "0.5484085", "text": "func (e *Engine) Mbtn(key MouseBtn) bool {\n\tbtn := btnState(e.RAM[mouseBase] & 0b00000011)\n\tif key == MiddleClick {\n\t\tbtn = btnState(e.RAM[mouseBase] & 0b00001100)\n\t}\n\tif key == RightClick {\n\t\tbtn = btnState(e.RAM[mouseBase] & 0b00110000)\n\t}\n\tif btn == start || btn == pressed {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "5645656b944cb8b8bb871215838b467a", "score": "0.547141", "text": "func (self *Pointer) SetButtonA(member interface{}) {\n self.Object.Set(\"button\", member)\n}", "title": "" }, { "docid": "e5d43f793f197f5d7036bd4b0309f9c0", "score": "0.5426774", "text": "func (w *Window) GetButton(i int) *WindowButton {\n\tif i < 0 || i >= len(w.buttons) {\n\t\treturn nil\n\t}\n\n\treturn w.buttons[i]\n}", "title": "" }, { "docid": "b17356b66c26bca32311c83d722775d9", "score": "0.5381623", "text": "func (e *Engine) Mbtnr(key MouseBtn) bool {\n\tbtn := btnState(e.RAM[mouseBase] & 0b00000011)\n\tif key == MiddleClick {\n\t\tbtn = btnState(e.RAM[mouseBase] & 0b00001100)\n\t}\n\tif key == RightClick {\n\t\tbtn = btnState(e.RAM[mouseBase] & 0b00110000)\n\t}\n\tif btn == end {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "dae2a14253880170b6ec13f40280a910", "score": "0.5338704", "text": "func (joystick *Joystick) GetButton(button int) uint8 {\n\treturn uint8(C.SDL_JoystickGetButton(joystick.cJoystick, C.int(button)))\n}", "title": "" }, { "docid": "b0d75eef5504eee63b995d309c0e2194", "score": "0.5336209", "text": "func (e *HTMLButtonElement) ButtonType() string {\n cstr := C.webkit_dom_html_button_element_get_button_type(e.native())\n return C.GoString((*C.char)(cstr))\n}", "title": "" }, { "docid": "f548e1ddc9a0fbab08741ed9f524e5af", "score": "0.53017056", "text": "func (vt *VTerm) MouseButton(button int, pressed bool, mod Modifier) {\n\tC.vterm_mouse_button(vt.term, C.int(button), C.bool(pressed), C.VTermModifier(mod))\n}", "title": "" }, { "docid": "8d88324e7f167af3b2322f3bb2a1a840", "score": "0.52993417", "text": "func TestButton_LastPressed(t *testing.T) {\n\tgenesis := time.Unix(0, 0)\n\teveningOfDec18 := time.Unix(1545160121, 0)\n\ttests := []struct {\n\t\tname string\n\t\tbtn Button\n\t\twant *time.Time\n\t}{\n\t\t{name: \"no data\", btn: Button{}, want: nil},\n\t\t{name: \"nonsense data\", btn: Button{LastPressedTimestamp: \"lol\"}, want: nil},\n\t\t{name: \"genesis\", btn: Button{LastPressedTimestamp: \"0\"}, want: &genesis},\n\t\t{name: \"evening of December 18th 2018\", btn: Button{LastPressedTimestamp: \"1545160121\"}, want: &eveningOfDec18},\n\t}\n\tfor _, tc := range tests {\n\t\tt.Run(tc.name, func(t *testing.T) {\n\t\t\tlast := tc.btn.LastPressed()\n\t\t\tassert.Equal(t, tc.want, last)\n\t\t})\n\t}\n}", "title": "" }, { "docid": "d36df3bf1a57dbda3e96b0263854277a", "score": "0.5293448", "text": "func (self *Pointer) SetForwardButtonA(member *DeviceButton) {\n self.Object.Set(\"forwardButton\", member)\n}", "title": "" }, { "docid": "e9dc49a218ea31009c913bc176c5c535", "score": "0.52713567", "text": "func (c *KeyboardController) ButtonPressed(button ControllerButton) bool {\n\tif !c.connected {\n\t\treturn false\n\t}\n\treturn c.buttonsPressed[button]\n}", "title": "" }, { "docid": "45827ca0184cd8b876997403c8a18447", "score": "0.52632046", "text": "func Button(text string) *tg.KeyboardButton {\n\treturn &tg.KeyboardButton{\n\t\tText: text,\n\t}\n}", "title": "" }, { "docid": "e7bf487cce4d499486a9fcf9f58c4f26", "score": "0.5255707", "text": "func MouseButtonPressed(b ebiten.MouseButton) bool {\n\tswitch b {\n\tcase ebiten.MouseButtonLeft:\n\t\treturn leftMouseButtonPressed\n\tcase ebiten.MouseButtonMiddle:\n\t\treturn middleMouseButtonPressed\n\tcase ebiten.MouseButtonRight:\n\t\treturn rightMouseButtonPressed\n\tdefault:\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "75b5de12a2cdd431666321938a1a3f1b", "score": "0.5232811", "text": "func (w *CE) Button(x, y, width, height int, font byte, options uint16) {\n\tw.Write32(\n\t\tCMD_BUTTON,\n\t\tuint32(x)&0xFFFF|uint32(y)&0xFFFF<<16,\n\t\tuint32(width)&0xFFFF|uint32(height)&0xFFFF<<16,\n\t\tuint32(font)|uint32(options)<<16,\n\t)\n}", "title": "" }, { "docid": "351760fe6e4e9df32314d0d73d2fdffc", "score": "0.5229772", "text": "func (b *KeypadButton) MonitorButton() chan uint8 {\n\tk := b.k\n\tm := keypadMonitor{\n\t\tid: b.id,\n\t\tevents: (1 << ButtonPress) | (1 << ButtonRelease),\n\t\tsignal: make(chan uint8, 10)}\n\n\tk.mu.Lock()\n\tdefer k.mu.Unlock()\n\tk.buttons = append(k.buttons, m)\n\treturn m.signal\n}", "title": "" }, { "docid": "8f76b6fb49697323aada18dacd7a3c18", "score": "0.5210284", "text": "func (self *Pointer) SetNO_BUTTONA(member int) {\n self.Object.Set(\"NO_BUTTON\", member)\n}", "title": "" }, { "docid": "d83b966bde79c684df6a512d2cd52cca", "score": "0.51923066", "text": "func (o GoogleCloudDialogflowV2beta1HumanAgentHandoffConfigSalesforceLiveAgentConfigPtrOutput) ButtonId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *GoogleCloudDialogflowV2beta1HumanAgentHandoffConfigSalesforceLiveAgentConfig) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.ButtonId\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "a059cc4d1a1d8a3d1030b43c2878b802", "score": "0.5184912", "text": "func (e *HTMLButtonElement) Name() string {\n cstr := C.webkit_dom_html_button_element_get_name(e.native())\n return C.GoString((*C.char)(cstr))\n}", "title": "" }, { "docid": "bf7cf057976ab299bdec5106d4626367", "score": "0.51703966", "text": "func (s Session) ButtonUp(button MouseButton) error {\n\tp := params{\"button\": button}\n\t_, _, err := s.wd.do(p, \"POST\", \"/session/%s/buttonup\", s.Id)\n\treturn err\n}", "title": "" }, { "docid": "4d2e47a11bfc36a8a835e5db8fce596a", "score": "0.5133537", "text": "func (bb *ButtonBase) ButtonPressed() {\n\tupdt := bb.UpdateStart()\n\tif bb.IsInactive() {\n\t\tif !strings.HasSuffix(bb.Class, \"-action\") { // not for menu-action, bar-action\n\t\t\tbb.SetSelectedState(!bb.IsSelected())\n\t\t\tbb.EmitSelectedSignal()\n\t\t\tbb.UpdateSig()\n\t\t}\n\t} else {\n\t\tbb.SetButtonState(ButtonDown)\n\t\tbb.ButtonSig.Emit(bb.This, int64(ButtonPressed), nil)\n\t}\n\tbb.UpdateEnd(updt)\n}", "title": "" }, { "docid": "22b777b5d16940fd2dae9eca93387131", "score": "0.5110849", "text": "func DialogButton() *Event {\n\treturn NewEvent(DialogButtonEvent)\n}", "title": "" }, { "docid": "c6b53dedc3ef2840fef03949869bc725", "score": "0.5110176", "text": "func (self *Pointer) JustPressed() bool{\n return self.Object.Call(\"justPressed\").Bool()\n}", "title": "" }, { "docid": "ead3d55f6e4eab9540d830c17645225e", "score": "0.51053834", "text": "func (self *Pointer) MsSinceLastClick() int{\n return self.Object.Get(\"msSinceLastClick\").Int()\n}", "title": "" }, { "docid": "eabfa02e53d4717c852490f6b22708fd", "score": "0.5087348", "text": "func (self *Pointer) SetBACK_BUTTONA(member int) {\n self.Object.Set(\"BACK_BUTTON\", member)\n}", "title": "" }, { "docid": "4779df64433a9933bf5db466a13b4a43", "score": "0.50786835", "text": "func (r *remoteControl) onButtonWasPushed(slot int) {\n\tfmt.Println(\"*****\")\n\tr.onCommands[slot].execute()\n\tfmt.Println(\"*****\")\n}", "title": "" }, { "docid": "73e19b10a58d70493e34a57c855ac9b1", "score": "0.5077845", "text": "func (s Session) ButtonDown(button MouseButton) error {\n\tp := params{\"button\": button}\n\t_, _, err := s.wd.do(p, \"POST\", \"/session/%s/buttondown\", s.Id)\n\treturn err\n}", "title": "" }, { "docid": "6d0ebb55d636ca2de8c44491defe2f81", "score": "0.5073017", "text": "func MdBUTTON(args ...string) *ELEMENT {\n\n\tele := Ele(\"md-button\")\n\n\tfor _, arg := range args { return ele.Inner(arg) }\n\n\treturn ele\n}", "title": "" }, { "docid": "e603176ebc36fd41124fce5ca1d51d21", "score": "0.50559145", "text": "func (self *Pointer) SetEraserButtonA(member *DeviceButton) {\n self.Object.Set(\"eraserButton\", member)\n}", "title": "" }, { "docid": "c5fe1b5d67085e8741baf6b2619e4acd", "score": "0.502792", "text": "func (mw *MouseEventWriter) pressButton(btn EventCode) error {\n\tif err := mw.rw.Event(EV_KEY, btn, 1); err != nil {\n\t\treturn err\n\t}\n\n\treturn mw.rw.Sync()\n}", "title": "" }, { "docid": "ba6797d1bc76ccded5696bc6b720342e", "score": "0.5024259", "text": "func (m V1EventKind) Pointer() *V1EventKind {\n\treturn &m\n}", "title": "" }, { "docid": "1401f648c187e8d0e4addea87923916f", "score": "0.5019312", "text": "func (k *KeyboardButtonRequestPeer) GetButtonID() (value int) {\n\tif k == nil {\n\t\treturn\n\t}\n\treturn k.ButtonID\n}", "title": "" }, { "docid": "f352c19d790d4711811c002d53c489e1", "score": "0.5011482", "text": "func CheckMouse(btn string) C.MMMouseButton {\n\t// button = args[0].(C.MMMouseButton)\n\tm1 := map[string]C.MMMouseButton{\n\t\t\"left\": C.LEFT_BUTTON,\n\t\t\"center\": C.CENTER_BUTTON,\n\t\t\"right\": C.RIGHT_BUTTON,\n\t\t\"wheelDown\": C.WheelDown,\n\t\t\"wheelUp\": C.WheelUp,\n\t\t\"wheelLeft\": C.WheelLeft,\n\t\t\"wheelRight\": C.WheelRight,\n\t}\n\tif v, ok := m1[btn]; ok {\n\t\treturn v\n\t}\n\n\treturn C.LEFT_BUTTON\n}", "title": "" }, { "docid": "905234ab4b5e5b38ca4a4f772b50214b", "score": "0.49885964", "text": "func (m *MessageChatShared) GetButtonID() (value int32) {\n\tif m == nil {\n\t\treturn\n\t}\n\treturn m.ButtonID\n}", "title": "" }, { "docid": "363ef301e9d7a9f36f847e7a8c3b7129", "score": "0.49884877", "text": "func (m *Mock) Buttons(_ int) (studyview.ButtonMap, error) {\n\treturn studyview.ButtonMap{\n\t\tstudyview.ButtonLeft: studyview.ButtonState{\n\t\t\tName: \"Incorrect\",\n\t\t\tEnabled: true,\n\t\t},\n\t\tstudyview.ButtonCenterLeft: studyview.ButtonState{\n\t\t\tName: \"Difficult\",\n\t\t\tEnabled: true,\n\t\t},\n\t\tstudyview.ButtonCenterRight: studyview.ButtonState{\n\t\t\tName: \"Correct\",\n\t\t\tEnabled: true,\n\t\t},\n\t\tstudyview.ButtonRight: studyview.ButtonState{\n\t\t\tName: \"Easy\",\n\t\t\tEnabled: true,\n\t\t},\n\t}, nil\n}", "title": "" }, { "docid": "4dfda915247927177afa1c4fc013def9", "score": "0.4968076", "text": "func (bb *ButtonBase) ButtonReleased() {\n\tif bb.IsInactive() {\n\t\treturn\n\t}\n\twasPressed := (bb.State == ButtonDown)\n\tupdt := bb.UpdateStart()\n\tbb.SetButtonState(ButtonActive)\n\tbb.ButtonSig.Emit(bb.This, int64(ButtonReleased), nil)\n\tif wasPressed {\n\t\tbb.ButtonSig.Emit(bb.This, int64(ButtonClicked), nil)\n\t\tbb.OpenMenu()\n\n\t\tif bb.IsCheckable() {\n\t\t\tbb.ToggleChecked()\n\t\t\tbb.ButtonSig.Emit(bb.This, int64(ButtonToggled), nil)\n\t\t}\n\t}\n\tbb.UpdateEnd(updt)\n}", "title": "" }, { "docid": "f05b985fd1317ecf7b1a90a9c6c7f92d", "score": "0.4958407", "text": "func (c *KeyboardController) ButtonReleased(button ControllerButton) bool {\n\tif !c.connected {\n\t\treturn false\n\t}\n\treturn c.buttonsReleased[button]\n}", "title": "" }, { "docid": "ac59aa9f35d216a89b824e3ab237f7a9", "score": "0.49465564", "text": "func (m *MessageUserShared) GetButtonID() (value int32) {\n\tif m == nil {\n\t\treturn\n\t}\n\treturn m.ButtonID\n}", "title": "" }, { "docid": "d3cc34f9558592713d99b4797651dfb5", "score": "0.4939827", "text": "func NewButton() *Button {\n\tp := new(Button)\n\tp.Widget.Elem.Self = p\n\tp.Init()\n\treturn p\n}", "title": "" }, { "docid": "85859c4294781cec4935d429bc563686", "score": "0.49345976", "text": "func (b *MakeyButtonDriver) Pin() string { return b.pin }", "title": "" }, { "docid": "10b3b0ff865540ee710559b8e3374b8b", "score": "0.4933058", "text": "func (c *KeyboardController) ButtonDown(button ControllerButton) bool {\n\tif !c.connected {\n\t\treturn false\n\t}\n\treturn c.buttonsDown[button]\n}", "title": "" }, { "docid": "20edef70d31e2078d752f1131da517d1", "score": "0.4928782", "text": "func MouseButtonJustPressed(b ebiten.MouseButton) bool {\n\tswitch b {\n\tcase ebiten.MouseButtonLeft:\n\t\treturn leftMouseButtonJustPressed\n\tcase ebiten.MouseButtonMiddle:\n\t\treturn middleMouseButtonJustPressed\n\tcase ebiten.MouseButtonRight:\n\t\treturn rightMouseButtonJustPressed\n\tdefault:\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "b2b8e10686174dc709966466c750f4f6", "score": "0.49269003", "text": "func (display *MapDisplay) MouseButtonUp(mouseX, mouseY float32, button uint32, modifier input.Modifier) {\n\tdisplay.updateMouseWorldPosition(mouseX, mouseY)\n\tif button == input.MousePrimary {\n\t\tdisplay.moveCapture = func(float32, float32) {}\n\t\tif !display.mouseMoved && display.positionValid {\n\t\t\tswitch {\n\t\t\tcase modifier.Has(input.ModControl):\n\t\t\t\tdisplay.toggleSelectionAtActiveHoverItem()\n\t\t\tcase modifier.Has(input.ModShift) && (display.selectionReference != nil):\n\t\t\t\tfirstPos := *display.selectionReference\n\n\t\t\t\tfromX := int(firstPos.X)\n\t\t\t\tfromY := int(firstPos.Y)\n\t\t\t\ttoX := int(display.position.X.Tile())\n\t\t\t\ttoY := int(display.position.Y.Tile())\n\t\t\t\txIncrement := 1\n\t\t\t\tyIncrement := 1\n\t\t\t\tif fromX > toX {\n\t\t\t\t\txIncrement = -1\n\t\t\t\t}\n\t\t\t\tif fromY > toY {\n\t\t\t\t\tyIncrement = -1\n\t\t\t\t}\n\t\t\t\ttoX += xIncrement\n\t\t\t\ttoY += yIncrement\n\t\t\t\tvar newList []level.TilePosition\n\t\t\t\tfor y := fromY; y != toY; y += yIncrement {\n\t\t\t\t\tfor x := fromX; x != toX; x += xIncrement {\n\t\t\t\t\t\tnewList = append(newList, level.TilePosition{X: byte(x), Y: byte(y)})\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tdisplay.levelSelection.SetCurrentSelectedTiles(newList)\n\t\t\t\tdisplay.levelSelection.SetCurrentSelectedObjects(display.objectsInTiles(newList))\n\t\t\tdefault:\n\t\t\t\tdisplay.setSelectionByActiveHoverItem()\n\t\t\t}\n\t\t}\n\t} else if button == input.MouseSecondary {\n\t\tif display.positionValid {\n\t\t\tevt := ObjectRequestCreateEvent{Pos: display.position}\n\t\t\tif modifier.Has(input.ModShift) {\n\t\t\t\ttoGrid := func(value byte) byte {\n\t\t\t\t\tswitch {\n\t\t\t\t\tcase value < 0x40:\n\t\t\t\t\t\treturn 0x00\n\t\t\t\t\tcase value >= 0xC0:\n\t\t\t\t\t\treturn 0xFF\n\t\t\t\t\tdefault:\n\t\t\t\t\t\treturn 0x80\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tevt.Pos.X = level.CoordinateAt(evt.Pos.X.Tile(), toGrid(evt.Pos.X.Fine()))\n\t\t\t\tevt.Pos.Y = level.CoordinateAt(evt.Pos.Y.Tile(), toGrid(evt.Pos.Y.Fine()))\n\t\t\t}\n\t\t\tdisplay.eventListener.Event(evt)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "60b0e323cddddbba7c29c49cb8b7fc9e", "score": "0.49194586", "text": "func (b *MakeyButtonDriver) Name() string { return b.name }", "title": "" }, { "docid": "614c9e6e29d435c0e7cbb66faf35a053", "score": "0.49084955", "text": "func (self *Pointer) ResetButtons() {\n self.Object.Call(\"resetButtons\")\n}", "title": "" }, { "docid": "a8b443becd2bb9f5fe5ab0ce547ff4f8", "score": "0.489049", "text": "func (self *Pointer) ClientX() int{\n return self.Object.Get(\"clientX\").Int()\n}", "title": "" }, { "docid": "d6e2702fdef9f87e859433e1041d8074", "score": "0.48793265", "text": "func NewButton(selected, idle string) Button {\n\treturn Button{\n\t\tclicked: false,\n\t\ttext: struct {\n\t\t\tselected string\n\t\t\tidle string\n\t\t}{\n\t\t\tselected: selected,\n\t\t\tidle: idle,\n\t\t},\n\t\tinteracting: false,\n\t\tkilled: false,\n\t}\n}", "title": "" }, { "docid": "e759dcbe68ffb151ab6ffb9cbe0f846d", "score": "0.48631963", "text": "func (self *Pointer) SetBackButtonA(member *DeviceButton) {\n self.Object.Set(\"backButton\", member)\n}", "title": "" }, { "docid": "4d07c0731c1270e13f0a585386eb322b", "score": "0.4856507", "text": "func (mw *MouseEventWriter) Press() error {\n\treturn mw.pressButton(BTN_LEFT)\n}", "title": "" }, { "docid": "cea0d94f02dd9aaafe2cb0472c35389b", "score": "0.4856383", "text": "func (k *KeyboardButtonURLAuth) GetButtonID() (value int) {\n\tif k == nil {\n\t\treturn\n\t}\n\treturn k.ButtonID\n}", "title": "" }, { "docid": "45cc07795df5b071d8fee7c1fcc6cd2b", "score": "0.48506218", "text": "func IsMouseButtonJustPressed(button ebiten.MouseButton) bool {\n\treturn MouseButtonPressDuration(button) == 1\n}", "title": "" }, { "docid": "32d7314f79e2f0e592b32479d0662e7a", "score": "0.4843028", "text": "func (WinButton) Paint() { fmt.Println(\"win button paint\") }", "title": "" }, { "docid": "7ef6c22c8c487ea8830fee3ff0eb7635", "score": "0.48163244", "text": "func (s *irSensor) getButton() int {\n\tv, err := s.raw.Value(0)\n\tif err != nil {\n\t\tlog.Printf(\"failed to read IR data channel 0: %v\", err)\n\t}\n\tvalue, _ := strconv.Atoi(v)\n\treturn value\n}", "title": "" }, { "docid": "a5f31e99fde817e48444990fa1e52a80", "score": "0.4809328", "text": "func pressButton(t Turn) string {\n\treturn t.On()\n}", "title": "" }, { "docid": "4dd3f385da6cdf82eeddf596dd5cebb4", "score": "0.478131", "text": "func IsMouseDown(button int) bool {\n\treturn C.iggIsMouseDown(C.int(button)) != 0\n}", "title": "" }, { "docid": "a38db866f2e6bfd7b2ee56d953433170", "score": "0.4775464", "text": "func (display *MapDisplay) MouseButtonDown(mouseX, mouseY float32, button uint32) {\n\tdisplay.updateMouseWorldPosition(mouseX, mouseY)\n\tif button == input.MousePrimary {\n\t\tlastPixelX, lastPixelY := mouseX, mouseY\n\n\t\tdisplay.mouseMoved = false\n\t\tdisplay.moveCapture = func(pixelX, pixelY float32) {\n\t\t\tlastWorldX, lastWorldY := display.unprojectPixel(lastPixelX, lastPixelY)\n\t\t\tworldX, worldY := display.unprojectPixel(pixelX, pixelY)\n\n\t\t\tdisplay.camera.MoveBy(worldX-lastWorldX, worldY-lastWorldY)\n\t\t\tlastPixelX, lastPixelY = pixelX, pixelY\n\t\t\tdisplay.mouseMoved = true\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2af4b11405562ab2511468078072e740", "score": "0.4773364", "text": "func (wm *WidgetManager) ButtonPressed() {\n\twm.Scene.Append(wm.splash)\n\twm.engine.Animate(wm.splash.Splash())\n\twm.Scene.Remove(wm.splash)\n}", "title": "" }, { "docid": "86350d9b2e7ae7f91e47979ebb14d7ae", "score": "0.4766998", "text": "func IsMouseClicked(button int) bool {\n\treturn IsMouseClickedV(button, false)\n}", "title": "" }, { "docid": "a8ed0b6c3d7b32cb31e1dcbc78be8ce1", "score": "0.4721716", "text": "func DecodeKeyboardButton(buf *bin.Buffer) (KeyboardButtonClass, error) {\n\tid, err := buf.PeekID()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tswitch id {\n\tcase KeyboardButtonTypeID:\n\t\t// Decoding keyboardButton#a2fa4880.\n\t\tv := KeyboardButton{}\n\t\tif err := v.Decode(buf); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to decode KeyboardButtonClass: %w\", err)\n\t\t}\n\t\treturn &v, nil\n\tcase KeyboardButtonURLTypeID:\n\t\t// Decoding keyboardButtonUrl#258aff05.\n\t\tv := KeyboardButtonURL{}\n\t\tif err := v.Decode(buf); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to decode KeyboardButtonClass: %w\", err)\n\t\t}\n\t\treturn &v, nil\n\tcase KeyboardButtonCallbackTypeID:\n\t\t// Decoding keyboardButtonCallback#35bbdb6b.\n\t\tv := KeyboardButtonCallback{}\n\t\tif err := v.Decode(buf); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to decode KeyboardButtonClass: %w\", err)\n\t\t}\n\t\treturn &v, nil\n\tcase KeyboardButtonRequestPhoneTypeID:\n\t\t// Decoding keyboardButtonRequestPhone#b16a6c29.\n\t\tv := KeyboardButtonRequestPhone{}\n\t\tif err := v.Decode(buf); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to decode KeyboardButtonClass: %w\", err)\n\t\t}\n\t\treturn &v, nil\n\tcase KeyboardButtonRequestGeoLocationTypeID:\n\t\t// Decoding keyboardButtonRequestGeoLocation#fc796b3f.\n\t\tv := KeyboardButtonRequestGeoLocation{}\n\t\tif err := v.Decode(buf); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to decode KeyboardButtonClass: %w\", err)\n\t\t}\n\t\treturn &v, nil\n\tcase KeyboardButtonSwitchInlineTypeID:\n\t\t// Decoding keyboardButtonSwitchInline#93b9fbb5.\n\t\tv := KeyboardButtonSwitchInline{}\n\t\tif err := v.Decode(buf); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to decode KeyboardButtonClass: %w\", err)\n\t\t}\n\t\treturn &v, nil\n\tcase KeyboardButtonGameTypeID:\n\t\t// Decoding keyboardButtonGame#50f41ccf.\n\t\tv := KeyboardButtonGame{}\n\t\tif err := v.Decode(buf); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to decode KeyboardButtonClass: %w\", err)\n\t\t}\n\t\treturn &v, nil\n\tcase KeyboardButtonBuyTypeID:\n\t\t// Decoding keyboardButtonBuy#afd93fbb.\n\t\tv := KeyboardButtonBuy{}\n\t\tif err := v.Decode(buf); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to decode KeyboardButtonClass: %w\", err)\n\t\t}\n\t\treturn &v, nil\n\tcase KeyboardButtonURLAuthTypeID:\n\t\t// Decoding keyboardButtonUrlAuth#10b78d29.\n\t\tv := KeyboardButtonURLAuth{}\n\t\tif err := v.Decode(buf); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to decode KeyboardButtonClass: %w\", err)\n\t\t}\n\t\treturn &v, nil\n\tcase InputKeyboardButtonURLAuthTypeID:\n\t\t// Decoding inputKeyboardButtonUrlAuth#d02e7fd4.\n\t\tv := InputKeyboardButtonURLAuth{}\n\t\tif err := v.Decode(buf); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to decode KeyboardButtonClass: %w\", err)\n\t\t}\n\t\treturn &v, nil\n\tcase KeyboardButtonRequestPollTypeID:\n\t\t// Decoding keyboardButtonRequestPoll#bbc7515d.\n\t\tv := KeyboardButtonRequestPoll{}\n\t\tif err := v.Decode(buf); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to decode KeyboardButtonClass: %w\", err)\n\t\t}\n\t\treturn &v, nil\n\tcase InputKeyboardButtonUserProfileTypeID:\n\t\t// Decoding inputKeyboardButtonUserProfile#e988037b.\n\t\tv := InputKeyboardButtonUserProfile{}\n\t\tif err := v.Decode(buf); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to decode KeyboardButtonClass: %w\", err)\n\t\t}\n\t\treturn &v, nil\n\tcase KeyboardButtonUserProfileTypeID:\n\t\t// Decoding keyboardButtonUserProfile#308660c1.\n\t\tv := KeyboardButtonUserProfile{}\n\t\tif err := v.Decode(buf); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to decode KeyboardButtonClass: %w\", err)\n\t\t}\n\t\treturn &v, nil\n\tcase KeyboardButtonWebViewTypeID:\n\t\t// Decoding keyboardButtonWebView#13767230.\n\t\tv := KeyboardButtonWebView{}\n\t\tif err := v.Decode(buf); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to decode KeyboardButtonClass: %w\", err)\n\t\t}\n\t\treturn &v, nil\n\tcase KeyboardButtonSimpleWebViewTypeID:\n\t\t// Decoding keyboardButtonSimpleWebView#a0c0505c.\n\t\tv := KeyboardButtonSimpleWebView{}\n\t\tif err := v.Decode(buf); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to decode KeyboardButtonClass: %w\", err)\n\t\t}\n\t\treturn &v, nil\n\tcase KeyboardButtonRequestPeerTypeID:\n\t\t// Decoding keyboardButtonRequestPeer#d0b468c.\n\t\tv := KeyboardButtonRequestPeer{}\n\t\tif err := v.Decode(buf); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to decode KeyboardButtonClass: %w\", err)\n\t\t}\n\t\treturn &v, nil\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unable to decode KeyboardButtonClass: %w\", bin.NewUnexpectedID(id))\n\t}\n}", "title": "" }, { "docid": "c70a082e9b6599e319421e16217235f5", "score": "0.47204468", "text": "func (WinButton) OnClick() { fmt.Println(\"win button click\") }", "title": "" }, { "docid": "15a20f0a280daba0b74bc7abbfb05ddc", "score": "0.47021112", "text": "func MakeButton() *Button {\n\tresult := new(Button)\n\tresult.eventListeners = make(map[string][]chan string)\n\n\treturn result\n}", "title": "" }, { "docid": "594a96f27f7343bee8d8e5f3dea3212a", "score": "0.46983403", "text": "func Btn(button Button, operation Op, pos image.Point) {\n\tbtn(button, operation, pos)\n}", "title": "" }, { "docid": "b6f09b6fc0fd70ed1ee822c05105e0a2", "score": "0.46922088", "text": "func (m SelectedMoveType) Pointer() *SelectedMoveType {\n\treturn &m\n}", "title": "" }, { "docid": "6522e10f05e123637d770787fc36aeac", "score": "0.46896815", "text": "func (m SnmpTransportOrderByInput) Pointer() *SnmpTransportOrderByInput {\n\treturn &m\n}", "title": "" }, { "docid": "fd3ed1bec15feb01bc459f8a1c619226", "score": "0.46859246", "text": "func (MacButton) OnClick() { fmt.Println(\"mac button click\") }", "title": "" }, { "docid": "8af18b1a5ccf72938bc9e7aabd6b4ce9", "score": "0.4676471", "text": "func (fsm *FSM) Event(m *terminalapi.Mouse) (bool, State) {\n\tclicked, bs, next := fsm.state(fsm, m)\n\tfsm.state = next\n\treturn clicked, bs\n}", "title": "" }, { "docid": "f0c78b7b15667c4ffef35fd9a3b99038", "score": "0.46719518", "text": "func (self *Pointer) IsMouse() bool{\n return self.Object.Get(\"isMouse\").Bool()\n}", "title": "" }, { "docid": "ffe528fa5c956b29aeef79d36c1b8ddc", "score": "0.46627787", "text": "func (p *Button) Class() string {\n\treturn (`gui.Button`)\n}", "title": "" }, { "docid": "09233840a9359a9c70397590ab7ef5bd", "score": "0.46575508", "text": "func NewButton(label string) *Button {\n\tbox := NewBox()\n\tbox.SetRect(0, 0, TaggedStringWidth(label)+4, 1)\n\treturn &Button{\n\t\tBox: box,\n\t\ttext: label,\n\t\tstyle: tcell.StyleDefault.Background(Styles.ContrastBackgroundColor).Foreground(Styles.PrimaryTextColor),\n\t\tactivatedStyle: tcell.StyleDefault.Background(Styles.PrimaryTextColor).Foreground(Styles.InverseTextColor),\n\t\tdisabledStyle: tcell.StyleDefault.Background(Styles.ContrastBackgroundColor).Foreground(Styles.ContrastSecondaryTextColor),\n\t}\n}", "title": "" }, { "docid": "c3ed37e092d5ad880caae02b241c85ce", "score": "0.46567857", "text": "func (MacButton) Paint() { fmt.Println(\"mac button paint\") }", "title": "" }, { "docid": "2868bae93e3ee9a5154236830172da97", "score": "0.46564245", "text": "func wantPress(fsm *FSM, m *terminalapi.Mouse) (bool, State, stateFn) {\n\tif m.Button != fsm.button || !m.Position.In(fsm.area) {\n\t\treturn false, Up, wantPress\n\t}\n\treturn false, Down, wantRelease\n}", "title": "" }, { "docid": "bb5ebc88982b91f771d82568665f37a5", "score": "0.4650649", "text": "func (r *Runtime) Pointer() int {\n\treturn r.index\n}", "title": "" }, { "docid": "50db02257728c2a5dd6220a6ca679c72", "score": "0.46441695", "text": "func (r *RMAApp) LeftClickNextButton() uiauto.Action {\n\treturn r.leftClickButton(nextButton.Visible())\n}", "title": "" }, { "docid": "fa096087f3c3cca0d15c2b796b118270", "score": "0.46368518", "text": "func handleMouseButtonEvent(button glfw.MouseButton, action glfw.Action, mods glfw.ModifierKey) {\n\tif action == glfw.Press {\n\t\tgreen += 0.1\n\t\tgreen, _ = math.Frexp(green)\n\t}\n\tlog.Printf(\"mouse button: %v action %v mods %v\", button, action, mods)\n}", "title": "" } ]
81c330bcbde895249dd83b9cba631be9
Debugf prints a debug message using the standard logger. Arguments are handled in the manner of fmt.Printf.
[ { "docid": "705eed022260236e6917e11d20d4ba54", "score": "0.0", "text": "func Debugf(format string, v ...interface{}) {\n\toriginal.Printf(\"[DBG] \"+format, v...)\n}", "title": "" } ]
[ { "docid": "945b6f7046daaffe89fa83ef2498bf80", "score": "0.8488066", "text": "func Debugf(format string, args ...interface{}) { logger.Debugf(format, args...) }", "title": "" }, { "docid": "8994c0b366a7cccb7cc34218a926d081", "score": "0.8307679", "text": "func (this*LoggingModule)Debugf(format string,args... interface{}){\n\tif GSessionConfiguration.Logging.Debug {\n\t\tGDLogger.Debugf(format, args)\n\t}\n}", "title": "" }, { "docid": "4f75d3ffbb84c05a30daa4554a6228e2", "score": "0.8306546", "text": "func logDebugf(format string, v ...interface{}) {\n\tif !debug {\n\t\treturn\n\t}\n\tlog.Printf(format, v...)\n}", "title": "" }, { "docid": "4f75d3ffbb84c05a30daa4554a6228e2", "score": "0.8306546", "text": "func logDebugf(format string, v ...interface{}) {\n\tif !debug {\n\t\treturn\n\t}\n\tlog.Printf(format, v...)\n}", "title": "" }, { "docid": "592eab09172bd8fc974108e6d06c6f30", "score": "0.8275978", "text": "func Debugf(format string, a ...interface{}) error { return globalLogger.Debugf(format, a...) }", "title": "" }, { "docid": "7afdb8fb11961e4d5c444374c0f1601e", "score": "0.8264116", "text": "func (p *Plugin) LogDebugf(format string, args ...interface{}) {\n\tp.Logger().Debugf(format, args...)\n}", "title": "" }, { "docid": "e4656e8264561cd31f5111438834c2a6", "score": "0.81172925", "text": "func Debugf(format string, args ...interface{}) {\n\tdefaultLogger.Debugf(format, args...)\n}", "title": "" }, { "docid": "041d99b965bc3fe12b473d58eebf0160", "score": "0.80882233", "text": "func Debugf(message string, args ...interface{}) {\n\tdefaultLogger.Debugf(message, args...)\n}", "title": "" }, { "docid": "324a0f6d887321a4a77096e45c7f2f19", "score": "0.807468", "text": "func Debugf(format string, args ...interface{}) {\n\tlogger := StandardLogger()\n\n\tlogger.Debugf(format, args...)\n}", "title": "" }, { "docid": "d0053e982e81f3562f731cf00dbf7587", "score": "0.80689603", "text": "func Debugf(format string, args ...interface{}) {\n\tcurrLogger.Debugf(format, args...)\n}", "title": "" }, { "docid": "ad15a7865ceb6a4151154367740f80b1", "score": "0.80561733", "text": "func Debugf(format string, args ...interface{}) {\n\tlog.logger.Debugf(format, args...)\n}", "title": "" }, { "docid": "13e0fcc0b86a4ec4f9dd0e42b82c70bc", "score": "0.8050426", "text": "func Debugf(format string, args ...interface{}) {\n\tDefaultLogger.Debugf(format, args...)\n}", "title": "" }, { "docid": "442889d8c3434de0ae8f30f2d3812659", "score": "0.8006065", "text": "func Debugf(format string, args ...interface{}) {\n\t_logger.Debugf(format, args)\n}", "title": "" }, { "docid": "0f8378ba943f1e028ae9ea4c7618db34", "score": "0.7983728", "text": "func Debugf(fmt string, args ...interface{}) {\n\tlog.Debugf(fmt, args...)\n}", "title": "" }, { "docid": "49f936e7a06d9d116a1b8a61a0bb8435", "score": "0.7982848", "text": "func Debugf(format string, args ...interface{}) {\n\tlogger.Debugf(format, args...)\n}", "title": "" }, { "docid": "49f936e7a06d9d116a1b8a61a0bb8435", "score": "0.7982848", "text": "func Debugf(format string, args ...interface{}) {\n\tlogger.Debugf(format, args...)\n}", "title": "" }, { "docid": "49f936e7a06d9d116a1b8a61a0bb8435", "score": "0.7982848", "text": "func Debugf(format string, args ...interface{}) {\n\tlogger.Debugf(format, args...)\n}", "title": "" }, { "docid": "49f936e7a06d9d116a1b8a61a0bb8435", "score": "0.7982848", "text": "func Debugf(format string, args ...interface{}) {\n\tlogger.Debugf(format, args...)\n}", "title": "" }, { "docid": "829233f36fe3d6b61a4611fabfc8b293", "score": "0.7982161", "text": "func Debugf(format string, args ...interface{}) {\n\tbaseLogger.logger.Debugf(format, args...)\n}", "title": "" }, { "docid": "51f81561040a61596446c6687c82064c", "score": "0.7981948", "text": "func Debugf(format string, args ...interface{}) {\n\tgetPackageLevelSugaredLogger().Debugf(format, args...)\n}", "title": "" }, { "docid": "459f1e65639dba49131f72ee1fa887db", "score": "0.79759353", "text": "func Debugf(format string, args ...interface{}) {\n\tbaseLogger.Debugf(format, args...)\n}", "title": "" }, { "docid": "988d24d6e4d621b167878c683a4871b9", "score": "0.7975595", "text": "func Debugf(format string, args ...interface{}) {\n\tif !isInLoggerLevel(DEBUG) {\n\t\treturn\n\t}\n\tlogger.Debugf(format, args...)\n}", "title": "" }, { "docid": "2bdd14508cbd4bc63515cf44d9f83845", "score": "0.79748064", "text": "func Debugf(format string, a ...interface{}) {\n\tdefaultLogger.Debugf(format, a...)\n}", "title": "" }, { "docid": "33679bd493922db9d3ab0684a791c05b", "score": "0.79386324", "text": "func Debugf(format string, args ...any) {\n\tLogger.Debugf(fmt.Sprintf(format, args...))\n}", "title": "" }, { "docid": "2aeff497735183c0634c8ab6abec8d73", "score": "0.79298466", "text": "func Debugf(format string, v ...interface{}) {\n\tdefaultLogger.Debugf(format, v...)\n}", "title": "" }, { "docid": "2aeff497735183c0634c8ab6abec8d73", "score": "0.79298466", "text": "func Debugf(format string, v ...interface{}) {\n\tdefaultLogger.Debugf(format, v...)\n}", "title": "" }, { "docid": "2270c416fd0c875e9f95f19a91ddcb4f", "score": "0.79239964", "text": "func Debugf(msg string, args ...interface{}) {\n\tlogrus.Debugf(msg, args...)\n}", "title": "" }, { "docid": "2270c416fd0c875e9f95f19a91ddcb4f", "score": "0.79239964", "text": "func Debugf(msg string, args ...interface{}) {\n\tlogrus.Debugf(msg, args...)\n}", "title": "" }, { "docid": "d329302ac5e8c23cc144dd06afca2e38", "score": "0.79209054", "text": "func Debugf(format string, args ...interface{}) {\n\tlog.Debugf(format, args...)\n}", "title": "" }, { "docid": "d329302ac5e8c23cc144dd06afca2e38", "score": "0.79209054", "text": "func Debugf(format string, args ...interface{}) {\n\tlog.Debugf(format, args...)\n}", "title": "" }, { "docid": "d329302ac5e8c23cc144dd06afca2e38", "score": "0.79209054", "text": "func Debugf(format string, args ...interface{}) {\n\tlog.Debugf(format, args...)\n}", "title": "" }, { "docid": "8fc48d7e93105010344ea626369e457d", "score": "0.7913336", "text": "func Debugf(format string, args ...interface{}) {\n\tloggerWithCaller().Debugf(format, args...)\n}", "title": "" }, { "docid": "3e5e0756732cd7c02da0fa40d228003f", "score": "0.79117817", "text": "func Debugf(format string, args ...interface{}) {\n\tensureLog()\n\tlog.Debugf(format, args...)\n}", "title": "" }, { "docid": "c88fb17976dfefd5b81f545d9cea30e6", "score": "0.7902229", "text": "func Debugf(ctx context.Context, format string, args ...interface{}) {\n\tdefaultLogger.logger.WithFields(defaultLogger.newField(ctx)).Debugf(format, args...)\n}", "title": "" }, { "docid": "906cd84a1d381654724ffff011ae073a", "score": "0.7895076", "text": "func Debugf(format string, args ...interface{}) {\n\tlog.writer.Debugf(format, args...)\n}", "title": "" }, { "docid": "eaf88085d790b81e2fca110b80201fe5", "score": "0.78789514", "text": "func Debugf(format string, a ...interface{}) (int, error) {\n\treturn DefaultLogger.Debugf(format, a...)\n}", "title": "" }, { "docid": "70f3889a667d076bfdfdbb3e23f10c61", "score": "0.78658736", "text": "func Debugf(msg string, args ...interface{}) {\n\tDefault.Debugf(msg, args...)\n}", "title": "" }, { "docid": "93a207e64c0937ca40ca180d890dc003", "score": "0.7863446", "text": "func (l *TestLogger) Debugf(format string, args ...interface{}) {\n\tl.logger.Debugf(format, args...)\n}", "title": "" }, { "docid": "b3802d7d2e7c0bd2c5cac293d0bd7738", "score": "0.7860025", "text": "func (sc *SnowthClient) LogDebugf(format string, args ...interface{}) {\n\tif sc.log != nil {\n\t\tsc.log.Debugf(format, args...)\n\t}\n}", "title": "" }, { "docid": "da04c1f35f820a3019226cc3f65a1ad1", "score": "0.7843754", "text": "func (t *tracker) debugf(message string, args ...interface{}) {\n\tif t.logger == nil || !t.config.EnabledLogging {\n\t\treturn\n\t}\n\tt.logger.Debugf(message, args...)\n}", "title": "" }, { "docid": "ba9e94ad70822f0a27c1cc77b5aafec4", "score": "0.7842066", "text": "func Debugf(format string, args ...interface{}) {\n\tlogs.Debugf(format, args...)\n}", "title": "" }, { "docid": "e8b3d81b88e7729b78e1e5c8ddcc9f64", "score": "0.7821694", "text": "func (l *defaultLogger) Debugf(f string, args ...interface{}) {\n\tl.log.Debugf(f, args...)\n}", "title": "" }, { "docid": "80d8cb85e8bcfec88976fafd1b5d65a0", "score": "0.77939117", "text": "func Debugf(str string, args ...interface{}) {\n\tif Debug {\n\t\tLogger.Debugf(str, args...)\n\t}\n}", "title": "" }, { "docid": "00a8df89be8aedde47073c6387119652", "score": "0.77935183", "text": "func (l LogrusLogger) Debugf(format string, args ...interface{}) {\n\tl.logger.Debugf(format, args...)\n}", "title": "" }, { "docid": "07ef607c9acb7e628ab00e68b43f3ae9", "score": "0.7793113", "text": "func Debugf(format string, args ...interface{}) {\r\n\t//TODO\r\n\t//if !strings.HasSuffix(format, \"\\n\") {\r\n\t//\tformat += \"\\n\"\r\n\t//}\r\n\tlog.Debugf(format, args...)\r\n}", "title": "" }, { "docid": "796c6df38ce14e73108551448a75e9b9", "score": "0.77711797", "text": "func (l logger) Debugf(format string, args ...interface{}) {\n\tl.cl.log.Debugf(format, args...)\n}", "title": "" }, { "docid": "6ce74d69e274f41596e85804bb2052a4", "score": "0.776314", "text": "func Debugf(ctx context.Context, format string, args ...interface{}) {\n\tlog.Debugf(ctx, format, args...)\n}", "title": "" }, { "docid": "6ce74d69e274f41596e85804bb2052a4", "score": "0.776314", "text": "func Debugf(ctx context.Context, format string, args ...interface{}) {\n\tlog.Debugf(ctx, format, args...)\n}", "title": "" }, { "docid": "60b02999e6b1e167b3f3408efac1b4d3", "score": "0.77621824", "text": "func Debugf(format string, val ...interface{}) {\n\tdefaultLogger.Debugf(format, val...)\n}", "title": "" }, { "docid": "8e3f09d957174041791238b5e2b90d28", "score": "0.7752443", "text": "func Debugf(format string, v ...interface{}) {\n\tlogger.Debugf(format, v...)\n}", "title": "" }, { "docid": "8bb823a2a8c9aff001c1c28757ac3958", "score": "0.774963", "text": "func (l logger) Debugf(format string, args ...interface{}) {\n\tl.entry.Debugf(format, args...)\n}", "title": "" }, { "docid": "55b66d4488631e615574a5a801afc2a0", "score": "0.7742565", "text": "func (Logger) Debugf(format string, args ...interface{}) {\n\tif klog.V(4).Enabled() {\n\t\tklog.InfoDepth(2, fmt.Sprintf(format, args...))\n\t}\n}", "title": "" }, { "docid": "d24f1a61ab1965473ad6b6890f29cf6d", "score": "0.77392226", "text": "func (l *Logger) Debugf(format string, args ...interface{}) {\n\tlog.Printf(\"D! \"+format, args...)\n}", "title": "" }, { "docid": "a94ca470e984c1a82941e76647323223", "score": "0.7733991", "text": "func (logger *Logger) Debugf(format string, args ...interface{}) {\n\tif logger.Active == false {\n\t\treturn\n\t}\n\n\tf := format\n\n\t_, file, line, ok := runtime.Caller(1)\n\tif ok {\n\t\tf = fmt.Sprintf(\"%s:%d %s\", file, line, format)\n\t}\n\n\tlogger.logger.Debugf(f, args...)\n}", "title": "" }, { "docid": "638744dad6214141fef3782121bb1582", "score": "0.7717591", "text": "func Debugf(format string, v ...interface{}) {\n\tget(logLevel, 3).Debugf(format, v...)\n}", "title": "" }, { "docid": "d3c982ba00d9db6210e69abf240097c1", "score": "0.77165955", "text": "func Debugf(template string, args ...interface{}) {\n\tDefaultLogger.Debugf(template, args...)\n}", "title": "" }, { "docid": "587d09f07bb8674073bf78aa4532b59a", "score": "0.77119255", "text": "func Debugf(format string, v ...interface{}) {\n\tdebugLogger.Debugf(format, v...)\n}", "title": "" }, { "docid": "6446c88039a71af7ef4cce30fd1498be", "score": "0.77100384", "text": "func Debugf(format string, args ...interface{}) {\n\tgosyncLogger.Debugf(format, args...)\n}", "title": "" }, { "docid": "268ab6d4aec5eccdee2ba9a410f42b3e", "score": "0.77051175", "text": "func (l *logger) Debugf(template string, args ...interface{}) {\n\tl.wrappedLogger.Debugf(template, args...)\n}", "title": "" }, { "docid": "684db41f06b91561f2214e0e2cf64f0d", "score": "0.77031", "text": "func (l *LogWrapper) Debugf(format string, args ...interface{}) {\n\tl.logger.Debugf(format, args...)\n}", "title": "" }, { "docid": "2f3de64cb6ca3be361d4463cbf8836ca", "score": "0.7701828", "text": "func (logger *Logger) Debugf(format string, args ...interface{}) {\n\tlogger.entry.Debugf(format, args...)\n}", "title": "" }, { "docid": "3c22a55836ec5b1143bef3e4e32cf48c", "score": "0.7700029", "text": "func Debugf(format string, v ...interface{}) {\n\tlog.Debugf(format, v...)\n}", "title": "" }, { "docid": "e6f5cb709d4dd26408a2b4ac7c6b65e7", "score": "0.7698515", "text": "func (l *Logger) Debugf(format string, args ...interface{}) {\n\tl.sugar.Debugf(format, args...)\n}", "title": "" }, { "docid": "b3e1d7f3104d138e8ba8a481d8e0ad29", "score": "0.7698491", "text": "func Debugf(format string, args ...interface{}) {\n\tlog.Debugf(indentation()+format, args...)\n}", "title": "" }, { "docid": "0d6f913d6ff7aa914be4bc8f32db1da8", "score": "0.76970255", "text": "func (l *Logger) TagDebugf(tags []string, fmt string, args ...interface{}) error {\n\tif l == nil {\n\t\treturn nil\n\t}\n\tl.RLock()\n\tif l.appender == nil {\n\t\tl.RUnlock()\n\t\treturn nil\n\t}\n\tdebugMode := l.debug\n\tif !debugMode {\n\t\tld, lt := len(l.debugTags), len(tags)\n\n\t\tfor i := 0; i < ld; i++ {\n\t\t\tfor j := 0; j < lt; j++ {\n\t\t\t\tif l.debugTags[i] == tags[j] {\n\t\t\t\t\tdebugMode = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif debugMode {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\tif !debugMode {\n\t\tl.RUnlock()\n\t\treturn nil\n\t}\n\tentry := l.format(true, tags, time.Now(), fmt, args...)\n\tapp := l.appender\n\tl.RUnlock()\n\treturn app(entry)\n}", "title": "" }, { "docid": "f8a19a22273e29d16fa1ded8971892fa", "score": "0.7696868", "text": "func debugf(format string, v ...interface{}) {\n\tlogPrintf(debugLogger, format, v...)\n}", "title": "" }, { "docid": "e1df543f6fac4f7307ce09168e5fa2c4", "score": "0.76915705", "text": "func Debugf(msgFormat string, msg ...interface{}) {\n\tlogger.Debugf(msgFormat, msg...)\n}", "title": "" }, { "docid": "d77a26704f424d1a03c54fb6673c2c0d", "score": "0.7688646", "text": "func Debugf(msg string, v ...interface{}) {\n\tdefaultLager.Debugf(msg, v...)\n}", "title": "" }, { "docid": "e3581a5169aeb559a8d19613a35aa72f", "score": "0.7680379", "text": "func (l *Logger) Debugf(format string, args ...interface{}) {\n\tcallstack(l.entry).Debugf(format, args...)\n}", "title": "" }, { "docid": "915322f959d9b693064e4977814d8596", "score": "0.7678271", "text": "func (l *Logger) VVVDebugf(format string, args ...interface{}) {\n\tl.printf(VVVDEBUG, format, args...)\n}", "title": "" }, { "docid": "97f338347ef664c36ad30cf81bad99f9", "score": "0.76749694", "text": "func debugf(format string, args ...interface{}) {\n\tif !Debug {\n\t\treturn\n\t}\n\ts := fmt.Sprintf(format, args...)\n\tlog.Print(s)\n}", "title": "" }, { "docid": "1384d5a02b2bb613b68fd78369bdd869", "score": "0.766786", "text": "func (l *Logger) VDebugf(format string, args ...interface{}) {\n\tl.printf(VDEBUG, format, args...)\n}", "title": "" }, { "docid": "e8f767a62994e892de57ff4e323428a3", "score": "0.765909", "text": "func Debugf(templ string, args ...interface{}) {\n\tlog.Debugf(templ, args...)\n}", "title": "" }, { "docid": "9620c6e820418e459bc78219a0bc9a9f", "score": "0.76581055", "text": "func Debugf(format string, objects ...interface{}) {\n\tglobalLogger.Debugf(format, objects...)\n}", "title": "" }, { "docid": "d7141cd236b03d620521ef0074686696", "score": "0.76427555", "text": "func (*StandardLogger) Debugf(f string, v ...interface{}) {\n\tgolog.Printf(\"DEBUG: %v\", fmt.Sprintf(f, v...))\n}", "title": "" }, { "docid": "9089c2380a2c663f83369f5262655185", "score": "0.76395386", "text": "func (l Logger) Debugf(format string, args ...interface{}) {\n\tif l.Logger.WithFields {\n\t\tl.logger.WithFields(logrus.Fields(l.Fields)).Debugf(format, args...)\n\t\treturn\n\t}\n\n\tl.logger.Debugf(format, args...)\n}", "title": "" }, { "docid": "008e46b8d685954dfdcaa3375a7eb846", "score": "0.7637374", "text": "func Debugf(format string, v ...interface{}) {\n\tlogrus.Debugf(format, v...)\n}", "title": "" }, { "docid": "3f4bb17a39ac1f68d697efcb47ba826f", "score": "0.7629112", "text": "func (*Log) Debugf(format string, v ...interface{}) {}", "title": "" }, { "docid": "5e8914c564d91b5d3e77c0f1ac8da634", "score": "0.7621046", "text": "func (nl *ConsoleLogger) Debugf(format string, args ...interface{}) {\n\tfmt.Printf(\"[DEBUG] \"+format+\"\\n\", args...)\n}", "title": "" }, { "docid": "7894221a51502f3ce6b9c7cf15fa10c1", "score": "0.7615154", "text": "func Debugf(format string, args ...interface{}) {\n\tl.Debugf(format, args...)\n}", "title": "" }, { "docid": "8a85d9de08b11de79f65ed70540bd3d5", "score": "0.75991154", "text": "func VVVDebugf(format string, args ...interface{}) {\n\tl.printf(VVVDEBUG, format, args...)\n}", "title": "" }, { "docid": "374a366166d3e00b99b4933983ce540d", "score": "0.7595942", "text": "func (l *loggerImpl) Debugf(template string, args ...interface{}) {\n\tl.logger.Debugf(template, args...)\n}", "title": "" }, { "docid": "7a43c6c71dad3f00af0d51a651502b1b", "score": "0.7592898", "text": "func Debugf(format string, args ...interface{}) {\n\tDefault.Debugf(format, args...)\n}", "title": "" }, { "docid": "af3d0a751764853fbe675eed019df090", "score": "0.75914115", "text": "func Debugf(format string, args ...interface{}) {\n\tmuteable.Debugf(format, args)\n}", "title": "" }, { "docid": "f022f1a5e11cfe1782b24af9d53bcc16", "score": "0.75880843", "text": "func Debugf(format string, v ...interface{}) {\n\tdefaultLogger.logf(LevelDebug, &format, v...)\n}", "title": "" }, { "docid": "ba8c2098d8b7871e4d5402e463a61638", "score": "0.75861734", "text": "func (l *Logger) Debugf(format string, args ...interface{}) {\n\tlog.Printf(\"D! [\"+l.Name+\"] \"+format, args...)\n}", "title": "" }, { "docid": "de9110580efe2682099c367ff16427d5", "score": "0.75848943", "text": "func Debugf(format string, args ...interface{}) {\n\tif Debug {\n\t\tlog.Printf(\"[DEBUG] \"+format+\"\\n\", args...)\n\t}\n}", "title": "" }, { "docid": "ecbc21b60cf2e579b1ec898a9116e9eb", "score": "0.7579757", "text": "func (lg *Logger) Debugf(tmpl string, args ...interface{}) {\n\tlg.sl.Debugf(tmpl, args...)\n}", "title": "" }, { "docid": "256ecd982d0d4e8e5b062f125c66092b", "score": "0.7577608", "text": "func (f *fallbackLogger) Debugf(ctx context.Context, format string, args ...interface{}) {\n\tlogrus.WithContext(ctx).Debugf(format, args...)\n}", "title": "" }, { "docid": "0424c4829252949449ba849beb9c5972", "score": "0.75729", "text": "func Debugf(format string, args ...interface{}) {\n\tstd.Debugf(format, args...)\n}", "title": "" }, { "docid": "0424c4829252949449ba849beb9c5972", "score": "0.75729", "text": "func Debugf(format string, args ...interface{}) {\n\tstd.Debugf(format, args...)\n}", "title": "" }, { "docid": "3d72fe6d69e1f392a80e5dda70248af7", "score": "0.75719774", "text": "func Debugf(format string, args ...interface{}) {\n\tif level <= LevelDebug {\n\t\tci := retrieveCallInfo()\n\t\tfi := fmt.Sprintf(format, args...)\n\n\t\tlogger.Debug(ci.verboseFormat(), fi)\n\t}\n}", "title": "" }, { "docid": "9ab2e6891f23aefb885cd0f7b46fae77", "score": "0.7564796", "text": "func (lg *Logger) Debugf(msgFormat string, msg ...interface{}) {\n\tfmt.Printf(msgFormat, msg...)\n\tlog.WithFields(lg.getFields()).Debugf(msgFormat, msg...)\n}", "title": "" }, { "docid": "ec5bf2ca8ddd3bef59e3bd9681542667", "score": "0.7560767", "text": "func (nl *NullLogger) Debugf(format string, args ...interface{}) {\n\n}", "title": "" }, { "docid": "97ad6dc479f82cd0b6b0321dc505a5a7", "score": "0.75604343", "text": "func (c *ChaincodeLogger) Debugf(format string, args ...interface{}) {\n\tc.logger.Debugf(format, args...)\n}", "title": "" }, { "docid": "466149b1e05ebf3c18e3ff032c281bf6", "score": "0.7544097", "text": "func (l *DefaultDebugLogger) Debugf(format string, args ...interface{}) {\n\tdepth := logOutputDepth\n\n\t// Adjust depth to account for any convenience wrappers. Enables\n\t// printing of correct caller info.\n\tpc := make([]uintptr, depth+5)\n\tn := runtime.Callers(depth, pc)\n\tif n > 0 {\n\t\tpc = pc[:n]\n\t\tframes := runtime.CallersFrames(pc)\n\t\tfor {\n\t\t\tframe, more := frames.Next()\n\t\t\tif !more {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tfnName := frame.Function[strings.LastIndex(frame.Function, \".\")+1:]\n\t\t\tif _, found := knownWrappers[fnName]; found {\n\t\t\t\tdepth++\n\t\t\t}\n\t\t}\n\t}\n\n\tout := fmt.Sprintf(format, args...)\n\tif err := l.log.Output(depth, out); err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"logger Debugf() failed: %s\\n\", err)\n\t}\n}", "title": "" }, { "docid": "499cb467b2f03402a13736a0b6386ec3", "score": "0.75414693", "text": "func (l CompatibleLogger) Debugf(format string, args ...interface{}) {\n\tl._log.Debug(fmt.Sprintf(format, args...))\n}", "title": "" }, { "docid": "952add01890a8c5197cdcd542c42a111", "score": "0.7539857", "text": "func Debugf(format string, v ...interface{}) {\n\tdglogObj.Debugf(format, v...)\n}", "title": "" }, { "docid": "8cc7a4b9ffecb7b0b6795f6366cefb9d", "score": "0.7537123", "text": "func Debugf(format string, v ...interface{}) {\n\tgetDefaultLogger().writef(LDebug, format, v...)\n}", "title": "" }, { "docid": "a1094b18ddb394e834b3cdb48d267757", "score": "0.75350356", "text": "func Debugf(format string, v ...interface{}) {\n\tmessage := fmt.Sprintf(format, v...)\n\tif level <= LevelDebug {\n\t\tgoLogger.Printf(\"[DEBUG] %s %s\", logPrefixStr, fmt.Sprintln(message))\n\t}\n}", "title": "" }, { "docid": "49c2a849d511f0ef4f58a2018594c19f", "score": "0.7533671", "text": "func Debugf(m string, args ...interface{}) {\n\tlogger.WithFields(decorate(\"debug\")).Debugf(m, args...)\n}", "title": "" } ]
b94c86326d0073f77abb3dbb03fd37d0
Hash returns last received hash.
[ { "docid": "2cc9ea49564d82ed3a8321908923adb4", "score": "0.67229885", "text": "func (s *MessagesGetAttachMenuBots) Hash() int64 {\n\tinner, _ := s.load()\n\treturn inner.hash\n}", "title": "" } ]
[ { "docid": "817a983f9ec9b442e363f7e184432955", "score": "0.7284133", "text": "func (recv *File) Hash() uint32 {\n\tretC := C.g_file_hash((C.gconstpointer)(recv.native))\n\tretGo := (uint32)(retC)\n\n\treturn retGo\n}", "title": "" }, { "docid": "d488da09b3193f2bbc6017458760ae08", "score": "0.719056", "text": "func (s *StateMachine) GetHash() (uint64, error) {\n\t// the only state we have is that Count variable. that uint64 value pretty much\n\t// represents the state of this IStateMachine\n\treturn 0, nil\n}", "title": "" }, { "docid": "d59b0be08909fd138dc734579f7ba9fc", "score": "0.71586555", "text": "func (c *Chain) LastHash() [32]byte {\n\treturn c.lastHash\n}", "title": "" }, { "docid": "76f69f8fc0255e5fae05a5dcae5c0cb1", "score": "0.7100423", "text": "func (b *Block) GetHash() types.Hash { return b.Hash }", "title": "" }, { "docid": "2073e0ccfdece3c7dbb054cd3bcc265b", "score": "0.7095552", "text": "func (f *MessagesFavedStickers) GetHash() (value int64) {\n\tif f == nil {\n\t\treturn\n\t}\n\treturn f.Hash\n}", "title": "" }, { "docid": "7e2817383358cf38885ced88ff9211e3", "score": "0.7075349", "text": "func (e *Event) Hash() ([]byte, error) {\n\tif len(e.hash) == 0 {\n\t\thash, err := e.Message.Body.Hash()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\te.hash = hash\n\t}\n\treturn e.hash, nil\n}", "title": "" }, { "docid": "acee9f573d35cb1eb113f95fd4a8d638", "score": "0.704673", "text": "func (_BASManager *BASManagerCaller) Hash(opts *bind.CallOpts, key string) ([32]byte, error) {\n\tvar (\n\t\tret0 = new([32]byte)\n\t)\n\tout := ret0\n\terr := _BASManager.contract.Call(opts, out, \"hash\", key)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "ff769161c40554e5ab6f75c002f5afb1", "score": "0.704421", "text": "func (_BASManager *BASManagerCallerSession) Hash(key string) ([32]byte, error) {\n\treturn _BASManager.Contract.Hash(&_BASManager.CallOpts, key)\n}", "title": "" }, { "docid": "e973432f32db135cecbec38cbaac52eb", "score": "0.7038995", "text": "func (s *MessagesGetFavedStickers) Hash() int64 {\n\tinner, _ := s.load()\n\treturn inner.hash\n}", "title": "" }, { "docid": "e9f67812d7db93fbbba81a8428cff6ff", "score": "0.70379883", "text": "func (_BASManager *BASManagerSession) Hash(key string) ([32]byte, error) {\n\treturn _BASManager.Contract.Hash(&_BASManager.CallOpts, key)\n}", "title": "" }, { "docid": "a05c3e645b6d90a1d17c546f7e2b306f", "score": "0.70292073", "text": "func (g *MessagesGetRecentReactionsRequest) GetHash() (value int64) {\n\tif g == nil {\n\t\treturn\n\t}\n\treturn g.Hash\n}", "title": "" }, { "docid": "a24a25652dbd03561cfd5259a7268935", "score": "0.7020696", "text": "func (n *NoOP) GetHash() (uint64, error) {\n\treturn 0, nil\n}", "title": "" }, { "docid": "24a9479ac28d7dae57d6c29b21d6df1a", "score": "0.69821525", "text": "func (u *URI) Hash() []byte {\n\treturn u.hash\n}", "title": "" }, { "docid": "ea058e9fd39cc96a628b647418e4026c", "score": "0.69631463", "text": "func (s *MessagesGetStickers) Hash() int64 {\n\tinner, _ := s.load()\n\treturn inner.hash\n}", "title": "" }, { "docid": "925c510b62094f443b36c9ded932af5f", "score": "0.6944993", "text": "func (s *MessagesGetRecentReactions) Hash() int64 {\n\tinner, _ := s.load()\n\treturn inner.hash\n}", "title": "" }, { "docid": "223304d26c2f61f697d102e59cebac08", "score": "0.6918069", "text": "func (self DataStream) GetHash(autoFree bool) UInt256 {\n\tres := &uint256{inner: C.datastream_get_hash(self.inner)}\n\tuint256SetFinalizer(res, autoFree)\n\treturn res\n}", "title": "" }, { "docid": "5b7c171b83b790ef2c001eb6ad955712", "score": "0.6911328", "text": "func (state *State) lastHash() bitcoin.Hash32 {\r\n\tif len(state.blocksToRequest) > 0 {\r\n\t\treturn state.blocksToRequest[len(state.blocksToRequest)-1]\r\n\t}\r\n\r\n\tif len(state.blocksRequested) > 0 {\r\n\t\treturn state.blocksRequested[len(state.blocksRequested)-1].hash\r\n\t}\r\n\r\n\treturn state.lastSavedHash\r\n}", "title": "" }, { "docid": "e37cbeeceeee89929c7f3773e12f2746", "score": "0.6907976", "text": "func (s *MessagesGetRecentStickers) Hash() int64 {\n\tinner, _ := s.load()\n\treturn inner.hash\n}", "title": "" }, { "docid": "2b04a18a28a17a4ca7ab7a999e7a053d", "score": "0.6900527", "text": "func (m Message) Hash() uint32 {\n\treturn crc32.ChecksumIEEE(m[magicOffset:])\n}", "title": "" }, { "docid": "ae251eb08f222256718cd44ba46dff44", "score": "0.68865615", "text": "func (s *MessagesGetAllStickers) Hash() int64 {\n\tinner, _ := s.load()\n\treturn inner.hash\n}", "title": "" }, { "docid": "a5d773b58801e9cfeb40779c8857d2e4", "score": "0.6856134", "text": "func (n *PST) GetHash() uint64 {\n\t// the hash value is always 0, so it is of course always consistent\n\treturn 0\n}", "title": "" }, { "docid": "fb0c4948bfff86b6d81bbfc94eb15044", "score": "0.68355966", "text": "func (s *MessagesGetTopReactions) Hash() int64 {\n\tinner, _ := s.load()\n\treturn inner.hash\n}", "title": "" }, { "docid": "7d9a07e29d2b1fa85252c5b1bd934d54", "score": "0.6831593", "text": "func (b *BlockPublish) Hash() (out [32]byte) {\n\th := sha256.New()\n\th.Write(b.PrevHash[:])\n\tth := b.Transaction.Hash()\n\th.Write(th[:])\n\tcopy(out[:], h.Sum(nil))\n\treturn\n}", "title": "" }, { "docid": "852220c684bb63aab46f373435d2522f", "score": "0.68249846", "text": "func (start *StartSubChain) Hash() hash.Hash32B {\n\treturn blake2b.Sum256(start.ByteStream())\n}", "title": "" }, { "docid": "dd39bfabbf5bce66d8448b8d4655576d", "score": "0.68144107", "text": "func (cb *Callback) Hash() [32]byte {\n\tvar f []string\n\tvar keys []string\n\tkeys = make([]string, len(cb.Expression.Value))\n\tz := 0\n\tfor k := range cb.Expression.Value {\n\t\tkeys[z] = low.GenerateHashString(cb.Expression.Value[k].Value)\n\t\tz++\n\t}\n\tsort.Strings(keys)\n\tf = append(f, keys...)\n\n\tkeys = make([]string, len(cb.Extensions))\n\tz = 0\n\tfor k := range cb.Extensions {\n\t\tkeys[z] = fmt.Sprintf(\"%s-%x\", k.Value, sha256.Sum256([]byte(fmt.Sprint(cb.Extensions[k].Value))))\n\t\tz++\n\t}\n\tsort.Strings(keys)\n\tf = append(f, keys...)\n\n\treturn sha256.Sum256([]byte(strings.Join(f, \"|\")))\n}", "title": "" }, { "docid": "f6de18d27ac3f2ddf457386f9955d362", "score": "0.68057096", "text": "func (s *MessagesGetMaskStickers) Hash() int64 {\n\tinner, _ := s.load()\n\treturn inner.hash\n}", "title": "" }, { "docid": "0c4fa864a716968b96779c7ef70b0385", "score": "0.67884165", "text": "func (c *ConcurrentUpdate) GetHash() (uint64, error) {\n\treturn 0, nil\n}", "title": "" }, { "docid": "80c1eea5aae92ad4d5ba957844dcd9f8", "score": "0.67810076", "text": "func getHash(name string) string {\n\treturn getHashSize(name, sysHashLen)\n}", "title": "" }, { "docid": "80d06bee678ef4d67a2f82556c8941b0", "score": "0.6776969", "text": "func (s *AccountGetSavedRingtones) Hash() int64 {\n\tinner, _ := s.load()\n\treturn inner.hash\n}", "title": "" }, { "docid": "edfcc695fb9523f724557e6c3997c661", "score": "0.67706144", "text": "func (rp RelayProof) Hash() []byte {\n\tres := rp.Bytes()\n\treturn Hash(res)\n}", "title": "" }, { "docid": "527068a0fb8c23966ce8caaa63b3aaff", "score": "0.6764286", "text": "func (c *ConcurrentSnapshot) GetHash() (uint64, error) {\n\treturn 0, nil\n}", "title": "" }, { "docid": "beddddebaddce11fb0d20a751fc1cbd1", "score": "0.67609906", "text": "func (a APIError) Hash() uint32 {\n\n\th := fnv.New32a()\n\th.Write([]byte(fmt.Sprintf(\"%d\", a.Code) + a.URL + a.Method)) // nolint\n\treturn h.Sum32()\n}", "title": "" }, { "docid": "596e9a3794c4ea926cb3e951808aac20", "score": "0.6751879", "text": "func (s *MessagesGetSavedGifs) Hash() int64 {\n\tinner, _ := s.load()\n\treturn inner.hash\n}", "title": "" }, { "docid": "da6ede6ce3ba75abe67dc8a969880ae0", "score": "0.67351586", "text": "func (service *Service) Hash() string {\n\t// Ignore the err result because the lib always return nil\n\thash, _ := structhash.Hash(service, 1) // TODO: why not reuse the package utils/hash?\n\treturn hash\n}", "title": "" }, { "docid": "546a97690b71bd12de3f0c9edb2e20ad", "score": "0.673174", "text": "func (r *Route) Hash() uint64 {\n\th := fnv.New64()\n\th.Reset()\n\th.Write([]byte(r.Service + r.Address + r.Gateway + r.Network + r.Router + r.Link))\n\treturn h.Sum64()\n}", "title": "" }, { "docid": "9242bcd80a394e5ca4661fcd74032916", "score": "0.67312235", "text": "func (h *HashNode) Hash() util.Uint256 {\n\tif !h.hashValid {\n\t\tpanic(\"can't get hash of an empty HashNode\")\n\t}\n\treturn h.hash\n}", "title": "" }, { "docid": "3a705c90f9426bec4ff3535384e30df9", "score": "0.67033297", "text": "func (ds *NativeStateMachine) GetHash() uint64 {\n\treturn ds.dataStore.GetHash()\n}", "title": "" }, { "docid": "04fa89e97cdf774c61de90a77b62f4b9", "score": "0.6698475", "text": "func (bc *Blockchain) GetLatestHash() string {\n\tbc.mutex.Lock()\n\thash := bc.blocks[len(bc.blocks)-1].hash\n\tbc.mutex.Unlock()\n\treturn hash\n}", "title": "" }, { "docid": "17a63e8d3e1bac4962e252577179481a", "score": "0.6690269", "text": "func getHash(bytes []byte) string {\n\treturn fmt.Sprintf(\"%x\", md5.Sum(bytes))\n}", "title": "" }, { "docid": "7ec02ee05c62fb5d146967ae464ca51d", "score": "0.66884863", "text": "func (f *fieldEncoding) Hash(msg []byte) GF.Elt { return f.hashToField(msg, 1)[0] }", "title": "" }, { "docid": "84ac72e6baaa3bd8e3b2989922d8746e", "score": "0.6686", "text": "func (c *Dynamic) Hash() []byte {\n\treturn c.cert.Hash()\n}", "title": "" }, { "docid": "dd5dcc018cfea44b1a8715c5b370caac", "score": "0.6685262", "text": "func (s *MessagesGetFeaturedStickers) Hash() int64 {\n\tinner, _ := s.load()\n\treturn inner.hash\n}", "title": "" }, { "docid": "509f4d14045772656859f8ff1a1fcb2e", "score": "0.664731", "text": "func (b *NamingBlock) Hash() []byte {\n\th := sha256.New()\n\n\th.Write(b.PrevHash)\n\th.Write(b.Content.Hash())\n\n\treturn h.Sum(nil)\n}", "title": "" }, { "docid": "fd07454d941e5d314aace9aa88d14726", "score": "0.66468966", "text": "func (s *clientIOSession) Hash() int {\n\treturn getHash(s.id)\n}", "title": "" }, { "docid": "0bb6c5d09960e48283e76145a03daa1e", "score": "0.6645404", "text": "func (req *ArchiveRequest) Hash() string {\n\treturn req.URI + bw.PONumDotForm(req.PO) + req.UUID + req.Value\n}", "title": "" }, { "docid": "02986e4b3f7bc6d38b151359fc06987a", "score": "0.66339815", "text": "func (g *MessagesGetWebPageRequest) GetHash() (value int) {\n\tif g == nil {\n\t\treturn\n\t}\n\treturn g.Hash\n}", "title": "" }, { "docid": "1535470354e4b951bfc029e73977f4d2", "score": "0.66192186", "text": "func (number Number) GetHash() int64 {\n\treturn number.hash\n}", "title": "" }, { "docid": "402396188069575b4b0a76620a36e75a", "score": "0.6617407", "text": "func (listener *Listener) Hash() string {\n\thash := md5.New()\n\tfinfo, err := os.Stat(listener.File)\n\tif err != nil {\n\t\tlog.Fatal(\"Listener not active, restart program:\", err)\n\t}\n\tio.WriteString(hash, listener.File)\n\tfmt.Fprintf(hash, \"%v\", finfo.Size())\n\tfmt.Fprintf(hash, \"%v\", finfo.ModTime())\n\treturn fmt.Sprintf(\"%x\", hash.Sum(nil))\n}", "title": "" }, { "docid": "0acf21f699d572c78d8e4cbe51a3e866", "score": "0.66148305", "text": "func (o *ConnectorFileChecksumAllOf) GetHash() string {\n\tif o == nil || o.Hash == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Hash\n}", "title": "" }, { "docid": "1fe9f3761b26b1c98b427e8a539470c3", "score": "0.6612828", "text": "func (f *MessagesFoundStickerSets) GetHash() (value int64) {\n\tif f == nil {\n\t\treturn\n\t}\n\treturn f.Hash\n}", "title": "" }, { "docid": "1aaabe5e8cfecc8156d14cd29188d3a2", "score": "0.66053003", "text": "func (tree *MutableTree) Hash() []byte {\n\tif tree.version > 0 {\n\t\treturn tree.lastSaved.Hash()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "aad1a0c2e031970ed5a0f5fc16e370d8", "score": "0.66021264", "text": "func (s *AccountGetRecentEmojiStatuses) Hash() int64 {\n\tinner, _ := s.load()\n\treturn inner.hash\n}", "title": "" }, { "docid": "d8998692c257c7810dd6f48127877961", "score": "0.6601139", "text": "func (c *connector) Hash() int {\n\treturn 0\n}", "title": "" }, { "docid": "12d7af89c9425d99c061df22a9e3c3a9", "score": "0.66002005", "text": "func (self ByteArray) GetHash(autoFree bool) (res UInt256) {\n\ts := NewDataStreamFromByteArray(self, false)\n\tres = s.GetHash(autoFree)\n\ts.Free()\n\treturn\n}", "title": "" }, { "docid": "5214916379cfc88dea26122c27c9abd2", "score": "0.659714", "text": "func (c *TestUpdate) GetHash() (uint64, error) {\n\treturn 0, nil\n}", "title": "" }, { "docid": "b91c0f35aab6f566d26abcb123a79f46", "score": "0.6585018", "text": "func (l *Link) Hash() [32]byte {\n\tvar f []string\n\tif l.Description.Value != \"\" {\n\t\tf = append(f, l.Description.Value)\n\t}\n\tif l.OperationRef.Value != \"\" {\n\t\tf = append(f, l.OperationRef.Value)\n\t}\n\tif l.OperationId.Value != \"\" {\n\t\tf = append(f, l.OperationId.Value)\n\t}\n\tif l.RequestBody.Value != \"\" {\n\t\tf = append(f, l.RequestBody.Value)\n\t}\n\tif l.Server.Value != nil {\n\t\tf = append(f, low.GenerateHashString(l.Server.Value))\n\t}\n\t// todo: needs ordering.\n\n\tkeys := make([]string, len(l.Parameters.Value))\n\tz := 0\n\tfor k := range l.Parameters.Value {\n\t\tkeys[z] = l.Parameters.Value[k].Value\n\t\tz++\n\t}\n\tsort.Strings(keys)\n\tf = append(f, keys...)\n\tkeys = make([]string, len(l.Extensions))\n\tz = 0\n\tfor k := range l.Extensions {\n\t\tkeys[z] = fmt.Sprintf(\"%s-%x\", k.Value, sha256.Sum256([]byte(fmt.Sprint(l.Extensions[k].Value))))\n\t\tz++\n\t}\n\tsort.Strings(keys)\n\tf = append(f, keys...)\n\treturn sha256.Sum256([]byte(strings.Join(f, \"|\")))\n}", "title": "" }, { "docid": "e26e2d909187b138127c44edb6c7ab63", "score": "0.6582764", "text": "func (mr MerkleRoot) GetHash() []byte {\n\treturn mr.Hash\n}", "title": "" }, { "docid": "fbf94f35a068032b23a22112c14d7b79", "score": "0.65823674", "text": "func hash(data []byte) []byte {\n\tresult := sha256.Sum256(data)\n\treturn result[:hashLength]\n}", "title": "" }, { "docid": "61098113c8bae3eab855eb35f85a2576", "score": "0.65772355", "text": "func (script *Script) Hash() ([]byte, error) {\n\n\tbuff, err := script.Bytes()\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t/* SHA256 Hash */\n\tsha256h := sha256.New()\n\tsha256h.Reset()\n\tsha256h.Write(buff)\n\tpubhash1 := sha256h.Sum(nil)\n\n\t/* RIPEMD-160 Hash */\n\tripemd160h := ripemd160.New()\n\tripemd160h.Reset()\n\tripemd160h.Write(pubhash1)\n\tpubhash2 := ripemd160h.Sum(nil)\n\n\tprogramhash := pubhash2\n\n\treturn programhash, nil\n}", "title": "" }, { "docid": "137e35662a30a166ec9b5b00d66b2090", "score": "0.657453", "text": "func (r Record) Hash() uint64 {\n\tvar h64 hash.Hash64\n\th64 = fnv.New64a()\n\th64.Write(r.Data())\n\treturn h64.Sum64()\n}", "title": "" }, { "docid": "d3c8de9953ee2056d011e9ae1b1f2dad", "score": "0.6572134", "text": "func (txObj TxTokenVout) Hash() *common.Hash {\n\t// final hash\n\thash := common.HashH([]byte(txObj.String()))\n\treturn &hash\n}", "title": "" }, { "docid": "644648452dd95aef6e8d5d71af69969d", "score": "0.65676576", "text": "func Hash(payload, secret, hashType string) (string, error) {\n\tvar hashFn func() hash.Hash\n\tswitch hashType {\n\tcase \"sha256\":\n\t\thashFn = sha256.New\n\tcase \"sha1\":\n\t\thashFn = sha1.New\n\tdefault:\n\t\treturn \"\", fmt.Errorf(\"invalid hashType specified\")\n\t}\n\th := hmac.New(hashFn, []byte(secret))\n\th.Write([]byte(payload))\n\thash := hex.EncodeToString(h.Sum(nil))\n\treturn hash, nil\n}", "title": "" }, { "docid": "86cd17183ba1bb9859fc6138607589a9", "score": "0.65638125", "text": "func (l *Log) Hash() []byte {\r\n\tlogBodyBytes, _ := json.Marshal(l.Body)\r\n\thash := sha256.Sum256(logBodyBytes)\r\n\treturn hash[:]\r\n}", "title": "" }, { "docid": "5509214222a612945397c2fb86f8c86a", "score": "0.6561405", "text": "func (o *Object) Hash(ctx context.Context, t hash.Type) (string, error) {\n\tif t != hash.Whirlpool {\n\t\treturn \"\", hash.ErrUnsupported\n\t}\n\n\treturn o.file.Checksum, nil\n}", "title": "" }, { "docid": "42517f4238ad71aa3de7ea780fc4ceb6", "score": "0.65596396", "text": "func Hash(a interface{}) (string, error) {\n\th := md5.New()\n\tif err := json.NewEncoder(h).Encode(a); err != nil {\n\t\treturn \"\", nil\n\t}\n\treturn hex.EncodeToString(h.Sum(nil)), nil\n}", "title": "" }, { "docid": "3b7d2bb684a6f65c293bed62d2ef6f31", "score": "0.6554701", "text": "func (c *MsgPaymentMade) Hash() tmbytes.HexBytes {\n\tbz, err := c.Marshal()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn tmhash.Sum(bz)\n}", "title": "" }, { "docid": "b9fbd69cd93a1e7b8a6fe574660c0e52", "score": "0.6551408", "text": "func Hash(bytes []byte, name string, height int32) (out chainhash.Hash) {\n\t// if IsTestnet && height < 10 {\n\t// \t// log <- cl.Warn{\"hash\", name, height}\n\t// \ttime.Sleep(time.Second / 20)\n\t// }\n\t// INFO(\"hash\", name, height}\n\tswitch name {\n\tcase \"blake2b\":\n\t\t_ = out.SetBytes(DivHash(Blake2b, bytes, HashReps))\n\tcase \"argon2i\":\n\t\t_ = out.SetBytes(DivHash(Argon2i, bytes, HashReps))\n\tcase \"cryptonight7v2\":\n\t\t_ = out.SetBytes(DivHash(Cryptonight7v2, bytes, HashReps))\n\tcase \"lyra2rev2\":\n\t\t_ = out.SetBytes(DivHash(Lyra2REv2, bytes, HashReps))\n\tcase \"scrypt\":\n\t\tif GetCurrent(height) > 0 {\n\t\t\t_ = out.SetBytes(DivHash(Scrypt, bytes, HashReps))\n\t\t} else {\n\t\t\t_ = out.SetBytes(Scrypt(bytes))\n\t\t}\n\tcase \"sha256d\": // sha256d\n\t\tif GetCurrent(height) > 0 {\n\t\t\t_ = out.SetBytes(DivHash(chainhash.DoubleHashB, bytes, HashReps))\n\t\t} else {\n\t\t\t_ = out.SetBytes(chainhash.DoubleHashB(bytes))\n\t\t}\n\tcase \"stribog\":\n\t\t_ = out.SetBytes(DivHash(Stribog, bytes, HashReps))\n\tcase \"skein\":\n\t\t_ = out.SetBytes(DivHash(Skein, bytes, HashReps))\n\tcase \"keccak\":\n\t\t_ = out.SetBytes(DivHash(Keccak, bytes, HashReps))\n\t}\n\treturn\n}", "title": "" }, { "docid": "a109b4e10e2be1437cd71813169aac8d", "score": "0.654361", "text": "func GetHash(text string) string {\n\thasher := fnv.New32()\n\thasher.Write([]byte(text))\n\treturn fmt.Sprintf(\"%x\", hasher.Sum32())\n}", "title": "" }, { "docid": "87d627e6a37740523ea21573f03f7c8d", "score": "0.65422153", "text": "func (s *MessagesGetFeaturedEmojiStickers) Hash() int64 {\n\tinner, _ := s.load()\n\treturn inner.hash\n}", "title": "" }, { "docid": "92927dc19ec796696a95a9ffcc047685", "score": "0.653243", "text": "func (b *Block) GetHash() Hash {\n\treturn b.data.sum()\n}", "title": "" }, { "docid": "313435dc7a9991de52cfdc97cb43d05a", "score": "0.6529308", "text": "func (s *MessagesSearchStickerSets) Hash() int64 {\n\tinner, _ := s.load()\n\treturn inner.hash\n}", "title": "" }, { "docid": "2e41d6f82e63b126dcb55df612c144ef", "score": "0.65199566", "text": "func (g *ContactsGetContactsRequest) GetHash() (value int64) {\n\tif g == nil {\n\t\treturn\n\t}\n\treturn g.Hash\n}", "title": "" }, { "docid": "9d83dcb0e485f3fc9b87a212ba7d154f", "score": "0.65161186", "text": "func (b *Block) Hash() [32]byte {\n\tm, _ := json.Marshal(b)\n\treturn sha256.Sum256(m)\n}", "title": "" }, { "docid": "6e130395652ea05331b0479764d9b84e", "score": "0.65156263", "text": "func (c *TestSnapshot) GetHash() (uint64, error) {\n\treturn 0, nil\n}", "title": "" }, { "docid": "1911451bdff8f45338c1876a022e7fcf", "score": "0.6511673", "text": "func (s *AccountGetWallPapers) Hash() int64 {\n\tinner, _ := s.load()\n\treturn inner.hash\n}", "title": "" }, { "docid": "2e2f642421c0830e4f8910d55e0a1556", "score": "0.65111566", "text": "func (t *templateValue) Hash() (uint32, error) { return t.hash, nil }", "title": "" }, { "docid": "399fee8bbd6d8654ce8b82a550eb8f2a", "score": "0.6510344", "text": "func (kdmP *KademGo) GetHash(ctx context.Context, req *protos.Request) (*protos.Response, error) {\n\tvar buf [utils.HASHSZ]byte\n\tkdmP.node.GetHash(&buf)\n\tvar ret *protos.Response = &protos.Response{}\n\tret.Hash = buf[:]\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "e1661c4912b5a5dcfc1ce6714e764f05", "score": "0.65090334", "text": "func (s *MessagesGetEmojiStickers) Hash() int64 {\n\tinner, _ := s.load()\n\treturn inner.hash\n}", "title": "" }, { "docid": "6ce2f9f4d8de7195d9038cfa58e2f452", "score": "0.6507828", "text": "func (p *Path) GetHash() []byte {\n\treturn p.hash\n}", "title": "" }, { "docid": "2ef8e9ad1d3fa823dba61d3bc200eee0", "score": "0.65066785", "text": "func (bc *Blockchain) GetHash(index int) (string, error) {\n\tif index > bc.GetLatestIndex() || index < 0 {\n\t\treturn \"\", errors.New(\"Index Out of Bounds\")\n\t}\n\tbc.mutex.Lock()\n\thash := bc.blocks[index].hash\n\tbc.mutex.Unlock()\n\treturn hash, nil\n}", "title": "" }, { "docid": "d4191c05518eaa99c0d5cf6c47963236", "score": "0.65029216", "text": "func (v *Vote) Hash() hash.Hash32B {\n\treturn blake2b.Sum256(v.ByteStream())\n}", "title": "" }, { "docid": "7b0aaeea2923df540fd79a3ca94b658e", "score": "0.6500504", "text": "func (dig *PvtDataDigest) Hash() (string, error) {\n\tb, err := proto.Marshal(dig)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn hex.EncodeToString(util.ComputeSHA256(b)), nil\n}", "title": "" }, { "docid": "5406f848ae75e95ab8568919276e5082", "score": "0.6495902", "text": "func Hash(data []byte) Byte128 {\n\treturn md5.Sum(data)\n}", "title": "" }, { "docid": "e0430e8bcfe555e45a048bc4e71bf5ee", "score": "0.6494954", "text": "func (s *AccountGetChatThemes) Hash() int64 {\n\tinner, _ := s.load()\n\treturn inner.hash\n}", "title": "" }, { "docid": "d5a77d36d804c2b6b734167280926136", "score": "0.64901567", "text": "func (info *bencodeInfo) hash() ([20]byte, error) {\n\tvar buffer bytes.Buffer\n\terr := bencode.Marshal(&buffer, *info)\n\tif err != nil {\n\t\treturn [20]byte{}, err\n\t}\n\thash := sha1.Sum(buffer.Bytes())\n\treturn hash, nil\n}", "title": "" }, { "docid": "af3e90a60ddbd150b03f93b748e3c068", "score": "0.6488939", "text": "func (_Multicall *MulticallSession) GetLastBlockHash() ([32]byte, error) {\n\treturn _Multicall.Contract.GetLastBlockHash(&_Multicall.CallOpts)\n}", "title": "" }, { "docid": "6828009ba0a49a9d855c9fef9bdd966e", "score": "0.648406", "text": "func (txObj TxTokenData) Hash() (*common.Hash, error) {\n\tif txObj.Vouts == nil {\n\t\treturn nil, errors.New(\"Vout is empty\")\n\t}\n\t// final hash\n\thash := common.HashH([]byte(txObj.String()))\n\treturn &hash, nil\n}", "title": "" }, { "docid": "5d0e01d55b03d29d1f2e15ab18b1d1ef", "score": "0.6474705", "text": "func (ch *Chat) Hash() string {\n\towner = ch.Owner.Username\n\tmembers = make([]string, len(ch.Members))\n\tfor i := range ch.Members {\n\t\tmembers[i] = ch.Membes[i].Username\n\t}\n\t// sort the members as the input order might be arbitrary\n\tsort.Strings(members)\n\tunhashed := owner + \"-\" + strings.Join(members, \"-\")\n\thasher := md5.New()\n\thasher.Write([]byte(unhashed))\n\treturn hex.EncodeToString(hasher.Sum(nil))\n}", "title": "" }, { "docid": "7c9b3c0a69dfbee094cbca11afd7fbbf", "score": "0.6456595", "text": "func (resource Resource) Hash() string {\n\treturn fmt.Sprintf(\"%x\", md5.Sum([]byte(resource.String())))\n}", "title": "" }, { "docid": "db8cf30f253bd8c1405a00fa9866b4da", "score": "0.644604", "text": "func (metric Metric) Hash() string {\n\treturn fmt.Sprintf(\"%x\", md5.Sum([]byte(metric.String())))\n}", "title": "" }, { "docid": "d643b605e517958b1fbf630ea67f2674", "score": "0.6442937", "text": "func (c ChallengeProofInvalidData) Hash() []byte {\n\treturn Hash(c.Bytes())\n}", "title": "" }, { "docid": "4a48f4805f0582b27208d5e5e7d29b13", "score": "0.64416933", "text": "func (self *Message) hash() []byte {\n\treturn crypto.Keccak256(append([]byte{self.Flags}, self.Payload...))\n}", "title": "" }, { "docid": "e3a3fc662c828e29d85465e958de6ff8", "score": "0.6439471", "text": "func (h *Hasher) GetHash(idx int) [16]byte {\n\tif hash, ok := h.data[idx]; ok {\n\t\treturn hash\n\t}\n\t// lets calculate it\n\tinput := salt + strconv.Itoa(idx)\n\tvar hash [16]byte\n\tif !part2 {\n\t\thash = md5.Sum([]byte(input))\n\t} else {\n\t\thash = stretchKey([]byte(input), 2016)\n\t}\n\th.SetHash(idx, hash)\n\treturn hash\n}", "title": "" }, { "docid": "83cd8941e294272ca52ef52eceac5358", "score": "0.6438377", "text": "func (t *Transaction) Hash() string {\n\tt.RLock()\n\tdefer t.RUnlock()\n\n\treturn t.hash\n}", "title": "" }, { "docid": "47f3856115fc1ad07f63f30221e88864", "score": "0.64371836", "text": "func (o Op) Hash() int {\n\th := xxhash.ChecksumString64S(string(o), hashSeed0)\n\treturn int(h)\n}", "title": "" }, { "docid": "f1d1fd2c227cc7eb6e1e535eabadd6dc", "score": "0.643474", "text": "func Hash(bytes []byte, name string, height int32) (out chainhash.Hash) {\n\thR := HashReps\n\tif fork.IsTestnet {\n\t\tswitch {\n\t\tcase height == 1:\n\t\t\thR = 0\n\t\t\t// case height < 10:\n\t\t\t//\thR = 6\n\t\t}\n\t}\n\tswitch name {\n\tcase fork.Scrypt:\n\t\tif fork.GetCurrent(height) > 0 {\n\t\t\t_ = out.SetBytes(DivHash(ScryptHash, bytes, hR))\n\t\t} else {\n\t\t\t_ = out.SetBytes(ScryptHash(bytes))\n\t\t}\n\tcase fork.SHA256d:\n\t\tif fork.GetCurrent(height) > 0 {\n\t\t\t_ = out.SetBytes(DivHash(chainhash.DoubleHashB, bytes, hR))\n\t\t} else {\n\t\t\t_ = out.SetBytes(\n\t\t\t\tchainhash.DoubleHashB(\n\t\t\t\t\tbytes,\n\t\t\t\t),\n\t\t\t)\n\t\t}\n\tdefault:\n\t\t_ = out.SetBytes(DivHash(Blake3, bytes, hR))\n\t}\n\treturn\n}", "title": "" }, { "docid": "7a4f6c22184b9636992f6da64de21346", "score": "0.6431927", "text": "func GetHash(data interface{}) string {\n\tvar buffer bytes.Buffer\n\tgetHash(data, &buffer)\n\treturn buffer.String()\n}", "title": "" }, { "docid": "5d5adcf23c4267d5ad1883b736dfc4aa", "score": "0.6431078", "text": "func (str String) GetHash() int64 {\n\treturn str.hash\n}", "title": "" }, { "docid": "098ec446f282c93dce2704b202602070", "score": "0.64290744", "text": "func (id *ID) Hash() string {\n\treturn id.hash\n}", "title": "" }, { "docid": "0ef9916d4f1e845f4cf755eb7606e29c", "score": "0.6426444", "text": "func (s *State) GetHash() string {\n\treturn util.ToHex(s.GetHashBytes())\n}", "title": "" } ]
80d41c23033af7ec5996342ac8018fe3
LogoutUser logs out a user
[ { "docid": "e1dd0e6b06081e8ee09ed3f9ca72f495", "score": "0.82333374", "text": "func (a *Server) LogoutUser(w http.ResponseWriter, r *http.Request) {\n\tfmt.Println(\"logout a user\")\n}", "title": "" } ]
[ { "docid": "c1d2ed015b971c1dcf6fbc5cb8db7ed6", "score": "0.82388914", "text": "func UserLogout(w http.ResponseWriter, r *http.Request) {\n\t_ = SessionDel(w, r, \"user\")\n\tutils.SuccessResponse(&w, \"登出成功\", \"\")\n}", "title": "" }, { "docid": "7e89a16f4f8541f3499c0b67fbb33b36", "score": "0.80569714", "text": "func (u *Users) LogOut() {\n\tu.deauthorizeUser()\n\tu.serveAJAXSuccess(nil)\n}", "title": "" }, { "docid": "3c358a9a10c863035571e7879edd4599", "score": "0.78812987", "text": "func Logout(c *gin.Context) {\n\tsession := sessions.Default(c)\n\tsession.Delete(\"user\");\n\tsession.Save();\n\tc.JSON(200, gin.H{\n\t\t\"success\": true,\n\t})\n}", "title": "" }, { "docid": "4fdd67e7f17075dd9dd800cb7c6f97ec", "score": "0.77779377", "text": "func Logout(w http.ResponseWriter, r *http.Request) {\n\tuser := r.Context().Value(utils.TokenContextKey).(string)\n\tmessage := models.Logout(user)\n\tutils.JSONResonseWithMessage(w, message)\n}", "title": "" }, { "docid": "b2ffba51140dbc5d8c4127c934eb32f4", "score": "0.77727336", "text": "func (u *UserController) Logout(c *gin.Context) {\n\trequestID := requestid.Get(c)\n\tau, err := helpers.ExtractTokenMetadata(c.Request, requestID)\n\tif err != nil {\n\t\tlogger.Error(logoutLogTag, requestID, \"Unable to extract token metadata on logout system, error: %+v\", err)\n\t\tc.JSON(http.StatusUnauthorized, \"unauthorized\")\n\t\treturn\n\t}\n\tdeleted, delErr := helpers.DeleteAuth(au.AccessUUID)\n\tif delErr != nil || deleted == 0 {\n\t\tlogger.Error(logoutLogTag, requestID, \"Unable to delete auth on logout system, error: %+v, deleted: %d\", delErr, deleted)\n\t\tc.JSON(http.StatusUnauthorized, \"user already logout\")\n\t\treturn\n\t}\n\tc.JSON(http.StatusOK, \"Successfully logged out\")\n}", "title": "" }, { "docid": "8a977a0fef39580574a32af3309f7530", "score": "0.7730275", "text": "func UserLogout(u *User) {\n\tconnectedUsers.remove(u.Name)\n}", "title": "" }, { "docid": "953ebbcefc51a01feaba92028bec26ee", "score": "0.7715442", "text": "func Logout(c echo.Context) error {\n\tuser := c.Get(\"user\").(*jwt.Token)\n\tclaims := user.Claims.(jwt.MapClaims)\n\tusername := claims[\"name\"].(string)\n\n\terr := db.UpdateUserLoggedIn(username, false)\n\tif err != nil {\n\t\treturn c.JSON(http.StatusInternalServerError, \"Error logging out user\")\n\t}\n\n\treturn c.JSON(http.StatusOK, \"User logged out successfully\")\n}", "title": "" }, { "docid": "9224710181dbe52de65d7290c9591433", "score": "0.7702253", "text": "func (u *User) Logout() {\n\t// Remove from logged-in user's list\n\t// etc ...\n\tu.authenticated = false\n}", "title": "" }, { "docid": "4478b6fd229cbacad250a88c57f71b2e", "score": "0.7656929", "text": "func (u *MyUserModel) Logout() {\n\t// Remove from logged-in user's list\n\t// etc ...\n\tu.authenticated = false\n}", "title": "" }, { "docid": "ce114cf04db4685511050ece06e15c94", "score": "0.7655605", "text": "func (a *Auth) Logout(w http.ResponseWriter, r *http.Request) {\n\tu := a.userstate.Username(r)\n\ta.userstate.Logout(u)\n\ta.userstate.ClearCookie(w)\n\ta.userstate.RemoveUser(u)\n\tutil.OK(w, r)\n}", "title": "" }, { "docid": "0ce7ba807a90f4296122c2a5537acf95", "score": "0.75342095", "text": "func (h *UserRepos) Logout(ctx context.Context, w http.ResponseWriter, r *http.Request, params map[string]string) error {\n\n\tsess := webcontext.ContextSession(ctx)\n\n\t// Set the access token to empty to logout the user.\n\tsess = webcontext.SessionDestroy(sess)\n\n\tif err := sess.Save(r, w); err != nil {\n\t\treturn err\n\t}\n\n\t// Redirect the user to the root page.\n\treturn web.Redirect(ctx, w, r, \"/\", http.StatusFound)\n}", "title": "" }, { "docid": "8dd37fb3cac1b06a2339a42e289b07da", "score": "0.7504329", "text": "func Logout(c buffalo.Context) error {\n\tsessionID := c.Value(\"SessionID\").(int)\n\tadmin := c.Value(\"Admin\")\n\tif admin != nil {\n\t\t// \"log out\" by unscoping out auth token\n\t\ttoken, err := utils.GenerateScopedToken(admin.(string), 0, sessionID)\n\t\tif err != nil {\n\t\t\treturn c.Error(http.StatusBadRequest, err)\n\t\t}\n\t\treturn c.Render(http.StatusOK, render.JSON(&common.TokenPayload{\n\t\t\tToken: token,\n\t\t}))\n\t}\n\tif err := modelext.DeleteUserSession(c, sessionID); err != nil {\n\t\treturn c.Error(http.StatusInternalServerError, err)\n\t}\n\treturn c.Render(http.StatusOK, render.JSON(&common.TokenPayload{\n\t\tToken: \"\",\n\t}))\n}", "title": "" }, { "docid": "7a30781fbcf05a7edf7ef823e96865c9", "score": "0.74651235", "text": "func Logout(app *aero.Application, authLog *log.Log) {\n\tapp.Get(\"/logout\", func(ctx aero.Context) error {\n\t\tif ctx.HasSession() {\n\t\t\tuser := arn.GetUserFromContext(ctx)\n\n\t\t\tif user != nil {\n\t\t\t\tauthLog.Info(\"%s logged out | %s | %s | %s | %s\", user.Nick, user.ID, ctx.IP(), user.Email, user.RealName())\n\t\t\t}\n\n\t\t\tctx.Session().Delete(\"userId\")\n\t\t}\n\n\t\treturn ctx.Redirect(http.StatusTemporaryRedirect, \"/\")\n\t})\n}", "title": "" }, { "docid": "851814a58041b9447799178b0948fbc5", "score": "0.7461463", "text": "func (userHandlersImpl UserHandlersImpl) Logout(w http.ResponseWriter, req *http.Request) {\n\n\tresp := \"\"\n\tWriteOKResponse(w, resp)\n\n}", "title": "" }, { "docid": "79ccd9a6590e614c6b79ee26beedcf6b", "score": "0.7450823", "text": "func Logout(w http.ResponseWriter, r *http.Request) error {\n\tsession, _ := loggedUserSession.Get(r, \"authenticated-user-session\")\n\tsession.Values[\"username\"] = \"\"\n\treturn session.Save(r, w)\n}", "title": "" }, { "docid": "ffda2f1df731837dece6808c6f4742ee", "score": "0.74257076", "text": "func (user *User) Logout() error {\n\tuser.IsOnline = false\n\tuser.LimitationPeriod = time.Now()\n\treturn nil\n}", "title": "" }, { "docid": "41d36df0e983ad713560c53d8280b582", "score": "0.74228424", "text": "func (u *USER_DB) Logout() {\n\t// Remove from logged-in user's list\n\t// etc ...\n\tu.authenticated = false\n}", "title": "" }, { "docid": "76fd2e527e64711c7b816214c0b0d282", "score": "0.7410684", "text": "func LogOutUser(c echo.Context) error {\n\tatoken := c.Request().Header.Get(\"accessToken\")\n\tif err := service.LogOutUser(atoken); err != nil {\n\t\treturn c.JSON(fasthttp.StatusBadRequest, model.NewErrorResponse(\"2002\", err.Error()))\n\t}\n\treturn c.JSON(fasthttp.StatusOK, model.NewErrorResponse(\"0\", \"Success\"))\n}", "title": "" }, { "docid": "e7a28c4c47b71b6f4a37a411dcad6a3e", "score": "0.7364808", "text": "func (h *Handler) Logout(w http.ResponseWriter, r *http.Request) {\n\tswitch r.Method {\n\tcase \"GET\":\n\t\terr := h.Services.User.Logout(Authorized.UUID)\n\t\tif err != nil {\n\t\t\tJsonResponse(w, r, http.StatusBadRequest, \"\")\n\t\t\treturn\n\t\t}\n\t\tJsonResponse(w, r, http.StatusOK, \"success\")\n\tcase \"POST\":\n\tdefault:\n\t\tJsonResponse(w, r, http.StatusBadRequest, \"Bad Request\")\n\t}\n}", "title": "" }, { "docid": "f5b3456c41568483ff2a7e2c804a3fe0", "score": "0.73349506", "text": "func Logout(res http.ResponseWriter, req *http.Request) error {\n\tsession, err := Store.Get(req, SessionName)\n\tif err != nil {\n\t\treturn err\n\t}\n\tsession.Options.MaxAge = -1\n\tsession.Values = make(map[interface{}]interface{})\n\terr = session.Save(req, res)\n\tif err != nil {\n\t\treturn errors.New(\"Could not delete user session \")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f2b3fd5322ce22dcb8ad42be9dc8967d", "score": "0.73128897", "text": "func Logout(ctx echo.Context) error {\n\tif _, ok := ctx.Get(\"User\").(*models.Person); ok {\n\t\tutils.DeleteSession(ctx, settings.App.Session.Lang)\n\t\tutils.DeleteSession(ctx, settings.App.Session.Flash)\n\t\tutils.DeleteSession(ctx, settings.App.Session.Name)\n\t}\n\tctx.Redirect(http.StatusFound, \"/\")\n\treturn nil\n}", "title": "" }, { "docid": "491f018664829918d7292c665eab3a96", "score": "0.7310873", "text": "func Logout(r *http.Request) {\n\ts := getSessionFromRequest(r)\n\tif s.ID == 0 {\n\t\treturn\n\t}\n\n\t// Store Logout to the user log\n\tfunc() {\n\t\tlog := &Log{}\n\t\tlog.SignIn(s.User.Username, log.Action.Logout(), r)\n\t\tlog.Save()\n\t}()\n\n\ts.Logout()\n\n\t// Delete the cookie from memory if we sessions are cached\n\tif CacheSessions {\n\t\tdelete(cachedSessions, s.Key)\n\t}\n\n\tIncrementMetric(\"uadmin/security/logout\")\n}", "title": "" }, { "docid": "2aae76dcc955e3097e5a1392cb77cd85", "score": "0.7310258", "text": "func (c UserInfo) Logout() revel.Result {\n\tc.Session.Del(\"DiscordUserID\")\n\tc.Response.Status = 200\n\treturn c.Render()\n}", "title": "" }, { "docid": "a36c7dd724612c1ae37796e6a371bb46", "score": "0.72971976", "text": "func (uh *UserHandler) Logout(w http.ResponseWriter, r *http.Request) {\n\tnewSession := uh.configSess()\n\tcookie, _ := r.Cookie(newSession.SID)\n\n\tsession.Remove(newSession.SID, w)\n\tuh.SService.DeleteSession(cookie.Value)\n\thttp.Redirect(w, r, \"/Login\", http.StatusSeeOther)\n}", "title": "" }, { "docid": "a5304cbd89f9826c112953fb29b78d15", "score": "0.7285039", "text": "func Logout(c *gin.Context) {\n\ttokenString := util.ExtractToken(c.Request)\n\n\tau, err := util.ExtractTokenMetadata(tokenString)\n\tif err != nil {\n\t\tc.JSON(http.StatusUnauthorized, \"unauthorized\")\n\t\treturn\n\t}\n\n\tdeleted, delErr := util.DeleteAuth(au.AccessUuid)\n\tif delErr != nil || deleted == 0 { //if any goes wrong\n\t\tc.JSON(http.StatusUnauthorized, \"unauthorized\")\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, \"Successfully logged out\")\n}", "title": "" }, { "docid": "e791057e8a7eb31dbf65c04e96b2d34d", "score": "0.72821784", "text": "func UserLogout(conn *store.Connection, userID uuid.UUID) error {\n\treturn tokens.RevokeAllRefreshTokens(conn, userID)\n}", "title": "" }, { "docid": "0a839b186b7b1f88a66b2fc573a0b840", "score": "0.7274833", "text": "func UserLogoutHandler(c *gin.Context) {\n\tlogout := c.PostForm(\"logout\")\n\tif logout != \"\" {\n\t\tcookies.Clear(c)\n\t\turl := c.DefaultPostForm(\"redirectTo\", \"/\")\n\t\tif strings.Contains(url, \"/mod/\") {\n\t\t\turl = \"/\"\n\t\t}\n\t\tc.Redirect(http.StatusSeeOther, url)\n\t} else {\n\t\tc.Status(http.StatusNotFound)\n\t}\n}", "title": "" }, { "docid": "293a53c7eb9e33cde58af504b2df3200", "score": "0.72541356", "text": "func (s *UserServer) Logout(ctx context.Context, token *pb.Token) (*pb.Status, error) {\n\tvar err error\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tutils.GetLog().Error(\"rpc.user.Logout error: %+v\", err)\n\t\t}\n\t}()\n\n\tout := users.NewLogout(token.Token)\n\tif err := out.Do(); err != nil {\n\t\treturn nil, errors.New(out.ErrorCode().String())\n\t}\n\treturn &pb.Status{Success: true}, nil\n}", "title": "" }, { "docid": "6506ff47b109c4a0b198a3b9fe4a1615", "score": "0.72534305", "text": "func (c *UserAPIController) LogoutUser(w http.ResponseWriter, r *http.Request) {\n\tresult, err := c.service.LogoutUser(r.Context())\n\t// If an error occurred, encode the error with the status code\n\tif err != nil {\n\t\tc.errorHandler(w, r, err, &result)\n\t\treturn\n\t}\n\t// If no error, encode the body and the result code\n\tEncodeJSONResponse(result.Body, &result.Code, result.Headers, w)\n}", "title": "" }, { "docid": "a4dab3289f055da6f432674aeac02348", "score": "0.72307694", "text": "func Logout(_ *gorm.DB, rc *redis.Client, _ http.ResponseWriter, r *http.Request, s *status.Status) (int, error) {\n\tctx := context.Background()\n\trequestUsername := getVar(r, model.UsernameVar)\n\tclaims := GetTokenClaims(ExtractToken(r))\n\ttokenUsername := fmt.Sprintf(\"%v\", claims[\"sub\"])\n\tif tokenUsername != requestUsername {\n\t\ts.Message = status.LogoutFailure\n\t\treturn http.StatusForbidden, nil\n\t}\n\ts.Code = status.SuccessCode\n\ts.Message = status.LogoutSuccess\n\trc.Del(ctx, \"access_\"+requestUsername)\n\treturn http.StatusOK, nil\n}", "title": "" }, { "docid": "6c7fdb6d1c1fefad039397c92fed2936", "score": "0.712987", "text": "func (a *loginAPI) HandleLogout(user security.User, w http.ResponseWriter, r *http.Request) error {\n\tlog.WithField(\"func\", \"server.HandleLogout\").Debugf(\"for user '%s'\", user.Username)\n\t// remove the cookie by expiring it\n\ta.setJWTCookie(a.jwt.CookieName, \"\", -1, w)\n\ta.appCookie.Set(errors.FlashKeyInfo, fmt.Sprintf(\"User '%s' was logged-off!\", user.Email), cookieExpiry, w)\n\thttp.Redirect(w, r, a.jwt.LoginRedirect, http.StatusTemporaryRedirect)\n\treturn nil\n}", "title": "" }, { "docid": "22757c288f29f2d4fc579c35b800ffcb", "score": "0.7112071", "text": "func (avisess *AviSession) Logout() error {\n\turl := avisess.prefix + \"logout\"\n\treq, _ := avisess.newAviRequest(\"POST\", url, nil, avisess.tenant)\n\t_, err := avisess.client.Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d1b85aff0549c094539b3b006aa687df", "score": "0.71079355", "text": "func Logout(w http.ResponseWriter, r *http.Request) {\r\n\t//Get user id of the session\r\n\tctx, cancel := context.WithTimeout(context.Background(), time.Second)\r\n\tdefer cancel()\r\n\tcookie, err := r.Cookie(\"sessionId\")\r\n\tif err != nil || cookie.Value != \"\" {\r\n\t\ttoken, _ := url.QueryUnescape(cookie.Value)\r\n\t\t_, err = AuthClient.RemoveAuthToken(ctx, &authpb.AuthToken{Token: token})\r\n\t\texpiration := time.Now()\r\n\t\tcookie := http.Cookie{Name: \"sessionId\", Path: \"/\", HttpOnly: true, Expires: expiration, MaxAge: -1}\r\n\t\thttp.SetCookie(w, &cookie)\r\n\t}\r\n\tAPIResponse(w, r, 200, \"Logout successful\", make(map[string]string))\r\n}", "title": "" }, { "docid": "c0c82b1621e7bcbae5092d18c4fa500e", "score": "0.7107755", "text": "func (ctrl *UserController) Logout(c *gin.Context) {\n\thttp.SetCookie(c.Writer, &http.Cookie{Path: \"/\", Name: auth.RefreshTokenKey, MaxAge: -1, Secure: true, HttpOnly: true, SameSite: http.SameSiteNoneMode})\n\thttp.SetCookie(c.Writer, &http.Cookie{Path: \"/\", Name: auth.AccessTokenKey, MaxAge: -1, Secure: true, HttpOnly: true, SameSite: http.SameSiteNoneMode})\n\n\tc.JSON(http.StatusOK, utils.Msg(\"Logged out\"))\n}", "title": "" }, { "docid": "7a01da53ba6fbce73a02dfcaec794012", "score": "0.7085781", "text": "func LogoutUserPath() string {\n\treturn \"/logout\"\n}", "title": "" }, { "docid": "808485d28c6e18a8cb991bb14a18662a", "score": "0.7078693", "text": "func logout(ctx context.Context) error {\n\tr := ctx.HttpRequest()\n\tsession, _ := core.GetSession(r)\n\t_, ok := session.Values[\"user\"]\n\tif ok {\n\t\tdelete(session.Values, \"user\")\n\t\tif err := session.Save(r, ctx.HttpResponseWriter()); err != nil {\n\t\t\tlog.Error(\"Unable to save session: \", err)\n\t\t}\n\t}\n\treturn goweb.Respond.WithPermanentRedirect(ctx, \"/\")\n}", "title": "" }, { "docid": "b9f5e9e879a5f88be36e6d4cc2b92508", "score": "0.7064985", "text": "func (bap *BaseAuthProvider) Logout(ctx *RequestCtx) {\n\t// When this is internally called (such as user reset password, or been disabled)\n\t// ctx might be nil\n\tif ctx.Ctx != nil {\n\t\t//delete token cookie, keep uuid cookie\n\t\tWriteToCookie(ctx.Ctx, AuthTokenName, \"\")\n\t}\n\tif ctx.User != nil {\n\t\t(*bap.Mutex).Lock()\n\t\tdelete(bap.TokenCache, ctx.User.Token())\n\t\tbap.TokenToUsername.DelString(ctx.User.Token())\n\t\t(*bap.Mutex).Unlock()\n\t\tlog.Println(\"Logout:\", ctx.User.Username())\n\t}\n}", "title": "" }, { "docid": "5e8ced255cc686e1082b346fd35fd9c2", "score": "0.70621306", "text": "func (c *Controller) Logout(ctx context.Context) (err error) {\n\t// Build request\n\treq, err := c.requestBuild(ctx, \"GET\", authenticationAPIName, \"logout\", nil)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"request building failure: %w\", err)\n\t}\n\t// execute auth request\n\tif err = c.requestExecute(ctx, req, nil, false); err != nil {\n\t\terr = fmt.Errorf(\"executing request failed: %w\", err)\n\t}\n\treturn\n}", "title": "" }, { "docid": "ca527263acc57d74ef488d9739f6f069", "score": "0.7061587", "text": "func (a *authSvc) Logout(ctx context.Context) error {\n\taccessUuid, ok := ctx.Value(AccessUuidKey).(string)\n\tif !ok {\n\t\treturn errors.New(\"access uuid not present in context\")\n\t}\n\tdeleted, err := deleteAuth(\"access_token\", accessUuid)\n\tif err != nil || deleted == 0 {\n\t\treturn errors.New(\"not authenticated\")\n\t}\n\trefreshUuid, ok := ctx.Value(RefreshUuidKey).(string)\n\tif !ok {\n\t\treturn errors.New(\"refresh uuid not present in context\")\n\t}\n\tdeleted, err = deleteAuth(\"refresh_token\", refreshUuid)\n\tif err != nil || deleted == 0 {\n\t\treturn errors.New(\"not authenticated\")\n\t}\n\tcookieAccess := getCookieAccess(ctx)\n\tcookieAccess.RemoveToken(\"jwtAccess\")\n\tcookieAccess.RemoveToken(\"jwtRefresh\")\n\treturn nil\n}", "title": "" }, { "docid": "5d5d15d7963ea5a83c923d049dc444ad", "score": "0.70412016", "text": "func (as *AdminServer) Logout(w http.ResponseWriter, r *http.Request) {\n\tsession := ctx.Get(r, \"session\").(*sessions.Session)\n\tdelete(session.Values, \"id\")\n\tFlash(w, r, \"success\", \"You have successfully logged out\")\n\tsession.Save(r, w)\n\thttp.Redirect(w, r, \"/login\", http.StatusFound)\n}", "title": "" }, { "docid": "01e0d13a445ed4bc9ad836c21daf132b", "score": "0.70401347", "text": "func (user *User) LogoutUser() {\n\tuser.Lock.Acquire(\"logout\")\n\tdefer user.Lock.Release()\n\tuser.ActiveClients -= 1\n\tif user.ActiveClients < 0 {\n\t\tuser.ActiveClients = 0\n\t}\n\tif user.ActiveClients == 0 {\n\t\tuser.Active = false\n\t}\n\twires.UsersUpdate.Offer(user.User)\n}", "title": "" }, { "docid": "a47d0110d103203551d1759eeaa98b17", "score": "0.703736", "text": "func Logout(res http.ResponseWriter, req *http.Request) {\n\t_, ok := cookiesManager.GetCookieValue(req, CookieName)\n\tif ok {\n\t\t// cbs.SessionManager.RemoveSession(uuid)\n\t\tcookiesManager.RemoveCookie(res, CookieName)\n\t} else {\n\t\tlog.Trace(\"Logging out without the cookie\")\n\t}\n}", "title": "" }, { "docid": "d69dad32005485adac6d33d9f6b658dd", "score": "0.70371646", "text": "func (a *Client) UserLogout(params *UserLogoutParams) (*UserLogoutOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewUserLogoutParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"User.logout\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/user/logout\",\n\t\tProducesMediaTypes: []string{\"application/javascript\", \"application/xml\", \"text/javascript\", \"text/xml\"},\n\t\tConsumesMediaTypes: []string{\"application/x-www-form-urlencoded\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &UserLogoutReader{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.(*UserLogoutOK), nil\n\n}", "title": "" }, { "docid": "7bfbcb4990c9e7a3be85acee63dc4b10", "score": "0.7034494", "text": "func (context Context) Logout() error {\n\n\treqURL := url.URL{\n\t\tScheme: \"http\",\n\t\tHost: context.ServerAddress,\n\t\tPath: path.Join(apiPrefix, \"users/logout\"),\n\t}\n\n\treq, err := http.NewRequest(\"GET\", reqURL.String(), nil)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"HTTP new request error\")\n\t}\n\tcontext.UserCredentials.Apply(req.Header)\n\n\tclient := &http.Client{}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"HTTP client error\")\n\t}\n\n\tif resp.StatusCode != 200 {\n\t\terrorResponse, err := getAPIErrorResponse(resp)\n\t\terrorString := errorResponse.String()\n\t\tif err == nil || errorString == \"\" {\n\t\t\terrorString = resp.Status\n\t\t}\n\t\treturn errors.New(\"API error: \" + resp.Status)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "079f5a894b26cbf9401c15c49b045b94", "score": "0.7032781", "text": "func (m *Repository) Logout(w http.ResponseWriter, r *http.Request) {\n\tif !m.App.Session.Exists(r.Context(), \"user_id\") {\n\t\thttp.Redirect(w, r, \"/\", http.StatusSeeOther)\n\t\treturn\n\t}\n\n\t_ = m.App.Session.Destroy(r.Context())\n\t_ = m.App.Session.RenewToken(r.Context())\n\tm.App.Session.Put(r.Context(), \"flash\", \"Successfully logged out!\")\n\n\thttp.Redirect(w, r, \"/\", http.StatusSeeOther)\n}", "title": "" }, { "docid": "6b68f9afc9b1a4e874e7d54a0d0503a5", "score": "0.7030284", "text": "func (uc UsersController) Signout(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {\n\tfmt.Fprint(w, \"UserSignout\")\n}", "title": "" }, { "docid": "c5f9e9aea87f77c3da762287a30b802b", "score": "0.7014632", "text": "func Logout(w http.ResponseWriter, req *http.Request) {\n\tif !requirePost(w, req) {\n\t\tlog.Warn(\"Logout request should use POST method\")\n\t\treturn\n\t}\n\tif !requireAuth(w, req) {\n\t\tlog.Warn(\"Logout request should be authenticated\")\n\t\treturn\n\t}\n\tsid := req.Context().Value(auth.SESSION_ID).(string)\n\terr := storage.DeleteSession(sid)\n\tif err != nil {\n\t\tlog.Error(err)\n\t}\n\tconf.RedirectTo(\"/\", \"\", w, req)\n}", "title": "" }, { "docid": "de8b6c729e592434501f149cc26a11fc", "score": "0.69463044", "text": "func Logout(w http.ResponseWriter, r *http.Request) {\n\tPrintln(\"Endpoint Hit: Logout\")\n\n\tsession := sessions.Start(w, r)\n\tsession.Clear()\n\tsessions.Destroy(w, r)\n\thttp.Redirect(w, r, \"/\", 302)\n}", "title": "" }, { "docid": "b1e629dcabb7e067e0ccb2c15944502f", "score": "0.6936827", "text": "func LogoutUser(w http.ResponseWriter, r *http.Request, sessionStore sessions.Store, userSession string) error {\n\tif r.Context().Value(UserCtxKey) != nil {\n\t\tvar session *sessions.Session\n\t\tvar err error\n\n\t\tif userSession == \"\" {\n\t\t\tsession, err = sessionStore.Get(r, \"user\")\n\t\t} else {\n\t\t\tsession, err = sessionStore.Get(r, userSession)\n\t\t}\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tsession.Options = &sessions.Options{\n\t\t\tMaxAge: -1,\n\t\t}\n\t\tsession.Save(r, w)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "04277079a1bc6b43f655451ef37fc64c", "score": "0.6907054", "text": "func logout(w http.ResponseWriter, r *http.Request) {\n\tsession, err := store.Get(r, \"auth\")\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tsession.Values[\"user\"] = User{}\n\tsession.Options.MaxAge = -1\n\n\terr = session.Save(r, w)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tlogRequest(r)\n}", "title": "" }, { "docid": "990dee69afa04154e62e123b2f9b224a", "score": "0.6905712", "text": "func (m *MgoUserManager) Logout(token string) error {\n\treturn m.LoginColl.RemoveId(token)\n}", "title": "" }, { "docid": "1059a91825513d2f1c524e89e8f84629", "score": "0.69029546", "text": "func (m *Model) Logout(ctx context.Context, header string) error {\n\tau, err := m.extractTokenMetadata(header)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = m.authDAO.DeleteByID(ctx, au.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f3407dc6c9fed1536f29c3cf395210ef", "score": "0.68765223", "text": "func Logout(res http.ResponseWriter, req *http.Request) {\n\ttokenID := req.Context().Value(\"tokenID\").(string)\n\tresponse := make(map[string]interface{})\n\tmsg := constants.Logout\n\t_, err := connectors.RemoveDocument(\"tokens\", tokenID)\n\tif err != nil {\n\t\trender.Render(res, req, responses.NewHTTPError(http.StatusServiceUnavailable, constants.Unavailable))\n\t\treturn\n\t}\n\tresponse[\"message\"] = msg\n\trender.Render(res, req, responses.NewHTTPSucess(http.StatusOK, response))\n}", "title": "" }, { "docid": "941bbc441f807b8b4fe4b458643ea34e", "score": "0.6849958", "text": "func (s *AuthService) Logout(login, refreshToken string) error {\n\terr := s.client.Auth.Logout(login, refreshToken)\n\treturn err\n}", "title": "" }, { "docid": "5fc48d70f426d8bd341abc5dda279ee2", "score": "0.68409383", "text": "func LogoutHandler(ctx *enliven.Context) {\n\tctx.Session.Destroy()\n\tctx.Redirect(config.GetConfig()[\"user_logout_redirect\"])\n}", "title": "" }, { "docid": "a803e2c8e30e35238ea95b04e7e3eb47", "score": "0.68361324", "text": "func Logout(w http.ResponseWriter, r *http.Request) {\n\t// TODO JvD: revoke the token?\n\thttp.Redirect(w, r, \"/login\", http.StatusFound)\n}", "title": "" }, { "docid": "2cdad1c844b940b38a9c03fd268fcc02", "score": "0.68323886", "text": "func (c *Client) Logout(ctx context.Context) error {\n\treq := c.Resource(internal.SessionPath).Request(http.MethodDelete)\n\treturn c.Do(ctx, req, nil)\n}", "title": "" }, { "docid": "c933da9c6ba4ff098c7b40f857b17d1a", "score": "0.68231654", "text": "func UsersLogout(c buffalo.Context) error {\n\tc.Session().Clear()\n\tc.Flash().Add(\"success\", \"Goodbye!\")\n\treturn c.Redirect(302, \"/\")\n}", "title": "" }, { "docid": "ba57ac5ee5ae0951fb66c15c31376fca", "score": "0.68209773", "text": "func (h *auth) Logout(c echo.Context) error {\n\tsession := currentSession(c)\n\tif session != nil {\n\t\terr := h.db.Delete(session)\n\t\tif err != nil && h.db.IsNotFound(err) {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn c.NoContent(http.StatusNoContent)\n}", "title": "" }, { "docid": "6cd53b6837169b4ff3b60a01bdd457ef", "score": "0.681692", "text": "func (c *Client) Logout() error {\n\t_, err := c.Exec(\"logout\")\n\treturn err\n}", "title": "" }, { "docid": "236c8453374653ada256763985b3f4f4", "score": "0.6799546", "text": "func (s *server) Logout(ctx context.Context, in *pb.LogRequest) (*pb.LogResponse, error) {\n\tlog.Printf(\"Received: %v\", \"Logout\")\n\tsuc, err := DeleteToken(in.Email, in.Token)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &pb.LogResponse{Sucess: suc}, nil\n}", "title": "" }, { "docid": "1e580e9351d94cb417ea7d708c6a9aec", "score": "0.6788425", "text": "func (am AuthManager) Logout(ctx *Ctx) error {\n\tsessionValue := am.readSessionValue(ctx)\n\t// validate the sessionValue isn't unset\n\tif len(sessionValue) == 0 {\n\t\treturn nil\n\t}\n\n\t// issue the expiration cookies to the response\n\tctx.ExpireCookie(am.CookieNameOrDefault(), am.CookiePathOrDefault())\n\tctx.Session = nil\n\n\t// call the remove handler if one has been provided\n\tif am.RemoveHandler != nil {\n\t\treturn am.RemoveHandler(ctx.Context(), sessionValue)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "53287a5cfb78eea6f48a10ca14868545", "score": "0.67819935", "text": "func (as *AuthService) SignOut(id int) error {\n\tdetails := &MethodInfo{\n\t\tName: \"SignOut\",\n\t\tDescription: \"SignOut is the DB method used to SignOut\",\n\t}\n\ttx, err := as.db.Begin()\n\t_, err = tx.Exec(\"UPDATE users SET session_token='' WHERE id=$1\", id)\n\tif err != nil {\n\t\treturn errors.Wrap(err, details.Name)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "39c7eb7965a1629eaa705dfe32ca0a44", "score": "0.6765547", "text": "func signOut(w http.ResponseWriter, r *http.Request) {\n\tlogoutUser(w, r)\n\tresp := map[string]interface{}{\n\t\t\"success\": true,\n\t}\n\tapiResponse(resp, w)\n}", "title": "" }, { "docid": "90ebac810461c2614f6c513f788befb2", "score": "0.6755527", "text": "func (c *UCSClient) Logout() {\n\tif c.IsLoggedIn() {\n\t\tc.Logger.Debug(\"Logging out\\n\")\n\t\treq := ucs.LogoutRequest{\n\t\t\tCookie: c.cookie,\n\t\t}\n\t\tpayload, err := req.Marshal()\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\n\t\tc.Post(payload)\n\t\tc.cookie = \"\"\n\t\tc.outDomains = \"\"\n\t}\n\tc.Logger.Info(\"Logged out\\n\")\n}", "title": "" }, { "docid": "eda731749bf0776d10533769e5437a93", "score": "0.67493945", "text": "func logout(c *gin.Context) {\n\t//Give the user a session\n\tsession := sessions.Default(c)\n\tclearSession(&session)\n\n\tc.Redirect(http.StatusFound, \"/\")\n}", "title": "" }, { "docid": "55bf1a0861c70cdd5b4599552f55db38", "score": "0.6747342", "text": "func (client *Client) Logout() error {\n\t_, err := client.SendQuery(NewLogoutQuery())\n\treturn err\n}", "title": "" }, { "docid": "347ad528ac32b620a45463490dd1457e", "score": "0.6746535", "text": "func Logout(rw http.ResponseWriter, request *http.Request) {\n\n\tlog.Println(\"call Logout\")\n\n\t// Cookieからセッション情報取得\n\tsessionID, err := request.Cookie(sessionIDName)\n\tif err != nil {\n\t\t// セッション情報取得に失敗した場合TOP画面に遷移\n\t\tlog.Println(\"Cookie 取得 失敗\")\n\t\tlog.Println(err)\n\t\t// Cookieクリア\n\t\tclearCookie(rw)\n\t\thttp.Redirect(rw, request, \"/index\", http.StatusFound)\n\t\treturn\n\t}\n\tlog.Println(\"Cookie 取得 成功\")\n\tlog.Println(\"セッション情報:\", sessionID.Value)\n\n\t// セッション情報を削除\n\tdbm := db.ConnDB()\n\t_, err = dbm.Exec(\"delete from sessions where sessionID = ?\", sessionID.Value)\n\tif err != nil {\n\t\tlog.Println(\"セッション 削除 失敗\")\n\t} else {\n\t\tlog.Println(\"セッション 削除 成功\")\n\t\tlog.Println(\"削除したセッションID:\", sessionID.Value)\n\t}\n\n\t// CookieクリアしてTOP画面表示\n\tclearCookie(rw)\n\thttp.Redirect(rw, request, \"/index\", http.StatusFound)\n}", "title": "" }, { "docid": "c9f96cabd9ebf9714ef0b5fbcb562bd5", "score": "0.67450726", "text": "func (s *Session) Logout() error { return nil }", "title": "" }, { "docid": "4c0a15647d4576edccc1b9dd3c523245", "score": "0.6742652", "text": "func (c *Client) Logout() (err error) {\n\t/* URL has to end in JSON, otherwise it will produce XML output */\n\treturn c.getResponse(\"/Auth/Logout/JSON\", nil, new(BaseResponse))\n}", "title": "" }, { "docid": "b5b99913d67abb404b997a61bdb2d7ec", "score": "0.6741093", "text": "func Logout(w http.ResponseWriter, r *http.Request) {\n\tif sessions.GoodSession(r) != true {\n\t\tjson.NewEncoder(w).Encode(\"Session Expired. Log out and log back in.\")\n\t}\n\tstore, err := pgstore.NewPGStore(os.Getenv(\"PGURL\"), key)\n\tcheck(err)\n\tdefer store.Close()\n\n\tsession, err := store.Get(r, \"scheduler-session\")\n\tcheck(err)\n\t// Revoke users authentication\n\tsession.Values[\"authenticated\"] = false\n\tw.WriteHeader(http.StatusOK)\n\tsession.Options.MaxAge = -1\n\tsession.Save(r, w)\n}", "title": "" }, { "docid": "be4f42e97a28696d51a5b7623b2e3413", "score": "0.6723265", "text": "func (mod *backendModule) Logout(uid int64) error {\n\tm := &gatepb.Logout{\n\t\tUid: uid,\n\t}\n\treturn mod.send(m.Typeof(), m)\n}", "title": "" }, { "docid": "198af50e02d75a0c92f4ceac795bea21", "score": "0.67225534", "text": "func (a *noAuth) Logout(c echo.Context) error {\n\treturn a.logout(c)\n}", "title": "" }, { "docid": "b21601ba658b86b6c82240eb0befe216", "score": "0.6691851", "text": "func (AuthenticationController) Logout(c *gin.Context) {\n\tsession := sessions.Default(c)\n\tsession.Clear()\n\tif sessionErr := session.Save(); sessionErr != nil {\n\t\tlog.Print(sessionErr)\n\t\tutils.CreateError(c, http.StatusInternalServerError, \"Failed to logout.\")\n\t\tc.Abort()\n\t\treturn\n\t}\n\tc.JSON(http.StatusOK, gin.H{\"message\": \"Logged out...\"})\n}", "title": "" }, { "docid": "a968b118d3503941c248c54cf462e770", "score": "0.6691021", "text": "func Logout(r * http.Request, response * APIResponse) {\n\tuser := UserForName(r.FormValue(\"username\"))\n\tresponse.Message = \"Logout \" + r.FormValue(\"username\")\n\tfor i := 0; i < len(Keys); i++ {\n\t\tif Keys[i].Key == r.FormValue(\"key\") && Keys[i].User == user.ID {\n\t\t\tKeys[i].EndTime = Keys[i].StartTime\n\t\t\tSaveDatabase(&Keys, \"keys\")\n\t\t\tbreak\n\t\t}\n\t}\n}", "title": "" }, { "docid": "cdf1025b9ccc459cb3de02b6bf7e328a", "score": "0.66900545", "text": "func (controller *Auth) Logout() {\n\tcontroller.distroySession()\n\tcontroller.DeleteConnectionCookie()\n\tcontroller.Redirect(\"/\", 200)\n}", "title": "" }, { "docid": "9adcea6907cb4a04071db7500911a49d", "score": "0.66864425", "text": "func LogoutCurrentUser(args []string) error {\n\tlogoutArgs := append([]string{\"logout\"}, args...)\n\t_, err := utils.RunCommand(\"pulumi\", logoutArgs)\n\treturn err\n}", "title": "" }, { "docid": "4a3581fc20c0b7553b051b42d6543937", "score": "0.6681431", "text": "func (f *Firebase) LogoutUser(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\tw.WriteHeader(http.StatusOK)\n}", "title": "" }, { "docid": "90aa338cad368a5281052d453276a822", "score": "0.667701", "text": "func Logout(origin string, o *model.OneTimePassword) error {\n\tu, err := url.Parse(origin)\n\tif err != nil {\n\t\treturn err\n\t}\n\tu.Path = path.Join(u.Path, \"housecontrol/v1/indoorauth/logout\")\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\treq.Header.Add(\"Authorization\", o.GetAuthHeader())\n\tresp, err := client.Do(req)\n\tif err != nil && err != io.EOF {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\tio.Copy(ioutil.Discard, resp.Body)\n\t// fmt.Println(\"logouted, status:\", resp.StatusCode)\n\treturn nil\n}", "title": "" }, { "docid": "e18ddc3fad2cb81fbfcce0396696b9c4", "score": "0.6669948", "text": "func (a *Auth) Logout(ctx *gin.Context) error {\n\tuuid, err := ctx.Cookie(a.cookie)\n\tif err != nil {\n\t\treturn nil\n\t}\n\n\t// delete redis record\n\tif err := a.redis.Del(uuid).Err(); err != nil {\n\t\treturn err\n\t}\n\n\t// delete cookie\n\thttp.SetCookie(ctx.Writer, &http.Cookie{\n\t\tName: a.cookie,\n\t\tValue: \"\",\n\t\tExpires: time.Unix(0, 0),\n\t})\n\treturn nil\n}", "title": "" }, { "docid": "8ed329293be47801de84b5bf92f67917", "score": "0.66474634", "text": "func (c *controller) Logout(ctx context.Context, request *web.Request) web.Result {\n\treturn c.service.LogoutFor(ctx, request.Params[\"broker\"], request, nil)\n}", "title": "" }, { "docid": "8c87eca061324e8aa2c9d1ffe28384fa", "score": "0.6646293", "text": "func logout(w http.ResponseWriter, r *http.Request) {\n\n\tif isAuthorized(w, r) {\n\t\tusername, _ := r.Cookie(\"username\")\n\t\tdelete(gostuff.SessionManager, username.Value)\n\t\tcookie := http.Cookie{Name: \"username\", Value: \"0\", MaxAge: -1}\n\t\thttp.SetCookie(w, &cookie)\n\t\tcookie = http.Cookie{Name: \"sessionID\", Value: \"0\", MaxAge: -1}\n\t\thttp.SetCookie(w, &cookie)\n\t\tw.Header().Set(\"Cache-Control\", \"no-cache, no-store, must-revalidate\")\n\t\thttp.ServeFile(w, r, \"index.html\")\n\t}\n}", "title": "" }, { "docid": "5cf5cf399362044c28488a58234218cc", "score": "0.6640534", "text": "func (a *localAuth) Logout(c echo.Context) error {\n\treturn a.logout(c)\n}", "title": "" }, { "docid": "a370bf48fe1f0a899cb7e430a283f961", "score": "0.66125137", "text": "func (env *Env) LogoutUser(c *gin.Context) {\n\n\t//Convert ID Parameter into int32\n\ttmp, err := strconv.Atoi(c.Param(\"id\"))\n\tif err != nil {\n\t\tLog.WithField(\"module\", \"handler\").WithError(err)\n\t\tc.AbortWithStatusJSON(http.StatusInternalServerError, errs.RQST001)\n\t\treturn\n\t}\n\tuserid := int32(tmp)\n\n\treqUserId, _ := c.Get(\"userid\")\n\n\t//Check if UserID exists\n\tvar exists int64\n\tresult := env.db.Model(mysql.User{}).Where(\"id = ?\", userid).Count(&exists)\n\tif result.Error != nil {\n\t\tLog.WithField(\"module\", \"sql\").WithError(result.Error)\n\t\tc.AbortWithStatusJSON(http.StatusInternalServerError, errs.DBSQ001)\n\t\treturn\n\t}\n\n\tif exists == 0 {\n\t\tLog.WithField(\"module\", \"handler\").Error(\"User not found in Database\")\n\t\tc.AbortWithStatusJSON(http.StatusBadRequest, errs.DBSQ006)\n\t\treturn\n\t}\n\n\tif userid != reqUserId {\n\t\tvar user mysql.User\n\n\t\tresult := env.db.Where(\"id = ?\", reqUserId).First(&user)\n\t\tif result.Error != nil {\n\t\t\tLog.WithField(\"module\", \"sql\").WithError(result.Error)\n\t\t\tc.AbortWithStatusJSON(http.StatusInternalServerError, errs.DBSQ001)\n\t\t\treturn\n\t\t}\n\n\t\tLog.Debug(user)\n\n\t\terr = env.db.Model(&user).Association(\"Permissions\").Find(&user.Permissions)\n\t\tif err != nil {\n\t\t\tLog.WithField(\"module\", \"sql\").WithError(err)\n\t\t\tc.AbortWithStatusJSON(http.StatusInternalServerError, errs.DBSQ001)\n\t\t\treturn\n\t\t}\n\n\t\tif !user.Permissions.Admin {\n\t\t\tLog.WithField(\"module\", \"handler\").Error(\"User not Authorized for this Action\")\n\t\t\tc.AbortWithStatusJSON(http.StatusUnauthorized, errs.AUTH009)\n\t\t\treturn\n\t\t}\n\t}\n\n\terr = env.rdis.Remove(fmt.Sprint(userid))\n\tif err != nil {\n\t\tLog.WithField(\"module\", \"redis\").WithError(err)\n\t\tc.AbortWithStatusJSON(http.StatusInternalServerError, errs.DBSQ003)\n\t\treturn\n\t}\n\n\tresult = env.db.Model(&mysql.User{}).Where(\"id = ?\", userid).Update(\"refresh_token\", \"\")\n\tif result.Error != nil {\n\t\tLog.WithField(\"module\", \"sql\").WithError(result.Error)\n\t\tc.AbortWithStatusJSON(http.StatusInternalServerError, errs.DBSQ001)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "eec6ee532db8fa7771a8803669e2a531", "score": "0.6590412", "text": "func (router *router) SignOut(w http.ResponseWriter, r *http.Request) {\n\trouter.log.Println(\"request received at endpoint: SignOut\")\n\tif session.IsAuthenticated(w, r) {\n\t\trouter.database.Delete(&schema.Favourite{User: session.GetUser(w, r)})\n\t\tsession.SignOut(w, r)\n\t\trouter.log.Println(\"sign out completed redirecting to home page\")\n\t} else {\n\t\trouter.log.Println(\"Not signed in to sign out, redirecting to home page\")\n\t}\n\n\tHomePage(w, r)\n\treturn\n}", "title": "" }, { "docid": "04c4b345c6c1b32629145b28d89115bf", "score": "0.6585824", "text": "func (c *yorcProviderClient) Logout() error {\n\trequest, err := http.NewRequest(\"POST\", fmt.Sprintf(\"%s/logout\", c.client.baseURL), nil)\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\trequest.Header.Add(\"Accept\", \"application/json\")\n\trequest.Header.Set(\"Connection\", \"close\")\n\n\trequest.Close = true\n\n\tresponse, err := c.client.Client.Do(request)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer response.Body.Close()\n\n\tif response.StatusCode != http.StatusOK {\n\t\treturn getError(response.Body)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d35308298836b3d65be12ec6a087ecd0", "score": "0.6579336", "text": "func logout(w http.ResponseWriter,r *http.Request){\n\tsession,err:=store.Get(r,\"cookie-name\")\n\tif err!=nil{\n\t\tlog.Fatal(err)\n\t}\n\tsession.Values[\"user\"]=user{}\n\tsession.Options.MaxAge=-1\n\n\terr=session.Save(r,w)\n\tif err!=nil{\n\t\tlog.Fatal(err)\n\t}\n\thttp.Redirect(w,r,\"/\",http.StatusFound)\n}", "title": "" }, { "docid": "58ba3a706bc8dcf17781a285c7ca6416", "score": "0.6559179", "text": "func (c *Client) Logout() (string, error) {\n\n\tif c.auth == nil {\n\t\treturn \"Was not logged in\", nil\n\t}\n\n\trequest, _ := http.NewRequest(\"POST\", c.getUrl()+\"/api/v1/logout\", nil)\n\n\tresponse := new(logoutResponse)\n\n\tif err := c.doRequest(request, response); err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif response.Status == \"success\" {\n\t\treturn response.Data.Message, nil\n\t} else {\n\t\treturn \"\", errors.New(\"Response status: \" + response.Status)\n\t}\n}", "title": "" }, { "docid": "f55193b12348250a11ac12c6c2ae165a", "score": "0.655849", "text": "func (c *Client) Logout(ctx context.Context, authToken *base64.Value) error {\n\treturn c.transport.Logout(ctx, authToken)\n}", "title": "" }, { "docid": "d75e74ef898ea525ef6e8b4bed2cb1ad", "score": "0.6555835", "text": "func gwLogout(c *gin.Context) {\n\ts := getHostServer(c)\n\treqId := getRequestId(s, c)\n\tuser := getUser(c)\n\tcks := s.conf.Security.Auth.Cookie\n\tok := s.AuthManager.Logout(user)\n\tif !ok {\n\t\ts.RespBodyBuildFunc(http.StatusInternalServerError, reqId, \"auth logout fail\", nil)\n\t\treturn\n\t}\n\tsid, ok := getSid(s, c)\n\tif !ok {\n\t\ts.RespBodyBuildFunc(http.StatusInternalServerError, reqId, \"session store logout fail\", nil)\n\t\treturn\n\t}\n\t_ = s.SessionStateManager.Remove(sid)\n\tc.SetCookie(cks.Key, \"\", -1, cks.Path, cks.Domain, cks.Secure, cks.HttpOnly)\n}", "title": "" }, { "docid": "46cde33dc6e833fc80275cf360e9704c", "score": "0.6541563", "text": "func Logout(token string) {\n\t// This might have more logic later\n\ttokenware.Revoke(token)\n}", "title": "" }, { "docid": "642e21176d213dc3ac162aea327be7e9", "score": "0.65400755", "text": "func (gs *GateService) Logout(ctx context.Context, opaque string) error {\n\treturn gs.repo.RemoveToken(ctx, opaque)\n}", "title": "" }, { "docid": "2034fb11eed8bf90045c9c57fdeeb128", "score": "0.6538037", "text": "func (s *ServerConnection) Logout() error {\n\t_, err := s.CallRaw(\"Session.logout\", nil)\n\treturn err\n}", "title": "" }, { "docid": "7c856f84146cb5f3af6caa017742024f", "score": "0.6522902", "text": "func LogoutHandler(w http.ResponseWriter, r *http.Request) {\n\tif !SessionManager.Exists(r.Context(), \"userid\") {\n\t\thttp.Redirect(w, r, \"/login\", http.StatusSeeOther)\n\t\treturn\n\t}\n\tif r.Method != \"GET\" {\n\t\tshared.HTTPerr(w, fmt.Errorf(\"bad HTTP method\"), http.StatusBadRequest)\n\t\treturn\n\t}\n\tSessionManager.Remove(r.Context(), \"userid\")\n\thttp.Redirect(w, r, \"/login\", http.StatusSeeOther)\n}", "title": "" }, { "docid": "cd2f3d5e9b2f709eb88aa8450b1c5cb3", "score": "0.6519542", "text": "func logout(res http.ResponseWriter, req *http.Request) {\n sess := session.Get(req)\n\n session.Remove(sess, res)\n sess = nil\n\n return\n http.Redirect(res, req, \"/login\", 301)\n}", "title": "" }, { "docid": "9d5009c885b9c0d2cd48db45f0105166", "score": "0.6519308", "text": "func (a *OAuthStrategy) Logout() error {\n\taccessToken := a.AccessToken()\n\n\tif accessToken == \"\" {\n\t\treturn nil\n\t}\n\n\tif err := a.OAuthClient.RevokeToken(a.AccessToken()); err != nil {\n\t\treturn err\n\t}\n\n\ta.SetTokens(\"\", \"\")\n\n\treturn nil\n}", "title": "" }, { "docid": "eabdb309bf28e0ed0400479049818c27", "score": "0.64970803", "text": "func (s *Handler) Logout(ctx context.Context, req *api.LogoutRequest) (*api.EmptyResponse, error) {\n\tif err := s.DaemonService.ClusterLogout(ctx, req.ClusterUri); err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\treturn &api.EmptyResponse{}, nil\n}", "title": "" }, { "docid": "510cb7b5840bc7bc32a92547b350cc79", "score": "0.64921975", "text": "func (c *APIClient) LogoutUser(ctx _context.Context, id int32) apiLogoutUserRequest {\n\treturn apiLogoutUserRequest{\n\t\tclient: c,\n\t\tctx: ctx,\n\t\tid: id,\n\t}\n}", "title": "" }, { "docid": "0dd24db0cec832beab54ac3d0274c392", "score": "0.6477729", "text": "func LogoutHandler(w http.ResponseWriter, r *http.Request) {\n\tfmt.Fprintf(w, \"logout\")\n}", "title": "" }, { "docid": "04f17fa7000682ccf66169a76afbaad9", "score": "0.6475095", "text": "func (a *Client) UserLogoutAll(params *UserLogoutAllParams) (*UserLogoutAllOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewUserLogoutAllParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"User.logoutAll\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/user/logoutAll\",\n\t\tProducesMediaTypes: []string{\"application/javascript\", \"application/xml\", \"text/javascript\", \"text/xml\"},\n\t\tConsumesMediaTypes: []string{\"application/x-www-form-urlencoded\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &UserLogoutAllReader{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.(*UserLogoutAllOK), nil\n\n}", "title": "" } ]
2dc128c676714ac7f8ed8c4053bd770d
UpdateScan updates an existing ticket scan.
[ { "docid": "fd2472b16609e1049a4537d8947b24e8", "score": "0.7891455", "text": "func (tr *TicketRepository) UpdateScan(ticketScan *models.TicketScan) error {\n\tdb := tr.db\n\n\tquery, _, _ := psql.\n\t\tUpdate(\"tickets_on_rides\").\n\t\tSet(\"ride_id\", \"$1\").\n\t\tSet(\"ticket_id\", \"$2\").\n\t\tSet(\"scan_datetime\", \"$3\").\n\t\tWhere(sq.Eq{\"id\": \"$4\"}).\n\t\tToSql()\n\n\t_, err := db.Exec(query, ticketScan.RideID, ticketScan.TicketID, ticketScan.ScanOn, ticketScan.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" } ]
[ { "docid": "8f3ea50dda96d5d5d8a78038dfffbe8b", "score": "0.670098", "text": "func (b *Blog) UpdateScan() {\n\tb.update(b.scan(false))\n}", "title": "" }, { "docid": "0c2ff3cd895ec7e1224dae0dc4a835fc", "score": "0.6299861", "text": "func (r Repository) UpdateScan(scan Scan) bool {\n\tsession, err := mgo.Dial(SERVER)\n\tdefer session.Close()\n\n\terr = session.DB(DBNAME).C(COLLECTION).UpdateId(scan.ID, scan)\n\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t\treturn false\n\t}\n\n\tfmt.Println(\"Updated Scan ID - \", scan.ID)\n\n\treturn true\n}", "title": "" }, { "docid": "84a4dc25d9a766b95529a98932f31e2b", "score": "0.6038925", "text": "func (a *Client) UpdateNetscan(params *UpdateNetscanParams) (*UpdateNetscanOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewUpdateNetscanParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"updateNetscan\",\n\t\tMethod: \"PUT\",\n\t\tPathPattern: \"/setting/netscans/{id}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &UpdateNetscanReader{formats: a.formats},\n\t\tAuthInfo: a.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.(*UpdateNetscanOK), nil\n\n}", "title": "" }, { "docid": "cad7e3e63652990159ed793795705c28", "score": "0.5557876", "text": "func (h *handler) updateScan(pn blob.Ref, new, old *mediaObject) error {\n\tif old == nil {\n\t\tmo, err := h.fetchScan(pn)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"scan %v not found: %v\", pn, err)\n\t\t}\n\t\told = &mo\n\t}\n\tif new.contentRef.Valid() && old.contentRef != new.contentRef {\n\t\tif err := h.setAttribute(pn, \"camliContent\", new.contentRef.String()); err != nil {\n\t\t\treturn fmt.Errorf(\"could not set contentRef for scan %v: %v\", pn, err)\n\t\t}\n\t}\n\tif new.documentRef.Valid() && old.documentRef != new.documentRef {\n\t\tif err := h.setAttribute(pn, \"document\", new.documentRef.String()); err != nil {\n\t\t\treturn fmt.Errorf(\"could not set documentRef for scan %v: %v\", pn, err)\n\t\t}\n\t}\n\tif !old.creation.Equal(new.creation) {\n\t\tif new.creation.IsZero() {\n\t\t\tif err := h.delAttribute(pn, nodeattr.DateCreated, \"\"); err != nil {\n\t\t\t\treturn fmt.Errorf(\"could not delete creation date for scan %v: %v\", pn, err)\n\t\t\t}\n\t\t} else {\n\t\t\tif err := h.setAttribute(pn, nodeattr.DateCreated, new.creation.UTC().Format(time.RFC3339)); err != nil {\n\t\t\t\treturn fmt.Errorf(\"could not set creation date for scan %v: %v\", pn, err)\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "785082cdc72c73079050bcbff82c4041", "score": "0.5176661", "text": "func (tr *TicketRepository) StoreScan(ticketScan *models.TicketScan) error {\n\tdb := tr.db\n\n\tquery, _, _ := psql.\n\t\tInsert(\"tickets_on_rides\").\n\t\tColumns(\"id\", \"ride_id\", \"ticket_id\", \"scan_datetime\").\n\t\tValues(\"$1\", \"$2\", \"$3\", \"$4\").\n\t\tToSql()\n\n\t_, err := db.Exec(query, ticketScan.ID, ticketScan.RideID, ticketScan.TicketID, ticketScan.ScanOn)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "019c51b6b6b180348ef2f2ce5c77c9b5", "score": "0.4965619", "text": "func (tr *TicketRepository) DeleteScan(ticketScanID string) error {\n\tdb := tr.db\n\n\tquery, _, _ := psql.\n\t\tDelete(\"tickets_on_rides\").\n\t\tWhere(sq.Eq{\"id\": \"$1\"}).\n\t\tToSql()\n\n\t_, err := db.Exec(query, ticketScanID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6c75bcaec3663451a0bf30fcb95fba65", "score": "0.4875569", "text": "func (a *Client) PatchNetscan(params *PatchNetscanParams) (*PatchNetscanOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewPatchNetscanParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"patchNetscan\",\n\t\tMethod: \"PATCH\",\n\t\tPathPattern: \"/setting/netscans/{id}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &PatchNetscanReader{formats: a.formats},\n\t\tAuthInfo: a.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.(*PatchNetscanOK), nil\n\n}", "title": "" }, { "docid": "4d4389bb31fbd1054a5143716ae73938", "score": "0.4727331", "text": "func (o *GetD4CAwsAccountParams) SetScanType(scanType *string) {\n\to.ScanType = scanType\n}", "title": "" }, { "docid": "d55f639e33586eaf6a602ca8542bfba8", "score": "0.4671322", "text": "func (rm *resourceManager) updateImageScanningConfiguration(\n\tctx context.Context,\n\tdesired *resource,\n) (*resource, error) {\n\tdspec := desired.ko.Spec\n\tinput := &svcsdk.PutImageScanningConfigurationInput{\n\t\tRepositoryName: aws.String(*dspec.RepositoryName),\n\t}\n\tif dspec.ImageScanningConfiguration == nil {\n\t\t// There isn't any \"reset\" behaviour and the image scanning\n\t\t// configuration field should always be set...\n\t\tinput.SetImageScanningConfiguration(&defaultImageScanningConfig)\n\t} else {\n\t\tisc := svcsdk.ImageScanningConfiguration{\n\t\t\tScanOnPush: dspec.ImageScanningConfiguration.ScanOnPush,\n\t\t}\n\t\tinput.SetImageScanningConfiguration(&isc)\n\t}\n\t_, err := rm.sdkapi.PutImageScanningConfigurationWithContext(ctx, input)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn desired, nil\n}", "title": "" }, { "docid": "039d41f7036b950a6cab512ce6906f6d", "score": "0.46661776", "text": "func (job *ScanSyncJob) processSyncedScan(scan domain.Scan, correspondingScanSummary domain.ScanSummary, baseJob domain.JobRegistration) {\n\tif status, err := scan.Status(); err == nil {\n\t\tjob.lstream.Send(log.Infof(\"Updating database scan [Id: %v] with status [%s]\", scan.ID(), status))\n\n\t\t// Save the updated scan summary\n\t\tif _, _, err = job.db.SaveScanSummary(scan.ID(), status); err == nil {\n\n\t\t\tif strings.ToLower(status) == strings.ToLower(domain.ScanFINISHED) {\n\t\t\t\tjob.createScanCloseJob(scan, correspondingScanSummary, baseJob)\n\t\t\t}\n\n\t\t} else {\n\t\t\tjob.lstream.Send(log.Errorf(err, \"Error while updating the scan summary [ID: %v] with status [%s]\", scan.ID(), status))\n\t\t}\n\t} else {\n\t\tjob.lstream.Send(log.Errorf(err, \"error while gathering the scan status of [%v]\", scan.ID()))\n\t}\n}", "title": "" }, { "docid": "b55b19d162fcce3e8c24110918a8f198", "score": "0.458133", "text": "func UpdatePop3ScanTls(client sophos.ClientInterface, val bool, options ...sophos.Option) (err error) {\n\treturn put(client, \"/api/nodes/pop3.scan_tls\", val, options...)\n}", "title": "" }, { "docid": "c45059a016c4153b9abc4b5f1a420886", "score": "0.45459184", "text": "func (svc *AWSService) Scan() error {\n\treturn errors.New(\"not implemented\")\n}", "title": "" }, { "docid": "a05b79240d71243ce4a228d791f8ee2c", "score": "0.4541949", "text": "func (svc *VulnerabilitiesService) Scan(registry, repository, tagOrHash string) (\n\tresponse vulScanResponse,\n\terr error,\n) {\n\terr = svc.client.RequestEncoderDecoder(\"POST\",\n\t\tapiVulnerabilitiesScan,\n\t\tvulScanRequest{registry, repository, tagOrHash},\n\t\t&response,\n\t)\n\treturn\n}", "title": "" }, { "docid": "a2df8775c1f2166ee51ff52661de471b", "score": "0.45280585", "text": "func (csc *CardScanCreate) SetScanAt(t time.Time) *CardScanCreate {\n\tcsc.mutation.SetScanAt(t)\n\treturn csc\n}", "title": "" }, { "docid": "cc8be8ba71c1d8125ec6a68f242cb4cf", "score": "0.4429875", "text": "func (m *postgresDBRepo) UpdateReservation(reservation modals.Reservation) error {\n\t//if this transaction is taking longer then give time then time out\n\tctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)\n\tdefer cancel()\n\n\tquery := \"update reservations set first_name = $1, last_name = $2, email = $3, phone = $4, updated_at = $5 where id = $6\"\n\n\t_, err := m.DB.ExecContext(ctx, query, reservation.FirstName, reservation.LastName, reservation.Email, reservation.Phone, time.Now(), reservation.ID)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2a932a8657651b022b617b0288a2d647", "score": "0.442693", "text": "func (c *Client) SubmitScan(ctx context.Context, ips []string, force bool) (result models.Scan, err error) {\n\tif ips == nil || len(ips) == 0 {\n\t\terr = errEmptyParams\n\t\treturn\n\t}\n\n\tparams := make(url.Values)\n\tparams.Set(\"ips\", strings.Join(ips, \",\"))\n\tif force {\n\t\tparams.Set(\"force\", \"true\")\n\t}\n\n\tbody := strings.NewReader(params.Encode())\n\theader := make(http.Header)\n\theader.Set(\"Content-Type\", \"application/x-www-form-urlencoded\")\n\n\terr = c.request(ctx, http.MethodPost, routes.ShodanScan, nil, body, header, &result)\n\treturn\n}", "title": "" }, { "docid": "da5f935c30d2bd09c0c7094b45f6d336", "score": "0.44221392", "text": "func (h *Handler) HandleScan() {\n\tlog.Debugf(\"received san job status update event: job-%d, status-%s\", h.id, h.status)\n\tif err := dao.UpdateScanJobStatus(h.id, h.status); err != nil {\n\t\tlog.Errorf(\"Failed to update job status, id: %d, status: %s\", h.id, h.status)\n\t\th.SendInternalServerError(err)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "1c221d40ccaf936a5deb27ff3051d51a", "score": "0.43961602", "text": "func (o *GetDiscoverCloudAzureAccountParams) SetScanType(scanType *string) {\n\to.ScanType = scanType\n}", "title": "" }, { "docid": "9db4b77c944fe6e985da154821d7de8c", "score": "0.4385966", "text": "func (scanner *Scanner) Scan(target zgrab2.ScanTarget) (zgrab2.ScanStatus, interface{}, error) {\n\tconn, err := target.Open(&scanner.config.BaseFlags)\n\tif err != nil {\n\t\treturn zgrab2.TryGetScanStatus(err), nil, err\n\t}\n\tdefer conn.Close()\n\t// TODO: implement\n\treturn zgrab2.SCAN_UNKNOWN_ERROR, nil, nil\n}", "title": "" }, { "docid": "5e30c524d8bc146c6c383d1a27dc1d8f", "score": "0.4342989", "text": "func (r *ReconcileComplianceScan) Reconcile(request reconcile.Request) (reconcile.Result, error) {\n\treqLogger := log.WithValues(\"Request.Namespace\", request.Namespace, \"Request.Name\", request.Name)\n\treqLogger.Info(\"Reconciling ComplianceScan\")\n\n\t// Fetch the ComplianceScan instance\n\tinstance := &compv1alpha1.ComplianceScan{}\n\terr := r.client.Get(context.TODO(), request.NamespacedName, instance)\n\tif err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\t// Request object not found, could have been deleted after reconcile request.\n\t\t\t// Owned objects are automatically garbage collected. For additional cleanup logic use finalizers.\n\t\t\t// Return and don't requeue\n\t\t\treturn reconcile.Result{}, nil\n\t\t}\n\t\t// Error reading the object - requeue the request.\n\t\treturn reconcile.Result{}, err\n\t}\n\n\t// examine DeletionTimestamp to determine if object is under deletion\n\tif instance.ObjectMeta.DeletionTimestamp.IsZero() {\n\t\t// The object is not being deleted, so if it does not have our finalizer,\n\t\t// then lets add the finalizer and update the object. This is equivalent\n\t\t// registering our finalizer.\n\t\tif !common.ContainsFinalizer(instance.ObjectMeta.Finalizers, compv1alpha1.ScanFinalizer) {\n\t\t\tinstance.ObjectMeta.Finalizers = append(instance.ObjectMeta.Finalizers, compv1alpha1.ScanFinalizer)\n\t\t\tif err := r.client.Update(context.TODO(), instance); err != nil {\n\t\t\t\treturn reconcile.Result{}, err\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// The object is being deleted\n\t\treturn r.scanDeleteHandler(instance, reqLogger)\n\t}\n\n\t// At this point, we make a copy of the instance, so we can modify it in the functions below.\n\tscanToBeUpdated := instance.DeepCopy()\n\n\t// If no phase set, default to pending (the initial phase):\n\tif scanToBeUpdated.Status.Phase == \"\" {\n\t\tscanToBeUpdated.Status.Phase = compv1alpha1.PhasePending\n\t}\n\n\tswitch scanToBeUpdated.Status.Phase {\n\tcase compv1alpha1.PhasePending:\n\t\treturn r.phasePendingHandler(scanToBeUpdated, reqLogger)\n\tcase compv1alpha1.PhaseLaunching:\n\t\treturn r.phaseLaunchingHandler(scanToBeUpdated, reqLogger)\n\tcase compv1alpha1.PhaseRunning:\n\t\treturn r.phaseRunningHandler(scanToBeUpdated, reqLogger)\n\tcase compv1alpha1.PhaseAggregating:\n\t\treturn r.phaseAggregatingHandler(scanToBeUpdated, reqLogger)\n\tcase compv1alpha1.PhaseDone:\n\t\treturn r.phaseDoneHandler(scanToBeUpdated, reqLogger, dontDelete)\n\t}\n\n\t// the default catch-all, just remove the request from the queue\n\treturn reconcile.Result{}, nil\n}", "title": "" }, { "docid": "8d7cb537957ef388fded640e08c1fca3", "score": "0.4313113", "text": "func (c *Client) GetScan(ctx context.Context, scanID string) (result models.Scan, err error) {\n\tif scanID == \"\" {\n\t\terr = errors.New(\"empty scanID\")\n\t\treturn\n\t}\n\n\troute := fmt.Sprintf(routes.ShodanScanView, scanID)\n\terr = c.request(ctx, http.MethodGet, route, nil, nil, nil, &result)\n\treturn\n}", "title": "" }, { "docid": "4251872e287ef1d277824cd8d83bc315", "score": "0.43006814", "text": "func (b *CassandraQueryBenchmarker) RunScan(r io.Reader, closeChan chan int) {\n\tdec := gob.NewDecoder(r)\n\n\tn := int64(0)\n\nloop:\n\tfor {\n\t\tif bulk_query.Benchmarker.Limit() >= 0 && n >= bulk_query.Benchmarker.Limit() {\n\t\t\tbreak\n\t\t}\n\n\t\tq := b.queryPool.Get().(*HLQuery)\n\t\terr := dec.Decode(q)\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\tq.ID = n\n\t\tq.ForceUTC()\n\n\t\tb.hlQueryChan <- q\n\n\t\tn++\n\t\tselect {\n\t\tcase <-closeChan:\n\t\t\tfmt.Printf(\"Received finish request\\n\")\n\t\t\tbreak loop\n\t\tdefault:\n\t\t}\n\t}\n\tb.scanFinished = true\n}", "title": "" }, { "docid": "00d24ba009d5bfd1ff1bcea9bc8be29c", "score": "0.4293852", "text": "func (scanner *Scanner) Scan(t zgrab2.ScanTarget) (zgrab2.ScanStatus, interface{}, error) {\n\tsock, err := t.OpenUDP(&scanner.config.BaseFlags, &scanner.config.UDPFlags)\n\tif err != nil {\n\t\treturn zgrab2.TryGetScanStatus(err), nil, err\n\t}\n\tdefer sock.Close()\n\tresult := &Results{}\n\tif !scanner.config.SkipGetTime {\n\t\tinPacket, err := scanner.GetTime(sock)\n\t\tif err != nil {\n\t\t\t// even if an inPacket is returned, it failed the syntax check, so indicate a failed detection via result == nil.\n\t\t\treturn zgrab2.TryGetScanStatus(err), nil, err\n\t\t}\n\t\ttemp := inPacket.ReceiveTimestamp.GetTime()\n\t\tresult.TimeResponse = inPacket\n\t\tresult.Time = &temp\n\t\tresult.Version = &inPacket.Version\n\t}\n\tif scanner.config.MonList {\n\t\tstatus, err := scanner.MonList(sock, result)\n\t\tif err != nil {\n\t\t\tif scanner.config.SkipGetTime {\n\t\t\t\t// TODO: Currently, returning a non-nil result means that the service was positively detected.\n\t\t\t\t// It may be safer to add an explicit flag for this (status == success is not sufficient, since e.g. you can get a timeout after positively identifying the service)\n\t\t\t\t// This also means that partial TLS handshakes cannot be returned\n\t\t\t\treturn status, nil, err\n\t\t\t}\n\t\t\treturn status, result, err\n\t\t}\n\t}\n\n\treturn zgrab2.SCAN_SUCCESS, result, nil\n}", "title": "" }, { "docid": "2d7f64b00f52922c1be1517710fc9300", "score": "0.42898786", "text": "func (_Slashmanager *SlashmanagerTransactor) UpdateReportRate(opts *bind.TransactOpts, newReportRate *big.Int) (*types.Transaction, error) {\n\treturn _Slashmanager.contract.Transact(opts, \"updateReportRate\", newReportRate)\n}", "title": "" }, { "docid": "fabfded96cb8aca46831f5126c7f1a84", "score": "0.4283748", "text": "func (c *Client) DecodeScan(resp *http.Response) (*Scan, error) {\n\tvar decoded Scan\n\terr := c.Decoder.Decode(&decoded, resp.Body, resp.Header.Get(\"Content-Type\"))\n\treturn &decoded, err\n}", "title": "" }, { "docid": "96f7fb1dda5f9ddbe9f94f1f8e79256b", "score": "0.42762518", "text": "func (client *HClient) ScannerOpenWithScan(tableName string, scan *TScan, attributes map[string]string) (ScannerID, error) {\n\tfmt.Println(tableName, scan, attributes)\n\treturn ScannerID(0), nil\n}", "title": "" }, { "docid": "18b0aeab46203e1ad59ac9fc1485f78a", "score": "0.42503038", "text": "func (a *Account) Scan(scanner interface {\n\tScan(dest ...interface{}) error\n}) error {\n\treturn scanner.Scan(\n\t\t&a.ID,\n\t\t&a.CreatedAt,\n\t\t&a.Email,\n\t\t&a.LastRequestAt,\n\t\t&a.UpdatedAt,\n\t)\n}", "title": "" }, { "docid": "d12d33dd923899f08967bd8c89e3ecb6", "score": "0.42388335", "text": "func (m *testDBRepo) UpdateReservation(u models.Reservation) error {\n\n\treturn nil\n}", "title": "" }, { "docid": "5d588da47bb6e9ccbc3df595ec00725e", "score": "0.42288715", "text": "func (p *proxyService) Scan(ctx context.Context, req *spb.ScanRequest, f graphstore.EntryFunc) error {\n\treturn p.invoke(func(svc graphstore.Service, cb graphstore.EntryFunc) error {\n\t\treturn svc.Scan(ctx, req, cb)\n\t}, f)\n}", "title": "" }, { "docid": "aa975245921a9445314bf8b9b73c93fa", "score": "0.422401", "text": "func (t *ScanHookTask) Put(rID int64, url string) (int64, error) {\n\tif url == \"\" || rID == 0 {\n\t\treturn 0, errors.New(\"'URL' and 'RegistID' should not be empty\")\n\t}\n\n\tvar reg ScanHookRegist\n\treg, err := reg.FindByID(rID)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\t//TODO: add to db and get task ID\n\tvar encodedCallbackID string\n\tvar info snapshot.SnapshotInputInfo\n\tinfo.Name = reg.ScanPluginName\n\tinfo.CallbackID = encodedCallbackID\n\tinfo.DataProto = reg.Proto\n\tinfo.DataURL = url\n\t// Do the real scan work\n\ts, err := snapshot.NewUpdateServiceSnapshot(info)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\terr = s.Process()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn 0, nil\n}", "title": "" }, { "docid": "4d641ec5a5a736ff9b253050ad194368", "score": "0.42193744", "text": "func (r Repository) AddScan(scan Scan) bool {\n\tsession, err := mgo.Dial(SERVER)\n\tdefer session.Close()\n\n\tscanID++\n\tscan.ID = scanID\n\tsession.DB(DBNAME).C(COLLECTION).Insert(scan)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t\treturn false\n\t}\n\n\tfmt.Println(\"Added New Scan ID- \", scan.ID)\n\n\treturn true\n}", "title": "" }, { "docid": "3c78e2a3b758c1010afe0382ace52234", "score": "0.4217863", "text": "func (m *testDBRepo) UpdateReservation(u models.Reservation) error {\n\treturn nil\n}", "title": "" }, { "docid": "7e5dae1dc19f536dea1e7ac7a9d4f894", "score": "0.42103437", "text": "func (c *Client) ChannelScan(ctx context.Context, opt *ChannelScanOptions) (io.ReadCloser, *http.Response, error) {\n\tu, err := addOptions(\"config/channels/scan\", opt)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treq, err := c.NewRequest(\"PUT\", u, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treq = req.WithContext(ctx)\n\tresp, err := c.client.Do(req)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn resp.Body, resp, nil\n}", "title": "" }, { "docid": "7bdb9113807de69373118f95b43be434", "score": "0.41967386", "text": "func (r *Range) Scan(args *proto.ScanRequest, reply *proto.ScanResponse) {\n\tkvs, err := r.mvcc.Scan(args.Key, args.EndKey, args.MaxResults, args.Timestamp, args.Txn)\n\treply.Rows = kvs\n\treply.SetGoError(err)\n}", "title": "" }, { "docid": "6442ebf16de5e29c5c580e00eb2c7b98", "score": "0.41885248", "text": "func UpdateSmtpScannerTimeout(client sophos.ClientInterface, val int64, options ...sophos.Option) (err error) {\n\treturn put(client, \"/api/nodes/smtp.scanner_timeout\", val, options...)\n}", "title": "" }, { "docid": "738893c9bdffc32a94fbdc524c920f29", "score": "0.41773596", "text": "func (client *HClient) ScannerOpenWithScan(tableName string, scan *TScan, attributes map[string]string) (id int32, err error) {\r\n\tret, e1 := client.hbase.ScannerOpenWithScan(hbase1.Text(tableName), toHbaseTScan(scan), toHbaseTextMap(attributes))\r\n\r\n\treturn int32(ret), e1\r\n}", "title": "" }, { "docid": "19b8652878c78a037649fe6a1b52e17c", "score": "0.41602257", "text": "func (r Repository) DeleteScan(id int) string {\n\tsession, err := mgo.Dial(SERVER)\n\tdefer session.Close()\n\n\t// Remove macScan\n\tif err = session.DB(DBNAME).C(COLLECTION).RemoveId(id); err != nil {\n\t\tlog.Fatal(err)\n\t\treturn \"INTERNAL ERR\"\n\t}\n\n\tfmt.Println(\"Deleted MacScan ID - \", id)\n\t// Write status\n\treturn \"OK\"\n}", "title": "" }, { "docid": "bc84cd8693d32305bdc2d6aa0e185a29", "score": "0.41529447", "text": "func (c *WrapConn) ScannerOpenWithScan(tableName Text, scan *TScan, attributes map[string]Text) (ScannerID, error) {\n\terr, results := c.runCommand(\"ScannerOpenWithScan\", tableName, scan, attributes)\n\tif err != nil {\n\t\treturn ScannerID(0), err\n\t}\n\treturn ScannerID(results[0].Int()), nil\n}", "title": "" }, { "docid": "bcd617651d5814619ab274ed7d8ae5dc", "score": "0.41485626", "text": "func (evs *ExValueScan) Update() *ExValueScanUpdateOne {\n\treturn NewExValueScanClient(evs.config).UpdateOne(evs)\n}", "title": "" }, { "docid": "46904cbcd01af455485f1580a084f76d", "score": "0.41410324", "text": "func (r *Rescan) Update(options ...UpdateOption) error {\n\tro := defaultRescanOptions()\n\tfor _, option := range r.options {\n\t\toption(ro)\n\t}\n\n\tuo := defaultUpdateOptions()\n\tfor _, option := range options {\n\t\toption(uo)\n\t}\n\n\tselect {\n\tcase r.updateChan <- uo:\n\tcase <-ro.quit:\n\t\treturn ErrRescanExit\n\n\tcase <-r.running:\n\t\terrStr := \"Rescan is already done and cannot be updated.\"\n\t\tr.errMtx.Lock()\n\t\tif r.err != nil {\n\t\t\terrStr += fmt.Sprintf(\" It returned error: %s\", r.err)\n\t\t}\n\t\tr.errMtx.Unlock()\n\t\treturn fmt.Errorf(errStr)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f024ff48a19a3a9850504697395a8dc2", "score": "0.41212925", "text": "func StartScan(rootPath string, updateFile bool, fileList string) {\n\tfiles, ignores := checkFilelist(fileList)\n\n\t//read md5 hash list from channel (old stamp file)\n\tmd5CompareList := <-readHashfile(STAMPFILE)\n\tvar fileTextBuffer bytes.Buffer\n\n\tfor _, f := range files {\n\t\tpath := rootPath\n\n\t\t//otherwise Lstat fail if path ends with *\n\t\tif f.path != \"*\" {\n\t\t\tpath += \"/\" + f.path\n\t\t}\n\n\t\tmd5InfoChan := scanPath(path, &ignores, f.recursive)\n\t\tcheckResultChan := compareDir(md5InfoChan, &md5CompareList)\n\n\t\tfor checkResult := range checkResultChan {\n\n\t\t\tif !updateFile && debug && checkResult.equal == false {\n\t\t\t\tlog.Println(\"File change detected:\", checkResult.err)\n\t\t\t}\n\n\t\t\tinfo := checkResult.md5Info\n\t\t\tfileHash := <-(*info).hash\n\t\t\tfileTextBuffer.WriteString(\n\t\t\t\tfmt.Sprintf(\"%s:%d:%s\\n\", (*info).filepath, (*info).filesize, fileHash))\n\t\t}\n\t}\n\tif updateFile == true && fileTextBuffer.Len() > 0 {\n\t\t//rotateStampFiles(OLDSTAMPFILE, STAMPFILE)\n\t\twriteToFile(STAMPFILE, &fileTextBuffer)\n\t}\n}", "title": "" }, { "docid": "bf50c31f8640e2188300bc05f528ad8b", "score": "0.41134825", "text": "func (cs *ConfigServer) UpdateRelease(ctx context.Context, req *pb.UpdateReleaseReq) (*pb.UpdateReleaseResp, error) {\n\trtime := time.Now()\n\tkit := common.RequestKit(ctx)\n\tlogger.V(2).Infof(\"%s[%s]| appcode: %s, user: %s, input[%+v]\", kit.Method, kit.Rid, kit.AppCode, kit.User, req)\n\n\tresponse := new(pb.UpdateReleaseResp)\n\n\tdefer func() {\n\t\tcost := cs.collector.StatRequest(kit.Method, response.Code, rtime, time.Now())\n\t\tlogger.V(2).Infof(\"%s[%s]| output[%dms][%+v]\", kit.Method, kit.Rid, cost, response)\n\t}()\n\n\taction := releaseaction.NewUpdateAction(kit, cs.viper, cs.authSvrCli, cs.dataMgrCli, req, response)\n\tif err := cs.executor.ExecuteWithAuth(action); err != nil {\n\t\tlogger.Errorf(\"%s[%s]| %+v\", kit.Method, kit.Rid, err)\n\t}\n\n\treturn response, nil\n}", "title": "" }, { "docid": "8de732198fbad47e22d273db61d832b1", "score": "0.4106702", "text": "func (scroll *Scroll) Scan(desc interface{}) app.Error {\n\tif scroll.currentResponse == nil {\n\t\treturn app.NewError(app.ErrorDevPoo, \"nothing to scan\", nil)\n\t}\n\n\trawDocs := []json.RawMessage{}\n\n\tfor _, hit := range scroll.currentResponse.Hits.Hits {\n\t\trawDocs = append(rawDocs, hit.Source)\n\t}\n\n\traw, err := json.Marshal(rawDocs)\n\tif err != nil {\n\t\treturn app.NewError(app.ErrorUnexpected, \"failed to marshal response\", err)\n\t}\n\n\tif err := json.Unmarshal(raw, desc); err != nil {\n\t\treturn app.NewError(app.ErrorUnexpected, \"failed to unmarshal elasticsearch response\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3d8d968480d8352d23591da022d537a3", "score": "0.409409", "text": "func (mr *MockLibscanMockRecorder) Scan(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Scan\", reflect.TypeOf((*MockLibscan)(nil).Scan), arg0, arg1)\n}", "title": "" }, { "docid": "120da6fc5cf9fa26d9c44d01fd32a659", "score": "0.40591228", "text": "func (s *FmtpRequest) SetScanMode(v string) *FmtpRequest {\n\ts.ScanMode = &v\n\treturn s\n}", "title": "" }, { "docid": "a9d6906e024b48c340ec843c542cf77e", "score": "0.40561566", "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": "17252b96d0186592cafd033232ae9a56", "score": "0.4053676", "text": "func PostFileScan(apiKey string, data []byte, fileName string) (*common.RPVTScanBlock, error) {\n\n\tbodyBuf := &bytes.Buffer{}\n\twBodyBuf := multipart.NewWriter(bodyBuf)\n\n\twBodyBuf.WriteField(\"apikey\", apiKey)\n\n\tfWriter, err := wBodyBuf.CreateFormFile(\"file\", fileName) //fWriter: io.Writer\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t_, err = fWriter.Write(data)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcontentType := wBodyBuf.FormDataContentType()\n\terr = wBodyBuf.Close()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\turi := \"https://www.virustotal.com/vtapi/v2/file/scan\"\n\treq, err := http.NewRequest(\"POST\", uri, bodyBuf)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\n\treq.Header.Set(\"Content-Type\", contentType)\n\tclient := &http.Client{\n\t\tTimeout: time.Duration(300 * time.Second),\n\t}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\n\tcontents, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar scanResponse = &common.RPVTScanBlock{}\n\terr = json.Unmarshal(contents, &scanResponse)\n\n\treturn scanResponse, err\n\n}", "title": "" }, { "docid": "9f55dbf036efc600f80e03a30f858a04", "score": "0.40439817", "text": "func (a *Client) AddNetscan(params *AddNetscanParams) (*AddNetscanOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewAddNetscanParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"addNetscan\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/setting/netscans\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &AddNetscanReader{formats: a.formats},\n\t\tAuthInfo: a.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.(*AddNetscanOK), nil\n\n}", "title": "" }, { "docid": "dbc3e57ee6392654c04a80cdfed3a2fb", "score": "0.40428224", "text": "func (_Slashmanager *SlashmanagerTransactorSession) UpdateReportRate(newReportRate *big.Int) (*types.Transaction, error) {\n\treturn _Slashmanager.Contract.UpdateReportRate(&_Slashmanager.TransactOpts, newReportRate)\n}", "title": "" }, { "docid": "6530357c51369fa31a0dc340481d37b2", "score": "0.4042815", "text": "func (s *Fmtp) SetScanMode(v string) *Fmtp {\n\ts.ScanMode = &v\n\treturn s\n}", "title": "" }, { "docid": "d11afa1cf26025c7c6365ddb942ae39e", "score": "0.4034714", "text": "func (ss *StatWALReceivers) Scan(value interface{}) error {\n\treturn convert.JSONScan(ss, value)\n}", "title": "" }, { "docid": "6d44f83ee2ad81c075220cf7fe39198c", "score": "0.4024734", "text": "func (ipam *Ipam) UpdateReservation(reservation models.Reservation) error {\n\tsession := ipam.session.Copy()\n\tdefer session.Close()\n\n\treturn session.DB(IpamDatabase).C(IpamCollectionReservations).UpdateId(reservation.ID, reservation)\n}", "title": "" }, { "docid": "731185a9380525b2d1180928623ca7ac", "score": "0.40207976", "text": "func (c *Client) Scan(w http.ResponseWriter, r *http.Request) {\n\tvar argS util.ScanArg\n\tvar retS util.ScanRet\n\tretS.FileInfos = make([]util.GetFileMetaRet, 0)\n\t// Decode the params\n\terr := json.NewDecoder(r.Body).Decode(&argS)\n\tif err != nil {\n\t\tlogrus.Warnln(\"Client Scan failed :\", err)\n\t\tw.WriteHeader(400)\n\t\treturn\n\t}\n\tlogrus.Debugf(\"Client scan : path %v\",argS.Path)\n\terr = util.Call(string(c.masterAddr), \"Master.ScanRPC\", argS, &retS)\n\tif err != nil {\n\t\tlogrus.Warnln(\"Client Scan failed :\", err)\n\t\tw.WriteHeader(400)\n\t\treturn\n\t}\n\tmsg, _ := json.Marshal(retS)\n\tw.Write(msg)\n}", "title": "" }, { "docid": "cf2ad2ce0bdd670b0f836095f91bf90b", "score": "0.40126252", "text": "func (q *Query) SetMaxScan(n int) *Query {\n\tq.m.Lock()\n\tq.op.options.MaxScan = n\n\tq.op.hasOptions = true\n\tq.m.Unlock()\n\treturn q\n}", "title": "" }, { "docid": "7955a24cf0280cac2d8095bcb8c33f3e", "score": "0.39983714", "text": "func (_Slashmanager *SlashmanagerSession) UpdateReportRate(newReportRate *big.Int) (*types.Transaction, error) {\n\treturn _Slashmanager.Contract.UpdateReportRate(&_Slashmanager.TransactOpts, newReportRate)\n}", "title": "" }, { "docid": "ee6f5b628fc6c88bdbdc385621574a75", "score": "0.39918432", "text": "func (cl *Client) Scan() (nets APs, err error) {\n\terr = cl.conn.SendCommandBool(CmdScan)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tresults := cl.conn.Subscribe(EventScanResults)\n\tfailed := cl.conn.Subscribe(EventScanFailed)\n\n\tfunc() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-failed.Next():\n\t\t\t\terr = ErrScanFailed\n\t\t\t\treturn\n\t\t\tcase <-results.Next():\n\t\t\t\treturn\n\t\t\tcase <-time.NewTimer(time.Second * 2).C:\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\n\tscanned, err := cl.conn.SendCommand(CmdScanResults)\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn parseAP([]byte(scanned))\n}", "title": "" }, { "docid": "31c00a93be4bb281aa9c36f647f378aa", "score": "0.3982098", "text": "func (m *postgresDBRepo) UpdateProcssedForReservation(id, processed int) error {\n\t//if this transaction is taking longer then give time then time out\n\tctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)\n\tdefer cancel()\n\n\tquery := \"update reservations set processed = $1 where id = $2\"\n\n\t_, err := m.DB.ExecContext(ctx, query, processed, id)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f14b2b9b5fa50cf23c78642f7efc1198", "score": "0.39816096", "text": "func (mr *MockLibvulnMockRecorder) Scan(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Scan\", reflect.TypeOf((*MockLibvuln)(nil).Scan), arg0, arg1)\n}", "title": "" }, { "docid": "1bffb97d17496f2e816bf134c5492031", "score": "0.39772528", "text": "func (db *Database) Scan(table string, channel interface{}) error {\n\t_, err := db.Client.ScanAllObjects(nil, channel, db.namespace, table)\n\treturn err\n}", "title": "" }, { "docid": "48d9ddd443fffbae45f1b9bca61ec18e", "score": "0.39752987", "text": "func (client *Client) UpdateSlot(request *UpdateSlotRequest) (response *UpdateSlotResponse, err error) {\n\tresponse = CreateUpdateSlotResponse()\n\terr = client.DoAction(request, response)\n\treturn\n}", "title": "" }, { "docid": "19c90930d80c608e200d07efac6ede78", "score": "0.39751473", "text": "func (a *Client) PutSystemScanAllSchedule(params *PutSystemScanAllScheduleParams, authInfo runtime.ClientAuthInfoWriter) (*PutSystemScanAllScheduleOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewPutSystemScanAllScheduleParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"PutSystemScanAllSchedule\",\n\t\tMethod: \"PUT\",\n\t\tPathPattern: \"/system/scanAll/schedule\",\n\t\tProducesMediaTypes: []string{\"application/json\", \"text/plain\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\", \"https\"},\n\t\tParams: params,\n\t\tReader: &PutSystemScanAllScheduleReader{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.(*PutSystemScanAllScheduleOK)\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 PutSystemScanAllSchedule: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "5ba0cca0258140463360cc267f91f165", "score": "0.39712477", "text": "func (r *Request) Scan(ctx context.Context, result interface{}) (err error) {\n\tq, err := r.q.string()\n\tif err != nil {\n\t\treturn\n\t}\n\tparams := url.Values{}\n\tparams.Add(\"business\", r.business)\n\tparams.Add(\"query\", q)\n\tresponse := new(response)\n\tif err = r.client.Get(ctx, r.c.Host+_pathQuery, \"\", params, &response); err != nil {\n\t\treturn\n\t}\n\tif !ecode.Int(response.Code).Equal(ecode.OK) {\n\t\treturn ecode.Int(response.Code)\n\t}\n\terr = errors.Wrapf(json.Unmarshal(response.Data, &result), \"scan(%s)\", response.Data)\n\treturn\n}", "title": "" }, { "docid": "54b0c3f8b39e4cc615ada2b33195a14f", "score": "0.39690834", "text": "func (m *WindowsUpdateForBusinessConfiguration) SetUserWindowsUpdateScanAccess(value *Enablement)() {\n m.userWindowsUpdateScanAccess = value\n}", "title": "" }, { "docid": "9890ae860893c09e6afb532ca6a93991", "score": "0.39633554", "text": "func (pw *ProvisionWatcherRestClient) Update(dev models.ProvisionWatcher, ctx context.Context) error {\n\treturn clients.UpdateRequest(pw.url, dev, ctx)\n}", "title": "" }, { "docid": "c7fb4828b0b8d6b0a7729eeedd6407f6", "score": "0.3960385", "text": "func (s *Stat) Scan(scanner interface {\n\tScan(dest ...interface{}) error\n}) error {\n\treturn scanner.Scan(\n\t\t&s.ID,\n\t\t&s.AccountID,\n\t\t&s.ComputerMove,\n\t\t&s.PlayerMove,\n\t\t&s.Round,\n\t)\n}", "title": "" }, { "docid": "4e329a39bce984b82841f2ab5124aa13", "score": "0.3955875", "text": "func (m *MockAdapter) Scan(req harbor.ScanRequest) (harbor.ScanResponse, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Scan\", req)\n\tret0, _ := ret[0].(harbor.ScanResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "696f817d3d76309b6bed3f8ece713f17", "score": "0.39556283", "text": "func (s *scanner) update(resp *pb.ScanResponse, region hrpc.RegionInfo) {\n\tif s.isRegionScannerClosed() && resp.ScannerId != nil {\n\t\ts.openRegionScanner(resp.GetScannerId())\n\t}\n\tif !resp.GetMoreResultsInRegion() {\n\t\t// we are done with this region, prepare scan for next region\n\t\ts.closeRegionScanner()\n\n\t\t// Normal Scan\n\t\tif !s.rpc.Reversed() {\n\t\t\ts.startRow = region.StopKey()\n\t\t\treturn\n\t\t}\n\n\t\t// Reversed Scan\n\t\t// return if we are at the end\n\t\tif len(region.StartKey()) == 0 {\n\t\t\ts.startRow = region.StartKey()\n\t\t\treturn\n\t\t}\n\n\t\t// create the nearest value lower than the current region startKey\n\t\trsk := region.StartKey()\n\t\t// if last element is 0x0, just shorten the slice\n\t\tif rsk[len(rsk)-1] == 0x0 {\n\t\t\ts.startRow = rsk[:len(rsk)-1]\n\t\t\treturn\n\t\t}\n\n\t\t// otherwise lower the last element byte value by 1 and pad with 0xffs\n\t\ttmp := make([]byte, len(rsk), len(rsk)+len(rowPadding))\n\t\tcopy(tmp, rsk)\n\t\ttmp[len(tmp)-1] = tmp[len(tmp)-1] - 1\n\t\ts.startRow = append(tmp, rowPadding...)\n\t}\n}", "title": "" }, { "docid": "d3da1febc7bf5b49fde72ef7cdd6c3b5", "score": "0.39546788", "text": "func (tr *TicketRepository) Update(ticket *models.Ticket) error {\n\tdb := tr.db\n\n\tquery, _, _ := psql.\n\t\tUpdate(\"tickets\").\n\t\tSet(\"user_id\", \"$1\").\n\t\tSet(\"is_kid\", \"$2\").\n\t\tSet(\"purchase_price\", \"$3\").\n\t\tSet(\"purchased_on\", \"$4\").\n\t\tSet(\"purchase_reference\", \"$5\").\n\t\tWhere(sq.Eq{\"id\": \"$6\"}).\n\t\tToSql()\n\n\t_, err := db.Exec(query, ticket.UserID, ticket.IsKid, ticket.PurchasePrice, ticket.PurchasedOn, ticket.PurchaseReference, ticket.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "5fe9cd7b216a65e335e14737bd14e2cf", "score": "0.39532855", "text": "func (_class PIFClass) Scan(sessionID SessionRef, host HostRef) (_err error) {\n\tif IsMock {\n\t\treturn _class.ScanMock(sessionID, host)\n\t}\t\n\t_method := \"PIF.scan\"\n\t_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf(\"%s(%s)\", _method, \"session_id\"), sessionID)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_hostArg, _err := convertHostRefToXen(fmt.Sprintf(\"%s(%s)\", _method, \"host\"), host)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_, _err = _class.client.APICall(_method, _sessionIDArg, _hostArg)\n\treturn\n}", "title": "" }, { "docid": "ec1c12c43782a4537b4c7ab07b361ee6", "score": "0.3951899", "text": "func (client *Client) ScanImage(request *ScanImageRequest) (response *ScanImageResponse, err error) {\n\tresponse = CreateScanImageResponse()\n\terr = client.DoAction(request, response)\n\treturn\n}", "title": "" }, { "docid": "0d07a015a31d58b44fc9e69ecc74d5fb", "score": "0.39492202", "text": "func (u *Uploader) Scan() error {\n\tfiles, err := ioutil.ReadDir(u.cfg.ScanDir)\n\tif err != nil {\n\t\treturn trace.ConvertSystemError(err)\n\t}\n\tscanned, started := 0, 0\n\tfor i := range files {\n\t\tfi := files[i]\n\t\tif fi.IsDir() {\n\t\t\tcontinue\n\t\t}\n\t\tif filepath.Ext(fi.Name()) == checkpointExt {\n\t\t\tcontinue\n\t\t}\n\t\tscanned++\n\t\tif err := u.startUpload(fi.Name()); err != nil {\n\t\t\tif trace.IsCompareFailed(err) {\n\t\t\t\tu.log.Debugf(\"Scan is skipping recording %v that is locked by another process.\", fi.Name())\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif trace.IsNotFound(err) {\n\t\t\t\tu.log.Debugf(\"Recording %v was uploaded by another process.\", fi.Name())\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\tstarted++\n\t}\n\tif scanned > 0 {\n\t\tu.log.Debugf(\"Scanned %v uploads, started %v in %v.\", scanned, started, u.cfg.ScanDir)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5f92e83191c3aeec66fdee5cc2594740", "score": "0.3948946", "text": "func (rs *RedditScanner) Scan(ctx Ctx, conn StorageConn, users []User) error {\nOUTER:\n\tfor _, user := range users {\n\n\t\tfor i := uint(0); i < rs.maxBatches; i++ {\n\t\t\tvar err error\n\t\t\tvar comments []Comment\n\t\t\tvar limit uint\n\t\t\tlastScan := time.Now().Sub(user.LastScan)\n\n\t\t\tif user.New || // if the user is new, we need to scan everything as fast as possible\n\t\t\t\tuser.Position != \"\" || // we don't know how many relevant comments the next page has, so take as many as possible\n\t\t\t\tuser.BatchSize+rs.commentsLeeway > MaxRedditListingLength || // don't request more than the maximum, else we'll look stupid\n\t\t\t\tlastScan > rs.maxAge { // use rs.maxAge as a heuristic to say if too much time has passed since the last scan\n\t\t\t\tlimit = MaxRedditListingLength\n\t\t\t} else {\n\t\t\t\tlimit = user.BatchSize + rs.commentsLeeway\n\t\t\t}\n\n\t\t\trs.logger.Debugf(\"trying to get %d comments from user %+v\", limit, user)\n\t\t\tcomments, user, err = rs.api.UserComments(ctx, user, limit)\n\t\t\tif IsCancellation(err) {\n\t\t\t\treturn err\n\t\t\t} else if err != nil {\n\t\t\t\trs.logger.Errorf(\"error while scanning user %q, skipping: %v\", user.Name, err)\n\t\t\t\tcontinue OUTER\n\t\t\t}\n\t\t\trs.logger.Debugf(\"fetched comments: %+v\", comments)\n\n\t\t\trs.logger.Debugf(\"before scanner's user update: %+v\", user)\n\t\t\t// This method contains logic that returns an User datastructure whose metadata\n\t\t\t// has been updated; in other words, it indirectly controls the behavior of the\n\t\t\t// current loop.\n\t\t\tuser, err = conn.SaveCommentsUpdateUser(comments, user, lastScan+rs.maxAge)\n\t\t\tif err != nil {\n\t\t\t\tif IsSQLiteForeignKeyErr(err) { // triggered after a PurgeUser\n\t\t\t\t\trs.logger.Debugf(\"saving the comments of %q resulted in a foreign key constraint error, skipping\", user.Name)\n\t\t\t\t\tcontinue OUTER\n\t\t\t\t}\n\t\t\t\treturn err\n\t\t\t}\n\t\t\trs.logger.Debugf(\"after scanner's user update: %+v\", user)\n\n\t\t\tif user.Suspended || user.NotFound {\n\t\t\t\trs.Lock()\n\t\t\t\tif rs.deaths != nil {\n\t\t\t\t\trs.deaths <- user\n\t\t\t\t}\n\t\t\t\trs.Unlock()\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tif err := rs.alertIfHighScore(conn, comments); err != nil {\n\t\t\t\trs.logger.Error(err)\n\t\t\t}\n\n\t\t\t// There are no more pages to scan, either because that's what the Reddit API returned,\n\t\t\t// or because the logic we called previously decided no more pages should be scanned.\n\t\t\tif user.Position == \"\" {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "10a63edafa671488c00b7628154f92b1", "score": "0.39456853", "text": "func (ws *WatchlistSelect) Scan(ctx context.Context, v interface{}) error {\n\tif err := ws.prepareQuery(ctx); err != nil {\n\t\treturn err\n\t}\n\tws.sql = ws.WatchlistQuery.sqlQuery(ctx)\n\treturn ws.sqlScan(ctx, v)\n}", "title": "" }, { "docid": "12c2c7696485836981f9bc93e317ee16", "score": "0.39439094", "text": "func executeScan(config *ScanOptions, scan *ws.Scan, utils whitesourceUtils) error {\n\tif config.ScanType == \"\" {\n\t\tconfig.ScanType = config.BuildTool\n\t}\n\n\toptions := wsScanOptions(config)\n\n\tswitch config.ScanType {\n\tcase \"mta\":\n\t\t// Execute scan for maven and all npm modules\n\t\tif err := scan.ExecuteMTAScan(options, utils); err != nil {\n\t\t\treturn err\n\t\t}\n\tcase \"maven\":\n\t\t// Execute scan with maven plugin goal\n\t\tif err := scan.ExecuteMavenScan(options, utils); err != nil {\n\t\t\treturn err\n\t\t}\n\tcase \"npm\":\n\t\t// Execute scan with in each npm module using npm.Executor\n\t\tif err := scan.ExecuteNpmScan(options, utils); err != nil {\n\t\t\treturn err\n\t\t}\n\tcase \"yarn\":\n\t\t// Execute scan with whitesource yarn plugin\n\t\tif err := scan.ExecuteYarnScan(options, utils); err != nil {\n\t\t\treturn err\n\t\t}\n\tdefault:\n\t\t// Execute scan with Unified Agent jar file\n\t\tif err := scan.ExecuteUAScan(options, utils); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "cc07351f4f892657e34edf6c785244bc", "score": "0.3932026", "text": "func (mr *MockAdapterMockRecorder) Scan(req interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Scan\", reflect.TypeOf((*MockAdapter)(nil).Scan), req)\n}", "title": "" }, { "docid": "ace80d2cd31fd0df20f5cb539d2074e1", "score": "0.39300132", "text": "func (s *Scanner) Scan(export bool) error {\n\treader, err := s.Request()\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif export {\n\t\tfmt.Println(reader)\n\t\treturn nil\n\t}\n\n\treturn json.NewDecoder(reader).Decode(&s.Report)\n}", "title": "" }, { "docid": "dc2ca6ad28f35114f2a813d191f2b470", "score": "0.39284077", "text": "func (scanner *Scanner) Scan(target zgrab2.ScanTarget) (zgrab2.ScanStatus, interface{}, error) {\n\t// ping, info, quit\n\tscan, err := scanner.StartScan(&target)\n\tif err != nil {\n\t\treturn zgrab2.TryGetScanStatus(err), nil, err\n\t}\n\tdefer scan.Close()\n\tresult := scan.result\n\tpingResponse, err := scan.SendCommand(\"PING\")\n\tif err != nil {\n\t\t// if the first command fails (as opposed to succeeding but returning an\n\t\t// ErrorMessage response), then flag the probe as having failed.\n\t\treturn zgrab2.TryGetScanStatus(err), nil, err\n\t}\n\t// From this point forward, we always return a non-nil result, implying that\n\t// we have positively identified that a redis service is present.\n\tresult.PingResponse = forceToString(pingResponse)\n\tif scanner.config.Password != \"\" {\n\t\tauthResponse, err := scan.SendCommand(scanner.config.AuthCommand, scanner.config.Password)\n\t\tif err != nil {\n\t\t\treturn zgrab2.TryGetScanStatus(err), result, err\n\t\t}\n\t\tresult.AuthResponse = forceToString(authResponse)\n\t}\n\tinfoResponse, err := scan.SendCommand(\"INFO\")\n\tif err != nil {\n\t\treturn zgrab2.TryGetScanStatus(err), result, err\n\t}\n\tresult.InfoResponse = forceToString(infoResponse)\n\tinfoResponseBulk, ok := infoResponse.(BulkString)\n\tif ok {\n\t\tfor _, line := range strings.Split(string(infoResponseBulk), \"\\r\\n\") {\n\t\t\tif strings.HasPrefix(line, \"redis_version:\") {\n\t\t\t\tresult.Version = strings.SplitN(line, \":\", 2)[1]\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\tbogusResponse, err := scan.SendCommand(\"NONEXISTENT\")\n\tif err != nil {\n\t\treturn zgrab2.TryGetScanStatus(err), result, err\n\t}\n\tresult.NonexistentResponse = forceToString(bogusResponse)\n\tquitResponse, err := scan.SendCommand(\"QUIT\")\n\tif err != nil && err != io.EOF {\n\t\treturn zgrab2.TryGetScanStatus(err), result, err\n\t}\n\tresult.QuitResponse = forceToString(quitResponse)\n\treturn zgrab2.SCAN_SUCCESS, &result, nil\n}", "title": "" }, { "docid": "b6fe9f78bc4f52002c5656dafe8052f3", "score": "0.39274725", "text": "func (ss *StatSLRUs) Scan(value interface{}) error {\n\treturn convert.JSONScan(ss, value)\n}", "title": "" }, { "docid": "453a3a98302f11c0df06e0ba78fa3be6", "score": "0.39274278", "text": "func (p *prov) Update(id string, ts v1alpha1.MonitorTemplateSpec) (string, error) {\n\tlogrus.Infof(\"Updating monitor %s with ID %s\", ts.Name, id)\n\n\treturn id, nil\n}", "title": "" }, { "docid": "3cd15451cda72a917d5c1d869ceb19b7", "score": "0.39205188", "text": "func (c *SurveyCellScanClient) Update() *SurveyCellScanUpdate {\n\treturn &SurveyCellScanUpdate{config: c.config}\n}", "title": "" }, { "docid": "a23c3068061f6f8eaee0fb24b86878ba", "score": "0.39189273", "text": "func (p *Plugin) scan(errChan chan error, pluginIndex int, DownloadQueue chan requests.PluginReq) {\n\n\terr := p.setDaysSinceUpdate()\n\tif err != nil {\n\t\terrChan <- fmt.Errorf(\"Plugin.go:Download() failed to setDaysSinceUpdate() with error: %s\", err)\n\t}\n\terr = p.setOutPath()\n\tif err != nil {\n\t\t// This error will stop us from downloading the plugin properly. so we skip it early.\n\t\terrChan <- fmt.Errorf(\"Plugin.go:Download() failed to setOutPath() with error: %s\", err)\n\t\treturn\n\t}\n\n\tDownloadQueue <- requests.PluginReq{\n\t\tURI: p.DownloadLink,\n\t\tFilePath: p.OutPath,\n\t\tIndex: pluginIndex,\n\t}\n}", "title": "" }, { "docid": "197aa48c80ac2e8b7fbf8ba1ae75a136", "score": "0.3915188", "text": "func (t *Method) Scan(value interface{}) (err error) {\n\treturn factoryMethod.Scan(t, value)\n}", "title": "" }, { "docid": "86402874fa5e1f0c27bd6da4bb26e863", "score": "0.38959232", "text": "func (pg *PGClient) UpdateBooking(booking *model.Booking) error {\n\ttx, err := pg.DB.Beginx()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tswitch err {\n\t\tcase nil:\n\t\t\terr = tx.Commit()\n\t\tdefault:\n\t\t\ttx.Rollback()\n\t\t}\n\t}()\n\n\t//check if booking exists\n\tcheck := &model.Booking{}\n\terr = tx.Get(check, qBookingBy + `id = $1`, booking.Id)\n\tif err != nil {\n\t\tif err == sql.ErrNoRows {\n\t\t\treturn ErrOrderNotFound\n\t\t}\n\t\treturn err\n\t}\n\n\tresult, err := tx.NamedExec(qUpdateBooking, booking)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = result.RowsAffected()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "ef51b82ec2f0204f0014ca57322e5a3a", "score": "0.3889954", "text": "func (mr *MockStoreMockRecorder) SetScanReport(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"SetScanReport\", reflect.TypeOf((*MockStore)(nil).SetScanReport), arg0, arg1)\n}", "title": "" }, { "docid": "383064832e8207301bce9cacd13d3a79", "score": "0.38889763", "text": "func (mr *MockPackageScannerMockRecorder) Scan(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Scan\", reflect.TypeOf((*MockPackageScanner)(nil).Scan), arg0, arg1)\n}", "title": "" }, { "docid": "3c31ce9ae487da6d5dc3961f92ee851e", "score": "0.38875368", "text": "func (content Contents) PauseScan(uuid string) {\n postData := make(map[string]string)\n postData[\"scan_uuid\"] = uuid\n request(\"scan/pause\", postData, &content)\n}", "title": "" }, { "docid": "e955e5eb47bc7e1d53fd706ac12c9077", "score": "0.38870707", "text": "func (mr *MockScannerMockRecorder) Scan() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Scan\", reflect.TypeOf((*MockScanner)(nil).Scan))\n}", "title": "" }, { "docid": "559badaced7d01ad418d93f8ebf900c9", "score": "0.3885882", "text": "func Update(credentials model.Credential) int64 {\n\tdb := connect()\n\tdefer db.Close()\n\n\tpStmt, _ := db.Prepare(\"UPDATE iot.users SET refresh_token = ? WHERE refresh_token = ? AND username = ?\")\n\tdefer pStmt.Close()\n\n\tresult, err := pStmt.Exec(credentials.NewRefreshToken, credentials.RefreshToken, credentials.Username)\n\n\tif err != nil {\n\t\tlog.Println(\"The transaction failed\")\n\t\treturn 0\n\t}\n\n\trows, _ := result.RowsAffected()\n\n\treturn rows\n}", "title": "" }, { "docid": "e30434a07232ff60c9d82174892a8326", "score": "0.38634497", "text": "func (adapter *HwAdapter) UpdateSubscription(subscription bool) {\n\tf := func() error {\n\t\tif adapter.tunerClient == nil {\n\t\t\treturn errors.New(\"tuner not available\")\n\t\t}\n\n\t\trq := &rpc.TunerUpdateSubscriptionRequest{}\n\t\trq.Active = subscription\n\t\t_, err := adapter.tunerClient.RpcUpdateSubscription(context.Background(), rq)\n\t\treturn err\n\t}\n\tretry.UntilSuccessOr5Failures(\"updating subscription\", f)\n}", "title": "" }, { "docid": "7915defb37785042ca34428d2ecc8efd", "score": "0.385516", "text": "func (device *Device) StopScan() {\n\tdevice.f.Write([]byte{BG_COMMAND, 0, BG_MSG_CLASS_GAP, BG_DISCOVER_STOP})\n}", "title": "" }, { "docid": "443fbb2654552f6d18205c766d2cc716", "score": "0.38474098", "text": "func (rrc *ResourceReservationCache) Update(rr *v1beta2.ResourceReservation) error {\n\treturn rrc.cache.Update(rr)\n}", "title": "" }, { "docid": "cbad5db71ea86f993b27d653ad21959c", "score": "0.38425577", "text": "func (ctx *Context) SetScanner(curr BasicScanner) (prev BasicScanner) {\n\tctx.Lock()\n\tdefer ctx.Unlock()\n\n\tprev, ctx.scanner = ctx.scanner, curr\n\treturn\n}", "title": "" }, { "docid": "5c5dda7cab930d3165587fde527dc88d", "score": "0.3839959", "text": "func (device *Device) Scan(data chan beacon.ScanData, done chan bool) {\n\tdevice.Open()\n\tdevice.StartScan()\n\n\treadChan := make(chan *Response, 2)\n\tshouldStop := false\n\tgo func() {\n\t\tfor !shouldStop {\n\t\t\tr, err := device.Read()\n\t\t\tif err == nil {\n\t\t\t\treadChan <- r\n\t\t\t}\n\t\t}\n\t\tclose(readChan)\n\t}()\n\nloop:\n\tfor {\n\t\tselect {\n\t\tcase r, more := <-readChan:\n\t\t\tif !more {\n\t\t\t\tbreak loop\n\t\t\t}\n\t\t\tif r.IsAdvertisement() {\n\t\t\t\tif r.IsMfgAd() {\n\t\t\t\t\tdata <- beacon.ScanData{\n\t\t\t\t\t\tBytes: r.Data[20:],\n\t\t\t\t\t\tDevice: r.MacAddress().String(),\n\t\t\t\t\t\tRSSI: r.RSSI(),\n\t\t\t\t\t\tRaw: &r.Data,\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tdata <- beacon.ScanData{\n\t\t\t\t\t\tBytes: r.Data[24:],\n\t\t\t\t\t\tDevice: r.MacAddress().String(),\n\t\t\t\t\t\tRSSI: r.RSSI(),\n\t\t\t\t\t\tRaw: &r.Data,\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\tcase <-done:\n\t\t\tshouldStop = true\n\t\t}\n\t}\n\tclose(data)\n\tdevice.StopScan()\n\tdevice.Close()\n}", "title": "" }, { "docid": "c8bf90d4cf11c8b5e294c73f6ac70b09", "score": "0.3839745", "text": "func (c *Controller) GetScan(w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r)\n\tlog.Println(vars)\n\n\tid := vars[\"id\"] // param id\n\tlog.Println(id)\n\n\tscanid, err := strconv.Atoi(id)\n\n\tif err != nil {\n\t\tlog.Fatalln(\"Error GetScan\", err)\n\t}\n\n\tscan := c.Repository.GetScanById(scanid)\n\tdata, _ := json.Marshal(scan)\n\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\tw.WriteHeader(http.StatusOK)\n\tw.Write(data)\n\treturn\n}", "title": "" }, { "docid": "5e60e4b1ad28a080f0527302245f5bfe", "score": "0.38389707", "text": "func UpdateTicket(db *sql.DB, params map[string]interface{}) error {\n\tcondKey := []string{\"id\"}\n\tignoredKey := []string{\n\t\t\"id\",\n\t\t\"created_at\",\n\t\t\"updated_at\",\n\t\t\"status\",\n\t}\n\n\tif err := helper.UpdateData(db, \"tickets\", params, ignoredKey, condKey); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b787148a58b9f3cf6e32eadb76629f79", "score": "0.3834305", "text": "func (pc *PerceptorClient) PostFinishedScan(scan *api.FinishedScanClientJob) error {\n\turl := fmt.Sprintf(\"http://%s:%d/%s\", pc.Host, pc.Port, finishedScanPath)\n\tlog.Debugf(\"about to issue post request %+v to url %s\", scan, url)\n\tresp, err := pc.Resty.R().SetBody(scan).Post(url)\n\tlog.Debugf(\"received resp %+v, status code %d, error %+v from url %s\", resp, resp.StatusCode(), err, url)\n\trecordHTTPStats(finishedScanPath, resp.StatusCode())\n\tif err != nil {\n\t\trecordScannerError(\"unable to post finished scan\")\n\t\treturn errors.Annotatef(err, \"unable to post finished scan\")\n\t} else if (resp.StatusCode() < 200) || (resp.StatusCode() >= 300) {\n\t\trecordScannerError(\"unable to post finished scan -- bad status code\")\n\t\treturn fmt.Errorf(\"unable to post finished scan; body %s and status code %d\", string(resp.Body()), resp.StatusCode())\n\t}\n\treturn errors.Trace(err)\n}", "title": "" }, { "docid": "3607baef06b0a58e806c5e628c806416", "score": "0.38297418", "text": "func (pc *Protecode) DeleteScan(cleanupMode string, productID int) {\n\tswitch cleanupMode {\n\tcase \"none\":\n\tcase \"binary\":\n\tcase \"complete\":\n\t\tpc.logger.Info(\"Deleting scan from server.\")\n\t\tprotecodeURL := pc.createURL(\"/api/product/\", fmt.Sprintf(\"%v/\", productID), \"\")\n\t\theaders := map[string][]string{}\n\n\t\tpc.sendAPIRequest(\"DELETE\", protecodeURL, headers)\n\tdefault:\n\t\t//TODO: bubble up error\n\t\tpc.logger.Fatalf(\"Unknown cleanup mode %v\", cleanupMode)\n\t}\n}", "title": "" }, { "docid": "e3a65439575a124ef99c6653aaa36fda", "score": "0.3819231", "text": "func (fs *FilesAtCommitScanner) Scan() (report.Report, error) {\n\tvar scannerReport report.Report\n\tfIter, err := fs.commit.Files()\n\tif err != nil {\n\t\treturn scannerReport, err\n\t}\n\n\terr = fIter.ForEach(func(f *object.File) error {\n\t\tbin, err := f.IsBinary()\n\t\tif bin {\n\t\t\treturn nil\n\t\t} else if err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tcontent, err := f.Contents()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tscannerReport.Leaks = append(scannerReport.Leaks, checkRules(fs.BaseScanner, fs.commit, fs.repoName, f.Name, content)...)\n\t\treturn nil\n\t})\n\n\tscannerReport.Commits = 1\n\treturn scannerReport, err\n}", "title": "" }, { "docid": "6bfa26bafb7b9084d037215f8ba63e63", "score": "0.3819204", "text": "func (mr *MockGormItfMockRecorder) Scan(dest interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Scan\", reflect.TypeOf((*MockGormItf)(nil).Scan), dest)\n}", "title": "" }, { "docid": "afa30930698398a778f417369842a1b4", "score": "0.3807189", "text": "func (e *Entry) Scan() (resp *dynamodb.ScanOutput, err error) {\n\tparams := &dynamodb.ScanInput{\n\t\tTableName: aws.String(\"gobook-entries\"),\n\t\tAttributesToGet: []*string{\n\t\t\taws.String(\"Email\"),\n\t\t\taws.String(\"Name\"),\n\t\t\taws.String(\"Year\"),\n\t\t\taws.String(\"Content\"),\n\t\t},\n\t}\n\treturn e.svc.Scan(params)\n}", "title": "" } ]
20a29dad3b993f9fdcb731a6a03fba41
NewEdiscoveryCasesItemCustodiansCustodianItemRequestBuilder instantiates a new CustodianItemRequestBuilder and sets the default values.
[ { "docid": "b194a42ecf57d8d98cafa1e7fd7cd5b1", "score": "0.79662764", "text": "func NewEdiscoveryCasesItemCustodiansCustodianItemRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*EdiscoveryCasesItemCustodiansCustodianItemRequestBuilder) {\n urlParams := make(map[string]string)\n urlParams[\"request-raw-url\"] = rawUrl\n return NewEdiscoveryCasesItemCustodiansCustodianItemRequestBuilderInternal(urlParams, requestAdapter)\n}", "title": "" } ]
[ { "docid": "3ad3b70c8b786ae60ba2f32a633508f6", "score": "0.7836518", "text": "func NewEdiscoveryCasesItemCustodiansCustodianItemRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*EdiscoveryCasesItemCustodiansCustodianItemRequestBuilder) {\n m := &EdiscoveryCasesItemCustodiansCustodianItemRequestBuilder{\n BaseRequestBuilder: *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewBaseRequestBuilder(requestAdapter, \"{+baseurl}/compliance/ediscovery/cases/{case%2Did}/custodians/{custodian%2Did}{?%24select,%24expand}\", pathParameters),\n }\n return m\n}", "title": "" }, { "docid": "95a5602bbacd7306480e73451e0971f1", "score": "0.64660925", "text": "func NewCasesEdiscoveryCasesItemCustodiansItemUnifiedGroupSourcesRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*CasesEdiscoveryCasesItemCustodiansItemUnifiedGroupSourcesRequestBuilder) {\n m := &CasesEdiscoveryCasesItemCustodiansItemUnifiedGroupSourcesRequestBuilder{\n BaseRequestBuilder: *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewBaseRequestBuilder(requestAdapter, \"{+baseurl}/security/cases/ediscoveryCases/{ediscoveryCase%2Did}/custodians/{ediscoveryCustodian%2Did}/unifiedGroupSources{?%24top,%24skip,%24search,%24filter,%24count,%24orderby,%24select,%24expand}\", pathParameters),\n }\n return m\n}", "title": "" }, { "docid": "ff2053b9e955d838d4f99b38ded84dcd", "score": "0.63938695", "text": "func (m *CasesEdiscoveryCasesItemSearchesEdiscoverySearchItemRequestBuilder) CustodianSources()(*CasesEdiscoveryCasesItemSearchesItemCustodianSourcesRequestBuilder) {\n return NewCasesEdiscoveryCasesItemSearchesItemCustodianSourcesRequestBuilderInternal(m.pathParameters, m.requestAdapter)\n}", "title": "" }, { "docid": "639d312eca5af25cad6180c920e46fce", "score": "0.634144", "text": "func NewCasesEdiscoveryCasesItemCustodiansItemUnifiedGroupSourcesRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*CasesEdiscoveryCasesItemCustodiansItemUnifiedGroupSourcesRequestBuilder) {\n urlParams := make(map[string]string)\n urlParams[\"request-raw-url\"] = rawUrl\n return NewCasesEdiscoveryCasesItemCustodiansItemUnifiedGroupSourcesRequestBuilderInternal(urlParams, requestAdapter)\n}", "title": "" }, { "docid": "33200ce1a469a23ad23f48dc714875e3", "score": "0.590125", "text": "func (m *EdiscoveryCasesItemCustodiansCustodianItemRequestBuilder) Get(ctx context.Context, requestConfiguration *EdiscoveryCasesItemCustodiansCustodianItemRequestBuilderGetRequestConfiguration)(ic154d683aa4025ee28853b9c1a3c35cd1f093a1c4542feba4c07682e2752db13.Custodianable, error) {\n requestInfo, err := m.ToGetRequestInformation(ctx, 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, ic154d683aa4025ee28853b9c1a3c35cd1f093a1c4542feba4c07682e2752db13.CreateCustodianFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(ic154d683aa4025ee28853b9c1a3c35cd1f093a1c4542feba4c07682e2752db13.Custodianable), nil\n}", "title": "" }, { "docid": "9738c99288dceb8e955b1c80cce4e2cd", "score": "0.58176434", "text": "func NewEdiscoveryCasesItemSettingsRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*EdiscoveryCasesItemSettingsRequestBuilder) {\n m := &EdiscoveryCasesItemSettingsRequestBuilder{\n BaseRequestBuilder: *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewBaseRequestBuilder(requestAdapter, \"{+baseurl}/compliance/ediscovery/cases/{case%2Did}/settings{?%24select,%24expand}\", pathParameters),\n }\n return m\n}", "title": "" }, { "docid": "5e51bfd25291f9bd7283118ba74e9d8c", "score": "0.5809925", "text": "func NewCasesEdiscoveryCasesItemCustodiansItemSecurityReleaseRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*CasesEdiscoveryCasesItemCustodiansItemSecurityReleaseRequestBuilder) {\n urlParams := make(map[string]string)\n urlParams[\"request-raw-url\"] = rawUrl\n return NewCasesEdiscoveryCasesItemCustodiansItemSecurityReleaseRequestBuilderInternal(urlParams, requestAdapter)\n}", "title": "" }, { "docid": "38cf5e535fee027b8252a0015739740b", "score": "0.5809696", "text": "func NewEdiscoveryCasesItemSettingsRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*EdiscoveryCasesItemSettingsRequestBuilder) {\n urlParams := make(map[string]string)\n urlParams[\"request-raw-url\"] = rawUrl\n return NewEdiscoveryCasesItemSettingsRequestBuilderInternal(urlParams, requestAdapter)\n}", "title": "" }, { "docid": "ef3c96af880d150bb33d3411088d374a", "score": "0.56415373", "text": "func NewCasesEdiscoveryCasesItemSearchesEdiscoverySearchItemRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*CasesEdiscoveryCasesItemSearchesEdiscoverySearchItemRequestBuilder) {\n m := &CasesEdiscoveryCasesItemSearchesEdiscoverySearchItemRequestBuilder{\n }\n m.urlTemplate = \"{+baseurl}/security/cases/ediscoveryCases/{ediscoveryCase%2Did}/searches/{ediscoverySearch%2Did}{?%24select,%24expand}\";\n urlTplParams := make(map[string]string)\n for idx, item := range pathParameters {\n urlTplParams[idx] = item\n }\n m.pathParameters = urlTplParams\n m.requestAdapter = requestAdapter\n return m\n}", "title": "" }, { "docid": "2e68c6f58852372bfed90a15fb3ad715", "score": "0.5605686", "text": "func NewCasesEdiscoveryCasesItemSearchesEdiscoverySearchItemRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*CasesEdiscoveryCasesItemSearchesEdiscoverySearchItemRequestBuilder) {\n urlParams := make(map[string]string)\n urlParams[\"request-raw-url\"] = rawUrl\n return NewCasesEdiscoveryCasesItemSearchesEdiscoverySearchItemRequestBuilderInternal(urlParams, requestAdapter)\n}", "title": "" }, { "docid": "e8457b14409bc32023fcff09cc6fb870", "score": "0.5599355", "text": "func NewEdiscoveryCasesItemTagsTagItemRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*EdiscoveryCasesItemTagsTagItemRequestBuilder) {\n urlParams := make(map[string]string)\n urlParams[\"request-raw-url\"] = rawUrl\n return NewEdiscoveryCasesItemTagsTagItemRequestBuilderInternal(urlParams, requestAdapter)\n}", "title": "" }, { "docid": "da471d36200d7698d9813b3273a24822", "score": "0.55627227", "text": "func (m *EdiscoveryCasesItemCustodiansCustodianItemRequestBuilder) UserSources()(*EdiscoveryCasesItemCustodiansItemUserSourcesRequestBuilder) {\n return NewEdiscoveryCasesItemCustodiansItemUserSourcesRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter)\n}", "title": "" }, { "docid": "c47e5873176c64450123fb9382d3f849", "score": "0.5533059", "text": "func (m *EdiscoveryCasesItemCustodiansCustodianItemRequestBuilder) MicrosoftGraphEdiscoveryActivate()(*EdiscoveryCasesItemCustodiansItemMicrosoftGraphEdiscoveryActivateRequestBuilder) {\n return NewEdiscoveryCasesItemCustodiansItemMicrosoftGraphEdiscoveryActivateRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter)\n}", "title": "" }, { "docid": "c01afd2b515e1d70ee0b8036ab739a1d", "score": "0.55323625", "text": "func (m *CasesEdiscoveryCasesItemSearchesEdiscoverySearchItemRequestBuilder) NoncustodialSources()(*CasesEdiscoveryCasesItemSearchesItemNoncustodialSourcesRequestBuilder) {\n return NewCasesEdiscoveryCasesItemSearchesItemNoncustodialSourcesRequestBuilderInternal(m.pathParameters, m.requestAdapter)\n}", "title": "" }, { "docid": "5521bfd01bec123437c28a5e234e71a1", "score": "0.5527939", "text": "func NewCasesEdiscoveryCasesItemCustodiansItemMicrosoftGraphSecurityUpdateIndexRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*CasesEdiscoveryCasesItemCustodiansItemMicrosoftGraphSecurityUpdateIndexRequestBuilder) {\n urlParams := make(map[string]string)\n urlParams[\"request-raw-url\"] = rawUrl\n return NewCasesEdiscoveryCasesItemCustodiansItemMicrosoftGraphSecurityUpdateIndexRequestBuilderInternal(urlParams, requestAdapter)\n}", "title": "" }, { "docid": "38795d8a4cac1a80d73b2c4ba1183481", "score": "0.5514584", "text": "func NewCasesEdiscoveryCasesItemCustodiansItemSecurityReleaseRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*CasesEdiscoveryCasesItemCustodiansItemSecurityReleaseRequestBuilder) {\n m := &CasesEdiscoveryCasesItemCustodiansItemSecurityReleaseRequestBuilder{\n }\n m.urlTemplate = \"{+baseurl}/security/cases/ediscoveryCases/{ediscoveryCase%2Did}/custodians/{ediscoveryCustodian%2Did}/security.release\";\n urlTplParams := make(map[string]string)\n for idx, item := range pathParameters {\n urlTplParams[idx] = item\n }\n m.pathParameters = urlTplParams\n m.requestAdapter = requestAdapter\n return m\n}", "title": "" }, { "docid": "8d5b3f9e8fc8182a6a2bbc928e20ea75", "score": "0.5497451", "text": "func (m *EdiscoveryCasesItemCustodiansCustodianItemRequestBuilder) ToGetRequestInformation(ctx context.Context, requestConfiguration *EdiscoveryCasesItemCustodiansCustodianItemRequestBuilderGetRequestConfiguration)(*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) {\n requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation()\n requestInfo.UrlTemplate = m.BaseRequestBuilder.UrlTemplate\n requestInfo.PathParameters = m.BaseRequestBuilder.PathParameters\n requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.GET\n requestInfo.Headers.Add(\"Accept\", \"application/json\")\n if requestConfiguration != nil {\n if requestConfiguration.QueryParameters != nil {\n requestInfo.AddQueryParameters(*(requestConfiguration.QueryParameters))\n }\n requestInfo.Headers.AddAll(requestConfiguration.Headers)\n requestInfo.AddRequestOptions(requestConfiguration.Options)\n }\n return requestInfo, nil\n}", "title": "" }, { "docid": "438204f79be3f002e96b94bfcd2e8591", "score": "0.54298216", "text": "func (m *EdiscoveryCasesItemCustodiansCustodianItemRequestBuilder) Delete(ctx context.Context, requestConfiguration *EdiscoveryCasesItemCustodiansCustodianItemRequestBuilderDeleteRequestConfiguration)(error) {\n requestInfo, err := m.ToDeleteRequestInformation(ctx, requestConfiguration);\n if err != nil {\n return err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n }\n err = m.BaseRequestBuilder.RequestAdapter.SendNoContent(ctx, requestInfo, errorMapping)\n if err != nil {\n return err\n }\n return nil\n}", "title": "" }, { "docid": "4700dcf5b65af396811545fa2c7adf0b", "score": "0.5413503", "text": "func NewCasesEdiscoveryCasesItemCustodiansItemMicrosoftGraphSecurityUpdateIndexRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*CasesEdiscoveryCasesItemCustodiansItemMicrosoftGraphSecurityUpdateIndexRequestBuilder) {\n m := &CasesEdiscoveryCasesItemCustodiansItemMicrosoftGraphSecurityUpdateIndexRequestBuilder{\n BaseRequestBuilder: *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewBaseRequestBuilder(requestAdapter, \"{+baseurl}/security/cases/ediscoveryCases/{ediscoveryCase%2Did}/custodians/{ediscoveryCustodian%2Did}/microsoft.graph.security.updateIndex\", pathParameters),\n }\n return m\n}", "title": "" }, { "docid": "ff67d8f0d188c0eb42fc32cfb2a2a89c", "score": "0.5376785", "text": "func (m *EdiscoveryCasesItemCustodiansCustodianItemRequestBuilder) SiteSources()(*EdiscoveryCasesItemCustodiansItemSiteSourcesRequestBuilder) {\n return NewEdiscoveryCasesItemCustodiansItemSiteSourcesRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter)\n}", "title": "" }, { "docid": "c7be364f3a9d75e2adc7dd21a2878467", "score": "0.5363189", "text": "func NewItemPeopleRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemPeopleRequestBuilder) {\n urlParams := make(map[string]string)\n urlParams[\"request-raw-url\"] = rawUrl\n return NewItemPeopleRequestBuilderInternal(urlParams, requestAdapter)\n}", "title": "" }, { "docid": "d44f17e4e2cb25f37da2a82eae2a257a", "score": "0.5350361", "text": "func NewItemContactFoldersContactFolderItemRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemContactFoldersContactFolderItemRequestBuilder) {\n m := &ItemContactFoldersContactFolderItemRequestBuilder{\n }\n m.urlTemplate = \"{+baseurl}/users/{user%2Did}/contactFolders/{contactFolder%2Did}{?%24select}\";\n urlTplParams := make(map[string]string)\n for idx, item := range pathParameters {\n urlTplParams[idx] = item\n }\n m.pathParameters = urlTplParams\n m.requestAdapter = requestAdapter\n return m\n}", "title": "" }, { "docid": "bc3b58394c3ab571a877b50f294db106", "score": "0.5256497", "text": "func NewEdiscoveryCasesItemTagsTagItemRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*EdiscoveryCasesItemTagsTagItemRequestBuilder) {\n m := &EdiscoveryCasesItemTagsTagItemRequestBuilder{\n BaseRequestBuilder: *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewBaseRequestBuilder(requestAdapter, \"{+baseurl}/compliance/ediscovery/cases/{case%2Did}/tags/{tag%2Did}{?%24select,%24expand}\", pathParameters),\n }\n return m\n}", "title": "" }, { "docid": "cab431164e82bf0a23ce939691169a2d", "score": "0.5220957", "text": "func (m *EdiscoveryCasesItemCustodiansCustodianItemRequestBuilder) MicrosoftGraphEdiscoveryRelease()(*EdiscoveryCasesItemCustodiansItemMicrosoftGraphEdiscoveryReleaseRequestBuilder) {\n return NewEdiscoveryCasesItemCustodiansItemMicrosoftGraphEdiscoveryReleaseRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter)\n}", "title": "" }, { "docid": "d49beccab384c8ddf50ca51adf2a036c", "score": "0.5208458", "text": "func NewItemContactFoldersContactFolderItemRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemContactFoldersContactFolderItemRequestBuilder) {\n urlParams := make(map[string]string)\n urlParams[\"request-raw-url\"] = rawUrl\n return NewItemContactFoldersContactFolderItemRequestBuilderInternal(urlParams, requestAdapter)\n}", "title": "" }, { "docid": "757e3705ef5742025171ef4ac0d2825b", "score": "0.5203213", "text": "func (m *EdiscoveryCasesItemCustodiansCustodianItemRequestBuilder) MicrosoftGraphEdiscoveryApplyHold()(*EdiscoveryCasesItemCustodiansItemMicrosoftGraphEdiscoveryApplyHoldRequestBuilder) {\n return NewEdiscoveryCasesItemCustodiansItemMicrosoftGraphEdiscoveryApplyHoldRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter)\n}", "title": "" }, { "docid": "da0d763805d7f35c8c2d02527d03f6c0", "score": "0.5202955", "text": "func (m *EdiscoveryCasesItemCustodiansCustodianItemRequestBuilder) MicrosoftGraphEdiscoveryUpdateIndex()(*EdiscoveryCasesItemCustodiansItemMicrosoftGraphEdiscoveryUpdateIndexRequestBuilder) {\n return NewEdiscoveryCasesItemCustodiansItemMicrosoftGraphEdiscoveryUpdateIndexRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter)\n}", "title": "" }, { "docid": "01533ed698f3f239de7d410f3f778814", "score": "0.51978374", "text": "func NewCompaniesItemSalesCreditMemosRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*CompaniesItemSalesCreditMemosRequestBuilder) {\n m := &CompaniesItemSalesCreditMemosRequestBuilder{\n BaseRequestBuilder: *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewBaseRequestBuilder(requestAdapter, \"{+baseurl}/financials/companies/{company%2Did}/salesCreditMemos{?%24top,%24skip,%24search,%24filter,%24count,%24orderby,%24select,%24expand}\", pathParameters),\n }\n return m\n}", "title": "" }, { "docid": "c5e68b11f983d1c7430bb5c2f3da5162", "score": "0.5192922", "text": "func NewCompaniesItemSalesCreditMemosRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*CompaniesItemSalesCreditMemosRequestBuilder) {\n urlParams := make(map[string]string)\n urlParams[\"request-raw-url\"] = rawUrl\n return NewCompaniesItemSalesCreditMemosRequestBuilderInternal(urlParams, requestAdapter)\n}", "title": "" }, { "docid": "dc668a3bd8d1a82c7b01c4498b310707", "score": "0.5177128", "text": "func NewCalendarItemRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*CalendarItemRequestBuilder) {\n urlParams := make(map[string]string)\n urlParams[\"request-raw-url\"] = rawUrl\n return NewCalendarItemRequestBuilderInternal(urlParams, requestAdapter)\n}", "title": "" }, { "docid": "d8643444187cabecd845690e2103816a", "score": "0.5132739", "text": "func NewItemCalendarRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemCalendarRequestBuilder) {\n urlParams := make(map[string]string)\n urlParams[\"request-raw-url\"] = rawUrl\n return NewItemCalendarRequestBuilderInternal(urlParams, requestAdapter)\n}", "title": "" }, { "docid": "0c199687b04b3cdae256db85a0391bc8", "score": "0.51249236", "text": "func NewCalendarItemRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*CalendarItemRequestBuilder) {\n m := &CalendarItemRequestBuilder{\n }\n m.urlTemplate = \"{+baseurl}/me/calendarGroups/{calendarGroup%2Did}/calendars/{calendar%2Did}{?%24select}\";\n urlTplParams := make(map[string]string)\n for idx, item := range pathParameters {\n urlTplParams[idx] = item\n }\n m.pathParameters = urlTplParams;\n m.requestAdapter = requestAdapter;\n return m\n}", "title": "" }, { "docid": "e0df2a47670bb10e00fe2d2ebedce510", "score": "0.51226157", "text": "func NewCompaniesItemPurchaseInvoicesItemPostRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*CompaniesItemPurchaseInvoicesItemPostRequestBuilder) {\n urlParams := make(map[string]string)\n urlParams[\"request-raw-url\"] = rawUrl\n return NewCompaniesItemPurchaseInvoicesItemPostRequestBuilderInternal(urlParams, requestAdapter)\n}", "title": "" }, { "docid": "8f2f1a072407fb2fa58da29170ff6ded", "score": "0.50964206", "text": "func NewCompaniesItemPurchaseInvoiceLinesItemItemRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*CompaniesItemPurchaseInvoiceLinesItemItemRequestBuilder) {\n urlParams := make(map[string]string)\n urlParams[\"request-raw-url\"] = rawUrl\n return NewCompaniesItemPurchaseInvoiceLinesItemItemRequestBuilderInternal(urlParams, requestAdapter)\n}", "title": "" }, { "docid": "c76a8fb63b4e6e659be773170a4f90e6", "score": "0.5059576", "text": "func NewItemAppConsentRequestsForApprovalItemUserConsentRequestsUserConsentRequestItemRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemAppConsentRequestsForApprovalItemUserConsentRequestsUserConsentRequestItemRequestBuilder) {\n m := &ItemAppConsentRequestsForApprovalItemUserConsentRequestsUserConsentRequestItemRequestBuilder{\n BaseRequestBuilder: *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewBaseRequestBuilder(requestAdapter, \"{+baseurl}/users/{user%2Did}/appConsentRequestsForApproval/{appConsentRequest%2Did}/userConsentRequests/{userConsentRequest%2Did}{?%24select,%24expand}\", pathParameters),\n }\n return m\n}", "title": "" }, { "docid": "97c087f0f11c5f723d97a59783433235", "score": "0.5058478", "text": "func NewCasesEdiscoveryCasesItemMicrosoftGraphSecurityCloseRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*CasesEdiscoveryCasesItemMicrosoftGraphSecurityCloseRequestBuilder) {\n urlParams := make(map[string]string)\n urlParams[\"request-raw-url\"] = rawUrl\n return NewCasesEdiscoveryCasesItemMicrosoftGraphSecurityCloseRequestBuilderInternal(urlParams, requestAdapter)\n}", "title": "" }, { "docid": "58fad5a8dfb810e7c5a91c0e59bfb9d9", "score": "0.5033946", "text": "func NewClassesEducationClassItemRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ClassesEducationClassItemRequestBuilder) {\n urlParams := make(map[string]string)\n urlParams[\"request-raw-url\"] = rawUrl\n return NewClassesEducationClassItemRequestBuilderInternal(urlParams, requestAdapter)\n}", "title": "" }, { "docid": "8169ba1eb3c11230de10775f6e8c13bc", "score": "0.49985495", "text": "func NewItemPeoplePersonItemRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemPeoplePersonItemRequestBuilder) {\n urlParams := make(map[string]string)\n urlParams[\"request-raw-url\"] = rawUrl\n return NewItemPeoplePersonItemRequestBuilderInternal(urlParams, requestAdapter)\n}", "title": "" }, { "docid": "39b8a186fbd720d1ce80dcbeae485c1b", "score": "0.49737555", "text": "func NewItemCalendarRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemCalendarRequestBuilder) {\n m := &ItemCalendarRequestBuilder{\n BaseRequestBuilder: *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewBaseRequestBuilder(requestAdapter, \"{+baseurl}/groups/{group%2Did}/calendar{?%24select}\", pathParameters),\n }\n return m\n}", "title": "" }, { "docid": "a51af9a2f42ea6d0ae13a9ddf58d3d7c", "score": "0.4966335", "text": "func NewEdiscoveryCasesItemLegalHoldsRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*EdiscoveryCasesItemLegalHoldsRequestBuilder) {\n urlParams := make(map[string]string)\n urlParams[\"request-raw-url\"] = rawUrl\n return NewEdiscoveryCasesItemLegalHoldsRequestBuilderInternal(urlParams, requestAdapter)\n}", "title": "" }, { "docid": "9f9ead6c15b57b56f004d966ef993ccf", "score": "0.4957818", "text": "func (m *EdiscoveryCasesItemCustodiansCustodianItemRequestBuilder) MicrosoftGraphEdiscoveryRemoveHold()(*EdiscoveryCasesItemCustodiansItemMicrosoftGraphEdiscoveryRemoveHoldRequestBuilder) {\n return NewEdiscoveryCasesItemCustodiansItemMicrosoftGraphEdiscoveryRemoveHoldRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter)\n}", "title": "" }, { "docid": "e7f211169fcff8b3a222fb6b4f8a4b32", "score": "0.49558452", "text": "func NewCasesEdiscoveryCasesItemNoncustodialDataSourcesItemMicrosoftGraphSecurityUpdateIndexRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*CasesEdiscoveryCasesItemNoncustodialDataSourcesItemMicrosoftGraphSecurityUpdateIndexRequestBuilder) {\n urlParams := make(map[string]string)\n urlParams[\"request-raw-url\"] = rawUrl\n return NewCasesEdiscoveryCasesItemNoncustodialDataSourcesItemMicrosoftGraphSecurityUpdateIndexRequestBuilderInternal(urlParams, requestAdapter)\n}", "title": "" }, { "docid": "a441977c8c8e671326a600ed04212599", "score": "0.49328932", "text": "func NewItemItemsItemWorkbookFunctionsNorm_S_DistRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemItemsItemWorkbookFunctionsNorm_S_DistRequestBuilder) {\n urlParams := make(map[string]string)\n urlParams[\"request-raw-url\"] = rawUrl\n return NewItemItemsItemWorkbookFunctionsNorm_S_DistRequestBuilderInternal(urlParams, requestAdapter)\n}", "title": "" }, { "docid": "2b2e5a6bce3b02f2a6128dbde243c51f", "score": "0.49212697", "text": "func NewItemCloudPCsItemGetCloudPcConnectivityHistoryRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemCloudPCsItemGetCloudPcConnectivityHistoryRequestBuilder) {\n urlParams := make(map[string]string)\n urlParams[\"request-raw-url\"] = rawUrl\n return NewItemCloudPCsItemGetCloudPcConnectivityHistoryRequestBuilderInternal(urlParams, requestAdapter)\n}", "title": "" }, { "docid": "684c65058399885849d507c31cd748f5", "score": "0.49187312", "text": "func NewCasesEdiscoveryCasesItemNoncustodialDataSourcesItemMicrosoftGraphSecurityUpdateIndexRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*CasesEdiscoveryCasesItemNoncustodialDataSourcesItemMicrosoftGraphSecurityUpdateIndexRequestBuilder) {\n m := &CasesEdiscoveryCasesItemNoncustodialDataSourcesItemMicrosoftGraphSecurityUpdateIndexRequestBuilder{\n BaseRequestBuilder: *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewBaseRequestBuilder(requestAdapter, \"{+baseurl}/security/cases/ediscoveryCases/{ediscoveryCase%2Did}/noncustodialDataSources/{ediscoveryNoncustodialDataSource%2Did}/microsoft.graph.security.updateIndex\", pathParameters),\n }\n return m\n}", "title": "" }, { "docid": "cd15edd2879b42c6e0863aca59469278", "score": "0.49180716", "text": "func NewContentTypeItemRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ContentTypeItemRequestBuilder) {\n m := &ContentTypeItemRequestBuilder{\n }\n m.urlTemplate = \"{+baseurl}/sites/{site%2Did}/contentTypes/{contentType%2Did}{?%24select,%24expand}\";\n urlTplParams := make(map[string]string)\n for idx, item := range pathParameters {\n urlTplParams[idx] = item\n }\n m.pathParameters = urlTplParams;\n m.requestAdapter = requestAdapter;\n return m\n}", "title": "" }, { "docid": "fcf80a939e1febbf46d1200557764429", "score": "0.4904291", "text": "func NewItemCalendarEventsEventItemRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemCalendarEventsEventItemRequestBuilder) {\n urlParams := make(map[string]string)\n urlParams[\"request-raw-url\"] = rawUrl\n return NewItemCalendarEventsEventItemRequestBuilderInternal(urlParams, requestAdapter)\n}", "title": "" }, { "docid": "40d2da48447b36c0417d18dfad524cb0", "score": "0.4903109", "text": "func NewItemCloudPCsItemGetCloudPcConnectivityHistoryRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemCloudPCsItemGetCloudPcConnectivityHistoryRequestBuilder) {\n m := &ItemCloudPCsItemGetCloudPcConnectivityHistoryRequestBuilder{\n BaseRequestBuilder: *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewBaseRequestBuilder(requestAdapter, \"{+baseurl}/users/{user%2Did}/cloudPCs/{cloudPC%2Did}/getCloudPcConnectivityHistory(){?%24top,%24skip,%24search,%24filter,%24count}\", pathParameters),\n }\n return m\n}", "title": "" }, { "docid": "0357228c3017789a530472a8806d22fb", "score": "0.4893525", "text": "func NewItemPeopleRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemPeopleRequestBuilder) {\n m := &ItemPeopleRequestBuilder{\n BaseRequestBuilder: *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewBaseRequestBuilder(requestAdapter, \"{+baseurl}/users/{user%2Did}/people{?%24top,%24skip,%24search,%24filter,%24count,%24orderby,%24select}\", pathParameters),\n }\n return m\n}", "title": "" }, { "docid": "ee4d98ddcd84f5e6237f6896efa057f1", "score": "0.48826432", "text": "func NewBookingBusinessesItemCalendarViewRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*BookingBusinessesItemCalendarViewRequestBuilder) {\n urlParams := make(map[string]string)\n urlParams[\"request-raw-url\"] = rawUrl\n return NewBookingBusinessesItemCalendarViewRequestBuilderInternal(urlParams, requestAdapter)\n}", "title": "" }, { "docid": "e3c0746d5b50d43c069aa7d26c3226ec", "score": "0.48714244", "text": "func NewClassesEducationClassItemRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ClassesEducationClassItemRequestBuilder) {\n m := &ClassesEducationClassItemRequestBuilder{\n }\n m.urlTemplate = \"{+baseurl}/education/classes/{educationClass%2Did}{?%24select,%24expand}\";\n urlTplParams := make(map[string]string)\n for idx, item := range pathParameters {\n urlTplParams[idx] = item\n }\n m.pathParameters = urlTplParams\n m.requestAdapter = requestAdapter\n return m\n}", "title": "" }, { "docid": "e275bead01c10718cb8a4855e2f21273", "score": "0.48662093", "text": "func NewItemCloudPCsItemRestoreRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemCloudPCsItemRestoreRequestBuilder) {\n m := &ItemCloudPCsItemRestoreRequestBuilder{\n BaseRequestBuilder: *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewBaseRequestBuilder(requestAdapter, \"{+baseurl}/users/{user%2Did}/cloudPCs/{cloudPC%2Did}/restore\", pathParameters),\n }\n return m\n}", "title": "" }, { "docid": "45a5bf7d7b68b4cbdf54a2dee569691c", "score": "0.48605788", "text": "func NewCompaniesItemSalesInvoicesItemCustomerPicturePictureItemRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*CompaniesItemSalesInvoicesItemCustomerPicturePictureItemRequestBuilder) {\n urlParams := make(map[string]string)\n urlParams[\"request-raw-url\"] = rawUrl\n return NewCompaniesItemSalesInvoicesItemCustomerPicturePictureItemRequestBuilderInternal(urlParams, requestAdapter)\n}", "title": "" }, { "docid": "03ed6a583faa08b1b5c610edf2a7e2f0", "score": "0.4857494", "text": "func NewContentTypeItemRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ContentTypeItemRequestBuilder) {\n urlParams := make(map[string]string)\n urlParams[\"request-raw-url\"] = rawUrl\n return NewContentTypeItemRequestBuilderInternal(urlParams, requestAdapter)\n}", "title": "" }, { "docid": "d1e12bd2be8fa67a604b20a2b27ae34f", "score": "0.48552552", "text": "func NewEdiscoveryCasesItemLegalHoldsRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*EdiscoveryCasesItemLegalHoldsRequestBuilder) {\n m := &EdiscoveryCasesItemLegalHoldsRequestBuilder{\n BaseRequestBuilder: *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewBaseRequestBuilder(requestAdapter, \"{+baseurl}/compliance/ediscovery/cases/{case%2Did}/legalHolds{?%24top,%24skip,%24search,%24filter,%24count,%24orderby,%24select,%24expand}\", pathParameters),\n }\n return m\n}", "title": "" }, { "docid": "c50c5abdf7d6441a99c0a20d9f4de1c1", "score": "0.4850078", "text": "func NewItemDevicesDeviceItemRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemDevicesDeviceItemRequestBuilder) {\n urlParams := make(map[string]string)\n urlParams[\"request-raw-url\"] = rawUrl\n return NewItemDevicesDeviceItemRequestBuilderInternal(urlParams, requestAdapter)\n}", "title": "" }, { "docid": "b5b2a9937fd4de4d60551c64d454d464", "score": "0.4848464", "text": "func NewItemAppConsentRequestsForApprovalItemUserConsentRequestsUserConsentRequestItemRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemAppConsentRequestsForApprovalItemUserConsentRequestsUserConsentRequestItemRequestBuilder) {\n urlParams := make(map[string]string)\n urlParams[\"request-raw-url\"] = rawUrl\n return NewItemAppConsentRequestsForApprovalItemUserConsentRequestsUserConsentRequestItemRequestBuilderInternal(urlParams, requestAdapter)\n}", "title": "" }, { "docid": "07541a7ba06825f7aa292fe93f739c11", "score": "0.4842919", "text": "func NewSchoolsItemClassesEducationClassItemRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*SchoolsItemClassesEducationClassItemRequestBuilder) {\n urlParams := make(map[string]string)\n urlParams[\"request-raw-url\"] = rawUrl\n return NewSchoolsItemClassesEducationClassItemRequestBuilderInternal(urlParams, requestAdapter)\n}", "title": "" }, { "docid": "e86a2396c53c6234fdf96048de4bccf7", "score": "0.48392352", "text": "func (m *EdiscoveryCasesItemTagsTagItemRequestBuilder) Parent()(*EdiscoveryCasesItemTagsItemParentRequestBuilder) {\n return NewEdiscoveryCasesItemTagsItemParentRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter)\n}", "title": "" }, { "docid": "fc162eee0515cd9469b7fede92b80a52", "score": "0.48330703", "text": "func NewCompaniesItemPurchaseInvoiceLinesItemItemRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*CompaniesItemPurchaseInvoiceLinesItemItemRequestBuilder) {\n m := &CompaniesItemPurchaseInvoiceLinesItemItemRequestBuilder{\n BaseRequestBuilder: *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewBaseRequestBuilder(requestAdapter, \"{+baseurl}/financials/companies/{company%2Did}/purchaseInvoiceLines/{purchaseInvoiceLine%2Did}/item{?%24select,%24expand}\", pathParameters),\n }\n return m\n}", "title": "" }, { "docid": "9e9aca9ce167ed74c0bf9635d76fa76a", "score": "0.48330528", "text": "func New(timeout time.Duration, notifyCb CustodyNotify) *Custodian {\n\tc := &Custodian{\n\t\ttimeout: timeout,\n\t\tnotifyCb: notifyCb,\n\t\trequests: make(map[string]*custody),\n\t}\n\tc.timer = time.NewTimer(time.Hour)\n\tc.timer.Stop()\n\tc.stopCh = make(chan struct{})\n\tgo c.notifyRoutine()\n\treturn c\n}", "title": "" }, { "docid": "e170b65dd727900a4eca1ec1d9be124a", "score": "0.48253867", "text": "func (m *EdiscoveryCasesItemCustodiansCustodianItemRequestBuilder) UnifiedGroupSources()(*EdiscoveryCasesItemCustodiansItemUnifiedGroupSourcesRequestBuilder) {\n return NewEdiscoveryCasesItemCustodiansItemUnifiedGroupSourcesRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter)\n}", "title": "" }, { "docid": "45d79d32260df5050cf23f545a12b625", "score": "0.4818153", "text": "func (m *EdiscoveryCasesItemCustodiansCustodianItemRequestBuilder) Patch(ctx context.Context, body ic154d683aa4025ee28853b9c1a3c35cd1f093a1c4542feba4c07682e2752db13.Custodianable, requestConfiguration *EdiscoveryCasesItemCustodiansCustodianItemRequestBuilderPatchRequestConfiguration)(ic154d683aa4025ee28853b9c1a3c35cd1f093a1c4542feba4c07682e2752db13.Custodianable, error) {\n requestInfo, err := m.ToPatchRequestInformation(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, ic154d683aa4025ee28853b9c1a3c35cd1f093a1c4542feba4c07682e2752db13.CreateCustodianFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(ic154d683aa4025ee28853b9c1a3c35cd1f093a1c4542feba4c07682e2752db13.Custodianable), nil\n}", "title": "" }, { "docid": "0794e631d6e5fb33086c4be11a70ffa3", "score": "0.48089", "text": "func NewManagedTenantsManagedDeviceCompliancesManagedDeviceComplianceItemRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ManagedTenantsManagedDeviceCompliancesManagedDeviceComplianceItemRequestBuilder) {\n urlParams := make(map[string]string)\n urlParams[\"request-raw-url\"] = rawUrl\n return NewManagedTenantsManagedDeviceCompliancesManagedDeviceComplianceItemRequestBuilderInternal(urlParams, requestAdapter)\n}", "title": "" }, { "docid": "28630060309ed609d8e9eaed47b2fe57", "score": "0.48079628", "text": "func NewMessageItemRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*MessageItemRequestBuilder) {\n m := &MessageItemRequestBuilder{\n }\n m.urlTemplate = \"{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder%2Did}/messages/{message%2Did}{?%24select,%24expand}\";\n urlTplParams := make(map[string]string)\n for idx, item := range pathParameters {\n urlTplParams[idx] = item\n }\n m.pathParameters = urlTplParams;\n m.requestAdapter = requestAdapter;\n return m\n}", "title": "" }, { "docid": "f18756de81f3dc8ca896ad36b4c988c9", "score": "0.48041683", "text": "func NewSetsItemParentGroupSetsItemTermsItemChildrenTermItemRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*SetsItemParentGroupSetsItemTermsItemChildrenTermItemRequestBuilder) {\n urlParams := make(map[string]string)\n urlParams[\"request-raw-url\"] = rawUrl\n return NewSetsItemParentGroupSetsItemTermsItemChildrenTermItemRequestBuilderInternal(urlParams, requestAdapter)\n}", "title": "" }, { "docid": "3940022f78b1ca3d915de3a2d35f9f5e", "score": "0.48018104", "text": "func (m *CasesEdiscoveryCasesItemSearchesEdiscoverySearchItemRequestBuilder) CustodianSourcesById(id string)(*CasesEdiscoveryCasesItemSearchesItemCustodianSourcesDataSourceItemRequestBuilder) {\n urlTplParams := make(map[string]string)\n for idx, item := range m.pathParameters {\n urlTplParams[idx] = item\n }\n if id != \"\" {\n urlTplParams[\"dataSource%2Did\"] = id\n }\n return NewCasesEdiscoveryCasesItemSearchesItemCustodianSourcesDataSourceItemRequestBuilderInternal(urlTplParams, m.requestAdapter)\n}", "title": "" }, { "docid": "58ce7a2d8fcc1a9676c4a42c08295cf4", "score": "0.47981283", "text": "func NewItemAgentsOnPremisesAgentItemRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemAgentsOnPremisesAgentItemRequestBuilder) {\n urlParams := make(map[string]string)\n urlParams[\"request-raw-url\"] = rawUrl\n return NewItemAgentsOnPremisesAgentItemRequestBuilderInternal(urlParams, requestAdapter)\n}", "title": "" }, { "docid": "0179391e7de493bd0cd6ef060d53dc83", "score": "0.47970426", "text": "func NewManagedTenantsManagedDeviceComplianceTrendsManagedDeviceComplianceTrendItemRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ManagedTenantsManagedDeviceComplianceTrendsManagedDeviceComplianceTrendItemRequestBuilder) {\n urlParams := make(map[string]string)\n urlParams[\"request-raw-url\"] = rawUrl\n return NewManagedTenantsManagedDeviceComplianceTrendsManagedDeviceComplianceTrendItemRequestBuilderInternal(urlParams, requestAdapter)\n}", "title": "" }, { "docid": "7bc7ff0eadf10db9bd78a3a85242eb0c", "score": "0.47964802", "text": "func NewCompaniesItemPurchaseInvoicesItemPostRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*CompaniesItemPurchaseInvoicesItemPostRequestBuilder) {\n m := &CompaniesItemPurchaseInvoicesItemPostRequestBuilder{\n BaseRequestBuilder: *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewBaseRequestBuilder(requestAdapter, \"{+baseurl}/financials/companies/{company%2Did}/purchaseInvoices/{purchaseInvoice%2Did}/post\", pathParameters),\n }\n return m\n}", "title": "" }, { "docid": "6af4df5fe102adeb16b51b2e68502d93", "score": "0.47905043", "text": "func NewEventItemRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*EventItemRequestBuilder) {\n m := &EventItemRequestBuilder{\n }\n m.urlTemplate = \"{+baseurl}/users/{user%2Did}/calendarView/{event%2Did}{?startDateTime*,endDateTime*,%24select}\";\n urlTplParams := make(map[string]string)\n for idx, item := range pathParameters {\n urlTplParams[idx] = item\n }\n m.pathParameters = urlTplParams;\n m.requestAdapter = requestAdapter;\n return m\n}", "title": "" }, { "docid": "4a36554b0a2942f7d0a4dba37aa09aac", "score": "0.47886753", "text": "func NewItemPeoplePersonItemRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemPeoplePersonItemRequestBuilder) {\n m := &ItemPeoplePersonItemRequestBuilder{\n BaseRequestBuilder: *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewBaseRequestBuilder(requestAdapter, \"{+baseurl}/users/{user%2Did}/people/{person%2Did}{?%24select}\", pathParameters),\n }\n return m\n}", "title": "" }, { "docid": "8046ff932c1d3b433b124ceeb3714230", "score": "0.47859013", "text": "func NewItemProfileCertificationsPersonCertificationItemRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemProfileCertificationsPersonCertificationItemRequestBuilder) {\n m := &ItemProfileCertificationsPersonCertificationItemRequestBuilder{\n BaseRequestBuilder: *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewBaseRequestBuilder(requestAdapter, \"{+baseurl}/users/{user%2Did}/profile/certifications/{personCertification%2Did}{?%24select,%24expand}\", pathParameters),\n }\n return m\n}", "title": "" }, { "docid": "7e8b688e54718c8ac98734ed025fc257", "score": "0.47828606", "text": "func NewOnenoteSectionItemRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*OnenoteSectionItemRequestBuilder) {\n m := &OnenoteSectionItemRequestBuilder{\n }\n m.urlTemplate = \"{+baseurl}/me/onenote/notebooks/{notebook%2Did}/sections/{onenoteSection%2Did}{?%24select,%24expand}\";\n urlTplParams := make(map[string]string)\n for idx, item := range pathParameters {\n urlTplParams[idx] = item\n }\n m.pathParameters = urlTplParams;\n m.requestAdapter = requestAdapter;\n return m\n}", "title": "" }, { "docid": "9aa2091362c41a72bc700f12dc801fb7", "score": "0.47796947", "text": "func NewEntitlementManagementResourceRequestsItemCatalogRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*EntitlementManagementResourceRequestsItemCatalogRequestBuilder) {\n urlParams := make(map[string]string)\n urlParams[\"request-raw-url\"] = rawUrl\n return NewEntitlementManagementResourceRequestsItemCatalogRequestBuilderInternal(urlParams, requestAdapter)\n}", "title": "" }, { "docid": "9e0f19876da900f6d51f8baed21ad1d4", "score": "0.47738627", "text": "func (m *CompaniesItemPurchaseInvoiceLinesItemItemRequestBuilder) ItemCategory()(*CompaniesItemPurchaseInvoiceLinesItemItemItemCategoryRequestBuilder) {\n return NewCompaniesItemPurchaseInvoiceLinesItemItemItemCategoryRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter)\n}", "title": "" }, { "docid": "4b6acc65b320ecc8764fc89e6e7bccc9", "score": "0.47732642", "text": "func newCNIRequest(args *skel.CmdArgs) *cniserver.CNIRequest {\n\tenvMap := make(map[string]string)\n\tfor _, item := range os.Environ() {\n\t\tidx := strings.Index(item, \"=\")\n\t\tif idx > 0 {\n\t\t\tenvMap[strings.TrimSpace(item[:idx])] = item[idx+1:]\n\t\t}\n\t}\n\n\treturn &cniserver.CNIRequest{\n\t\tEnv: envMap,\n\t\tConfig: args.StdinData,\n\t}\n}", "title": "" }, { "docid": "b501e985569578ab82a2e0220cbfd46c", "score": "0.4771352", "text": "func NewItemCalendarCalendarViewEventItemRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemCalendarCalendarViewEventItemRequestBuilder) {\n m := &ItemCalendarCalendarViewEventItemRequestBuilder{\n BaseRequestBuilder: *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewBaseRequestBuilder(requestAdapter, \"{+baseurl}/users/{user%2Did}/calendar/calendarView/{event%2Did}{?startDateTime*,endDateTime*,%24select}\", pathParameters),\n }\n return m\n}", "title": "" }, { "docid": "87f85f7b6abfc08bc6d74b354b46be55", "score": "0.47696808", "text": "func NewEntitlementManagementResourceRequestsItemCatalogRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*EntitlementManagementResourceRequestsItemCatalogRequestBuilder) {\n m := &EntitlementManagementResourceRequestsItemCatalogRequestBuilder{\n BaseRequestBuilder: *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewBaseRequestBuilder(requestAdapter, \"{+baseurl}/identityGovernance/entitlementManagement/resourceRequests/{accessPackageResourceRequest%2Did}/catalog{?%24select,%24expand}\", pathParameters),\n }\n return m\n}", "title": "" }, { "docid": "b9a55521bbd4cd8ac2751c332ed74841", "score": "0.47585982", "text": "func NewItemItemsItemWorkbookWorksheetsItemChartsItemDataLabelsRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemItemsItemWorkbookWorksheetsItemChartsItemDataLabelsRequestBuilder) {\n urlParams := make(map[string]string)\n urlParams[\"request-raw-url\"] = rawUrl\n return NewItemItemsItemWorkbookWorksheetsItemChartsItemDataLabelsRequestBuilderInternal(urlParams, requestAdapter)\n}", "title": "" }, { "docid": "cefef4a48a005d60e6476460e68b32be", "score": "0.47578028", "text": "func NewMessageItemRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*MessageItemRequestBuilder) {\n urlParams := make(map[string]string)\n urlParams[\"request-raw-url\"] = rawUrl\n return NewMessageItemRequestBuilderInternal(urlParams, requestAdapter)\n}", "title": "" }, { "docid": "ccc35c73623e3b00c8215225cc3ca26c", "score": "0.47555605", "text": "func NewItemProfileCertificationsPersonCertificationItemRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemProfileCertificationsPersonCertificationItemRequestBuilder) {\n urlParams := make(map[string]string)\n urlParams[\"request-raw-url\"] = rawUrl\n return NewItemProfileCertificationsPersonCertificationItemRequestBuilderInternal(urlParams, requestAdapter)\n}", "title": "" }, { "docid": "2afd5ac81118aa469fbd7eedf1155ef0", "score": "0.47422123", "text": "func NewConfigurationPolicyTemplatesItemSettingTemplatesDeviceManagementConfigurationSettingTemplateItemRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ConfigurationPolicyTemplatesItemSettingTemplatesDeviceManagementConfigurationSettingTemplateItemRequestBuilder) {\n urlParams := make(map[string]string)\n urlParams[\"request-raw-url\"] = rawUrl\n return NewConfigurationPolicyTemplatesItemSettingTemplatesDeviceManagementConfigurationSettingTemplateItemRequestBuilderInternal(urlParams, requestAdapter)\n}", "title": "" }, { "docid": "dbd3c48949facecc02a43f26b944f016", "score": "0.4738982", "text": "func NewItemTermStoreSetsItemParentGroupSetsItemChildrenTermItemRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemTermStoreSetsItemParentGroupSetsItemChildrenTermItemRequestBuilder) {\n urlParams := make(map[string]string)\n urlParams[\"request-raw-url\"] = rawUrl\n return NewItemTermStoreSetsItemParentGroupSetsItemChildrenTermItemRequestBuilderInternal(urlParams, requestAdapter)\n}", "title": "" }, { "docid": "dd0abc4a47b1490fb968595e868d7075", "score": "0.4738343", "text": "func (m *CasesEdiscoveryCasesItemCustodiansItemUnifiedGroupSourcesRequestBuilder) ToGetRequestInformation(ctx context.Context, requestConfiguration *CasesEdiscoveryCasesItemCustodiansItemUnifiedGroupSourcesRequestBuilderGetRequestConfiguration)(*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) {\n requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation()\n requestInfo.UrlTemplate = m.BaseRequestBuilder.UrlTemplate\n requestInfo.PathParameters = m.BaseRequestBuilder.PathParameters\n requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.GET\n requestInfo.Headers.Add(\"Accept\", \"application/json\")\n if requestConfiguration != nil {\n if requestConfiguration.QueryParameters != nil {\n requestInfo.AddQueryParameters(*(requestConfiguration.QueryParameters))\n }\n requestInfo.Headers.AddAll(requestConfiguration.Headers)\n requestInfo.AddRequestOptions(requestConfiguration.Options)\n }\n return requestInfo, nil\n}", "title": "" }, { "docid": "2483d5e779f01f59f2dd607a69ed8c77", "score": "0.4736902", "text": "func NewItemCalendarCalendarViewEventItemRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemCalendarCalendarViewEventItemRequestBuilder) {\n urlParams := make(map[string]string)\n urlParams[\"request-raw-url\"] = rawUrl\n return NewItemCalendarCalendarViewEventItemRequestBuilderInternal(urlParams, requestAdapter)\n}", "title": "" }, { "docid": "a7233fa7da2246b99f3829f50b81051d", "score": "0.47348943", "text": "func NewItemTermStoreSetsItemParentGroupSetsItemChildrenTermItemRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemTermStoreSetsItemParentGroupSetsItemChildrenTermItemRequestBuilder) {\n m := &ItemTermStoreSetsItemParentGroupSetsItemChildrenTermItemRequestBuilder{\n BaseRequestBuilder: *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewBaseRequestBuilder(requestAdapter, \"{+baseurl}/sites/{site%2Did}/termStore/sets/{set%2Did}/parentGroup/sets/{set%2Did1}/children/{term%2Did}{?%24select,%24expand}\", pathParameters),\n }\n return m\n}", "title": "" }, { "docid": "70843c7305e682208a902e9f078ec432", "score": "0.4734124", "text": "func NewItemMobileAppTroubleshootingEventsItemAppLogCollectionRequestsAppLogCollectionRequestItemRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemMobileAppTroubleshootingEventsItemAppLogCollectionRequestsAppLogCollectionRequestItemRequestBuilder) {\n urlParams := make(map[string]string)\n urlParams[\"request-raw-url\"] = rawUrl\n return NewItemMobileAppTroubleshootingEventsItemAppLogCollectionRequestsAppLogCollectionRequestItemRequestBuilderInternal(urlParams, requestAdapter)\n}", "title": "" }, { "docid": "e6c186b10715de0f9a36672a6d5c41ce", "score": "0.47273025", "text": "func NewItemRegisteredOwnersDirectoryObjectItemRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemRegisteredOwnersDirectoryObjectItemRequestBuilder) {\n urlParams := make(map[string]string)\n urlParams[\"request-raw-url\"] = rawUrl\n return NewItemRegisteredOwnersDirectoryObjectItemRequestBuilderInternal(urlParams, requestAdapter)\n}", "title": "" }, { "docid": "79b7744278adfb065c7c1927690fa735", "score": "0.47204775", "text": "func NewManagedTenantsManagedDeviceCompliancesManagedDeviceComplianceItemRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ManagedTenantsManagedDeviceCompliancesManagedDeviceComplianceItemRequestBuilder) {\n m := &ManagedTenantsManagedDeviceCompliancesManagedDeviceComplianceItemRequestBuilder{\n BaseRequestBuilder: *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewBaseRequestBuilder(requestAdapter, \"{+baseurl}/tenantRelationships/managedTenants/managedDeviceCompliances/{managedDeviceCompliance%2Did}{?%24select,%24expand}\", pathParameters),\n }\n return m\n}", "title": "" }, { "docid": "9ef144c8745f328fb33fc45dc866d989", "score": "0.47188514", "text": "func NewItemItemsItemWorkbookWorksheetsItemChartsItemDataLabelsRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemItemsItemWorkbookWorksheetsItemChartsItemDataLabelsRequestBuilder) {\n m := &ItemItemsItemWorkbookWorksheetsItemChartsItemDataLabelsRequestBuilder{\n BaseRequestBuilder: *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewBaseRequestBuilder(requestAdapter, \"{+baseurl}/drives/{drive%2Did}/items/{driveItem%2Did}/workbook/worksheets/{workbookWorksheet%2Did}/charts/{workbookChart%2Did}/dataLabels{?%24select,%24expand}\", pathParameters),\n }\n return m\n}", "title": "" }, { "docid": "767dcde21573a9d670bde5d249b694e0", "score": "0.4718076", "text": "func NewItemCalendarEventsEventItemRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemCalendarEventsEventItemRequestBuilder) {\n m := &ItemCalendarEventsEventItemRequestBuilder{\n BaseRequestBuilder: *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewBaseRequestBuilder(requestAdapter, \"{+baseurl}/groups/{group%2Did}/calendar/events/{event%2Did}{?%24select,%24expand}\", pathParameters),\n }\n return m\n}", "title": "" }, { "docid": "092a87502455cdb93e5effa3c3d38168", "score": "0.47166017", "text": "func NewItemItemsItemWorkbookTablesItemColumnsItemFilterApplyTopItemsFilterRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemItemsItemWorkbookTablesItemColumnsItemFilterApplyTopItemsFilterRequestBuilder) {\n urlParams := make(map[string]string)\n urlParams[\"request-raw-url\"] = rawUrl\n return NewItemItemsItemWorkbookTablesItemColumnsItemFilterApplyTopItemsFilterRequestBuilderInternal(urlParams, requestAdapter)\n}", "title": "" }, { "docid": "75b7c77d40aad929680b6f01292561a9", "score": "0.47097424", "text": "func NewCasesEdiscoveryCasesItemReviewSetsItemSecurityAddToReviewSetRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*CasesEdiscoveryCasesItemReviewSetsItemSecurityAddToReviewSetRequestBuilder) {\n m := &CasesEdiscoveryCasesItemReviewSetsItemSecurityAddToReviewSetRequestBuilder{\n }\n m.urlTemplate = \"{+baseurl}/security/cases/ediscoveryCases/{ediscoveryCase%2Did}/reviewSets/{ediscoveryReviewSet%2Did}/security.addToReviewSet\";\n urlTplParams := make(map[string]string)\n for idx, item := range pathParameters {\n urlTplParams[idx] = item\n }\n m.pathParameters = urlTplParams\n m.requestAdapter = requestAdapter\n return m\n}", "title": "" }, { "docid": "66bae586e64e5a5211bac618dc4d6db9", "score": "0.47039166", "text": "func NewCallsItemKeepAliveRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*CallsItemKeepAliveRequestBuilder) {\n urlParams := make(map[string]string)\n urlParams[\"request-raw-url\"] = rawUrl\n return NewCallsItemKeepAliveRequestBuilderInternal(urlParams, requestAdapter)\n}", "title": "" }, { "docid": "71f73eebd2f819e979646cee1edc3d59", "score": "0.46789488", "text": "func NewItemDevicesDeviceItemRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemDevicesDeviceItemRequestBuilder) {\n m := &ItemDevicesDeviceItemRequestBuilder{\n BaseRequestBuilder: *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewBaseRequestBuilder(requestAdapter, \"{+baseurl}/users/{user%2Did}/devices/{device%2Did}{?%24select,%24expand}\", pathParameters),\n }\n return m\n}", "title": "" }, { "docid": "d5ac3cfdd43aaa499206c2ea78489215", "score": "0.46761325", "text": "func NewCompaniesItemVendorsItemPaymentTermRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*CompaniesItemVendorsItemPaymentTermRequestBuilder) {\n urlParams := make(map[string]string)\n urlParams[\"request-raw-url\"] = rawUrl\n return NewCompaniesItemVendorsItemPaymentTermRequestBuilderInternal(urlParams, requestAdapter)\n}", "title": "" }, { "docid": "16069f5e0da6ba908df5fa06bf0e8786", "score": "0.46749544", "text": "func NewItemCloudPCsItemRestoreRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemCloudPCsItemRestoreRequestBuilder) {\n urlParams := make(map[string]string)\n urlParams[\"request-raw-url\"] = rawUrl\n return NewItemCloudPCsItemRestoreRequestBuilderInternal(urlParams, requestAdapter)\n}", "title": "" }, { "docid": "80b593202732554f6bc56c53616c42b0", "score": "0.46655923", "text": "func NewGroupPolicyCategoriesItemChildrenRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*GroupPolicyCategoriesItemChildrenRequestBuilder) {\n urlParams := make(map[string]string)\n urlParams[\"request-raw-url\"] = rawUrl\n return NewGroupPolicyCategoriesItemChildrenRequestBuilderInternal(urlParams, requestAdapter)\n}", "title": "" }, { "docid": "b85b58c73b8887a2573cf454ffb2f7c4", "score": "0.46569014", "text": "func NewRiskyUsersRiskyUserItemRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*RiskyUsersRiskyUserItemRequestBuilder) {\n urlParams := make(map[string]string)\n urlParams[\"request-raw-url\"] = rawUrl\n return NewRiskyUsersRiskyUserItemRequestBuilderInternal(urlParams, requestAdapter)\n}", "title": "" } ]
0f3a8384626d67a3871d9054e724c473
Render the default next state in ASL JSON format. Experimental.
[ { "docid": "0e8943da01c02df562aaa1016bfda987", "score": "0.5790752", "text": "func (c *jsiiProxy_CallApiGatewayHttpApiEndpoint) RenderNextEnd() interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"renderNextEnd\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" } ]
[ { "docid": "b8259b1a9b1490711cf8896514ddcc02", "score": "0.5717316", "text": "func (s *jsiiProxy_SageMakerCreateEndpointConfig) RenderNextEnd() interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\ts,\n\t\t\"renderNextEnd\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "10b4965e8cd5d1e44e5da26a3651858a", "score": "0.5652296", "text": "func (c *jsiiProxy_CallApiGatewayRestApiEndpoint) RenderNextEnd() interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"renderNextEnd\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "7cfa5c53003ba2bb048e87a43233b8a6", "score": "0.5487833", "text": "func (s *jsiiProxy_SageMakerCreateTrainingJob) RenderNextEnd() interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\ts,\n\t\t\"renderNextEnd\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "dd893a0f00dcd60036722856bb2736a9", "score": "0.54806185", "text": "func (s *jsiiProxy_SageMakerUpdateEndpoint) RenderNextEnd() interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\ts,\n\t\t\"renderNextEnd\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "7e82f2bba1ca28786cf784ec21ec043e", "score": "0.5437091", "text": "func (d *jsiiProxy_DynamoUpdateItem) RenderNextEnd() interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\td,\n\t\t\"renderNextEnd\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "86da9ec059902edcf8b76ce61e60b956", "score": "0.5410919", "text": "func (s *jsiiProxy_SageMakerCreateEndpoint) RenderNextEnd() interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\ts,\n\t\t\"renderNextEnd\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "1db0f7cc68715364c8a9d08f61e6e94d", "score": "0.53719205", "text": "func (r *Resource) Next() (*Resource, error) { return r.navigate(\"next\") }", "title": "" }, { "docid": "9c32bf7e4a5be3b6dcfd7f40f513ae68", "score": "0.5331606", "text": "func (s *jsiiProxy_SageMakerCreateModel) RenderNextEnd() interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\ts,\n\t\t\"renderNextEnd\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "8514db26578d2a2844b53c89a1e8a630", "score": "0.5319996", "text": "func (e *jsiiProxy_EmrAddStep) RenderNextEnd() interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\te,\n\t\t\"renderNextEnd\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "fe762a6181f81f8ef3892be4bcf99429", "score": "0.53143966", "text": "func next(w http.ResponseWriter, r *http.Request) {\n\tw.WriteHeader(http.StatusOK)\n\tio.WriteString(w, \"from next\")\n}", "title": "" }, { "docid": "ab5438d60b98551f01418d43b1773f84", "score": "0.52724296", "text": "func (d *jsiiProxy_DynamoPutItem) RenderNextEnd() interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\td,\n\t\t\"renderNextEnd\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "f2997b6ddc162ade1ab5e70bacd63474", "score": "0.5267404", "text": "func (d *jsiiProxy_DynamoGetItem) RenderNextEnd() interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\td,\n\t\t\"renderNextEnd\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "de4d9f433d3f4e531161801a49c489b0", "score": "0.52640045", "text": "func (l *jsiiProxy_LambdaInvoke) RenderNextEnd() interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tl,\n\t\t\"renderNextEnd\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "bbf072677d3eb126495e2c0e520e2669", "score": "0.5217476", "text": "func (sm *StateMachine) Render() {\n\tif len(sm.gameState) != 0 {\n\t\tn := len(sm.gameState) - 1\n\t\tsm.gameState[n].Render()\n\t}\n}", "title": "" }, { "docid": "e2c9bf9862ce1e649471e04751370074", "score": "0.5192928", "text": "func (a *jsiiProxy_AthenaGetQueryResults) RenderNextEnd() interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\ta,\n\t\t\"renderNextEnd\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "b4951157efd323a67f1f712ad706e24f", "score": "0.5185269", "text": "func (e *jsiiProxy_EksCall) RenderNextEnd() interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\te,\n\t\t\"renderNextEnd\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "ddabbb54a6835a33ba55713f6b9e981b", "score": "0.51828384", "text": "func (action *PaymentsIndexAction) JSON() {\n\taction.LoadPage()\n\tif action.Err != nil {\n\t\treturn\n\t}\n\thal.Render(action.W, action.Page)\n}", "title": "" }, { "docid": "4af7dcc166f004e1fec1781ab3d948ec", "score": "0.5118974", "text": "func (s *jsiiProxy_SageMakerCreateTransformJob) RenderNextEnd() interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\ts,\n\t\t\"renderNextEnd\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "381019fd12ec2b4d31674ade1cc116a9", "score": "0.5089189", "text": "func (e *jsiiProxy_EmrModifyInstanceFleetByName) RenderNextEnd() interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\te,\n\t\t\"renderNextEnd\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "094daf954a9daf955b6d4db69e4ce36f", "score": "0.5050715", "text": "func Next() Prng {\n\treturn global.outlet.Next()\n}", "title": "" }, { "docid": "83015de16f48d551f2ac3b507ae791c7", "score": "0.5044563", "text": "func (s *jsiiProxy_StepFunctionsInvokeActivity) RenderNextEnd() interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\ts,\n\t\t\"renderNextEnd\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "1d1ce983d7d1f77ba5856dae207d3431", "score": "0.49980575", "text": "func (c *jsiiProxy_CodeBuildStartBuild) RenderNextEnd() interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"renderNextEnd\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "573827690058f93f07651f60d560782e", "score": "0.49708077", "text": "func (o ManagedIntegrationRuntimeResponseOutput) State() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ManagedIntegrationRuntimeResponse) string { return v.State }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "4d46aa36936e2cf3eefe32fa69937e47", "score": "0.49382946", "text": "func (ev *SentGenEnv) NextState() {\n\tif ev.SentIdx.Cur < 0 {\n\t\tev.NextSent()\n\t}\n\tev.SentIdx.Set(ev.SentIdx.Cur + 1)\n\tif ev.SentIdx.Cur >= len(ev.CurSent) {\n\t\tev.NextSent()\n\t}\n\tev.RenderState()\n}", "title": "" }, { "docid": "399960ec1f4876b53c76b9615753339c", "score": "0.49366754", "text": "func (e *jsiiProxy_EmrCreateCluster) RenderNextEnd() interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\te,\n\t\t\"renderNextEnd\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "79d051357573abb48a0164c509f0c4ef", "score": "0.49138722", "text": "func (a *jsiiProxy_AthenaGetQueryExecution) RenderNextEnd() interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\ta,\n\t\t\"renderNextEnd\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "3a72385a26467c90cc563a5da3666303", "score": "0.4907641", "text": "func (s *jsiiProxy_StepFunctionsStartExecution) RenderNextEnd() interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\ts,\n\t\t\"renderNextEnd\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "6c9e448412e08a9b81165606f273c057", "score": "0.49068636", "text": "func (a *jsiiProxy_AthenaStartQueryExecution) RenderNextEnd() interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\ta,\n\t\t\"renderNextEnd\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "16ad0453b58f8559b3c808eae8dc0c91", "score": "0.48982683", "text": "func (e *jsiiProxy_EventBridgePutEvents) RenderNextEnd() interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\te,\n\t\t\"renderNextEnd\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "20bfd45a66f9f9c5dd13a7f4abf416a9", "score": "0.487402", "text": "func (e *jsiiProxy_EvaluateExpression) RenderNextEnd() interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\te,\n\t\t\"renderNextEnd\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "eae43312c5e12fb7e9c7de856d0e51ff", "score": "0.48733526", "text": "func (g *jsiiProxy_GlueStartJobRun) RenderNextEnd() interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tg,\n\t\t\"renderNextEnd\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "32951f4128bfde7506e5d2f5f63151fa", "score": "0.4860078", "text": "func (action *OperationIndexAction) JSON() error {\n\taction.Do(\n\t\taction.EnsureHistoryFreshness,\n\t\taction.loadParams,\n\t\taction.ValidateCursorWithinHistory,\n\t\taction.loadRecords,\n\t\taction.loadLedgers,\n\t\taction.loadPage,\n\t\tfunc() { hal.Render(action.W, action.Page) },\n\t)\n\treturn action.Err\n}", "title": "" }, { "docid": "e9672ea0b4e08eeae6dc1744088643cc", "score": "0.48574808", "text": "func (s *State) Next() string {\n\tif s.IsMoved {\n\t\treturn s.Chain\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "1224d9d971a6b446a3cd9fc357dc5721", "score": "0.48566648", "text": "func (b *bitwise) GetNext() string {\n\tif b == nil || !b.hasMore {\n\t\tpanic(\"Generator is done\")\n\t}\n\t// Get the string representation of the current state\n\tres := generateFromState(b.n, b.state, b.buffer)\n\n\t// Generate new state\n\tt := b.state ^ mu0\n\tu := t ^ (t - 1)\n\tv := b.state | u\n\tw := v + 1\n\ts := popCount(u & mu0)\n\twp := (v & (^w)) >> s\n\tnewstate := w + wp\n\n\tb.hasMore = (newstate & b.mask) == 0\n\tb.state = newstate\n\treturn res\n}", "title": "" }, { "docid": "a04c0283b5121eb68c7891e14cde3ab8", "score": "0.48500887", "text": "func (o NodeResponseOutput) State() pulumi.StringOutput {\n\treturn o.ApplyT(func(v NodeResponse) string { return v.State }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "7611876cd015ad3f7154ff4121adaf88", "score": "0.48429886", "text": "func (d *jsiiProxy_DynamoDeleteItem) RenderNextEnd() interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\td,\n\t\t\"renderNextEnd\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "a073b54d7e529456b45edd8bdf2ad18f", "score": "0.48319915", "text": "func (r *hookedRenderer) renderAutoLinkDefault(w util.BufWriter, source []byte, node ast.Node, entering bool) (ast.WalkStatus, error) {\n\tn := node.(*ast.AutoLink)\n\tif !entering {\n\t\treturn ast.WalkContinue, nil\n\t}\n\t_, _ = w.WriteString(`<a href=\"`)\n\turl := n.URL(source)\n\tlabel := n.Label(source)\n\tif n.AutoLinkType == ast.AutoLinkEmail && !bytes.HasPrefix(bytes.ToLower(url), []byte(\"mailto:\")) {\n\t\t_, _ = w.WriteString(\"mailto:\")\n\t}\n\t_, _ = w.Write(util.EscapeHTML(util.URLEscape(url, false)))\n\tif n.Attributes() != nil {\n\t\t_ = w.WriteByte('\"')\n\t\thtml.RenderAttributes(w, n, html.LinkAttributeFilter)\n\t\t_ = w.WriteByte('>')\n\t} else {\n\t\t_, _ = w.WriteString(`\">`)\n\t}\n\t_, _ = w.Write(util.EscapeHTML(label))\n\t_, _ = w.WriteString(`</a>`)\n\treturn ast.WalkContinue, nil\n}", "title": "" }, { "docid": "a9d545214a7c41b95ede298cdb62479e", "score": "0.4824089", "text": "func (b *jsiiProxy_BatchSubmitJob) RenderNextEnd() interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tb,\n\t\t\"renderNextEnd\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "6b96f5e52b65f37d0ca4d7c25c22b475", "score": "0.48215702", "text": "func (e *jsiiProxy_EmrCancelStep) RenderNextEnd() interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\te,\n\t\t\"renderNextEnd\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "7a0a4ff0dbaf78974aa27353f7bcadfc", "score": "0.48213696", "text": "func (s *jsiiProxy_SnsPublish) RenderNextEnd() interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\ts,\n\t\t\"renderNextEnd\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "c5aaa851489bfbccd7abd93fe42aab58", "score": "0.47826728", "text": "func (c *jsiiProxy_CallApiGatewayRestApiEndpoint) Next(next awsstepfunctions.IChainable) awsstepfunctions.Chain {\n\tvar returns awsstepfunctions.Chain\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"next\",\n\t\t[]interface{}{next},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "f48393106a8afbe821affa9dea8aa785", "score": "0.47769988", "text": "func (o *OAuthFlows) Render() ([]byte, error) {\n\treturn yaml.Marshal(o)\n}", "title": "" }, { "docid": "406c7c063bec1dbaadb3cf35db2c1d16", "score": "0.47754404", "text": "func (tran Transition) RenderSwapped() string {\n\n\tvar trans_arr = []string{\"#[fg=\", colors[tran.next.bg], \",bg=\", colors[tran.prev.bg], \",nobold]\", tran.divider.Render()}\n\n\tlogger.Info(\"Next bg: %s (%s)\", tran.next.bg, colors[tran.next.bg])\n\n\treturn strings.Join(trans_arr, \"\")\n}", "title": "" }, { "docid": "c411782be1eb5b2db1382b78a4089c9d", "score": "0.4764693", "text": "func (g *jsiiProxy_GlueDataBrewStartJobRun) RenderNextEnd() interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tg,\n\t\t\"renderNextEnd\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "69526606c47b7d6791651ae148c36054", "score": "0.47563767", "text": "func (e *jsiiProxy_EmrSetClusterTerminationProtection) RenderNextEnd() interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\te,\n\t\t\"renderNextEnd\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "837fe32b4c13677641b20367d979f1fd", "score": "0.47440103", "text": "func (c *jsiiProxy_CallApiGatewayHttpApiEndpoint) Next(next awsstepfunctions.IChainable) awsstepfunctions.Chain {\n\tvar returns awsstepfunctions.Chain\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"next\",\n\t\t[]interface{}{next},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "7743649f087ee7e9b48bc627b3815b62", "score": "0.47100207", "text": "func (e *jsiiProxy_EmrTerminateCluster) RenderNextEnd() interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\te,\n\t\t\"renderNextEnd\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "8004062aa02b6be25224da1b90e7845d", "score": "0.4699356", "text": "func (c *jsiiProxy_CallApiGatewayRestApiEndpoint) MakeNext(next awsstepfunctions.State) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"makeNext\",\n\t\t[]interface{}{next},\n\t)\n}", "title": "" }, { "docid": "e643534190152e5a401206fd18de7d0d", "score": "0.4689903", "text": "func (c *jsiiProxy_CallApiGatewayHttpApiEndpoint) MakeNext(next awsstepfunctions.State) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"makeNext\",\n\t\t[]interface{}{next},\n\t)\n}", "title": "" }, { "docid": "9bc1824a70261bb1dcc8ce2362f51b74", "score": "0.468403", "text": "func (action *OrderBookShowAction) JSON() {\n\taction.Do(action.LoadQuery, action.LoadRecord, action.LoadResource)\n\n\taction.Do(func() {\n\t\thal.Render(action.W, action.Resource)\n\t})\n}", "title": "" }, { "docid": "7bb2faa24de3cb1a0e31370b13a51e22", "score": "0.46787018", "text": "func (o AssetOutput) State() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Asset) pulumi.StringOutput { return v.State }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "5193b8e4e581587f95cbe6ab7b84ce4b", "score": "0.46628806", "text": "func (s *jsiiProxy_SageMakerCreateEndpointConfig) Next(next awsstepfunctions.IChainable) awsstepfunctions.Chain {\n\tvar returns awsstepfunctions.Chain\n\n\t_jsii_.Invoke(\n\t\ts,\n\t\t\"next\",\n\t\t[]interface{}{next},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "e35c199b17df07196733997851edadc2", "score": "0.4634989", "text": "func (a *jsiiProxy_AthenaStopQueryExecution) RenderNextEnd() interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\ta,\n\t\t\"renderNextEnd\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "586e99c1b2191a76cfa148765b7ee8c1", "score": "0.4634689", "text": "func (r *hookedRenderer) renderLinkDefault(w util.BufWriter, source []byte, node ast.Node, entering bool) (ast.WalkStatus, error) {\n\tn := node.(*ast.Link)\n\tif entering {\n\t\t_, _ = w.WriteString(\"<a href=\\\"\")\n\t\tif r.Unsafe || !html.IsDangerousURL(n.Destination) {\n\t\t\t_, _ = w.Write(util.EscapeHTML(util.URLEscape(n.Destination, true)))\n\t\t}\n\t\t_ = w.WriteByte('\"')\n\t\tif n.Title != nil {\n\t\t\t_, _ = w.WriteString(` title=\"`)\n\t\t\tr.Writer.Write(w, n.Title)\n\t\t\t_ = w.WriteByte('\"')\n\t\t}\n\t\t_ = w.WriteByte('>')\n\t} else {\n\t\t_, _ = w.WriteString(\"</a>\")\n\t}\n\treturn ast.WalkContinue, nil\n}", "title": "" }, { "docid": "df8b3e9ba35413dd57eafc9c26375b99", "score": "0.463226", "text": "func (o EndpointOutput) State() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Endpoint) pulumi.StringOutput { return v.State }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "56bdc6de398d8ff5c99688fc21cb82d8", "score": "0.46242252", "text": "func (o TIDataConnectorDataTypesResponseIndicatorsOutput) State() pulumi.StringOutput {\n\treturn o.ApplyT(func(v TIDataConnectorDataTypesResponseIndicators) string { return v.State }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "5cde0f32713a8ae395354f81f04095b1", "score": "0.4622746", "text": "func Home(w http.ResponseWriter, r *http.Request) {\n\trender := render.New(render.Options{\n\t\tIndentJSON: true,\n\t})\n\n\trender.JSON(w, http.StatusOK, map[string]string{\"welcome\": \"This is rendered JSON!\"})\n}", "title": "" }, { "docid": "b2494593f324076dc2edd1d69add4441", "score": "0.46136093", "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": "7b6fd60500240adde6d047f7ad76fd3a", "score": "0.46120343", "text": "func (s *jsiiProxy_SageMakerCreateModel) Next(next awsstepfunctions.IChainable) awsstepfunctions.Chain {\n\tvar returns awsstepfunctions.Chain\n\n\t_jsii_.Invoke(\n\t\ts,\n\t\t\"next\",\n\t\t[]interface{}{next},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "47acf610fc34b9bb8b641ec352e120e6", "score": "0.46064284", "text": "func (o BqmlTrainingRunResponseOutput) State() pulumi.StringOutput {\n\treturn o.ApplyT(func(v BqmlTrainingRunResponse) string { return v.State }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "4d85f87c5e9090cf5462fc43bd193a9f", "score": "0.4597035", "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": "c3facfaf06771928c3a7e617a706b53b", "score": "0.45920658", "text": "func (o MetadataExportResponseOutput) State() pulumi.StringOutput {\n\treturn o.ApplyT(func(v MetadataExportResponse) string { return v.State }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "6b613fb4e4c5629dc67e3f479c534eb7", "score": "0.45790404", "text": "func (o ManagedIntegrationRuntimeStatusResponseOutput) State() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ManagedIntegrationRuntimeStatusResponse) string { return v.State }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "47aaf569247dba8d1c7598c482bb6a28", "score": "0.457419", "text": "func (o PipelineOutput) State() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Pipeline) pulumi.StringOutput { return v.State }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "41dd22108ed8e73bdebbed2f66bef70b", "score": "0.45695114", "text": "func (l *LCG) Next() int {\r\n\tl.State = (l.Multiplier*l.State + l.Increment) % l.Modulus\r\n\treturn l.State\r\n}", "title": "" }, { "docid": "96b545c69f25611b7cf34aac137c8e5a", "score": "0.45674193", "text": "func (o RedisOutput) State() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Redis) pulumi.StringOutput { return v.State }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "3f352ac0fd7329849727b63fddae1fb8", "score": "0.45582968", "text": "func (e *jsiiProxy_EmrModifyInstanceGroupByName) RenderNextEnd() interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\te,\n\t\t\"renderNextEnd\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "de1103a42294b3bfc189d2f7e445ac5c", "score": "0.45531803", "text": "func (k *InlineKeyboard) Next() tgbotapi.EditMessageReplyMarkupConfig {\n\tif k.CurrentPage <= len(k.Pages)-1 {\n\t\tk.CurrentPage++\n\t}\n\n\treturn k.Show()\n}", "title": "" }, { "docid": "ad5b3f67796929ae4618c3e892699d7a", "score": "0.45511225", "text": "func (s *jsiiProxy_SageMakerCreateEndpoint) Next(next awsstepfunctions.IChainable) awsstepfunctions.Chain {\n\tvar returns awsstepfunctions.Chain\n\n\t_jsii_.Invoke(\n\t\ts,\n\t\t\"next\",\n\t\t[]interface{}{next},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "06b2182ba3d7065f8abeacf90af9106d", "score": "0.45463744", "text": "func (o AlertsDataTypeOfDataConnectorResponseAlertsOutput) State() pulumi.StringOutput {\n\treturn o.ApplyT(func(v AlertsDataTypeOfDataConnectorResponseAlerts) string { return v.State }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "cdffd6326c73183feab26096900a595e", "score": "0.45369542", "text": "func (s *State) Next() uint64 {\n\tr := bits.RotateLeft64(s.s1*5, 7) * 9\n\n\tt := s.s1 << 17\n\n\ts.s2 ^= s.s0\n\ts.s3 ^= s.s1\n\ts.s1 ^= s.s2\n\ts.s0 ^= s.s3\n\n\ts.s2 ^= t\n\n\ts.s3 = bits.RotateLeft64(s.s3, 45)\n\n\treturn r\n}", "title": "" }, { "docid": "75664e25432d8522aa7a948a7b8752d8", "score": "0.45343375", "text": "func (o FlexTemplateJobOutput) State() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *FlexTemplateJob) pulumi.StringOutput { return v.State }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "76e95b5758d4bdb53a7ecb7918ccc90f", "score": "0.45306337", "text": "func (s SentinelOnboardingState) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"etag\", s.Etag)\n\tpopulate(objectMap, \"id\", s.ID)\n\tpopulate(objectMap, \"name\", s.Name)\n\tpopulate(objectMap, \"properties\", s.Properties)\n\tpopulate(objectMap, \"systemData\", s.SystemData)\n\tpopulate(objectMap, \"type\", s.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "d57b55ea0a78da10d1176685eaf77229", "score": "0.45248178", "text": "func (l *lexer) next() {\n\t// next\n}", "title": "" }, { "docid": "cc419defb17ee71ef7e98a8a6f90eb91", "score": "0.45190293", "text": "func lexNext(l *lexer) stateFn {\n\tr := l.next()\n\tswitch {\n\tcase r == eof:\n\t\treturn l.errorf(\"statement unterminated by '.'\")\n\tcase r == '.':\n\t\tif l.peek() == '(' {\n\t\t\tl.emit(itemAtom)\n\t\t} else {\n\t\t\tl.emit(itemDot)\n\t\t\treturn lexSpace\n\t\t}\n\tcase r == '|':\n\t\tl.emit(itemPipe)\n\tcase r == '!':\n\t\tl.emit(itemCut)\n\tcase r == ',':\n\t\tl.emit(itemComma)\n\tcase r == '(':\n\t\tl.emit(itemLeftParen)\n\t\tl.parenDepth++\n\tcase r == ')':\n\t\tl.emit(itemRightParen)\n\t\tl.parenDepth--\n\t\tif l.parenDepth < 0 {\n\t\t\treturn l.errorf(\"unexpected right paren %#U\", r)\n\t\t}\n\tcase r == '[':\n\t\tl.emit(itemLeftBrace)\n\t\tl.braceDepth++\n\tcase r == ']':\n\t\tl.emit(itemRightParen)\n\t\tl.parenDepth--\n\t\tif l.parenDepth < 0 {\n\t\t\treturn l.errorf(\"unexpected right paren %#U\", r)\n\t\t}\n\tcase unicode.IsDigit(r):\n\t\treturn lexNumber\n\tcase unicode.IsUpper(r) || r == '_':\n\t\treturn lexVariable\n\tcase unicode.IsLower(r):\n\t\treturn lexAtom\n\tcase r == '\\'' || r == '\"':\n\t\tl.backup()\n\t\treturn lexQuoted\n\tcase unicode.IsDigit(r):\n\t\tl.backup()\n\t\treturn lexNumber\n\tdefault:\n\t\tl.errorf(\"unexpected character %#U\", r)\n\t}\n\treturn lexNext\n}", "title": "" }, { "docid": "48d943bc11b3be586845ff65e216dc00", "score": "0.44842398", "text": "func (o OfficeDataConnectorDataTypesResponseSharePointOutput) State() pulumi.StringOutput {\n\treturn o.ApplyT(func(v OfficeDataConnectorDataTypesResponseSharePoint) string { return v.State }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "6b6254eae0388501bbaf309d378d20f3", "score": "0.4484145", "text": "func (o TIDataConnectorDataTypesIndicatorsOutput) State() pulumi.StringOutput {\n\treturn o.ApplyT(func(v TIDataConnectorDataTypesIndicators) string { return v.State }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "ea0080594868cde40f69884f1c468d6c", "score": "0.44832352", "text": "func (o SelfHostedIntegrationRuntimeStatusResponseOutput) State() pulumi.StringOutput {\n\treturn o.ApplyT(func(v SelfHostedIntegrationRuntimeStatusResponse) string { return v.State }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "8b3232a3bb62621cce5fce45cb9ff690", "score": "0.44794035", "text": "func (o AlertsDataTypeOfDataConnectorAlertsOutput) State() pulumi.StringOutput {\n\treturn o.ApplyT(func(v AlertsDataTypeOfDataConnectorAlerts) string { return v.State }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "4787d5cefc39b99c53447a9dbe4f967a", "score": "0.44667155", "text": "func (s *Links) GetNext() OptString {\n\treturn s.Next\n}", "title": "" }, { "docid": "272303945f34f79ba2f2b660f9b8092a", "score": "0.44645298", "text": "func (p *DirectedPipeline) Render() ([]byte, error) {\n\treturn dot.Marshal(p.Graph, \"G\", \"\", \" \")\n}", "title": "" }, { "docid": "22b4683bc768ebbe2c511284feb80d8c", "score": "0.4463966", "text": "func (e *jsiiProxy_EcsRunTask) RenderNextEnd() interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\te,\n\t\t\"renderNextEnd\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "e5a6d964ad16d02d1fe8beb5e3ba3316", "score": "0.44572037", "text": "func (o VocabularyOutput) State() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Vocabulary) pulumi.StringOutput { return v.State }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "86edb4bc62d17dffdd2d07c65b7ae2c1", "score": "0.44545782", "text": "func (d *decodeState) next() (interface{}, error) {\n\tswitch {\n\tcase d.data[d.off] == 'i':\n\t\treturn d.parseInt()\n\tcase d.data[d.off] >= '0' && d.data[d.off] <= '9':\n\t\treturn d.parseString()\n\tcase d.data[d.off] == 'd':\n\t\td.off++\n\t\treturn d.parseDictionary(1)\n\tcase d.data[d.off] == 'l':\n\t\td.off++\n\t\treturn d.parseList()\n\tdefault:\n\t\td.off++\n\t\treturn nil, errors.New(\"Cannot reconize next object\")\n\t}\n}", "title": "" }, { "docid": "2cd98e1e3e0398ad8507cbedb5f9854c", "score": "0.44465515", "text": "func (t *NextHopTraversalStep) MarshalJSON() ([]byte, error) {\n\tvalues := t.Values()\n\tt.GraphTraversal.RLock()\n\tdefer t.GraphTraversal.RUnlock()\n\treturn json.Marshal(values)\n}", "title": "" }, { "docid": "1975b6bd09cf488d14eac23b6bb4fb41", "score": "0.44414523", "text": "func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage {\n\treturn cdc.MustMarshalJSON(DefaultGenesisState())\n}", "title": "" }, { "docid": "e413d8fab6c4ebb9c152d8d31bc75e1d", "score": "0.44345185", "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": "19a89e0842a85e6b21105fa41d9c3141", "score": "0.44344097", "text": "func (o LookupAppGatewayResultOutput) State() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupAppGatewayResult) string { return v.State }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "9cb6df7f090543ffb180a63974bd0fd4", "score": "0.44331378", "text": "func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage {\n\tgs := types.DefaultGenesisState()\n\treturn cdc.MustMarshalJSON(gs)\n}", "title": "" }, { "docid": "2037ec8031f637690061d4d89e742da4", "score": "0.44308725", "text": "func (o AssetResourceStatusOutput) State() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v AssetResourceStatus) *string { return v.State }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "875a7be22cb6c8a19daae7c95ecfd351", "score": "0.44257018", "text": "func (s *jsiiProxy_SqsSendMessage) RenderNextEnd() interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\ts,\n\t\t\"renderNextEnd\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "ba478e7efe259ccb817b45a3bf7832bf", "score": "0.44243366", "text": "func (gqlr GraphQueryListResult) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif gqlr.NextLink != nil {\n\t\tobjectMap[\"nextLink\"] = gqlr.NextLink\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "156d655a94d05ff1203ce6ba03fb15a7", "score": "0.4424088", "text": "func (s Status) Render() []byte {\n\tv := map[string]interface{}{\n\t\t\"code\": s.Code,\n\t}\n\tswitch s.Code {\n\tdefault:\n\t\tv[\"message\"] = http.StatusText(s.Code)\n\tcase http.StatusBadRequest,\n\t\thttp.StatusUnprocessableEntity:\n\t\tv[\"message\"] = s.Message\n\t\tif s.Metadata != nil {\n\t\t\tv[\"metadata\"] = s.Metadata\n\t\t}\n\t}\n\tb, err := json.MarshalIndent(v, \"\", \"\\t\")\n\tif err != nil {\n\t\treturn nil\n\t}\n\treturn b\n}", "title": "" }, { "docid": "29b796696d23dfc6ba93e6ff40e5710d", "score": "0.44189855", "text": "func (o AuthConfigOutput) State() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *AuthConfig) pulumi.StringOutput { return v.State }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "414e9c6a04d9583ec19876694716339e", "score": "0.44180244", "text": "func (s *jsiiProxy_SageMakerCreateTrainingJob) Next(next awsstepfunctions.IChainable) awsstepfunctions.Chain {\n\tvar returns awsstepfunctions.Chain\n\n\t_jsii_.Invoke(\n\t\ts,\n\t\t\"next\",\n\t\t[]interface{}{next},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "bd3e08022186649855473ae31a635180", "score": "0.44140568", "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": "b9bd8d056b02b4ab59086acb5cfa6858", "score": "0.44132614", "text": "func printState(w io.ReadWriter, s *game.State) {\n\tfmt.Fprint(w, clear)\n\tfmt.Fprintln(w, title)\n\tfmt.Fprintln(w, board(s))\n\tfmt.Fprintln(w)\n\tfmt.Fprintln(w, legend())\n}", "title": "" }, { "docid": "37d4ff9f777dbb536d73de81b661e3d7", "score": "0.4412982", "text": "func (s *jsiiProxy_SageMakerCreateTransformJob) Next(next awsstepfunctions.IChainable) awsstepfunctions.Chain {\n\tvar returns awsstepfunctions.Chain\n\n\t_jsii_.Invoke(\n\t\ts,\n\t\t\"next\",\n\t\t[]interface{}{next},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "cae036bf665d38c744333ba6b669c393", "score": "0.44104034", "text": "func (o OfficeDataConnectorDataTypesSharePointOutput) State() pulumi.StringOutput {\n\treturn o.ApplyT(func(v OfficeDataConnectorDataTypesSharePoint) string { return v.State }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "347291530c7b414e422ef29ac4661519", "score": "0.44057813", "text": "func (AppModuleBasic) DefaultGenesis(cdc codec.JSONMarshaler) json.RawMessage {\n\treturn cdc.MustMarshalJSON(types.DefaultGenesisState())\n}", "title": "" } ]
9647b873210526979d097a3177472b54
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be nonnil.
[ { "docid": "af60b34fb3f400fcec2d7ab4ce9e5b22", "score": "0.0", "text": "func (in *PublisherDeptSpec) DeepCopyInto(out *PublisherDeptSpec) {\n\t*out = *in\n\tif in.Replicas != nil {\n\t\tin, out := &in.Replicas, &out.Replicas\n\t\t*out = new(int32)\n\t\t**out = **in\n\t}\n}", "title": "" } ]
[ { "docid": "1c2d70d782e9a1af879ef1c56794f835", "score": "0.82413644", "text": "func (in *Data) DeepCopyInto(out *Data) {\n\t*out = *in\n}", "title": "" }, { "docid": "da106d983b586b057f03d7a4a40c0ad7", "score": "0.8176556", "text": "func (in *Info) DeepCopyInto(out *Info) {\n\t*out = *in\n}", "title": "" }, { "docid": "fdea5f2ac6cc2ce2c38000e1d09d0d61", "score": "0.81523335", "text": "func (in *Binary) DeepCopyInto(out *Binary) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "0649f53a95cb6619607d3d1a0f4ddd1b", "score": "0.8139364", "text": "func (in *InterfacePasst) DeepCopyInto(out *InterfacePasst) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "96e806fc2839c14e1c5e0b59cb549799", "score": "0.8094733", "text": "func (id *ObjectId) DeepCopyInto(out *ObjectId) {\n\t*out = *id\n}", "title": "" }, { "docid": "96e806fc2839c14e1c5e0b59cb549799", "score": "0.8094733", "text": "func (id *ObjectId) DeepCopyInto(out *ObjectId) {\n\t*out = *id\n}", "title": "" }, { "docid": "8bde1b1cbaa096356e20c921603ac232", "score": "0.804062", "text": "func (in *DatadogConfiugration) DeepCopyInto(out *DatadogConfiugration) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "3f5da2ac6cfa7bd05112672385c886d2", "score": "0.80319166", "text": "func (in *DataExport) DeepCopyInto(out *DataExport) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "8e7a3b08ebd7c00b7f2a3efdede21d3a", "score": "0.80289304", "text": "func (in *Selection) DeepCopyInto(out *Selection) {\n\t*out = *in\n\tif in.UseAllDevices != nil {\n\t\tin, out := &in.UseAllDevices, &out.UseAllDevices\n\t\t*out = new(bool)\n\t\t**out = **in\n\t}\n\tif in.Devices != nil {\n\t\tin, out := &in.Devices, &out.Devices\n\t\t*out = make([]Device, len(*in))\n\t\tfor i := range *in {\n\t\t\t(*in)[i].DeepCopyInto(&(*out)[i])\n\t\t}\n\t}\n\tif in.Directories != nil {\n\t\tin, out := &in.Directories, &out.Directories\n\t\t*out = make([]Directory, len(*in))\n\t\tfor i := range *in {\n\t\t\t(*in)[i].DeepCopyInto(&(*out)[i])\n\t\t}\n\t}\n\tif in.VolumeClaimTemplates != nil {\n\t\tin, out := &in.VolumeClaimTemplates, &out.VolumeClaimTemplates\n\t\t*out = make([]v1.PersistentVolumeClaim, len(*in))\n\t\tfor i := range *in {\n\t\t\t(*in)[i].DeepCopyInto(&(*out)[i])\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "eb90b1072cf91df16d578f58e7621cd0", "score": "0.80219454", "text": "func (in *ImpersonationProxyTLSSpec) DeepCopyInto(out *ImpersonationProxyTLSSpec) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "ea03285e84e15a7cf1c08625d0146a63", "score": "0.8017569", "text": "func (in *FS) DeepCopyInto(out *FS) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "175c70831781dd23d04328f4bd884fc0", "score": "0.80046487", "text": "func (in *Hugepages) DeepCopyInto(out *Hugepages) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "f27556289b17f8999672f1a5d66f41e9", "score": "0.7993403", "text": "func (in *CrossVersionObjectReference) DeepCopyInto(out *CrossVersionObjectReference) {\r\n\t*out = *in\r\n\treturn\r\n}", "title": "" }, { "docid": "943731dcc5b0dd132eeb06116f982bdd", "score": "0.79878217", "text": "func (in *TestResult) DeepCopyInto(out *TestResult) {\n\t*out = *in\n}", "title": "" }, { "docid": "1bd357ab02d89fa3997e03fbf4690533", "score": "0.7986415", "text": "func (in *PVC) DeepCopyInto(out *PVC) {\n\t*out = *in\n}", "title": "" }, { "docid": "9e3fc04a6e6836d14ea52df87ac56ff7", "score": "0.798623", "text": "func (in *TargetPath) DeepCopyInto(out *TargetPath) {\n\t*out = *in\n}", "title": "" }, { "docid": "20912e92eb84ea1ec41dde40b691cafc", "score": "0.79833347", "text": "func (in *FloppyTarget) DeepCopyInto(out *FloppyTarget) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "8da051a527c97b23131359841bf49407", "score": "0.7980664", "text": "func (in *ESIdle) DeepCopyInto(out *ESIdle) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "32411e48b0c41369a3b37f1f34c69604", "score": "0.797522", "text": "func (in *Heapster) DeepCopyInto(out *Heapster) {\n\t*out = *in\n\tout.Addon = in.Addon\n\treturn\n}", "title": "" }, { "docid": "02e3fed7ff65a26076a354a53d6c154b", "score": "0.7972963", "text": "func (in *Arguments) DeepCopyInto(out *Arguments) {\n\t*out = *in\n}", "title": "" }, { "docid": "3952b8f895516a1de32d72864f8387d7", "score": "0.7972908", "text": "func (in *Input) DeepCopyInto(out *Input) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "09a622ae41a2172d4fd07d376190f880", "score": "0.79726255", "text": "func (in *Runtime) DeepCopyInto(out *Runtime) {\n\t*out = *in\n}", "title": "" }, { "docid": "dc25f670b9ab6635efd1a7f707841646", "score": "0.79705614", "text": "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n}", "title": "" }, { "docid": "acbc3f1efee5aaa8d03be05054421061", "score": "0.7968362", "text": "func (in *Backup) DeepCopyInto(out *Backup) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "f1ea9399c096cf0b72bcb8ea02d6e108", "score": "0.7963191", "text": "func (in *Imagestruct) DeepCopyInto(out *Imagestruct) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "188ae490063dcfa8bb2af538536656b9", "score": "0.79618305", "text": "func (in *Unstash) DeepCopyInto(out *Unstash) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "012b1e8c186c8bb5d6be717d858c96b9", "score": "0.7958075", "text": "func (in *ArbitraryObject) DeepCopyInto(out *ArbitraryObject) {\n\t*out = *in\n}", "title": "" }, { "docid": "1d7086a38f14633785818609a374af11", "score": "0.7956491", "text": "func (in *HostAndPath) DeepCopyInto(out *HostAndPath) {\n\t*out = *in\n}", "title": "" }, { "docid": "2c96afbae72d9d09403592d10a75dd2e", "score": "0.7954403", "text": "func (in *Incompatibility) DeepCopyInto(out *Incompatibility) {\n\t*out = *in\n}", "title": "" }, { "docid": "3c51337658fc0e9d2966273bd3459022", "score": "0.7946799", "text": "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "3c51337658fc0e9d2966273bd3459022", "score": "0.7946799", "text": "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "03b47d22a5efb39d6ec384531900b624", "score": "0.79428643", "text": "func (in *Ovs) DeepCopyInto(out *Ovs) {\n\t*out = *in\n}", "title": "" }, { "docid": "d9295895700ce483b375539279ecb7a0", "score": "0.7934434", "text": "func (in *Multus) DeepCopyInto(out *Multus) {\n\t*out = *in\n}", "title": "" }, { "docid": "ae8320d666daf42f7b276f91c508dfdb", "score": "0.7930485", "text": "func (in *File) DeepCopyInto(out *File) {\n\t*out = *in\n}", "title": "" }, { "docid": "736b857be3d993b086b590e39732d911", "score": "0.7928373", "text": "func (in *CleanupOptions) DeepCopyInto(out *CleanupOptions) {\n\t*out = *in\n}", "title": "" }, { "docid": "7f0d45d14df063a02ea85d0b366a2d3d", "score": "0.79274577", "text": "func (in *DynamoDBOutput) DeepCopyInto(out *DynamoDBOutput) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "e23b9d84f4323f0fc171205cc84e6f0b", "score": "0.7925676", "text": "func (in *General) DeepCopyInto(out *General) {\n\t*out = *in\n}", "title": "" }, { "docid": "614438a35d37b46a31778669cb3ed687", "score": "0.791886", "text": "func (in *ImpersonationProxyInfo) DeepCopyInto(out *ImpersonationProxyInfo) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "7f9d90d9468991d878220396a544f96e", "score": "0.7916556", "text": "func (in *Step) DeepCopyInto(out *Step) {\n\t*out = *in\n\tif in.Arguments != nil {\n\t\tin, out := &in.Arguments, &out.Arguments\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Options != nil {\n\t\tin, out := &in.Options, &out.Options\n\t\t*out = make(map[string]string, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t}\n\tif in.Loop != nil {\n\t\tin, out := &in.Loop, &out.Loop\n\t\t*out = new(Loop)\n\t\t(*in).DeepCopyInto(*out)\n\t}\n\tif in.Agent != nil {\n\t\tin, out := &in.Agent, &out.Agent\n\t\t*out = new(Agent)\n\t\t**out = **in\n\t}\n\tif in.Env != nil {\n\t\tin, out := &in.Env, &out.Env\n\t\t*out = make([]v1.EnvVar, len(*in))\n\t\tfor i := range *in {\n\t\t\t(*in)[i].DeepCopyInto(&(*out)[i])\n\t\t}\n\t}\n\tif in.Steps != nil {\n\t\tin, out := &in.Steps, &out.Steps\n\t\t*out = make([]*Step, len(*in))\n\t\tfor i := range *in {\n\t\t\tif (*in)[i] != nil {\n\t\t\t\tin, out := &(*in)[i], &(*out)[i]\n\t\t\t\t*out = new(Step)\n\t\t\t\t(*in).DeepCopyInto(*out)\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "e8a780c4f533b75c3c678fa3003c7322", "score": "0.7914803", "text": "func (in *DataTarget) DeepCopyInto(out *DataTarget) {\n\t*out = *in\n}", "title": "" }, { "docid": "a38ef85c8eb850f5d0a0d92d3f4503d1", "score": "0.7913708", "text": "func (in *Workspace) DeepCopyInto(out *Workspace) {\n\t*out = *in\n}", "title": "" }, { "docid": "70c5f5879e07637980a325527fff4749", "score": "0.79127294", "text": "func (in *Check) DeepCopyInto(out *Check) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "cfc737b2f967c736e30dd8ee07d84b31", "score": "0.7910865", "text": "func (in *TupDBFrom) DeepCopyInto(out *TupDBFrom) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "b37eac6da40504e302f650ddd06037ad", "score": "0.79078776", "text": "func (in *CHVersion) DeepCopyInto(out *CHVersion) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "eae9a043ce1412b2407a7ae6b28a5fa1", "score": "0.7906067", "text": "func (in *Variable) DeepCopyInto(out *Variable) {\n\t*out = *in\n}", "title": "" }, { "docid": "1c8cc8d41acead0d4873c0186a5de6db", "score": "0.79058474", "text": "func (in *Container) DeepCopyInto(out *Container) {\n\t*out = *in\n\tif in.Command != nil {\n\t\tin, out := &in.Command, &out.Command\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Args != nil {\n\t\tin, out := &in.Args, &out.Args\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Env != nil {\n\t\tin, out := &in.Env, &out.Env\n\t\t*out = make([]EnvVar, len(*in))\n\t\tfor i := range *in {\n\t\t\t(*in)[i].DeepCopyInto(&(*out)[i])\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "5c9e6a5011797fcea0d83be108d0bb74", "score": "0.7904976", "text": "func (in *Command) DeepCopyInto(out *Command) {\n\t*out = *in\n}", "title": "" }, { "docid": "f8ee01c3ea1b08bcc0ba7b79af0aae57", "score": "0.79048085", "text": "func (in *InterfaceMacvtap) DeepCopyInto(out *InterfaceMacvtap) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "ebde97abbe9aa8149c7ca6159e15bd33", "score": "0.7901901", "text": "func (in *CPUAndMem) DeepCopyInto(out *CPUAndMem) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "da814d21ab5e82f1dded2d914bd0d7db", "score": "0.7898767", "text": "func (in *Maplet) DeepCopyInto(out *Maplet) {\n\t*out = *in\n}", "title": "" }, { "docid": "b00adcbd292725cda24745b58102a425", "score": "0.78963304", "text": "func (in *RecyclingStrategy_Stable) DeepCopyInto(out *RecyclingStrategy_Stable) {\n\t*out = *in\n\tout.XXX_NoUnkeyedLiteral = in.XXX_NoUnkeyedLiteral\n\tif in.XXX_unrecognized != nil {\n\t\tin, out := &in.XXX_unrecognized, &out.XXX_unrecognized\n\t\t*out = make([]byte, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" }, { "docid": "be1c2a75c97d2e1a1dc1b1b6323a206f", "score": "0.7895883", "text": "func (in *TupWasGit) DeepCopyInto(out *TupWasGit) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "fa34b7a912adaa8fa8376df86845b6a8", "score": "0.7889267", "text": "func (in *VirtualMachineInstanceFileSystem) DeepCopyInto(out *VirtualMachineInstanceFileSystem) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "9a0aef88d71c929767eb4a0816465544", "score": "0.7888201", "text": "func (in *G1) DeepCopyInto(out *G1) {\n\t*out = *in\n}", "title": "" }, { "docid": "80574d29b6649e47f2a18a9ed7366cd8", "score": "0.78853357", "text": "func (in *TupDBTo) DeepCopyInto(out *TupDBTo) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "39ce8c74909b19176d16e3d69414e86a", "score": "0.7884342", "text": "func (in *BaseImage) DeepCopyInto(out *BaseImage) {\n\t*out = *in\n}", "title": "" }, { "docid": "864f91224a6eb3d2308114ac2e729916", "score": "0.7883498", "text": "func (in *Commit) DeepCopyInto(out *Commit) {\n\t*out = *in\n}", "title": "" }, { "docid": "f52e07466bf5b35c939262569e273970", "score": "0.7880811", "text": "func (in *CheckoutFrom) DeepCopyInto(out *CheckoutFrom) {\n\t*out = *in\n}", "title": "" }, { "docid": "a0004460d3beb4ca076e6ec2f48364a9", "score": "0.7880794", "text": "func (in *Grafana) DeepCopyInto(out *Grafana) {\n\t*out = *in\n}", "title": "" }, { "docid": "21cb77fa3d58ef3d1a2dc5850f634acc", "score": "0.78798366", "text": "func (in *ExtractionSource) DeepCopyInto(out *ExtractionSource) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "f4f8255c221465ab5155dffb2fa7bd9f", "score": "0.7876241", "text": "func (in *NavigationNode) DeepCopyInto(out *NavigationNode) {\n\t*out = *in\n\tif in.Settings != nil {\n\t\tin, out := &in.Settings, &out.Settings\n\t\t*out = new(runtime.RawExtension)\n\t\t(*in).DeepCopyInto(*out)\n\t}\n\tif in.RequiredPermissions != nil {\n\t\tin, out := &in.RequiredPermissions, &out.RequiredPermissions\n\t\t*out = make([]RequiredPermission, len(*in))\n\t\tfor i := range *in {\n\t\t\t(*in)[i].DeepCopyInto(&(*out)[i])\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "28c1f4101022b22d6ae98fbe0d4ae73c", "score": "0.7874144", "text": "func (in *CreateJenkinsfileArguments) DeepCopyInto(out *CreateJenkinsfileArguments) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "b7d2317b7d71a72506d5e952c7d6ac1a", "score": "0.7868943", "text": "func (in *Detail) DeepCopyInto(out *Detail) {\n\t*out = *in\n\tif in.StringValue != nil {\n\t\tin, out := &in.StringValue, &out.StringValue\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n\tif in.FloatValue != nil {\n\t\tin, out := &in.FloatValue, &out.FloatValue\n\t\t*out = new(float64)\n\t\t**out = **in\n\t}\n\tif in.BooleanValue != nil {\n\t\tin, out := &in.BooleanValue, &out.BooleanValue\n\t\t*out = new(bool)\n\t\t**out = **in\n\t}\n\treturn\n}", "title": "" }, { "docid": "8497b8e7f460bc68e010890c739cb813", "score": "0.78684497", "text": "func (in *Machine) DeepCopyInto(out *Machine) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "8497b8e7f460bc68e010890c739cb813", "score": "0.78684497", "text": "func (in *Machine) DeepCopyInto(out *Machine) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "8497b8e7f460bc68e010890c739cb813", "score": "0.78684497", "text": "func (in *Machine) DeepCopyInto(out *Machine) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "f8f9d1e1517b16db1fb1e4dc33762f0b", "score": "0.7867507", "text": "func (in *VMSelector) DeepCopyInto(out *VMSelector) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "60f2c810f51132cc5295ed2b35dac8ab", "score": "0.7865061", "text": "func (in *Action) DeepCopyInto(out *Action) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "1e1088954cae99b323e1b34730ad0490", "score": "0.7864017", "text": "func (in *Proxy) DeepCopyInto(out *Proxy) {\n\t*out = *in\n}", "title": "" }, { "docid": "e39896940442e2145aef5b05f65f5935", "score": "0.78626436", "text": "func (in *PodInfo) DeepCopyInto(out *PodInfo) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "7e85603bf93dd9729dd3185e72119127", "score": "0.78604776", "text": "func (in *FilesystemVirtiofs) DeepCopyInto(out *FilesystemVirtiofs) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "d77a09323414bb5ead85df58d20c21f1", "score": "0.785983", "text": "func (in *Match) DeepCopyInto(out *Match) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "a510fbe7bc41427b104d0eaa08202270", "score": "0.78590155", "text": "func (in *Host) DeepCopyInto(out *Host) {\n\t*out = *in\n}", "title": "" }, { "docid": "4e37b1e20e1e9cfe9a36a9c44de31c56", "score": "0.7853551", "text": "func (in *ResultsAPIProperties) DeepCopyInto(out *ResultsAPIProperties) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "4c52e751685f7d72e9ecfa8aaa132ad2", "score": "0.7852457", "text": "func (in *VersionedObjectReference) DeepCopyInto(out *VersionedObjectReference) {\n\t*out = *in\n\tout.ObjectReference = in.ObjectReference\n\treturn\n}", "title": "" }, { "docid": "9c7a70c686477c87992e082ae028c122", "score": "0.78512913", "text": "func (in *ChaosTestSpec) DeepCopyInto(out *ChaosTestSpec) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "e34b21a8afba2d52e3ecd2992cdcf0f8", "score": "0.7849713", "text": "func (in *ContainerRuntime) DeepCopyInto(out *ContainerRuntime) {\n\t*out = *in\n}", "title": "" }, { "docid": "7b05167b456af5c9293243358ed34ad7", "score": "0.7849226", "text": "func (in *PrestoNode) DeepCopyInto(out *PrestoNode) {\n\t*out = *in\n}", "title": "" }, { "docid": "e4913de28c2145467caf2d40a4f1654c", "score": "0.784811", "text": "func (in *ConsoleType) DeepCopyInto(out *ConsoleType) {\n\t*out = *in\n}", "title": "" }, { "docid": "514cd9b91bbcfa62b3eaca4ea029adb6", "score": "0.78468573", "text": "func (in *TupWasFrom) DeepCopyInto(out *TupWasFrom) {\n\t*out = *in\n\tout.Git = in.Git\n\treturn\n}", "title": "" }, { "docid": "0661c6d1870948cb6bc664ce3e28ee0d", "score": "0.7846747", "text": "func (in *Action) DeepCopyInto(out *Action) {\n\t*out = *in\n\tout.FillInterval.Seconds = in.FillInterval.Seconds\n\tout.FillInterval.Nanos = in.FillInterval.Nanos\n\tout.XXX_NoUnkeyedLiteral = in.XXX_NoUnkeyedLiteral\n\tif in.XXX_unrecognized != nil {\n\t\tin, out := &in.XXX_unrecognized, &out.XXX_unrecognized\n\t\t*out = make([]byte, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" }, { "docid": "73f5ed585bd057adce08054c75e5e8a8", "score": "0.7845679", "text": "func (in *TriggerStep) DeepCopyInto(out *TriggerStep) {\n\t*out = *in\n\tif in.Args != nil {\n\t\tin, out := &in.Args, &out.Args\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Env != nil {\n\t\tin, out := &in.Env, &out.Env\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.SecretEnv != nil {\n\t\tin, out := &in.SecretEnv, &out.SecretEnv\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Volumes != nil {\n\t\tin, out := &in.Volumes, &out.Volumes\n\t\t*out = make([]TriggerVolumes, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.WaitFor != nil {\n\t\tin, out := &in.WaitFor, &out.WaitFor\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" }, { "docid": "174cc360588a08f07c703c24bc1de03c", "score": "0.78415596", "text": "func (in *ContainerBuildArtifacts) DeepCopyInto(out *ContainerBuildArtifacts) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "647f1524647108952ee31ce014c689dc", "score": "0.7841353", "text": "func (in *HelmTiller) DeepCopyInto(out *HelmTiller) {\n\t*out = *in\n\tout.Addon = in.Addon\n\treturn\n}", "title": "" }, { "docid": "179b49839cac1113f009dc3570408eef", "score": "0.7840726", "text": "func (in *DiskTarget) DeepCopyInto(out *DiskTarget) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "179b49839cac1113f009dc3570408eef", "score": "0.7840726", "text": "func (in *DiskTarget) DeepCopyInto(out *DiskTarget) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "65b584585f6b71b70a2827141b1486f1", "score": "0.78386533", "text": "func (in *Default) DeepCopyInto(out *Default) {\n\t*out = *in\n\tif in.Scopes != nil {\n\t\tin, out := &in.Scopes, &out.Scopes\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" }, { "docid": "6af44f744e22e8c655f8c2045f82edd7", "score": "0.78357565", "text": "func (in *ImageBase) DeepCopyInto(out *ImageBase) {\n\t*out = *in\n}", "title": "" }, { "docid": "6e978e1552da1d32ee8f9c02cf0d4490", "score": "0.7835049", "text": "func (in *DiskSetup) DeepCopyInto(out *DiskSetup) {\n\t*out = *in\n\tif in.Partitions != nil {\n\t\tin, out := &in.Partitions, &out.Partitions\n\t\t*out = make([]Partition, len(*in))\n\t\tfor i := range *in {\n\t\t\t(*in)[i].DeepCopyInto(&(*out)[i])\n\t\t}\n\t}\n\tif in.Filesystems != nil {\n\t\tin, out := &in.Filesystems, &out.Filesystems\n\t\t*out = make([]Filesystem, len(*in))\n\t\tfor i := range *in {\n\t\t\t(*in)[i].DeepCopyInto(&(*out)[i])\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9bcd5d1a4cfca66ff5fcc4ffb7729ebc", "score": "0.783253", "text": "func (in *AmazonESProxy) DeepCopyInto(out *AmazonESProxy) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "66d2580ffb856b04e5d00a44ee008ce0", "score": "0.78313106", "text": "func (in *Target) DeepCopyInto(out *Target) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "bd7141db523e31824019287f9024dba2", "score": "0.78305846", "text": "func (in *EchoSpec) DeepCopyInto(out *EchoSpec) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "f8b0e375a7b6ee42eb30959578613752", "score": "0.78293675", "text": "func (in *DirectorSpec) DeepCopyInto(out *DirectorSpec) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "8e14ffa5d59641d2c993b17ea5ba3246", "score": "0.7828387", "text": "func (in *Delegate) DeepCopyInto(out *Delegate) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "7d0dadb0d8227a97ac91b35e66fd7cfc", "score": "0.7828071", "text": "func (in *FileDiscovery) DeepCopyInto(out *FileDiscovery) {\n\t*out = *in\n}", "title": "" }, { "docid": "ffc8735ea7a860548c18f550515167fb", "score": "0.78280014", "text": "func (in *ScreenshotOptions) DeepCopyInto(out *ScreenshotOptions) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "783f47424c191839399d4e44b906dd71", "score": "0.7825525", "text": "func (in *Port) DeepCopyInto(out *Port) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "783f47424c191839399d4e44b906dd71", "score": "0.7825525", "text": "func (in *Port) DeepCopyInto(out *Port) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "783f47424c191839399d4e44b906dd71", "score": "0.7825525", "text": "func (in *Port) DeepCopyInto(out *Port) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "783f47424c191839399d4e44b906dd71", "score": "0.7825525", "text": "func (in *Port) DeepCopyInto(out *Port) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "8ff4edb62aac78b649c6382f24a79f61", "score": "0.78247243", "text": "func (in *Database) DeepCopyInto(out *Database) {\n\t*out = *in\n\treturn\n}", "title": "" } ]
313ad19bea879a7548eec404131da2c9
SetLocalEndpointPort adds the localEndpointPort to the ipsec policy collection get params
[ { "docid": "eb3048fba930f907c150f8b1b5b97861", "score": "0.7956093", "text": "func (o *IpsecPolicyCollectionGetParams) SetLocalEndpointPort(localEndpointPort *string) {\n\to.LocalEndpointPort = localEndpointPort\n}", "title": "" } ]
[ { "docid": "0b8d08233150fcbb3f97facb917b68e1", "score": "0.70411485", "text": "func (o *IpsecPolicyCollectionGetParams) WithLocalEndpointPort(localEndpointPort *string) *IpsecPolicyCollectionGetParams {\n\to.SetLocalEndpointPort(localEndpointPort)\n\treturn o\n}", "title": "" }, { "docid": "a2c00b5253228fe9fee80b0f3b4136f1", "score": "0.5811183", "text": "func (endpoint *Endpoint) LocalPort() (string, error) {\n\thost, port, err := net.SplitHostPort(endpoint.Host)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tip, err := net.ResolveIPAddr(\"ip\", host)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tifaces, err := net.Interfaces()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tfor _, iface := range ifaces {\n\t\taddrs, err := iface.Addrs()\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\tfor _, addr := range addrs {\n\t\t\tif interfaceAddr, ok := addr.(*net.IPNet); ok {\n\t\t\t\tif iface.Flags&net.FlagLoopback != 0 && interfaceAddr.Contains(ip.IP) {\n\t\t\t\t\treturn port, nil\n\t\t\t\t}\n\t\t\t\tif interfaceAddr.IP.Equal(ip.IP) {\n\t\t\t\t\treturn port, nil\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn \"\", nil\n}", "title": "" }, { "docid": "3720f691a3919098b79c86d22c179848", "score": "0.5735904", "text": "func (o *IpsecPolicyCollectionGetParams) SetLocalEndpointFamily(localEndpointFamily *string) {\n\to.LocalEndpointFamily = localEndpointFamily\n}", "title": "" }, { "docid": "dc8d54d6521ee8990229a3990791eb06", "score": "0.566905", "text": "func (o *IpsecPolicyCollectionGetParams) SetLocalEndpointAddress(localEndpointAddress *string) {\n\to.LocalEndpointAddress = localEndpointAddress\n}", "title": "" }, { "docid": "9d7351ce0f632cb73d3a5ccfa1579de1", "score": "0.5660769", "text": "func (o *IpsecPolicyCollectionGetParams) WithLocalEndpointFamily(localEndpointFamily *string) *IpsecPolicyCollectionGetParams {\n\to.SetLocalEndpointFamily(localEndpointFamily)\n\treturn o\n}", "title": "" }, { "docid": "d341eadfbbdc73eff2a82c1109cbe41f", "score": "0.54760253", "text": "func (o *IpsecPolicyCollectionGetParams) SetLocalEndpointNetmask(localEndpointNetmask *string) {\n\to.LocalEndpointNetmask = localEndpointNetmask\n}", "title": "" }, { "docid": "f92c416ffdddc148e766ad3211c03c36", "score": "0.5440853", "text": "func localPortsHandler(fw *portforward.PortForwarder, opts Options) {\n\tif fw == nil {\n\t\treturn\n\t}\n\n\tif opts.ReadyChannel != nil && opts.PortsChannel != nil {\n\t\tgo func() {\n\t\t\tselect {\n\t\t\tcase <-opts.ReadyChannel:\n\t\t\t\tports, err := fw.GetPorts()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn // TODO\n\t\t\t\t}\n\t\t\t\tfp := make([]ForwardedPort, len(ports))\n\t\t\t\tfor i := range ports {\n\t\t\t\t\tfp[i].Local = ports[i].Local\n\t\t\t\t\tfp[i].Remote = ports[i].Remote\n\t\t\t\t}\n\t\t\t\topts.PortsChannel <- fp\n\n\t\t\tcase <-opts.StopChannel:\n\t\t\t\treturn\n\t\t\t}\n\t\t}()\n\t}\n}", "title": "" }, { "docid": "795ca9a8ccabcdc46e6448559a2cf99b", "score": "0.53961635", "text": "func (o *IpsecPolicyCollectionGetParams) WithLocalEndpointAddress(localEndpointAddress *string) *IpsecPolicyCollectionGetParams {\n\to.SetLocalEndpointAddress(localEndpointAddress)\n\treturn o\n}", "title": "" }, { "docid": "b7775dc776d7a22743ab0003dee42b0b", "score": "0.5317786", "text": "func (tc *TunnelConnection) LocalPort() string {\n\treturn tc.localPort\n}", "title": "" }, { "docid": "b4ee4fdb3f6f960510ec3505980cf66f", "score": "0.52484083", "text": "func (o *IpsecPolicyCollectionGetParams) WithLocalEndpointNetmask(localEndpointNetmask *string) *IpsecPolicyCollectionGetParams {\n\to.SetLocalEndpointNetmask(localEndpointNetmask)\n\treturn o\n}", "title": "" }, { "docid": "36c4f0bc7e357247fb82314eecf7d056", "score": "0.5160681", "text": "func (self *Vxlan) AddLocalEndpoint(endpoint OfnetEndpoint) error {\n\tlog.Infof(\"Adding local endpoint: %+v\", endpoint)\n\n\tvni := self.agent.getvlanVniMap(endpoint.Vlan)\n\tif vni == nil {\n\t\tlog.Errorf(\"VNI for vlan %d is not known\", endpoint.Vlan)\n\t\treturn errors.New(\"Unknown Vlan\")\n\t}\n\n\tdNATTbl := self.ofSwitch.GetTable(SRV_PROXY_DNAT_TBL_ID)\n\n\t// Install a flow entry for vlan mapping and point it to Mac table\n\tportVlanFlow, err := createPortVlanFlow(self.agent, self.vlanTable, dNATTbl, &endpoint)\n\tif err != nil {\n\t\tlog.Errorf(\"Error creating portvlan entry. Err: %v\", err)\n\t\treturn err\n\t}\n\n\t// save the flow entry\n\tself.portVlanFlowDb[endpoint.PortNo] = portVlanFlow\n\n\t// install DSCP flow entries if required\n\tif endpoint.Dscp != 0 {\n\t\tdscpV4Flow, dscpV6Flow, err := createDscpFlow(self.agent, self.vlanTable, dNATTbl, &endpoint)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Error installing DSCP flows. Err: %v\", err)\n\t\t\treturn err\n\t\t}\n\n\t\t// save it for tracking\n\t\tself.dscpFlowDb[endpoint.PortNo] = []*ofctrl.Flow{dscpV4Flow, dscpV6Flow}\n\t}\n\n\t// Add the port to local and remote flood list\n\toutput, err := self.ofSwitch.OutputPort(endpoint.PortNo)\n\tif err != nil {\n\t\treturn err\n\t}\n\tvlan := self.vlanDb[endpoint.Vlan]\n\tif vlan != nil {\n\t\tvlan.localFlood.AddOutput(output)\n\t\tvlan.allFlood.AddOutput(output)\n\t}\n\n\tmacAddr, err := net.ParseMAC(endpoint.MacAddrStr)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Finally install the mac address\n\tmacFlow, err := self.macDestTable.NewFlow(ofctrl.FlowMatch{\n\t\tPriority: FLOW_MATCH_PRIORITY,\n\t\tVlanId: endpoint.Vlan,\n\t\tMacDa: &macAddr,\n\t})\n\tif err != nil {\n\t\tlog.Errorf(\"Error creating mac flow for endpoint %+v. Err: %v\", endpoint, err)\n\t\treturn err\n\t}\n\n\t// Remove vlan tag and point it to local port\n\tmacFlow.PopVlan()\n\tmacFlow.Next(output)\n\n\t// Install dst group entry for the endpoint\n\terr = self.policyAgent.AddEndpoint(&endpoint)\n\tif err != nil {\n\t\tlog.Errorf(\"Error adding endpoint to policy agent{%+v}. Err: %v\", endpoint, err)\n\t\treturn err\n\t}\n\n\t// Install dst group entry for IPv6 endpoint\n\tif endpoint.Ipv6Addr != nil {\n\t\terr = self.policyAgent.AddIpv6Endpoint(&endpoint)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Error adding IPv6 endpoint to policy agent{%+v}. Err: %v\", endpoint, err)\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Save the flow in DB\n\tself.macFlowDb[endpoint.MacAddrStr] = macFlow\n\n\t// Send GARP\n\terr = self.sendGARP(endpoint.IpAddr, macAddr, uint64(endpoint.Vni))\n\tif err != nil {\n\t\tlog.Warnf(\"Error in sending GARP packet for (%s,%s) in vlan %d. Err: %+v\",\n\t\t\tendpoint.IpAddr.String(), endpoint.MacAddrStr, endpoint.Vlan, err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3a4e53dc710835c1ab226d24fefec0e4", "score": "0.51585317", "text": "func (self *Vxlan) AddLocalEndpoint(endpoint EndpointInfo) error {\n\tlog.Infof(\"Adding local endpoint: %+v\", endpoint)\n\n\tvni := self.agent.vlanVniMap[endpoint.Vlan]\n\tif vni == nil {\n\t\tlog.Errorf(\"VNI for vlan %d is not known\", endpoint.Vlan)\n\t\treturn errors.New(\"Unknown Vlan\")\n\t}\n\n\t// Install a flow entry for vlan mapping and point it to Mac table\n\tportVlanFlow, err := self.vlanTable.NewFlow(ofctrl.FlowMatch{\n\t\tPriority: FLOW_MATCH_PRIORITY,\n\t\tInputPort: endpoint.PortNo,\n\t})\n\tif err != nil {\n\t\tlog.Errorf(\"Error creating portvlan entry. Err: %v\", err)\n\t\treturn err\n\t}\n\n\t// Set the vlan and install it\n\tportVlanFlow.SetVlan(endpoint.Vlan)\n\terr = portVlanFlow.Next(self.macDestTable)\n\tif err != nil {\n\t\tlog.Errorf(\"Error installing portvlan entry. Err: %v\", err)\n\t\treturn err\n\t}\n\n\t// save the flow entry\n\tself.portVlanFlowDb[endpoint.PortNo] = portVlanFlow\n\n\t// Add the port to local and remote flood list\n\toutput, _ := self.ofSwitch.OutputPort(endpoint.PortNo)\n\tvlan := self.vlanDb[endpoint.Vlan]\n\tif vlan != nil {\n\t\tvlan.localFlood.AddOutput(output)\n\t\tvlan.allFlood.AddOutput(output)\n\t}\n\n\t// Finally install the mac address\n\tmacFlow, err := self.macDestTable.NewFlow(ofctrl.FlowMatch{\n\t\tPriority: FLOW_MATCH_PRIORITY,\n\t\tVlanId: endpoint.Vlan,\n\t\tMacDa: &endpoint.MacAddr,\n\t})\n\tif err != nil {\n\t\tlog.Errorf(\"Error creating mac flow for endpoint %+v. Err: %v\", endpoint, err)\n\t\treturn err\n\t}\n\n\t// Remove vlan tag and point it to local port\n\tmacFlow.PopVlan()\n\tmacFlow.Next(output)\n\n\t// Save the flow in DB\n\tself.macFlowDb[endpoint.MacAddr.String()] = macFlow\n\n\t// Build the mac route\n\tmacRoute := MacRoute{\n\t\tMacAddrStr: endpoint.MacAddr.String(),\n\t\tVni: *vni,\n\t\tOriginatorIp: self.agent.localIp,\n\t\tPortNo: endpoint.PortNo,\n\t\tTimestamp: time.Now(),\n\t}\n\n\t// Advertize the route to master\n\terr = self.localMacRouteAdd(&macRoute)\n\tif err != nil {\n\t\tlog.Errorf(\"Failed to add route %+v to master. Err: %v\", macRoute, err)\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "39777cee86bdb485761fd48162ff54e1", "score": "0.50627315", "text": "func getLocalEndpoint(endpointList []nsmapi.NetworkServiceEndpoint, nsmPodIPAddress string) []nsmapi.NetworkServiceEndpoint {\n\tlocalEndpoints := []nsmapi.NetworkServiceEndpoint{}\n\tfor _, ep := range endpointList {\n\t\tif ep.Spec.NetworkServiceHost == nsmPodIPAddress {\n\t\t\tlocalEndpoints = append(localEndpoints, ep)\n\t\t}\n\t}\n\treturn localEndpoints\n}", "title": "" }, { "docid": "53e253e74a0c2eb2f9c4c5626b69811b", "score": "0.50476855", "text": "func (plugin *Plugin) GetServiceLocalEndpointWeight() uint8 {\n\treturn plugin.Config.ServiceLocalEndpointWeight\n}", "title": "" }, { "docid": "e3c747ce9e171fc2f9e6a2f43e59534d", "score": "0.4982345", "text": "func (o *IpsecPolicyCollectionGetParams) SetLocalIdentity(localIdentity *string) {\n\to.LocalIdentity = localIdentity\n}", "title": "" }, { "docid": "86052419659ed6387e3b4f887e426d00", "score": "0.49703455", "text": "func LocalListenerWithRandomPort() (*net.TCPListener, error) {\n\treturn Listener(LocalhostWithRandomPort)\n}", "title": "" }, { "docid": "6a65e08b12676ed55085b83817b4589d", "score": "0.48688138", "text": "func (lpo *localPortOpener) OpenLocalPort(port int, protocol string) (io.Closer, error) {\n\t// For now, NodePortLocal only supports IPv4 and TCP/UDP.\n\tvar network string\n\tvar socket io.Closer\n\tswitch protocol {\n\tcase \"tcp\":\n\t\tnetwork = \"tcp4\"\n\t\tlistener, err := net.Listen(network, fmt.Sprintf(\":%d\", port))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tsocket = listener\n\tcase \"udp\":\n\t\tnetwork = \"udp4\"\n\t\taddr, err := net.ResolveUDPAddr(network, fmt.Sprintf(\":%d\", port))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tconn, err := net.ListenUDP(network, addr)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tsocket = conn\n\t}\n\tklog.V(2).InfoS(\"Opened local port\", \"port\", port)\n\treturn socket, nil\n}", "title": "" }, { "docid": "9e8a8d097fa0f8bf68b3be9d88e91c08", "score": "0.48400983", "text": "func (r Rule) LocalPort() Port {\n\tif r.Type() != RuleApp {\n\t\tpanic(\"invalid rule\")\n\t}\n\treturn Port(binary.BigEndian.Uint16(r[48:]))\n}", "title": "" }, { "docid": "5370a7bb98fed36e2ad601e564277ead", "score": "0.47915196", "text": "func (o *IpsecPolicyCollectionGetParams) SetRemoteEndpointPort(remoteEndpointPort *string) {\n\to.RemoteEndpointPort = remoteEndpointPort\n}", "title": "" }, { "docid": "1e179a97d1c5b8d203686552253085db", "score": "0.47660026", "text": "func localIPPort(dstIP net.IP) (net.IP, int, error) {\n\tserverAddr, err := net.ResolveUDPAddr(\"udp\", dstIP.String()+\":54321\")\n\tif err != nil {\n\t\treturn nil, 0, err\n\t}\n\t// We don't actually connect to anything, but we can determine\n\t// based on our destination ip what source ip we should use.\n\tif con, err := net.DialUDP(\"udp\", nil, serverAddr); err == nil {\n\t\tif udpaddr, ok := con.LocalAddr().(*net.UDPAddr); ok {\n\t\t\treturn udpaddr.IP, udpaddr.Port, nil\n\t\t}\n\t}\n\treturn nil, -1, err\n}", "title": "" }, { "docid": "3896653981e0fbee036a9a65ac6b40ba", "score": "0.47547576", "text": "func (o *IpsecPolicyCollectionGetParams) WithRemoteEndpointPort(remoteEndpointPort *string) *IpsecPolicyCollectionGetParams {\n\to.SetRemoteEndpointPort(remoteEndpointPort)\n\treturn o\n}", "title": "" }, { "docid": "eab4b99e11f02b632be8e7a66229db86", "score": "0.47287452", "text": "func LocalPort(containerName string, containerPort string) string {\n\t// Example return: \"unison:32757\"\n\tcs := utils.StdoutCmd(\"docker-compose\", \"-f\", filepath.Join(conf.GetProjectPath(), \"docker-compose.tok.yml\"), \"port\", containerName, containerPort)\n\n\tp := strings.Split(cs, \":\")\n\tif len(p) <= 1 {\n\t\tlog.Fatal(\"The required container '\" + containerName + \"' is not running. Check the status of your containers with `tok ps` and retry `tok up`. Exiting...\")\n\t\treturn \"\"\n\t}\n\n\treturn p[1]\n}", "title": "" }, { "docid": "38b890e567fc2d2afe78e0dea917531b", "score": "0.46835282", "text": "func localIPPort(dstip net.IP) (net.IP, int) {\n\tserverAddr, err := net.ResolveUDPAddr(\"udp\", dstip.String()+\":12345\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t// we don't actually connect to anything, but we can determine\n\t// based on our destination ip what source ip we should use.\n\tif con, err := net.DialUDP(\"udp\", nil, serverAddr); err == nil {\n\t\tif udpaddr, ok := con.LocalAddr().(*net.UDPAddr); ok {\n\t\t\treturn udpaddr.IP, udpaddr.Port\n\t\t}\n\t}\n\tlog.Fatal(\"could not get local ip: \" + err.Error())\n\treturn nil, -1\n}", "title": "" }, { "docid": "a78ad7e071787f7a29bc64fc66ac1cf7", "score": "0.46759802", "text": "func (m *CloudPcProvisioningPolicy) SetLocalAdminEnabled(value *bool)() {\n err := m.GetBackingStore().Set(\"localAdminEnabled\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "07c4c4532862276498d52ad1f726a4b6", "score": "0.46621013", "text": "func (h *HttpSrvConfig) OuterIpPort() string {\n\tif len(h.OuterHost) == 0 {\n\t\th.OuterHost, _ = micro.OuterIpPort(h.ListenPort())\n\t}\n\treturn h.OuterHost\n}", "title": "" }, { "docid": "1401a8abbbfd8433b86da5f8c5c74354", "score": "0.4654478", "text": "func (p *Prefs) initLocalIP() {\r\n\turl := \"https://api.ipify.org?format=text\"\r\n\tfmt.Printf(\"Getting IP address from ipify ...\\n\")\r\n\tresp, err := http.Get(url)\r\n\tif err != nil {\r\n\t\tpanic(err)\r\n\t}\r\n\tdefer resp.Body.Close()\r\n\tip, err := ioutil.ReadAll(resp.Body)\r\n\tif err != nil {\r\n\t\tpanic(err)\r\n\t}\r\n\tconn, err := net.Dial(\"udp\", \"8.8.8.8:80\")\r\n\tif err != nil {\r\n\t\tcom.HhjLog.Critical(err)\r\n\t}\r\n\tdefer conn.Close()\r\n\r\n\tlocalAddr := conn.LocalAddr().(*net.UDPAddr)\r\n\tcom.HhjLog.Infof(\"Listening on IP: %s:%d\\n\", localAddr.IP.String(),p.config.UDPPort)\r\n\tcom.HhjLog.Infof(\"Listening on IP: %s:%d\\n\", ip,p.config.ExternalUDPPort)\r\n\r\n\tp.localIP = ip2I(localAddr.IP)\r\n\tp.bFirewalled = false\r\n\tp.externIP = ip2I(net.ParseIP(string(ip)))\r\n}", "title": "" }, { "docid": "b19caf6963db5ab78c58f7d656d3fefa", "score": "0.4635858", "text": "func (ovn *SyncHandler) localEndpointSubnetSet() set.Set[string] {\n\tlocalSubnets := set.New[string]()\n\n\tif ovn.localEndpoint != nil {\n\t\tfor _, subnet := range ovn.localEndpoint.Spec.Subnets {\n\t\t\tlocalSubnets.Insert(subnet)\n\t\t}\n\t}\n\n\treturn localSubnets\n}", "title": "" }, { "docid": "d749454cef98d8edd4ed6c7555289f49", "score": "0.46293646", "text": "func (inv *ActionHostIpAddressAssignInvocation) SetPathParamInt(param string, value int64) *ActionHostIpAddressAssignInvocation {\n\treturn inv.SetPathParamString(param, convertInt64ToString(value))\n}", "title": "" }, { "docid": "8085929cd1bff707b9e35be54bb89dd1", "score": "0.46291575", "text": "func (self *Vxlan) UpdateLocalEndpoint(endpoint *OfnetEndpoint, epInfo EndpointInfo) error {\n\toldDscp := endpoint.Dscp\n\n\t// Remove existing DSCP flows if required\n\tif epInfo.Dscp == 0 || epInfo.Dscp != endpoint.Dscp {\n\t\t// remove old DSCP flows\n\t\tdscpFlows, found := self.dscpFlowDb[endpoint.PortNo]\n\t\tif found {\n\t\t\tfor _, dflow := range dscpFlows {\n\t\t\t\terr := dflow.Delete()\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Errorf(\"Error deleting dscp flow {%+v}. Err: %v\", dflow, err)\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// change DSCP value\n\tendpoint.Dscp = epInfo.Dscp\n\n\t// Add new DSCP flows if required\n\tif epInfo.Dscp != 0 && epInfo.Dscp != oldDscp {\n\t\tdNATTbl := self.ofSwitch.GetTable(SRV_PROXY_DNAT_TBL_ID)\n\n\t\t// add new dscp flows\n\t\tdscpV4Flow, dscpV6Flow, err := createDscpFlow(self.agent, self.vlanTable, dNATTbl, endpoint)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Error installing DSCP flows. Err: %v\", err)\n\t\t\treturn err\n\t\t}\n\n\t\t// save it for tracking\n\t\tself.dscpFlowDb[endpoint.PortNo] = []*ofctrl.Flow{dscpV4Flow, dscpV6Flow}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "8c85a998ccbc55197ee13f5b500685ae", "score": "0.4595243", "text": "func (inv *ActionNetworkAddAddressesInvocation) SetPathParamInt(param string, value int64) *ActionNetworkAddAddressesInvocation {\n\treturn inv.SetPathParamString(param, convertInt64ToString(value))\n}", "title": "" }, { "docid": "917544339f8566d836dc9d1d9b59817e", "score": "0.45195", "text": "func GetPort() string {\n\treturn LOCAL_PORT\n}", "title": "" }, { "docid": "91254d5c474bc2061f73a832bb52919d", "score": "0.4495143", "text": "func Set_param() string {\n\t//Parsing by Flag\n\tport := flag.String(\"port\", Service_port, \"Set port number for Service\")\n\tapi_server := flag.String(\"apiserver\", ConsulURL, \"Set API Server URI for comunication\")\n\tflag.Parse()\n\tService_port = *port\n\tConsulURL = *api_server\n\treturn Service_port\n}", "title": "" }, { "docid": "94d2b78922d4315ead1bb250be8c6a4e", "score": "0.44474453", "text": "func StartLocalConnection(port string) (portString string, udpConn *net.UDPConn) {\n\tvar udpAddr *net.UDPAddr\n\tvar err error\n\tsuccessful := false\n\tfor !successful {\n\t\tudpAddr, err = net.ResolveUDPAddr(\"udp4\", \"127.0.0.1:\"+port)\n\t\tCheckError(err)\n\t\tudpConn, err = net.ListenUDP(\"udp4\", udpAddr)\n\t\tif err == nil {\n\t\t\tsuccessful = true\n\t\t} else {\n\t\t\tintAux, err := strconv.Atoi(port)\n\t\t\tCheckError(err)\n\t\t\tport = strconv.Itoa(intAux + 1)\n\t\t}\n\t}\n\treturn port, udpConn\n}", "title": "" }, { "docid": "56bcbd9b6d277db4889ea72a2b1edad9", "score": "0.44316837", "text": "func (inv *ActionVpsConfigUpdateInvocation) SetPathParamInt(param string, value int64) *ActionVpsConfigUpdateInvocation {\n\treturn inv.SetPathParamString(param, convertInt64ToString(value))\n}", "title": "" }, { "docid": "5ec908b463b86433d42e89360583db77", "score": "0.4424073", "text": "func (inv *ActionPoolShowInvocation) SetPathParamInt(param string, value int64) *ActionPoolShowInvocation {\n\treturn inv.SetPathParamString(param, convertInt64ToString(value))\n}", "title": "" }, { "docid": "9534e6a07c81695faa5c560168a67e3b", "score": "0.44190976", "text": "func (o *IpsecPolicyCollectionGetParams) WithLocalIdentity(localIdentity *string) *IpsecPolicyCollectionGetParams {\n\to.SetLocalIdentity(localIdentity)\n\treturn o\n}", "title": "" }, { "docid": "f39916d463c8f92acf931be7e54039e5", "score": "0.4392093", "text": "func (o PrometheusSpecThanosOutput) ListenLocal() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v PrometheusSpecThanos) *bool { return v.ListenLocal }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "a78770c8b180ac1b90e896bde4ae0cee", "score": "0.43887994", "text": "func (o PrometheusSpecOutput) ListenLocal() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v PrometheusSpec) *bool { return v.ListenLocal }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "abb28b5b34730443e3b209108177e882", "score": "0.43648186", "text": "func (m *IosikEv2VpnConfiguration) SetLocalIdentifier(value *VpnLocalIdentifier)() {\n err := m.GetBackingStore().Set(\"localIdentifier\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "101226df6f60488b3f352adc2e0311a4", "score": "0.43582338", "text": "func addrLocal(addr net.Addr) string {\n\t_, port, _ := net.SplitHostPort(addr.String())\n\treturn net.JoinHostPort(\"localhost\", port)\n}", "title": "" }, { "docid": "2150c2e2cc950daf2c1f6cd17db9fcc6", "score": "0.43580472", "text": "func getLocalIPPort(dst net.IP) (net.IP, int, *net.UDPConn, error) {\n\t//local port doesn't really matter, just getting a routable address\n\tserverAddr, err := net.ResolveUDPAddr(\"udp\", net.JoinHostPort(dst.String(), \"12345\"))\n\tif err != nil {\n\t\tglog.Error(\"Error resolving address: \" + err.Error())\n\t\treturn nil, -1, nil, err\n\t}\n\n\tvar conn *net.UDPConn\n\tif conn, err = net.DialUDP(\"udp\", nil, serverAddr); err == nil {\n\t\tif udpaddr, ok := conn.LocalAddr().(*net.UDPAddr); ok {\n\t\t\treturn udpaddr.IP, udpaddr.Port, conn, nil\n\t\t}\n\t}\n\tglog.Error(\"could not get local ip: \" + err.Error())\n\treturn nil, -1, nil, err\n}", "title": "" }, { "docid": "523f7a84e3ae2a2ce48f16a27a887087", "score": "0.435616", "text": "func Port(p int) func(*Server) {\n\treturn func(s *Server) {\n\t\ts.port = p\n\t}\n}", "title": "" }, { "docid": "064b988a867afc7abe4fb5378f8a56eb", "score": "0.4351186", "text": "func (m *gerritListenerSpec) SetEndpoint(val *string) {\n\tm.endpointField = val\n}", "title": "" }, { "docid": "da69c6b7d31332d22b3e3156683a1a62", "score": "0.43449897", "text": "func (m *MicrosoftTunnelConfiguration) SetListenPort(value *int32)() {\n err := m.GetBackingStore().Set(\"listenPort\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "e4849a26b4774a6df991b253a2b90be6", "score": "0.43389666", "text": "func (s *NetworkInstance_ConnectionPoint_Endpoint_Local) Validate() error {\n\tif err := ytypes.Validate(SchemaTree[\"NetworkInstance_ConnectionPoint_Endpoint_Local\"], s); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c30396574cfa5a9802f870faed6c18f9", "score": "0.43358088", "text": "func (inv *ActionUserPublicKeyUpdateInvocation) SetPathParamInt(param string, value int64) *ActionUserPublicKeyUpdateInvocation {\n\treturn inv.SetPathParamString(param, convertInt64ToString(value))\n}", "title": "" }, { "docid": "e1c5f0bc3ee670f1e5ff4e799ac43cb1", "score": "0.4332526", "text": "func (c *Context) Port() int {\n\tparts := strings.Split(c.Request().Host(), \":\")\n\tif len(parts) == 2 {\n\t\tport, _ := strconv.Atoi(parts[1])\n\t\treturn port\n\t}\n\treturn 80\n}", "title": "" }, { "docid": "e6bf512e65136c18a64d5d9bad3de71e", "score": "0.4324344", "text": "func (o *RetrieveCertificateParams) SetPort(port *int32) {\n\to.Port = port\n}", "title": "" }, { "docid": "b18b1612b7988851fc04b93be255d110", "score": "0.43232614", "text": "func (m *gerritListener) SetEndpoint(val string) {\n\tm.endpointField = val\n}", "title": "" }, { "docid": "6eb620247cd3cdfa196827f0a2387f26", "score": "0.4315461", "text": "func WithHTTPPort(p int) Opt {\n\treturn func(c *Client) error {\n\t\tc.httpPort = p\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "5906781a6c8dd7bf6409827faac5f7b3", "score": "0.43132806", "text": "func (m *IpsecPolicyInlineLocalEndpoint) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateAddress(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateFamily(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateNetmask(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "59d007161086b387f9787b1fc4b30464", "score": "0.43072948", "text": "func SetPort(s string) func(*SAMWebConfig) error {\n\treturn func(c *SAMWebConfig) error {\n\t\tport, err := strconv.Atoi(s)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Invalid TCP Server Target Port %s; non-number \", s)\n\t\t}\n\t\tif port < 65536 && port > -1 {\n\t\t\tc.port = s\n\t\t\treturn nil\n\t\t}\n\t\treturn fmt.Errorf(\"Invalid port\")\n\t}\n}", "title": "" }, { "docid": "5813b2637a567bc8661aa269ae283e64", "score": "0.4303717", "text": "func (proxy *ConsulProxy) local() *net.TCPAddr {\n\tvar local = proxy.localIp + \":\" + strconv.Itoa(proxy.localPort)\n\tlocalAddress, err := net.ResolveTCPAddr(\"tcp\", local)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn localAddress\n}", "title": "" }, { "docid": "977422bc06c084fa24864491565b5748", "score": "0.42887196", "text": "func (inv *ActionSystemConfigUpdateInvocation) SetPathParamInt(param string, value int64) *ActionSystemConfigUpdateInvocation {\n\treturn inv.SetPathParamString(param, convertInt64ToString(value))\n}", "title": "" }, { "docid": "23553cfe10c4cbd60640d880833f5a41", "score": "0.4288322", "text": "func (c *Context) Port() int {\n\tparts := strings.Split(c.request.Host, \":\")\n\tif len(parts) == 2 {\n\t\tport, _ := strconv.Atoi(parts[1])\n\t\treturn port\n\t}\n\treturn 80\n}", "title": "" }, { "docid": "5d0a2ee826a5e83a0d8bc4a3b9a0970a", "score": "0.42860913", "text": "func (inv *ActionLocationNetworkUpdateInvocation) SetPathParamInt(param string, value int64) *ActionLocationNetworkUpdateInvocation {\n\treturn inv.SetPathParamString(param, convertInt64ToString(value))\n}", "title": "" }, { "docid": "d0d7576e8a93829de72ccfd075b94a23", "score": "0.42853895", "text": "func (_this *Location) SetPort(value string) {\n\tinput := value\n\t_this.Value_JS.Set(\"port\", input)\n}", "title": "" }, { "docid": "989134751b6ab2710330ab53f43044ba", "score": "0.4274677", "text": "func (s *NetworkInstance_ConnectionPoint_Endpoint_Local) Validate(opts ...ygot.ValidationOption) error {\n\tif err := ytypes.Validate(SchemaTree[\"NetworkInstance_ConnectionPoint_Endpoint_Local\"], s, opts...); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ee93d9f7ddfdd750500f94c7595d0702", "score": "0.42641324", "text": "func (o ServiceMonitorSpecEndpointsOutput) Port() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ServiceMonitorSpecEndpoints) *string { return v.Port }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "2ff09ed53814478125775d349a69a9e8", "score": "0.4259816", "text": "func LocalPort() string {\n\tp := docker.LocalPort(\"drush\", \"5000\")\n\tif p == \"\" {\n\t\tlog.Fatal(\"Drush container doesn't appear to be running!\")\n\t}\n\n\treturn p\n}", "title": "" }, { "docid": "4cb2f6b3f56c54ada7f58fc80d5b8e3a", "score": "0.42596117", "text": "func (tads *SDKClient) SetIpPort(ip string, port int, schema string) {\n\tipPort := fmt.Sprintf(\"%s:%d\", ip, port)\n\ttads.SetHost(ipPort, schema)\n}", "title": "" }, { "docid": "1f417a3e43867c6c68812d3e0eab812e", "score": "0.42554972", "text": "func (baseRequest *BaseRequest) SetPort(port string) {\n\tbaseRequest.Port = port\n}", "title": "" }, { "docid": "736ae15979fdaa35bce4f80e9c8ff409", "score": "0.4253759", "text": "func (inv *ActionMigrationPlanShowInvocation) SetPathParamInt(param string, value int64) *ActionMigrationPlanShowInvocation {\n\treturn inv.SetPathParamString(param, convertInt64ToString(value))\n}", "title": "" }, { "docid": "c2caa5d55775fdf66cf6251a831bdaad", "score": "0.4252051", "text": "func (b *ThanosSpecApplyConfiguration) WithListenLocal(value bool) *ThanosSpecApplyConfiguration {\n\tb.ListenLocal = &value\n\treturn b\n}", "title": "" }, { "docid": "49c1d03b30cf6dcd4589f9d1df49c910", "score": "0.42485696", "text": "func (o AlertmanagerSpecOutput) ListenLocal() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v AlertmanagerSpec) *bool { return v.ListenLocal }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "0bd3193ceeed028a9205effe51675c4f", "score": "0.42478937", "text": "func (b *Builder) UnsetPort(p string) {\n\tdelete(b.OCIv1.Config.ExposedPorts, p)\n\tdelete(b.Docker.Config.ExposedPorts, docker.Port(p))\n}", "title": "" }, { "docid": "f119b49ada14ed421da9d15c3c712fbd", "score": "0.42338488", "text": "func (proc *ProcessesWatcher) GetLocalPortToPIDMapping(transport applayer.Transport) (ports map[endpoint]int, err error) {\n\tsourceFiles, ok := procFiles[transport]\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"unsupported transport protocol id: %d\", transport)\n\t}\n\tvar pids gosigar.ProcList\n\tif err = pids.Get(); err != nil {\n\t\treturn nil, err\n\t}\n\tlogp.Debug(\"procs\", \"getLocalPortsToPIDs()\")\n\tipv4socks, err := socketsFromProc(sourceFiles.ipv4, false)\n\tif err != nil {\n\t\tlogp.Err(\"GetLocalPortToPIDMapping: parsing '%s': %s\", sourceFiles.ipv4, err)\n\t\treturn nil, err\n\t}\n\tipv6socks, err := socketsFromProc(sourceFiles.ipv6, true)\n\tif err != nil {\n\t\tlogp.Err(\"GetLocalPortToPIDMapping: parsing '%s': %s\", sourceFiles.ipv6, err)\n\t\treturn nil, err\n\t}\n\tsocksMap := map[uint64]*socketInfo{}\n\tfor _, s := range ipv4socks {\n\t\tsocksMap[s.inode] = s\n\t}\n\tfor _, s := range ipv6socks {\n\t\tsocksMap[s.inode] = s\n\t}\n\n\tports = make(map[endpoint]int)\n\tfor _, pid := range pids.List {\n\t\tinodes, err := findSocketsOfPid(\"\", pid)\n\t\tif err != nil {\n\t\t\tlogp.Err(\"FindSocketsOfPid: %s\", err)\n\t\t\tcontinue\n\t\t}\n\n\t\tfor _, inode := range inodes {\n\t\t\tif sockInfo, exists := socksMap[inode]; exists {\n\t\t\t\tports[endpoint{address: sockInfo.srcIP.String(), port: sockInfo.srcPort}] = pid\n\t\t\t}\n\t\t}\n\t}\n\n\treturn ports, nil\n}", "title": "" }, { "docid": "1ed29a77b54e08555760d256d27b5ca3", "score": "0.42309064", "text": "func (inv *ActionActionStatePollInvocation) SetPathParamInt(param string, value int64) *ActionActionStatePollInvocation {\n\treturn inv.SetPathParamString(param, convertInt64ToString(value))\n}", "title": "" }, { "docid": "d79ff71900ad340ec2e4236ec717f56b", "score": "0.42046937", "text": "func (o PrometheusSpecPtrOutput) ListenLocal() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v *PrometheusSpec) *bool {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.ListenLocal\n\t}).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "b11bc8332bfd1623fce2304aa8b7f234", "score": "0.4201789", "text": "func (*NokiaConf_Configure_Ipsec_TsList_Local_Entry_Protocol_Id_ProtocolIdWithAnyPort_Union_E_NokiaConf_Configure_Ipsec_TsList_Local_Entry_Protocol_Id_ProtocolIdWithAnyPort) Is_NokiaConf_Configure_Ipsec_TsList_Local_Entry_Protocol_Id_ProtocolIdWithAnyPort_Union() {\n}", "title": "" }, { "docid": "71ddb62bf09b290d9fff13180933b28f", "score": "0.41943234", "text": "func (inv *ActionHostIpAddressAssignInvocation) SetPathParamString(param string, value string) *ActionHostIpAddressAssignInvocation {\n\tinv.Path = strings.Replace(inv.Path, \"{\"+param+\"}\", value, 1)\n\treturn inv\n}", "title": "" }, { "docid": "e0a916f16f84cabe8fda9e57a6f0e19a", "score": "0.41940895", "text": "func (o *StorageNetAppBaseIpInterface) SetCurrentPort(v string) {\n\to.CurrentPort = &v\n}", "title": "" }, { "docid": "f86bac24412db4cbbcd84e120c90f167", "score": "0.41896522", "text": "func (b *Builder) SetPort(p string) {\n\tif b.OCIv1.Config.ExposedPorts == nil {\n\t\tb.OCIv1.Config.ExposedPorts = map[string]struct{}{}\n\t}\n\tb.OCIv1.Config.ExposedPorts[p] = struct{}{}\n\tif b.Docker.Config.ExposedPorts == nil {\n\t\tb.Docker.Config.ExposedPorts = make(docker.PortSet)\n\t}\n\tb.Docker.Config.ExposedPorts[docker.Port(p)] = struct{}{}\n}", "title": "" }, { "docid": "a9f0a2658503b3412c5bbd6ecb68a5d3", "score": "0.41882712", "text": "func SetPort(p uint64) {\n\tport = p\n}", "title": "" }, { "docid": "0d9538afed5f631d00a114e42528140d", "score": "0.41863093", "text": "func Endpoint(ip string, port int) string {\n\treturn fmt.Sprintf(\"%s:%d\", ip, port)\n}", "title": "" }, { "docid": "da9026558a3d915baae26fd1f2e797c2", "score": "0.41843992", "text": "func WithLocalWriter(tag string, priority syslog.Priority, bufferLen int) Option {\n\treturn func(logger *Logger) error {\n\t\tw, err := writer.NewWriter(types.ConnectionLOCAL, \"\", tag, priority, bufferLen)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tlogger.writers.AddWriter(w)\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "efe7cd73f7a8c9b01088506273ec71eb", "score": "0.4184375", "text": "func (r *Reader) SetEndpoint(endpoint string) { r.MockEndpoint = endpoint }", "title": "" }, { "docid": "e92f2d8f7973757399ad4a82cf8719c3", "score": "0.41773662", "text": "func CollectorEndpointFromEnv() string {\n\treturn os.Getenv(envEndpoint)\n}", "title": "" }, { "docid": "4ea630057e09a71f19ff495456460441", "score": "0.41618884", "text": "func (o AlertmanagerSpecPtrOutput) ListenLocal() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v *AlertmanagerSpec) *bool {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.ListenLocal\n\t}).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "73652f1319a84acf1ff793a7308cd40a", "score": "0.41602707", "text": "func (o IpsecServerIkeConfigOutput) LocalId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v IpsecServerIkeConfig) *string { return v.LocalId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "d302189c4622e29b0d7c7900569839a3", "score": "0.41558945", "text": "func (e *Endpoint) SetPort(port int) {\n\te.port = port\n}", "title": "" }, { "docid": "2d90266ec6cec9e9e0f0d44ad0b3fedf", "score": "0.4154207", "text": "func Port(label string, local int) int {\n\tif *LocalUse {\n\t\tPortRegistry[label] = local\n\t\treturn local\n\t}\n\tif i, ok := PortRegistry[label]; ok {\n\t\treturn i\n\t}\n\ti := FreePort()\n\tPortRegistry[label] = i\n\treturn i\n}", "title": "" }, { "docid": "2fc2edfcaeafa404c33b004ea734fc13", "score": "0.415256", "text": "func (o AlertmanagerSpecInitContainersLivenessProbeTcpSocketOutput) Port() AlertmanagerSpecInitContainersLivenessProbeTcpSocketPortOutput {\n\treturn o.ApplyT(func(v AlertmanagerSpecInitContainersLivenessProbeTcpSocket) AlertmanagerSpecInitContainersLivenessProbeTcpSocketPort {\n\t\treturn v.Port\n\t}).(AlertmanagerSpecInitContainersLivenessProbeTcpSocketPortOutput)\n}", "title": "" }, { "docid": "902e12b5a6d76fb433f224166bc96e3c", "score": "0.41525042", "text": "func getLocalMemUsage(endpoints EndpointList, r *http.Request) ServerMemUsageInfo {\n\tvar memUsages []mem.Usage\n\tvar historicUsages []mem.Usage\n\tseenHosts := set.NewStringSet()\n\tfor _, endpoint := range endpoints {\n\t\tif seenHosts.Contains(endpoint.Host) {\n\t\t\tcontinue\n\t\t}\n\t\tseenHosts.Add(endpoint.Host)\n\n\t\t// Only proceed for local endpoints\n\t\tif endpoint.IsLocal {\n\t\t\tmemUsages = append(memUsages, mem.GetUsage())\n\t\t\thistoricUsages = append(historicUsages, mem.GetHistoricUsage())\n\t\t}\n\t}\n\taddr := r.Host\n\tif globalIsDistXL {\n\t\taddr = GetLocalPeer(endpoints)\n\t}\n\treturn ServerMemUsageInfo{\n\t\tAddr: addr,\n\t\tUsage: memUsages,\n\t\tHistoricUsage: historicUsages,\n\t}\n}", "title": "" }, { "docid": "11c2885756c5d621ffa520b78ad0029a", "score": "0.4148256", "text": "func LocalOptionCapability(c []byte) func(*Local) {\n\treturn func(l *Local) {\n\t\tl.Capability = c\n\t}\n}", "title": "" }, { "docid": "7482bfa32a77cbc7b87441a4029ee520", "score": "0.4146932", "text": "func (b *PodAttachmentApplyConfiguration) WithLocalIface(value string) *PodAttachmentApplyConfiguration {\n\tb.LocalIface = &value\n\treturn b\n}", "title": "" }, { "docid": "193ceff312949da71a655339426bf235", "score": "0.4142393", "text": "func (o PrometheusSpecInitContainersLivenessProbeTcpSocketOutput) Port() PrometheusSpecInitContainersLivenessProbeTcpSocketPortOutput {\n\treturn o.ApplyT(func(v PrometheusSpecInitContainersLivenessProbeTcpSocket) PrometheusSpecInitContainersLivenessProbeTcpSocketPort {\n\t\treturn v.Port\n\t}).(PrometheusSpecInitContainersLivenessProbeTcpSocketPortOutput)\n}", "title": "" }, { "docid": "f483ba183f08b90b004dad03adf44ed4", "score": "0.41417918", "text": "func (o PrometheusSpecThanosPtrOutput) ListenLocal() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v *PrometheusSpecThanos) *bool {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.ListenLocal\n\t}).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "dc8e0301a166ff448a33da18f7863dc1", "score": "0.41352794", "text": "func (o PrometheusSpecInitContainersLivenessProbeTcpSocketPtrOutput) Port() PrometheusSpecInitContainersLivenessProbeTcpSocketPortPtrOutput {\n\treturn o.ApplyT(func(v *PrometheusSpecInitContainersLivenessProbeTcpSocket) *PrometheusSpecInitContainersLivenessProbeTcpSocketPort {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Port\n\t}).(PrometheusSpecInitContainersLivenessProbeTcpSocketPortPtrOutput)\n}", "title": "" }, { "docid": "7c5572cc5c3cafd207b8dcfb01e21fdd", "score": "0.41328925", "text": "func (t *Transcoder) SetInternalHTTPPort(port string) {\n\tt.internalListenerPort = port\n}", "title": "" }, { "docid": "fd1a88b8f2964850745012fbaf24a293", "score": "0.41191778", "text": "func (o AlertmanagerSpecInitContainersLivenessProbeTcpSocketPtrOutput) Port() AlertmanagerSpecInitContainersLivenessProbeTcpSocketPortPtrOutput {\n\treturn o.ApplyT(func(v *AlertmanagerSpecInitContainersLivenessProbeTcpSocket) *AlertmanagerSpecInitContainersLivenessProbeTcpSocketPort {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Port\n\t}).(AlertmanagerSpecInitContainersLivenessProbeTcpSocketPortPtrOutput)\n}", "title": "" }, { "docid": "ca99a159e89f3f11301d58c8212692c7", "score": "0.41177553", "text": "func (o AlertmanagerSpecInitContainersLifecyclePreStopTcpSocketOutput) Port() AlertmanagerSpecInitContainersLifecyclePreStopTcpSocketPortOutput {\n\treturn o.ApplyT(func(v AlertmanagerSpecInitContainersLifecyclePreStopTcpSocket) AlertmanagerSpecInitContainersLifecyclePreStopTcpSocketPort {\n\t\treturn v.Port\n\t}).(AlertmanagerSpecInitContainersLifecyclePreStopTcpSocketPortOutput)\n}", "title": "" }, { "docid": "c660cd183407c0d8c7a60aa7d10f25e3", "score": "0.41167346", "text": "func SetPorts(ports ...api.ServicePort) Tweak {\n\treturn func(svc *api.Service) {\n\t\tsvc.Spec.Ports = ports\n\t}\n}", "title": "" }, { "docid": "b1eafda441b7aae371d74d045bfeb160", "score": "0.41156387", "text": "func (ap *ApplicationPolicy) AddServicePort(start, end, proto int) error {\n\tm := make(map[string]interface{})\n\tm[\"start_port\"] = start\n\tm[\"end_port\"] = end\n\tm[\"proto\"] = proto\n\tm[\"version\"] = fmt.Sprintf(\"v%d\", ap.a.LatestVersion)\n\n\tjsonStr, err := json.Marshal(m)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error Marshalling service port %s\", err)\n\t}\n\n\tpostURL := fmt.Sprintf(\"/policies/%s/l4_params\", ap.ID)\n\n\t_, err = ap.a.h4.Post(postURL, fmt.Sprintf(\"%s\", jsonStr))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"POST error: %s / POST: %s\", err.Error(), jsonStr)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "8f7a9cda4f162bb3e5f8244791f9b4f7", "score": "0.4110378", "text": "func (b *ThanosSpecApplyConfiguration) WithHTTPListenLocal(value bool) *ThanosSpecApplyConfiguration {\n\tb.HTTPListenLocal = &value\n\treturn b\n}", "title": "" }, { "docid": "647fcd58e38cc9a082713720913f8fa2", "score": "0.40973416", "text": "func InterpretPort(next echo.HandlerFunc) echo.HandlerFunc {\n\treturn func(c echo.Context) error {\n\t\tport, err := strconv.Atoi(c.Param(\"port\"))\n\t\tif err != nil {\n\t\t\treturn Error(c, ErrInvalidPort)\n\t\t}\n\t\tif port <= 0 || 65536 <= port {\n\t\t\treturn Error(c, ErrInvalidPort)\n\t\t}\n\t\tc.Set(\"port\", port)\n\n\t\treturn next(c)\n\t}\n}", "title": "" }, { "docid": "5744c37a57c935b161808ae71370c894", "score": "0.4093643", "text": "func (a *api) EnablePublicEndpointPort(serviceid, endpointName, portAddr string, isEnabled bool) error {\n\tclient, err := a.connectMaster()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn client.EnablePublicEndpointPort(serviceid, endpointName, portAddr, isEnabled)\n}", "title": "" }, { "docid": "a017db5aa1a95166ff7d871dce201cf1", "score": "0.40891385", "text": "func (inv *ActionUserClusterResourcePackageUpdateInvocation) SetPathParamInt(param string, value int64) *ActionUserClusterResourcePackageUpdateInvocation {\n\treturn inv.SetPathParamString(param, convertInt64ToString(value))\n}", "title": "" }, { "docid": "47620b26ebd18a0326b5b674bbe30f4c", "score": "0.4088782", "text": "func NewLocal(port int, dims uint, maxrequests int, seedaddr string) (*Local, error) {\n\tvar id uint64\n\n\tip := getip()\n\n\tlocal := &Local{\n\t\tNode: Node{\n\t\t\tID: 0,\n\t\t\tIP: ip,\n\t\t\tPort: port,\n\t\t},\n\t\tdims: dims,\n\t\tdata: make(map[string][]byte),\n\t\tdatalock: &sync.RWMutex{},\n\t\tpeers: nil,\n\t\tpeerlock: &sync.RWMutex{},\n\t\toperational: &sync.RWMutex{},\n\t\tmutex: common.NewIntExtLock(),\n\t\tsem: util.NewSemaphore(maxrequests),\n\t}\n\tlocal.startRPC()\n\tif seedaddr != \"\" {\n\t\tlocal.operational.Lock()\n\t\tdefer local.operational.Unlock()\n\t\tpeer, err := NewPeer(seedaddr)\n\n\t\t//Get the number of dimensions\n\t\tdims, err = peer.GetDims()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tid, err = peer.AssistBootstrap(fmt.Sprintf(\"%v:%v\", ip, port))\n\t\tlocal.peers = NewPeers(id, dims)\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t\treturn nil, err\n\t\t}\n\t\tlocal.Node.ID = id\n\t\tlocal.dims = dims\n\t\t//fmt.Println(\"release\", id)\n\t\tlocal.getPeers(peer)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t} else {\n\t\tlocal.peers = NewPeers(id, dims)\n\t}\n\t//TBI: id deciding, initial greeting\n\treturn local, nil\n}", "title": "" }, { "docid": "d919ad0b9dfde6908a89477132206828", "score": "0.40887034", "text": "func (o PrometheusSpecInitContainersStartupProbeTcpSocketOutput) Port() PrometheusSpecInitContainersStartupProbeTcpSocketPortOutput {\n\treturn o.ApplyT(func(v PrometheusSpecInitContainersStartupProbeTcpSocket) PrometheusSpecInitContainersStartupProbeTcpSocketPort {\n\t\treturn v.Port\n\t}).(PrometheusSpecInitContainersStartupProbeTcpSocketPortOutput)\n}", "title": "" } ]
1a73d1c0a708913d9d376201d86a4ca3
NewCreateLookmlDashboardRenderTaskParamsWithContext creates a new CreateLookmlDashboardRenderTaskParams object with the default values initialized, and the ability to set a context for a request
[ { "docid": "fa3103f5ec6f547c28b0e4dd82cffc3a", "score": "0.8227336", "text": "func NewCreateLookmlDashboardRenderTaskParamsWithContext(ctx context.Context) *CreateLookmlDashboardRenderTaskParams {\n\tvar ()\n\treturn &CreateLookmlDashboardRenderTaskParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" } ]
[ { "docid": "af78d3d35f9e16322cb4c315f5f4a71b", "score": "0.7806261", "text": "func NewCreateLookmlDashboardRenderTaskParams() *CreateLookmlDashboardRenderTaskParams {\n\tvar ()\n\treturn &CreateLookmlDashboardRenderTaskParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "e8e14d5bc16636eb55fae4409d16da99", "score": "0.77714026", "text": "func (o *CreateLookmlDashboardRenderTaskParams) WithContext(ctx context.Context) *CreateLookmlDashboardRenderTaskParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "48350a11b615d0d73cec899dac2f730d", "score": "0.7314788", "text": "func NewCreateLookmlDashboardRenderTaskParamsWithHTTPClient(client *http.Client) *CreateLookmlDashboardRenderTaskParams {\n\tvar ()\n\treturn &CreateLookmlDashboardRenderTaskParams{\n\t\tHTTPClient: client,\n\t}\n}", "title": "" }, { "docid": "56346cb33daf765f9a8dfa814a076551", "score": "0.7302523", "text": "func (o *CreateLookmlDashboardRenderTaskParams) WithFields(fields *string) *CreateLookmlDashboardRenderTaskParams {\n\to.SetFields(fields)\n\treturn o\n}", "title": "" }, { "docid": "c87ebb4f1cf7f8d04efc0eae47fbd018", "score": "0.71615833", "text": "func NewCreateLookmlDashboardRenderTaskParamsWithTimeout(timeout time.Duration) *CreateLookmlDashboardRenderTaskParams {\n\tvar ()\n\treturn &CreateLookmlDashboardRenderTaskParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "title": "" }, { "docid": "cdbb271d3aa65b906cf7c1c555baea09", "score": "0.69104314", "text": "func (o *CreateLookmlDashboardRenderTaskParams) WithBody(body *models.CreateDashboardRenderTask) *CreateLookmlDashboardRenderTaskParams {\n\to.SetBody(body)\n\treturn o\n}", "title": "" }, { "docid": "eb6e466d9cf2c6f6f869ec04b645a298", "score": "0.687789", "text": "func (o *CreateLookmlDashboardRenderTaskParams) WithTimeout(timeout time.Duration) *CreateLookmlDashboardRenderTaskParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "title": "" }, { "docid": "13653f0d6612814d2b00ac0a0f9fbe9a", "score": "0.6671448", "text": "func (o *CreateLookmlDashboardRenderTaskParams) WithHeight(height int64) *CreateLookmlDashboardRenderTaskParams {\n\to.SetHeight(height)\n\treturn o\n}", "title": "" }, { "docid": "3d66333db5729f4c76feaa450f013770", "score": "0.637885", "text": "func (o *CreateLookmlDashboardRenderTaskParams) WithWidth(width int64) *CreateLookmlDashboardRenderTaskParams {\n\to.SetWidth(width)\n\treturn o\n}", "title": "" }, { "docid": "775481461ebb380f4437209c02e38b4e", "score": "0.6178911", "text": "func (o *CreateLookmlDashboardRenderTaskParams) WithHTTPClient(client *http.Client) *CreateLookmlDashboardRenderTaskParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "title": "" }, { "docid": "a9d715eb523810955d6c5ac854809128", "score": "0.5928705", "text": "func (o *CreateLookmlDashboardRenderTaskParams) WithDashboardID(dashboardID string) *CreateLookmlDashboardRenderTaskParams {\n\to.SetDashboardID(dashboardID)\n\treturn o\n}", "title": "" }, { "docid": "d352452762d31b3078e01294db33bc6e", "score": "0.55717236", "text": "func (o *CreateLookmlDashboardRenderTaskParams) WithPdfLandscape(pdfLandscape *bool) *CreateLookmlDashboardRenderTaskParams {\n\to.SetPdfLandscape(pdfLandscape)\n\treturn o\n}", "title": "" }, { "docid": "6d939e1a3fd2d9a35d7c6f1770384d22", "score": "0.53742933", "text": "func (o *CreateLookmlDashboardRenderTaskParams) WithPdfPaperSize(pdfPaperSize *string) *CreateLookmlDashboardRenderTaskParams {\n\to.SetPdfPaperSize(pdfPaperSize)\n\treturn o\n}", "title": "" }, { "docid": "6841a2e262d87cf297b089d36518d01e", "score": "0.53200525", "text": "func (o *ScheduledPlansForLookmlDashboardParams) WithContext(ctx context.Context) *ScheduledPlansForLookmlDashboardParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "f9b5a8aff4a42c5359135ef9a7008dd7", "score": "0.52098525", "text": "func (o *CreateLookmlDashboardRenderTaskParams) WithResultFormat(resultFormat string) *CreateLookmlDashboardRenderTaskParams {\n\to.SetResultFormat(resultFormat)\n\treturn o\n}", "title": "" }, { "docid": "60e1a41b9d5eeda859eed73402f04ae4", "score": "0.5083139", "text": "func (o *CreateLookmlDashboardRenderTaskParams) 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.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param dashboard_id\n\tif err := r.SetPathParam(\"dashboard_id\", o.DashboardID); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Fields != nil {\n\n\t\t// query param fields\n\t\tvar qrFields string\n\t\tif o.Fields != nil {\n\t\t\tqrFields = *o.Fields\n\t\t}\n\t\tqFields := qrFields\n\t\tif qFields != \"\" {\n\t\t\tif err := r.SetQueryParam(\"fields\", qFields); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// query param height\n\tqrHeight := o.Height\n\tqHeight := swag.FormatInt64(qrHeight)\n\tif qHeight != \"\" {\n\t\tif err := r.SetQueryParam(\"height\", qHeight); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.PdfLandscape != nil {\n\n\t\t// query param pdf_landscape\n\t\tvar qrPdfLandscape bool\n\t\tif o.PdfLandscape != nil {\n\t\t\tqrPdfLandscape = *o.PdfLandscape\n\t\t}\n\t\tqPdfLandscape := swag.FormatBool(qrPdfLandscape)\n\t\tif qPdfLandscape != \"\" {\n\t\t\tif err := r.SetQueryParam(\"pdf_landscape\", qPdfLandscape); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.PdfPaperSize != nil {\n\n\t\t// query param pdf_paper_size\n\t\tvar qrPdfPaperSize string\n\t\tif o.PdfPaperSize != nil {\n\t\t\tqrPdfPaperSize = *o.PdfPaperSize\n\t\t}\n\t\tqPdfPaperSize := qrPdfPaperSize\n\t\tif qPdfPaperSize != \"\" {\n\t\t\tif err := r.SetQueryParam(\"pdf_paper_size\", qPdfPaperSize); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// path param result_format\n\tif err := r.SetPathParam(\"result_format\", o.ResultFormat); err != nil {\n\t\treturn err\n\t}\n\n\t// query param width\n\tqrWidth := o.Width\n\tqWidth := swag.FormatInt64(qrWidth)\n\tif qWidth != \"\" {\n\t\tif err := r.SetQueryParam(\"width\", qWidth); 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": "41583e7d884abfed34c14ea8b1519e06", "score": "0.5008801", "text": "func (o *ScheduledPlansForLookmlDashboardParams) WithLookmlDashboardID(lookmlDashboardID int64) *ScheduledPlansForLookmlDashboardParams {\n\to.SetLookmlDashboardID(lookmlDashboardID)\n\treturn o\n}", "title": "" }, { "docid": "3fbd0540345b3544b171858c4ffad071", "score": "0.4814054", "text": "func (o *ScheduledPlansForLookmlDashboardParams) WithFields(fields *string) *ScheduledPlansForLookmlDashboardParams {\n\to.SetFields(fields)\n\treturn o\n}", "title": "" }, { "docid": "42b6d868ba38a73426df1dbea09cdcfc", "score": "0.48076627", "text": "func (o *ScheduledPlansForLookmlDashboardParams) SetLookmlDashboardID(lookmlDashboardID int64) {\n\to.LookmlDashboardID = lookmlDashboardID\n}", "title": "" }, { "docid": "0b785e9eeb592494fc218bf129caed99", "score": "0.4614212", "text": "func NewScheduledPlansForLookmlDashboardParams() *ScheduledPlansForLookmlDashboardParams {\n\tvar ()\n\treturn &ScheduledPlansForLookmlDashboardParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "ac1cc79e8020cf3dd177146b6be8a9a8", "score": "0.44682515", "text": "func (o *ScheduledPlansForLookmlDashboardParams) WithTimeout(timeout time.Duration) *ScheduledPlansForLookmlDashboardParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "title": "" }, { "docid": "08cd497fdfe8101b29288253170c2c43", "score": "0.446426", "text": "func NewScheduledPlansForLookmlDashboardParamsWithContext(ctx context.Context) *ScheduledPlansForLookmlDashboardParams {\n\tvar ()\n\treturn &ScheduledPlansForLookmlDashboardParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "c0da254a39d76958adb055abbd16e66d", "score": "0.43856573", "text": "func (c *Client) CreateDBDiagReportTaskWithContext(ctx context.Context, request *CreateDBDiagReportTaskRequest) (response *CreateDBDiagReportTaskResponse, err error) {\n if request == nil {\n request = NewCreateDBDiagReportTaskRequest()\n }\n \n if c.GetCredential() == nil {\n return nil, errors.New(\"CreateDBDiagReportTask require credential\")\n }\n\n request.SetContext(ctx)\n \n response = NewCreateDBDiagReportTaskResponse()\n err = c.Send(request, response)\n return\n}", "title": "" }, { "docid": "14538f252274aba93ebb136336a03225", "score": "0.42937127", "text": "func NewScheduledPlansForLookmlDashboardParamsWithTimeout(timeout time.Duration) *ScheduledPlansForLookmlDashboardParams {\n\tvar ()\n\treturn &ScheduledPlansForLookmlDashboardParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "title": "" }, { "docid": "bc701caec548f2514b0c57aa9546e239", "score": "0.42022258", "text": "func (o *CreateLookmlDashboardRenderTaskParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "dfef2028040f8834669ff8beb5c5abb4", "score": "0.41757378", "text": "func NewLookParams() *LookParams {\n\tvar ()\n\treturn &LookParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "9309abc4052007c5a0aa5546e269dd15", "score": "0.4065151", "text": "func NewScheduledPlansForLookmlDashboardParamsWithHTTPClient(client *http.Client) *ScheduledPlansForLookmlDashboardParams {\n\tvar ()\n\treturn &ScheduledPlansForLookmlDashboardParams{\n\t\tHTTPClient: client,\n\t}\n}", "title": "" }, { "docid": "e4a211a526bdc1a3e836e851885f5d08", "score": "0.40303954", "text": "func (o *ScheduledPlansForLookmlDashboardParams) WithUserID(userID *int64) *ScheduledPlansForLookmlDashboardParams {\n\to.SetUserID(userID)\n\treturn o\n}", "title": "" }, { "docid": "297d292fb8cf207893db355f10bae684", "score": "0.38957784", "text": "func (o *CreateLookmlDashboardRenderTaskParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "dbd1cc2f3cad3936602f8294985f4258", "score": "0.3833767", "text": "func (o *CreateLookmlDashboardRenderTaskParams) SetHeight(height int64) {\n\to.Height = height\n}", "title": "" }, { "docid": "9e4de10888a0a085b89f8b8d3f347f07", "score": "0.37430766", "text": "func (o *ScheduledPlansForLookmlDashboardParams) 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.AllUsers != nil {\n\n\t\t// query param all_users\n\t\tvar qrAllUsers bool\n\t\tif o.AllUsers != nil {\n\t\t\tqrAllUsers = *o.AllUsers\n\t\t}\n\t\tqAllUsers := swag.FormatBool(qrAllUsers)\n\t\tif qAllUsers != \"\" {\n\t\t\tif err := r.SetQueryParam(\"all_users\", qAllUsers); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Fields != nil {\n\n\t\t// query param fields\n\t\tvar qrFields string\n\t\tif o.Fields != nil {\n\t\t\tqrFields = *o.Fields\n\t\t}\n\t\tqFields := qrFields\n\t\tif qFields != \"\" {\n\t\t\tif err := r.SetQueryParam(\"fields\", qFields); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// path param lookml_dashboard_id\n\tif err := r.SetPathParam(\"lookml_dashboard_id\", swag.FormatInt64(o.LookmlDashboardID)); err != nil {\n\t\treturn err\n\t}\n\n\tif o.UserID != nil {\n\n\t\t// query param user_id\n\t\tvar qrUserID int64\n\t\tif o.UserID != nil {\n\t\t\tqrUserID = *o.UserID\n\t\t}\n\t\tqUserID := swag.FormatInt64(qrUserID)\n\t\tif qUserID != \"\" {\n\t\t\tif err := r.SetQueryParam(\"user_id\", qUserID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d95e3d6c95780ee7be7d2104e2f97316", "score": "0.37036118", "text": "func (o *ScheduledPlansForLookmlDashboardParams) WithHTTPClient(client *http.Client) *ScheduledPlansForLookmlDashboardParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "title": "" }, { "docid": "bc08e8feab9d5b680b0d01c8c2bdf9b1", "score": "0.36822927", "text": "func NewRenderRunner(workingDir string, opts ...Options) *RenderRunner {\n\trunner := &RenderRunner{Project: &Project{workingDir: workingDir}}\n\trunner.Init(opts...)\n\treturn runner\n}", "title": "" }, { "docid": "f9a1061595237b375de64b6050b8027f", "score": "0.3658608", "text": "func (c *Client) ModifyLivePullStreamTaskWithContext(ctx context.Context, request *ModifyLivePullStreamTaskRequest) (response *ModifyLivePullStreamTaskResponse, err error) {\n if request == nil {\n request = NewModifyLivePullStreamTaskRequest()\n }\n \n if c.GetCredential() == nil {\n return nil, errors.New(\"ModifyLivePullStreamTask require credential\")\n }\n\n request.SetContext(ctx)\n \n response = NewModifyLivePullStreamTaskResponse()\n err = c.Send(request, response)\n return\n}", "title": "" }, { "docid": "dca09a0a119dc91f1753897f007d9f01", "score": "0.36338818", "text": "func (o *CreateLookmlDashboardRenderTaskParams) SetFields(fields *string) {\n\to.Fields = fields\n}", "title": "" }, { "docid": "7fb17ebb666fe28d2a81ec46fe9be9a0", "score": "0.3599817", "text": "func newWorkflowTaskPoller(\n\ttaskHandler WorkflowTaskHandler,\n\tldaTunnel *locallyDispatchedActivityTunnel,\n\tservice workflowserviceclient.Interface,\n\tdomain string,\n\tparams workerExecutionParameters,\n) *workflowTaskPoller {\n\treturn &workflowTaskPoller{\n\t\tbasePoller: basePoller{shutdownC: params.WorkerStopChannel},\n\t\tservice: service,\n\t\tdomain: domain,\n\t\ttaskListName: params.TaskList,\n\t\tidentity: params.Identity,\n\t\ttaskHandler: taskHandler,\n\t\tldaTunnel: ldaTunnel,\n\t\tmetricsScope: metrics.NewTaggedScope(params.MetricsScope),\n\t\tlogger: params.Logger,\n\t\tstickyUUID: uuid.New(),\n\t\tdisableStickyExecution: params.DisableStickyExecution,\n\t\tStickyScheduleToStartTimeout: params.StickyScheduleToStartTimeout,\n\t\tfeatureFlags: params.FeatureFlags,\n\t}\n}", "title": "" }, { "docid": "c9dd0e18840aa52f5b18c7ad3522eba5", "score": "0.35937887", "text": "func (o *LookParams) WithLookID(LookID int64) *LookParams {\n\to.LookID = LookID\n\treturn o\n}", "title": "" }, { "docid": "d25c1a647fe158f5b84904866588fc35", "score": "0.35745862", "text": "func (_m *Mockec2API) CreateInstanceExportTaskWithContext(_parameter_0 context.Context, _parameter_1 *ec2.CreateInstanceExportTaskInput, _parameter_2 ...request.Option) (_result_0 *ec2.CreateInstanceExportTaskOutput, _result_1 error) {\n\tvarParams := make([]interface{}, 2+len(_parameter_2))\n\tvarParams[0] = _parameter_0\n\tvarParams[1] = _parameter_1\n\tfor varIndex, varParam := range _parameter_2 {\n\t\tvarParams[2+varIndex] = varParam\n\t}\n\n\tret := _m.Called(varParams...)\n\n\tvar r0 *ec2.CreateInstanceExportTaskOutput\n\tif rf, ok := ret.Get(0).(func(context.Context, *ec2.CreateInstanceExportTaskInput, ...request.Option) *ec2.CreateInstanceExportTaskOutput); ok {\n\t\tr0 = rf(_parameter_0, _parameter_1, _parameter_2...)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*ec2.CreateInstanceExportTaskOutput)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(context.Context, *ec2.CreateInstanceExportTaskInput, ...request.Option) error); ok {\n\t\tr1 = rf(_parameter_0, _parameter_1, _parameter_2...)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "effb9a569ef0d1d46e57e0023f5fd8c0", "score": "0.35727993", "text": "func (o *DcimPowerPortTemplatesListParams) WithAllocatedDrawLte(allocatedDrawLte *string) *DcimPowerPortTemplatesListParams {\n\to.SetAllocatedDrawLte(allocatedDrawLte)\n\treturn o\n}", "title": "" }, { "docid": "ac4fb12522d6741167a04030592b3182", "score": "0.35699338", "text": "func NewPutLTENetworkIDGatewaysGatewayIDCellularPoolingParams() *PutLTENetworkIDGatewaysGatewayIDCellularPoolingParams {\n\tvar ()\n\treturn &PutLTENetworkIDGatewaysGatewayIDCellularPoolingParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "1a18602e4500431bb82bb1a2f7570885", "score": "0.35579163", "text": "func (c *Client) CreateLivePullStreamTaskWithContext(ctx context.Context, request *CreateLivePullStreamTaskRequest) (response *CreateLivePullStreamTaskResponse, err error) {\n if request == nil {\n request = NewCreateLivePullStreamTaskRequest()\n }\n \n if c.GetCredential() == nil {\n return nil, errors.New(\"CreateLivePullStreamTask require credential\")\n }\n\n request.SetContext(ctx)\n \n response = NewCreateLivePullStreamTaskResponse()\n err = c.Send(request, response)\n return\n}", "title": "" }, { "docid": "ed5c0173e55a082e92dd87ad0958d7e7", "score": "0.3537123", "text": "func NewLookParamsWithTimeout(timeout time.Duration) *LookParams {\n\tvar ()\n\treturn &LookParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "title": "" }, { "docid": "7160e8299ec8a52dc3fcd4b7ffac15f9", "score": "0.35221282", "text": "func NewRender(options RenderOptions) *Render {\n\tr := Render{\n\t\topt: options,\n\t}\n\n\tr.prepareOptions()\n\tr.compileTemplates()\n\n\treturn &r\n}", "title": "" }, { "docid": "8b10ff76f377cf3b9dd0775b56e5e0d4", "score": "0.35214493", "text": "func (o *IpamRouteTargetsListParams) WithCreatedLte(createdLte *string) *IpamRouteTargetsListParams {\n\to.SetCreatedLte(createdLte)\n\treturn o\n}", "title": "" }, { "docid": "effaca440db71aa1a53a5c2ee90c8e7c", "score": "0.34944335", "text": "func (o *CreateLookmlDashboardRenderTaskParams) SetBody(body *models.CreateDashboardRenderTask) {\n\to.Body = body\n}", "title": "" }, { "docid": "a598be52a2e58613f566cc9ad83df805", "score": "0.3486776", "text": "func (o *CreateLookmlDashboardRenderTaskParams) SetDashboardID(dashboardID string) {\n\to.DashboardID = dashboardID\n}", "title": "" }, { "docid": "fa4fdfb189c9ded453cd4b63d425c1ee", "score": "0.34850422", "text": "func NewDashboardParams() *DashboardParams {\n\tvar ()\n\treturn &DashboardParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "62dfb815f5b6dbedf0cd8e415d99a4ea", "score": "0.34839618", "text": "func (p *provider) CreateWithContext(\n\tctx context.Context,\n\turn resource.URN,\n\tcheckedInputs resource.PropertyMap,\n\ttimeout float64,\n\tpreview bool,\n) (resource.ID, resource.PropertyMap, resource.Status, error) {\n\tctx = p.initLogging(ctx, p.logSink, urn)\n\n\trh, err := p.resourceHandle(ctx, urn)\n\tif err != nil {\n\t\treturn \"\", nil, 0, err\n\t}\n\n\ttfType := rh.schema.Type().TerraformType(ctx).(tftypes.Object)\n\n\tpriorState := newResourceState(ctx, &rh, nil /*private state*/)\n\n\tcheckedInputsValue, err := convert.EncodePropertyMap(rh.encoder, checkedInputs)\n\tif err != nil {\n\t\treturn \"\", nil, 0, err\n\t}\n\n\tplanResp, err := p.plan(ctx, rh.terraformResourceName, rh.schema, priorState, checkedInputsValue)\n\tif err != nil {\n\t\treturn \"\", nil, 0, err\n\t}\n\n\tif err := p.processDiagnostics(planResp.Diagnostics); err != nil {\n\t\treturn \"\", nil, 0, err\n\t}\n\n\t// NOTE: it seems that planResp.RequiresReplace can be ignored in Create and must be false.\n\n\tif preview {\n\t\tplannedStatePropertyMap, err := convert.DecodePropertyMapFromDynamic(\n\t\t\trh.decoder, tfType, planResp.PlannedState)\n\t\tif err != nil {\n\t\t\treturn \"\", nil, 0, err\n\t\t}\n\t\treturn \"\", plannedStatePropertyMap, resource.StatusOK, nil\n\t}\n\n\tpriorStateValue, configValue, err := makeDynamicValues2(priorState.state.Value, checkedInputsValue)\n\tif err != nil {\n\t\treturn \"\", nil, 0, err\n\t}\n\n\treq := tfprotov6.ApplyResourceChangeRequest{\n\t\tTypeName: rh.terraformResourceName,\n\t\tPriorState: &priorStateValue,\n\t\tPlannedState: planResp.PlannedState,\n\t\tConfig: &configValue,\n\t\tPlannedPrivate: planResp.PlannedPrivate,\n\t\t// TODO[pulumi/pulumi-terraform-bridge#794] set ProviderMeta\n\t\t//\n\t\t// See https://www.terraform.io/internals/provider-meta\n\t}\n\n\tresp, err := p.tfServer.ApplyResourceChange(ctx, &req)\n\tif err != nil {\n\t\treturn \"\", nil, 0, err\n\t}\n\n\tif err := p.processDiagnostics(resp.Diagnostics); err != nil {\n\t\treturn \"\", nil, 0, err\n\t}\n\n\tcreatedState, err := parseResourceStateFromTF(ctx, &rh, resp.NewState, resp.Private)\n\tif err != nil {\n\t\treturn \"\", nil, 0, err\n\t}\n\n\tcreatedStateMap, err := createdState.ToPropertyMap(&rh)\n\tif err != nil {\n\t\treturn \"\", nil, 0, err\n\t}\n\n\tcreatedID, err := createdState.ExtractID(&rh)\n\tif err != nil {\n\t\treturn \"\", nil, 0, err\n\t}\n\n\treturn createdID, createdStateMap, resource.StatusOK, nil\n}", "title": "" }, { "docid": "c0459b439fde0091f2a3b1c5dbd85d5d", "score": "0.34739566", "text": "func (o *PutLTENetworkIDGatewaysGatewayIDCellularPoolingParams) WithResource(resource []*models.CellularGatewayPoolRecord) *PutLTENetworkIDGatewaysGatewayIDCellularPoolingParams {\n\to.SetResource(resource)\n\treturn o\n}", "title": "" }, { "docid": "7bb6b8e616dc55066279fd2366dede1e", "score": "0.3459732", "text": "func NewMocktaskRunner(ctrl *gomock.Controller) *MocktaskRunner {\n\tmock := &MocktaskRunner{ctrl: ctrl}\n\tmock.recorder = &MocktaskRunnerMockRecorder{mock}\n\treturn mock\n}", "title": "" }, { "docid": "8d72e878a591786a6301f3b3544b5fe4", "score": "0.34537697", "text": "func NewReport(task *config.TaskConfig) *Report {\n\treturn &Report{\n\t\tTableResults: make(map[string]map[string]*TableResult),\n\t\tResult: Pass,\n\t\ttask: task,\n\t}\n}", "title": "" }, { "docid": "82d4db2cab7890251f6d0d1bbbca302e", "score": "0.3450364", "text": "func (o *CreateNodeDeploymentParams) WithContext(ctx context.Context) *CreateNodeDeploymentParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "772c9f6f7cdf1ea14322c305a28aee97", "score": "0.34378988", "text": "func (o *DcimPowerPortTemplatesListParams) WithAllocatedDrawLt(allocatedDrawLt *string) *DcimPowerPortTemplatesListParams {\n\to.SetAllocatedDrawLt(allocatedDrawLt)\n\treturn o\n}", "title": "" }, { "docid": "ba9bb19c30d009cff6d1313c100c4bc4", "score": "0.34296927", "text": "func (o *CreateFolderParams) WithContext(ctx context.Context) *CreateFolderParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "c4429224db9e3368bda8a2b27579756c", "score": "0.340458", "text": "func (o *CreateReportParams) WithBody(body *dynatrace.DashboardReport) *CreateReportParams {\n\to.SetBody(body)\n\treturn o\n}", "title": "" }, { "docid": "6f1c865b8fe402588239afdf1a3af365", "score": "0.3395104", "text": "func NewShowTicketParams() *ShowTicketParams {\n\tvar ()\n\treturn &ShowTicketParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "085e993eba279a5c05e8c1073b997059", "score": "0.33912954", "text": "func NewFIFOScheduler[T Task](\n\toptions *FIFOSchedulerOptions,\n\tlogger log.Logger,\n) *FIFOScheduler[T] {\n\treturn &FIFOScheduler[T]{\n\t\tstatus: common.DaemonStatusInitialized,\n\t\toptions: options,\n\n\t\tlogger: logger,\n\n\t\ttasksChan: make(chan T, options.QueueSize),\n\t\tshutdownChan: make(chan struct{}),\n\t}\n}", "title": "" }, { "docid": "84fe026d7aa742b5c4dfdb6ed26f73b3", "score": "0.33882833", "text": "func (o *PutLTENetworkIDGatewaysGatewayIDCellularPoolingParams) WithContext(ctx context.Context) *PutLTENetworkIDGatewaysGatewayIDCellularPoolingParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "ce5d6dc57720fefe38f3b3ab08b44c3e", "score": "0.3387016", "text": "func NewTask(pctx context.Context, taskType string) (context.Context, *trace.Task,)", "title": "" }, { "docid": "531c291b7085e9afe8e9136a1474c0df", "score": "0.3381952", "text": "func (o *IpamRouteTargetsListParams) WithCreatedn(createdn *string) *IpamRouteTargetsListParams {\n\to.SetCreatedn(createdn)\n\treturn o\n}", "title": "" }, { "docid": "121ed8f2cb4f6c906374a87188318936", "score": "0.3363573", "text": "func NewPostWalletUnlockParamsWithContext(ctx context.Context) *PostWalletUnlockParams {\n\treturn &PostWalletUnlockParams{\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "ab10df9f66de01b07095051704a3b495", "score": "0.3358784", "text": "func NewShowTicketParamsWithContext(ctx context.Context) *ShowTicketParams {\n\tvar ()\n\treturn &ShowTicketParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "5e614363a17ef0e5bee4a47e31ef869b", "score": "0.33479002", "text": "func (o *DcimPowerPortTemplatesListParams) SetCreatedLte(createdLte *string) {\n\to.CreatedLte = createdLte\n}", "title": "" }, { "docid": "0a143f49723a6e788b5a2cc62f6302cd", "score": "0.33176777", "text": "func NewTask(raw string, taskarg []string) (*Task, error) {\n\t//check prams\n\tif raw == \"\" {\n\t\treturn nil, errors.New(\"params can not be null\")\n\t}\n\n\tt := new(Task)\n\tif t == nil {\n\t\treturn nil, errors.New(\"there is no space to create struct\")\n\t}\n\n\tlogger.Info(\"raw : \", raw)\n\n\t//pass params\n\tt.Raw = raw\n\tt.parseRaw()\n\n\tjsonColumn, err := t.parseJson()\n\tif err != nil {\n\t\treturn t, nil\n\t}\n\tt.jsonData = jsonColumn\n\n\tt.phpServerIp = taskarg[0]\n\tt.waterPath = taskarg[1]\n\n\treturn t, nil\n\n}", "title": "" }, { "docid": "91261285f4223f89e225cb43e90f021b", "score": "0.3305364", "text": "func (o *DcimPowerPortTemplatesListParams) WithCreatedLte(createdLte *string) *DcimPowerPortTemplatesListParams {\n\to.SetCreatedLte(createdLte)\n\treturn o\n}", "title": "" }, { "docid": "c6118f38858f4a43d58386cce7938558", "score": "0.33044273", "text": "func (o *IpamRouteTargetsListParams) SetCreatedLte(createdLte *string) {\n\to.CreatedLte = createdLte\n}", "title": "" }, { "docid": "242b61a3b2fef77783a9fbe7d3df997d", "score": "0.3295328", "text": "func NewTendermint(n paxi.Node, options ...func(*Tendermint)) *Tendermint {\n\tp := &Tendermint{\n\t\tNode: \t \tn,\n\t\tlog: \t \tmake(map[int]*entry, paxi.GetConfig().BufferSize),\n\t\tlogR: \tmake(map[int]*RequestSlot, paxi.GetConfig().BufferSize),\n\t\tslot: \t \t-1,\n\t\tquorum: \t \tpaxi.NewQuorum(),\n\t\tRequests: \t \tmake([]*paxi.Request, 0),\n\t\tMember: \tpaxi.NewMember(),\n\t\tRequestFlag: \t\tfalse,\n\t\tcount:\t\t\t\t0,\n\t\tEarlyPropose:\t\tfalse,\n\t\tLeader:\t\t\t\tfalse,\n\t\tPlist:\t\t\t\tmake([]paxi.ID,0),\n\t}\n\n\tfor _, opt := range options {\n\t\topt(p)\n\t}\n\treturn p\n}", "title": "" }, { "docid": "0418f2bf8499347be42a2a404a778f0e", "score": "0.32952994", "text": "func NewPutLTENetworkIDGatewaysGatewayIDCellularPoolingParamsWithTimeout(timeout time.Duration) *PutLTENetworkIDGatewaysGatewayIDCellularPoolingParams {\n\tvar ()\n\treturn &PutLTENetworkIDGatewaysGatewayIDCellularPoolingParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "title": "" }, { "docid": "7c6b07d912997c514c0444a894d780e6", "score": "0.32949805", "text": "func (o *ScheduledPlansForLookmlDashboardParams) WithAllUsers(allUsers *bool) *ScheduledPlansForLookmlDashboardParams {\n\to.SetAllUsers(allUsers)\n\treturn o\n}", "title": "" }, { "docid": "569eb01912d9fe2d1e0c528e924d4aa9", "score": "0.32932597", "text": "func (o *IpamRouteTargetsListParams) WithCreatedLt(createdLt *string) *IpamRouteTargetsListParams {\n\to.SetCreatedLt(createdLt)\n\treturn o\n}", "title": "" }, { "docid": "90df86f0afcd51f7c60f6c093ab19f33", "score": "0.32866633", "text": "func NewTendermint(n paxi.Node, options ...func(*Tendermint)) *Tendermint {\n\n\tp := &Tendermint{\n\t\tNode: \t \tn,\n\t\tlog: \t \tmake(map[int]*entry, paxi.GetConfig().BufferSize),\n\t\tlogR: \tmake(map[int]*RequestSlot, paxi.GetConfig().BufferSize),\n\t\tslot: \t \t-1,\n\t\tquorum: \t \tpaxi.NewQuorum(),\n\t\tRequests: \t \tmake([]*paxi.Request, 0),\n\t\tMember: \tpaxi.NewMember(),\n\t\tRequestFlag: \t\tfalse,\n\t\tcount:\t\t\t\t0,\n\t\tEarlyPropose:\t\tfalse,\n\t\tLeader:\t\t\t\tfalse,\n\t\tPlist:\t\t\t\tmake([]paxi.ID,0),\n\t}\n\tfor _, opt := range options {\n\t\topt(p)\n\t}\n\treturn p\n\n}", "title": "" }, { "docid": "554d6e6e659582885caafe37e45fb185", "score": "0.32861242", "text": "func (mr *MockWorkflowServiceClientMockRecorder) RespondWorkflowTaskFailed(ctx, in interface{}, opts ...interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\tvarargs := append([]interface{}{ctx, in}, opts...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"RespondWorkflowTaskFailed\", reflect.TypeOf((*MockWorkflowServiceClient)(nil).RespondWorkflowTaskFailed), varargs...)\n}", "title": "" }, { "docid": "cf9e935539cf7e2026cc737fb8d7b96a", "score": "0.3282459", "text": "func NewRecordTelemetryTask(\n\trecorder metric.MetricRecorder,\n\tperiod int,\n\tlogger logging.LoggerInterface,\n) *asynctask.AsyncTask {\n\trecord := func(logger logging.LoggerInterface) error {\n\t\treturn recorder.SynchronizeTelemetry()\n\t}\n\n\tonStop := func(l logging.LoggerInterface) {\n\t\trecord(logger)\n\t}\n\treturn asynctask.NewAsyncTask(\"SubmitTelemetry\", record, period, nil, onStop, logger)\n}", "title": "" }, { "docid": "1497bf36205f0f8655a41dd3cdcea6e1", "score": "0.3279629", "text": "func NewGetTaskLogParams() *GetTaskLogParams {\n\tvar ()\n\treturn &GetTaskLogParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "b8fb64a9838346db9788a3d20383adef", "score": "0.32567093", "text": "func NewTaskWithContext(ctx context.Context, options ...data.ImmutableKeyValue) (Task, fail.Error) {\n\tif ctx == nil {\n\t\treturn nil, fail.InvalidParameterCannotBeNilError(\"ctx\")\n\t}\n\n\treturn newTask(ctx, nil, options...)\n}", "title": "" }, { "docid": "c6dadcec97b56d0fc0d765be2cb56ffc", "score": "0.32557738", "text": "func NewPutLTENetworkIDGatewaysGatewayIDCellularPoolingParamsWithContext(ctx context.Context) *PutLTENetworkIDGatewaysGatewayIDCellularPoolingParams {\n\tvar ()\n\treturn &PutLTENetworkIDGatewaysGatewayIDCellularPoolingParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "7eeabc6029e6eaeb9052f1ad201c9172", "score": "0.3244337", "text": "func NewFolderChildrenParamsWithContext(ctx context.Context) *FolderChildrenParams {\n\tvar ()\n\treturn &FolderChildrenParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "ce0a3884f004ec775b50c84259b0ffe9", "score": "0.32442734", "text": "func (cdToolchain *CdToolchainV2) CreateToolWithContext(ctx context.Context, createToolOptions *CreateToolOptions) (result *PostToolResponse, response *core.DetailedResponse, err error) {\n\terr = core.ValidateNotNil(createToolOptions, \"createToolOptions cannot be nil\")\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.ValidateStruct(createToolOptions, \"createToolOptions\")\n\tif err != nil {\n\t\treturn\n\t}\n\n\tpathParamsMap := map[string]string{\n\t\t\"toolchain_id\": *createToolOptions.ToolchainID,\n\t}\n\n\tbuilder := core.NewRequestBuilder(core.POST)\n\tbuilder = builder.WithContext(ctx)\n\tbuilder.EnableGzipCompression = cdToolchain.GetEnableGzipCompression()\n\t_, err = builder.ResolveRequestURL(cdToolchain.Service.Options.URL, `/v2/toolchains/{toolchain_id}/tools`, pathParamsMap)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor headerName, headerValue := range createToolOptions.Headers {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\n\tsdkHeaders := common.GetSdkHeaders(\"cd_toolchain\", \"V2\", \"CreateTool\")\n\tfor headerName, headerValue := range sdkHeaders {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\tbuilder.AddHeader(\"Accept\", \"application/json\")\n\tbuilder.AddHeader(\"Content-Type\", \"application/json\")\n\n\tbody := make(map[string]interface{})\n\tif createToolOptions.ToolTypeID != nil {\n\t\tbody[\"tool_type_id\"] = createToolOptions.ToolTypeID\n\t}\n\tif createToolOptions.Name != nil {\n\t\tbody[\"name\"] = createToolOptions.Name\n\t}\n\tif createToolOptions.Parameters != nil {\n\t\tbody[\"parameters\"] = createToolOptions.Parameters\n\t}\n\tif createToolOptions.ParametersReferences != nil {\n\t\tbody[\"parameters_references\"] = createToolOptions.ParametersReferences\n\t}\n\t_, err = builder.SetBodyContentJSON(body)\n\tif err != nil {\n\t\treturn\n\t}\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 = cdToolchain.Service.Request(request, &rawResponse)\n\tif err != nil {\n\t\treturn\n\t}\n\tif rawResponse != nil {\n\t\terr = core.UnmarshalModel(rawResponse, \"\", &result, UnmarshalPostToolResponse)\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": "8856cfbeb631a5f2761a39115f9a47aa", "score": "0.32370612", "text": "func (o *DcimPowerPortTemplatesListParams) SetAllocatedDrawLte(allocatedDrawLte *string) {\n\to.AllocatedDrawLte = allocatedDrawLte\n}", "title": "" }, { "docid": "8cda310f59389014d91aa26a8d4e8f74", "score": "0.32355985", "text": "func (o *CreateReportParams) WithContext(ctx context.Context) *CreateReportParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "97ce9744f7e0b9b7305679f6253072dd", "score": "0.3232549", "text": "func NewPostIamLocalUserPasswordsMoidParamsWithContext(ctx context.Context) *PostIamLocalUserPasswordsMoidParams {\n\tvar ()\n\treturn &PostIamLocalUserPasswordsMoidParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "72dc196932e1aa86cca30106736b90b7", "score": "0.32317156", "text": "func NewTendermint(n PaxiBFT.Node, options ...func(*Tendermint)) *Tendermint {\n\n\tp := &Tendermint{\n\t\tNode: \t \tn,\n\t\tlog: \t \tmake(map[int]*entry, PaxiBFT.GetConfig().BufferSize),\n\n\t\tslot: \t \t-1,\n\t\tquorum: \t \tPaxiBFT.NewQuorum(),\n\t\tRequests: \t \tmake([]*PaxiBFT.Request, 0),\n\t\tMember: \tPaxiBFT.NewMember(),\n\t\tRequestFlag: \t\tfalse,\n\t\tcount:\t\t\t\t0,\n\t\tEarlyPropose:\t\tfalse,\n\t\tLeader:\t\t\t\tfalse,\n\t\tPlist:\t\t\t\tmake([]PaxiBFT.ID,0),\n\t}\n\tfor _, opt := range options {\n\t\topt(p)\n\t}\n\treturn p\n\n}", "title": "" }, { "docid": "25815ded934a31f5d14ce6075139fb48", "score": "0.32293674", "text": "func NewSetUpResourcesFolderRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*SetUpResourcesFolderRequestBuilder) {\n m := &SetUpResourcesFolderRequestBuilder{\n }\n m.urlTemplate = \"{+baseurl}/education/classes/{educationClass%2Did}/assignments/{educationAssignment%2Did}/submissions/{educationSubmission%2Did}/microsoft.graph.setUpResourcesFolder\";\n urlTplParams := make(map[string]string)\n for idx, item := range pathParameters {\n urlTplParams[idx] = item\n }\n m.pathParameters = urlTplParams;\n m.requestAdapter = requestAdapter;\n return m\n}", "title": "" }, { "docid": "cd44da5859e1cbd3c64867f1c93b5e8d", "score": "0.32259429", "text": "func (o *CreatePlanCreatedBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "698f2b20bad7c35c481bb4175f0a09f1", "score": "0.32225493", "text": "func newTaskContext(ctx context.Context, msg *structs.TaskMessage, ddl time.Time) (context.Context, context.CancelFunc) {\n\tmd := &taskMetadata{\n\t\tid: msg.ID.String(),\n\t\tcanRetry: msg.CanRetry,\n\t\tqname: msg.QueueName,\n\t}\n\tnewCtx := context.WithValue(ctx, taskMetadataCtxKey, md)\n\treturn context.WithDeadline(newCtx, ddl)\n}", "title": "" }, { "docid": "2ff50beb093a84e82db90a10a05189c8", "score": "0.32148302", "text": "func NewCmdStepCreateTemplatedConfig(commonOpts *opts.CommonOptions) *cobra.Command {\n\toptions := &StepCreateTemplatedConfigOptions{\n\t\tStepOptions: step.StepOptions{\n\t\t\tCommonOptions: commonOpts,\n\t\t},\n\t}\n\n\tcmd := &cobra.Command{\n\t\tUse: \"templated config\",\n\t\tShort: \"Create a YAML config file from a Go template file and a jx requirements file\",\n\t\tLong: createTemplatedConfigLong,\n\t\tExample: createTemplatedConfigExample,\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\toptions.Cmd = cmd\n\t\t\toptions.Args = args\n\t\t\terr := options.Run()\n\t\t\thelper.CheckErr(err)\n\t\t},\n\t}\n\n\tcmd.Flags().StringVarP(&options.TemplateFile, templateFileOption, \"t\", \"\", \"The template file used to render the config YAML file\")\n\tcmd.Flags().StringVarP(&options.ParametersFile, parametersFileOption, \"p\", \"\", \"The values file used as parameters in the template file\")\n\tcmd.Flags().StringVarP(&options.RequirementsDir, requirementsDirOption, \"r\", \".\", \"The jx requirements file directory\")\n\tcmd.Flags().StringVarP(&options.ConfigFile, configFileOption, \"c\", \"\", \"The rendered config YAML file\")\n\n\treturn cmd\n}", "title": "" }, { "docid": "aba66ad0261d4001f5df6f18a6f12366", "score": "0.3213972", "text": "func (_m *Mockec2API) WaitUntilExportTaskCancelledWithContext(_parameter_0 context.Context, _parameter_1 *ec2.DescribeExportTasksInput, _parameter_2 ...request.WaiterOption) (_result_0 error) {\n\tvarParams := make([]interface{}, 2+len(_parameter_2))\n\tvarParams[0] = _parameter_0\n\tvarParams[1] = _parameter_1\n\tfor varIndex, varParam := range _parameter_2 {\n\t\tvarParams[2+varIndex] = varParam\n\t}\n\n\tret := _m.Called(varParams...)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(context.Context, *ec2.DescribeExportTasksInput, ...request.WaiterOption) error); ok {\n\t\tr0 = rf(_parameter_0, _parameter_1, _parameter_2...)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "f5ab4f14cf36e4d5e8018764b395279d", "score": "0.32126632", "text": "func NewReplaceDashboardParamsWithContext(ctx context.Context) *ReplaceDashboardParams {\n\tvar ()\n\treturn &ReplaceDashboardParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "5d5dd9ba90ccfcfce0f0240b6a711032", "score": "0.32095537", "text": "func NewCmdStepCreateTask(f Factory, in terminal.FileReader, out terminal.FileWriter, errOut io.Writer) *cobra.Command {\n\toptions := &StepCreateTaskOptions{\n\t\tStepOptions: StepOptions{\n\t\t\tCommonOptions: CommonOptions{\n\t\t\t\tFactory: f,\n\t\t\t\tIn: in,\n\t\t\t\tOut: out,\n\t\t\t\tErr: errOut,\n\t\t\t},\n\t\t},\n\t}\n\n\tcmd := &cobra.Command{\n\t\tUse: \"task\",\n\t\tShort: \"Creates a Knative Pipeline Task for the current folder or given build pack\",\n\t\tLong: createTaskLong,\n\t\tExample: createTaskExample,\n\t\tAliases: []string{\"bt\"},\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\toptions.Cmd = cmd\n\t\t\toptions.Args = args\n\t\t\terr := options.Run()\n\t\t\tCheckErr(err)\n\t\t},\n\t}\n\toptions.addCommonFlags(cmd)\n\n\tcmd.Flags().StringVarP(&options.Dir, \"dir\", \"d\", \"\", \"The directory to query to find the projects .git directory\")\n\tcmd.Flags().StringVarP(&options.OutputFile, \"output\", \"o\", \"\", \"The output file to write the output to as YAML\")\n\tcmd.Flags().StringVarP(&options.BuildPackURL, \"url\", \"u\", \"\", \"The URL for the build pack Git repository\")\n\tcmd.Flags().StringVarP(&options.BuildPackRef, \"ref\", \"r\", \"\", \"The Git reference (branch,tag,sha) in the Git repository to use\")\n\tcmd.Flags().StringVarP(&options.Pack, \"pack\", \"p\", \"\", \"The build pack name. If none is specified its discovered from the source code\")\n\tcmd.Flags().StringVarP(&options.PipelineKind, \"kind\", \"k\", \"release\", \"The kind of pipeline to create such as: \"+strings.Join(jenkinsfile.PipelineKinds, \", \"))\n\treturn cmd\n}", "title": "" }, { "docid": "4be090c976aabaacf8106cbee95c7a1f", "score": "0.32093543", "text": "func NewCreateFolderParams() *CreateFolderParams {\n\tvar ()\n\treturn &CreateFolderParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "2d12441169567d5629daad88c5d23ce1", "score": "0.3203792", "text": "func (o *PostCharactersCharacterIDFittingsCreated) WithPayload(payload *models.PostCharactersCharacterIDFittingsCreatedBody) *PostCharactersCharacterIDFittingsCreated {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "12342798079f5a9efec59e124defd14e", "score": "0.31939474", "text": "func (o *VirtualizationInterfacesListParams) SetCreatedLte(createdLte *string) {\n\to.CreatedLte = createdLte\n}", "title": "" }, { "docid": "10ee79906898d4925d9e3c8719a89742", "score": "0.31938317", "text": "func (o *ScheduledPlansForLookmlDashboardParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "b699930743d745355bec5d45584f2e25", "score": "0.31926754", "text": "func (o *DcimPowerPortTemplatesListParams) WithIDLte(iDLte *string) *DcimPowerPortTemplatesListParams {\n\to.SetIDLte(iDLte)\n\treturn o\n}", "title": "" }, { "docid": "3242753892021efca0476c3faa0c61f3", "score": "0.31917542", "text": "func (m *TaskCreateRequest) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateCallSystem(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a404b11c1be146bdccb1d3df0e0e33fe", "score": "0.31868646", "text": "func NewLocalMTASender(mtaPath string) *LocalMTASender {\n\tif mtaPath == \"\" {\n\t\tmtaPath = MTABINARY\n\t}\n\n\tc, err := exec.LookPath(mtaPath)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"Couldn't find specified MTA: %s\", err.Error()))\n\t} else {\n\t\tlogrus.Infof(\"mail: found %s at %s.\", mtaPath, c)\n\t}\n\tmtaPath = c\n\n\treturn &LocalMTASender{\n\t\tRunner: SendmailRunner{mtaPath},\n\t}\n}", "title": "" }, { "docid": "db04898b2c05ef3e89abff554ca3e61c", "score": "0.31760865", "text": "func New(tpl *template.Engine, r *http.Request, sess *session.Session) *View {\n\tb := &View{tpl, r, make(map[string]interface{})}\n\ttheme := request.UserTheme(r)\n\tb.params[\"menu\"] = \"\"\n\tb.params[\"csrf\"] = request.CSRF(r)\n\tb.params[\"flashMessage\"] = sess.FlashMessage(request.FlashMessage(r))\n\tb.params[\"flashErrorMessage\"] = sess.FlashErrorMessage(request.FlashErrorMessage(r))\n\tb.params[\"theme\"] = theme\n\tb.params[\"language\"] = request.UserLanguage(r)\n\tb.params[\"theme_checksum\"] = static.StylesheetBundleChecksums[theme]\n\tb.params[\"app_js_checksum\"] = static.JavascriptBundleChecksums[\"app\"]\n\tb.params[\"sw_js_checksum\"] = static.JavascriptBundleChecksums[\"service-worker\"]\n\treturn b\n}", "title": "" }, { "docid": "aa8b6079c9992c50417f9bd3a1102581", "score": "0.31708056", "text": "func (_m *Mockec2API) WaitUntilExportTaskCompletedWithContext(_parameter_0 context.Context, _parameter_1 *ec2.DescribeExportTasksInput, _parameter_2 ...request.WaiterOption) (_result_0 error) {\n\tvarParams := make([]interface{}, 2+len(_parameter_2))\n\tvarParams[0] = _parameter_0\n\tvarParams[1] = _parameter_1\n\tfor varIndex, varParam := range _parameter_2 {\n\t\tvarParams[2+varIndex] = varParam\n\t}\n\n\tret := _m.Called(varParams...)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(context.Context, *ec2.DescribeExportTasksInput, ...request.WaiterOption) error); ok {\n\t\tr0 = rf(_parameter_0, _parameter_1, _parameter_2...)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "46434f5665fa35f0cb058dd4eeaaded7", "score": "0.3169457", "text": "func NewTriggerTumblingWindow(ctx *pulumi.Context,\n\tname string, args *TriggerTumblingWindowArgs, opts ...pulumi.ResourceOption) (*TriggerTumblingWindow, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.DataFactoryId == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'DataFactoryId'\")\n\t}\n\tif args.Frequency == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'Frequency'\")\n\t}\n\tif args.Interval == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'Interval'\")\n\t}\n\tif args.Pipeline == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'Pipeline'\")\n\t}\n\tif args.StartTime == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'StartTime'\")\n\t}\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource TriggerTumblingWindow\n\terr := ctx.RegisterResource(\"azure:datafactory/triggerTumblingWindow:TriggerTumblingWindow\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "78be58672faa56ee95ab9063a32036d6", "score": "0.31641755", "text": "func (o *CreateNodeParams) WithContext(ctx context.Context) *CreateNodeParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" } ]
e41ebc5a9fdaf1ea24ec11ba6c170590
Type implements domain.VarType .
[ { "docid": "724cd5e6a96e077a5ca4d9e282469cc5", "score": "0.72835547", "text": "func (v Var) Type() string {\n\treturn v.t\n}", "title": "" } ]
[ { "docid": "cefff3e49439ba0efc9628a012562713", "score": "0.74998707", "text": "func (it *Variable) Type() graph.Type { return graph.Variable }", "title": "" }, { "docid": "395cf17a3b7b341f307f10a861336f27", "score": "0.70474106", "text": "func (p *Var) Type() reflect.Type {\n\treturn p.typ\n}", "title": "" }, { "docid": "395cf17a3b7b341f307f10a861336f27", "score": "0.70474106", "text": "func (p *Var) Type() reflect.Type {\n\treturn p.typ\n}", "title": "" }, { "docid": "495003a9953329e7746c955b5a72cbcc", "score": "0.6939252", "text": "func VarTypeByValue(data interface{}) (vt *VariableType, size uint, numElements uint, err error) {\n\t// defer func() {\n\t// \tlog.Printf(\"VarTypeByValue(%T) => %s\", data, vt)\n\t// }()\n\n\tif data == nil {\n\t\treturn StringVarType, 1, 0, nil\n\t}\n\tswitch x := data.(type) {\n\tcase VariableType:\n\t\treturn &x, x.size, 0, nil\n\tcase *VariableType:\n\t\tif x == nil {\n\t\t\treturn StringVarType, 1, 0, nil\n\t\t}\n\t\treturn x, x.size, 0, nil\n\tcase Variable:\n\t\treturn x.typ, x.typ.size, 0, nil\n\tcase *Variable:\n\t\tif x == nil {\n\t\t\treturn StringVarType, 1, 0, nil\n\t\t}\n\t\treturn x.typ, x.typ.size, 0, nil\n\n\tcase string:\n\t\tif len(x) == 0 {\n\t\t\treturn StringVarType, MaxStringChars, 0, nil\n\t\t}\n\t\tif len(x) > MaxStringChars {\n\t\t\treturn LongStringVarType, uint(len(x) + 1), 0, nil\n\t\t}\n\t\treturn StringVarType, uint(len(x) + 1), 0, nil\n\tcase *string:\n\t\treturn VarTypeByValue(*x)\n\tcase []string:\n\t\tnumElements = uint(len(x))\n\t\tvt, size, _, err = VarTypeByValue(\"\")\n\t\tfor _, y := range x {\n\t\t\tsize = maxUint(size, uint(len(y)+1))\n\t\t}\n\t\treturn\n\n\tcase bool:\n\t\treturn BooleanVarType, 0, 0, nil\n\tcase *bool:\n\t\treturn VarTypeByValue(*x)\n\n\tcase int8, uint8, int16, uint16, int32, uint32:\n\t\treturn Int32VarType, 0, 0, nil\n\tcase *int:\n\t\treturn VarTypeByValue(*x)\n\tcase *uint:\n\t\treturn VarTypeByValue(*x)\n\tcase int, uint:\n\t\tif IntIs64bit {\n\t\t\treturn Int64VarType, 0, 0, nil\n\t\t}\n\n\tcase int64, uint64:\n\t\treturn Int64VarType, 0, 0, nil\n\tcase *int64:\n\t\treturn VarTypeByValue(*x)\n\tcase *uint64:\n\t\treturn VarTypeByValue(*x)\n\n\tcase float32, float64:\n\t\treturn FloatVarType, 0, 0, nil\n\tcase *float32:\n\t\treturn VarTypeByValue(*x)\n\tcase *float64:\n\t\treturn VarTypeByValue(*x)\n\n\tcase []int8, []int16, []uint16, []int32, []uint32, []int64, []uint64, []int, []uint, []float32, []float64:\n\t\trV := reflect.ValueOf(x)\n\t\tnumElements = uint(rV.Len())\n\t\tvt, size, _, err = VarTypeByValue(reflect.Zero(rV.Type().Elem()).Interface())\n\t\treturn\n\n\tcase time.Time:\n\t\treturn DateTimeVarType, 0, 0, nil\n\tcase []time.Time:\n\t\tnumElements = uint(len(x))\n\t\tvt, size, _, err = VarTypeByValue(time.Time{})\n\t\treturn\n\tcase *time.Time:\n\t\treturn VarTypeByValue(*x)\n\n\tcase time.Duration:\n\t\treturn IntervalVarType, 0, 0, nil\n\n\tcase []byte:\n\t\tif len(x) > MaxBinaryBytes {\n\t\t\treturn LongBinaryVarType, uint(len(x)), 0, nil\n\t\t}\n\t\treturn BinaryVarType, uint(len(x)), 0, nil\n\tcase [][]byte:\n\t\tnumElements = uint(len(x))\n\t\tvt, size, _, err = VarTypeByValue([]byte{})\n\t\treturn\n\n\tcase []interface{}:\n\t\tnumElements = uint(len(x))\n\t\tif numElements == 0 {\n\t\t\treturn nil, 0, 0, ListIsEmpty\n\t\t}\n\t\tfor i, y := range x {\n\t\t\tif i == 0 {\n\t\t\t\tif vt, size, _, err = VarTypeByValue(y); err != nil {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tif _, s, _, e := VarTypeByValue(y); e != nil {\n\t\t\t\t\terr = e\n\t\t\t\t\treturn\n\t\t\t\t} else {\n\t\t\t\t\tsize = maxUint(size, s)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn\n\n\tcase *Cursor:\n\t\treturn CursorVarType, 0, 0, nil\n\t}\n\n\tif x, ok := data.(OraTyper); ok {\n\t\treturn x.GetVarType(), 0, 0, nil\n\t}\n\n\treturn nil, 0, 0, errgo.Newf(\"unhandled data type %T\", data)\n}", "title": "" }, { "docid": "41be39e324109e75218348739ec1209b", "score": "0.6839212", "text": "func (VarType) IsVarType() bool {\n\treturn true\n}", "title": "" }, { "docid": "73b0861c0da8051412b2c2109535672c", "score": "0.65746784", "text": "func (p Type) Var(name string, defval interface{}) interface{} {\n\n\tv, ok := p.Impl.GetVar(name)\n\tif !ok {\n\t\tv = defval\n\t}\n\treturn v\n}", "title": "" }, { "docid": "de9da361ea58d72733cc26a6eaf13ab8", "score": "0.64489424", "text": "func (*VarFilterContext) GetType(name typeName) types.Type { return nil }", "title": "" }, { "docid": "b2687b2d1ec29baa0e5249fdc4c249ca", "score": "0.64426315", "text": "func (self *Task) GetVarType(j int32) (vartype Variabletype,err error) {\n var _tmp788 int32\n if _tmp789 := C.MSK_getvartype(self.ptr(),C.int32_t(j),(*C.int32_t)(&_tmp788)); _tmp789 != 0 {\n lastcode,lastmsg := self.getlasterror(_tmp789)\n err = &MosekError{code:Rescode(lastcode),msg:lastmsg}\n return\n }\n vartype = Variabletype(_tmp788)\n return\n}", "title": "" }, { "docid": "59e9b018d12dd6e45fd177353c6b9a0b", "score": "0.638357", "text": "func (d *Docs) VarType(i int) (typ string) {\n\t_, rest := splitNamed(d.Vars[i])\n\tif rest == \"\" {\n\t\treturn\n\t}\n\n\thead := strings.SplitN(rest, \"\\n\", 2)\n\tline := strings.TrimSpace(head[0])\n\tif line == \"\" {\n\t\treturn \"\"\n\t}\n\tif !isTypeString(line) {\n\t\treturn \"\"\n\t}\n\n\treturn line\n}", "title": "" }, { "docid": "b6b3c8b31ed8c65839b237f6aafda58f", "score": "0.63738203", "text": "func (*VariableAssignment) Type() string { return \"VariableAssignment\" }", "title": "" }, { "docid": "4b759ae404a250f7db1b05fbaaf92eb8", "score": "0.63737315", "text": "func (cur *Cursor) NewVar(value interface{}, /*inconverter, outconverter, typename*/\n) (v *Variable, err error) {\n\t// determine the type of variable\n\t// varType = Variable_TypeByPythonType(self, type);\n\trval := reflect.ValueOf(value)\n\tval := value\n\tif rval.Kind() == reflect.Ptr {\n\t\tval = rval.Elem().Interface()\n\t}\n\tvarType, size, numElements, err := VarTypeByValue(val)\n\tif err != nil {\n\t\treturn nil, errgo.Mask(err)\n\t}\n\tif varType.isVariableLength && size == 0 {\n\t\tsize = varType.size\n\t}\n\tLog.Debug(\"NewVar\", \"varType\", varType, \"size\", size, \"numElements\", numElements)\n\n\t// create the variable\n\tv, err = cur.NewVariable(numElements, varType, size)\n\t/*\n\t var->inConverter = inConverter;\n\t var->outConverter = outConverter;\n\t*/\n\n\t// define the object type if needed\n\t/*\n\t if (type == (PyObject*) &g_ObjectVarType) {\n\t objectVar = (udt_ObjectVar*) var;\n\t objectVar->objectType = ObjectType_NewByName(self->connection,\n\t typeNameObj);\n\t if (!objectVar->objectType) {\n\t Py_DECREF(var);\n\t return NULL;\n\t }\n\t }\n\t*/\n\n\t// set the value, if applicable\n\terr = v.SetValue(0, value)\n\treturn\n}", "title": "" }, { "docid": "fe4bc1a5546a26bb255607ffe0dcd520", "score": "0.6308979", "text": "func NewVar(pos token.Pos, pkg *Package, name string, typ Type) *Var {}", "title": "" }, { "docid": "3e7e633ddd92132d8bbea46aa537897a", "score": "0.6282339", "text": "func (ov *OutputVariable) Type() model.Type {\n\treturn ov.typ\n}", "title": "" }, { "docid": "18bc3db9baa7385064303ab5c44ffea1", "score": "0.62692726", "text": "func NewType(name string, llvmType types.Type, prec int) *VarType {\n\n\tif GlobalTypeMap == nil || castPrecidences == nil {\n\t\tinitializeMaps()\n\t}\n\tt := &VarType{}\n\tt.Name = name\n\tt.LLVMType = llvmType\n\tcastPrecidences[llvmType] = prec\n\tGlobalTypeMap.Types[t.Name] = t\n\treturn t\n}", "title": "" }, { "docid": "34e9acb6d97df69049e17a477e8b8fb7", "score": "0.6197062", "text": "func (v Value) Type() Type {\n\treturn v.vtype\n}", "title": "" }, { "docid": "8ed8fad66b62482b99573f182dd6b6f1", "score": "0.61777294", "text": "func (lv *LocalVariable) Type() model.Type {\n\treturn lv.Definition.Type()\n}", "title": "" }, { "docid": "4a214b7eed55a3d5afde510bd3fecbb2", "score": "0.61189514", "text": "func NewVar[T any](val T) *Var[T] {\n\tv := &Var[T]{}\n\tv.value.Store(versionedValue[T]{\n\t\tvalue: val,\n\t})\n\treturn v\n}", "title": "" }, { "docid": "d4e87a625a4f099f400033f617ba2e0d", "score": "0.60997605", "text": "func Var(field interface{}, tag string) error {\n\treturn New().Var(field, tag)\n}", "title": "" }, { "docid": "c638f3860a210f5c434305e14ff5aa42", "score": "0.60950977", "text": "func useVariableTypeAttributes(server []UA_Server, session []UA_Session, node []UA_VariableNode, item []UA_AddNodesItem) UA_StatusCode {\n\tvar attributes []UA_VariableAttributes = (*item[0].nodeAttributes.content.decoded()).data.([]UA_VariableAttributes)\n\tvar typeDefinition []UA_NodeId\n\tif uint32(node[0].nodeClass) == uint32(UA_NODECLASS_VARIABLE) {\n\t\t// Select the type definition\n\t\ttypeDefinition = (*[100000000]UA_NodeId)(unsafe.Pointer(&item[0].typeDefinition.nodeId))[:]\n\t} else {\n\t\t// UA_NODECLASS_VARIABLETYPE\n\t\ttypeDefinition = (*[100000000]UA_NodeId)(unsafe.Pointer(&item[0].parentNodeId.nodeId))[:]\n\t}\n\tif int((int((UA_NodeId_isNull(typeDefinition))))) != 0 {\n\t\t// Replace an empty typeDefinition with the most permissive default\n\t\ttypeDefinition = (*[100000000]UA_NodeId)(unsafe.Pointer(&baseDataVariableType))[:]\n\t}\n\tvar vt []UA_VariableTypeNode = server.config.nodestore.getNode((server)[0].config.nodestore.context, typeDefinition)\n\tif vt == nil || uint32(vt[0].nodeClass) != uint32(UA_NODECLASS_VARIABLETYPE) {\n\t\tserver.config.nodestore.releaseNode((server)[0].config.nodestore.context, vt)\n\t\treturn UA_StatusCode((uint32_t((uint32((uint32(2155085824)))))))\n\t}\n\tvar retval UA_StatusCode\n\tif attributes[0].value.type_ == nil {\n\t\t// If no value is set, see if the vt provides one and copy it. This needs to\n\t\t// * be done before copying the datatype from the vt, as setting the datatype\n\t\t// * triggers a typecheck.\n\t\tUA_LOG_DEBUG(UA_Logger(server[0].config.logger), UA_LOGCATEGORY_SESSION, []byte(\"Connection %i | SecureChannel %i | Session %08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x | AddNodes: No value given; Copy the valuefrom the TypeDefinition%.0s\\x00\"), (func() int {\n\t\t\tif (session)[0].header.channel != nil {\n\t\t\t\treturn (func() int {\n\t\t\t\t\tif (session)[0].header.channel[0].connection != nil {\n\t\t\t\t\t\treturn int((__int32_t((int32_t((UA_Int32((session)[0].header.channel[0].connection[0].sockfd)))))))\n\t\t\t\t\t}\n\t\t\t\t\treturn 0\n\t\t\t\t}())\n\t\t\t}\n\t\t\treturn 0\n\t\t}()), (func() uint32 {\n\t\t\tif (session)[0].header.channel != nil {\n\t\t\t\treturn uint32((uint32((uint32_t((UA_UInt32((session)[0].header.channel[0].securityToken.channelId)))))))\n\t\t\t}\n\t\t\treturn 0\n\t\t}()), UA_UInt32((*(session)[0].sessionId.identifier.guid()).data1), int(uint16((uint16((uint16_t((UA_UInt16((*(session)[0].sessionId.identifier.guid()).data2)))))))), int(uint16((uint16((uint16_t((UA_UInt16((*(session)[0].sessionId.identifier.guid()).data3)))))))), int(uint8((__uint8_t((uint8_t((UA_Byte((*(session)[0].sessionId.identifier.guid()).data4[:][0])))))))), int(uint8((__uint8_t((uint8_t((UA_Byte((*(session)[0].sessionId.identifier.guid()).data4[:][1])))))))), int(uint8((__uint8_t((uint8_t((UA_Byte((*(session)[0].sessionId.identifier.guid()).data4[:][2])))))))), int(uint8((__uint8_t((uint8_t((UA_Byte((*(session)[0].sessionId.identifier.guid()).data4[:][3])))))))), int(uint8((__uint8_t((uint8_t((UA_Byte((*(session)[0].sessionId.identifier.guid()).data4[:][4])))))))), int(uint8((__uint8_t((uint8_t((UA_Byte((*(session)[0].sessionId.identifier.guid()).data4[:][5])))))))), int(uint8((__uint8_t((uint8_t((UA_Byte((*(session)[0].sessionId.identifier.guid()).data4[:][6])))))))), int(uint8((__uint8_t((uint8_t((UA_Byte((*(session)[0].sessionId.identifier.guid()).data4[:][7])))))))), []byte(\"\\x00\"))\n\t\tvar vt_value UA_DataValue\n\t\tUA_DataValue_init((*[100000000]UA_DataValue)(unsafe.Pointer(&vt_value))[:])\n\t\tretval = readValueAttribute(server, session, vt, (*[100000000]UA_DataValue)(unsafe.Pointer(&vt_value))[:])\n\t\tif retval == UA_StatusCode((uint32_t((uint32((0)))))) && int((int((UA_Boolean(vt_value.hasValue))))) != 0 {\n\t\t\tretval = UA_Variant_copy((*[100000000]UA_Variant)(unsafe.Pointer(&vt_value.value))[:], (*[100000000]UA_Variant)(unsafe.Pointer(&(*node[0].value.data()).value.value))[:])\n\t\t\t(*node[0].value.data()).value.hasValue = 1\n\t\t}\n\t\tUA_DataValue_deleteMembers((*[100000000]UA_DataValue)(unsafe.Pointer(&vt_value))[:])\n\t}\n\tif retval == UA_StatusCode((uint32_t((uint32((0)))))) && int((int((UA_NodeId_isNull((*[100000000]UA_NodeId)(unsafe.Pointer(&node[0].dataType))[:]))))) != 0 {\n\t\t// If no datatype is given, use the datatype of the vt\n\t\tUA_LOG_INFO(UA_Logger(server[0].config.logger), UA_LOGCATEGORY_SESSION, []byte(\"Connection %i | SecureChannel %i | Session %08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x | AddNodes: No datatype given; Copy the datatype attribute from the TypeDefinition%.0s\\x00\"), (func() int {\n\t\t\tif (session)[0].header.channel != nil {\n\t\t\t\treturn (func() int {\n\t\t\t\t\tif (session)[0].header.channel[0].connection != nil {\n\t\t\t\t\t\treturn int((__int32_t((int32_t((UA_Int32((session)[0].header.channel[0].connection[0].sockfd)))))))\n\t\t\t\t\t}\n\t\t\t\t\treturn 0\n\t\t\t\t}())\n\t\t\t}\n\t\t\treturn 0\n\t\t}()), (func() uint32 {\n\t\t\tif (session)[0].header.channel != nil {\n\t\t\t\treturn uint32((uint32((uint32_t((UA_UInt32((session)[0].header.channel[0].securityToken.channelId)))))))\n\t\t\t}\n\t\t\treturn 0\n\t\t}()), UA_UInt32((*(session)[0].sessionId.identifier.guid()).data1), int(uint16((uint16((uint16_t((UA_UInt16((*(session)[0].sessionId.identifier.guid()).data2)))))))), int(uint16((uint16((uint16_t((UA_UInt16((*(session)[0].sessionId.identifier.guid()).data3)))))))), int(uint8((__uint8_t((uint8_t((UA_Byte((*(session)[0].sessionId.identifier.guid()).data4[:][0])))))))), int(uint8((__uint8_t((uint8_t((UA_Byte((*(session)[0].sessionId.identifier.guid()).data4[:][1])))))))), int(uint8((__uint8_t((uint8_t((UA_Byte((*(session)[0].sessionId.identifier.guid()).data4[:][2])))))))), int(uint8((__uint8_t((uint8_t((UA_Byte((*(session)[0].sessionId.identifier.guid()).data4[:][3])))))))), int(uint8((__uint8_t((uint8_t((UA_Byte((*(session)[0].sessionId.identifier.guid()).data4[:][4])))))))), int(uint8((__uint8_t((uint8_t((UA_Byte((*(session)[0].sessionId.identifier.guid()).data4[:][5])))))))), int(uint8((__uint8_t((uint8_t((UA_Byte((*(session)[0].sessionId.identifier.guid()).data4[:][6])))))))), int(uint8((__uint8_t((uint8_t((UA_Byte((*(session)[0].sessionId.identifier.guid()).data4[:][7])))))))), []byte(\"\\x00\"))\n\t\tretval = UA_NodeId_copy((*[100000000]UA_NodeId)(unsafe.Pointer(&vt[0].dataType))[:], (*[100000000]UA_NodeId)(unsafe.Pointer(&node[0].dataType))[:])\n\t}\n\t// TODO: If the vt has arraydimensions but this variable does not, copy\n\tserver.config.nodestore.releaseNode((server)[0].config.nodestore.context, vt)\n\treturn UA_StatusCode(retval)\n}", "title": "" }, { "docid": "141959218919c93093c4f2722704b508", "score": "0.6069421", "text": "func (v Value) Type() Type {\n\treturn v.typ\n}", "title": "" }, { "docid": "2a07a89a68c199350064901da8e68540", "score": "0.6065816", "text": "func (s *BaseSystemVerilogParserListener) EnterVar_data_type(ctx *Var_data_typeContext) {}", "title": "" }, { "docid": "b04f95c53bd9cbd7706e2ebd37e701df", "score": "0.6063349", "text": "func TabletTypeVar(p *topodata.TabletType, name string, defaultValue topodata.TabletType, usage string) {\n\t*p = defaultValue\n\tflag.Var((*TabletTypeFlag)(p), name, usage)\n}", "title": "" }, { "docid": "cec08f1322146c9f46ee661ffc9c05a1", "score": "0.60378224", "text": "func (t *Terraformer) Var(name string, value interface{}) {\n\tif len(t.Vars) == 0 {\n\t\tt.Vars = make(Variables)\n\t}\n\tt.Vars[name] = value\n}", "title": "" }, { "docid": "ddb4cad37f5bc3534f354910e518815c", "score": "0.6026467", "text": "func (v *Variable) ValueType() string {\n\treturn v.value.TypeName()\n}", "title": "" }, { "docid": "3f077277daef5a2941e89dae7d7a803a", "score": "0.6026464", "text": "func (u Universe) Variable(n Name) *Type {\n\treturn u.Package(n.Package).Variable(n.Name)\n}", "title": "" }, { "docid": "7f39dcb39b188d33ba64a9024d540c2a", "score": "0.6024897", "text": "func NewVar(typ reflect.Type, name string) *Var {\n\treturn &Var{typ: typ, name: \"Q\" + name, idx: 0xffffffff}\n}", "title": "" }, { "docid": "0dc10f9301d704c271850b376e7f30f7", "score": "0.6020822", "text": "func addVariableTypeNode(server []UA_Server, name []byte, variabletypeid UA_UInt32, isAbstract UA_Boolean, valueRank UA_Int32, dataType UA_UInt32, type_ []UA_DataType, parentid UA_UInt32) UA_StatusCode {\n\tvar attr UA_VariableTypeAttributes = UA_VariableTypeAttributes_default\n\tattr.displayName = UA_LOCALIZEDTEXT([]byte(\"\\x00\"), name)\n\tattr.dataType = UA_NODEID_NUMERIC(0, UA_UInt32(dataType))\n\tattr.isAbstract = isAbstract\n\tattr.valueRank = valueRank\n\tif type_ != nil {\n\t\tvar tempVal []UA_Byte\n\t\tUA_init(tempVal, type_)\n\t\tUA_Variant_setScalar((*[100000000]UA_Variant)(unsafe.Pointer(&attr.value))[:], tempVal, type_)\n\t\treturn UA_Server_addVariableTypeNode(server, UA_NODEID_NUMERIC(0, UA_UInt32(variabletypeid)), UA_NODEID_NUMERIC(0, UA_UInt32(parentid)), UA_NODEID_NULL, UA_QUALIFIEDNAME(0, name), UA_NODEID_NULL, attr, nil, nil)\n\t}\n\treturn UA_Server_addVariableTypeNode(server, UA_NODEID_NUMERIC(0, UA_UInt32(variabletypeid)), UA_NODEID_NUMERIC(0, UA_UInt32(parentid)), UA_NODEID_NULL, UA_QUALIFIEDNAME(0, name), UA_NODEID_NULL, attr, nil, nil)\n}", "title": "" }, { "docid": "c1c49978314e21a5252e3e2932b4d1d6", "score": "0.60205626", "text": "func (v Value) Type() querypb.Type {\n\treturn v.typ\n}", "title": "" }, { "docid": "b1bff1051be347a6e2347b291eb9ddc7", "score": "0.60178", "text": "func (v *VarImp) Interface() interface{} {\n\treturn v.Val()\n}", "title": "" }, { "docid": "450e617b1bd70c3ce6aef4febec18d0c", "score": "0.5968314", "text": "func (self *Task) PutVarType(j int32,vartype Variabletype) (err error) {\n if _tmp1229 := C.MSK_putvartype(self.ptr(),C.int32_t(j),C.int32_t(vartype)); _tmp1229 != 0 {\n lastcode,lastmsg := self.getlasterror(_tmp1229)\n err = &MosekError{code:Rescode(lastcode),msg:lastmsg}\n return\n }\n return\n}", "title": "" }, { "docid": "8b3e2eeb2e19be4415458fd433294384", "score": "0.5964931", "text": "func varTypeByOraDataType(oracleDataType C.ub2, charsetForm C.ub1) (*VariableType, error) {\n\tswitch oracleDataType {\n\tcase C.SQLT_RDD:\n\t\treturn RowidVarType, nil\n\tcase C.SQLT_DAT, C.SQLT_ODT:\n\t\tfallthrough\n\tcase C.SQLT_DATE, C.SQLT_TIMESTAMP, C.SQLT_TIMESTAMP_TZ, C.SQLT_TIMESTAMP_LTZ:\n\t\treturn DateTimeVarType, nil\n\tcase C.SQLT_INTERVAL_DS:\n\t\treturn IntervalVarType, nil\n\tcase C.SQLT_LNG:\n\t\treturn LongStringVarType, nil\n\tcase C.SQLT_LBI:\n\t\treturn LongBinaryVarType, nil\n\tcase C.SQLT_RSET:\n\t\treturn CursorVarType, nil\n\t\t// case C.SQLT_NTY:\n\t\t// return &vt_Object;\n\tcase C.SQLT_CLOB:\n\t\tif charsetForm == C.SQLCS_NCHAR {\n\t\t\treturn NClobVarType, nil\n\t\t}\n\t\treturn ClobVarType, nil\n\tcase C.SQLT_BLOB:\n\t\treturn BlobVarType, nil\n\tcase C.SQLT_BFILE:\n\t\treturn BFileVarType, nil\n\tcase C.SQLT_AFC:\n\t\treturn FixedCharVarType, nil\n\tcase C.SQLT_CHR:\n\t\t// log.Printf(\"StringVarType=%v\", StringVarType)\n\t\treturn StringVarType, nil\n\tcase C.SQLT_BIN:\n\t\treturn BinaryVarType, nil\n\tcase C.SQLT_BFLOAT, C.SQLT_IBFLOAT, C.SQLT_BDOUBLE, C.SQLT_IBDOUBLE:\n\t\tfallthrough\n\tcase C.SQLT_NUM, C.SQLT_VNU:\n\t\treturn FloatVarType, nil\n\t}\n\treturn nil, errgo.Newf(\"TypeByOracleDataType: unhandled data type %d\",\n\t\toracleDataType)\n}", "title": "" }, { "docid": "610817c46e0b4239a996722dd282cab3", "score": "0.5944753", "text": "func (this *Value) Type() int {\n return this.dType\n}", "title": "" }, { "docid": "42541e1d81d6b7b725bd709b3e2f3829", "score": "0.5933765", "text": "func (this *Ntile) Type() value.Type { return value.NUMBER }", "title": "" }, { "docid": "300fb9fc495f5b1b630860b3da07ed85", "score": "0.5931216", "text": "func (tv TypeAndValue) IsType() bool {}", "title": "" }, { "docid": "f34849dc21e25d2e1c31ecd6b6067ca8", "score": "0.59201205", "text": "func (v Value) Type() byte {\n\tif vv := v.get(); vv != nil {\n\t\treturn vv.typ\n\t}\n\treturn 0\n}", "title": "" }, { "docid": "c797e8eb564334b45f724d71b1caffa7", "score": "0.5919741", "text": "func (s *BaseSV2017ParserListener) EnterVar_data_type(ctx *Var_data_typeContext) {}", "title": "" }, { "docid": "423dffda0a2a2016fa3b35989eaa0481", "score": "0.5907668", "text": "func (ub *UnionBuilder) Var(arg interface{}) string {\n\treturn ub.args.Add(arg)\n}", "title": "" }, { "docid": "1792669fad35581cc65c79f9bdda32cf", "score": "0.5890764", "text": "func newVar(name string, typ types.Type) *types.Var {\n\treturn types.NewParam(token.NoPos, nil, name, typ)\n}", "title": "" }, { "docid": "9b8db9a8bc57d07a28d389854e973083", "score": "0.588208", "text": "func (v Value) Type() Type {\n\treturn v.bits.Type()\n}", "title": "" }, { "docid": "3e5f5836854d8df3181b4c4693816e3f", "score": "0.5880734", "text": "func NewVar(typ reflect.Type, name string) *Var {\n\tc := name[0]\n\tif c >= '0' && c <= '9' {\n\t\tname = \"_ret_\" + name\n\t}\n\treturn &Var{typ: typ, name: name}\n}", "title": "" }, { "docid": "ee5d27cd98ee9f80a7d3d421b9c647cc", "score": "0.5867091", "text": "func (q *Query) Var() *Query {\n\tq.isVar = true\n\treturn q\n}", "title": "" }, { "docid": "2cac6dfc364d57394c4c08d9c7977cd9", "score": "0.5865123", "text": "func (v VarState) ValueType() VarType {\n\treturn v.Type\n}", "title": "" }, { "docid": "d22d1b46d5ec1b5668a102b3d111ca26", "score": "0.5849521", "text": "func (v *Value) Type() Type {\n\tif v == nil {\n\t\treturn TypeNull\n\t}\n\tif v.t == typeRawString {\n\t\tv.s = unescapeStringBestEffort(v.s)\n\t\tv.t = TypeString\n\t}\n\treturn v.t\n}", "title": "" }, { "docid": "04f6f6ff065e24267e99706c43d853fd", "score": "0.58459187", "text": "func (i VariableType) IsAVariableType() bool {\n\tfor _, v := range _VariableTypeValues {\n\t\tif i == v {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "772bccf714062fe4af9cf29c0337daf8", "score": "0.58261025", "text": "func (s *BaseVerilogParserListener) EnterVariable_type(ctx *Variable_typeContext) {}", "title": "" }, { "docid": "7982bf80741c581e227e0e72253a8707", "score": "0.57976437", "text": "func type_of_variable() {\n\tfmt.Println(\"\\n## \" + funcName())\n\n\tvar now time.Time = time.Now().UTC()\n\tfmt.Println(\"now is a type of: \", reflect.TypeOf(now))\n\tvar name string = \"Carl Johannes\"\n\tfmt.Println(\"name is a type of: \", reflect.TypeOf(name))\n\tvar age int = 5\n\tfmt.Println(\"age is a type of: \", reflect.TypeOf(age))\n}", "title": "" }, { "docid": "acfa98341e2705c4e171730f078a2f5f", "score": "0.5782536", "text": "func (p *Package) Variable(varName string) *Type {\n\tif t, ok := p.Variables[varName]; ok {\n\t\treturn t\n\t}\n\tt := &Type{Name: Name{Package: p.Path, Name: varName}}\n\tt.Kind = DeclarationOf\n\tp.Variables[varName] = t\n\treturn t\n}", "title": "" }, { "docid": "6f0ddfd751ba11d0674416bae8d268b5", "score": "0.5774992", "text": "func getType(myvar interface{}) string {\n\tt := reflect.TypeOf(myvar)\n\tif t.Kind() == reflect.Ptr {\n\t\treturn t.Elem().Name()\n\t}\n\treturn t.Name()\n}", "title": "" }, { "docid": "a50507c694cd32b3c2f4ad1f86542537", "score": "0.5770461", "text": "func VariableTypeValues() []VariableType {\n\treturn _VariableTypeValues\n}", "title": "" }, { "docid": "6d3fe0de66e1d680860cbc00381eeba0", "score": "0.5769354", "text": "func (cur *Cursor) NewVariable(numElements uint, varType *VariableType, size uint) (v *Variable, err error) {\n\t// log.Printf(\"cur=%+v varType=%+v\", cur, varType)\n\t// perform basic initialization\n\tif IsDebug {\n\t\tLog.Debug(\"NewVariable\", \"type\", varType, \"size\", size, \"numElements\", numElements)\n\t}\n\tisArray := numElements > 1\n\tif numElements < 1 {\n\t\tnumElements = 1\n\t}\n\tv = &Variable{\n\t\ttyp: varType,\n\t\tenvironment: cur.connection.environment,\n\t\tisAllocatedInternally: true,\n\t\tallocatedElements: numElements,\n\t\tsize: varType.size,\n\t\tindicator: make([]C.sb2, numElements),\n\t}\n\tif isArray {\n\t\tv.makeArray()\n\t}\n\n\t// log.Printf(\"NewVariable(elts=%d typ=%s)\", numElements, varType)\n\n\t// set the maximum length of the variable, ensure that a minimum of\n\t// 2 bytes is allocated to ensure that the array size check works\n\tif v.typ.isVariableLength {\n\t\tif size < 2 {\n\t\t\tsize = 2\n\t\t}\n\t\tv.size = size\n\t}\n\n\t// allocate the data for the variable\n\t// log.Printf(\"allocate data for the variable\")\n\tif err = v.allocateData(); err != nil {\n\t\treturn\n\t}\n\n\t// for variable length data, also allocate the return code\n\tif v.typ.isVariableLength {\n\t\tv.returnCode = make([]C.ub2, v.allocatedElements)\n\t\tv.actualLength = make([]C.ACTUAL_LENGTH_TYPE, v.allocatedElements)\n\t}\n\n\t// perform extended initialization\n\tif v.typ.initialize != nil {\n\t\tif err = v.typ.initialize(v, cur); err != nil {\n\t\t\terr = errgo.Newf(\"error initializing %s: %s\", v, err)\n\t\t\treturn\n\t\t}\n\t}\n\n\treturn v, nil\n}", "title": "" }, { "docid": "aee1e3c35f6c3b50b986d2cfb0779c54", "score": "0.5746815", "text": "func (t *VariableType) String() string {\n\treturn fmt.Sprintf(\"<%s %d var?%t char?%t>\", t.Name, t.oracleType,\n\t\tt.isVariableLength, t.isCharData)\n}", "title": "" }, { "docid": "0a107b6f5b0545c07e8c3932b9732f22", "score": "0.57429105", "text": "func Var(value Value, name string, logic_name string, required bool, usage string) {\n\tCommandLine.Var(value, name, logic_name, required, usage)\n}", "title": "" }, { "docid": "c37193064f896939f7cebcc0622ef91c", "score": "0.57402456", "text": "func writeDataTypeAttribute(server []UA_Server, session []UA_Session, node []UA_VariableNode, type_ []UA_VariableTypeNode, dataType []UA_NodeId) UA_StatusCode {\n\tif uint32(node[0].nodeClass) == uint32(UA_NODECLASS_VARIABLETYPE) && int((int((UA_Node_hasSubTypeOrInstances(node))))) != 0 {\n\t\t// If this is a variabletype, there must be no instances or subtypes of it\n\t\t// when we do the change\n\t\treturn UA_StatusCode((uint32_t((uint32((uint32(2147614720)))))))\n\t}\n\tif int((int((noarch.NotUA_Boolean(compatibleDataType(server, dataType, (*[100000000]UA_NodeId)(unsafe.Pointer(&type_[0].dataType))[:], 0)))))) != 0 {\n\t\t// Does the new type match the constraints of the variabletype?\n\t\treturn UA_StatusCode((uint32_t((uint32((uint32(2155085824)))))))\n\t}\n\tvar value UA_DataValue\n\t// Check if the current value would match the new type\n\tUA_DataValue_init((*[100000000]UA_DataValue)(unsafe.Pointer(&value))[:])\n\tvar retval UA_StatusCode = readValueAttribute(server, session, node, (*[100000000]UA_DataValue)(unsafe.Pointer(&value))[:])\n\tif retval != UA_StatusCode((uint32_t((uint32((0)))))) {\n\t\treturn UA_StatusCode(retval)\n\t}\n\tif int((int((UA_Boolean(value.hasValue))))) != 0 {\n\t\tif int((int((noarch.NotUA_Boolean(compatibleValue(server, dataType, UA_Int32(node[0].valueRank), uint(node[0].arrayDimensionsSize), node[0].arrayDimensions, (*[100000000]UA_Variant)(unsafe.Pointer(&value.value))[:], nil)))))) != 0 {\n\t\t\tretval = UA_StatusCode((uint32_t((uint32((uint32(2155085824)))))))\n\t\t}\n\t\tUA_DataValue_deleteMembers((*[100000000]UA_DataValue)(unsafe.Pointer(&value))[:])\n\t\tif retval != UA_StatusCode((uint32_t((uint32((0)))))) {\n\t\t\tUA_LOG_DEBUG(UA_Logger(server[0].config.logger), UA_LOGCATEGORY_SERVER, []byte(\"The current value does not match the new data type\\x00\"))\n\t\t\treturn UA_StatusCode(retval)\n\t\t}\n\t}\n\tvar dtCopy UA_NodeId = node[0].dataType\n\t// Replace the datatype nodeid\n\tretval = UA_NodeId_copy(dataType, (*[100000000]UA_NodeId)(unsafe.Pointer(&node[0].dataType))[:])\n\tif retval != UA_StatusCode((uint32_t((uint32((0)))))) {\n\t\tnode[0].dataType = dtCopy\n\t\treturn UA_StatusCode(retval)\n\t}\n\tUA_NodeId_deleteMembers((*[100000000]UA_NodeId)(unsafe.Pointer(&dtCopy))[:])\n\treturn 0\n}", "title": "" }, { "docid": "246404b9848dd6b81a5be8ac8f520708", "score": "0.5734965", "text": "func (av *AliasValue) Type() string { return av.target.Value.Type() }", "title": "" }, { "docid": "a2edd646922c14d5a6cbb70d066707df", "score": "0.57222694", "text": "func typeCaseVar(info *packages.Package, cc *ast.CaseClause) *types.Var {\n\t// Removed from go/loader\n\tif v := info.TypesInfo.Implicits[cc]; v != nil {\n\t\treturn v.(*types.Var)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2385efcbebe933eb3f63a9fa84b5fd58", "score": "0.57184947", "text": "func (v VarState) Value() interface{} {\n\tswitch v.Type {\n\tcase IntType:\n\t\treturn v.Int\n\tcase FloatType:\n\t\treturn v.Float\n\tcase MapType:\n\t\treturn v.Map\n\tcase StringType:\n\t\treturn v.String\n\tcase FuncType:\n\t\treturn v.Func\n\tdefault:\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "d4a4e8b5bc6e3f7d6a28cd3028b7e4b1", "score": "0.570287", "text": "func (o OneDashboardVariableOutput) Type() pulumi.StringOutput {\n\treturn o.ApplyT(func(v OneDashboardVariable) string { return v.Type }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "d05946f18d6ed166df8aadbd05b81332", "score": "0.5690653", "text": "func (n *TypeName) Type() Type { return n.typ }", "title": "" }, { "docid": "14bdf00d592a9bb35bba540c2678556c", "score": "0.5684054", "text": "func (pt PolyType) Var(i int) (*fbsemantic.Var, error) {\n\tif i < 0 || i >= pt.NumVars() {\n\t\treturn nil, errors.Newf(codes.Internal, \"request for polytype var out of bounds: %v in %v\", i, pt.NumVars())\n\t}\n\tv := new(fbsemantic.Var)\n\tif !pt.fb.Vars(v, i) {\n\t\treturn nil, errors.Newf(codes.Internal, \"missing var\")\n\t}\n\treturn v, nil\n}", "title": "" }, { "docid": "985c3e265b5611f6471687380c0d6d58", "score": "0.5680588", "text": "func NewVariable(v interface{}) (result Variable, err error) {\n\tswitch v := reflect.ValueOf(v); v.Kind() {\n\tcase reflect.String:\n\t\tresult.Type = TypeString\n\tdefault:\n\t\terr = fmt.Errorf(\"Unknown type: %s\", v.Kind())\n\t}\n\n\tresult.Value = v\n\treturn\n}", "title": "" }, { "docid": "58b595ac837500692cb392562fd8f4ad", "score": "0.5680535", "text": "func (t *Template) varValue(name string, st *state) reflect.Value {\n\tfield := t.findVar(st, name)\n\tif !field.IsValid() {\n\t\tif st.parent == nil {\n\t\t\tt.execError(st, t.linenum, \"name not found: %s in type %s\", name, st.data.Type())\n\t\t}\n\t\treturn t.varValue(name, st.parent)\n\t}\n\treturn field\n}", "title": "" }, { "docid": "cbcb982b2a5968e79e4a59a6e00850ea", "score": "0.56784433", "text": "func (d RData) Type() Type { return d.Value().Type() }", "title": "" }, { "docid": "0faaeb4d976f4fde6e4e192c94d84145", "score": "0.5676048", "text": "func (this *Field) Type() value.Type { return value.JSON }", "title": "" }, { "docid": "1e517e23077f07ad801a929aae79a1ea", "score": "0.5661077", "text": "func isVariable(value interface{}) bool {\n\t//FIXME\n\tif _, ok := value.(Variable); ok {\n\t\treturn true\n\t}\n\tif _, ok := value.(*Variable); ok {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "c834f534032aeb9d249676c1b29ce60b", "score": "0.5660912", "text": "func (s *BaseJava8ParserListener) EnterTypeVariable(ctx *TypeVariableContext) {}", "title": "" }, { "docid": "39f57b3c43ccbec075b901cf95e402dd", "score": "0.56500673", "text": "func (o SetVariableActivityOutput) Type() pulumi.StringOutput {\n\treturn o.ApplyT(func(v SetVariableActivity) string { return v.Type }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "db70db96cf80316d47c18b705d432b95", "score": "0.56479377", "text": "func Type(v Val) string {\n\tswitch v.(type) {\n\tcase String:\n\t\treturn \"string\"\n\tcase Number:\n\t\treturn \"number\"\n\tcase Bool:\n\t\treturn \"bool\"\n\tcase Func:\n\t\treturn \"func\"\n\tcase Object:\n\t\treturn \"object\"\n\tdefault:\n\t\tif v == Nil {\n\t\t\treturn \"nil\"\n\t\t} else {\n\t\t\treturn \"custom\"\n\t\t}\n\t}\n}", "title": "" }, { "docid": "66089f41167d7e54d6d152f68c872bb9", "score": "0.56439847", "text": "func (v *VarImp) Vars() []Var {\n\tarray := qn_conv.Interfaces(v.Val())\n\tif len(array) == 0 {\n\t\treturn nil\n\t}\n\tvars := make([]Var, len(array))\n\tfor k, v := range array {\n\t\tvars[k] = New(v)\n\t}\n\treturn vars\n}", "title": "" }, { "docid": "2bad83b2b484ebe2a128c1bb9b431060", "score": "0.56397164", "text": "func GoTypeToVariant(value reflect.Value) Variant {\n\tif !value.IsValid() {\n\t\treturn NewVariantNil()\n\t}\n\n\tvalueInterface := value.Interface()\n\tswitch v := valueInterface.(type) {\n\tcase bool:\n\t\treturn NewVariantBool(v)\n\tcase int:\n\t\treturn NewVariantInt(int64(v))\n\tcase int16:\n\t\treturn NewVariantInt(int64(v))\n\tcase int32:\n\t\treturn NewVariantInt(int64(v))\n\tcase int64:\n\t\treturn NewVariantInt(v)\n\tcase float32:\n\t\treturn NewVariantReal(float64(v))\n\tcase float64:\n\t\treturn NewVariantReal(v)\n\tcase string:\n\t\treturn NewVariantString(v)\n\tcase String:\n\t\treturn NewVariantString(internWithGodotString(v))\n\tcase Vector2:\n\t\treturn NewVariantVector2(v)\n\tcase Rect2:\n\t\treturn NewVariantRect2(v)\n\tcase Vector3:\n\t\treturn NewVariantVector3(v)\n\tcase Transform2D:\n\t\treturn NewVariantTransform2D(v)\n\tcase Plane:\n\t\treturn NewVariantPlane(v)\n\tcase Quat:\n\t\treturn NewVariantQuat(v)\n\tcase AABB:\n\t\treturn NewVariantAABB(v)\n\tcase Basis:\n\t\treturn NewVariantBasis(v)\n\tcase Transform:\n\t\treturn NewVariantTransform(v)\n\tcase Color:\n\t\treturn NewVariantColor(v)\n\tcase NodePath:\n\t\treturn NewVariantNodePath(v)\n\tcase RID:\n\t\treturn NewVariantRID(v)\n\tcase *GodotObject:\n\t\treturn NewVariantObject(v)\n\tcase Dictionary:\n\t\treturn NewVariantDictionary(v)\n\tcase Array:\n\t\treturn NewVariantArray(v)\n\tcase PoolByteArray:\n\t\treturn NewVariantPoolByteArray(v)\n\tcase PoolIntArray:\n\t\treturn NewVariantPoolIntArray(v)\n\tcase PoolRealArray:\n\t\treturn NewVariantPoolRealArray(v)\n\tcase PoolStringArray:\n\t\treturn NewVariantPoolStringArray(v)\n\tcase PoolVector2Array:\n\t\treturn NewVariantPoolVector2Array(v)\n\tcase PoolVector3Array:\n\t\treturn NewVariantPoolVector3Array(v)\n\tcase PoolColorArray:\n\t\treturn NewVariantPoolColorArray(v)\n\tcase Variant:\n\t\treturn v\n\t}\n\tlog.Panic(\"value not handled\", StringField(\"value\", fmt.Sprintf(\"%v\", value)))\n\treturn NewVariantNil()\n}", "title": "" }, { "docid": "34a3b5d4064eebd741f8abc7d01dec3c", "score": "0.5638678", "text": "func (v *VarImp) Val() interface{} {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tif v.safe {\n\t\tif t, ok := v.value.(*qn_type.Interface); ok {\n\t\t\treturn t.Val()\n\t\t}\n\t}\n\treturn v.value\n}", "title": "" }, { "docid": "98fa2be9bc389857b36af2cc4f21bb23", "score": "0.5638454", "text": "func (v Value) Type() ValueType {\n\treturn newValueType(v)\n}", "title": "" }, { "docid": "860d3c0a4f5ba20fb55f667a640ee96e", "score": "0.56344163", "text": "func Var(name string) *GrVar {\n\treturn &GrVar{nil, name}\n}", "title": "" }, { "docid": "2b40d15f7e017d4c8d61f400cb383007", "score": "0.5632647", "text": "func (dv *DynValue) Type() ref.Type {\n\treturn dv.ExprValue().Type()\n}", "title": "" }, { "docid": "0074b795c0490a31c5b99aed3c1d7cfb", "score": "0.5631387", "text": "func VecType(vin Vector) (vout Vector, numeric bool) {\n switch t := vin.(type) {\n case int:\n v := make([]int, len(vin))\n copy(v, vin)\n return (v, true)\n case float64:\n v := make([]float64, len(vin))\n copy(v, vin)\n return (v, true)\n case uint64:\n v := make([]uint64, len(vin))\n copy(v, vin)\n return (v, true)\n case complex128:\n v := make([]int, len(vin))\n copy(v, vin)\n return (v, true)\n default:\n return (v, false)\n }\n}", "title": "" }, { "docid": "7c88a6c7ceb13c106d790f4b6507fd63", "score": "0.5619768", "text": "func (v *VarImp) Set(value interface{}) (old interface{}) {\n\tif v.safe {\n\t\tif t, ok := v.value.(*qn_type.Interface); ok {\n\t\t\told = t.Set(value)\n\t\t\treturn\n\t\t}\n\t}\n\told = v.value\n\tv.value = value\n\treturn\n}", "title": "" }, { "docid": "715775250d6a5735559a2afe16e43491", "score": "0.5612948", "text": "func (op *ExtType) ImportVariableType(k *Importer) (retType ephemera.Named, retAff string, err error) {\n\tif imp, ok := op.Opt.(primTypeImporter); !ok {\n\t\terr = ImportError(op, op.At, errutil.Fmt(\"%w for %T\", UnhandledSwap, op.Opt))\n\t} else if typeName, aff, e := imp.ImportPrimType(k); e != nil {\n\t\terr = e\n\t} else {\n\t\t// currently, when affinity is set, the type name is a record ( or object ) kind\n\t\tvar cat string\n\t\tif len(aff) > 0 {\n\t\t\tcat = tables.NAMED_KIND\n\t\t} else {\n\t\t\tcat = tables.NAMED_TYPE\n\t\t}\n\t\tretType, retAff = k.NewName(typeName, cat, op.At.String()), aff\n\t}\n\treturn\n}", "title": "" }, { "docid": "75099972deaff2dd183cf5736d89f27c", "score": "0.5612004", "text": "func getVarTypeDesc(t script.VariableType) string {\n\tswitch t {\n\tcase script.VAR_TYPE_STRING:\n\t\treturn \"{b}(String){!}\"\n\tcase script.VAR_TYPE_NUMBER:\n\t\treturn \"{y}(Number){!}\"\n\tcase script.VAR_TYPE_BOOLEAN:\n\t\treturn \"{g}(Boolean){!}\"\n\tdefault:\n\t\treturn \"\"\n\t}\n}", "title": "" }, { "docid": "e8347519af7c93cb7700356b4df28ce9", "score": "0.56011087", "text": "func (type_ VariantType) Value() VariantType {\n\tret0 := C.g_variant_type_value(type_.native())\n\treturn wrapVariantType(ret0)\n}", "title": "" }, { "docid": "b497c3331212f6a140bf1fc0309114e9", "score": "0.55969757", "text": "func NewVar(name string, tp Type, docs ...Comment) *Var {\n\treturn &Var{\n\t\tName: name,\n\t\tType: tp,\n\t\tdocs: docs,\n\t}\n}", "title": "" }, { "docid": "4876b11c820d716b5ab26ae349ce5c8c", "score": "0.5592541", "text": "func GetType(myvar interface{}) string {\n\tt := reflect.TypeOf(myvar)\n\tif t.Kind() == reflect.Ptr {\n\t\treturn \"*\" + t.Elem().Name()\n\t}\n\treturn t.Name()\n}", "title": "" }, { "docid": "099f1478e1af2d681fef619718e56331", "score": "0.5584496", "text": "func (s *BaseBruenListener) EnterVarsTypeInit(ctx *VarsTypeInitContext) {}", "title": "" }, { "docid": "b0d9d1ae546de413fc6e945b6b2c6cd3", "score": "0.5581179", "text": "func (o AppendVariableActivityOutput) Type() pulumi.StringOutput {\n\treturn o.ApplyT(func(v AppendVariableActivity) string { return v.Type }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "c03ccbd2ae7b7944829bb34618f0cf18", "score": "0.5572046", "text": "func UA_Server_addVariableTypeNode(server []UA_Server, requestedNewNodeId UA_NodeId, parentNodeId UA_NodeId, referenceTypeId UA_NodeId, browseName UA_QualifiedName, typeDefinition UA_NodeId, attr UA_VariableTypeAttributes, nodeContext interface{}, outNewNodeId []UA_NodeId) UA_StatusCode {\n\treturn __UA_Server_addNode(server, UA_NODECLASS_VARIABLETYPE, (*[100000000]UA_NodeId)(unsafe.Pointer(&requestedNewNodeId))[:], (*[100000000]UA_NodeId)(unsafe.Pointer(&parentNodeId))[:], (*[100000000]UA_NodeId)(unsafe.Pointer(&referenceTypeId))[:], browseName, (*[100000000]UA_NodeId)(unsafe.Pointer(&typeDefinition))[:], (*[100000000]UA_VariableTypeAttributes)(unsafe.Pointer(&attr))[:], (*[100000000]UA_DataType)(unsafe.Pointer(&UA_TYPES[116]))[:], nodeContext, outNewNodeId)\n}", "title": "" }, { "docid": "1ec1b966451337b0334cb6adb62463a2", "score": "0.55606186", "text": "func (v *Variable) TypeName(mod int) string {\n\tif v == nil {\n\t\treturn \"\"\n\t}\n\n\treturn getTypeName(v.Type, mod)\n}", "title": "" }, { "docid": "4c1858625fba9bc96aa106856e4cb466", "score": "0.55595493", "text": "func UA_Client_addVariableTypeNode(client []UA_Client, requestedNewNodeId UA_NodeId, parentNodeId UA_NodeId, referenceTypeId UA_NodeId, browseName UA_QualifiedName, attr UA_VariableTypeAttributes, outNewNodeId []UA_NodeId) UA_StatusCode {\n\treturn __UA_Client_addNode(client, UA_NODECLASS_VARIABLETYPE, requestedNewNodeId, parentNodeId, referenceTypeId, browseName, UA_NODEID_NULL, (*[100000000]UA_VariableTypeAttributes)(unsafe.Pointer(&attr))[:], (*[100000000]UA_DataType)(unsafe.Pointer(&UA_TYPES[116]))[:], outNewNodeId)\n}", "title": "" }, { "docid": "7a3b85f0c73ee4799e6c4e55875fd307", "score": "0.55530405", "text": "func (g *VariableGrouping) Variable(name string, typ TypeReference, format string, args ...interface{}) *VariableGrouping {\n\tv := &Variable{\n\t\tIdentifier: Identifier{\n\t\t\tName: name,\n\t\t\tType: typ,\n\t\t},\n\t\tConstant: false,\n\t\tFormat: format,\n\t\tArgs: args,\n\t}\n\tg.Variables = append(g.Variables, v)\n\treturn g\n}", "title": "" }, { "docid": "745f0b7418a722fa0acf585d73341c1f", "score": "0.5546539", "text": "func (n *Node) IsVar() bool { return n.isArg() && !n.isStmt && !n.isConstant() }", "title": "" }, { "docid": "a40b080b3bae8ef16ee35fcd369b9320", "score": "0.55449396", "text": "func NewVariable(name string) {\n var TempObject *libgogo.ObjectDesc;\n var temp uint64;\n if Compile != 0 {\n\t\tCurrentObject = libgogo.NewObject(name, CurrentPackage, libgogo.CLASS_VAR);\n\t\tif InsideFunction == 0 { //Global objects or function parameters\n\t\t if InsideFunctionVarDecl == 0 { //Global objects\n\t\t TempObject = libgogo.GetObject(name, CurrentPackage, GlobalObjects);\n\t\t if TempObject != nil {\n\t\t SymbolTableError(\"duplicate\", \"global\", \"identifier\", name);\n\t\t }\n\t\t GlobalObjects = libgogo.AppendObject(CurrentObject, GlobalObjects);\n\t\t } else { //Function parameters\n\t\t if (CurrentFunction.ForwardDecl == 0) && (CurrentFunction.Base != nil) { //Check implementation of forward declaration\n\t\t fwdParamCount = fwdParamCount + 1; //One more parameter\n\t\t ParameterCheck_Less(CurrentFunction, fwdParamCount); //Check number of parameters\n \t\t TempObject = libgogo.GetParameterAt(fwdParamCount, CurrentFunction);\n \t\t temp = libgogo.HasField(name, CurrentFunction); //Check for duplicate parameter names\n\t if temp != 0 {\n\t SymbolTableError(\"duplicate\", \"parameter\", \"name\", name);\n\t }\n \t\t TempObject.PackageName = CurrentFunction.PackageName;\n \t\t TempObject.Name = name; //Set name of current parameter\n\t\t //A type check can only be performed as soon as the type is parsed (see parser.go)\n\t\t } else {\n\t temp = libgogo.HasField(name, CurrentFunction);\n\t if temp != 0 {\n\t SymbolTableError(\"duplicate\", \"parameter\", \"name\", name);\n\t } else {\n\t CurrentObject.Class = libgogo.CLASS_PARAMETER;\n\t CurrentObject.PackageName = CurrentFunction.PackageName;\n\t libgogo.AddParameters(CurrentObject, CurrentFunction);\n\t }\n\t\t }\n\t\t }\n\t\t} else { //Function-local objects\n\t TempObject = libgogo.GetObject(name, CurrentPackage, LocalObjects);\n\t if TempObject != nil {\n\t SymbolTableError(\"duplicate\", \"local\", \"identifier\", name);\n\t }\n\t TempObject = libgogo.GetObject(name, CurrentPackage, CurrentFunction.Fields);\n\t if TempObject != nil {\n\t SymbolTableError(\"There is already a parameter\", \"\", \"named\", name);\n\t }\n\t LocalObjects = libgogo.AppendObject(CurrentObject, LocalObjects);\n\t\t}\n }\n}", "title": "" }, { "docid": "12ad2f118ce650d88b1ade5eb3397118", "score": "0.5526482", "text": "func (obj *object) Type() Type {}", "title": "" }, { "docid": "e15e08264695bc56746d10f7a3248907", "score": "0.55204797", "text": "func (n *typedName) Type() Type {\n\treturn n.t\n}", "title": "" }, { "docid": "d4adc47d84f2ba55441bc30135b23325", "score": "0.55117726", "text": "func VariableTypeFromString(in string) VariableType {\n\tswitch in {\n\tcase string(SecretVariable):\n\t\treturn SecretVariable\n\tcase string(TextVariable):\n\t\treturn TextVariable\n\tcase string(StringVariable):\n\t\treturn StringVariable\n\tcase string(KeyVariable):\n\t\treturn KeyVariable\n\tcase string(BooleanVariable):\n\t\treturn BooleanVariable\n\tdefault:\n\t\treturn StringVariable\n\t}\n}", "title": "" }, { "docid": "7a4f008b952f81a95b6e9ae38628d1e2", "score": "0.5507861", "text": "func (v Value) Type() ValueType {\n\tif v.iface == nil {\n\t\treturn NilType\n\t}\n\tswitch v.iface.(type) {\n\tcase int64:\n\t\treturn IntType\n\tcase float64:\n\t\treturn FloatType\n\tcase bool:\n\t\treturn BoolType\n\tcase string:\n\t\treturn StringType\n\tcase *Table:\n\t\treturn TableType\n\tcase *Code:\n\t\treturn CodeType\n\tcase *GoFunction, *Closure:\n\t\treturn FunctionType\n\tcase *Thread:\n\t\treturn ThreadType\n\tcase *UserData:\n\t\treturn UserDataType\n\tdefault:\n\t\treturn UnknownType\n\t}\n}", "title": "" }, { "docid": "c3ecc25a5640042bf82dbe0b6d2aec2d", "score": "0.5506544", "text": "func (s *ipNetSliceValue) Type() string {\n\treturn \"ipNetSlice\"\n}", "title": "" }, { "docid": "a0ce15c2acd3ae84c29d0bc6bda60c3a", "score": "0.55061686", "text": "func TypeName(myvar interface{}) (res string) {\n\tt := reflect.TypeOf(myvar)\n\tfor t.Kind() == reflect.Ptr {\n\t\tt = t.Elem()\n\t\tres += \"*\"\n\t}\n\treturn res + t.Name()\n}", "title": "" }, { "docid": "f765107fafae5f0c2dc120818a23a555", "score": "0.5499191", "text": "func (tv TypeAndValue) IsValue() bool {}", "title": "" }, { "docid": "378d2ea9978f044f56e2d7e5a150ae46", "score": "0.5496483", "text": "func (s *BaseSystemVerilogParserListener) ExitVar_data_type(ctx *Var_data_typeContext) {}", "title": "" }, { "docid": "231a013e9f292577e38e862547457fc7", "score": "0.54955274", "text": "func (v *Value) Type() NodeType {\n\treturn nodeType(v.data)\n}", "title": "" }, { "docid": "46beaf8f6f27c6de92787875a8beea45", "score": "0.549451", "text": "func VariableType_Values() []string {\n\treturn []string{\n\t\tVariableTypeIncidentRecordArn,\n\t\tVariableTypeInvolvedResources,\n\t}\n}", "title": "" }, { "docid": "1adfc294fffb50694873bb28bd177da3", "score": "0.54881245", "text": "func GetType(s interface{}) string {\n\tvar varType string\n\tswitch s.(type) {\n\tcase int:\n\t\tvarType = \"int\"\n\tcase int8:\n\t\tvarType = \"int8\"\n\tcase int16:\n\t\tvarType = \"int16\"\n\tcase int32:\n\t\tvarType = \"int32\"\n\tcase int64:\n\t\tvarType = \"int64\"\n\tcase uint:\n\t\tvarType = \"uint\"\n\tcase uint8:\n\t\tvarType = \"uint8\"\n\tcase uint16:\n\t\tvarType = \"uint16\"\n\tcase uint32:\n\t\tvarType = \"uint32\"\n\tcase uint64:\n\t\tvarType = \"uint64\"\n\tcase float32:\n\t\tvarType = \"float32\"\n\tcase float64:\n\t\tvarType = \"float64\"\n\tcase bool:\n\t\tvarType = \"bool\"\n\tcase string:\n\t\tvarType = \"string\"\n\tcase []byte:\n\t\tvarType = \"[]byte\"\n\tdefault:\n\t\tif s == nil {\n\t\t\treturn \"nil\"\n\t\t}\n\t\tv := zreflect.TypeOf(s)\n\t\tif v.Kind() == reflect.Invalid {\n\t\t\treturn \"invalid\"\n\t\t}\n\t\tvarType = v.String()\n\t}\n\treturn varType\n}", "title": "" }, { "docid": "e032cdd784b5fab1efb4dfbd5baf1736", "score": "0.5487975", "text": "func main() {\r\n\tvar name = \"scotty\"\r\n\tfmt.Printf(\"type %T value %v\", name, name)\r\n}", "title": "" } ]
0b151a047985c18a545ec08a288439d3
Parse fetches the distroId from the http request.
[ { "docid": "0dc42f3df241bd0d7aae15231e9bd11c", "score": "0.6194259", "text": "func (h *distroIDPatchHandler) Parse(ctx context.Context, r *http.Request) error {\n\th.distroId = gimlet.GetVars(r)[\"distro_id\"]\n\tbody := util.NewRequestReader(r)\n\tdefer body.Close()\n\tb, err := ioutil.ReadAll(body)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Argument read error\")\n\t}\n\th.body = b\n\n\treturn nil\n}", "title": "" } ]
[ { "docid": "0e7b9fc2e0f585143bd5926c2c97f0b7", "score": "0.72890216", "text": "func (h *distroIDGetHandler) Parse(ctx context.Context, r *http.Request) error {\n\th.distroId = gimlet.GetVars(r)[\"distro_id\"]\n\n\treturn nil\n}", "title": "" }, { "docid": "716619fea5b87a343a7d479d30a7c5c6", "score": "0.72500706", "text": "func (h *distroIDGetHandler) Parse(ctx context.Context, r *http.Request) error {\n\th.distroID = gimlet.GetVars(r)[\"distro_id\"]\n\n\treturn nil\n}", "title": "" }, { "docid": "8a845bc17a081cc0e77cb013f5fd16a7", "score": "0.6774654", "text": "func (h *distroIDGetSetupHandler) Parse(ctx context.Context, r *http.Request) error {\n\th.distroID = gimlet.GetVars(r)[\"distro_id\"]\n\n\treturn nil\n}", "title": "" }, { "docid": "a445a25fa9f0f60984d0d6ef5e61ddb1", "score": "0.66705847", "text": "func (h *distroIDDeleteHandler) Parse(ctx context.Context, r *http.Request) error {\n\th.distroId = gimlet.GetVars(r)[\"distro_id\"]\n\n\treturn nil\n}", "title": "" }, { "docid": "c082dd2a292e8b51082f871c601a281d", "score": "0.6640144", "text": "func (h *distroIDDeleteHandler) Parse(ctx context.Context, r *http.Request) error {\n\th.distroID = gimlet.GetVars(r)[\"distro_id\"]\n\n\treturn nil\n}", "title": "" }, { "docid": "a095e59233937c597343186bd62f58e9", "score": "0.61794055", "text": "func (h *distroIDPatchHandler) Parse(ctx context.Context, r *http.Request) error {\n\th.distroID = gimlet.GetVars(r)[\"distro_id\"]\n\tbody := util.NewRequestReader(r)\n\tdefer body.Close()\n\tb, err := ioutil.ReadAll(body)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Argument read error\")\n\t}\n\th.body = b\n\n\treturn nil\n}", "title": "" }, { "docid": "d15469d81e47ba5b01974d37ac1e910b", "score": "0.5919349", "text": "func (h *distroIDChangeSetupHandler) Parse(ctx context.Context, r *http.Request) error {\n\th.distroID = gimlet.GetVars(r)[\"distro_id\"]\n\tbody := util.NewRequestReader(r)\n\tdefer body.Close()\n\n\tif err := utility.ReadJSON(body, h); err != nil {\n\t\treturn errors.Wrap(err, \"Argument read error\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "fcd4645435c99327b9cb0e7470c910bf", "score": "0.58994627", "text": "func (h *distroIDPutHandler) Parse(ctx context.Context, r *http.Request) error {\n\th.distroID = gimlet.GetVars(r)[\"distro_id\"]\n\n\tbody := util.NewRequestReader(r)\n\tdefer body.Close()\n\tb, err := ioutil.ReadAll(body)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Argument read error\")\n\t}\n\th.body = b\n\n\treturn nil\n}", "title": "" }, { "docid": "f8d941fd1545734dd9a6187bbeb3fa36", "score": "0.57775533", "text": "func parse(id string) (rId, rType string) {\n\tif strings.HasPrefix(id, \"/\") == false {\n\t\tid = \"/\" + id\n\t}\n\tif strings.HasSuffix(id, \"/\") == false {\n\t\tid = id + \"/\"\n\t}\n\n\tparts := strings.Split(id, \"/\")\n\tl := len(parts)\n\n\tif l%2 == 0 {\n\t\trId = parts[l-2]\n\t\trType = parts[l-3]\n\t} else {\n\t\trId = parts[l-3]\n\t\trType = parts[l-2]\n\t}\n\treturn\n}", "title": "" }, { "docid": "8e43317d039dda29576afcc842276464", "score": "0.57003194", "text": "func (h *distroExecuteHandler) Parse(ctx context.Context, r *http.Request) error {\n\th.distro = gimlet.GetVars(r)[\"distro_id\"]\n\tbody := util.NewRequestReader(r)\n\tdefer body.Close()\n\n\tif err := utility.ReadJSON(body, &h.opts); err != nil {\n\t\treturn errors.Wrap(err, \"could not read request\")\n\t}\n\n\tif h.opts.Script == \"\" {\n\t\treturn errors.New(\"cannot execute an empty script\")\n\t}\n\tif !h.opts.IncludeTaskHosts && !h.opts.IncludeSpawnHosts {\n\t\treturn errors.New(\"cannot exclude both spawn hosts and task hosts from script execution\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "4a2eeb2f7af036ce5412974a70380c69", "score": "0.5622797", "text": "func Parse(uri string) (DID, error) {\n\tmethod, err := GetMethod(uri)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdt, err := GetDIDTypeFromMethod(method)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdid, err := dt.Parse(uri)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn did, nil\n}", "title": "" }, { "docid": "249080e49d4a7b81e8ee0964e5934c7c", "score": "0.5473088", "text": "func (id *ID) Parse(r *http.Request) error {\n\tid.Val = mux.Vars(r)[\"id\"]\n\n\tif err := id.valid(); err != nil {\n\t\treturn errors.Wrap(err, \"data.api.filters.ID.Parse\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "dfa00357beac3064b98391e6cc43a48f", "score": "0.5466079", "text": "func parseID(b [512]byte) *ID {\n\tid := *(*unix.HDDriveID)(unsafe.Pointer(&b[0]))\n\n\treturn &ID{\n\t\tModel: byteStr(id.Model[:]),\n\t\tSerial: byteStr(id.Serial_no[:]),\n\t\tFirmware: byteStr(id.Fw_rev[:]),\n\t}\n}", "title": "" }, { "docid": "e58e0748fbde40dd150d131979d97943", "score": "0.542137", "text": "func (h *distroIcecreamConfigHandler) Parse(ctx context.Context, r *http.Request) error {\n\th.distro = gimlet.GetVars(r)[\"distro_id\"]\n\tbody := util.NewRequestReader(r)\n\tdefer body.Close()\n\n\tif err := utility.ReadJSON(body, &h.opts); err != nil {\n\t\treturn errors.Wrap(err, \"could not read request body\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "64a41a49075abcb233ba46e1efa8bfd8", "score": "0.5412623", "text": "func ParseBuildID(id BuildID) (string, string, int, error) {\n\tparts := strings.SplitN(string(id), \"|\", 3)\n\tif len(parts) != 3 {\n\t\treturn \"\", \"\", -1, fmt.Errorf(\"Invalid build ID `%s`: Must be of the form: myMaster|myBuilder|42\", string(id))\n\t}\n\tn, err := bytesToIntBigEndian([]byte(parts[2]))\n\tif err != nil {\n\t\treturn \"\", \"\", -1, fmt.Errorf(\"Invalid build ID: build number is not valid: %s\", err)\n\t}\n\treturn parts[0], parts[1], int(n), nil\n}", "title": "" }, { "docid": "f304ac0c32bab6d02acf38c707a44a5c", "score": "0.5354694", "text": "func ReadIDFromURL(r *http.Request) int {\n\t//Remove any information on forms etc.\n\turl_c := strings.Split(r.URL.String(), \"?\")\n\n\t//Remove the ip and port\n\turl := strings.Split(url_c[0], \"/\")\n\n\t//Remove the function name/subdir\n\tsubdir := strings.Split(url[len(url)-1], \"_\")\n\tid_string := subdir[len(subdir)-1]\n\n\t//Convert the id to integer from string\n\tid_int, err := strconv.Atoi(id_string)\n\tErrorCheck(err, true, true, true)\n\n\treturn id_int\n}", "title": "" }, { "docid": "122180aa20dd9095267acbff7234cf3d", "score": "0.52498865", "text": "func parseOsRelease(osRelease string) *DistroInfo {\n\tresult := &DistroInfo{Distribution: Unknown}\n\n\t// Default value\n\tosID := \"unknown\"\n\tosNAME := \"Unknown\"\n\tversion := \"\"\n\n\t// Split into lines\n\tlines := strings.Split(osRelease, \"\\n\")\n\t// Iterate lines\n\tfor _, line := range lines {\n\t\t// Split each line by the equals char\n\t\tsplitLine := strings.SplitN(line, \"=\", 2)\n\t\t// Check we have\n\t\tif len(splitLine) != 2 {\n\t\t\tcontinue\n\t\t}\n\t\tswitch splitLine[0] {\n\t\tcase \"ID\":\n\t\t\tosID = strings.ToLower(strings.Trim(splitLine[1], \"\\\"\"))\n\t\tcase \"NAME\":\n\t\t\tosNAME = strings.Trim(splitLine[1], \"\\\"\")\n\t\tcase \"VERSION_ID\":\n\t\t\tversion = strings.Trim(splitLine[1], \"\\\"\")\n\t\t}\n\t}\n\n\t// Check distro name against list of distros\n\tswitch osID {\n\tcase \"fedora\":\n\t\tresult.Distribution = Fedora\n\tcase \"centos\":\n\t\tresult.Distribution = CentOS\n\tcase \"rhel\":\n\t\tresult.Distribution = RHEL\n\tcase \"arch\":\n\t\tresult.Distribution = Arch\n\tcase \"archlabs\":\n\t\tresult.Distribution = ArchLabs\n\tcase \"ctlos\":\n\t\tresult.Distribution = Ctlos\n\tcase \"debian\":\n\t\tresult.Distribution = Debian\n\tcase \"ubuntu\":\n\t\tresult.Distribution = Ubuntu\n\tcase \"gentoo\":\n\t\tresult.Distribution = Gentoo\n\tcase \"zorin\":\n\t\tresult.Distribution = Zorin\n\tcase \"parrot\":\n\t\tresult.Distribution = Parrot\n\tcase \"linuxmint\":\n\t\tresult.Distribution = Linuxmint\n\tcase \"void\":\n\t\tresult.Distribution = VoidLinux\n\tcase \"elementary\":\n\t\tresult.Distribution = Elementary\n\tcase \"kali\":\n\t\tresult.Distribution = Kali\n\tcase \"neon\":\n\t\tresult.Distribution = Neon\n\tcase \"arcolinux\":\n\t\tresult.Distribution = ArcoLinux\n\tcase \"manjaro\":\n\t\tresult.Distribution = Manjaro\n\tcase \"manjaro-arm\":\n\t\tresult.Distribution = ManjaroARM\n\tcase \"deepin\":\n\t\tresult.Distribution = Deepin\n\tcase \"raspbian\":\n\t\tresult.Distribution = Raspbian\n\tcase \"opensuse-tumbleweed\":\n\t\tresult.Distribution = Tumbleweed\n\tcase \"opensuse-leap\":\n\t\tresult.Distribution = Leap\n\tcase \"pop\":\n\t\tresult.Distribution = PopOS\n\tcase \"solus\":\n\t\tresult.Distribution = Solus\n\tcase \"endeavouros\":\n\t\tresult.Distribution = EndeavourOS\n\tcase \"crux\":\n\t\tresult.Distribution = Crux\n\tcase \"nixos\":\n\t\tresult.Distribution = NixOS\n\tcase \"artix\":\n\t\tresult.Distribution = ArtixLinux\n\tcase \"uos\":\n\t\tresult.Distribution = Uos\n\tdefault:\n\t\tresult.Distribution = Unknown\n\t}\n\n\tresult.Name = osNAME\n\tresult.ID = osID\n\tresult.Release = version\n\n\treturn result\n}", "title": "" }, { "docid": "d7bf93095074a66bf3743b81abe05e59", "score": "0.52147293", "text": "func ParseDeleteAuthorizationsIDResponse(rsp *http.Response) (*DeleteAuthorizationsIDResponse, error) {\n\tbodyBytes, err := ioutil.ReadAll(rsp.Body)\n\tdefer rsp.Body.Close()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresponse := &DeleteAuthorizationsIDResponse{\n\t\tBody: bodyBytes,\n\t\tHTTPResponse: rsp,\n\t}\n\n\tswitch {\n\tcase strings.Contains(rsp.Header.Get(\"Content-Type\"), \"json\") && true:\n\t\tvar dest Error\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSONDefault = &dest\n\n\t}\n\n\treturn response, nil\n}", "title": "" }, { "docid": "782dca05975bbe2251c43e96929e3b3e", "score": "0.5131488", "text": "func resourceVSphereComputeClusterHostGroupParseID(id string) (string, string, error) {\n\tparts := strings.SplitN(id, \":\", 3)\n\tif len(parts) < 2 {\n\t\treturn \"\", \"\", fmt.Errorf(\"bad ID %q\", id)\n\t}\n\treturn parts[0], parts[1], nil\n}", "title": "" }, { "docid": "0d54fd396407bafbd4c92e97ad99b912", "score": "0.51089585", "text": "func parseURLParamID(r *http.Request, key string) (string, error) {\n\tv := chi.URLParam(r, key)\n\tif v == \"\" {\n\t\tes := fmt.Sprintf(\"there is no value with key: %v inside URL\", key)\n\t\treturn \"\", errors.New(es)\n\t}\n\n\tif _, err := uuid.Parse(v); err != nil {\n\t\treturn \"\", RequestError{\n\t\t\tErrorText: \"id is not in UUID format\",\n\t\t\tStatus: http.StatusBadRequest,\n\t\t}\n\t}\n\n\treturn \"\", nil\n}", "title": "" }, { "docid": "2a5062ad7f905f8d2b0f74766840d36c", "score": "0.5095814", "text": "func extractCORSID(rawPath string) cors.ID {\n\tsegments := strings.Split(rawPath, \"/\")\n\tid := segments[len(segments)-1]\n\treturn cors.ID(id)\n}", "title": "" }, { "docid": "8bff4fd4a9ea97ea0363db604805e70c", "score": "0.5091777", "text": "func ParseToken(request *http.Request) (primitive.ObjectID, error) {\n\ttoken := strings.ReplaceAll(request.Header.Values(\"Authorization\")[0], \"Bearer \", \"\")\n\tbs, err := jwt.DecodeSegment(token)\n\tif err != nil {\n\t\tlog.Println(\"Unable to DecodeSegment:\", err.Error())\n\t\treturn primitive.ObjectID{}, err\n\t}\n\tID, err := primitive.ObjectIDFromHex(string(bs))\n\tif err != nil {\n\t\tlog.Println(\"Unable to convert string id to ObjectID:\", err.Error())\n\t\treturn primitive.ObjectID{}, err\n\t}\n\treturn ID, nil\n}", "title": "" }, { "docid": "b070959d278789b67ebf07dbcbfb8e5a", "score": "0.5079518", "text": "func parseId(c *gin.Context) (int, error) {\n\tidStr := c.Param(\"id\")\n\tid, err := strconv.Atoi(idStr)\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(`Could not convert id paramater \"%s\" to int`, idStr)\n\t}\n\tif id < 0 || id > len(todos)-1 {\n\t\treturn 0, fmt.Errorf(`Could not find todo with id = %d`, id)\n\t}\n\treturn id, nil\n}", "title": "" }, { "docid": "d746404506522013711c15c1e7186fbb", "score": "0.5072492", "text": "func UserIDFromRequest(r *http.Request) (*string, error) {\n\tuserId := r.Header.Get(UserIDHeader)\n\tif userId == \"\" {\n\t\treturn nil, errors.New(\"could not parse user id from headers\")\n\t}\n\n\treturn &userId, nil\n}", "title": "" }, { "docid": "4831bc52adc8ac1d939c8a169bf0b0f2", "score": "0.506253", "text": "func Parse(r *http.Request) APIRequestHeader {\n\th := APIRequestHeader{\n\t\tAPIKey: r.Header.Get(\"API-Key\"),\n\t\tAppIdentifier: r.Header.Get(\"App-Identifier\"),\n\t\tContentType: r.Header.Get(\"Content-Type\"),\n\t\tDeviceID: r.Header.Get(\"Device-Identifier\"),\n\t\tDeviceModel: r.Header.Get(\"Device-Model\"),\n\t\tDevicePlatform: r.Header.Get(\"Device-Platform\"),\n\t\tUserAgent: r.UserAgent(),\n\t}\n\tif h.DevicePlatform == platform.WEB {\n\t\th.AppIdentifier = r.Header.Get(\"Origin\")\n\t}\n\treturn h\n}", "title": "" }, { "docid": "f1728d0c91bfdf2fe81fba420d53111c", "score": "0.5057518", "text": "func ExtractTokenID(r *http.Request) (uint32, error) {\n\n\ttokenString := ExtractToken(r)\n\ttoken, err := jwt.Parse(tokenString, func(token *jwt.Token) (interface{}, error) {\n\t\tif _, ok := token.Method.(*jwt.SigningMethodHMAC); !ok {\n\t\t\treturn nil, fmt.Errorf(\"Unexpected signing method: %v\", token.Header[\"alg\"])\n\t\t}\n\t\treturn []byte(viper.GetString(\"token.key\")), nil\n\t})\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tclaims, ok := token.Claims.(jwt.MapClaims)\n\tif ok && token.Valid {\n\t\tuid, err := strconv.ParseUint(fmt.Sprintf(\"%.0f\", claims[\"user_id\"]), 10, 32)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\treturn uint32(uid), nil\n\t}\n\treturn 0, nil\n}", "title": "" }, { "docid": "4dedee51b0cc216be8fbadf957d113ab", "score": "0.5035115", "text": "func ParseGetAuthorizationsIDResponse(rsp *http.Response) (*GetAuthorizationsIDResponse, error) {\n\tbodyBytes, err := ioutil.ReadAll(rsp.Body)\n\tdefer rsp.Body.Close()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresponse := &GetAuthorizationsIDResponse{\n\t\tBody: bodyBytes,\n\t\tHTTPResponse: rsp,\n\t}\n\n\tswitch {\n\tcase strings.Contains(rsp.Header.Get(\"Content-Type\"), \"json\") && rsp.StatusCode == 200:\n\t\tvar dest Authorization\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON200 = &dest\n\n\tcase strings.Contains(rsp.Header.Get(\"Content-Type\"), \"json\") && true:\n\t\tvar dest Error\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSONDefault = &dest\n\n\t}\n\n\treturn response, nil\n}", "title": "" }, { "docid": "243829d9f591f20ccc1979cc33890ac5", "score": "0.5012174", "text": "func IDFromHeader(h http.Header) (uint64, error) {\n\tidStr := h.Get(\"id\")\n\treturn strconv.ParseUint(idStr, 10, 64)\n}", "title": "" }, { "docid": "d89488a35319267b864c0709f3091005", "score": "0.4982223", "text": "func ParseId(id int64) (t time.Time, ts int64, dataCenterId int64, workerId int64, seq int64) {\n\tseq = id & CSequenceMask\n\tworkerId = (id >> CWorkerIdShift) & CMaxWorker\n\tdataCenterId = (id >> CDataCenterShift) & CMaxDataCenter\n\tts = (id >> CTimeStampShift) + CEpoch\n\tt = time.Unix(ts/1000, (ts%1000)*1000000)\n\treturn\n}", "title": "" }, { "docid": "3c77bf2e2e3a0c950c6a5cae1d2df7cd", "score": "0.4975754", "text": "func ParseRevID(revid string) (int, string) {\n\tif revid == \"\" {\n\t\treturn 0, \"\"\n\t}\n\tvar generation int\n\tvar id string\n\tn, _ := fmt.Sscanf(revid, \"%d-%s\", &generation, &id)\n\tif n < 1 || generation < 1 {\n\t\tbase.Warn(\"parseRevID failed on %q\", revid)\n\t\treturn -1, \"\"\n\t}\n\treturn generation, id\n}", "title": "" }, { "docid": "af75b58c1d64a9a0ca4d6c785f0ee7bf", "score": "0.49742076", "text": "func parsePrincipalID(principalID string) (map[string]string, error) {\n\tparsed := make(map[string]string)\n\n\tparts := strings.SplitN(principalID, \":\", 2)\n\tif len(parts) != 2 {\n\t\treturn parsed, errors.Errorf(\"invalid id %v\", principalID)\n\t}\n\texternalID := strings.TrimPrefix(parts[1], \"//\")\n\n\tparsed[\"ID\"] = externalID\n\n\tpparts := strings.SplitN(parts[0], \"_\", 2)\n\tif len(pparts) != 2 {\n\t\treturn parsed, errors.Errorf(\"invalid id %v\", principalID)\n\t}\n\n\tparsed[\"provider\"] = pparts[0]\n\tparsed[\"type\"] = pparts[1]\n\n\treturn parsed, nil\n}", "title": "" }, { "docid": "c156de99aa626d626a58549c978f8b71", "score": "0.49648106", "text": "func parseOptClientID(data []byte) (*optClientID, error) {\n\tcid, err := DuidFromBytes(data)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &optClientID{*cid}, nil\n}", "title": "" }, { "docid": "bcbdcc44a7db1cbcf468530cbbb5668b", "score": "0.49290937", "text": "func extractAndroidID(output []byte) string {\n\tres := \"\"\n\textract(bytes.NewReader(output), fmt.Sprintf(`.*%s.*: id2 = (.+)`, centerIDTag), func(s []string) {\n\t\tres = s[1]\n\t})\n\treturn res\n}", "title": "" }, { "docid": "56eb3184d3b8b45cddc99daf46fa1ae6", "score": "0.49131578", "text": "func ParseServiceID(r io.Reader) (string, error) {\n\tvar s struct {\n\t\tMetadata struct {\n\t\t\tServiceID string\n\t\t}\n\t}\n\tif err := json.NewDecoder(r).Decode(&s); err != nil {\n\t\treturn \"\", err\n\t}\n\treturn s.Metadata.ServiceID, nil\n}", "title": "" }, { "docid": "d26a60fecd2dd8e9291f551e5908acbc", "score": "0.48678225", "text": "func identifierFromRequest(identifier string, request *http.Request) *int {\n\tvars := mux.Vars(request)\n\tidString := vars[identifier]\n\n\tif idString == \"\" {\n\t\treturn nil\n\t}\n\n\tid, err := strconv.Atoi(idString)\n\tif err != nil {\n\t\treturn nil\n\t}\n\n\treturn &id\n}", "title": "" }, { "docid": "e70c642f3c1d1ddac34aa4029b06429a", "score": "0.48667714", "text": "func GetUID(request *revel.Request) int {\n\ttoken := request.GetHttpHeader(\"athena-token\")\n\tif token == \"\" {\n\t\treturn -1\n\t}\n\tuidStr := strings.Split(token, \"|\")[0]\n\n\tuid, err := strconv.Atoi(uidStr)\n\tif err != nil {\n\t\treturn -1\n\t}\n\treturn uid\n}", "title": "" }, { "docid": "fd5d5e19f9cbc6ec2f29011468d23e2f", "score": "0.48340702", "text": "func Parse(input string) ID {\n\treturn decode([]byte(input))\n}", "title": "" }, { "docid": "dfc740fd540a2474f67d9067b7811917", "score": "0.48339686", "text": "func ExtractID(location string) (int64, error) {\n\tidstr := location[strings.LastIndex(location, \"/\")+1:]\n\treturn strconv.ParseInt(idstr, 10, 64)\n}", "title": "" }, { "docid": "5e97594648785920afb0a03f920ec261", "score": "0.47953314", "text": "func ParseId(s string) (Id, error) {\n\tb, err := base64.RawURLEncoding.DecodeString(s)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif len(b) != 8 {\n\t\treturn \"\", fmt.Errorf(\"bow.ParseId: input must be exactly 8 bytes long\")\n\t}\n\treturn Id(b), nil\n}", "title": "" }, { "docid": "9bdddf0bd9df7aea9aceb83429026dae", "score": "0.47931895", "text": "func DecodeDriversGetByIDRequest(_ context.Context, r *http.Request) (interface{}, error) {\n\tvars := mux.Vars(r)\n\tidString, ok := vars[\"id\"]\n\tif !ok {\n\t\treturn nil, errors.New(\"Bad routing\")\n\t}\n\n\tid, err := strconv.Atoi(idString)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn driversGetByIDRequest{ID: uint64(id)}, nil\n}", "title": "" }, { "docid": "0f74e1afd19af61e45aa417aedd3dca6", "score": "0.4787264", "text": "func ExtractUserId(r *http.Request) (int64, error) {\n\ttokenString := extractToken(r)\n\ttoken, err := jwt.Parse(tokenString, getVerificateKey)\n\n\tif err != nil {\n\t\treturn int64(0), err\n\t}\n\n\tif claims, ok := token.Claims.(jwt.MapClaims); ok && token.Valid {\n\t\tuserID, err := strconv.ParseInt(fmt.Sprintf(\"%.0f\", claims[\"userID\"]), 10, 64)\n\t\tif err != nil {\n\t\t\treturn int64(0), err\n\t\t}\n\t\treturn userID, nil\n\t}\n\n\treturn int64(0), errors.New(\"token inválido\")\n\n}", "title": "" }, { "docid": "205d19ff294f6f736d7a007a17c90988", "score": "0.47848412", "text": "func parseTaskID(t ms.TaskID) (cluster, ip, port string, id int64, err error) {\n\tv := t.GetValue()\n\ttids := strings.Split(v, \",\")\n\tss := strings.Split(tids[0], \"-\")\n\tif len(ss) != 3 {\n\t\terr = errTaskID\n\t\treturn\n\t}\n\thost := ss[0]\n\tcluster = ss[1]\n\tids := ss[2]\n\tid, _ = strconv.ParseInt(ids, 10, 64)\n\tidx := strings.IndexByte(host, ':')\n\tip = host[:idx]\n\tport = host[idx+1:]\n\treturn\n}", "title": "" }, { "docid": "617eef7dd4571af401aebcd980cac889", "score": "0.47526017", "text": "func getEntityID(r *http.Request) string {\n\tvars := mux.Vars(r)\n\tvalue := vars[\"id\"]\n\tsubstring := value[1 : len(value)-1]\n\treturn substring\n}", "title": "" }, { "docid": "1b459f3c46cb80faee813d34e96bf83e", "score": "0.47505856", "text": "func triceIDParse(t string) (nbID string, id TriceID, found idType) {\n\tnbID = matchNbID.FindString(t)\n\tif nbID == \"\" {\n\t\tmsg.InfoOnTrue(Verbose, fmt.Sprintln(\"No 'Id(n)' or 'id(n)' found inside \"+t)) // todo: patID\n\t\treturn\n\t}\n\tvar n int\n\t_, err := fmt.Sscanf(nbID, \"iD(%d\", &n) // closing bracket in format string omitted intentionally // todo: patID\n\tif nil == err { // because spaces after id otherwise are not tolerated\n\t\tid = TriceID(n)\n\t\tfound = idTypeS8\n\t\treturn\n\t}\n\t_, err = fmt.Sscanf(nbID, \"ID(%d\", &n) // closing bracket in format string omitted intentionally // todo: patID\n\tif nil == err { // because spaces after id otherwise are not tolerated\n\t\tid = TriceID(n)\n\t\tfound = idTypeS4\n\t\treturn\n\t}\n\t_, err = fmt.Sscanf(nbID, \"Id(%d\", &n) // closing bracket in format string omitted intentionally // todo: patID\n\tif nil == err { // because spaces after id otherwise are not tolerated\n\t\tid = TriceID(n)\n\t\tfound = idTypeS2\n\t\treturn\n\t}\n\t_, err = fmt.Sscanf(nbID, \"id(%d\", &n) // closing bracket in format string omitted intentionally // todo: patID\n\tif nil == err { // because spaces after id otherwise are not tolerated\n\t\tid = TriceID(n)\n\t\tfound = idTypeS0\n\t\treturn\n\t}\n\tmsg.Info(fmt.Sprintln(\"no 'Id(n' found inside \" + nbID)) // todo: patID\n\treturn\n}", "title": "" }, { "docid": "a47724dcdc59fb9ea5fd6cc800c0fcf8", "score": "0.47312573", "text": "func (resolver nameResolver) ExtractServiceId(applicaton, host string) string {\n\tresourceName := strings.Split(host, \".\")[0]\n\treturn strings.TrimPrefix(resourceName, getResourceNamePrefix(applicaton))\n}", "title": "" }, { "docid": "9c52f5aa3f02de2c62549102d2c963af", "score": "0.4702354", "text": "func (r NotifyResult) Extract() (string, error) {\n\trequestID := r.Header.Get(\"X-Openstack-Request-Id\")\n\treturn requestID, r.Err\n}", "title": "" }, { "docid": "24af9b488be4925a22a0636aa978c4f6", "score": "0.46970338", "text": "func resourceVSphereComputeClusterVMDependencyRuleParseID(id string) (string, int32, error) {\n\tparts := strings.SplitN(id, \":\", 3)\n\tif len(parts) < 2 {\n\t\treturn \"\", 0, fmt.Errorf(\"bad ID %q\", id)\n\t}\n\n\tkey, err := strconv.ParseInt(parts[1], 10, 32)\n\tif err != nil {\n\t\treturn \"\", 0, fmt.Errorf(\"while converting key in ID %q to int32: %s\", parts[1], err)\n\t}\n\n\treturn parts[0], int32(key), nil\n}", "title": "" }, { "docid": "daf10cf72de9d43e854b0f18be9d2407", "score": "0.46911022", "text": "func extractTeamID(r io.Reader) (string, error) {\n\tbytes, err := ioutil.ReadAll(r)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tteamIds := teamIDRegEx.FindStringSubmatch(string(bytes))\n\tif len(teamIds) < 2 {\n\t\treturn \"\", fmt.Errorf(\"teamID not found in body\")\n\t}\n\treturn teamIds[1], nil\n}", "title": "" }, { "docid": "515b44f084062d56267185f79c3b79fb", "score": "0.46803316", "text": "func Parse(uid string) (info Info, err error) {\n\tif len(uid) != 16 {\n\t\terr = errors.New(\"bad uid length\")\n\t\treturn\n\t}\n\n\tdata, err := base64.RawURLEncoding.DecodeString(uid)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tinfo.Time = time.Unix(int64(binary.BigEndian.Uint32(data[0:4])), 0)\n\tcopy(info.Machine[:], data[4:7])\n\tinfo.Pid = binary.BigEndian.Uint16(data[7:9])\n\tcounter := data[9:12]\n\tinfo.Counter = uint32(uint32(counter[0])<<16 | uint32(counter[1])<<8 | uint32(counter[2]))\n\n\treturn\n}", "title": "" }, { "docid": "454463eeb7bbf079ad7c2379a4aa7c5b", "score": "0.46771458", "text": "func parseDepInfo(s string) (*depInfo, error) {\n\tfields := strings.Split(s, \"\\t\")\n\tif len(fields) != 4 {\n\t\treturn nil, fmt.Errorf(\"expected 4 tab-separated fields, got %d\", len(fields))\n\t}\n\tinfo := &depInfo{\n\t\tproject: fields[0],\n\t\tvcs: kindToVCS[fields[1]],\n\t\tVCSInfo: VCSInfo{\n\t\t\trevid: fields[2],\n\t\t\trevno: fields[3],\n\t\t},\n\t}\n\tif info.vcs == nil {\n\t\treturn nil, fmt.Errorf(\"unknown VCS kind %q\", fields[1])\n\t}\n\tif info.project == \"\" {\n\t\treturn nil, fmt.Errorf(\"empty project field\")\n\t}\n\tif info.revid == \"\" {\n\t\treturn nil, fmt.Errorf(\"empty revision id\")\n\t}\n\treturn info, nil\n}", "title": "" }, { "docid": "26009e51b674513fe39010a24fa8abe5", "score": "0.46590853", "text": "func extractPidCrio117(partial map[string]json.RawMessage) (float64, error) {\n\tvar result float64\n\terr := json.Unmarshal(partial[\"pid\"], &result)\n\tif err != nil {\n\t\treturn -1, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "04e160f70255c53f233ec27fc5b09a06", "score": "0.46580264", "text": "func DecodeIDRequest(_ context.Context, req *http.Request) (interface{}, error) {\n\tif errRoleCheck := roleCheck(req); errRoleCheck != nil {\n\t\treturn nil, errRoleCheck\n\t}\n\n\trequest := communications.NewIDRequest()\n\n\t// Set Request Headers\n\tsetRequestHeaders(req, request)\n\n\t// Set Request Parameters\n\tif errSetParameters := setRequestParameters(req, request); errSetParameters != nil {\n\t\treturn nil, errSetParameters\n\t}\n\n\tid, errExtractID := extractID(req)\n\tif errExtractID != nil {\n\t\treturn nil, errExtractID\n\t}\n\n\trequest.ID = id\n\n\treturn request, nil\n}", "title": "" }, { "docid": "eec340f1748efa0de69a0d1b659502e1", "score": "0.4643991", "text": "func parseTwoPartID(id string) (string, string) {\n\tparts := strings.SplitN(id, \":\", 2)\n\treturn parts[0], parts[1]\n}", "title": "" }, { "docid": "237ff94f44cdfd122723d9162d8a32b5", "score": "0.46405205", "text": "func parseQueryID(queryID string) (id xid.ID, score int64, qtype string, err error) {\n\tparts := strings.Split(queryID, \":\")\n\tif len(parts) != 3 {\n\t\treturn xid.NilID(), 0, \"\", fmt.Errorf(\"invalid id\")\n\t}\n\tid, err = xid.FromString(parts[2])\n\tif err != nil {\n\t\treturn xid.NilID(), 0, \"\", fmt.Errorf(\"invalid id\")\n\t}\n\tscore, err = strconv.ParseInt(parts[1], 10, 64)\n\tif err != nil {\n\t\treturn xid.NilID(), 0, \"\", fmt.Errorf(\"invalid id\")\n\t}\n\tqtype = parts[0]\n\tif len(qtype) != 1 || !strings.Contains(\"srd\", qtype) {\n\t\treturn xid.NilID(), 0, \"\", fmt.Errorf(\"invalid id\")\n\t}\n\treturn id, score, qtype, nil\n}", "title": "" }, { "docid": "d2d2e7f03957be9a09ea5d735229cc4f", "score": "0.46271425", "text": "func parsePromshiftHeader(h string) (string, int64) {\n\tsplitted := strings.Split(h, \"=\")\n\tif !timeshiftHeadersMap[splitted[0]] {\n\t\treturn \"\", 0\n\t}\n\n\tpromshiftHeader := splitted[0]\n\ttargetHeader := strings.TrimPrefix(promshiftHeader, \"promshift_\")\n\tv := splitted[1]\n\n\tdur, err := time.ParseDuration(v)\n\tif err != nil {\n\t\tlog.Printf(\"WARN: unable to parse duration %q from header %q\", v, promshiftHeader)\n\t\treturn \"\", 0\n\t}\n\n\tchange := int64(dur.Seconds())\n\treturn targetHeader, change\n}", "title": "" }, { "docid": "f5d12e57dc8b6f4ed01b98cdecf1ebdc", "score": "0.46177116", "text": "func ParseDeleteAdminSsoProvidersSsoProviderIdResponse(rsp *http.Response) (*DeleteAdminSsoProvidersSsoProviderIdResponse, error) {\n\tbodyBytes, err := io.ReadAll(rsp.Body)\n\tdefer func() { _ = rsp.Body.Close() }()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresponse := &DeleteAdminSsoProvidersSsoProviderIdResponse{\n\t\tBody: bodyBytes,\n\t\tHTTPResponse: rsp,\n\t}\n\n\tswitch {\n\tcase strings.Contains(rsp.Header.Get(\"Content-Type\"), \"json\") && rsp.StatusCode == 200:\n\t\tvar dest SSOProviderSchema\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON200 = &dest\n\n\tcase strings.Contains(rsp.Header.Get(\"Content-Type\"), \"json\") && rsp.StatusCode == 401:\n\t\tvar dest ErrorSchema\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON401 = &dest\n\n\tcase strings.Contains(rsp.Header.Get(\"Content-Type\"), \"json\") && rsp.StatusCode == 403:\n\t\tvar dest ErrorSchema\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON403 = &dest\n\n\tcase strings.Contains(rsp.Header.Get(\"Content-Type\"), \"json\") && rsp.StatusCode == 404:\n\t\tvar dest ErrorSchema\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON404 = &dest\n\n\t}\n\n\treturn response, nil\n}", "title": "" }, { "docid": "81cb96de5e96d4639978c45acb066d58", "score": "0.45989856", "text": "func ParseBlobDigest(dgst string) (string, int, int) {\n\tsegs := strings.Split(dgst, \"_\")\n\tif len(segs) == 1 {\n\t\treturn dgst, 0, 0\n\t}\n\n\treturn segs[0], String2Int(segs[1]), String2Int(segs[2])\n}", "title": "" }, { "docid": "a12248c23a63ce335b3b090f3d7d5aee", "score": "0.45932347", "text": "func parseRequest(r io.Reader) (*kvParser, string, error) {\n\t// Consume the first line to retrieve the command.\n\tp := newKVParser(r)\n\tif !p.Next() {\n\t\treturn nil, \"\", p.Err()\n\t}\n\n\treturn p, p.Key(), nil\n}", "title": "" }, { "docid": "948dc2c5a66260a97b3e610f63d0094e", "score": "0.4586208", "text": "func ParseQuotaID(id string, quotas []string) (string, error) {\n\tswitch len(quotas) {\n\tcase 0:\n\t\tif isSetQuotaID(id) {\n\t\t\treturn \"\", fmt.Errorf(\"invalid to set quota id(%s) without disk-quota\", id)\n\t\t}\n\tcase 1:\n\t\tif isSetQuotaID(id) {\n\t\t\treturn id, nil\n\t\t}\n\n\t\tparts := strings.Split(quotas[0], \"=\")\n\t\tif len(parts) == 1 {\n\t\t\treturn \"-1\", nil\n\t\t}\n\tdefault:\n\t\tif isSetQuotaID(id) {\n\t\t\treturn \"\", fmt.Errorf(\"invalid to set quota id(%s) for multi disk-quota\", id)\n\t\t}\n\t}\n\n\treturn id, nil\n}", "title": "" }, { "docid": "aa8bd38de1bde1dbc2d15451852b74ee", "score": "0.45819953", "text": "func ParseGetKedaScalerVersionDetailsResponse(rsp *http.Response) (*GetKedaScalerVersionDetailsResponse, error) {\n\tbodyBytes, err := ioutil.ReadAll(rsp.Body)\n\tdefer rsp.Body.Close()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresponse := &GetKedaScalerVersionDetailsResponse{\n\t\tBody: bodyBytes,\n\t\tHTTPResponse: rsp,\n\t}\n\n\tswitch {\n\tcase strings.Contains(rsp.Header.Get(\"Content-Type\"), \"json\") && rsp.StatusCode == 200:\n\t\tvar dest KedaScalerPackage\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON200 = &dest\n\n\tcase strings.Contains(rsp.Header.Get(\"Content-Type\"), \"json\") && rsp.StatusCode == 404:\n\t\tvar dest Error\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON404 = &dest\n\n\tcase strings.Contains(rsp.Header.Get(\"Content-Type\"), \"json\") && rsp.StatusCode == 500:\n\t\tvar dest Error\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON500 = &dest\n\n\t}\n\n\treturn response, nil\n}", "title": "" }, { "docid": "c3c05c36c1102f660917af02f60591fb", "score": "0.45734298", "text": "func DecodeDeletePayementRequest(_ context.Context, r *http.Request) (interface{}, error) {\n\tvars := mux.Vars(r)\n\tid, err := uuid.FromString(vars[\"id\"])\n\tnewErr := treatErr(err, \"err: Could not read 'delete payment' body\")\n\tif newErr != nil {\n\t\treturn nil, newErr\n\t}\n\treturn DeletePaymentRequest{PaymentID: id}, nil\n}", "title": "" }, { "docid": "ae4723bd123835b0556b84636820b793", "score": "0.45723405", "text": "func extractPidCrio118(partial map[string]json.RawMessage) (float64, error) {\n\tvar result map[string]interface{}\n\terr := json.Unmarshal(partial[\"info\"], &result)\n\tif err != nil {\n\t\treturn -1, err\n\t}\n\treturn result[\"pid\"].(float64), nil\n}", "title": "" }, { "docid": "502acade379e9f74beb809f8cc2ae442", "score": "0.45619217", "text": "func getProductID(request *http.Request) int {\n\tvars := mux.Vars(request)\n\n\tid, err := strconv.Atoi(vars[\"id\"])\n\n\tif err != nil {\n\t\t// should never happen\n\t\tpanic(err)\n\t}\n\n\treturn id\n}", "title": "" }, { "docid": "cc92e259d7419015d374f012bdc09c5e", "score": "0.45580652", "text": "func parseGithubPR(urlStr string) (*PROpts, error) {\n\tresult, err := url.Parse(urlStr)\n\tif err != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\tparts := strings.Split(strings.Trim(result.Path, \"/\"), \"/\")\n\tif l := len(parts); l != 4 {\n\t\treturn nil, errors.Errorf(\"pull request URL path should have four parts, found %d\", l)\n\t}\n\n\tn, err := strconv.Atoi(parts[3])\n\tif err != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\n\thost := strings.Replace(result.Host, \".\", \"_\", -1)\n\treturn &PROpts{\n\t\tRepoOpts: RepoOpts{\n\t\t\tHost: host,\n\t\t\tRepoOwner: parts[0],\n\t\t\tRepoName: parts[1],\n\t\t},\n\t\tPRID: n,\n\t}, nil\n}", "title": "" }, { "docid": "de12b7833e332802ccc7fce53317dd44", "score": "0.4550022", "text": "func resourceVSphereComputeClusterVMHostRuleParseID(id string) (string, int32, error) {\n\tparts := strings.SplitN(id, \":\", 3)\n\tif len(parts) < 2 {\n\t\treturn \"\", 0, fmt.Errorf(\"bad ID %q\", id)\n\t}\n\n\tkey, err := strconv.ParseInt(parts[1], 10, 32)\n\tif err != nil {\n\t\treturn \"\", 0, fmt.Errorf(\"while converting key in ID %q to int32: %s\", parts[1], err)\n\t}\n\n\treturn parts[0], int32(key), nil\n}", "title": "" }, { "docid": "cb7e595f57d756a38eef71190dcef47f", "score": "0.45491716", "text": "func ParseGetAdminSsoProvidersSsoProviderIdResponse(rsp *http.Response) (*GetAdminSsoProvidersSsoProviderIdResponse, error) {\n\tbodyBytes, err := io.ReadAll(rsp.Body)\n\tdefer func() { _ = rsp.Body.Close() }()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresponse := &GetAdminSsoProvidersSsoProviderIdResponse{\n\t\tBody: bodyBytes,\n\t\tHTTPResponse: rsp,\n\t}\n\n\tswitch {\n\tcase strings.Contains(rsp.Header.Get(\"Content-Type\"), \"json\") && rsp.StatusCode == 200:\n\t\tvar dest SSOProviderSchema\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON200 = &dest\n\n\tcase strings.Contains(rsp.Header.Get(\"Content-Type\"), \"json\") && rsp.StatusCode == 401:\n\t\tvar dest ErrorSchema\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON401 = &dest\n\n\tcase strings.Contains(rsp.Header.Get(\"Content-Type\"), \"json\") && rsp.StatusCode == 403:\n\t\tvar dest ErrorSchema\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON403 = &dest\n\n\tcase strings.Contains(rsp.Header.Get(\"Content-Type\"), \"json\") && rsp.StatusCode == 404:\n\t\tvar dest ErrorSchema\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON404 = &dest\n\n\t}\n\n\treturn response, nil\n}", "title": "" }, { "docid": "9f5e13fd112253a086f1064ba9c68d84", "score": "0.45469993", "text": "func getProductID(r *http.Request) int {\n\t// parse the product id from the url\n\tvars := mux.Vars(r)\n\n\t// convert the id into an integer and return\n\tid, err := strconv.Atoi(vars[\"id\"])\n\tif err != nil {\n\t\t// should never happen\n\t\tpanic(err)\n\t}\n\n\treturn id\n}", "title": "" }, { "docid": "9f5e13fd112253a086f1064ba9c68d84", "score": "0.45469993", "text": "func getProductID(r *http.Request) int {\n\t// parse the product id from the url\n\tvars := mux.Vars(r)\n\n\t// convert the id into an integer and return\n\tid, err := strconv.Atoi(vars[\"id\"])\n\tif err != nil {\n\t\t// should never happen\n\t\tpanic(err)\n\t}\n\n\treturn id\n}", "title": "" }, { "docid": "065c9cee66876f5fe2ae68c183facb46", "score": "0.45371273", "text": "func parseThreePartID(id, left, center, right string) (string, string, string, error) {\n\tparts := strings.SplitN(id, \":\", 3)\n\tif len(parts) != 3 {\n\t\treturn \"\", \"\", \"\", fmt.Errorf(\"unexpected ID format (%q). Expected %s:%s:%s\", id, left, center, right)\n\t}\n\n\treturn parts[0], parts[1], parts[2], nil\n}", "title": "" }, { "docid": "8e2099f67914d486bb91e5fa420492b8", "score": "0.45368084", "text": "func GetProjectId(reqURL string) string {\n\tu, err := url.Parse(reqURL)\n\tif err != nil {\n\t\tlog.Error(\"url.Parse failed:\" + err.Error())\n\t\treturn \"\"\n\t}\n\n\t// /v3/{project_id}/\n\twords := strings.Split(u.Path, \"/\")\n\n\tif (len(words) >= 3) && (len(words[2]) > 0) {\n\t\tlog.V(5).Info(\"project_id is\" + words[2])\n\t\treturn words[2]\n\t} else {\n\t\tlog.Error(\"there is no project_id in the request URL:\" + reqURL)\n\t\treturn \"\"\n\t}\n}", "title": "" }, { "docid": "fd742faea5f5c7529332270da957f73a", "score": "0.45344073", "text": "func parseCanonicalJobID(id string) (name string, folders []string) {\n\tif id == \"\" {\n\t\treturn\n\t}\n\n\tfolders = extractFolders(id)\n\treturn folders[len(folders)-1], folders[0 : len(folders)-1]\n}", "title": "" }, { "docid": "cb3af4d424e6b846f173522f3fee7e38", "score": "0.45335805", "text": "func ParseGetKedaScalerDetailsResponse(rsp *http.Response) (*GetKedaScalerDetailsResponse, error) {\n\tbodyBytes, err := ioutil.ReadAll(rsp.Body)\n\tdefer rsp.Body.Close()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresponse := &GetKedaScalerDetailsResponse{\n\t\tBody: bodyBytes,\n\t\tHTTPResponse: rsp,\n\t}\n\n\tswitch {\n\tcase strings.Contains(rsp.Header.Get(\"Content-Type\"), \"json\") && rsp.StatusCode == 200:\n\t\tvar dest KedaScalerPackage\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON200 = &dest\n\n\tcase strings.Contains(rsp.Header.Get(\"Content-Type\"), \"json\") && rsp.StatusCode == 404:\n\t\tvar dest Error\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON404 = &dest\n\n\tcase strings.Contains(rsp.Header.Get(\"Content-Type\"), \"json\") && rsp.StatusCode == 500:\n\t\tvar dest Error\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON500 = &dest\n\n\t}\n\n\treturn response, nil\n}", "title": "" }, { "docid": "74c04970e844961627166d2d6ffd5d0c", "score": "0.45331421", "text": "func parseContentLength(clen string) (int64, error) {\n\n\tif clen == \"\" {\n\t\treturn (0), nil\n\t}\n\n\tn, err := strconv.ParseInt(clen, 10, 64)\n\n\tif (err != nil) || (n < 0) {\n\t\treturn -1, errors.New(\"Content-Length decode error: \" + err.Error())\n\t}\n\treturn (n), nil\n}", "title": "" }, { "docid": "a3f1bfd1337a56525c1140efa8e5fc29", "score": "0.4527885", "text": "func parseVaultID(id string) (string, string) {\n\ttokens := strings.SplitN(id, \"#\", 2)\n\tswitch len(tokens) {\n\tcase 1:\n\t\treturn tokens[0], VaultDefaultField\n\tdefault:\n\t\treturn tokens[0], tokens[1]\n\t}\n}", "title": "" }, { "docid": "f1dac5cef359904c6a40d70bcbd079c4", "score": "0.45210978", "text": "func extractToken(r *http.Request) string {\n\tbearToken := r.Header.Get(\"Authorization\")\n\tstrArr := strings.Split(bearToken, \" \")\n\tif len(strArr) == 2 {\n\t\treturn strArr[1]\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "428ec487066e4f4237e8ed988d362c62", "score": "0.45164442", "text": "func ParseResourceID(id string) (*ResourceID, error) {\n\t// example: https://foo.dfs.core.windows.net/Bar\n\tif id == \"\" {\n\t\treturn nil, fmt.Errorf(\"`id` was empty\")\n\t}\n\n\turi, err := url.Parse(id)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error parsing ID as a URL: %s\", err)\n\t}\n\n\taccountName, err := endpoints.GetAccountNameFromEndpoint(uri.Host)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error parsing Account Name: %s\", err)\n\t}\n\n\tfileSystemAndPath := strings.TrimPrefix(uri.Path, \"/\")\n\tseparatorIndex := strings.Index(fileSystemAndPath, \"/\")\n\tvar fileSystem, path string\n\tif separatorIndex < 0 {\n\t\tfileSystem = fileSystemAndPath\n\t\tpath = \"\"\n\t} else {\n\t\tfileSystem = fileSystemAndPath[0:separatorIndex]\n\t\tpath = fileSystemAndPath[separatorIndex+1:]\n\t}\n\treturn &ResourceID{\n\t\tAccountName: *accountName,\n\t\tFileSystemName: fileSystem,\n\t\tPath: path,\n\t}, nil\n}", "title": "" }, { "docid": "c42d39235fb709993155deb9b8e18cc6", "score": "0.45126444", "text": "func ParseGetUserByIDResponse(rsp *http.Response) (*GetUserByIDResponse, error) {\n\tbodyBytes, err := ioutil.ReadAll(rsp.Body)\n\tdefer rsp.Body.Close()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresponse := &GetUserByIDResponse{\n\t\tBody: bodyBytes,\n\t\tHTTPResponse: rsp,\n\t}\n\n\tswitch {\n\tcase strings.Contains(rsp.Header.Get(\"Content-Type\"), \"json\") && rsp.StatusCode == 200:\n\t\tvar dest User\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON200 = &dest\n\n\t}\n\n\treturn response, nil\n}", "title": "" }, { "docid": "2f00d7155fbe87b8e6d764d41dc175f4", "score": "0.45120758", "text": "func ParseDeleteAdminUsersUserIdFactorsFactorIdResponse(rsp *http.Response) (*DeleteAdminUsersUserIdFactorsFactorIdResponse, error) {\n\tbodyBytes, err := io.ReadAll(rsp.Body)\n\tdefer func() { _ = rsp.Body.Close() }()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresponse := &DeleteAdminUsersUserIdFactorsFactorIdResponse{\n\t\tBody: bodyBytes,\n\t\tHTTPResponse: rsp,\n\t}\n\n\tswitch {\n\tcase strings.Contains(rsp.Header.Get(\"Content-Type\"), \"json\") && rsp.StatusCode == 200:\n\t\tvar dest MFAFactorSchema\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON200 = &dest\n\n\tcase strings.Contains(rsp.Header.Get(\"Content-Type\"), \"json\") && rsp.StatusCode == 401:\n\t\tvar dest ErrorSchema\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON401 = &dest\n\n\tcase strings.Contains(rsp.Header.Get(\"Content-Type\"), \"json\") && rsp.StatusCode == 403:\n\t\tvar dest ErrorSchema\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON403 = &dest\n\n\tcase strings.Contains(rsp.Header.Get(\"Content-Type\"), \"json\") && rsp.StatusCode == 404:\n\t\tvar dest ErrorSchema\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON404 = &dest\n\n\t}\n\n\treturn response, nil\n}", "title": "" }, { "docid": "acfe10b44e5ead527b6b47d2c1d24c9c", "score": "0.44958743", "text": "func (i *Introspect) extractToken(r *http.Request) (string, error) {\n\tif r == nil {\n\t\treturn \"\", ErrBadAuthRequest\n\t}\n\n\t// Get token from query\n\tif r.URL == nil {\n\t\treturn \"\", ErrBadAuthRequest\n\t}\n\tqueryValues := r.URL.Query()\n\tfor _, queryParamName := range i.cfg.QueryParamName {\n\t\ttoken := queryValues.Get(queryParamName)\n\n\t\tif token != \"\" {\n\t\t\treturn token, nil\n\t\t}\n\t}\n\n\t// Get token from cookie\n\tfor _, cookieName := range i.cfg.CookieName {\n\t\ttokenCookie, err := r.Cookie(cookieName)\n\t\tvar token string\n\t\tif err == nil {\n\t\t\ttoken = tokenCookie.Value\n\t\t}\n\n\t\tif token != \"\" {\n\t\t\treturn token, nil\n\t\t}\n\t}\n\n\t// If not token not found in query, try get from Authorization header\n\tfor _, headerName := range i.cfg.HeaderName {\n\t\ttoken := r.Header.Get(headerName)\n\t\tif token == \"\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tsplitToken := strings.Split(token, \" \")\n\t\tif len(splitToken) < 2 {\n\t\t\ttoken = strings.TrimSpace(splitToken[0])\n\t\t} else {\n\t\t\ttoken = strings.TrimSpace(splitToken[1])\n\t\t}\n\n\t\treturn token, nil\n\t}\n\n\treturn \"\", ErrBadAuthRequest\n}", "title": "" }, { "docid": "2fa42e2428a689992b4e5c65cb28df84", "score": "0.44918564", "text": "func parseHost(req *http.Request) string {\n\t//if req.Host == \"\" {\n\t//\tlog.Fatalln(\"req.Host empty\") // net/http server set req.Host automatically\n\t//}\n\t// Extract the hostname part req.Host == \"some.hostname.net:1234\"\n\thost_strip, _, err := net.SplitHostPort(req.Host)\n\tif err != nil {\n\t\t// If req.Host doesn't contain any port part.\n\t\t//log.Println(\"net.SplitHostPort error\", err)\n\t\treturn req.Host\n\t}\n\treturn host_strip\n}", "title": "" }, { "docid": "6b36bd9235dbe2033cb475f71fbc6272", "score": "0.448612", "text": "func (rp *RecommendationParser) getID(contentArea *goquery.Selection) int {\n\tid, _ := contentArea.Find(\"a\").First().Attr(\"href\")\n\tid = utils.GetValueFromSplit(id, \"/\", 4)\n\treturn utils.StrToNum(id)\n}", "title": "" }, { "docid": "ef299677c1c5d83c3b0b9106962209e9", "score": "0.4482911", "text": "func parseName(raw string) (n name, err error) {\n\tdefer func() {\n\t\tif err != nil {\n\t\t\terr = errors.E(\"parseName\", raw, err)\n\t\t}\n\t}()\n\thead, tail := peel(raw, \"/\")\n\tif tail == \"\" {\n\t\tswitch {\n\t\tcase hexRe.MatchString(head):\n\t\t\tn.Kind = idName\n\t\t\tn.ID, err = reflow.Digester.Parse(head)\n\t\tcase ec2HostRe.MatchString(head):\n\t\t\tn.Kind, n.Hostname = hostName, head\n\t\t}\n\t\treturn\n\t}\n\tif !hexRe.MatchString(head) {\n\t\tn.Hostname = strings.Split(head, \":\")[0]\n\t\tn.HostAndPort = head\n\t\thead, tail = peel(tail, \"/\")\n\t}\n\tn.AllocID = head\n\tif tail == \"\" {\n\t\tn.Kind = allocName\n\t\treturn\n\t}\n\tn.Kind = execName\n\tn.ID, err = reflow.Digester.Parse(tail)\n\treturn\n}", "title": "" }, { "docid": "0eae100f8e9dd247245ee1db1d5102da", "score": "0.4482471", "text": "func ProcessSnippetResponse(respBody []byte) string {\n\tjsonParsed, _ := gabs.ParseJSON(respBody)\n\tsnippetId := getSnippetId(jsonParsed)\n\treturn snippetId\n}", "title": "" }, { "docid": "4fa86530e71bf36a54230df42423d756", "score": "0.4478026", "text": "func extractArg(serverResponse string) string {\n\ti := strings.IndexByte(serverResponse, ' ')\n\treturn strings.TrimSpace(serverResponse[i+1:])\n}", "title": "" }, { "docid": "be6803e30fd6d713ce67fe80e67c49cf", "score": "0.44778228", "text": "func ParseGetCoreDNSPluginVersionDetailsResponse(rsp *http.Response) (*GetCoreDNSPluginVersionDetailsResponse, error) {\n\tbodyBytes, err := ioutil.ReadAll(rsp.Body)\n\tdefer rsp.Body.Close()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresponse := &GetCoreDNSPluginVersionDetailsResponse{\n\t\tBody: bodyBytes,\n\t\tHTTPResponse: rsp,\n\t}\n\n\tswitch {\n\tcase strings.Contains(rsp.Header.Get(\"Content-Type\"), \"json\") && rsp.StatusCode == 200:\n\t\tvar dest CoreDNSPackage\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON200 = &dest\n\n\tcase strings.Contains(rsp.Header.Get(\"Content-Type\"), \"json\") && rsp.StatusCode == 404:\n\t\tvar dest Error\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON404 = &dest\n\n\tcase strings.Contains(rsp.Header.Get(\"Content-Type\"), \"json\") && rsp.StatusCode == 500:\n\t\tvar dest Error\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON500 = &dest\n\n\t}\n\n\treturn response, nil\n}", "title": "" }, { "docid": "a73bf54917b0a73bd7df741c6c6c0284", "score": "0.44772696", "text": "func ExtractClientId (logfile string, client_num string) string {\n cmd := \"grep 'server: accepted from' \" + \" \" + runFolder + \"/\" + logfile + \" | awk -F\\\":\\\" '{print $7}' | awk 'NR==\" + client_num + \"'\"\n //fmt.Println (\"Grep command in ExtractClientId: \", cmd)\n out, err := BashCmd(cmd)\n if (err != nil) {\n fmt.Errorf(\"Error occur when extracting client id: %s\", out)\n }\n client := strings.TrimSpace (string(out))\n return client\n}", "title": "" }, { "docid": "07009ddff1b716d2ed377d89c8730592", "score": "0.44761667", "text": "func ParseDeleteUserResponse(rsp *http.Response) (*DeleteUserResponse, error) {\n\tbodyBytes, err := ioutil.ReadAll(rsp.Body)\n\tdefer rsp.Body.Close()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresponse := &DeleteUserResponse{\n\t\tBody: bodyBytes,\n\t\tHTTPResponse: rsp,\n\t}\n\n\treturn response, nil\n}", "title": "" }, { "docid": "d3306c229752fe8d7a1a881eba2615a7", "score": "0.4475537", "text": "func (e ErrParseID) BadRequest() {}", "title": "" }, { "docid": "e19060e304614f3bd7fdb60ab2ba5c40", "score": "0.44746214", "text": "func ParseId(id string) (uuid.UUID, error) {\n if IsMojangId(id) {\n return ToStandardId(id)\n }\n\n return uuid.Parse(id)\n}", "title": "" }, { "docid": "e569750ec49207a4bf6775d3a348f329", "score": "0.44685116", "text": "func (b *Buse) parseReadRequest(request []byte) ([]byte, uint64, uint64, uint64) {\n\traw := make([]byte, 8)\n\tcopy(raw, request[16:24])\n\toffset := binary.LittleEndian.Uint64(raw)\n\n\tsector := binary.LittleEndian.Uint64(request[:8]) * 512 / uint64(b.Options.BlockSize)\n\tlength := binary.LittleEndian.Uint64(request[8:16]) * 512 / uint64(b.Options.BlockSize)\n\n\treturn raw, offset, sector, length\n}", "title": "" }, { "docid": "07b996d050235a835de10d43b6f79059", "score": "0.44684556", "text": "func extract(regex *regexp.Regexp, rawDeviceID string) string {\n\t// Raw device ID looks like CI\\VEN_15AD&DEV_0405&SUBSYS_040515AD&REV_00\\3&2B8E0B4B&0&78.\n\tgroups := regex.FindStringSubmatch(rawDeviceID)\n\tif groups != nil {\n\t\treturn strings.ToLower(groups[1])\n\t}\n\treturn \"UNKNOWN\"\n}", "title": "" }, { "docid": "f756a95f8f9822c81cde02e7b60b128f", "score": "0.44648468", "text": "func ParseHTTP(v url.Values) map[string]string {\n\tp := make(map[string]string)\n\tfor k, v := range v {\n\t\tif strings.HasPrefix(k, \"openid.\") && len(v) > 0 {\n\t\t\tp[strings.TrimPrefix(k, \"openid.\")] = v[0]\n\t\t}\n\t}\n\treturn p\n}", "title": "" }, { "docid": "27bbe18db197338034e4e21328b80978", "score": "0.44618693", "text": "func ParseCliResponse(body []byte) (*CliResponse, error) {\n\tdecoded := make([]byte, Sqrl64.DecodedLen(len(body)))\n\t_, err := Sqrl64.Decode(decoded, body)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error decoding response: %v\", err)\n\t}\n\tparams, err := ParseSqrlQuery(string(decoded))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"couldn't parse response: %v\", err)\n\t}\n\n\ttifbig, err := strconv.ParseUint(params[\"tif\"], 16, 32)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"can't parse tif: %v\", err)\n\t}\n\n\treturn &CliResponse{\n\t\tVersion: []int{1},\n\t\tNut: Nut(params[\"nut\"]),\n\t\tTIF: uint32(tifbig),\n\t\tQry: params[\"qry\"],\n\t\tURL: params[\"url\"],\n\t\tSin: params[\"sin\"],\n\t\tSuk: params[\"suk\"],\n\t\tAsk: ParseAsk(params[\"ask\"]),\n\t\tCan: params[\"can\"],\n\t}, nil\n}", "title": "" }, { "docid": "5d262e1f5934925159b14503cfe6e89b", "score": "0.44599068", "text": "func (rb RadarBounds) parseFlightIDs(body *[]byte) (*[]FlightID, error) {\n\tflightIDs := []FlightID{}\n\tvar radarData []interface{}\n\t_ = json.Unmarshal(*body, &radarData)\n\n\t// parsing failed\n\tif len(radarData) == 0 {\n\t\treturn &flightIDs, errors.New(\"radar data returned nothing\")\n\t}\n\n\t// Get all the planes within radius. Will be under the first element in\n\t// returned list of values.\n\tplanes, ok := radarData[0].(map[string]interface{})\n\tif !ok {\n\t\treturn &flightIDs, errors.New(\"unable to get fids from radar data\")\n\t}\n\n\tfor fid, _ := range planes {\n\t\tflightIDs = append(flightIDs, FlightID{fid})\n\t}\n\n\treturn &flightIDs, nil\n}", "title": "" }, { "docid": "c25b4253965bf86f0d024375aae830ee", "score": "0.44571704", "text": "func ParsePatchAuthorizationsIDResponse(rsp *http.Response) (*PatchAuthorizationsIDResponse, error) {\n\tbodyBytes, err := ioutil.ReadAll(rsp.Body)\n\tdefer rsp.Body.Close()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresponse := &PatchAuthorizationsIDResponse{\n\t\tBody: bodyBytes,\n\t\tHTTPResponse: rsp,\n\t}\n\n\tswitch {\n\tcase strings.Contains(rsp.Header.Get(\"Content-Type\"), \"json\") && rsp.StatusCode == 200:\n\t\tvar dest Authorization\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON200 = &dest\n\n\tcase strings.Contains(rsp.Header.Get(\"Content-Type\"), \"json\") && true:\n\t\tvar dest Error\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSONDefault = &dest\n\n\t}\n\n\treturn response, nil\n}", "title": "" }, { "docid": "58c954e5edee3a78397eb8c5cd42f2bc", "score": "0.44518712", "text": "func ParseResourceID(resourceID string) (*ResourceDetails, error) {\n\tcacheKey := fmt.Sprintf(cacheKeyResourceID, resourceID)\n\n\tif cdetails, ok := c.Get(cacheKey); ok {\n\t\tif details, ok := cdetails.(*ResourceDetails); ok {\n\t\t\treturn details, nil\n\t\t}\n\t}\n\n\tmatch := resourceIDPattern.FindStringSubmatch(resourceID)\n\n\tif len(match) == 0 {\n\t\treturn nil, fmt.Errorf(\"parsing failed for %s. Invalid resource Id format\", resourceID)\n\t}\n\n\tv := strings.Split(match[5], \"/\")\n\tresourceName := v[len(v)-1]\n\n\tdetails := &ResourceDetails{\n\t\tSubscriptionID: match[1],\n\t\tResourceGroup: match[2],\n\t\tProvider: match[3],\n\t\tType: match[4],\n\t\tName: resourceName,\n\t}\n\n\tc.SetDefault(cacheKey, details)\n\n\treturn details, nil\n}", "title": "" }, { "docid": "6dcea285fda78ac17cee8927c89e3811", "score": "0.445017", "text": "func (p Parser) Parse(rawRequest []byte) (*Data, *Error) {\n\n\tdata := &Data{}\n\trequestData := string(rawRequest)\n\n\tif len(rawRequest) == 0 {\n\t\treturn data, newError(status.BadRequest)\n\t}\n\n\ttokens := strings.Split(requestData, \" \")\n\tdata.Verb = tokens[0]\n\n\tif data.Verb != \"GET\" {\n\t\treturn data, newError(status.InvalidHTTPMethod)\n\t}\n\n\tif len(tokens) < 2 {\n\t\treturn data, newError(status.BadRequest)\n\t}\n\n\tdata.Path = tokens[1][1:]\n\n\tif len(data.Path) > 512 {\n\t\treturn data, newError(status.URITooLong)\n\t}\n\n\tif !isFileTypeSupported(data.Path) {\n\t\treturn data, newError(status.UnsupportedMediaType)\n\t}\n\n\tif !p.fileChecker.Exists(data.Path) {\n\t\treturn data, newError(status.NotFound)\n\t}\n\n\tdata.FileType = tokens[len(tokens)-1]\n\n\treturn data, nil\n}", "title": "" }, { "docid": "2e8d9fcd71cfeea256ad59fbe496501c", "score": "0.44494054", "text": "func ParseUniqueName(workspaceID string) (string, uint, uint, error) {\n\tstrArr := strings.Split(workspaceID, \"-\")\n\n\tif len(strArr) < 3 {\n\t\treturn \"\", 0, 0, fmt.Errorf(\"workspace id improperly formatted\")\n\t}\n\n\tprojID, err := strconv.ParseUint(strArr[1], 10, 64)\n\n\tif err != nil {\n\t\treturn \"\", 0, 0, err\n\t}\n\n\tinfraID, err := strconv.ParseUint(strArr[2], 10, 64)\n\n\tif err != nil {\n\t\treturn \"\", 0, 0, err\n\t}\n\n\treturn strArr[0], uint(projID), uint(infraID), nil\n}", "title": "" }, { "docid": "bfc9b33bdc5f9cf974fca57a00134839", "score": "0.44486204", "text": "func ExtractToken(r *http.Request) string {\n\tbearToken := r.Header.Get(\"Authorization\")\n\tstrArr := strings.Split(bearToken, \" \")\n\tif len(strArr) == 2 {\n\t\treturn strArr[1]\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "851c565601164789ce080322d9c1dc6d", "score": "0.4439836", "text": "func getID(url, base string) (int, error) {\n\t// Strip API prefix.\n\tif !strings.HasPrefix(url, base) {\n\t\treturn 0, fmt.Errorf(\"bad url prefix for %v\", url)\n\t}\n\tidStr := url[len(base):]\n\n\ti, err := strconv.Atoi(idStr)\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(\"bad listener id %v\", idStr)\n\t}\n\treturn i, nil\n}", "title": "" } ]
f19497b7ceb4e1a202dd97a54979ec68
requestsByTraceID takes an incoming tempodb.PushRequest and creates a set of keys for the hash ring and traces to pass onto the ingesters.
[ { "docid": "ecf59b963ef9ee98683489878483ad68", "score": "0.6676256", "text": "func requestsByTraceID(req *tempopb.PushRequest, userID string, spanCount int) ([]uint32, []*tempopb.Trace, [][]byte, error) {\n\ttype traceAndID struct {\n\t\tid []byte\n\t\ttrace *tempopb.Trace\n\t}\n\n\tconst tracesPerBatch = 20 // p50 of internal env\n\ttracesByID := make(map[uint32]*traceAndID, tracesPerBatch)\n\tspansByILS := make(map[uint32]*v1.InstrumentationLibrarySpans)\n\n\tfor _, ils := range req.Batch.InstrumentationLibrarySpans {\n\t\tfor _, span := range ils.Spans {\n\t\t\ttraceID := span.TraceId\n\t\t\tif !validation.ValidTraceID(traceID) {\n\t\t\t\treturn nil, nil, nil, status.Errorf(codes.InvalidArgument, \"trace ids must be 128 bit\")\n\t\t\t}\n\n\t\t\ttraceKey := util.TokenFor(userID, traceID)\n\t\t\tilsKey := traceKey\n\t\t\tif ils.InstrumentationLibrary != nil {\n\t\t\t\tilsKey = fnv1a.AddString32(ilsKey, ils.InstrumentationLibrary.Name)\n\t\t\t\tilsKey = fnv1a.AddString32(ilsKey, ils.InstrumentationLibrary.Version)\n\t\t\t}\n\n\t\t\texistingILS, ok := spansByILS[ilsKey]\n\t\t\tif !ok {\n\t\t\t\texistingILS = &v1.InstrumentationLibrarySpans{\n\t\t\t\t\tInstrumentationLibrary: ils.InstrumentationLibrary,\n\t\t\t\t\tSpans: make([]*v1.Span, 0, spanCount/tracesPerBatch),\n\t\t\t\t}\n\t\t\t\tspansByILS[ilsKey] = existingILS\n\t\t\t}\n\t\t\texistingILS.Spans = append(existingILS.Spans, span)\n\n\t\t\t// if we found an ILS we assume its already part of a request and can go to the next span\n\t\t\tif ok {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\texistingTrace, ok := tracesByID[traceKey]\n\t\t\tif !ok {\n\t\t\t\texistingTrace = &traceAndID{\n\t\t\t\t\tid: traceID,\n\t\t\t\t\ttrace: &tempopb.Trace{\n\t\t\t\t\t\tBatches: make([]*v1.ResourceSpans, 0, spanCount/tracesPerBatch),\n\t\t\t\t\t},\n\t\t\t\t}\n\n\t\t\t\ttracesByID[traceKey] = existingTrace\n\t\t\t}\n\n\t\t\texistingTrace.trace.Batches = append(existingTrace.trace.Batches, &v1.ResourceSpans{\n\t\t\t\tResource: req.Batch.Resource,\n\t\t\t\tInstrumentationLibrarySpans: []*v1.InstrumentationLibrarySpans{existingILS},\n\t\t\t})\n\t\t}\n\t}\n\n\tmetricTracesPerBatch.Observe(float64(len(tracesByID)))\n\n\tkeys := make([]uint32, 0, len(tracesByID))\n\ttraces := make([]*tempopb.Trace, 0, len(tracesByID))\n\tids := make([][]byte, 0, len(tracesByID))\n\n\tfor k, r := range tracesByID {\n\t\tkeys = append(keys, k)\n\t\ttraces = append(traces, r.trace)\n\t\tids = append(ids, r.id)\n\t}\n\n\treturn keys, traces, ids, nil\n}", "title": "" } ]
[ { "docid": "6ba1ce61709e14193c16921508024052", "score": "0.59071887", "text": "func (s *SQLTraceStore) GetTraceIDsBySource(ctx context.Context, sourceFilename string, tileNumber types.TileNumber) ([]string, error) {\n\tctx, span := trace.StartSpan(ctx, \"sqltracestore.GetTraceIDsBySource\")\n\tdefer span.End()\n\n\trows, err := s.db.Query(ctx, statements[getTraceIDsBySource], sourceFilename, tileNumber)\n\tif err != nil {\n\t\treturn nil, skerr.Wrapf(err, \"Failed for sourceFilename=%q and tileNumber=%d\", sourceFilename, tileNumber)\n\t}\n\n\t// We queried the Postings table, build up each traceid from all the\n\t// key=value pairs returned.\n\tvar currentTraceIDAsBytes []byte\n\tp := paramtools.Params{}\n\tret := []string{}\n\tfor rows.Next() {\n\t\tvar keyValue string\n\t\tvar traceIDAsBytes []byte\n\t\tif err := rows.Scan(&keyValue, &traceIDAsBytes); err != nil {\n\t\t\treturn nil, skerr.Wrapf(err, \"Failed scanning for sourceFilename=%q and tileNumber=%d\", sourceFilename, tileNumber)\n\t\t}\n\t\t// If we hit a new trace_id then we have a complete traceID.\n\t\tif !bytes.Equal(currentTraceIDAsBytes, traceIDAsBytes) {\n\t\t\tif currentTraceIDAsBytes == nil {\n\t\t\t\t// This is the first time going through this loop.\n\t\t\t\tcurrentTraceIDAsBytes = make([]byte, len(traceIDAsBytes))\n\t\t\t} else {\n\t\t\t\t// Since traceIDAsBytes changed we are done building up the\n\t\t\t\t// params for the traceID, so convert the params into a string.\n\t\t\t\ttraceID, err := query.MakeKey(p)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, skerr.Wrap(err)\n\t\t\t\t}\n\t\t\t\tret = append(ret, traceID)\n\t\t\t}\n\t\t\tp = paramtools.Params{}\n\t\t\tcopy(currentTraceIDAsBytes, traceIDAsBytes)\n\t\t}\n\n\t\t// Add to the current Params.\n\t\tparts := strings.SplitN(keyValue, \"=\", 2)\n\t\tif len(parts) != 2 {\n\t\t\tsklog.Warningf(\"Found invalid key=value pair in Postings: %q\", keyValue)\n\t\t\tcontinue\n\t\t}\n\t\tp[parts[0]] = parts[1]\n\n\t}\n\tif err := rows.Err(); err != nil {\n\t\treturn nil, skerr.Wrap(err)\n\t}\n\n\t// Make sure to get the last trace id.\n\tif currentTraceIDAsBytes != nil {\n\t\ttraceID, err := query.MakeKey(p)\n\t\tif err != nil {\n\t\t\treturn nil, skerr.Wrap(err)\n\t\t}\n\n\t\tret = append(ret, traceID)\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "44ab222b5e5824708aff8add5ff6d20a", "score": "0.5574423", "text": "func getAllHashKeysFromReq(sourceKeys []hashSource, req *http.Request) []byte {\n\tvar b bytes.Buffer\n\tfor _, v := range sourceKeys {\n\t\tb.Write(getHashKeyFromReq(v.Key, v.Source, req))\n\t}\n\treturn b.Bytes()\n}", "title": "" }, { "docid": "2c1d7a27e6cad5871e9c2f085e37e266", "score": "0.5106097", "text": "func buildApiRequestAuditEntries(eventTypeId uint32, event *ApiAuditFields, auditInfo *datastore.AuditInfo) []auditQueueEntry {\n\n\tremote := parseAddress(event.RemoteAddress)\n\tlocal := parseAddress(event.LocalAddress)\n\t// No credentials at all? Generate one record.\n\tusernames := event.Users\n\tif len(usernames) == 0 {\n\t\trecord := &n1qlAuditApiRequestEvent{\n\t\t\tGenericFields: event.GenericFields,\n\t\t\tRemote: remote,\n\t\t\tLocal: local,\n\t\t\tHttpMethod: event.HttpMethod,\n\t\t\tHttpResultCode: event.HttpResultCode,\n\t\t\tErrorCode: event.ErrorCode,\n\t\t\tErrorMessage: event.ErrorMessage,\n\t\t\tStat: event.Stat,\n\t\t\tName: event.Name,\n\t\t\tRequest: event.Request,\n\t\t\tValues: event.Values,\n\t\t\tCluster: event.Cluster,\n\t\t\tNode: event.Node,\n\t\t\tBody: event.Body,\n\t\t}\n\t\tentry := auditQueueEntry{\n\t\t\teventId: eventTypeId,\n\t\t\tisQueryType: false,\n\t\t\tapiAuditRecord: record,\n\t\t}\n\t\treturn []auditQueueEntry{entry}\n\t}\n\n\t// Figure out which users to generate events for.\n\tauditableUsers := make([]datastore.UserInfo, 0, len(usernames))\n\tfor _, username := range usernames {\n\t\tuser := userInfoFromUsername(username)\n\t\tif !auditInfo.UserWhitelisted[user] {\n\t\t\tauditableUsers = append(auditableUsers, user)\n\t\t}\n\t}\n\n\t// Generate one entry per user.\n\tentries := make([]auditQueueEntry, len(auditableUsers))\n\tfor i, user := range auditableUsers {\n\t\trecord := &n1qlAuditApiRequestEvent{\n\t\t\tGenericFields: event.GenericFields,\n\t\t\tRemote: remote,\n\t\t\tLocal: local,\n\t\t\tHttpMethod: event.HttpMethod,\n\t\t\tHttpResultCode: event.HttpResultCode,\n\t\t\tErrorCode: event.ErrorCode,\n\t\t\tErrorMessage: event.ErrorMessage,\n\t\t\tStat: event.Stat,\n\t\t\tName: event.Name,\n\t\t\tRequest: event.Request,\n\t\t\tValues: event.Values,\n\t\t\tCluster: event.Cluster,\n\t\t\tNode: event.Node,\n\t\t\tBody: event.Body,\n\t\t}\n\t\trecord.GenericFields.RealUserid.Domain = user.Domain\n\t\trecord.GenericFields.RealUserid.Username = user.Name\n\n\t\tentries[i] = auditQueueEntry{\n\t\t\teventId: eventTypeId,\n\t\t\tisQueryType: false,\n\t\t\tapiAuditRecord: record,\n\t\t}\n\t}\n\treturn entries\n}", "title": "" }, { "docid": "b960100f0a14deed594803af1002daed", "score": "0.50390655", "text": "func (s *SQLTraceStore) convertHexTraceIdsToParams(ctx context.Context, currentBatch []traceIDForSQL, tileNumber types.TileNumber, outParams chan paramtools.Params) error {\n\tctx, span := trace.StartSpan(ctx, \"sqltracestore.QueryTracesIDOnly.convertHexTraceIdsToParams\")\n\tdefer span.End()\n\n\tcontext := convertTraceIDsContext{\n\t\tTileNumber: tileNumber,\n\t\tTraceIDs: currentBatch,\n\t\tAsOf: \"\",\n\t}\n\tif s.enableFollowerReads {\n\t\tcontext.AsOf = followerReadsStatement\n\t}\n\n\t// Expand the template for the SQL.\n\tvar b bytes.Buffer\n\tif err := s.unpreparedStatements[convertTraceIDs].Execute(&b, context); err != nil {\n\t\treturn skerr.Wrapf(err, \"failed to expand convertTraceIDs template\")\n\t}\n\tsql := b.String()\n\trows, err := s.db.Query(ctx, sql)\n\tif err != nil {\n\t\treturn skerr.Wrapf(err, \"SQL: %q\", sql)\n\t}\n\n\t// We build up the Params for each matching trace id row-by-row. That\n\t// is, each row contains the trace_id of a trace that matches the query,\n\t// and a single key=value pair from the trace name.\n\n\t// As we scan we keep track of the current trace_id we are on, since the\n\t// query returns rows ordered by trace_id we know they are all grouped\n\t// together.\n\tvar currentTraceID []byte\n\tp := paramtools.Params{}\n\tfor rows.Next() {\n\t\tvar keyValue string\n\t\tvar traceIDAsBytes []byte\n\t\tif err := rows.Scan(&keyValue, &traceIDAsBytes); err != nil {\n\t\t\tsklog.Errorf(\"Failed to scan traceName: %s\", skerr.Wrap(err))\n\t\t\treturn err\n\t\t}\n\t\t// If we hit a new trace_id then emit the current Params we have\n\t\t// built so far and start on a fresh Params.\n\t\tif !bytes.Equal(currentTraceID, traceIDAsBytes) {\n\t\t\t// Don't emit on the first row, i.e. before we've actually done\n\t\t\t// any work.\n\t\t\tif currentTraceID != nil {\n\t\t\t\toutParams <- p\n\t\t\t} else {\n\t\t\t\tcurrentTraceID = make([]byte, len(traceIDAsBytes))\n\t\t\t}\n\t\t\tp = paramtools.Params{}\n\t\t\tcopy(currentTraceID, traceIDAsBytes)\n\t\t}\n\n\t\t// Add to the current Params.\n\t\tparts := strings.SplitN(keyValue, \"=\", 2)\n\t\tif len(parts) != 2 {\n\t\t\tsklog.Warningf(\"Found invalid key=value pair in Postings: %q\", keyValue)\n\t\t\tcontinue\n\t\t}\n\t\tp[parts[0]] = parts[1]\n\t}\n\tif err := rows.Err(); err != nil && err != pgx.ErrNoRows {\n\t\treturn skerr.Wrapf(err, \"Failed while reading traceNames\")\n\t}\n\n\t// Make sure to emit the last trace id.\n\tif currentTraceID != nil {\n\t\toutParams <- p\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3e35ab1ad718eda3a11f6ac3a037bdd3", "score": "0.4960428", "text": "func (s *Store) GetTRBRequestSystemIntakesByTRBRequestID(ctx context.Context, trbRequestID uuid.UUID) ([]*models.SystemIntake, error) {\n\tresults := []*models.SystemIntake{}\n\n\terr := s.db.Select(&results, `\n\t\tSELECT b.*\n\t\tFROM trb_request_system_intakes a\n\t\tJOIN system_intakes b\n\t\tON b.id = a.system_intake_id\n\t\tWHERE a.trb_request_id = $1;`, trbRequestID)\n\n\tif err != nil && !errors.Is(err, sql.ErrNoRows) {\n\t\tappcontext.ZLogger(ctx).Error(\n\t\t\t\"Failed to fetch TRB request system intakes\",\n\t\t\tzap.Error(err),\n\t\t\tzap.String(\"id\", trbRequestID.String()))\n\n\t\treturn nil, &apperrors.QueryError{\n\t\t\tErr: err,\n\t\t\tModel: models.TRBRequestSystemIntake{},\n\t\t\tOperation: apperrors.QueryFetch,\n\t\t}\n\t}\n\treturn results, nil\n}", "title": "" }, { "docid": "f5936de0422c76fed9adbf24a6a5e33f", "score": "0.4906497", "text": "func validateAndCreateIdsForRequests(reqs []requests.RequestConfig) ([]requests.RequestConfig, map[int]int64) {\n\tsource := rand.NewSource(time.Now().UnixNano())\n\trandom := rand.New(source)\n\n\t//an array of ids used by database pacakge to calculate mean response time and send notifications\n\tids := make(map[int]int64, 0)\n\n\t//an array of new requests data after updating the ids\n\tnewreqs := make([]requests.RequestConfig, 0)\n\n\tfor i, requestConfig := range reqs {\n\t\tvalidateErr := requestConfig.Validate()\n\t\tif validateErr != nil {\n\t\t\tprintln(\"\\nInvalid Request data in config file for Request #\", i, \" \", requestConfig.Url)\n\t\t\tprintln(\"Error:\", validateErr.Error())\n\t\t\tos.Exit(3)\n\t\t}\n\n\t\t//Set a random value as id\n\t\trandInt := random.Intn(1000000)\n\t\tids[randInt] = requestConfig.ResponseTime\n\t\trequestConfig.SetId(randInt)\n\t\tnewreqs = append(newreqs, requestConfig)\n\t}\n\n\treturn newreqs, ids\n}", "title": "" }, { "docid": "783bc470f259a39e6da1751ce1526eb1", "score": "0.48139802", "text": "func (s serviceClient) QueryRequestsByReqCtx(reqCtxID string, batchCounter uint64) ([]rpc.ServiceRequest, sdk.Error) {\n\tparam := struct {\n\t\tRequestContextID cmn.HexBytes\n\t\tBatchCounter uint64\n\t}{\n\t\tRequestContextID: hexBytesFrom(reqCtxID),\n\t\tBatchCounter: batchCounter,\n\t}\n\n\tvar rs requests\n\tif err := s.QueryWithResponse(\"custom/service/requests_by_ctx\", param, &rs); err != nil {\n\t\treturn nil, sdk.Wrap(err)\n\t}\n\treturn rs.Convert().([]rpc.ServiceRequest), nil\n}", "title": "" }, { "docid": "6123cd731fb5cd3d6ceaf84eadd82974", "score": "0.4806909", "text": "func LogsToLokiRequests(ld plog.Logs, defaultLabelsEnabled map[string]bool) map[string]PushRequest {\n\tgroups := map[string]pushRequestGroup{}\n\n\trls := ld.ResourceLogs()\n\tfor i := 0; i < rls.Len(); i++ {\n\t\tills := rls.At(i).ScopeLogs()\n\t\tresource := rls.At(i).Resource()\n\n\t\tfor j := 0; j < ills.Len(); j++ {\n\t\t\tlogs := ills.At(j).LogRecords()\n\t\t\tscope := ills.At(j).Scope()\n\t\t\tfor k := 0; k < logs.Len(); k++ {\n\t\t\t\tlog := logs.At(k)\n\t\t\t\ttenant := GetTenantFromTenantHint(log.Attributes(), resource.Attributes())\n\t\t\t\tgroup, ok := groups[tenant]\n\t\t\t\tif !ok {\n\t\t\t\t\tgroup = pushRequestGroup{\n\t\t\t\t\t\treport: &PushReport{},\n\t\t\t\t\t\tstreams: make(map[string]*push.Stream),\n\t\t\t\t\t}\n\t\t\t\t\tgroups[tenant] = group\n\t\t\t\t}\n\n\t\t\t\tentry, err := LogToLokiEntry(log, resource, scope, defaultLabelsEnabled)\n\t\t\t\tif err != nil {\n\t\t\t\t\t// Couldn't convert so dropping log.\n\t\t\t\t\tgroup.report.Errors = append(group.report.Errors, fmt.Errorf(\"failed to convert, dropping log: %w\", err))\n\t\t\t\t\tgroup.report.NumDropped++\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tgroup.report.NumSubmitted++\n\n\t\t\t\t// create the stream name based on the labels\n\t\t\t\tlabels := entry.Labels.String()\n\t\t\t\tif stream, ok := group.streams[labels]; ok {\n\t\t\t\t\tstream.Entries = append(stream.Entries, *entry.Entry)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tgroup.streams[labels] = &push.Stream{\n\t\t\t\t\tLabels: labels,\n\t\t\t\t\tEntries: []push.Entry{*entry.Entry},\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\trequests := make(map[string]PushRequest)\n\tfor tenant, g := range groups {\n\t\tpr := &push.PushRequest{\n\t\t\tStreams: make([]push.Stream, len(g.streams)),\n\t\t}\n\n\t\ti := 0\n\t\tfor _, stream := range g.streams {\n\t\t\tpr.Streams[i] = *stream\n\t\t\ti++\n\t\t}\n\t\trequests[tenant] = PushRequest{\n\t\t\tPushRequest: pr,\n\t\t\tReport: g.report,\n\t\t}\n\t}\n\treturn requests\n}", "title": "" }, { "docid": "94c292dde6c82732763e9620d888ca79", "score": "0.4758219", "text": "func (o *GetSDTHistoryByDeviceIDParams) 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.End != nil {\n\n\t\t// query param end\n\t\tvar qrEnd int64\n\t\tif o.End != nil {\n\t\t\tqrEnd = *o.End\n\t\t}\n\t\tqEnd := swag.FormatInt64(qrEnd)\n\t\tif qEnd != \"\" {\n\t\t\tif err := r.SetQueryParam(\"end\", qEnd); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Fields != nil {\n\n\t\t// query param fields\n\t\tvar qrFields string\n\t\tif o.Fields != nil {\n\t\t\tqrFields = *o.Fields\n\t\t}\n\t\tqFields := qrFields\n\t\tif qFields != \"\" {\n\t\t\tif err := r.SetQueryParam(\"fields\", qFields); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Filter != nil {\n\n\t\t// query param filter\n\t\tvar qrFilter string\n\t\tif o.Filter != nil {\n\t\t\tqrFilter = *o.Filter\n\t\t}\n\t\tqFilter := qrFilter\n\t\tif qFilter != \"\" {\n\t\t\tif err := r.SetQueryParam(\"filter\", qFilter); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// path param id\n\tif err := r.SetPathParam(\"id\", swag.FormatInt32(o.ID)); err != nil {\n\t\treturn err\n\t}\n\n\tif o.NetflowFilter != nil {\n\n\t\t// query param netflowFilter\n\t\tvar qrNetflowFilter string\n\t\tif o.NetflowFilter != nil {\n\t\t\tqrNetflowFilter = *o.NetflowFilter\n\t\t}\n\t\tqNetflowFilter := qrNetflowFilter\n\t\tif qNetflowFilter != \"\" {\n\t\t\tif err := r.SetQueryParam(\"netflowFilter\", qNetflowFilter); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Offset != nil {\n\n\t\t// query param offset\n\t\tvar qrOffset int32\n\t\tif o.Offset != nil {\n\t\t\tqrOffset = *o.Offset\n\t\t}\n\t\tqOffset := swag.FormatInt32(qrOffset)\n\t\tif qOffset != \"\" {\n\t\t\tif err := r.SetQueryParam(\"offset\", qOffset); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Size != nil {\n\n\t\t// query param size\n\t\tvar qrSize int32\n\t\tif o.Size != nil {\n\t\t\tqrSize = *o.Size\n\t\t}\n\t\tqSize := swag.FormatInt32(qrSize)\n\t\tif qSize != \"\" {\n\t\t\tif err := r.SetQueryParam(\"size\", qSize); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Start != nil {\n\n\t\t// query param start\n\t\tvar qrStart int64\n\t\tif o.Start != nil {\n\t\t\tqrStart = *o.Start\n\t\t}\n\t\tqStart := swag.FormatInt64(qrStart)\n\t\tif qStart != \"\" {\n\t\t\tif err := r.SetQueryParam(\"start\", qStart); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1333e179289c05ec36e4d272d86daa2f", "score": "0.47414824", "text": "func GetRequestEntries() ([]Sensor, error) {\n\tclient := initDBClient()\n\tparams := &dynamodb.ScanInput{\n\t\tTableName: aws.String(\"sensorsRequest\"),\n\t}\n\n\tresult, err := client.Scan(params)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar requestList = []Sensor{}\n\tfor _, i := range result.Items {\n\t\tentry := Sensor{}\n\t\terr = dynamodbattribute.UnmarshalMap(i, &entry)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\trequestList = append(requestList, entry)\n\t}\n\n\treturn requestList, nil\n}", "title": "" }, { "docid": "8b786c9433be1de2ba26ba57c643f1c8", "score": "0.47313926", "text": "func recordsBySessionID(cmd *cobra.Command, sessionID types.MetadataAddress) error {\n\tscopeUUID, err := sessionID.ScopeUUID()\n\tif err != nil {\n\t\treturn err\n\t}\n\tclientCtx, err := client.GetClientQueryContext(cmd)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tqueryClient := types.NewQueryClient(clientCtx)\n\tres, err := queryClient.Scope(context.Background(), &types.ScopeRequest{ScopeUuid: scopeUUID.String()})\n\tif err != nil {\n\t\treturn err\n\t}\n\tif res == nil || res.Records == nil || len(res.Records) == 0 {\n\t\treturn fmt.Errorf(\"no records found for scope uuid %s\", scopeUUID)\n\t}\n\n\tprotoList := []proto.Message{}\n\tfor _, record := range res.Records {\n\t\tif record != nil && sessionID.Equals(record.SessionId) {\n\t\t\tprotoList = append(protoList, record)\n\t\t}\n\t}\n\treturn printProtoList(clientCtx, protoList)\n}", "title": "" }, { "docid": "cc5ec41cbb2e73bde6a94a5dda3b88d0", "score": "0.467395", "text": "func (ds *deleteRequestsStore) addDeleteRequest(ctx context.Context, userID string, createdAt, startTime, endTime model.Time, selectors []string) ([]byte, error) {\n\trequestID := generateUniqueID(userID, selectors)\n\n\tfor {\n\t\t_, err := ds.GetDeleteRequest(ctx, userID, string(requestID))\n\t\tif err != nil {\n\t\t\tif err == ErrDeleteRequestNotFound {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// we have a collision here, lets recreate a new requestID and check for collision\n\t\ttime.Sleep(time.Millisecond)\n\t\trequestID = generateUniqueID(userID, selectors)\n\t}\n\n\t// userID, requestID\n\tuserIDAndRequestID := fmt.Sprintf(\"%s:%s\", userID, requestID)\n\n\t// Add an entry with userID, requestID as range key and status as value to make it easy to manage and lookup status\n\t// We don't want to set anything in hash key here since we would want to find delete requests by just status\n\twriteBatch := ds.indexClient.NewWriteBatch()\n\twriteBatch.Add(DeleteRequestsTableName, string(deleteRequestID), []byte(userIDAndRequestID), []byte(StatusReceived))\n\n\t// Add another entry with additional details like creation time, time range of delete request and selectors in value\n\trangeValue := fmt.Sprintf(\"%x:%x:%x\", int64(createdAt), int64(startTime), int64(endTime))\n\twriteBatch.Add(DeleteRequestsTableName, fmt.Sprintf(\"%s:%s\", deleteRequestDetails, userIDAndRequestID),\n\t\t[]byte(rangeValue), []byte(strings.Join(selectors, separator)))\n\n\terr := ds.indexClient.BatchWrite(ctx, writeBatch)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn requestID, nil\n}", "title": "" }, { "docid": "acb2a89c5b8007c65348c1658c6001c9", "score": "0.46647385", "text": "func handleRequest(ctx context.Context, event events.DynamoDBEvent) (err error) {\n\tlc, ok := lambdacontext.FromContext(ctx)\n\tif !ok {\n\t\trequestID = \"UNDEFINED\"\n\t}\n\trequestID = lc.AwsRequestID\n\n\t//Define the request logger with common fields\n\treqLogger := log.WithFields(logrus.Fields{\"request_id\": requestID, \"function\": \"handleRequest\"})\n\treqLogger.Debug(\"Raw request: %#v\", event)\n\n\t// Create an Elasticsearch client\n\tesClient, err := newESClient(awsRegion)\n\tif err != nil {\n\t\tlog.Fatalf(\"Can't create client for ElasticSearch: \", err)\n\t}\n\n\t//New ES index if it doesn't exist\n\terr = createESIndex(ctx, esClient, esIndex)\n\tif err != nil {\n\t\tlog.Fatalf(\"Something went wrong during index checking: %s\", err)\n\t}\n\n\tfor _, r := range event.Records {\n\t\tdata := map[string]interface{}{}\n\t\tfor k, v := range r.Change.NewImage {\n\t\t\treqLogger.Debugf(\"key %s type %d\", k, v.DataType())\n\t\t\tswitch v.DataType() {\n\t\t\tcase 5:\n\t\t\t\tdata[k], err = v.Integer()\n\t\t\t\tif err != nil {\n\t\t\t\t\treqLogger.Error(\"Can't convert value to integer\")\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\tcase 7:\n\t\t\t\tdata[k] = \"NULL\"\n\t\t\tcase 8:\n\t\t\t\tdata[k] = v.String()\n\t\t\tdefault:\n\t\t\t\tdata[k] = v.String()\n\t\t\t}\n\t\t}\n\n\t\tvar id string\n\t\tif id, ok = data[recID].(string); !ok {\n\t\t\treturn errors.New(\"can't get the value for given ID\")\n\t\t}\n\n\t\treqLogger.Debugf(\"ES document id: %s\", id)\n\t\tstatus, err := createESDocument(ctx, esClient, esIndex, id, data)\n\t\tif err != nil {\n\t\t\treqLogger.Error(err)\n\t\t\treturn err\n\t\t}\n\t\treqLogger.Info(status.Result)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "bdbc974da29eb556583f58f5c386a687", "score": "0.45769718", "text": "func (o *GetFlowLogsByResourceNameParams) 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.AccountID != nil {\n\n\t\t// query param accountId\n\t\tvar qrAccountID string\n\t\tif o.AccountID != nil {\n\t\t\tqrAccountID = *o.AccountID\n\t\t}\n\t\tqAccountID := qrAccountID\n\t\tif qAccountID != \"\" {\n\t\t\tif err := r.SetQueryParam(\"accountId\", qAccountID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// path param resourceName\n\tif err := r.SetPathParam(\"resourceName\", o.ResourceName); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "36c9157f94b4529f32db08d722e26adb", "score": "0.45721936", "text": "func (o *GetNetworksNetworkIDTracingTraceIDParams) 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\t// path param network_id\n\tif err := r.SetPathParam(\"network_id\", o.NetworkID); err != nil {\n\t\treturn err\n\t}\n\n\t// path param trace_id\n\tif err := r.SetPathParam(\"trace_id\", o.TraceID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "281ff568ac06fdf8064f85d3c9cfe09d", "score": "0.45326486", "text": "func recordsByScopeID(cmd *cobra.Command, id types.MetadataAddress) error {\n\tscopeUUID, err := id.ScopeUUID()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn recordsByScopeUUID(cmd, scopeUUID.String())\n}", "title": "" }, { "docid": "16be126a08ff0cd868746bc900ccfcfc", "score": "0.45250013", "text": "func DecodeVersionsByIDRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (interface{}, error) {\n\treturn func(r *http.Request) (interface{}, error) {\n\t\tvar (\n\t\t\tid uint\n\t\t\terr error\n\n\t\t\tparams = mux.Vars(r)\n\t\t)\n\t\t{\n\t\t\tidRaw := params[\"id\"]\n\t\t\tv, err2 := strconv.ParseUint(idRaw, 10, strconv.IntSize)\n\t\t\tif err2 != nil {\n\t\t\t\terr = goa.MergeErrors(err, goa.InvalidFieldTypeError(\"id\", idRaw, \"unsigned integer\"))\n\t\t\t}\n\t\t\tid = uint(v)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpayload := NewVersionsByIDPayload(id)\n\n\t\treturn payload, nil\n\t}\n}", "title": "" }, { "docid": "6c9120f27958892ba322fbfe81709bb6", "score": "0.45156512", "text": "func (r *queryResolver) uploadsByIDs(ctx context.Context, ids []int, uploadsByIDs map[int]dbstore.Dump) ([]dbstore.Dump, error) {\n\tmissingIDs := make([]int, 0, len(ids))\n\texistingUploads := make([]store.Dump, 0, len(ids))\n\n\tfor _, id := range ids {\n\t\tif upload, ok := uploadsByIDs[id]; ok {\n\t\t\texistingUploads = append(existingUploads, upload)\n\t\t} else {\n\t\t\tmissingIDs = append(missingIDs, id)\n\t\t}\n\t}\n\n\tuploads, err := r.dbStore.GetDumpsByIDs(ctx, missingIDs)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"dbstore.GetDumpsByIDs\")\n\t}\n\n\tnewUploads, err := filterUploadsWithCommits(ctx, r.cachedCommitChecker, uploads)\n\tif err != nil {\n\t\treturn nil, nil\n\t}\n\n\treturn append(existingUploads, newUploads...), nil\n}", "title": "" }, { "docid": "515a90f8cc820f1b5d9c0c46b2783fb0", "score": "0.4509455", "text": "func getSGsByID(conn *gophercloud.ServiceClient, logger logrus.FieldLogger) (map[string]sg.SecGroup, error) {\n\tsgByID := make(map[string]sg.SecGroup)\n\tallPages, err := sg.List(conn, sg.ListOpts{}).AllPages()\n\tif err != nil {\n\t\tlogger.Error(err)\n\t\treturn sgByID, nil\n\t}\n\tallSGs, err := sg.ExtractGroups(allPages)\n\tif err != nil {\n\t\tlogger.Error(err)\n\t\treturn sgByID, nil\n\t}\n\n\t// Organize SGs for easy lookup\n\tfor _, group := range allSGs {\n\t\tsgByID[group.ID] = group\n\t}\n\treturn sgByID, err\n}", "title": "" }, { "docid": "641186cc89dc758e93cb50ad37d32008", "score": "0.44974583", "text": "func (ts *TraceServiceImpl) atomize(ids []string) (map[string]uint64, error) {\n\tret := map[string]uint64{}\n\n\t// First look up everything in the LRU cache.\n\tnotcached := []string{}\n\tfor _, id := range ids {\n\t\tts.mutex.Lock()\n\t\tcached, ok := ts.cache.Get(id)\n\t\tts.mutex.Unlock()\n\t\tif ok {\n\t\t\tret[id] = cached.(uint64)\n\t\t} else {\n\t\t\tnotcached = append(notcached, id)\n\t\t}\n\t}\n\n\t// If we've found all our answers in the LRU cache then we're done.\n\tif len(ret) == len(ids) {\n\t\treturn ret, nil\n\t}\n\n\t// Next look into the datastore and see if we can find the answers there.\n\tnotstored := []string{}\n\tget := func(tx *bolt.Tx) error {\n\t\tt := tx.Bucket([]byte(TRACEID_BUCKET_NAME))\n\t\tfor _, id := range notcached {\n\t\t\t// Find the value in the datastore.\n\t\t\tif bid64 := t.Get([]byte(id)); bid64 == nil {\n\t\t\t\tnotstored = append(notstored, id)\n\t\t\t} else {\n\t\t\t\t// If found update the return value and the cache.\n\t\t\t\tid64 := binary.LittleEndian.Uint64(bid64)\n\t\t\t\tts.mutex.Lock()\n\t\t\t\tts.cache.Add(id, id64)\n\t\t\t\tts.cache.Add(id64, id)\n\t\t\t\tts.mutex.Unlock()\n\t\t\t\tret[id] = id64\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}\n\n\tif err := ts.db.View(get); err != nil {\n\t\treturn nil, fmt.Errorf(\"Error while reading trace ids: %s\", err)\n\t}\n\n\tif len(ret) == len(ids) {\n\t\treturn ret, nil\n\t}\n\n\t// If we still have ids that we haven't matching trace64ids for then we need\n\t// to create trace64ids for them and store them in BoltDB and in the LRU\n\t// cache.\n\tadd := func(tx *bolt.Tx) error {\n\t\tt := tx.Bucket([]byte(TRACEID_BUCKET_NAME))\n\t\t// Find the current largest trace64id.\n\t\tvar largest uint64 = 0\n\t\tif blargest := t.Get([]byte(LARGEST_TRACEID_KEY)); blargest != nil {\n\t\t\tlargest = binary.LittleEndian.Uint64(blargest)\n\t\t}\n\n\t\t// Generate a new id for each traceid and store the results.\n\t\tfor i, id := range notstored {\n\t\t\tvalue := largest + uint64(i) + 1\n\t\t\tbvalue := make([]byte, 8, 8)\n\t\t\tbinary.LittleEndian.PutUint64(bvalue, value)\n\t\t\tif err := t.Put([]byte(id), bvalue); err != nil {\n\t\t\t\treturn fmt.Errorf(\"Failed to write atomized value for %s: %s\", id, err)\n\t\t\t}\n\t\t\tif err := t.Put(bvalue, []byte(id)); err != nil {\n\t\t\t\treturn fmt.Errorf(\"Failed to write atomized reverse lookup value for %s: %s\", id, err)\n\t\t\t}\n\t\t\tts.mutex.Lock()\n\t\t\tts.cache.Add(id, value)\n\t\t\tts.cache.Add(value, id)\n\t\t\tts.mutex.Unlock()\n\t\t\tret[id] = value\n\t\t}\n\n\t\tlargest = largest + uint64(len(notstored))\n\n\t\t// Write the new value for LARGEST_TRACEID_KEY.\n\t\tblargest := make([]byte, 8, 8)\n\t\tbinary.LittleEndian.PutUint64(blargest, largest)\n\t\tif err := t.Put([]byte(LARGEST_TRACEID_KEY), blargest); err != nil {\n\t\t\treturn fmt.Errorf(\"Failed to write an updated largest trace64id value: %s\", err)\n\t\t}\n\n\t\treturn nil\n\t}\n\n\tif err := ts.db.Update(add); err != nil {\n\t\treturn nil, fmt.Errorf(\"Error while writing new trace ids: %s\", err)\n\t}\n\n\tif len(ret) == len(ids) {\n\t\treturn ret, nil\n\t} else {\n\t\treturn nil, fmt.Errorf(\"Failed to add traceid ids: mismatched number of ids.\")\n\t}\n}", "title": "" }, { "docid": "66441a19b981d582c748d657bc2f090c", "score": "0.44873336", "text": "func ParseTraceID(id string) (paramtools.Params, error) {\n\tprelimKeys, err := query.ParseKeyFast(id)\n\tif err != nil {\n\t\treturn nil, skerr.Wrap(err)\n\t}\n\ttraceKeys := make(map[string]string, len(prelimKeys))\n\tfor k, v := range prelimKeys {\n\t\tk = strings.ReplaceAll(k, urlEncodedComma, \",\")\n\t\tv = strings.ReplaceAll(v, urlEncodedComma, \",\")\n\t\ttraceKeys[k] = v\n\t}\n\treturn traceKeys, nil\n}", "title": "" }, { "docid": "8d164cb2d03471f90ebf5990e4d99f9e", "score": "0.44760406", "text": "func (t *TweetRawIncludes) TweetsByID() map[string]*TweetObj {\n\tswitch {\n\tcase t.referenceTweets == nil:\n\t\treturn t.tweetsByID()\n\tdefault:\n\t\treturn t.referenceTweets\n\t}\n}", "title": "" }, { "docid": "71eccc0d11f6c8d3b70cdc9ed237292d", "score": "0.44638523", "text": "func tracing(nextRequestID func() string) func(http.Handler) http.Handler {\n\treturn func(next http.Handler) http.Handler {\n\t\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\trequestID := r.Header.Get(\"X-Request-Id\")\n\t\t\tif requestID == \"\" {\n\t\t\t\trequestID = nextRequestID()\n\t\t\t}\n\t\t\tctx := context.WithValue(r.Context(), requestIDKey, requestID)\n\t\t\tw.Header().Set(\"X-Request-Id\", requestID)\n\t\t\tnext.ServeHTTP(w, r.WithContext(ctx))\n\t\t})\n\t}\n}", "title": "" }, { "docid": "7b63784e637eacfb3683fa6aa736a97b", "score": "0.44630992", "text": "func (o *SyncHistoryUsingGETParams) bindParamSourceIds(formats strfmt.Registry) []string {\n\tsourceIdsIR := o.SourceIds\n\n\tvar sourceIdsIC []string\n\tfor _, sourceIdsIIR := range sourceIdsIR { // explode []strfmt.UUID\n\n\t\tsourceIdsIIV := sourceIdsIIR.String() // strfmt.UUID as string\n\t\tsourceIdsIC = append(sourceIdsIC, sourceIdsIIV)\n\t}\n\n\t// items.CollectionFormat: \"multi\"\n\tsourceIdsIS := swag.JoinByFormat(sourceIdsIC, \"multi\")\n\n\treturn sourceIdsIS\n}", "title": "" }, { "docid": "a2208fe8be391dc88dd2853452c76ed7", "score": "0.4456903", "text": "func TraceIDExtractor(ctx context.Context, r *http.Request) context.Context {\n\ttraceID := r.Header.Get(traceIDHeader)\n\tif traceID != \"\" {\n\t\treturn ctxWithTraceID(ctx, traceID)\n\t}\n\treturn ctxWithTraceID(ctx, utils.GenRandomString(traceIDLen))\n}", "title": "" }, { "docid": "e24842d34bbbfa0f46df928c430b995c", "score": "0.44561028", "text": "func (b *BigTableTraceStore) allTraces(ctx context.Context, tileKey TileKey) (types.TraceSet, error) {\n\tctx, span := trace.StartSpan(ctx, \"BigTableTraceStore.allTraces\")\n\tdefer span.End()\n\n\tops, err := b.GetOrderedParamSet(ctx, tileKey)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to get OPS: %s\", err)\n\t}\n\n\tdefer timer.New(\"btts_all_traces\").Stop()\n\tdefer metrics2.FuncTimer().Stop()\n\tvar mutex sync.Mutex\n\tret := types.TraceSet{}\n\tvar g errgroup.Group\n\ttctx, cancel := context.WithTimeout(context.Background(), TIMEOUT)\n\tdefer cancel()\n\t// Spawn one Go routine for each shard.\n\tfor i := int32(0); i < b.shards; i++ {\n\t\ti := i\n\t\tg.Go(func() error {\n\t\t\trowRegex := tileKey.TraceRowPrefix(i) + \".*\"\n\t\t\treturn b.getTable().ReadRows(tctx, bigtable.PrefixRange(tileKey.TraceRowPrefix(i)), func(row bigtable.Row) bool {\n\t\t\t\tvec := vec32.New(int(b.tileSize))\n\t\t\t\tfor _, col := range row[VALUES_FAMILY] {\n\t\t\t\t\tvec[b.lookup[col.Column]] = math.Float32frombits(binary.LittleEndian.Uint32(col.Value))\n\t\t\t\t}\n\t\t\t\tparts := strings.Split(row.Key(), \":\")\n\t\t\t\ttraceId, err := traceIdFromEncoded(ops, parts[2])\n\t\t\t\tif err != nil {\n\t\t\t\t\tsklog.Infof(\"Found encoded key %q that can't be decoded: %s\", parts[2], err)\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t\tmutex.Lock()\n\t\t\t\tret[traceId] = vec\n\t\t\t\tmutex.Unlock()\n\t\t\t\treturn true\n\t\t\t}, bigtable.RowFilter(\n\t\t\t\tbigtable.ChainFilters(\n\t\t\t\t\tbigtable.LatestNFilter(1),\n\t\t\t\t\tbigtable.RowKeyFilter(rowRegex),\n\t\t\t\t\tbigtable.FamilyFilter(VALUES_FAMILY),\n\t\t\t\t)))\n\t\t})\n\t}\n\tif err := g.Wait(); err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to query: %s\", err)\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "8c510f3c40c1259b01d6e31581b01d24", "score": "0.44538462", "text": "func RequestEntries(cacheID CacheID) *RequestEntriesParams {\n\treturn &RequestEntriesParams{\n\t\tCacheID: cacheID,\n\t}\n}", "title": "" }, { "docid": "e17087d72ca73a95fe5fea33a005ba09", "score": "0.44332576", "text": "func NewReqHdrGenerateTraceAndMessageID() *pb.RequestHeader {\n\treturn &pb.RequestHeader{Identifiers: &pb.Identifiers{TraceID: NewTraceID(), MessageID: NewMessageID()}, RequestTimestamp: ptypes.TimestampNow()}\n}", "title": "" }, { "docid": "ae61e67420405548fbc0c40a424a8ee8", "score": "0.44149253", "text": "func RequestID(headerName string) func(next http.Handler) http.Handler {\n\treturn func(next http.Handler) http.Handler {\n\t\tfn := func(w http.ResponseWriter, r *http.Request) {\n\t\t\tctx := r.Context()\n\t\t\trequestID := r.Header.Get(getHeaderName(headerName))\n\t\t\tif requestID == \"\" {\n\t\t\t\trequestID = uuid.New().String()\n\t\t\t}\n\n\t\t\tctx = context.WithValue(ctx, RequestIDKey, requestID)\n\n\t\t\tnext.ServeHTTP(w, r.WithContext(ctx))\n\t\t}\n\t\treturn http.HandlerFunc(fn)\n\t}\n}", "title": "" }, { "docid": "11670d19a7360bc41a0fe6ce7b5a7228", "score": "0.4411105", "text": "func GetTraceID(r *http.Request) string {\n\tif id, ok := r.Context().Value(contextKey(\"requestID\")).(string); ok {\n\t\treturn id\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "bc917f395e1b5b5aeb2c2baa7a17af67", "score": "0.43997154", "text": "func (_TellorTransfer *TellorTransferSession) RequestIdByQueryHash(arg0 [32]byte) (*big.Int, error) {\n\treturn _TellorTransfer.Contract.RequestIdByQueryHash(&_TellorTransfer.CallOpts, arg0)\n}", "title": "" }, { "docid": "e675ed6e002dd0cd709d4d88d22cfff6", "score": "0.43888053", "text": "func (traces HTTPReqTraces) Get(id TraceID) *HTTPReqTrace {\n\tfor i := range traces {\n\t\tif traces[i].TraceID == id {\n\t\t\treturn &traces[i]\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2f23469718e989d8a7e2344121767d8e", "score": "0.43837506", "text": "func (_ITellor *ITellorCallerSession) GetMinersByRequestIdAndTimestamp(_requestId *big.Int, _timestamp *big.Int) ([5]common.Address, error) {\n\treturn _ITellor.Contract.GetMinersByRequestIdAndTimestamp(&_ITellor.CallOpts, _requestId, _timestamp)\n}", "title": "" }, { "docid": "ff08fa172722009a7a2d991d3e19315a", "score": "0.43824098", "text": "func (m *MySqlDbHandler) LogRequest(requests chan Entities.CollectorRequest) error {\n\n\tdb, err := sql.Open(mysqlDriver, m.ConStr) // open connection to mysql database\n\n\tgo func() {\n\n\t\tdefer db.Close()\n\t\tvar queryBuffer bytes.Buffer\n\t\tqueryBuffer.WriteString(\"INSERT INTO `events` VALUES \")\n\t\titemsCount := 0\n\t\tfor request := range requests {\n\t\t\tlog.Println(\"handle request\", request)\n\n\t\t\t// collect all the parameters in a map\n\t\t\tparams := make([]ParamKeyValue,8)\n\t\t\tparams[0] = ParamKeyValue{Value: \"0\", Type: reflect.TypeOf(request.Gender), Key: \"idevents\"}\n\t\t\tparams[1] = ParamKeyValue{Value: request.Gender, Type: reflect.TypeOf(request.Gender), Key: \"gender\"}\n\t\t\tparams[2] = ParamKeyValue{Value: strconv.FormatFloat(request.D1, 'f', 2, 64), Type: reflect.TypeOf(request.D1), Key: \"d1\"}\n\t\t\tparams[3] = ParamKeyValue{Value: strconv.FormatFloat(request.P1, 'f', 2, 64), Type: reflect.TypeOf(request.P1), Key:\"p1\"}\n\t\t\tparams[4] = ParamKeyValue{Value: request.App_name, Type: reflect.TypeOf(request.App_name), Key:\"app_name\"}\n\t\t\tparams[5] = ParamKeyValue{Value: request.Mime_type, Type: reflect.TypeOf(request.Mime_type), Key:\"mime_type\"}\n\t\t\tparams[6] = ParamKeyValue{Value: strconv.FormatFloat(request.N1, 'f', 2, 64), Type: reflect.TypeOf(request.N1), Key:\"n1\"}\n\t\t\tparams[7] = ParamKeyValue{Value: request.Cc, Type: reflect.TypeOf(request.Cc), Key:\"cc\"}\n\n\t\t\t// create sql key value string\n\t\t\tqueryParams := queryParametersCreator(params, true)\n\t\t\tqueryParams = strings.Trim(queryParams, \" \")\n\t\t\tqueryParams = fmt.Sprintf(\"(%s),\", queryParams)\n\t\t\tqueryBuffer.WriteString(queryParams)\n\n\t\t\titemsCount++\n\n\t\t\tif (itemsCount == cap(requests)) {\n\t\t\t\tquery := strings.Trim(queryBuffer.String(), \",\")\n\t\t\t\tlog.Println(\"execute\", query)\n\t\t\t\t_, err = db.Exec(query) // execute\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Println(err.Error())\n\t\t\t\t}\n\t\t\t\titemsCount = 0\n\t\t\t\tqueryBuffer.Reset()\n\t\t\t\tqueryBuffer.WriteString(\"INSERT INTO events VALUES \")\n\t\t\t}\n\t\t}\n\n\t\tlog.Println(\"insert is done\")\n\t}()\n\treturn err\n}", "title": "" }, { "docid": "5dfdb9058f8d1caf63ec418355c06746", "score": "0.43816268", "text": "func mergeRequests(requests []dataRequest, req dataRequest) []dataRequest {\n\tfor _, request := range requests {\n\t\t// if req is for a dataset already in requests\n\t\tif req.datasetName == request.datasetName {\n\t\t\tfor key, _ := range req.requested {\n\t\t\t\t// if key exists in requests\n\t\t\t\tif _, ok := request.requested[key]; ok {\n\t\t\t\t\t// add all ranges from req to slice of ranges in request\n\t\t\t\t\tfor _, myRange := range req.requested[key] {\n\t\t\t\t\t\trequest.requested[key] = append(request.requested[key], myRange)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\trequest.requested[key] = req.requested[key]\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn requests\n\t\t}\n\t}\n\trequests = append(requests, req)\n\treturn requests\n}", "title": "" }, { "docid": "c74b8a62c4535656cdf2c43f60a4f800", "score": "0.43779337", "text": "func (_TellorTransfer *TellorTransferCallerSession) RequestIdByQueryHash(arg0 [32]byte) (*big.Int, error) {\n\treturn _TellorTransfer.Contract.RequestIdByQueryHash(&_TellorTransfer.CallOpts, arg0)\n}", "title": "" }, { "docid": "d4d112d9d6857d2d0501df90bf8f5016", "score": "0.43769312", "text": "func (b *BigTableTraceStore) ReadTraces(tileKey TileKey, keys []string) (map[string][]float32, error) {\n\t// First encode all the keys by the OrderedParamSet of the given tile.\n\tops, err := b.GetOrderedParamSet(context.TODO(), tileKey)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to get OPS: %s\", err)\n\t}\n\t// Also map[encodedKey]originalKey so we can construct our response.\n\tencodedKeys := map[string]string{}\n\trowSet := bigtable.RowList{}\n\tfor _, key := range keys {\n\t\tparams, err := query.ParseKey(key)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"Failed to parse key %q: %s\", key, err)\n\t\t}\n\t\t// Not all keys may appear in all tiles, that's ok.\n\t\tencodedKey, err := ops.EncodeParamsAsString(paramtools.Params(params))\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tencodedKeys[encodedKey] = key\n\t\tencodedKey = tileKey.TraceRowName(encodedKey, b.shards)\n\t\trowSet = append(rowSet, encodedKey)\n\t}\n\tret := map[string][]float32{}\n\n\ttctx, cancel := context.WithTimeout(context.Background(), TIMEOUT)\n\tdefer cancel()\n\terr = b.getTable().ReadRows(tctx, rowSet, func(row bigtable.Row) bool {\n\t\tvec := vec32.New(int(b.tileSize))\n\t\tfor _, col := range row[VALUES_FAMILY] {\n\t\t\tvec[b.lookup[col.Column]] = math.Float32frombits(binary.LittleEndian.Uint32(col.Value))\n\t\t}\n\t\tparts := strings.Split(row.Key(), \":\")\n\t\tret[encodedKeys[parts[2]]] = vec\n\t\treturn true\n\t}, bigtable.RowFilter(\n\t\tbigtable.ChainFilters(\n\t\t\tbigtable.LatestNFilter(1),\n\t\t\tbigtable.FamilyFilter(VALUES_FAMILY),\n\t\t)))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn ret, nil\n}", "title": "" }, { "docid": "08b5e04b51b4deaf5112f7f14a379d80", "score": "0.43668655", "text": "func writeDigests(w io.Writer, traces map[string]tiling.Trace) (map[string]int, error) {\n\tdigestSet := util.NewStringSet()\n\tfor _, trace := range traces {\n\t\tdigestSet.AddLists(trace.(*types.GoldenTrace).Values)\n\t}\n\n\tdigests := digestSet.Keys()\n\tif len(digests) > int(math.Pow(2, BYTES_PER_INT*8)) {\n\t\treturn nil, fmt.Errorf(\"Not enough bytes to encode digests. %d > %d\", len(digests), int(math.Pow(2, BYTES_PER_INT*8)))\n\t}\n\n\tif err := writeStringArr(w, digests); err != nil {\n\t\treturn nil, err\n\t}\n\n\tdigestTable := make(map[string]int, len(digests))\n\tfor idx, d := range digests {\n\t\tdigestTable[d] = idx\n\t}\n\n\treturn digestTable, nil\n}", "title": "" }, { "docid": "85731f7317202ac9cc31d7bb903a6798", "score": "0.43653756", "text": "func XAPITrackersByOrgID(db XODB, orgID sql.NullInt64) ([]*XAPITracker, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT ` +\n\t\t`id, user_email, user_device_id, lat_coord, long_coord, api_name, request_body, error_message, status_cd, org_id, created_at, updated_at ` +\n\t\t`FROM x_showroom.x_api_tracker ` +\n\t\t`WHERE org_id = ?`\n\n\t// run query\n\tXOLog(sqlstr, orgID)\n\tq, err := db.Query(sqlstr, orgID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer q.Close()\n\n\t// load results\n\tres := []*XAPITracker{}\n\tfor q.Next() {\n\t\txapit := XAPITracker{\n\t\t\t_exists: true,\n\t\t}\n\n\t\t// scan\n\t\terr = q.Scan(&xapit.ID, &xapit.UserEmail, &xapit.UserDeviceID, &xapit.LatCoord, &xapit.LongCoord, &xapit.APIName, &xapit.RequestBody, &xapit.ErrorMessage, &xapit.StatusCd, &xapit.OrgID, &xapit.CreatedAt, &xapit.UpdatedAt)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tres = append(res, &xapit)\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "b3c8e0d3044198dcb37afa10cfe2903a", "score": "0.4356097", "text": "func (_ITellor *ITellorSession) GetMinersByRequestIdAndTimestamp(_requestId *big.Int, _timestamp *big.Int) ([5]common.Address, error) {\n\treturn _ITellor.Contract.GetMinersByRequestIdAndTimestamp(&_ITellor.CallOpts, _requestId, _timestamp)\n}", "title": "" }, { "docid": "7acbc06b7ab9f670b8810d0b42439e23", "score": "0.4350809", "text": "func (_TellorGetters *TellorGettersSession) RequestIdByQueryHash(arg0 [32]byte) (*big.Int, error) {\n\treturn _TellorGetters.Contract.RequestIdByQueryHash(&_TellorGetters.CallOpts, arg0)\n}", "title": "" }, { "docid": "3c48688b4e54ef1ae917247b2a2ff92a", "score": "0.4348209", "text": "func GetOrdersBySignalID(c *gin.Context) {\n\tif err := store.Connect(); err != nil {\n\t\tc.String(http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\tdefer store.Disconnect()\n\n\tfield := c.DefaultQuery(\"field\", \"\")\n\torderStr := c.DefaultQuery(\"order\", \"true\")\n\torder, err := strconv.ParseBool(orderStr)\n\tif err != nil {\n\t\tc.String(http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\n\tidStr := c.Query(\"signal_id\")\n\tid, err := strconv.Atoi(idStr)\n\tif err != nil {\n\t\tc.String(http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\n\torders, err := store.GetOrdersBySignalID(id, field, order)\n\tif err != nil {\n\t\tc.String(http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, orders)\n}", "title": "" }, { "docid": "8fb4e40d99823d78eedd05b7bd26b2ff", "score": "0.434814", "text": "func (_TellorGetters *TellorGettersCallerSession) RequestIdByQueryHash(arg0 [32]byte) (*big.Int, error) {\n\treturn _TellorGetters.Contract.RequestIdByQueryHash(&_TellorGetters.CallOpts, arg0)\n}", "title": "" }, { "docid": "6e9b1087b873205b1069faa606f1af0e", "score": "0.4348022", "text": "func (e *esearch) GetTxsByTxIds(symbol string, txIds []string, include blocc.TxInclude) ([]*blocc.Tx, error) {\n\n\te.throttleSearches <- struct{}{}\n\tdefer func() {\n\t\t<-e.throttleSearches\n\t}()\n\n\tindex := e.indexName(IndexTypeTx, symbol)\n\tquery := e.client.MultiGet()\n\tfsc := txFetchSourceContext(include)\n\n\t// Add all the ids\n\tfor _, txId := range txIds {\n\t\tquery.Add(elastic.NewMultiGetItem().Index(index).Type(DocType).Id(txId).FetchSource(fsc))\n\t}\n\n\tres, err := query.Do(e.ctx)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Could not get block: %v\", err)\n\t}\n\n\ttxs := make([]*blocc.Tx, 0)\n\n\tfor _, doc := range res.Docs {\n\t\tif doc.Source == nil {\n\t\t\tcontinue\n\t\t}\n\t\tt := new(blocc.Tx)\n\t\terr = json.Unmarshal(*doc.Source, t)\n\t\ttxs = append(txs, t)\n\t}\n\n\treturn txs, err\n\n}", "title": "" }, { "docid": "242362732e0865046b5227d57c00920e", "score": "0.4346327", "text": "func (s *Server) TrackRequest(w http.ResponseWriter, r *http.Request, samlRequestID string) (string, error) {\n\tsrc := make([]byte, 29)\n\tif _, err := rand.Read(src); err != nil {\n\t\treturn \"\", err\n\t}\n\n\tdst := make([]byte, ascii85.MaxEncodedLen(len(src)))\n\tascii85.Encode(dst, src)\n\n\tindex := string(dst)\n\trequest := samlsp.TrackedRequest{\n\t\tIndex: index,\n\t\tSAMLRequestID: samlRequestID,\n\t\tURI: r.URL.String(),\n\t}\n\n\tctx := r.Context()\n\trequests, ok := s.relaystate.Get(ctx, trackedRequestsKey).([]samlsp.TrackedRequest)\n\tswitch {\n\tcase ok && len(requests) < trackedRequestsLimit:\n\t\trequests = append(requests, request)\n\tcase ok:\n\t\tcopy(requests, requests[1:])\n\t\trequests[len(requests)-1] = request\n\tdefault:\n\t\trequests = []samlsp.TrackedRequest{request}\n\t}\n\ts.relaystate.Put(ctx, trackedRequestsKey, requests)\n\n\treturn index, nil\n}", "title": "" }, { "docid": "fa6a5d2c24846beeab8b9b6d8b21dfed", "score": "0.43364242", "text": "func ReqID() string {\n\treturn Default.config.TraceReqID\n}", "title": "" }, { "docid": "a4e6adfe55b9f54710f510760649c977", "score": "0.43353546", "text": "func (f *Fetch) requestHashBatchFromPeers() {\n\tvar requestList []requestMessage\n\tf.activeReqM.Lock()\n\t// only send one request per hash\n\tfor hash, reqs := range f.activeRequests {\n\t\tf.log.With().Debug(\"batching hash request\", log.String(\"hash\", hash.ShortString()))\n\t\trequestList = append(requestList, requestMessage{Hash: hash, Hint: reqs[0].hint})\n\t\t// move the processed requests to pending\n\t\tf.pendingRequests[hash] = append(f.pendingRequests[hash], reqs...)\n\t\tdelete(f.activeRequests, hash)\n\t}\n\tf.activeReqM.Unlock()\n\n\t// send in batches\n\tfor i := 0; i < len(requestList); i += f.cfg.BatchSize {\n\t\tj := i + f.cfg.BatchSize\n\t\tif j > len(requestList) {\n\t\t\tj = len(requestList)\n\t\t}\n\t\tf.sendBatch(requestList[i:j])\n\t}\n}", "title": "" }, { "docid": "0c8f64ba3be170f2c2494e3cb5288759", "score": "0.43298417", "text": "func (m *AppliesToRequestBuilder) GetByIds()(*i5fcc1cbba281bf089e86d1f0fd053b72254efdc576b56f07f5f474773e8f4e0b.GetByIdsRequestBuilder) {\n return i5fcc1cbba281bf089e86d1f0fd053b72254efdc576b56f07f5f474773e8f4e0b.NewGetByIdsRequestBuilderInternal(m.pathParameters, m.requestAdapter);\n}", "title": "" }, { "docid": "84f18794efad919ca055d2f3f798890b", "score": "0.4299637", "text": "func (_ZapGetters *ZapGettersCallerSession) GetMinersByRequestIdAndTimestamp(_requestId *big.Int, _timestamp *big.Int) ([5]common.Address, error) {\r\n\treturn _ZapGetters.Contract.GetMinersByRequestIdAndTimestamp(&_ZapGetters.CallOpts, _requestId, _timestamp)\r\n}", "title": "" }, { "docid": "104490eb35165b8b604161aa9dc29b68", "score": "0.42985165", "text": "func (_TellorTransfer *TellorTransferCaller) RequestIdByQueryHash(opts *bind.CallOpts, arg0 [32]byte) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _TellorTransfer.contract.Call(opts, &out, \"requestIdByQueryHash\", arg0)\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": "4b1a35cca8b066abd5ee90c0f9e47958", "score": "0.42956004", "text": "func SchedulerEntriesKey(schedulerID string) string {\n\treturn fmt.Sprintf(\"asynq:schedulers:{%s}\", schedulerID)\n}", "title": "" }, { "docid": "eddda62a64434c89be41b2ce2e9dafdd", "score": "0.42870274", "text": "func (_ZapGetters *ZapGettersSession) GetMinersByRequestIdAndTimestamp(_requestId *big.Int, _timestamp *big.Int) ([5]common.Address, error) {\r\n\treturn _ZapGetters.Contract.GetMinersByRequestIdAndTimestamp(&_ZapGetters.CallOpts, _requestId, _timestamp)\r\n}", "title": "" }, { "docid": "2cad5b5a05fc493a7eb435e0bb7aa9c0", "score": "0.42833686", "text": "func (_ZapMaster *ZapMasterCaller) GetMinersByRequestIdAndTimestamp(opts *bind.CallOpts, _requestId *big.Int, _timestamp *big.Int) ([5]common.Address, error) {\r\n\tvar (\r\n\t\tret0 = new([5]common.Address)\r\n\t)\r\n\tout := ret0\r\n\terr := _ZapMaster.contract.Call(opts, out, \"getMinersByRequestIdAndTimestamp\", _requestId, _timestamp)\r\n\treturn *ret0, err\r\n}", "title": "" }, { "docid": "ba517bbf13c07950c5b810d330e782e0", "score": "0.42831597", "text": "func GenTracesFromTraces(parantes []*fact.Trace, added int) []*fact.Trace {\n\tenvs := genStringSlice(10)\n\ttags := genStringSlice(10)\n\n\tresults := make([]*fact.Trace, 0)\n\tresults = append(results, parantes...)\n\n\tfor i := 0; i < added; i++ {\n\t\tparent := parantes[random.Intn(len(parantes))]\n\t\tstart := parent.StartTime.AsTime().Add(10 * time.Minute)\n\t\tresults = append(results, GenTrace(parent.ID, start, envs, tags))\n\t}\n\n\treturn results\n}", "title": "" }, { "docid": "caa84f3d349a8b8c9c918b45d9611ba4", "score": "0.42763928", "text": "func (u *UserRequestsCtxImpl) GetTraceID() TraceID { return u.traceID }", "title": "" }, { "docid": "155862374faa063245a1ce32bb64c1dd", "score": "0.4276136", "text": "func (cli *requestCli) FetchRequestsByNodes(nodes []models.Node) []*models.Request {\n\tsize := len(nodes)\n\tif size == 0 {\n\t\treturn nil\n\t}\n\tresult := make(map[string][]*models.Request)\n\tvar wait sync.WaitGroup\n\twait.Add(size)\n\tfor idx := range nodes {\n\t\ti := idx\n\t\tgo func() {\n\t\t\tdefer wait.Done()\n\t\t\tnode := nodes[i]\n\t\t\taddress := node.HTTPAddress()\n\t\t\tvar stats []*models.Request\n\t\t\t_, err := resty.New().R().\n\t\t\t\tSetHeader(\"Accept\", \"application/json\").\n\t\t\t\tSetResult(&stats).\n\t\t\t\tGet(address + constants.APIVersion1CliPath + \"/state/requests\")\n\t\t\tif err != nil {\n\t\t\t\tcli.logger.Error(\"get current alive reuqests from alive node\", logger.String(\"url\", address), logger.Error(err))\n\t\t\t\treturn\n\t\t\t}\n\t\t\tresult[node.Indicator()] = stats\n\t\t}()\n\t}\n\twait.Wait()\n\n\t// build result set sort by request start time\n\tvar rs []*models.Request\n\tfor k, v := range result {\n\t\tfor _, req := range v {\n\t\t\treq.Entry = k\n\t\t\trs = append(rs, req)\n\t\t}\n\t}\n\n\tsort.Slice(rs, func(i, j int) bool {\n\t\treturn rs[i].Start < rs[j].Start\n\t})\n\treturn rs\n}", "title": "" }, { "docid": "254c4ce16211e42123d5f9bd8da8c96a", "score": "0.42704436", "text": "func GetTripIDsByUserIDHandler(w http.ResponseWriter, r *http.Request) {\n\tparams := mux.Vars(r)\n\n\tuserID, err := uuid.FromString(params[\"id\"])\n\tif err != nil {\n\t\tcommon.SendBadRequest(w, r, \"ERROR: Wrong userID\", err)\n\t\treturn\n\t}\n\titemOwner, err := model.GetUserByID(userID)\n\tsessionID, err := auth.GetSessionIDFromRequest(w, r)\n\tif err != nil {\n\t\treturn\n\t}\n\tif auth.CheckPermission(sessionID, auth.Owner, itemOwner.Login) == false {\n\t\tcommon.SendError(w, r, http.StatusForbidden, auth.NotOwnerResponse, nil)\n\t\treturn\n\t}\n\n\tresult, err := model.GetTripIDsByUserID(userID)\n\tif err != nil {\n\t\tcommon.SendBadRequest(w, r, \"ERROR: Can't get this trip\", err)\n\t\treturn\n\t}\n\n\tcommon.RenderJSON(w, r, result)\n}", "title": "" }, { "docid": "c06e20da2a65e179fba980e021aea3e7", "score": "0.4270208", "text": "func (_ZapGetters *ZapGettersCaller) GetMinersByRequestIdAndTimestamp(opts *bind.CallOpts, _requestId *big.Int, _timestamp *big.Int) ([5]common.Address, error) {\r\n\tvar (\r\n\t\tret0 = new([5]common.Address)\r\n\t)\r\n\tout := ret0\r\n\terr := _ZapGetters.contract.Call(opts, out, \"getMinersByRequestIdAndTimestamp\", _requestId, _timestamp)\r\n\treturn *ret0, err\r\n}", "title": "" }, { "docid": "985ab88d40d9802b463b7d1c764eba5a", "score": "0.42693862", "text": "func (_Tellor *TellorCallerSession) RequestIdByQueryHash(arg0 [32]byte) (*big.Int, error) {\n\treturn _Tellor.Contract.RequestIdByQueryHash(&_Tellor.CallOpts, arg0)\n}", "title": "" }, { "docid": "c8dac141c74793549b102f829ede311b", "score": "0.42671138", "text": "func (c *setOfSpotRequests) add(s *spotRequest) *setOfSpotRequests {\n\tc.keyMap[s.SpotRequestID] = s\n\treturn c\n}", "title": "" }, { "docid": "e68e918ca7d46ea3b3246a80a7a0d4fa", "score": "0.42665648", "text": "func (b *BigTableTraceStore) tileKeys(ctx context.Context, tileKey TileKey) (<-chan string, <-chan error) {\n\tout := make(chan string)\n\terrCh := make(chan error)\n\tvar g errgroup.Group\n\n\ttctx := context.Background()\n\n\tgo func() {\n\t\tdefer close(out)\n\t\tdefer close(errCh)\n\t\t// Spawn one Go routine for each shard.\n\t\tfor i := int32(0); i < b.shards; i++ {\n\t\t\ti := i\n\t\t\tg.Go(func() error {\n\t\t\t\treturn b.getTable().ReadRows(tctx, bigtable.PrefixRange(tileKey.TraceRowPrefix(i)), func(row bigtable.Row) bool {\n\t\t\t\t\tparts := strings.Split(row.Key(), \":\")\n\t\t\t\t\tb := &strings.Builder{}\n\t\t\t\t\tb.WriteString(parts[2])\n\t\t\t\t\tout <- b.String()\n\t\t\t\t\treturn true\n\t\t\t\t}, bigtable.RowFilter(\n\t\t\t\t\tbigtable.ChainFilters(\n\t\t\t\t\t\tbigtable.LatestNFilter(1),\n\t\t\t\t\t\tbigtable.FamilyFilter(VALUES_FAMILY),\n\t\t\t\t\t\tbigtable.CellsPerRowLimitFilter(1),\n\t\t\t\t\t\tbigtable.StripValueFilter(),\n\t\t\t\t\t)))\n\t\t\t})\n\t\t}\n\t\tif err := g.Wait(); err != nil {\n\t\t\terrCh <- skerr.Wrapf(err, \"Failed to query.\")\n\t\t}\n\t}()\n\treturn out, errCh\n}", "title": "" }, { "docid": "ec687db675fae53ec300593235bc0609", "score": "0.42584625", "text": "func (_ZapMaster *ZapMasterCallerSession) GetMinersByRequestIdAndTimestamp(_requestId *big.Int, _timestamp *big.Int) ([5]common.Address, error) {\r\n\treturn _ZapMaster.Contract.GetMinersByRequestIdAndTimestamp(&_ZapMaster.CallOpts, _requestId, _timestamp)\r\n}", "title": "" }, { "docid": "12d6ca3119e94f8507f1a00089d3a465", "score": "0.42508614", "text": "func (o *GetTransactionFundingrequestsRequest) 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.FilterAdmissionStatus != nil {\n\n\t\t// query param filter[admission.status]\n\t\tvar qrFilterAdmissionStatus string\n\t\tif o.FilterAdmissionStatus != nil {\n\t\t\tqrFilterAdmissionStatus = *o.FilterAdmissionStatus\n\t\t}\n\t\tqFilterAdmissionStatus := qrFilterAdmissionStatus\n\t\tif qFilterAdmissionStatus != \"\" {\n\t\t\tif err := r.SetQueryParam(\"filter[admission.status]\", qFilterAdmissionStatus); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.FilterAmount != nil {\n\n\t\t// query param filter[amount]\n\t\tvar qrFilterAmount string\n\t\tif o.FilterAmount != nil {\n\t\t\tqrFilterAmount = *o.FilterAmount\n\t\t}\n\t\tqFilterAmount := qrFilterAmount\n\t\tif qFilterAmount != \"\" {\n\t\t\tif err := r.SetQueryParam(\"filter[amount]\", qFilterAmount); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.FilterCurrency != nil {\n\n\t\t// query param filter[currency]\n\t\tvar qrFilterCurrency string\n\t\tif o.FilterCurrency != nil {\n\t\t\tqrFilterCurrency = *o.FilterCurrency\n\t\t}\n\t\tqFilterCurrency := qrFilterCurrency\n\t\tif qFilterCurrency != \"\" {\n\t\t\tif err := r.SetQueryParam(\"filter[currency]\", qFilterCurrency); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.FilterCutoffDatetimeFrom != nil {\n\n\t\t// query param filter[cutoff_datetime_from]\n\t\tvar qrFilterCutoffDatetimeFrom strfmt.DateTime\n\t\tif o.FilterCutoffDatetimeFrom != nil {\n\t\t\tqrFilterCutoffDatetimeFrom = *o.FilterCutoffDatetimeFrom\n\t\t}\n\t\tqFilterCutoffDatetimeFrom := qrFilterCutoffDatetimeFrom.String()\n\t\tif qFilterCutoffDatetimeFrom != \"\" {\n\t\t\tif err := r.SetQueryParam(\"filter[cutoff_datetime_from]\", qFilterCutoffDatetimeFrom); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.FilterCutoffDatetimeTo != nil {\n\n\t\t// query param filter[cutoff_datetime_to]\n\t\tvar qrFilterCutoffDatetimeTo strfmt.DateTime\n\t\tif o.FilterCutoffDatetimeTo != nil {\n\t\t\tqrFilterCutoffDatetimeTo = *o.FilterCutoffDatetimeTo\n\t\t}\n\t\tqFilterCutoffDatetimeTo := qrFilterCutoffDatetimeTo.String()\n\t\tif qFilterCutoffDatetimeTo != \"\" {\n\t\t\tif err := r.SetQueryParam(\"filter[cutoff_datetime_to]\", qFilterCutoffDatetimeTo); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.FilterFundingEntity != nil {\n\n\t\t// query param filter[funding_entity]\n\t\tvar qrFilterFundingEntity string\n\t\tif o.FilterFundingEntity != nil {\n\t\t\tqrFilterFundingEntity = *o.FilterFundingEntity\n\t\t}\n\t\tqFilterFundingEntity := qrFilterFundingEntity\n\t\tif qFilterFundingEntity != \"\" {\n\t\t\tif err := r.SetQueryParam(\"filter[funding_entity]\", qFilterFundingEntity); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.FilterFundingRequestType != nil {\n\n\t\t// query param filter[funding_request_type]\n\t\tvar qrFilterFundingRequestType string\n\t\tif o.FilterFundingRequestType != nil {\n\t\t\tqrFilterFundingRequestType = *o.FilterFundingRequestType\n\t\t}\n\t\tqFilterFundingRequestType := qrFilterFundingRequestType\n\t\tif qFilterFundingRequestType != \"\" {\n\t\t\tif err := r.SetQueryParam(\"filter[funding_request_type]\", qFilterFundingRequestType); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.FilterFxDealID != nil {\n\n\t\t// query param filter[fx_deal.id]\n\t\tvar qrFilterFxDealID strfmt.UUID\n\t\tif o.FilterFxDealID != nil {\n\t\t\tqrFilterFxDealID = *o.FilterFxDealID\n\t\t}\n\t\tqFilterFxDealID := qrFilterFxDealID.String()\n\t\tif qFilterFxDealID != \"\" {\n\t\t\tif err := r.SetQueryParam(\"filter[fx_deal.id]\", qFilterFxDealID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tvar valuesFilterOrganisationID []string\n\tfor _, v := range o.FilterOrganisationID {\n\t\tvaluesFilterOrganisationID = append(valuesFilterOrganisationID, v.String())\n\t}\n\n\tjoinedFilterOrganisationID := swag.JoinByFormat(valuesFilterOrganisationID, \"\")\n\t// query array param filter[organisation_id]\n\tif err := r.SetQueryParam(\"filter[organisation_id]\", joinedFilterOrganisationID...); err != nil {\n\t\treturn err\n\t}\n\n\tif o.FilterPartyID != nil {\n\n\t\t// query param filter[party.id]\n\t\tvar qrFilterPartyID strfmt.UUID\n\t\tif o.FilterPartyID != nil {\n\t\t\tqrFilterPartyID = *o.FilterPartyID\n\t\t}\n\t\tqFilterPartyID := qrFilterPartyID.String()\n\t\tif qFilterPartyID != \"\" {\n\t\t\tif err := r.SetQueryParam(\"filter[party.id]\", qFilterPartyID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.FilterReference != nil {\n\n\t\t// query param filter[reference]\n\t\tvar qrFilterReference string\n\t\tif o.FilterReference != nil {\n\t\t\tqrFilterReference = *o.FilterReference\n\t\t}\n\t\tqFilterReference := qrFilterReference\n\t\tif qFilterReference != \"\" {\n\t\t\tif err := r.SetQueryParam(\"filter[reference]\", qFilterReference); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.FilterTargetCurrency != nil {\n\n\t\t// query param filter[target.currency]\n\t\tvar qrFilterTargetCurrency string\n\t\tif o.FilterTargetCurrency != nil {\n\t\t\tqrFilterTargetCurrency = *o.FilterTargetCurrency\n\t\t}\n\t\tqFilterTargetCurrency := qrFilterTargetCurrency\n\t\tif qFilterTargetCurrency != \"\" {\n\t\t\tif err := r.SetQueryParam(\"filter[target.currency]\", qFilterTargetCurrency); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.PageNumber != nil {\n\n\t\t// query param page[number]\n\t\tvar qrPageNumber string\n\t\tif o.PageNumber != nil {\n\t\t\tqrPageNumber = *o.PageNumber\n\t\t}\n\t\tqPageNumber := qrPageNumber\n\t\tif qPageNumber != \"\" {\n\t\t\tif err := r.SetQueryParam(\"page[number]\", qPageNumber); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.PageSize != nil {\n\n\t\t// query param page[size]\n\t\tvar qrPageSize int64\n\t\tif o.PageSize != nil {\n\t\t\tqrPageSize = *o.PageSize\n\t\t}\n\t\tqPageSize := swag.FormatInt64(qrPageSize)\n\t\tif qPageSize != \"\" {\n\t\t\tif err := r.SetQueryParam(\"page[size]\", qPageSize); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d7fa38fdb592390720861dd100a6a87c", "score": "0.42503214", "text": "func (_TellorStake *TellorStakeCallerSession) RequestIdByQueryHash(arg0 [32]byte) (*big.Int, error) {\n\treturn _TellorStake.Contract.RequestIdByQueryHash(&_TellorStake.CallOpts, arg0)\n}", "title": "" }, { "docid": "3eba872b4918e90688eda39e8b6898bf", "score": "0.42477867", "text": "func (_ITellor *ITellorCaller) GetMinersByRequestIdAndTimestamp(opts *bind.CallOpts, _requestId *big.Int, _timestamp *big.Int) ([5]common.Address, error) {\n\tvar out []interface{}\n\terr := _ITellor.contract.Call(opts, &out, \"getMinersByRequestIdAndTimestamp\", _requestId, _timestamp)\n\n\tif err != nil {\n\t\treturn *new([5]common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new([5]common.Address)).(*[5]common.Address)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "4934509b81c32fa7384ac2e523e6e90d", "score": "0.42475864", "text": "func (client *LogAnalyticsClient) exportThrottledRequestsCreateRequest(ctx context.Context, location string, parameters ThrottledRequestsInput, options *LogAnalyticsBeginExportThrottledRequestsOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests\"\n\tif location == \"\" {\n\t\treturn nil, errors.New(\"parameter location cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{location}\", url.PathEscape(location))\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.MethodPost, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-07-01\")\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": "1d79788977c612af2afab57410d525e0", "score": "0.42444816", "text": "func updateSnapshotReqs(reqs []*SnapshotRequest, newExport *ExportCache) []*SnapshotRequest {\n\tvar pendingReqs []*SnapshotRequest\n\tfor _, req := range reqs {\n\t\tif req.targetChunkIds[newExport.chunkId] && req.collectedSnapshot[newExport.chunkId] == nil {\n\t\t\tif newExport.timestamp == req.timestamp {\n\t\t\t\treq.collectedSnapshot[newExport.chunkId] = &api.ChunkSnapshot{\n\t\t\t\t\tGrains: newExport.head.ChunkGrains,\n\t\t\t\t}\n\t\t\t} else if newExport.timestamp > req.timestamp {\n\t\t\t\tlog.Printf(\"Somehow missed capturing snapshot of chunk %s @ %d (already @ %d)\",\n\t\t\t\t\tnewExport.chunkId, req.timestamp, newExport.timestamp)\n\t\t\t}\n\t\t}\n\n\t\tif len(req.targetChunkIds) == len(req.collectedSnapshot) {\n\t\t\tlog.Printf(\"SnapshotRequest resolved (ids=%#v@t=%d)\", req.targetChunkIds, req.timestamp)\n\t\t\treq.receiver <- &api.SnapshotS{\n\t\t\t\tTimestamp: req.timestamp,\n\t\t\t\tSnapshot: req.collectedSnapshot,\n\t\t\t}\n\t\t} else {\n\t\t\tpendingReqs = append(pendingReqs, req)\n\t\t}\n\t}\n\treturn pendingReqs\n}", "title": "" }, { "docid": "85f87fed31e2f78980bbfc1722968434", "score": "0.42434594", "text": "func getRequestIDHandler(fieldKey, headerName string) func(next http.Handler) http.Handler {\n\treturn func(next http.Handler) http.Handler {\n\t\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\trequestID := getRequestID(r)\n\t\t\tctx := r.Context()\n\t\t\tlog := zerolog.Ctx(ctx)\n\t\t\tif len(fieldKey) > 0 {\n\t\t\t\tlog.UpdateContext(func(c zerolog.Context) zerolog.Context {\n\t\t\t\t\treturn c.Str(fieldKey, requestID)\n\t\t\t\t})\n\t\t\t}\n\t\t\tif len(headerName) > 0 {\n\t\t\t\tw.Header().Set(headerName, requestID)\n\t\t\t}\n\t\t\tnext.ServeHTTP(w, r)\n\t\t})\n\t}\n}", "title": "" }, { "docid": "3a44695426fb55afb4462f8a2eec626a", "score": "0.4238027", "text": "func (_TellorStake *TellorStakeSession) RequestIdByQueryHash(arg0 [32]byte) (*big.Int, error) {\n\treturn _TellorStake.Contract.RequestIdByQueryHash(&_TellorStake.CallOpts, arg0)\n}", "title": "" }, { "docid": "6b8fe2420907bc79430086c4f07fa0db", "score": "0.42342433", "text": "func (_ZapMaster *ZapMasterSession) GetMinersByRequestIdAndTimestamp(_requestId *big.Int, _timestamp *big.Int) ([5]common.Address, error) {\r\n\treturn _ZapMaster.Contract.GetMinersByRequestIdAndTimestamp(&_ZapMaster.CallOpts, _requestId, _timestamp)\r\n}", "title": "" }, { "docid": "958e70ae299b11f0f8cb605dc0a84e77", "score": "0.42338657", "text": "func (a *API) RequestsCreate(r *gin.Context) {\n\tvar input struct {\n\t\tReports []types.ExtendedUUID `json:\"reports\"`\n\t}\n\tif err := r.BindJSON(&input); err != nil {\n\t\tr.AbortWithStatusJSON(http.StatusBadRequest, gin.H{\n\t\t\t\"error\": \"Invalid input: \" + err.Error(),\n\t\t})\n\t\treturn\n\t}\n\n\ttx, err := a.DB.Begin()\n\tif err != nil {\n\t\tr.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{\n\t\t\t\"error\": err.Error(),\n\t\t})\n\t\treturn\n\t}\n\tdefer tx.Rollback()\n\n\tstatus := models.RequestStatus(\"Open\")\n\n\titem := &models.Request{\n\t\tAccountID: r.MustGet(\"account\").(*models.Account).ID,\n\t\tStatus: &status,\n\t}\n\tif err := models.CreateRequest(r, tx, item); err != nil {\n\t\tr.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{\n\t\t\t\"error\": \"Unable to save the request\",\n\t\t})\n\t\treturn\n\t}\n\n\tfor _, id := range input.Reports {\n\t\treport, err := models.GetReport(r, tx, id)\n\t\tif err != nil {\n\t\t\tr.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{\n\t\t\t\t\"error\": \"Unable to fetch the report: \" + err.Error(),\n\t\t\t})\n\t\t\treturn\n\t\t}\n\n\t\tlesion, err := models.GetLesion(r, tx, report.LesionID)\n\t\tif err != nil {\n\t\t\tr.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{\n\t\t\t\t\"error\": \"Unable to fetch the lesion: \" + err.Error(),\n\t\t\t})\n\t\t\treturn\n\t\t}\n\n\t\tif lesion.AccountID.Bytes != item.AccountID.Bytes {\n\t\t\tr.AbortWithStatusJSON(http.StatusBadRequest, gin.H{\n\t\t\t\t\"error\": \"Every report in the update has to belong to the user\",\n\t\t\t})\n\t\t\treturn\n\t\t}\n\n\t\treport.RequestID = item.ID\n\t\treport.Status = types.StringToText(\"Submitted\")\n\t\tif err := models.UpdateReport(r, tx, report); err != nil {\n\t\t\tr.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{\n\t\t\t\t\"error\": \"Unable to save a report\",\n\t\t\t})\n\t\t\treturn\n\t\t}\n\t}\n\n\tif err := tx.Commit(); err != nil {\n\t\tr.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{\n\t\t\t\"error\": \"Unable to complete the transaction\",\n\t\t})\n\t}\n\n\tr.JSON(http.StatusCreated, item)\n}", "title": "" }, { "docid": "ca332c6ffdc307accf0dbad771917bd8", "score": "0.42337835", "text": "func (_TellorStake *TellorStakeCaller) RequestIdByQueryHash(opts *bind.CallOpts, arg0 [32]byte) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _TellorStake.contract.Call(opts, &out, \"requestIdByQueryHash\", arg0)\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": "fdf446ed065dd023140b92fd049dccae", "score": "0.4225077", "text": "func (_Tellor *TellorSession) RequestIdByQueryHash(arg0 [32]byte) (*big.Int, error) {\n\treturn _Tellor.Contract.RequestIdByQueryHash(&_Tellor.CallOpts, arg0)\n}", "title": "" }, { "docid": "fef5533109b4d0fd2b77975b3da048d2", "score": "0.4221326", "text": "func handleKeys() {\n // Assume first key is ID 1\n new_id := uint64(1)\n\n // Loop forever\n for {\n select { // Block until any one of these threads has a message\n // See DelKey\n case id := <- del:\n delete(keyChain, id)\n\n // See AddKey\n case k := <- add:\n keyChain[k.Id] = &k\n\n // See GetKey\n case transport := <- get:\n if val, ok := keyChain[transport.Id]; ok {\n transport.Result <- *val\n } else {\n close(transport.Result)\n }\n\n // See GetList\n case transport := <- getList:\n // Declare a list with static size\n list := make([]uint64, len(keyChain))\n // Iterate through all \n i:=0\n for id := range keyChain {\n list[i] = id\n i++\n }\n transport <- list\n\n // See getUID\n // Generate a new, unique ID\n // Maybe it should be more difficult to predict\n case getId <- new_id:\n new_id = new_id+1\n }\n }\n}", "title": "" }, { "docid": "1e0bcb64bf985b2f1a32a5925221db4d", "score": "0.422111", "text": "func GetAllAuditRequest() ([]*AuditRequest, error) {\n\tvar results []*AuditRequest\n\n\tquery := NewQuery(AuditRequestKind, []*Filter{}, 10, 1, \"-Created\")\n\n\tkeys, err := DS.GetAll(query, &results)\n\n\tfor i, key := range keys {\n\t\tresults[i].SetID(key)\n\t}\n\n\treturn results, err\n}", "title": "" }, { "docid": "de9dcada2b7ca518a683e2783e9e9b83", "score": "0.42175543", "text": "func recordsByScopeUUID(cmd *cobra.Command, scopeUUID string) error {\n\tclientCtx, err := client.GetClientQueryContext(cmd)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tqueryClient := types.NewQueryClient(clientCtx)\n\tres, err := queryClient.Scope(context.Background(), &types.ScopeRequest{ScopeUuid: scopeUUID})\n\tif err != nil {\n\t\treturn err\n\t}\n\tif res == nil || res.Records == nil || len(res.Records) == 0 {\n\t\treturn fmt.Errorf(\"no records found for scope uuid %s\", scopeUUID)\n\t}\n\n\tprotoList := make([]proto.Message, len(res.Records))\n\tfor i, record := range res.Records {\n\t\tif record != nil {\n\t\t\tprotoList[i] = record\n\t\t} else {\n\t\t\tprotoList[i] = &types.Record{}\n\t\t}\n\t}\n\treturn printProtoList(clientCtx, protoList)\n}", "title": "" }, { "docid": "aed2197291d86523479a7b69240c934b", "score": "0.4210371", "text": "func (s *SQLTraceStore) QueryTracesIDOnly(ctx context.Context, tileNumber types.TileNumber, q *query.Query) (<-chan paramtools.Params, error) {\n\tctx, span := trace.StartSpan(ctx, \"sqltracestore.QueryTracesIDOnly\")\n\tdefer span.End()\n\n\tdefer timer.New(\"QueryTracesIDOnlyByIndex\").Stop()\n\toutParams := make(chan paramtools.Params, queryTracesIDOnlyByIndexChannelSize)\n\tif q.Empty() {\n\t\tclose(outParams)\n\t\treturn outParams, skerr.Fmt(\"Can't run QueryTracesIDOnlyByIndex for the empty query.\")\n\t}\n\n\tps, err := s.GetParamSet(ctx, tileNumber)\n\tif err != nil {\n\t\tclose(outParams)\n\t\treturn outParams, skerr.Wrap(err)\n\t}\n\n\tplan, err := q.QueryPlan(ps)\n\tif err != nil {\n\t\t// Not an error, we just won't match anything in this tile.\n\t\t//\n\t\t// The plan may be invalid because it is querying with keys or values\n\t\t// that don't appear in a tile, which means the query won't work on this\n\t\t// tile, but it may still work on other tiles, so we just don't return\n\t\t// any results for this tile.\n\t\tclose(outParams)\n\t\treturn outParams, nil\n\t}\n\tif len(plan) == 0 {\n\t\t// We won't match anything in this tile.\n\t\tclose(outParams)\n\t\treturn outParams, nil\n\t}\n\n\t// Sanitize our inputs.\n\tif err := query.ValidateParamSet(plan); err != nil {\n\t\treturn nil, skerr.Wrapf(err, \"invalid query %#v\", *q)\n\t}\n\n\t// Do a quick pre-flight to find if we can add a \"AND trace_id IN (...)\"\n\t// clause to all query parts to speed them up.\n\ttraceIDRestriction, skipKey, planDisposition := s.restrictByCounting(ctx, tileNumber, plan)\n\tif planDisposition == skippable {\n\t\t// We know this query won't match any traces in this tile.\n\t\treturn outParams, nil\n\t}\n\n\t// This query is done in two parts because the CDB query planner seems to\n\t// pick a really bad plan a large percentage of the time.\n\n\t// First find the encoded trace ids that match the query. Break apart the\n\t// QueryPlan and do each group of OR's as individual queries to the\n\t// database, but then stream the results and do the ANDs here on the server.\n\t// That's because CDB complains about the amount of RAM that doing the AND\n\t// can require. For example, the query 'source_type=svg&sub_result=min_ms'\n\t// requires merging two lists that are both over 200k.\n\tunionChannels := []<-chan traceIDForSQL{}\n\ti := 0\n\tfor key, values := range plan {\n\t\t// If we are using a restrict clause then all the trace_ids for that key\n\t\t// are included all the other queries, so we can skip querying on that\n\t\t// key directly.\n\t\tif key == skipKey {\n\t\t\tcontinue\n\t\t}\n\t\tcontext := queryTraceIDsContext{\n\t\t\tTileNumber: tileNumber,\n\t\t\tKey: key,\n\t\t\tValues: values,\n\t\t\tAsOf: \"\",\n\t\t\tRestrictClause: traceIDRestriction,\n\t\t}\n\t\tif s.enableFollowerReads {\n\t\t\tcontext.AsOf = followerReadsStatement\n\t\t}\n\n\t\t// Expand the template for the SQL.\n\t\tvar b bytes.Buffer\n\t\tif err := s.unpreparedStatements[queryTraceIDs].Execute(&b, context); err != nil {\n\t\t\treturn nil, skerr.Wrapf(err, \"failed to expand queryTraceIDs template\")\n\t\t}\n\t\tsql := b.String()\n\t\trows, err := s.db.Query(ctx, sql)\n\t\tif err != nil {\n\t\t\treturn nil, skerr.Wrap(err)\n\t\t}\n\t\tch := make(chan traceIDForSQL)\n\t\tunionChannels = append(unionChannels, ch)\n\n\t\tgo func(ch chan traceIDForSQL, rows pgx.Rows) {\n\t\t\t_, span := trace.StartSpan(ctx, \"sqltracestore.QueryTracesIDOnly.PerKeyWorker\")\n\t\t\tdefer span.End()\n\n\t\t\tdefer close(ch)\n\n\t\t\tfor rows.Next() {\n\t\t\t\tvar traceIDAsBytes []byte\n\t\t\t\tif err := rows.Scan(&traceIDAsBytes); err != nil {\n\t\t\t\t\tsklog.Errorf(\"Failed to scan traceIDAsBytes: %s\", skerr.Wrap(err))\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tif err := rows.Err(); err != nil {\n\t\t\t\t\tif err == pgx.ErrNoRows {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\tsklog.Errorf(\"Failed while reading traceIDAsBytes: %s\", skerr.Wrap(err))\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tch <- traceIDForSQLFromTraceIDAsBytes(traceIDAsBytes)\n\t\t\t}\n\t\t}(ch, rows)\n\t\ti++\n\t}\n\n\t// Now AND together the results of all the unionChannels.\n\ttraceIDsCh := newIntersect(ctx, unionChannels)\n\n\t// And then convert the results of the AND into Params, which we sent out\n\t// the channel we'll return from this function.\n\tchunkChannel := make(chan []traceIDForSQL)\n\tgo func() {\n\t\tdefer close(outParams)\n\n\t\t// Start a pool of workers.\n\t\tg, ctx := errgroup.WithContext(ctx)\n\t\tfor i := 0; i < poolSize; i++ {\n\t\t\tg.Go(func() error {\n\t\t\t\tctx, span := trace.StartSpan(ctx, \"sqltracestore.QueryTracesIDOnly.convertToParamsWorker\")\n\t\t\t\tdefer span.End()\n\n\t\t\t\tfor chunk := range chunkChannel {\n\t\t\t\t\tif err := ctx.Err(); err != nil {\n\t\t\t\t\t\treturn skerr.Wrap(err)\n\t\t\t\t\t}\n\t\t\t\t\tif err := s.convertHexTraceIdsToParams(ctx, chunk, tileNumber, outParams); err != nil {\n\t\t\t\t\t\t// Drain the channel before returning the err.\n\t\t\t\t\t\tfor range chunkChannel {\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn skerr.Wrap(err)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn nil\n\t\t\t})\n\t\t}\n\n\t\t// Now feed the pool of workers chunks to resolve.\n\t\tcurrentChunk := []traceIDForSQL{}\n\t\tfor hexEncodedTraceID := range traceIDsCh {\n\t\t\tcurrentChunk = append(currentChunk, hexEncodedTraceID)\n\t\t\tif len(currentChunk) >= queryTraceIDsChunkSize {\n\t\t\t\tchunkChannel <- currentChunk\n\t\t\t\tcurrentChunk = []traceIDForSQL{}\n\t\t\t}\n\t\t}\n\t\t// Now handle any remaining values in the currentChunk.\n\t\tchunkChannel <- currentChunk\n\n\t\tclose(chunkChannel)\n\t\tif err := g.Wait(); err != nil {\n\t\t\tsklog.Error(err)\n\t\t}\n\t}()\n\n\treturn outParams, nil\n}", "title": "" }, { "docid": "495f89636253c63ca78227d6c792b308", "score": "0.42038646", "text": "func BuildKeys(limiter *config.Limiter, ctx *fasthttp.RequestCtx) [][]string {\n\tremoteIP := RemoteIP(limiter.IPLookups, ctx)\n\tpath := string(ctx.Path())\n\treqMethod := string(ctx.Method())\n\tsliceKeys := make([][]string, 0)\n\n\t// Don't BuildKeys if remoteIP is blank.\n\tif remoteIP == \"\" {\n\t\treturn sliceKeys\n\t}\n\n\tif limiter.Methods != nil && limiter.Headers != nil && limiter.BasicAuthUsers != nil {\n\t\t// Limit by HTTP methods and HTTP headers+values and Basic Auth credentials.\n\t\tif StringInSlice(limiter.Methods, reqMethod) {\n\t\t\tfor headerKey, headerValues := range limiter.Headers {\n\t\t\t\theaderLen := len(ctx.Request.Header.Peek(headerKey))\n\t\t\t\tif (headerValues == nil || len(headerValues) <= 0) && headerLen != 0 {\n\t\t\t\t\t// If header values are empty, rate-limit all request with headerKey.\n\t\t\t\t\tusername, _, ok := parseBasicAuth(string(ctx.Request.Header.Peek(\"Authorization\")))\n\t\t\t\t\tif ok && StringInSlice(limiter.BasicAuthUsers, username) {\n\t\t\t\t\t\tsliceKeys = append(sliceKeys, []string{remoteIP, path, reqMethod, headerKey, username})\n\t\t\t\t\t}\n\n\t\t\t\t} else if len(headerValues) > 0 && headerLen != 0 {\n\t\t\t\t\t// If header values are not empty, rate-limit all request with headerKey and headerValues.\n\t\t\t\t\tfor _, headerValue := range headerValues {\n\t\t\t\t\t\tusername, _, ok := parseBasicAuth(string(ctx.Request.Header.Peek(\"Authorization\")))\n\t\t\t\t\t\tif ok && StringInSlice(limiter.BasicAuthUsers, username) {\n\t\t\t\t\t\t\tsliceKeys = append(sliceKeys, []string{remoteIP, path, reqMethod, headerKey, headerValue, username})\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} else if limiter.Methods != nil && limiter.Headers != nil {\n\t\t// Limit by HTTP methods and HTTP headers+values.\n\t\tif StringInSlice(limiter.Methods, reqMethod) {\n\t\t\tfor headerKey, headerValues := range limiter.Headers {\n\t\t\t\theaderLen := len(ctx.Request.Header.Peek(headerKey))\n\t\t\t\tif (headerValues == nil || len(headerValues) <= 0) && headerLen != 0 {\n\t\t\t\t\t// If header values are empty, rate-limit all request with headerKey.\n\t\t\t\t\tsliceKeys = append(sliceKeys, []string{remoteIP, path, reqMethod, headerKey})\n\n\t\t\t\t} else if len(headerValues) > 0 && headerLen != 0 {\n\t\t\t\t\t// If header values are not empty, rate-limit all request with headerKey and headerValues.\n\t\t\t\t\tfor _, headerValue := range headerValues {\n\t\t\t\t\t\tsliceKeys = append(sliceKeys, []string{remoteIP, path, reqMethod, headerKey, headerValue})\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t} else if limiter.Methods != nil && limiter.BasicAuthUsers != nil {\n\t\t// Limit by HTTP methods and Basic Auth credentials.\n\t\tif StringInSlice(limiter.Methods, reqMethod) {\n\t\t\tusername, _, ok := parseBasicAuth(string(ctx.Request.Header.Peek(\"Authorization\")))\n\t\t\tif ok && StringInSlice(limiter.BasicAuthUsers, username) {\n\t\t\t\tsliceKeys = append(sliceKeys, []string{remoteIP, path, reqMethod, username})\n\t\t\t}\n\t\t}\n\n\t} else if limiter.Methods != nil {\n\t\t// Limit by HTTP methods.\n\t\tif StringInSlice(limiter.Methods, reqMethod) {\n\t\t\tsliceKeys = append(sliceKeys, []string{remoteIP, path, reqMethod})\n\t\t}\n\n\t} else if limiter.Headers != nil {\n\t\t// Limit by HTTP headers+values.\n\t\tfor headerKey, headerValues := range limiter.Headers {\n\t\t\theaderLen := len(ctx.Request.Header.Peek(headerKey))\n\t\t\tif (headerValues == nil || len(headerValues) <= 0) && headerLen != 0 {\n\t\t\t\t// If header values are empty, rate-limit all request with headerKey.\n\t\t\t\tsliceKeys = append(sliceKeys, []string{remoteIP, path, headerKey})\n\n\t\t\t} else if len(headerValues) > 0 && headerLen != 0 {\n\t\t\t\t// If header values are not empty, rate-limit all request with headerKey and headerValues.\n\t\t\t\tfor _, headerValue := range headerValues {\n\t\t\t\t\tsliceKeys = append(sliceKeys, []string{remoteIP, path, headerKey, headerValue})\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t} else if limiter.BasicAuthUsers != nil {\n\t\t// Limit by Basic Auth credentials.\n\t\tusername, _, ok := parseBasicAuth(string(ctx.Request.Header.Peek(\"Authorization\")))\n\t\tif ok && StringInSlice(limiter.BasicAuthUsers, username) {\n\t\t\tsliceKeys = append(sliceKeys, []string{remoteIP, path, username})\n\t\t}\n\t} else {\n\t\t// Default: Limit by remoteIP and path.\n\t\tsliceKeys = append(sliceKeys, []string{remoteIP, path})\n\t}\n\n\treturn sliceKeys\n}", "title": "" }, { "docid": "170340caa35e7368159cc22ece47af12", "score": "0.4200519", "text": "func (_TellorGetters *TellorGettersCallerSession) GetMinersByRequestIdAndTimestamp(_requestId *big.Int, _timestamp *big.Int) ([5]common.Address, error) {\n\treturn _TellorGetters.Contract.GetMinersByRequestIdAndTimestamp(&_TellorGetters.CallOpts, _requestId, _timestamp)\n}", "title": "" }, { "docid": "a669c29d300a4bfa4964efe2489ddad1", "score": "0.4196709", "text": "func (_TellorGetters *TellorGettersCaller) RequestIdByQueryHash(opts *bind.CallOpts, arg0 [32]byte) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _TellorGetters.contract.Call(opts, &out, \"requestIdByQueryHash\", arg0)\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": "8749551ba8d51ae8cdf77be740f6c8e5", "score": "0.41913462", "text": "func (nc *NATSCollector) makeRequests() map[string]map[string]interface{} {\n\t// query the URL for the most recent stats.\n\t// get all the Metrics at once, then set the stats and collect them together.\n\tresps := make(map[string]map[string]interface{})\n\tfor _, u := range nc.servers {\n\t\tvar response = map[string]interface{}{}\n\t\tif err := getMetricURL(nc.httpClient, u.URL, &response); err != nil {\n\t\t\tDebugf(\"ignoring server %s: %v\", u.ID, err)\n\t\t\tdelete(resps, u.ID)\n\t\t}\n\t\tresps[u.ID] = response\n\t}\n\treturn resps\n}", "title": "" }, { "docid": "8fb12d0db7233cd595f2dd01c4c70b23", "score": "0.41872898", "text": "func (o *GetEventsNetworkIDParams) 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.End != nil {\n\n\t\t// query param end\n\t\tvar qrEnd string\n\t\tif o.End != nil {\n\t\t\tqrEnd = *o.End\n\t\t}\n\t\tqEnd := qrEnd\n\t\tif qEnd != \"\" {\n\t\t\tif err := r.SetQueryParam(\"end\", qEnd); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Events != nil {\n\n\t\t// query param events\n\t\tvar qrEvents string\n\t\tif o.Events != nil {\n\t\t\tqrEvents = *o.Events\n\t\t}\n\t\tqEvents := qrEvents\n\t\tif qEvents != \"\" {\n\t\t\tif err := r.SetQueryParam(\"events\", qEvents); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.From != nil {\n\n\t\t// query param from\n\t\tvar qrFrom string\n\t\tif o.From != nil {\n\t\t\tqrFrom = *o.From\n\t\t}\n\t\tqFrom := qrFrom\n\t\tif qFrom != \"\" {\n\t\t\tif err := r.SetQueryParam(\"from\", qFrom); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.HwIds != nil {\n\n\t\t// query param hw_ids\n\t\tvar qrHwIds string\n\t\tif o.HwIds != nil {\n\t\t\tqrHwIds = *o.HwIds\n\t\t}\n\t\tqHwIds := qrHwIds\n\t\tif qHwIds != \"\" {\n\t\t\tif err := r.SetQueryParam(\"hw_ids\", qHwIds); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// path param network_id\n\tif err := r.SetPathParam(\"network_id\", o.NetworkID); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Size != nil {\n\n\t\t// query param size\n\t\tvar qrSize string\n\t\tif o.Size != nil {\n\t\t\tqrSize = *o.Size\n\t\t}\n\t\tqSize := qrSize\n\t\tif qSize != \"\" {\n\t\t\tif err := r.SetQueryParam(\"size\", qSize); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Start != nil {\n\n\t\t// query param start\n\t\tvar qrStart string\n\t\tif o.Start != nil {\n\t\t\tqrStart = *o.Start\n\t\t}\n\t\tqStart := qrStart\n\t\tif qStart != \"\" {\n\t\t\tif err := r.SetQueryParam(\"start\", qStart); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Streams != nil {\n\n\t\t// query param streams\n\t\tvar qrStreams string\n\t\tif o.Streams != nil {\n\t\t\tqrStreams = *o.Streams\n\t\t}\n\t\tqStreams := qrStreams\n\t\tif qStreams != \"\" {\n\t\t\tif err := r.SetQueryParam(\"streams\", qStreams); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Tags != nil {\n\n\t\t// query param tags\n\t\tvar qrTags string\n\t\tif o.Tags != nil {\n\t\t\tqrTags = *o.Tags\n\t\t}\n\t\tqTags := qrTags\n\t\tif qTags != \"\" {\n\t\t\tif err := r.SetQueryParam(\"tags\", qTags); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "455a8116a398640fba3fa275a54cd1f2", "score": "0.41854098", "text": "func (to *Session) GetLogsByQueryParams(queryParams string) ([]tc.Log, toclientlib.ReqInf, error) {\n\turi := APILogs + queryParams\n\tvar data tc.LogsResponse\n\treqInf, err := to.get(uri, nil, &data)\n\treturn data.Response, reqInf, err\n}", "title": "" }, { "docid": "6d3aa4b9a52a1bad3d55d8c2c87128bb", "score": "0.4183252", "text": "func (_TellorStorage *TellorStorageCallerSession) RequestIdByQueryHash(arg0 [32]byte) (*big.Int, error) {\n\treturn _TellorStorage.Contract.RequestIdByQueryHash(&_TellorStorage.CallOpts, arg0)\n}", "title": "" }, { "docid": "d640b3698243d0bfc168490ae7043f7a", "score": "0.41802847", "text": "func sortAndFilterTribIdList(n int, tribIdList []string) KeyList {\n\tkeyList := make(KeyList, len(tribIdList))\n\tfor i, tribId := range tribIdList {\n\t\tkeyParts := strings.Split(tribId, \":\")\n\t\ttimestamp, _ := strconv.ParseInt(keyParts[1], 10, 64)\n\t\tkey := TribKey{keyParts[0], timestamp}\n\n\t\tkeyList[i] = key\n\t}\n\n\tsort.Sort(keyList)\n\n\tif len(keyList) > n {\n\t\tkeyList = keyList[:n]\n\t}\n\n\treturn keyList\n}", "title": "" }, { "docid": "8deabb287e2d848c3a07550b371f6e47", "score": "0.41725922", "text": "func (_ZapGetters *ZapGettersCaller) GetSubmissionsByTimestamp(opts *bind.CallOpts, _requestId *big.Int, _timestamp *big.Int) ([5]*big.Int, error) {\r\n\tvar (\r\n\t\tret0 = new([5]*big.Int)\r\n\t)\r\n\tout := ret0\r\n\terr := _ZapGetters.contract.Call(opts, out, \"getSubmissionsByTimestamp\", _requestId, _timestamp)\r\n\treturn *ret0, err\r\n}", "title": "" }, { "docid": "5ea4cf5fbd3f38d2f409379f14e1657e", "score": "0.41673842", "text": "func (s *Store) CreateTRBRequestSystemIntakes(ctx context.Context, trbRequestID uuid.UUID, systemIntakeIDs []uuid.UUID) ([]*models.TRBRequestSystemIntake, error) {\n\ttx := s.db.MustBegin()\n\tdefer tx.Rollback()\n\tdeleteTRBRequestSystemIntakesSQL := `\n\t\tDELETE FROM trb_request_system_intakes\n\t\tWHERE trb_request_id = $1;\n\t`\n\t_, err := tx.Exec(deleteTRBRequestSystemIntakesSQL, trbRequestID)\n\n\t// Create a new TRBRequestSystemIntake for each SystemIntake ID\n\ttrbRequestSystemIntakes := []models.TRBRequestSystemIntake{}\n\tfor _, systemIntakeID := range systemIntakeIDs {\n\t\ttrbIntake := models.TRBRequestSystemIntake{\n\t\t\tTRBRequestID: trbRequestID,\n\t\t\tSystemIntakeID: systemIntakeID,\n\t\t}\n\t\ttrbIntake.CreatedBy = appcontext.Principal(ctx).ID()\n\t\ttrbIntake.ID = uuid.New()\n\t\ttrbRequestSystemIntakes = append(trbRequestSystemIntakes, trbIntake)\n\t}\n\n\tif err != nil {\n\t\tappcontext.ZLogger(ctx).Error(fmt.Sprintf(\"Failed to create TRB request system intakes transaction, error %s\", err))\n\t\treturn nil, err\n\t}\n\tif len(trbRequestSystemIntakes) > 0 {\n\t\tinsertTRBRequestSystemIntakesSQL := `\n\t\t\tINSERT INTO trb_request_system_intakes (\n\t\t\t\t\tid,\n\t\t\t\t\ttrb_request_id,\n\t\t\t\t\tsystem_intake_id,\n\t\t\t\t\tcreated_by,\n\t\t\t\t\tmodified_by\n\t\t\t\t)\n\t\t\t\tVALUES (\n\t\t\t\t\t:id,\n\t\t\t\t\t:trb_request_id,\n\t\t\t\t\t:system_intake_id,\n\t\t\t\t\t:created_by,\n\t\t\t\t\t:modified_by\n\t\t\t\t)\n\t\t\t`\n\t\t_, err = tx.NamedExec(insertTRBRequestSystemIntakesSQL, trbRequestSystemIntakes)\n\n\t\tif err != nil {\n\t\t\tappcontext.ZLogger(ctx).Error(fmt.Sprintf(\"Failed to create TRB request system intakes transaction, error %s\", err))\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tgetTRBRequestIntakesSQL := `SELECT * FROM trb_request_system_intakes WHERE trb_request_id = $1;`\n\tinsertedTRBRequestSystemIntakes := []*models.TRBRequestSystemIntake{}\n\terr = tx.Select(&insertedTRBRequestSystemIntakes, getTRBRequestIntakesSQL, trbRequestID)\n\tif err != nil {\n\t\tappcontext.ZLogger(ctx).Error(fmt.Sprintf(\"Failed to create TRB request system intakes transaction, error %s\", err))\n\t\treturn nil, err\n\t}\n\terr = tx.Commit()\n\tif err != nil {\n\t\tappcontext.ZLogger(ctx).Error(fmt.Sprintf(\"Failed to create TRB request system intakes transaction, error %s\", err))\n\t\treturn nil, err\n\t}\n\treturn insertedTRBRequestSystemIntakes, nil\n}", "title": "" }, { "docid": "899bcfefe9f022bb26c714bf1080d5df", "score": "0.41671553", "text": "func RequestID(c *web.C, h http.Handler) http.Handler {\n\tfn := func(w http.ResponseWriter, r *http.Request) {\n\t\tif c.Env == nil {\n\t\t\tc.Env = make(map[string]interface{})\n\t\t}\n\t\tmyid := atomic.AddUint64(&reqid, 1)\n\t\tc.Env[RequestIDKey] = fmt.Sprintf(\"%s-%06d\", prefix, myid)\n\n\t\th.ServeHTTP(w, r)\n\t}\n\n\treturn http.HandlerFunc(fn)\n}", "title": "" }, { "docid": "72a47f8bda6c17d8971397768af446d9", "score": "0.41667035", "text": "func MakeIDMap() {\n\tvar nameIDMap = make(map[string]string)\n\tvar indexIDMap = make(map[int]string)\n\tsrv := getService() // gets authorized cal service\n\t// grab current time to start look from\n\tt := time.Now().Format(time.RFC3339)\n\n\tgo func() {\n\t\t// get list of events\n\t\tevents, err := srv.Events.List(\"primary\").ShowDeleted(false).SingleEvents(true).TimeMin(t).MaxResults(10).OrderBy(\"startTime\").Do()\n\t\tif err != nil {\n\t\t\tlog.Fatalln(err)\n\t\t}\n\t\t// loop over items and create map\n\t\tfor i, item := range events.Items {\n\t\t\t// creates the map for title, id pair\n\t\t\tcreateEventMap(item.Summary, item.Id, nameIDMap)\n\t\t\t// creates map for index, id pairs (delete method)\n indexIDMap[i + 1] = item.Id // add indx and id to map\n\t\t}\n\t\t// sends the nameIDMap throught the idMapCh\n\t\tidMapCh <- nameIDMap // sends new map to idMapCh\n\t\tdeleteMapCh <- indexIDMap // sends index, id pair map \n\t}()\n\n}", "title": "" }, { "docid": "92364883e4016b6fa3bdd6dba8d26b8c", "score": "0.4164832", "text": "func generateBulkRequest(hit *Hit) ([]string, error) {\n\tmeta := hit.GenerateBulkMeta()\n\tsrc := hit.GenerateBulkSource()\n\treturn []string{meta, src}, nil\n}", "title": "" }, { "docid": "909a44483ef23e80d852918c6e390a4a", "score": "0.41616035", "text": "func logRequest(key string, data [][]string) {\n\tfmt.Println(\"request logged: \", key, data)\n\n}", "title": "" }, { "docid": "057d54267f7353e651f73a84a833c2c1", "score": "0.415218", "text": "func (_TellorStorage *TellorStorageSession) RequestIdByQueryHash(arg0 [32]byte) (*big.Int, error) {\n\treturn _TellorStorage.Contract.RequestIdByQueryHash(&_TellorStorage.CallOpts, arg0)\n}", "title": "" }, { "docid": "081bb6e9ae9ec090731c6d4303b15a1b", "score": "0.4152137", "text": "func (_TellorGetters *TellorGettersSession) GetMinersByRequestIdAndTimestamp(_requestId *big.Int, _timestamp *big.Int) ([5]common.Address, error) {\n\treturn _TellorGetters.Contract.GetMinersByRequestIdAndTimestamp(&_TellorGetters.CallOpts, _requestId, _timestamp)\n}", "title": "" }, { "docid": "84d3d7f73b1ae462fde21f13e4354a5a", "score": "0.41515842", "text": "func (_Tellor *TellorCaller) RequestIdByQueryHash(opts *bind.CallOpts, arg0 [32]byte) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _Tellor.contract.Call(opts, &out, \"requestIdByQueryHash\", arg0)\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": "73e5f120b82c8e1bb198314f6fb15b8b", "score": "0.41464645", "text": "func (p *BoltS3Perf) generateKeyNames(numObjects int) {\n\tfor i := 0; i < numObjects; i++ {\n\t\tkey := \"bolt-s3-perf\" + strconv.Itoa(i)\n\t\tp.keys = append(p.keys, key)\n\t}\n}", "title": "" }, { "docid": "f5896f6abb38d2f6bc516b072c715a4f", "score": "0.41389817", "text": "func RequestID() http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tclog.Info(\"Request\", fmt.Sprintf(\"Request-by-ID by client %s.\", r.RemoteAddr))\n\t\ttype Request struct {\n\t\t\tID string `json:\"ID\"`\n\t\t}\n\t\tvar request Request\n\t\tdecoder := json.NewDecoder(r.Body)\n\t\terr := decoder.Decode(&request)\n\t\tif err != nil {\n\t\t\tclog.Error(\"RequestID\", \"Unable to decode request.\", err)\n\t\t\tw.WriteHeader(http.StatusBadRequest) // 400 Bad Request\n\t\t\treturn\n\t\t}\n\t\treqID, err := strconv.Atoi(request.ID)\n\t\tif err != nil {\n\t\t\tclog.Error(\"RequestID\", \"Unable to convert request ID to an integer.\", err)\n\t\t\tw.WriteHeader(http.StatusInternalServerError) // 500 Internal Server Error\n\t\t\treturn\n\t\t}\n\t\tpath, err := getPathById(reqID)\n\t\tif err != nil {\n\t\t\tclog.Error(\"RequestID\", \"Unable to find file path by song ID.\", err)\n\t\t\tw.WriteHeader(http.StatusInternalServerError) // 500 Internal Server Error\n\t\t\treturn\n\t\t}\n\t\t_, err = liquidsoapRequest(path)\n\t\tif err != nil {\n\t\t\tclog.Error(\"RequestID\", \"Unable to submit song request.\", err)\n\t\t\tw.WriteHeader(http.StatusInternalServerError) // 500 Internal Server Error\n\t\t\treturn\n\t\t}\n\t\tw.WriteHeader(http.StatusAccepted) // 202 Accepted\n\t}\n}", "title": "" }, { "docid": "4b392a0996f98eb556acfb9c88b2bdf6", "score": "0.41376513", "text": "func RequestID(next echo.HandlerFunc) echo.HandlerFunc {\n\treturn echo.HandlerFunc(func(c echo.Context) error {\n\t\tc.Set(KeyRequestID, utils.GetUniqueID())\n\t\treturn next(c)\n\t})\n}", "title": "" }, { "docid": "1a7d1fb249b8f9f8001928049ba8b0e6", "score": "0.41325143", "text": "func (o *SecurityAuditLogCollectionGetParams) 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.Application != nil {\n\n\t\t// query param application\n\t\tvar qrApplication string\n\n\t\tif o.Application != nil {\n\t\t\tqrApplication = *o.Application\n\t\t}\n\t\tqApplication := qrApplication\n\t\tif qApplication != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"application\", qApplication); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.CommandID != nil {\n\n\t\t// query param command_id\n\t\tvar qrCommandID string\n\n\t\tif o.CommandID != nil {\n\t\t\tqrCommandID = *o.CommandID\n\t\t}\n\t\tqCommandID := qrCommandID\n\t\tif qCommandID != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"command_id\", qCommandID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Fields != nil {\n\n\t\t// binding items for fields\n\t\tjoinedFields := o.bindParamFields(reg)\n\n\t\t// query array param fields\n\t\tif err := r.SetQueryParam(\"fields\", joinedFields...); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.Index != nil {\n\n\t\t// query param index\n\t\tvar qrIndex int64\n\n\t\tif o.Index != nil {\n\t\t\tqrIndex = *o.Index\n\t\t}\n\t\tqIndex := swag.FormatInt64(qrIndex)\n\t\tif qIndex != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"index\", qIndex); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Input != nil {\n\n\t\t// query param input\n\t\tvar qrInput string\n\n\t\tif o.Input != nil {\n\t\t\tqrInput = *o.Input\n\t\t}\n\t\tqInput := qrInput\n\t\tif qInput != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"input\", qInput); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Location != nil {\n\n\t\t// query param location\n\t\tvar qrLocation string\n\n\t\tif o.Location != nil {\n\t\t\tqrLocation = *o.Location\n\t\t}\n\t\tqLocation := qrLocation\n\t\tif qLocation != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"location\", qLocation); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.MaxRecords != nil {\n\n\t\t// query param max_records\n\t\tvar qrMaxRecords int64\n\n\t\tif o.MaxRecords != nil {\n\t\t\tqrMaxRecords = *o.MaxRecords\n\t\t}\n\t\tqMaxRecords := swag.FormatInt64(qrMaxRecords)\n\t\tif qMaxRecords != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"max_records\", qMaxRecords); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Message != nil {\n\n\t\t// query param message\n\t\tvar qrMessage string\n\n\t\tif o.Message != nil {\n\t\t\tqrMessage = *o.Message\n\t\t}\n\t\tqMessage := qrMessage\n\t\tif qMessage != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"message\", qMessage); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.NodeName != nil {\n\n\t\t// query param node.name\n\t\tvar qrNodeName string\n\n\t\tif o.NodeName != nil {\n\t\t\tqrNodeName = *o.NodeName\n\t\t}\n\t\tqNodeName := qrNodeName\n\t\tif qNodeName != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"node.name\", qNodeName); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.NodeUUID != nil {\n\n\t\t// query param node.uuid\n\t\tvar qrNodeUUID string\n\n\t\tif o.NodeUUID != nil {\n\t\t\tqrNodeUUID = *o.NodeUUID\n\t\t}\n\t\tqNodeUUID := qrNodeUUID\n\t\tif qNodeUUID != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"node.uuid\", qNodeUUID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.OrderBy != nil {\n\n\t\t// binding items for order_by\n\t\tjoinedOrderBy := o.bindParamOrderBy(reg)\n\n\t\t// query array param order_by\n\t\tif err := r.SetQueryParam(\"order_by\", joinedOrderBy...); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.ReturnRecords != nil {\n\n\t\t// query param return_records\n\t\tvar qrReturnRecords bool\n\n\t\tif o.ReturnRecords != nil {\n\t\t\tqrReturnRecords = *o.ReturnRecords\n\t\t}\n\t\tqReturnRecords := swag.FormatBool(qrReturnRecords)\n\t\tif qReturnRecords != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"return_records\", qReturnRecords); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.ReturnTimeout != nil {\n\n\t\t// query param return_timeout\n\t\tvar qrReturnTimeout int64\n\n\t\tif o.ReturnTimeout != nil {\n\t\t\tqrReturnTimeout = *o.ReturnTimeout\n\t\t}\n\t\tqReturnTimeout := swag.FormatInt64(qrReturnTimeout)\n\t\tif qReturnTimeout != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"return_timeout\", qReturnTimeout); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Scope != nil {\n\n\t\t// query param scope\n\t\tvar qrScope string\n\n\t\tif o.Scope != nil {\n\t\t\tqrScope = *o.Scope\n\t\t}\n\t\tqScope := qrScope\n\t\tif qScope != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"scope\", qScope); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.SessionID != nil {\n\n\t\t// query param session_id\n\t\tvar qrSessionID string\n\n\t\tif o.SessionID != nil {\n\t\t\tqrSessionID = *o.SessionID\n\t\t}\n\t\tqSessionID := qrSessionID\n\t\tif qSessionID != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"session_id\", qSessionID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.State != nil {\n\n\t\t// query param state\n\t\tvar qrState string\n\n\t\tif o.State != nil {\n\t\t\tqrState = *o.State\n\t\t}\n\t\tqState := qrState\n\t\tif qState != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"state\", qState); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.SvmName != nil {\n\n\t\t// query param svm.name\n\t\tvar qrSvmName string\n\n\t\tif o.SvmName != nil {\n\t\t\tqrSvmName = *o.SvmName\n\t\t}\n\t\tqSvmName := qrSvmName\n\t\tif qSvmName != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"svm.name\", qSvmName); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Timestamp != nil {\n\n\t\t// query param timestamp\n\t\tvar qrTimestamp string\n\n\t\tif o.Timestamp != nil {\n\t\t\tqrTimestamp = *o.Timestamp\n\t\t}\n\t\tqTimestamp := qrTimestamp\n\t\tif qTimestamp != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"timestamp\", qTimestamp); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.User != nil {\n\n\t\t// query param user\n\t\tvar qrUser string\n\n\t\tif o.User != nil {\n\t\t\tqrUser = *o.User\n\t\t}\n\t\tqUser := qrUser\n\t\tif qUser != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"user\", qUser); err != nil {\n\t\t\t\treturn err\n\t\t\t}\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": "c481dda79825c7d2732efc869bef52e7", "score": "0.41293183", "text": "func (o *TicketEventsReadParams) 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\t// path param id\n\tif err := r.SetPathParam(\"id\", swag.FormatInt64(o.ID)); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b449677ec874734c23f58890e4700940", "score": "0.4127634", "text": "func DtagTransferRequestStoreKey(address string) []byte {\n\treturn append(DTagTransferRequestsPrefix, address...)\n}", "title": "" } ]
c7cca85aa04d5ac55cf7e41e23a53661
return all files in a folder
[ { "docid": "bd1e0ea7b31f48720a870e3b641999a0", "score": "0.7410016", "text": "func FilesInFolder(runner runner.CommandRunner, srcPath string, filenamesOnly bool) ([]string, error) {\n\tvar cmd = fmt.Sprintf(\"find %s -type f\", srcPath)\n\tif filenamesOnly {\n\t\tcmd = cmd + \" -printf '%f\\n'\"\n\t}\n\tstdout,_, err := runner.Run(cmd)\n\tif err != nil {\n\t\treturn []string{}, err\n\t}\n\n\tscanner := bufio.NewScanner(strings.NewReader(stdout))\n\tvar filePaths []string\n\tfor scanner.Scan() {\n\t\tfilePaths = append(filePaths, scanner.Text())\n\t}\n\n\treturn filePaths, nil\n}", "title": "" } ]
[ { "docid": "097f11898ffabc5c68df9fadbb0b0073", "score": "0.8082044", "text": "func getAllFiles(searchDir string) []string {\n fileList := []string{}\n //iterate through a folder: https://gist.github.com/francoishill/a5aca2a7bd598ef5b563\n filepath.Walk(searchDir, func(path string, f os.FileInfo, err error) error {\n fileList = append(fileList, path)\n return nil\n })\n return fileList\n}", "title": "" }, { "docid": "ba59793ff762b08eee4f4a4c0214e95e", "score": "0.7705043", "text": "func GetFolderFiles(folder string) []os.FileInfo {\n files,err := ioutil.ReadDir(folder)\n\n if err != nil {\n message.WriteError(\"(getFolderFiles) Read dir error\")\n os.Exit(1)\n } \n\n return files\n}", "title": "" }, { "docid": "0481de649c510452f028b25f35f6fb17", "score": "0.74549586", "text": "func getFiles(directory string) []string {\n\tvar allFilesPath []string\n\tfiles, err := ioutil.ReadDir(directory)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfor _, file := range files {\n\t\tif file.IsDir() {\n\t\t\tallFilesResult := getFiles(path.Join(directory, file.Name()))\n\t\t\tallFilesPath = append(allFilesPath, allFilesResult...)\n\t\t} else {\n\t\t\tfilePath := path.Join(directory, file.Name())\n\t\t\tallFilesPath = append(allFilesPath, filePath)\n\t\t}\n\t}\n\n\treturn allFilesPath\n}", "title": "" }, { "docid": "8003b57fa690cd9966cd34556bda44bf", "score": "0.72672385", "text": "func FilesInFolder(dir, filename string) ([]string, error) {\n\tif !IsDirExists(dir) {\n\t\treturn nil, errors.New(dir + \"folder does not exist\")\n\t}\n\tvar files []string\n\terr := filepath.Walk(dir, func(path string, f os.FileInfo, err error) error {\n\t\tif !f.IsDir() && strings.HasSuffix(path, filename) {\n\t\t\tfiles = append(files, path)\n\t\t}\n\t\treturn err\n\t})\n\treturn files, err\n}", "title": "" }, { "docid": "20b76121e3fb17b9d993ca4b4fdb7942", "score": "0.72302854", "text": "func getAllFile(pathname string) ([]string, error) {\n\tresult := []string{}\n\trd, err := ioutil.ReadDir(pathname)\n\tfor _, fi := range rd {\n\t\tdPath := path.Join(pathname, fi.Name())\n\t\tif fi.IsDir() {\n\t\t\tsubres, err := getAllFile(dPath)\n\t\t\tif err == nil {\n\t\t\t\tresult = append(result, subres...)\n\t\t\t}\n\t\t} else {\n\t\t\tresult = append(result, dPath)\n\t\t}\n\t}\n\treturn result, err\n}", "title": "" }, { "docid": "705047505e2225d4e0a19fabd69c3281", "score": "0.7205218", "text": "func getFiles(directory string) []os.FileInfo {\n\tfiles, err := ioutil.ReadDir(directory)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\n\treturn files\n\n}", "title": "" }, { "docid": "573b1f4bedaba71324fe42c7b4eecb2a", "score": "0.7201417", "text": "func Files(folderPath string) ([]string, error) {\n\tfi, err := ioutil.ReadDir(folderPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar files []string\n\tfor _, f := range fi {\n\t\tif !f.IsDir() {\n\t\t\tfiles = append(files, path.Join(folderPath, f.Name()))\n\t\t}\n\t}\n\treturn files, nil\n}", "title": "" }, { "docid": "d0664b7938299ba063085ce1600f58a4", "score": "0.7162582", "text": "func dirFiles(dir string, extension string) ([]string, error) {\n\tfiles, err := filepath.Glob(path.Join(dir, \"*.\"+extension))\n\treturn files, err\n}", "title": "" }, { "docid": "e02a1f0c639771a38c0046cad07a43d6", "score": "0.715148", "text": "func getFilesIn(fs http.FileSystem, root string) ([]string, error) {\n\tvar filenames []string\n\td, err := fs.Open(root)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfiles, err := d.Readdir(-1)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, fi := range files {\n\t\tif fi.IsDir() {\n\t\t\tf, err := getFilesIn(fs, path.Join(root, fi.Name()))\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tfilenames = append(filenames, f...)\n\t\t\tcontinue\n\t\t}\n\t\tfilenames = append(filenames, path.Join(root, fi.Name()))\n\t}\n\treturn filenames, nil\n}", "title": "" }, { "docid": "0b7b472b5d1375e906be735de72ac4ec", "score": "0.71100336", "text": "func getAllFiles(recursive bool,directory string) []Filepath {\n // read all files and folders\n files, err := ioutil.ReadDir(directory)\n check(err)\n all_files := make([]Filepath,0,len(files))\n\n for _, file := range files {\n full_path := filepath.Join(directory,file.Name())\n if file.IsDir() {\n // if file is directory, recursively traverse it\n if recursive {\n all_files = append(all_files,getAllFiles(true,full_path)...)\n }\n } else {\n full_filename := file.Name()\n filename,extension,err := splitFileName(full_filename)\n if err == nil {\n filepath := Filepath{directory : directory, filename : filename, extension : extension}\n all_files = append(all_files,filepath)\n }\n }\n }\n fmt.Println(all_files)\n return all_files\n\n}", "title": "" }, { "docid": "d9d638f53544cd017baa32e4a9b15c4a", "score": "0.71076286", "text": "func AllFilesInDir(s *storage.Client, bucket, folder string, callback func(item *storage.ObjectAttrs)) error {\n\ttotal := 0\n\tq := &storage.Query{Prefix: folder, Versions: false}\n\tfor q != nil {\n\t\tlist, err := s.Bucket(bucket).List(context.Background(), q)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Problem reading from Google Storage: %v\", err)\n\t\t}\n\t\ttotal += len(list.Results)\n\t\tglog.Infof(\"Loading %d more files from gs://%s/%s Total: %d\", len(list.Results), bucket, folder, total)\n\t\tfor _, item := range list.Results {\n\t\t\tcallback(item)\n\t\t}\n\t\tq = list.Next\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "aa640b350b3da7c500fd70bf8cd43591", "score": "0.7091918", "text": "func (cleaner FileSystemCleaner) GetFiles(directory string) (files []string, err error) {\n\tentries, err := os.ReadDir(directory)\n\tif err != nil {\n\t\treturn\n\t}\n\tfiles = make([]string, 0)\n\tfor i := 0; i < len(entries); i++ {\n\t\tif entries[i].Type().IsDir() {\n\t\t\tcontinue\n\t\t}\n\t\tfiles = append(files, entries[i].Name())\n\t}\n\treturn\n}", "title": "" }, { "docid": "11397f3e574815c90697d352f38a37d7", "score": "0.7069123", "text": "func getFiles(path string) ([]os.FileInfo, error) {\n\tfiles, err := ioutil.ReadDir(path)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn files, nil\n}", "title": "" }, { "docid": "aafd5aba95f9c35c382661e091bf9b5e", "score": "0.7001784", "text": "func GetFiles(root string) []string {\n\tvar files []string\n\n\terr := filepath.Walk(root, func(path string, info os.FileInfo, err error) error {\n\t\tfiles = append(files, path)\n\t\treturn nil\n\t})\n\n\tif err != nil {\n\t\tlogging.ErrorLogger.Fatal(err)\n\t}\n\n\treturn files\n}", "title": "" }, { "docid": "889dae8bf9d1dcebb556c043128a2ea5", "score": "0.6993798", "text": "func (g Galadh) getFiles(path string) (files []os.FileInfo, err error) {\n\tfile, err := os.Open(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfi, err := file.Stat()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif !fi.IsDir() {\n\t\treturn []os.FileInfo{}, nil\n\t}\n\n\tfs, err := file.Readdir(0)\n\tif err != nil && err != io.EOF {\n\t\treturn nil, err\n\t}\n\n\t// If we use the match dir options, check\n\t// if folder name matches and set var.\n\tdirPatternMatch := false\n\tif g.matchDirs {\n\t\tdirPatternMatch = g.matchPattern(g.includePattern, fi.Name())\n\t}\n\n\t// Processing files of this directory\n\tfor _, f := range fs {\n\t\t// If option all files is not set\n\t\t// and it is a hidden file, we skip the file.\n\t\tif !g.allFiles && isHidden(f) {\n\t\t\tcontinue\n\t\t}\n\n\t\t// If only dir option is set and we have\n\t\t// a file, we skip it.\n\t\tif g.dirOnly && !f.IsDir() {\n\t\t\tcontinue\n\t\t}\n\n\t\t// If an include pattern is set, check\n\t\t// if file matches the pattern and continue\n\t\t// if not. If dir pattern matches include all files.\n\t\tif !(dirPatternMatch || g.matchPattern(g.includePattern, f.Name())) {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Skip file if exclude pattern matches\n\t\tif g.excludePattern != \"\" && g.matchPattern(g.excludePattern, f.Name()) {\n\t\t\tcontinue\n\t\t}\n\n\t\tfiles = append(files, f)\n\t}\n\n\t// Let's sort our files slice, first directories and then files in alphabetic order.\n\tsort.SliceStable(files, func(i, j int) bool {\n\t\tfa := files[i]\n\t\tfb := files[j]\n\n\t\tif fa.IsDir() && !fb.IsDir() {\n\t\t\treturn true\n\t\t}\n\n\t\tif !fa.IsDir() && fb.IsDir() {\n\t\t\treturn false\n\t\t}\n\n\t\treturn strings.ToLower(fa.Name()) < strings.ToLower(fb.Name())\n\t})\n\n\treturn files, nil\n}", "title": "" }, { "docid": "69ed7666df24721d6dae1c1847958d96", "score": "0.69544184", "text": "func (manager *FileManager) readFiles(dir string, recursive bool) ([]*File, error) {\n\tfpath, _ := filepath.Abs(dir)\n\tinfo, err := os.Stat(fpath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !info.IsDir() {\n\t\treturn []*File{{\n\t\t\tFile: info,\n\t\t\tFullPath: fpath,\n\t\t}}, nil\n\t}\n\tlist, err := ioutil.ReadDir(fpath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresult := []*File{}\n\tfor _, f := range list {\n\t\tif !f.IsDir() {\n\t\t\tfname := strings.ToLower(f.Name())\n\t\t\tif string(fname[len(fname)-4:]) == \".hcl\" {\n\t\t\t\tresult = append(result, &File{\n\t\t\t\t\tFile: f,\n\t\t\t\t\tFullPath: fpath + string(filepath.Separator) + f.Name(),\n\t\t\t\t})\n\t\t\t}\n\t\t} else if recursive {\n\t\t\tsubdirList, serr := manager.readFiles(dir+\"/\"+f.Name(), recursive)\n\t\t\tif serr != nil {\n\t\t\t\treturn nil, serr\n\t\t\t}\n\t\t\tfor _, s := range subdirList {\n\t\t\t\tresult = append(result, s)\n\t\t\t}\n\t\t}\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "39f2f5e9bcc9228cc166ee7ae7054951", "score": "0.6953965", "text": "func AllFilesInDir(d *drive.Service, parentFolderId string) ([]*drive.File, error) {\n\tvar fs []*drive.File\n\tpageToken := \"\"\n\tfor {\n\t\tq := d.Files.List().MaxResults(1000)\n\t\t// If we have a pageToken set, apply it to the query\n\t\tif pageToken != \"\" {\n\t\t\tq = q.PageToken(pageToken)\n\t\t}\n\t\tif parentFolderId != \"\" {\n\t\t\tq = q.Q(fmt.Sprintf(\"'%s' in parents\", parentFolderId))\n\t\t}\n\t\tr, err := q.Do()\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"An error occurred: %v\\n\", err)\n\t\t\treturn fs, err\n\t\t}\n\t\tfs = append(fs, r.Items...)\n\t\tpageToken = r.NextPageToken\n\t\tif pageToken == \"\" {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn fs, nil\n}", "title": "" }, { "docid": "ed5965be298922251d8f4316c9ab8df4", "score": "0.69417137", "text": "func getFiles(path string, extensions []string) []File {\n\tvar returnFiles []File\n\n\tfiles, _ := ioutil.ReadDir(path)\n\tfor _, file := range files {\n\n\t\tfileExt := filepath.Ext(path + \"/\" + file.Name())\n\n\t\tfor _, extension := range extensions {\n\t\t\tif fileExt == extension {\n\t\t\t\t//TODO: change this to add to slice, add from slice to folder in a different func\n\t\t\t\t//TODO: add file to folder\n\t\t\t\t//data, err := ioutil.ReadFile(path + \"/\" + file.Name())\n\t\t\t\t//if err != nil {\n\t\t\t\t//\tfmt.Println(err)\n\t\t\t\t//\tbreak\n\t\t\t\t//}\n\t\t\t\t//\n\t\t\t\t//err = ioutil.WriteFile(folderPath + \"/\" + file.Name(), data, 0777)\n\t\t\t\t//\n\t\t\t\t//if err != nil {\n\t\t\t\t//\tfmt.Println(err)\n\t\t\t\t//\tbreak\n\t\t\t\t//}\n\t\t\t\t//break\n\n\t\t\t\tvar st syscall.Stat_t\n\t\t\t\tif err := syscall.Stat(path+\"/\"+file.Name(), &st); err != nil {\n\t\t\t\t\tlog.Fatal(err)\n\t\t\t\t}\n\n\t\t\t\tfileObject := File{\n\t\t\t\t\tInfo: file,\n\t\t\t\t\tPath: path + \"/\" + file.Name(),\n\t\t\t\t\tcTime: st.Ctimespec.Sec,\n\t\t\t\t}\n\t\t\t\treturnFiles = append(returnFiles, fileObject)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\t//if fileExt == \".jpg\" {\n\t\t//\tfmt.Printf(\"Name: %v, size: %v kb, Mode: %v, isDir: %v\\n\",\n\t\t//\t\tfile.Name(),\n\t\t//\t\tfile.Size()/1000,\n\t\t//\t\tfile.Mode(),\n\t\t//\t\tfile.IsDir())\n\t\t//}\n\n\t\tif file.IsDir() {\n\t\t\treturnFiles = append(returnFiles, getFiles(path+\"/\"+file.Name(), extensions)...)\n\t\t}\n\t}\n\n\treturn returnFiles\n}", "title": "" }, { "docid": "d6dbaafc981533ea3ec9c2e5b98de1ba", "score": "0.6928795", "text": "func AllFilePaths(dir string) []string {\n\tallFiles := []string{}\n\terr := filepath.Walk(dir,\n\t\tfunc(p string, info os.FileInfo, err error) error {\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\t// fmt.Println(p, info.Size())\n\t\t\tif s, _ := os.Stat(p); !s.IsDir() {\n\t\t\t\tallFiles = append(allFiles, p)\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\n\treturn allFiles\n}", "title": "" }, { "docid": "733a82bdd93508dd40c18910a8d4ddee", "score": "0.6881401", "text": "func ListFiles(folder string) []string {\n\tf := make([]string, 0)\n\tfiles, err := ioutil.ReadDir(folder)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfor _, file := range files {\n\t\tt := CheckFileType(file.Name())\n\t\tif t == 0 {\n\t\t\tf = append(f, file.Name())\n\t\t}\n\t}\n\treturn f\n}", "title": "" }, { "docid": "68945d23e1c82c96ce3ab5f3647fc07e", "score": "0.6877283", "text": "func files(directory string) []string {\n\tdir, _ := ioutil.ReadDir(directory)\n\tvar files []string\n\tfor _, file := range dir {\n\t\tfiles = append(files, file.Name())\n\t}\n\treturn (files)\n}", "title": "" }, { "docid": "d900d2bea71565df31c8e9f35b5df014", "score": "0.68499774", "text": "func FilesInDir(path string) ([]string, error) {\n\tentries, err := ioutil.ReadDir(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar l []string\n\tfor _, f := range entries {\n\t\tif f.Mode().IsDir() {\n\t\t\tcontinue\n\t\t}\n\t\tl = append(l, f.Name())\n\t}\n\n\tsort.Strings(l)\n\treturn l, nil\n}", "title": "" }, { "docid": "e6e81d89e0080cc1f4a29fdd81184166", "score": "0.68321645", "text": "func GetFiles(root string) ([]string, error) {\n\tvar files []string\n\tf, err := os.Open(root)\n\tif err != nil {\n\t\treturn files, err\n\t}\n\tfileInfo, err := f.Readdir(-1)\n\tf.Close()\n\tif err != nil {\n\t\treturn files, err\n\t}\n\n\tfor _, file := range fileInfo {\n\t\tfiles = append(files, file.Name())\n\t}\n\treturn files, nil\n}", "title": "" }, { "docid": "706f64996906008907c54358934e0083", "score": "0.6820042", "text": "func getFiles(dirName string, suffix string) {\n fChannel := allFiles(dirName)\n parralelizer(2, fChannel, dirName, suffix)\n}", "title": "" }, { "docid": "60769e428cea42b235ff637656615c0c", "score": "0.67824656", "text": "func FindAllFiles(path string, list []string) (chan SearchResult, error) {\n\treturn findFiles(path, list, nil, false)\n}", "title": "" }, { "docid": "bf3445a8d971884bed45b3de64abe608", "score": "0.67743367", "text": "func collectFiles(dir string) ([]string, error) {\n\tfiles := make([]string, 0)\n\n\tcollector := func(path string, info os.FileInfo, err error) error {\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\trelative, err := filepath.Rel(dir, path)\n\t\tif err != nil {\n\t\t\tpanic(fmt.Sprintf(\"%s is not within %s but it should have been\", path, dir))\n\t\t}\n\t\tif info.Mode()&os.ModeType == 0 {\n\t\t\tfiles = append(files, relative)\n\t\t}\n\n\t\treturn err\n\t}\n\n\treturn files, filepath.Walk(dir, collector)\n}", "title": "" }, { "docid": "34a15fd3cb5f8864ec202e36b433ce11", "score": "0.6771733", "text": "func (service Service) GetAllFiles(prefix string) ([]*get3w.File, error) {\n\tfiles := []*get3w.File{}\n\tif !service.IsExist(prefix) {\n\t\treturn files, nil\n\t}\n\n\terr := filepath.Walk(prefix, func(p string, fileInfo os.FileInfo, err error) error {\n\t\tisDir := fileInfo.IsDir()\n\t\tname := fileInfo.Name()\n\t\tpath := p[len(service.SourcePath):]\n\t\tpath = filepath.ToSlash(path)\n\t\tpath = strings.Trim(strings.Replace(path, \"//\", \"/\", -1), \"/\")\n\t\tsize := fileInfo.Size()\n\t\tchecksum := \"\"\n\t\tif !isDir {\n\t\t\tchecksum, _ = service.Checksum(path)\n\t\t}\n\n\t\tlastModified := fileInfo.ModTime()\n\t\tfile := &get3w.File{\n\t\t\tIsDir: isDir,\n\t\t\tPath: path,\n\t\t\tName: name,\n\t\t\tSize: size,\n\t\t\tChecksum: checksum,\n\t\t\tLastModified: timeutils.ToString(lastModified),\n\t\t}\n\t\tfiles = append(files, file)\n\t\treturn nil\n\t})\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn files, nil\n}", "title": "" }, { "docid": "2524e0e8ea79f40aa06f9b7dd022da58", "score": "0.675485", "text": "func GetAllFiles(ext string) ([]string, error) {\n\tdir, err := os.Getwd()\n\tCheckError(err)\n\n\tvar files []string\n\tlog.Infof(\"Finding files in %q directory\", dir)\n\tfiles, err = filepath.Glob(ext)\n\tCheckError(err)\n\n\tif len(files) == 0 {\n\t\tlog.Infof(\"No files with %q extensions found in %q\", ext, dir)\n\t}\n\treturn files, nil\n}", "title": "" }, { "docid": "e455ad8b87942205b88ac3035283a717", "score": "0.67423284", "text": "func filesIn(dir string) []string {\n\tvar fs []string\n\n\td, _ := os.Open(dir)\n\tnames, err := d.Readdirnames(0)\n\tif err != nil {\n\t\tlog.Fatal(\"filesIn: \", err)\n\t}\n\n\tfor _, name := range names {\n\t\tfinfo, err := os.Lstat(dir + \"/\" + name)\n\t\tif err != nil {\n\t\t\tlog.Fatal(\"filesIn: \", err)\n\t\t}\n\t\tif finfo.Mode().IsRegular() {\n\t\t\tfs = append(fs, finfo.Name())\n\t\t}\n\t}\n\treturn fs\n}", "title": "" }, { "docid": "5bb7c9493394153172954eaa21d6ce41", "score": "0.6739474", "text": "func findFiles(dir string) (files []string) {\n\tfilepath.Walk(dir, func(path string, info os.FileInfo, err error) error {\n\t\tif info.Mode().IsRegular() && info.Size() > 0 {\n\t\t\tfiles = append(files, path)\n\t\t}\n\t\treturn nil\n\t})\n\tsort.Strings(files)\n\treturn files\n}", "title": "" }, { "docid": "837ac2f93bb82cf6fa060de895533b24", "score": "0.6699527", "text": "func allFiles(dirName string) <-chan os.FileInfo {\n files, err := ioutil.ReadDir(dirName)\n if err != nil {\n throwErr(err)\n }\n\n out := make(chan os.FileInfo)\n go func() {\n for _, file := range files {\n out <- file\n }\n close(out)\n }()\n return out\n}", "title": "" }, { "docid": "0cb864dc6277b4e37bbbe6ace8d90e78", "score": "0.66941494", "text": "func GetFilesLayer(path string) []File {\r\n\tfiles, _ := ioutil.ReadDir(path)\r\n\tvar fileList []File\r\n\r\n\tfor _, file := range files {\r\n\t\tif !file.IsDir() && IsLegalPath(file.Name()) {\r\n\t\t\tf := ProcessFile(filepath.Join(path, file.Name()))\r\n\t\t\tfileList = append(fileList, f)\r\n\t\t}\r\n\t}\r\n\r\n\treturn fileList\r\n}", "title": "" }, { "docid": "b737a2ba88302fb9d14bb3721e85dba9", "score": "0.6693185", "text": "func CollectFiles(dir string) ([]string, error) {\n\tvar files []string\n\n\terr := filepath.Walk(dir, func(path string, info os.FileInfo, err error) error {\n\n\t\tif !strings.Contains(path, \".go\") || strings.Contains(path, \"_test.go\") {\n\t\t\treturn nil\n\t\t}\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tabsPath, err := filepath.Abs(path)\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfiles = append(files, absPath)\n\t\treturn nil\n\t})\n\n\tif err != nil {\n\t\treturn []string{}, err\n\t}\n\treturn files, nil\n}", "title": "" }, { "docid": "f815e0aabbea1500a38223df53ebd116", "score": "0.66903436", "text": "func RegularFilesInDir(path string) ([]string, error) {\n\tentries, err := ioutil.ReadDir(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar l []string\n\tfor _, f := range entries {\n\t\tif !f.Mode().IsRegular() {\n\t\t\tcontinue\n\t\t}\n\t\tl = append(l, f.Name())\n\t}\n\n\tsort.Strings(l)\n\treturn l, nil\n}", "title": "" }, { "docid": "7c905af626160fd3d1bc1b2e77054fe5", "score": "0.6678425", "text": "func getAllOKFilesInPath(dir string, includeTests bool) ([]string, error) {\n\tfiles, err := fs.Filesystem.ReadDir(dir)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar fileNames []string\n\tfor _, f := range files {\n\t\tfileName := path.Join(dir, f.Name())\n\t\tif path.Ext(fileName) == \".ok\" {\n\t\t\tfileNames = append(fileNames, fileName)\n\t\t}\n\n\t\tif includeTests && path.Ext(fileName) == \".okt\" {\n\t\t\tfileNames = append(fileNames, fileName)\n\t\t}\n\t}\n\n\treturn fileNames, nil\n}", "title": "" }, { "docid": "9a3235a3e8145267e0a682536463b1ee", "score": "0.6662156", "text": "func ListFiles(dir string) []string {\n\tvar out []string\n\tentries, err := ioutil.ReadDir(dir)\n\tif err != nil {\n\t\tlog.Println(\"Unable to read directory\", dir, err)\n\t\treturn nil\n\t}\n\tfor _, f := range entries {\n\t\tif !f.IsDir() {\n\t\t\tout = append(out, f.Name())\n\t\t}\n\t}\n\treturn out\n}", "title": "" }, { "docid": "a8cff4e969ffc6cdfc1d3844600422ac", "score": "0.666053", "text": "func GetFiles(directory string) ([]os.FileInfo, error) {\n\tfiles, err := ioutil.ReadDir(directory)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn files, nil\n}", "title": "" }, { "docid": "088e29e5b92b5e7bdd6b4326ab80035c", "score": "0.6648784", "text": "func GetFiles(dir string, extensions []string) ([]string, error) {\n\t// check if the directory exists\n\tif _, err := os.Stat(dir); os.IsNotExist(err) {\n\t\treturn nil, fmt.Errorf(\"Directory %s does not exist\", dir)\n\t}\n\t// append slash to dir name if doesn't have\n\tif !strings.HasSuffix(dir, \"/\") {\n\t\tdir += \"/\"\n\t}\n\n\tfiles, err := ioutil.ReadDir(dir)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar filePaths []string\n\tfor _, f := range files {\n\t\tif extensions == nil {\n\t\t\tfilePaths = append(filePaths, dir+f.Name())\n\t\t\tcontinue\n\t\t} else if !f.IsDir() && hasSuffix(f.Name(), extensions) {\n\t\t\tfilePaths = append(filePaths, dir+f.Name())\n\t\t}\n\t}\n\n\treturn filePaths, nil\n}", "title": "" }, { "docid": "d26a86135d89b7f32684fb3838afb6bf", "score": "0.66480243", "text": "func fileList(dir string) []string {\n\tfileList := []string{}\n\terr := filepath.Walk(dir, func(path string, f os.FileInfo, err error) error {\n\t\tif !f.IsDir() && (filepath.Ext(path) == \".js\" || filepath.Ext(path) == \".css\") {\n\t\t\tfileList = append(fileList, path)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\treturn fileList\n}", "title": "" }, { "docid": "1b2bc655fed84caba340d6fe5957c1b0", "score": "0.6638467", "text": "func (s *Scrapper) Scrap() (files []string, err error) {\n\tfiles = make([]string, 0)\n\tfArray, err := ioutil.ReadDir(s.folder)\n\tif err != nil {\n\t\treturn\n\t}\n\t// search / filter\n\tfor _, f := range fArray {\n\t\tif !f.IsDir() {\n\t\t\tif strings.Contains(f.Name(), s.pattern) {\n\t\t\t\tfiles = append(files, f.Name())\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "57ec1a181b622056df56cd0d2175197f", "score": "0.6611988", "text": "func GetFiles(dir string) ([]string, []string, error) {\n\tjsFiles, err := GetJSFiles(dir)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tvar testFiles []string\n\ttestDir := filepath.Join(dir, \"tests\")\n\tok, err := exists(testDir)\n\tif ok {\n\t\ttestFiles, err = GetJSFiles(testDir)\n\t}\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treturn jsFiles, testFiles, nil\n}", "title": "" }, { "docid": "80b9a078ccef88a5d82e8406c29f5abb", "score": "0.65966827", "text": "func GetAllFile(pathname string, relativePath string) (list []string, err error) {\n\trd, err := ioutil.ReadDir(relativePath + pathname)\n\tfor _, fi := range rd {\n\t\tif fi.IsDir() {\n\t\t\tfmt.Printf(\"[%s]\\n\", pathname + \"/\" + fi.Name())\n\t\t\tli, err := GetAllFile(pathname + \"/\" + fi.Name(), relativePath)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tlist = append(list, li...)\n\t\t} else {\n\t\t\tfmt.Println(pathname + \"/\" + fi.Name())\n\t\t\tlist = append(list, pathname + \"/\" + fi.Name())\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "be304f6e9a7b9722368eda1141a404e0", "score": "0.65823644", "text": "func readFiles(root string, onFile func(string) error) {\n\terr := filepath.Walk(root, func(name string, info os.FileInfo, err error) error {\n\t\tif err != nil {\n\t\t\tcolor.Red(err.Error())\n\t\t\treturn err\n\t\t}\n\n\t\tif info.IsDir() {\n\t\t\treturn nil\n\t\t}\n\n\t\tif !strings.HasSuffix(name, \".webm\") {\n\t\t\treturn nil\n\t\t}\n\n\t\terr = onFile(name)\n\n\t\tif err != nil {\n\t\t\tcolor.Red(err.Error())\n\t\t}\n\n\t\t// Always continue traversing the directory\n\t\treturn nil\n\t})\n\n\tif err != nil {\n\t\tcolor.Red(err.Error())\n\t}\n}", "title": "" }, { "docid": "2d691bf8bdf5471e1c62ada6c7f97dc7", "score": "0.65679306", "text": "func findImageFiles(rootPath *string, recursive bool) {\n\n\tif recursive {\n\t\terr := filepath.Walk(*rootPath, func(path string, info os.FileInfo, err error) error {\n\t\t\tch <- path\n\t\t\treturn nil\n\t\t})\n\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Error:\", err.Error())\n\t\t}\n\t} else {\n\t\tfiles, err := ioutil.ReadDir(*rootPath)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Error\", err.Error())\n\t\t}\n\t\tfor _, f := range files {\n\t\t\tif !f.IsDir() {\n\t\t\t\tch <- (*rootPath) + \"/\" + f.Name()\n\t\t\t}\n\t\t}\n\t}\n\tclose(ch)\n\n}", "title": "" }, { "docid": "9439d49baeb7b91af259f36aea4d74f4", "score": "0.65431905", "text": "func getOpenFilesInDir(dirPath string, fFilter fileFilter) ([]*os.File, error) {\n\tdfi, err := os.Open(dirPath)\n\tif err != nil {\n\t\treturn nil, newCannotOpenFileError(\"Cannot open directory \" + dirPath)\n\t}\n\tdefer dfi.Close()\n\t// Size of read buffer (i.e. chunk of items read at a time).\n\trbs := 64\n\tresFiles := []*os.File{}\nL:\n\tfor {\n\t\t// Read directory entities by reasonable chuncks\n\t\t// to prevent overflows on big number of files.\n\t\tfis, e := dfi.Readdir(rbs)\n\t\tswitch e {\n\t\t// It's OK.\n\t\tcase nil:\n\t\t// Do nothing, just continue cycle.\n\t\tcase io.EOF:\n\t\t\tbreak L\n\t\t// Something went wrong.\n\t\tdefault:\n\t\t\treturn nil, e\n\t\t}\n\t\t// THINK: Maybe, use async running.\n\t\tfor _, fi := range fis {\n\t\t\t// NB: On Linux this could be a problem as\n\t\t\t// there are lots of file types available.\n\t\t\tif !fi.IsDir() {\n\t\t\t\tf, e := os.Open(filepath.Join(dirPath, fi.Name()))\n\t\t\t\tif e != nil {\n\t\t\t\t\tif f != nil {\n\t\t\t\t\t\tf.Close()\n\t\t\t\t\t}\n\t\t\t\t\t// THINK: Add nil as indicator that a problem occurred.\n\t\t\t\t\tresFiles = append(resFiles, nil)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\t// Check filter condition.\n\t\t\t\tif fFilter != nil && !fFilter(fi, f) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tresFiles = append(resFiles, f)\n\t\t\t}\n\t\t}\n\t}\n\treturn resFiles, nil\n}", "title": "" }, { "docid": "d4cb354b659db264b0bf7a7b1a4afd79", "score": "0.65226686", "text": "func fileList(dir string) []fs.FileInfo {\n\tfiles, err := ioutil.ReadDir(dir)\n\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\n\treturn files\n}", "title": "" }, { "docid": "49d4f58614edf6424b38d6fbc8a74aaf", "score": "0.6521369", "text": "func FindFiles(dir string, pattern string) ([]string, error) {\n\t\n\tfl := []string{}\n\terr := filepath.Walk(dir, func(path string, info os.FileInfo, err error) error {\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"error accessing path %q:%v\\n\", dir, err)\n\t\t\treturn err\n\t\t}\n\t\t\t// Get list of files in path\n\t\t\tfilelist, err := filepath.Glob(filepath.Join(path, pattern))\n\t\t\tif err != nil {\n\t\t\t\tfmt.Printf(\"Error in search pattern %v\\n\", err)\n\t\t\t\treturn err\n\t\t\t}\n\t\t\t\n\t\t\t// add file as long as it isn't a dir\n\t\t\tfor _,file := range filelist {\n\t\t\t\tif info, err := os.Stat(file); err != nil || !info.IsDir() {\n\t\t\t\t\tfl = append(fl, file)\t\n\t\t\t}}\n\t\treturn nil\n\t})\n\treturn fl, err\n}", "title": "" }, { "docid": "5f5d59a419481f832621998ef4e751e5", "score": "0.65194786", "text": "func GetAllOKFilesInPath(dir string, includeTests bool) ([]string, error) {\n\tfs, err := ioutil.ReadDir(dir)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar files []string\n\tfor _, f := range fs {\n\t\tfileName := path.Join(dir, f.Name())\n\t\tif path.Ext(fileName) == \".ok\" {\n\t\t\tfiles = append(files, fileName)\n\t\t}\n\n\t\tif includeTests && path.Ext(fileName) == \".okt\" {\n\t\t\tfiles = append(files, fileName)\n\t\t}\n\t}\n\n\treturn files, nil\n}", "title": "" }, { "docid": "364f878bb933af6e9ecb8090a652ded3", "score": "0.6517813", "text": "func (s *Sio) GetAllFilePaths(rootPath string) {\n\tfileInfos, err := ioutil.ReadDir(rootPath)\n\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfor _, fileInfo := range fileInfos {\n\t\tfileName := fileInfo.Name()\n\t\tswitch mode := fileInfo.Mode(); {\n\t\tcase mode.IsRegular():\n\t\t\t// Check for .go extension\n\t\t\tif fileName[len(fileName)-3:] != \".go\" {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\ts.TmpFiles = append(s.TmpFiles, rootPath+\"/\"+fileName)\n\t\t\tbreak\n\t\tcase mode.IsDir():\n\t\t\ts.GetAllFilePaths(rootPath + \"/\" + fileName)\n\t\t\tbreak\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9c33eb3eda74b1878313869775453ed3", "score": "0.6511696", "text": "func getAllHTMLFiles(dir string) ([]string, error) {\n\tpages, err := filepath.Glob(filepath.Join(dir, \"*.html\"))\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar files []string\n\n\tfor _, page := range pages {\n\t\tfiles = append(files, page)\n\t}\n\n\treturn files, nil\n}", "title": "" }, { "docid": "c17bcfa8de957b3d216dbf15229b6397", "score": "0.64739263", "text": "func lsFiles(path string) []file.File {\n\tls := file.NewScanner().IncludePath(path).ScanRelativeTo(path)\n\tsort.Sort(file.ByPath(ls))\n\tfor i := range ls {\n\t\t// Folder mod times will probably differ, so just zero them out.\n\t\tls[i].ModTime = time.Time{}\n\t}\n\treturn ls\n}", "title": "" }, { "docid": "3777dc6f209757deed860d8029e7c41f", "score": "0.6471514", "text": "func listFiles(path string) []os.FileInfo {\n\tfileList, err := ioutil.ReadDir(path)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\treturn fileList\n}", "title": "" }, { "docid": "e70494ac8572827df90860297b006bb9", "score": "0.64660054", "text": "func browseFiles(absoluteDirPath string) (*data.ReadDirResult, error) {\n if !dirExists(absoluteDirPath) {\n errMsg := \"Directory \" + absoluteDirPath + \" does not exisit.\"\n glog.Errorln(errMsg)\n return nil, fmt.Errorf(errMsg)\n }\n // Get the info of files/folders inside the directory.\n readDirResult := new(data.ReadDirResult)\n files, _ := ioutil.ReadDir(absoluteDirPath)\n for _, file := range files {\n dirEntry := new(data.DirEntry)\n dirEntry.Name = file.Name()\n dirEntry.FilePath = filepath.Join(absoluteDirPath, file.Name())\n dirEntry.Size = file.Size()\n if file.IsDir() {\n dirEntry.Type = \"kDirectory\"\n } else if !file.Mode().IsRegular() {\n dirEntry.Type = \"kSymlink\"\n } else {\n dirEntry.Type = \"kFile\"\n }\n glog.Infoln(\"Adding entry to read directory under: \"+absoluteDirPath+\n \" with properties: %+v\\n\", *dirEntry)\n readDirResult.Entries = append(readDirResult.Entries, dirEntry)\n }\n return readDirResult, nil\n}", "title": "" }, { "docid": "1e2fdc3a57a97976510fa83ba6ee6223", "score": "0.6461589", "text": "func (appCtx *Pruner) getFiles(searchDir string, files []model.JavaConfigFileMetadata) []model.JavaConfigFileMetadata {\n\tvar fileInfo []os.FileInfo\n\tvar err error\n\tlog.Infof(\"Scanning directory %s \", searchDir)\n\tif fileInfo, err = ioutil.ReadDir(searchDir); err != nil {\n\t\tlog.Errorf(\"Unable to read directory at %s: %v\", searchDir, err)\n\t\treturn files\n\t}\n\tfor _, file := range fileInfo {\n\t\tif file.IsDir() {\n\t\t\tlog.Infof(\"Directory Found %s \", file.Name())\n\t\t\treturn appCtx.getFiles(searchDir+\"/\"+file.Name(), files)\n\n\t\t}\n\t\tparts := strings.Split(file.Name(), \".\")\n\t\tif len(parts) > 1 {\n\t\t\tif _, found := Find(fileTypes, parts[1]); found {\n\t\t\t\tfileNameParts := strings.Split(parts[0], \"-\")\n\t\t\t\tif _, isJavaConfig := Find(fileNames, fileNameParts[0]); isJavaConfig {\n\t\t\t\t\tconfigFile := model.JavaConfigFileMetadata{}\n\t\t\t\t\tconfigFile.ConfigurationType = parts[len(parts)-1]\n\t\t\t\t\tconfigFile.Path = searchDir + \"/\" + file.Name()\n\t\t\t\t\tif len(fileNameParts) > 1 {\n\t\t\t\t\t\tconfigFile.Profile = fileNameParts[len(fileNameParts)-1]\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconfigFile.Profile = defaultProfileKey\n\t\t\t\t\t}\n\t\t\t\t\tconfigFile.ApplicationContext = fileNameParts[0]\n\n\t\t\t\t\tfiles = append(files, configFile)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn files\n}", "title": "" }, { "docid": "0c77f3aaa2b1f71de7062782d2c42ba9", "score": "0.644046", "text": "func getFilesInDirectory(path string) []string {\n\tfiles := []string{}\n\tfilepath.Walk(*fileDirPath, func(path string, f os.FileInfo, _ error) error {\n\t\tif !f.IsDir() {\n\t\t\tfiles = append(files, f.Name())\n\t\t}\n\t\treturn nil\n\t})\n\tif err := os.Chdir(path); err != nil {\n\t\tlog.Fatalf(\"failed to change directory: %s\\n\", err)\n\t}\n\tfor _, f := range files {\n\t\tfile, err := os.Open(f)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"failed opening file: %s\\n\", err)\n\t\t}\n\t\tdefer file.Close()\n\n\t\tscanner := bufio.NewScanner(file)\n\t\tscanner.Split(bufio.ScanLines)\n\t\tvar prevLine string\n\t\tfor scanner.Scan() { // using line by line scan to handle large files\n\t\t\ttextLine := scanner.Text() // read in a lines\n\t\t\tif len(textLine) > 0 { // skip empty line\n\t\t\t\tif textLine < prevLine { // out of lexicographic order\n\t\t\t\t\tlog.Fatalf(\"%s is not sort!\\n\")\n\t\t\t\t} else {\n\t\t\t\t\tprevLine = textLine\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn files\n}", "title": "" }, { "docid": "3c5be18d87494ba84f28ade099bd9017", "score": "0.6439569", "text": "func filePathWalkDir(root string) ([]string, error) {\n\tvar files []string\n\terr := filepath.Walk(root, func(path string, info os.FileInfo, err error) error {\n\t\tif !info.IsDir() {\n\t\t\tfiles = append(files, path)\n\t\t}\n\t\treturn err\n\t})\n\treturn files, err\n}", "title": "" }, { "docid": "9167f79db23530aaa7aeb1ac4111922f", "score": "0.6422046", "text": "func FindFiles(searchDir string) []string {\n\tfileList := []string{}\n\terr := filepath.Walk(searchDir, func(path string, f os.FileInfo, err error) error {\n\t\tif f.IsDir() == false {\n\t\t\tfileList = append(fileList, path)\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn fileList\n}", "title": "" }, { "docid": "7474871afef146ecdcd12c01bc0a2264", "score": "0.6410484", "text": "func findFiles(dir, ext string) ([]string, error) {\n\tfiles := []string{}\n\text = strings.ToLower(ext)\n\terr := filepath.Walk(dir, func(path string, fi os.FileInfo, err error) error {\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif fi.IsDir() {\n\t\t\treturn nil\n\t\t}\n\n\t\tx := filepath.Ext(path)\n\t\tif strings.ToLower(x) == ext {\n\t\t\tfiles = append(files, path)\n\t\t}\n\n\t\treturn nil\n\t})\n\n\treturn files, err\n}", "title": "" }, { "docid": "fc6f0b43d0113cdcaa3af57202862061", "score": "0.6408578", "text": "func readFilesFromDir(dir *os.File) ([]string, error) {\n\tfiles, err := dir.Readdirnames(0)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn files, nil\n}", "title": "" }, { "docid": "206cf156804de715411b1fb31036f77d", "score": "0.64042133", "text": "func GetFilesInDir(path string) ([]string, []string) {\n\tvar contents []string\n\tvar paths []string\n\tfiles, err := ioutil.ReadDir(path)\n\tif err != nil {\n\t\tPrintError(err.Error(), 127)\n\t}\n\tfor _, file := range files {\n\t\tif !file.IsDir() {\n\t\t\tfileContents, err := ioutil.ReadFile(path + \"/\" + file.Name())\n\t\t\tif err != nil {\n\t\t\t\tPrintError(err.Error(), 1)\n\t\t\t}\n\t\t\tcontents = append(contents, string(fileContents))\n\t\t\tpaths = append(paths, file.Name())\n\t\t} else {\n\t\t\tdirContents, dirPaths := GetFilesInDir(path + \"/\" + file.Name())\n\t\t\tfor i, dirPath := range dirPaths {\n\t\t\t\tdirPaths[i] = file.Name() + \"/\" + dirPath\n\t\t\t}\n\t\t\tcontents = append(append(contents, \"\"), dirContents...)\n\t\t\tpaths = append(append(paths, fmt.Sprintf(\"%s/\", file.Name())), dirPaths...)\n\t\t}\n\t}\n\treturn contents, paths\n}", "title": "" }, { "docid": "36fdd28a705f2525d09d28c3c94d7a2e", "score": "0.63974136", "text": "func (d *FileDir) GetFiles(dir []byte, reply *FileDir) error {\n\n\t//line is the byte stream that contains the directory name\n\n\ttime.Sleep(5 * time.Second) //to show it is an expensive process\n\tdirectory := string(dir) //getting the directory name as a string\n\tresult := \"\" //for storing the result\n\tfmt.Printf(\"\\nDirectory requested: %v\", directory)\n\n\tfiles, err := ioutil.ReadDir(directory) //reading the contents of the directory\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfor _, f := range files { //iterating over the folders and files in the directory and saving their names to a string variable\n\t\tfName := f.Name()\n\t\tresult = result + fName + \"\\n\"\n\t}\n\n\t*reply = FileDir{result} //referencing the data to be returned\n\treturn nil\n}", "title": "" }, { "docid": "5685a79a404bf8cbf65cf65ca873e033", "score": "0.6393623", "text": "func (service Service) GetFiles(prefix string) ([]*get3w.File, error) {\n\tfiles := []*get3w.File{}\n\n\tfileInfos, err := ioutil.ReadDir(prefix)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\trootPath := service.GetRootPrefix(\"\")\n\trel, _ := filepath.Rel(rootPath, prefix)\n\trel = strings.Replace(rel, (string)(os.PathSeparator), \"/\", -1)\n\n\tfor _, fileInfo := range fileInfos {\n\t\tisDir := fileInfo.IsDir()\n\t\tname := fileInfo.Name()\n\t\tpath := path.Join(rel, name)\n\t\tsize := fileInfo.Size()\n\t\tchecksum := \"\"\n\t\tif !isDir {\n\t\t\tchecksum, _ = service.Checksum(path)\n\t\t}\n\n\t\tlastModified := fileInfo.ModTime()\n\t\tfile := &get3w.File{\n\t\t\tIsDir: isDir,\n\t\t\tPath: path,\n\t\t\tName: name,\n\t\t\tSize: size,\n\t\t\tChecksum: checksum,\n\t\t\tLastModified: timeutils.ToString(lastModified),\n\t\t}\n\t\tfiles = append(files, file)\n\t}\n\n\treturn files, nil\n}", "title": "" }, { "docid": "0f99962feb5838056380c5bb4e15aaa8", "score": "0.63862723", "text": "func GetFiles(path string, notIgnoreFolder bool, ignores []string) ([]push.File, error) {\n\tvar fs []push.File\n\tigf := utils.ToMap(ignores)\n\tigfiles := utils.ToMap(utils.DefaultIgnoreFiles)\n\terr := filepath.Walk(path, func(path string, info os.FileInfo, err error) error {\n\t\tif info.IsDir() {\n\t\t\tif isHiddenPath(path) && !notIgnoreFolder {\n\t\t\t\tfmt.Printf(\"%s Skip hidden folder: %15s\\n\", colors.Blue(\"-->\"), colors.Red(path))\n\t\t\t\treturn filepath.SkipDir\n\t\t\t}\n\t\t\tif _, ok := igf[path]; ok {\n\t\t\t\tfmt.Printf(\"%s Skip folder: %15s\\n\", colors.Blue(\"-->\"), colors.Red(path))\n\t\t\t\treturn filepath.SkipDir\n\t\t\t}\n\t\t\tfmt.Printf(\"%s Parse folder: %15s\\n\", colors.Blue(\"-->\"), colors.Purple(path))\n\t\t\treturn nil\n\t\t}\n\t\tif len(fs) > utils.MaxFilesCount {\n\t\t\treturn utils.ErrMaxFilesCount\n\t\t}\n\t\tfmt.Printf(\"%s Reading file: %15s\\n\", colors.Blue(\"-->\"), colors.Cyan(path))\n\t\tcontent, err := ioutil.ReadFile(path)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tf := push.File{\n\t\t\tFilename: path,\n\t\t\tContent: string(content),\n\t\t}\n\t\t_, shouldIgnore := igfiles[info.Name()]\n\n\t\tif f.Content != \"\" && !shouldIgnore {\n\t\t\tfs = append(fs, f)\n\t\t} else {\n\t\t\tfmt.Printf(\"%s Skip file: %15s\\n\", colors.Blue(\"-->\"), colors.Red(path))\n\t\t}\n\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn fs, nil\n}", "title": "" }, { "docid": "2ee0e6b889725d53564392e5cf2343fb", "score": "0.6377351", "text": "func FilesInDirectory(dir string, prefix string) []string {\n\n\texistingFiles := []string{}\n\n\t// Walk the home directory to find\n\tfilepath.Walk(dir, func(path string, info os.FileInfo, err error) error {\n\t\tif strings.Contains(path, filepath.Join(dir, prefix)) {\n\t\t\texistingFiles = append(existingFiles, path)\n\t\t}\n\t\treturn nil\n\t})\n\n\tif len(existingFiles) > 0 {\n\n\t\tsort.Slice(existingFiles, func(i, j int) bool {\n\n\t\t\tdti := strings.Split(existingFiles[i], BackupDelineator)\n\t\t\tdateTextI := dti[len(dti)-1]\n\t\t\ttimeI, _ := time.Parse(FileTimeFormat, dateTextI)\n\n\t\t\tdtj := strings.Split(existingFiles[j], BackupDelineator)\n\t\t\tdateTextJ := dtj[len(dtj)-1]\n\t\t\ttimeJ, _ := time.Parse(FileTimeFormat, dateTextJ)\n\n\t\t\treturn timeI.Before(timeJ)\n\n\t\t})\n\n\t}\n\n\treturn existingFiles\n\n}", "title": "" }, { "docid": "b78b32eb97116c891df193b7cde9b22d", "score": "0.6376016", "text": "func getDirectoryFilenames(path string) ([]string, error) {\n\tresult := make([]string, 0)\n\tfiles, err := os.ReadDir(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, f := range files {\n\t\tresult = append(result, f.Name())\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "74b751dbb418fae306db901b469fb77f", "score": "0.63646203", "text": "func (w *Watcher) readDirectory() ([]*filepb.File, error) {\n\tfileList, err := w.directoryReader.ReadDir(w.directory)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfileNames := make([]*filepb.File, len(fileList))\n\tvar j int\n\n\tfor i := range fileList {\n\t\t// Ignore directories\n\t\tif fileList[i].IsDir() {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Skip files that begin with a period if configured to do so\n\t\tif w.skipHiddenFiles {\n\t\t\tif strings.HasPrefix(fileList[i].Name(), \".\") {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\tfileNames[j] = &filepb.File{\n\t\t\tFilename: fileList[i].Name(),\n\t\t}\n\t\tj++\n\t}\n\n\t// Adjust the slice to account for any files that were filtered\n\tfileNames = fileNames[:j]\n\n\treturn fileNames, nil\n}", "title": "" }, { "docid": "73d00d8872d73ae7fcc1f57fa7528270", "score": "0.63538206", "text": "func ListFiles(path string) ([]os.FileInfo, error) {\n\treturn ioutil.ReadDir(path)\n}", "title": "" }, { "docid": "cd51b71a641167df777190bc4eba24b4", "score": "0.6351108", "text": "func Directory(file string) (files []string, err error) {\n\tinfo, err := os.Stat(file)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !info.IsDir() {\n\t\treturn []string{filepath.Base(file)}, nil\n\t}\n\tf, err := os.Open(file)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer func() {\n\t\tnerr := f.Close()\n\t\tif err == nil {\n\t\t\terr = nerr\n\t\t}\n\t}()\n\treturn f.Readdirnames(0)\n}", "title": "" }, { "docid": "c74ec9c60441ef749d2dbe62753a9a71", "score": "0.6339261", "text": "func GetDirFiles(path string, pattern string) []string {\n\tfiles := make([]string, 0)\n\terr := filepath.Walk(path, func(path string, f os.FileInfo, err error) error {\n\t\tif f == nil {\n\t\t\treturn err\n\t\t}\n\t\tif !f.IsDir() {\n\t\t\tif pattern != \"\" {\n\t\t\t\tif strings.Contains(path, pattern) {\n\t\t\t\t\tfiles = append(files, path)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfiles = append(files, path)\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\tfmt.Printf(\"filepath.Walk() returned %v\\n\", err)\n\t}\n\treturn files\n}", "title": "" }, { "docid": "773115086b0b3cab2c44ff854196e325", "score": "0.6334901", "text": "func walkFolder(fs afero.Fs, root string, wg *sync.WaitGroup) <-chan string {\n\tfiles := make(chan string, 100000)\n\tif exist, err := afero.DirExists(fs, root); err != nil || !exist {\n\t\tlog.Fatalf(\"The folder '%v' doesn't exist\", root)\n\t}\n\tgo func() {\n\t\tdefer wg.Done()\n\t\tafero.Walk(fs, root, func(path string, fi os.FileInfo, err error) error {\n\t\t\tif !fi.IsDir() && fi.Name() != catalog.CatalogFileName {\n\t\t\t\tfiles <- path\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\t\tfiles <- \"\"\n\t}()\n\treturn files\n}", "title": "" }, { "docid": "649b480663d8d9f931c48f6de7a89e7f", "score": "0.63253707", "text": "func getAllMatchingFiles(path string, allFilesMap map[string]data) []string {\n\tmatches := make([]string, 0)\n\tfor filePath, data := range allFilesMap {\n\t\t// Should not be a directory. Should have the path prefix (identifying that it is in the directory)\n\t\t// filePath != path because it should only return files within the provided directory. otherwise a file\n\t\t// can be matched if it has the same path as the given path.\n\t\tif !data.isDir && strings.HasPrefix(filePath, path) && filePath != path {\n\t\t\tmatches = append(matches, filePath)\n\t\t}\n\t}\n\treturn matches\n}", "title": "" }, { "docid": "8510da71c552c11f4afba76df85f5c96", "score": "0.6313469", "text": "func (d *Dir) Files() ([]string, error) {\n\tdir, err := os.Open(filepath.Join(d.path, \"files\"))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer dir.Close()\n\treturn dir.Readdirnames(0)\n}", "title": "" }, { "docid": "0a7f30146e484e04464043cd8b4d35f4", "score": "0.63112044", "text": "func getPaths(dirOrFilePath string) ([]string, error) {\n\tinfo, err := os.Stat(dirOrFilePath)\n\tif err != nil {\n\t\treturn nil, errors.Err(err)\n\t}\n\n\tif info.Mode().IsRegular() {\n\t\treturn []string{dirOrFilePath}, nil\n\t}\n\n\tf, err := os.Open(dirOrFilePath)\n\tif err != nil {\n\t\treturn nil, errors.Err(err)\n\t}\n\n\tfiles, err := f.Readdir(-1)\n\tif err != nil {\n\t\treturn nil, errors.Err(err)\n\t}\n\terr = f.Close()\n\tif err != nil {\n\t\treturn nil, errors.Err(err)\n\t}\n\n\tvar filenames []string\n\tfor _, file := range files {\n\t\tif !file.IsDir() {\n\t\t\tfilenames = append(filenames, dirOrFilePath+\"/\"+file.Name())\n\t\t}\n\t}\n\n\treturn filenames, nil\n}", "title": "" }, { "docid": "193f6fed31d050294201758ab0d931c3", "score": "0.6284522", "text": "func ListFilesRecursive(sourcePath string, output chan *string) {\n\terr := filepath.Walk(sourcePath, func(path string, f os.FileInfo, err error) error {\n\t\tif f.IsDir() {\n\t\t\treturn nil\n\t\t}\n\n\t\tfor _, suffix := range AllowedSuffixes {\n\t\t\tfmt.Printf(\"%s\\n\", path)\n\t\t\tif strings.HasSuffix(path, suffix) {\n\t\t\t\toutput <- &path\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t})\n\n\tif err != nil {\n\t\tlog.Print(\"Failed to read the directory: \", err)\n\t}\n}", "title": "" }, { "docid": "8d9e6af85d8481d3920ef9ebb6d76fed", "score": "0.6282397", "text": "func (storage *DropboxStorage) ListFiles(threadIndex int, dir string) (files []string, sizes []int64, err error) {\n\n if dir != \"\" && dir[0] != '/' {\n dir = \"/\" + dir\n }\n\n if len(dir) > 1 && dir[len(dir) - 1] == '/' {\n dir = dir[:len(dir) - 1]\n }\n\n input := &dropbox.ListFolderInput {\n Path : storage.storageDir + dir,\n Recursive : false,\n IncludeMediaInfo: false,\n IncludeDeleted: false,\n }\n\n output, err := storage.clients[threadIndex].ListFolder(input)\n\n for {\n\n if err != nil {\n return nil, nil, err\n }\n\n for _, entry := range output.Entries {\n name := entry.Name\n if entry.Tag == \"folder\" {\n name += \"/\"\n }\n files = append(files, name)\n sizes = append(sizes, int64(entry.Size))\n }\n\n if output.HasMore {\n output, err = storage.clients[threadIndex].ListFolderContinue(\n &dropbox.ListFolderContinueInput { Cursor: output.Cursor, })\n\n } else {\n break\n }\n\n }\n\n return files, sizes, nil\n}", "title": "" }, { "docid": "dea90ba73aa7f0bb52938fe582e2a177", "score": "0.62535775", "text": "func ReadEveryFileInDir(h errs.Handler, dirpath string) (Packages, error) {\n\terrs.Init(&h)\n\n\tvar pkgs Packages\n\tdirpath = filepath.Clean(dirpath)\n\terr := filepath.Walk(dirpath, func(filename string, info os.FileInfo, err error) error {\n\t\tif err != nil {\n\t\t\treturn h(fmt.Errorf(\"read file %s: %w\", filename, err))\n\t\t}\n\t\tif info.Mode().IsDir() {\n\t\t\tif filename == dirpath {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn filepath.SkipDir\n\t\t}\n\t\tif alpm.HasPackageFormat(filename) {\n\t\t\tp, err := Read(filename)\n\t\t\tif err != nil {\n\t\t\t\treturn h(err)\n\t\t\t}\n\n\t\t\tpkgs = append(pkgs, p)\n\t\t}\n\n\t\treturn nil\n\t})\n\n\treturn pkgs, err\n}", "title": "" }, { "docid": "cd4874c6fb38e08f50e6cd79ea294531", "score": "0.62456113", "text": "func FileList(dirPath string, suffix string) ([]string, error) {\n\tfiles := make([]string, 0, 128)\n\n\tdir, err := ioutil.ReadDir(dirPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsep := string(os.PathSeparator)\n\tsuffix = strings.ToLower(suffix)\n\n\tfor _, fi := range dir {\n\t\tif fi.IsDir() {\n\t\t\t// no recursive\n\t\t\tcontinue\n\t\t}\n\t\tif strings.HasSuffix(strings.ToLower(fi.Name()), suffix) {\n\t\t\tfiles = append(files, dirPath+sep+fi.Name())\n\t\t}\n\t}\n\n\treturn files, nil\n}", "title": "" }, { "docid": "52d5046500478284514cd095a8a1f5bb", "score": "0.62416935", "text": "func ListFilesInsideDirectory(directoryPath string) ([]FileInfo, error) {\n\tfiles, err := os.ReadDir(directoryPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfileList := make([]FileInfo, 0)\n\tfor _, f := range files {\n\t\tfi, err := f.Info()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfile := FileInfo{\n\t\t\tName: f.Name(),\n\t\t\tSize: fi.Size(),\n\t\t\tDir: f.IsDir(),\n\t\t\tModTime: fi.ModTime().Unix(),\n\t\t}\n\n\t\tfileList = append(fileList, file)\n\t}\n\n\treturn fileList, nil\n}", "title": "" }, { "docid": "5f5b314ebddfaa3ba4e147743e0077bc", "score": "0.62378883", "text": "func ListFilesRecursive(directory string) (string, error) {\n\n\t// check if directory is valid\n\t_, err := os.Open(directory)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tfileInfo := make([]string, 1)\n\n\tfilepath.Walk(directory,\n\t\tfunc(path string, info os.FileInfo, err error) error {\n\t\t\tif err != nil {\n\t\t\t\tfileInfo = append(fileInfo, err.Error())\n\t\t\t}\n\t\t\tfile := fmt.Sprintf(\"%v %v %v %v\", path, info.Size(), info.ModTime(), info.Mode())\n\t\t\tfileInfo = append(fileInfo, file)\n\t\t\treturn nil\n\t\t})\n\n\toutputToString := strings.Join(fileInfo, \" \")\n\n\treturn outputToString, nil\n}", "title": "" }, { "docid": "3cf44bdc453570f696713d88b68f4bfa", "score": "0.62273234", "text": "func (driver *ClientDriver) ListFiles(cc server.ClientContext, directory string) ([]os.FileInfo, error) {\n\tpath := path.Join(driver.baseDir, directory)\n\tif directory == \"\" {\n\t\tpath = driver.baseDir + cc.Path()\n\t}\n\n\treturn ioutil.ReadDir(path)\n}", "title": "" }, { "docid": "b9101f2cc34b22bc29b552e68d91398d", "score": "0.62271816", "text": "func (fet *Fet) dirCompiledFiles(dir string) ([]string, error) {\n\tfileList := []string{}\n\terr := filepath.Walk(dir, func(pwd string, info os.FileInfo, err error) error {\n\t\ttpl, _ := filepath.Rel(dir, pwd)\n\t\tif err != nil {\n\t\t\tfet.debug(\"read compile file failure:%v\", err)\n\t\t\treturn nil\n\t\t}\n\t\tif fet.NeedIgnore(tpl) {\n\t\t\treturn filepath.SkipDir\n\t\t}\n\t\tif !info.IsDir() {\n\t\t\tfileList = append(fileList, pwd)\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn fileList, nil\n}", "title": "" }, { "docid": "fc7c9556442411f9299c9fcebbf0ddc2", "score": "0.62270266", "text": "func (ld *LocalDir) Files() ([]*LocalFile, error) {\n\tvar files []*LocalFile\n\tfileInfos, err := ioutil.ReadDir(ld.path)\n\tif err != nil {\n\t\treturn files, err\n\t}\n\tfor _, f := range fileInfos {\n\t\tif f.IsDir() {\n\t\t\tcontinue\n\t\t}\n\t\tsize := int(f.Size())\n\t\tbytes := fastrand.Bytes(size)\n\t\tfiles = append(files, &LocalFile{\n\t\t\tpath: filepath.Join(ld.path, f.Name()),\n\t\t\tsize: size,\n\t\t\tchecksum: crypto.HashBytes(bytes),\n\t\t})\n\t}\n\treturn files, nil\n}", "title": "" }, { "docid": "c5682961545fa219552f759830a7838e", "score": "0.621938", "text": "func FilePathWalkDir(root string) ([]string, error) {\n\tvar files []string\n\terr := filepath.Walk(root, func(path string, info os.FileInfo, err error) error {\n\t\tif !info.IsDir() {\n\t\t\tfiles = append(files, path)\n\t\t}\n\treturn nil\n\t})\nreturn files, err\n}", "title": "" }, { "docid": "3239568853ad7655d941b125d170c7e5", "score": "0.62146604", "text": "func WalkAllFiles(dirPath string, visitor WalkerVisitor) []error {\n\treturn NewDirWalker(true, nil, visitor).Walk(dirPath)\n}", "title": "" }, { "docid": "da7ec427a476c803ce06c1338d1454a2", "score": "0.62088907", "text": "func enumerateFiles(dirname string) chan string {\n\toutput := make(chan string)\n\t// walk through the dir in goroutine and send files into output chanel\n\tgo func() {\n\t\tfilepath.Walk(dirname, func(path string, f os.FileInfo, err error) error {\n\t\t\tif !f.IsDir() {\n\t\t\t\toutput <- path\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\t\tclose(output)\n\t}()\n\treturn output\n}", "title": "" }, { "docid": "8a7807e70c682c6d0fc3f426601588c8", "score": "0.62050354", "text": "func parseResultsFileDirectory() []string {\n\n\tfiles := make([]string, 0)\n\n\tzipFiles, _ := filepath.Glob(\"./in/*.zip\")\n\txmlFiles, _ := filepath.Glob(\"./in/*.xml\")\n\n\tfiles = append(files, zipFiles...)\n\tfiles = append(files, xmlFiles...)\n\tif len(files) == 0 {\n\t\tlog.Fatalln(\"No results data *.zip *.xml.zip or *.xml files found in input folder /in.\")\n\t}\n\n\treturn files\n\n}", "title": "" }, { "docid": "0bf43a02394db323165e7b21d5621719", "score": "0.6201687", "text": "func get_file_list(searchDir string, file_channel chan string, num_workers int, wg *sync.WaitGroup) {\n\tdefer wg.Done() // signal we are finished at end of function or return\n\n\t// sub function of how to recurse/walk the directory structure of searchDir\n\t_ = filepath.Walk(searchDir, func(path string, f os.FileInfo, err error) error {\n\n\t\t// check if it's a file/directory (we just want files)\n if !strings.HasSuffix(path, \".hart\"){\n return nil\n }\n\t\tfile, err := os.Open(path)\n\t\tif err != nil {\n\t\t\treturn nil\n\t\t}\n\n\t\tdefer file.Close() // close file handle on return\n\n\t\tfi, err := file.Stat()\n\t\tif fi.IsDir() {\n\t\t\treturn nil\n\t\t}\n\n\t\tpath = strings.Replace(path, searchDir, \"\", 1)\n\t\tfile_channel <- path // add file to the work channel (queue)\n\t\treturn nil\n\t})\n\n\t// add num_workers empty files on as termination signal to them\n\tfor i := 0; i < num_workers; i++ {\n\t\tfile_channel <- \"\"\n\t}\n}", "title": "" }, { "docid": "5ced26eb97e74634532553f88f02731a", "score": "0.62016153", "text": "func findGoFiles(dir string) (list []string, err error) {\n\terr = filepath.Walk(dir, func(name string, fi os.FileInfo, err error) error {\n\t\tif filepath.Base(name) == \"vendor\" {\n\t\t\treturn filepath.SkipDir\n\t\t}\n\n\t\tif filepath.Ext(name) == \".go\" {\n\t\t\trelpath, err := filepath.Rel(dir, name)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tlist = append(list, relpath)\n\t\t}\n\n\t\treturn err\n\t})\n\n\treturn list, err\n}", "title": "" }, { "docid": "99999f25989b0e8e7e4db8eaee2fbb4b", "score": "0.61980134", "text": "func getFilelist(fpath string) ([]string, error) {\n\tpaths := make([]string, 0)\n\terr := filepath.Walk(fpath, func(path string, f os.FileInfo, err error) error {\n\t\tif f == nil {\n\t\t\treturn err\n\t\t}\n\t\tif f.IsDir() {\n\t\t\treturn nil\n\t\t}\n\t\tpaths = append(paths, path)\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\tlog.Error(err)\n\t}\n\treturn paths, err\n}", "title": "" }, { "docid": "25fd9fe200ebd47e451a8e1314572427", "score": "0.618272", "text": "func GetVmFilesFromDir(path string) []string {\n\n\t// save a variable that will contain the array of file names.\n\tvar filename_list []string\n\n\t// create a list containing each of the files in the directory.\n\tfiles, err := ioutil.ReadDir(path)\n\tif err != nil {\n\t\tfailrar(err)\n\t}\n\n\t// check each of the file names for the extention \".vm\",\n\t// if a .vm is found, then add it to the list of filenames,\n\t// which will be returned at the end of the function.\n\tfor _, file := range files {\n\t\tif filepath.Ext(file.Name()) == \".vm\" {\n\t\t\tfilename_list = append(filename_list, file.Name())\n\t\t}\n\t}\n\treturn filename_list\n}", "title": "" }, { "docid": "22b06cdf7c9e1184abdc22b3754bfb2e", "score": "0.61809355", "text": "func GetAllFiles(fields []string) ([]File, error) {\r\n\r\n\t// Select only demanded fields\r\n\tvar query string\r\n\tif len(fields) > 0 {\r\n\t\tvar buffer bytes.Buffer\r\n\t\tbuffer.WriteString(\"SELECT \")\r\n\t\tlength := len(fields)\r\n\t\tfor index, field := range fields {\r\n\t\t\tbuffer.WriteString(field)\r\n\t\t\tif index < length-1 {\r\n\t\t\t\tbuffer.WriteString(\",\")\r\n\t\t\t}\r\n\t\t}\r\n\t\tbuffer.WriteString(\" FROM `files`\")\r\n\t\tquery = buffer.String()\r\n\t} else {\r\n\t\tquery = \"SELECT files.* FROM `files`\"\r\n\t}\r\n\r\n\t// Execute our query\r\n\trows, err := db.Cluster.Query(query, &gocb.QueryOptions{})\r\n\tif err != nil {\r\n\t\tfmt.Println(\"Error executing n1ql query:\", err)\r\n\t}\r\n\r\n\t// Interfaces for handling streaming return values\r\n\tvar row File\r\n\tvar retValues []File\r\n\r\n\t// Stream the values returned from the query into a typed array of structs\r\n\tfor rows.Next(&row) {\r\n\t\tretValues = append(retValues, row)\r\n\t}\r\n\r\n\treturn retValues, nil\r\n}", "title": "" }, { "docid": "f46414bd016e183fd0dedf638dac2326", "score": "0.617412", "text": "func dirwalk(dir string) ([]string, error) {\n files, err := ioutil.ReadDir(dir)\n if err != nil {\n return nil, err\n }\n\n var paths []string\n for _, file := range files {\n /* if file.IsDir() {\n paths = append(paths, dirwalk(filepath.Join(dir, file.Name()))...)\n continue\n }\n */\n paths = append(paths, file.Name())\n }\n\n return paths, err\n}", "title": "" }, { "docid": "9576a60df38d431850a76b3009736613", "score": "0.6172484", "text": "func GetAllReplayFiles(rootFolder string) (files []*ReplayFile, err error) {\n\terr = filepath.Walk(rootFolder,\n\t\tfunc(path string, info os.FileInfo, err error) error {\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"incoming error for %v: %v\",\n\t\t\t\t\tpath, err)\n\t\t\t}\n\t\t\tif IsRepalyInfo(info) {\n\t\t\t\tfiles = append(files, &ReplayFile{path, info})\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error when walking %v: %v\",\n\t\t\trootFolder, err)\n\t}\n\treturn files, nil\n}", "title": "" }, { "docid": "74abcc01e6f8a492f29ff7554fdd17df", "score": "0.6150834", "text": "func FindFiles(path string, filter FilePathFilterer) <-chan string {\n\tfiles := make(chan string, Workers)\n\tgo func() {\n\t\tfilepath.Walk(path, func(fpath string, info os.FileInfo, err error) error {\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tif info.IsDir() {\n\t\t\t\tif !filter.FilterPath(fpath) {\n\t\t\t\t\treturn filepath.SkipDir\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif filter.FilterFile(fpath) {\n\t\t\t\t\tfiles <- fpath\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\t\tclose(files)\n\t}()\n\treturn files\n}", "title": "" }, { "docid": "603709e30e087a6dd120886d4ee81e1f", "score": "0.6144749", "text": "func ListFilesInDir(directoryName string) []string {\n\tvar filesInDirectory []string\n\tfiles, err := ioutil.ReadDir(directoryName)\n\tExpect(err).ShouldNot(HaveOccurred())\n\n\tfor _, file := range files {\n\t\tfilesInDirectory = append(filesInDirectory, file.Name())\n\t}\n\treturn filesInDirectory\n}", "title": "" }, { "docid": "5b4522e13ed8ffb1735ff96170aa850b", "score": "0.61339676", "text": "func FindFiles(fileOrDir string) ([]string, error) {\n\tfiles := make([]string, 0, DefaultCaps)\n\n\tstat, err := os.Stat(fileOrDir)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif stat.IsDir() {\n\t\tif err := filepath.Walk(fileOrDir, func(fpath string, info os.FileInfo, err error) error {\n\t\t\tif info.IsDir() {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tif strings.HasSuffix(fpath, \".go\") {\n\t\t\t\tfiles = append(files, fpath)\n\t\t\t}\n\t\t\treturn nil\n\t\t}); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t} else {\n\t\tfiles = []string{fileOrDir}\n\t}\n\treturn files, nil\n}", "title": "" }, { "docid": "685bb2211032378781c62e24d3d8b3b4", "score": "0.61316276", "text": "func (storage *SFTPStorage) ListFiles(threadIndex int, dirPath string) (files []string, sizes []int64, err error) {\n\n entries, err := storage.client.ReadDir(path.Join(storage.storageDir, dirPath))\n if err != nil {\n return nil, nil, err\n }\n\n for _, entry := range entries {\n name := entry.Name()\n if entry.IsDir() && name[len(name) - 1] != '/' {\n name += \"/\"\n }\n\n files = append(files, name)\n sizes = append(sizes, entry.Size())\n }\n\n return files, sizes, nil\n}", "title": "" }, { "docid": "1f0f71aa1aca6e6689fe5805ff79962c", "score": "0.61196226", "text": "func listFiles() []string {\n\tvar list []string\n\tfiles, _ := ioutil.ReadDir(\"./images/\")\n\tfor _, f := range files {\n\t\tlist = append(list, f.Name())\n\t}\n\treturn list\n}", "title": "" }, { "docid": "a76c6a07387dc7485a1d6ecd9c1d26b5", "score": "0.61111474", "text": "func ListFiles(dir string, extFilter, nameFilter []string) []string {\n\tvar names []string\n\tvar ret []string\n\tif len(dir) == 0 {\n\t\tdir = \".\"\n\t}\n\tdirs, err := os.ReadDir(dir)\n\tif err != nil {\n\t\tlog.Println(\"read dir error:\", dir, err)\n\t\treturn nil\n\t}\n\tfor _, d := range dirs {\n\t\tif d.IsDir() {\n\t\t\ttmp := ListFiles(dir + \"/\" + d.Name(), extFilter, nameFilter)\n\t\t\tret = append(ret, tmp...)\n\t\t} else {\n\t\t\tnames = append(names, d.Name())\n\t\t}\n\t}\n\tfor _, n := range names {\n\t\text := filepath.Ext(dir + \"/\" + n)\n\t\tnonExtName := n[:len(n) - len(ext)]\n\t\tif HasIndex(ext, extFilter) {\n\t\t\tcontinue\n\t\t}\n\t\tif HasIndex(nonExtName, nameFilter) {\n\t\t\tcontinue\n\t\t}\n\t\tret = append(ret, dir + \"/\" + n)\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "357f0175e72d83ece414d96ee4f96b06", "score": "0.6110304", "text": "func filesIn(path string) ([]fileInfo, error) {\n\tfiles := []fileInfo{}\n\terr := filepath.Walk(path, func(path string, f os.FileInfo, err error) error {\n\t\tfiles = append(files, fileInfo{f, path})\n\t\treturn nil\n\t})\n\treturn files, err\n}", "title": "" } ]
2ce3c49a6cc96c24f82541c075cf2852
DeleteStickerFromSet Use this method to delete a sticker from a set created by the bot.
[ { "docid": "271b712690b427baeef0badb3cd31a36", "score": "0.8171988", "text": "func (b *Bot) DeleteStickerFromSet(sticker string) (ok bool, err error) {\n\tparams := map[string]interface{}{\n\t\t\"sticker\": sticker,\n\t}\n\n\tresult, err := b.call(\"deleteStickerFromSet\", params)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\treturn result.(bool), nil\n}", "title": "" } ]
[ { "docid": "a35636dc50e5b66ed896086b6cc8e96d", "score": "0.8802386", "text": "func (b *Bot) DeleteStickerFromSet(sticker string) error {\n\t_, err := b.Raw(\"deleteStickerFromSet\", map[string]string{\"sticker\": sticker})\n\treturn err\n\n}", "title": "" }, { "docid": "bd7d5cf42d0cf90e3d7f09ea3fd22491", "score": "0.84035486", "text": "func (b *Bot) DeleteStickerFromSet(ctx context.Context, request *DeleteStickerFromSetRequest) (result bool, err error) {\n\treturn result, b.postResult(ctx, \"deleteStickerFromSet\", request, &result)\n}", "title": "" }, { "docid": "7f623e43fb3fb81720645f58afb8a0f1", "score": "0.832338", "text": "func (b *Bot) DeleteStickerFromSet(sticker string) (result APIResponseBool) {\n\t// essential params\n\tparams := map[string]interface{}{\n\t\t\"sticker\": sticker,\n\t}\n\n\treturn b.requestResponseBool(\"deleteStickerFromSet\", params)\n}", "title": "" }, { "docid": "678264e9f30a1896ac2740ddf664e31b", "score": "0.8241023", "text": "func (bot *Bot) DeleteStickerFromSet(sticker string, opts *DeleteStickerFromSetOpts) (bool, error) {\n\tv := map[string]string{}\n\tv[\"sticker\"] = sticker\n\n\tvar reqOpts *RequestOpts\n\tif opts != nil {\n\t\treqOpts = opts.RequestOpts\n\t}\n\n\tr, err := bot.Request(\"deleteStickerFromSet\", v, nil, reqOpts)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tvar b bool\n\treturn b, json.Unmarshal(r, &b)\n}", "title": "" }, { "docid": "611e2d4ac8727e04580ca17116b9d219", "score": "0.82027423", "text": "func (b *API) DeleteStickerFromSet(sticker string) (bool, error) {\n\t_, err := b.requester.JSONRequest(\"deleteStickerFromSet\", map[string]interface{}{\n\t\t\"sticker\": sticker,\n\t})\n\n\treturn err == nil, err\n}", "title": "" }, { "docid": "0411b3c0ef4b83806b32b2ae8f02ef39", "score": "0.7964561", "text": "func (bot *Bot) DeleteStickerFromSet(sticker string) (bool, error) {\n\tdst, err := json.Marshal(&DeleteStickerFromSetParameters{Sticker: sticker})\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tresp, err := bot.request(dst, MethodDeleteStickerFromSet)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tvar data bool\n\terr = json.Unmarshal(*resp.Result, &data)\n\treturn data, err\n}", "title": "" }, { "docid": "7d7ef71d1c67f1bf011cd389c7f00c2d", "score": "0.7804432", "text": "func (bot *Bot) DeleteStickerSet(name string, opts *DeleteStickerSetOpts) (bool, error) {\n\tv := map[string]string{}\n\tv[\"name\"] = name\n\n\tvar reqOpts *RequestOpts\n\tif opts != nil {\n\t\treqOpts = opts.RequestOpts\n\t}\n\n\tr, err := bot.Request(\"deleteStickerSet\", v, nil, reqOpts)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tvar b bool\n\treturn b, json.Unmarshal(r, &b)\n}", "title": "" }, { "docid": "baed0e84f0221818b02e0319235fbfcd", "score": "0.77803314", "text": "func (client *Client) RemoveStickerFromSet(request *RemoveStickerFromSetRequest) (*Ok, error) {\n\t// Unlock receive function at the end of this function to mark received event as processed\n\tdefer client.Unlock(\"RemoveStickerFromSet\")\n\tresult, err := client.Send(Request{\n\t\tmeta: meta{\n\t\t\tType: \"removeStickerFromSet\",\n\t\t},\n\t\tData: map[string]interface{}{\n\t\t\t\"sticker\": request.Sticker,\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": "a10abff7753e035a07a18eca370ea7a7", "score": "0.7654367", "text": "func (b *Bot) DeleteChatStickerSet(req *DeleteChatStickerSetRequest) (json.RawMessage, error) {\n\treturn b.makeRequest(\"deleteChatStickerSet\", req)\n}", "title": "" }, { "docid": "08896fe9728c76fc738c6b6117b0c178", "score": "0.7503423", "text": "func (b *Bot) DeleteChatStickerSet(ctx context.Context, request *DeleteChatStickerSetRequest) (result bool, err error) {\n\treturn result, b.postResult(ctx, \"deleteChatStickerSet\", request, &result)\n}", "title": "" }, { "docid": "55267b3a4ef0202eac633e7e37113ccf", "score": "0.72581714", "text": "func (b *Bot) DeleteChatStickerSet(chatID ChatID) (result APIResponseBool) {\n\t// essential params\n\tparams := map[string]interface{}{\n\t\t\"chat_id\": chatID,\n\t}\n\n\treturn b.requestResponseBool(\"deleteChatStickerSet\", params)\n}", "title": "" }, { "docid": "27051acd8408dd16df73eae51bf12672", "score": "0.71511453", "text": "func (b *API) DeleteChatStickerSet(chatID string) (bool, error) {\n\tr := map[string]interface{}{\n\t\t\"chat_id\": chatID,\n\t}\n\n\t_, err := b.requester.JSONRequest(\"deleteChatStickerSet\", r)\n\n\treturn err == nil, err\n}", "title": "" }, { "docid": "6f1d3f71ee52e3df3822ef378c8e10a1", "score": "0.7009646", "text": "func (c *Context) DeleteChatStickerSet() (bool, error) {\n\treturn c.tg.DeleteChatStickerSet(c.ChatID())\n}", "title": "" }, { "docid": "a1d8d38b411e009fdd0e2ded25dbb9ef", "score": "0.6959506", "text": "func (bot *Bot) DeleteChatStickerSet(chatId int64, opts *DeleteChatStickerSetOpts) (bool, error) {\n\tv := map[string]string{}\n\tv[\"chat_id\"] = strconv.FormatInt(chatId, 10)\n\n\tvar reqOpts *RequestOpts\n\tif opts != nil {\n\t\treqOpts = opts.RequestOpts\n\t}\n\n\tr, err := bot.Request(\"deleteChatStickerSet\", v, nil, reqOpts)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tvar b bool\n\treturn b, json.Unmarshal(r, &b)\n}", "title": "" }, { "docid": "8100b7df3d7c192157df87a0e4bdd3d9", "score": "0.6940137", "text": "func (b Bot) DeleteChatStickerSet(cid int64) (bool, error) {\n\tsrc, err := b.Do(MethodDeleteChatStickerSet, DeleteChatStickerSet{ChatID: cid})\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tresp := new(Response)\n\tif err = b.marshler.Unmarshal(src, resp); err != nil {\n\t\treturn false, err\n\t}\n\n\tvar result bool\n\tif err = b.marshler.Unmarshal(resp.Result, &result); err != nil {\n\t\treturn false, err\n\t}\n\n\treturn result, nil\n}", "title": "" }, { "docid": "d2bacaaa9d47391fac8e819d06dee83a", "score": "0.6831573", "text": "func NewDeleteChatStickerSet(chatID int64) *DeleteChatStickerSet {\n\tmethod := new(DeleteChatStickerSet)\n\tmethod.ChatID = chatID\n\treturn method\n}", "title": "" }, { "docid": "6c3a58e22c0553ad16a0ccaed99f5127", "score": "0.62399024", "text": "func (s *topoService) DeleteSet(params types.ContextParams, pathParams, queryParams ParamsGetter, data frtypes.MapStr) (interface{}, error) {\n\n\tif \"batch\" == pathParams(\"set_id\") {\n\t\treturn s.DeleteSets(params, pathParams, queryParams, data)\n\t}\n\n\tbizID, err := strconv.ParseInt(pathParams(\"app_id\"), 10, 64)\n\tif nil != err {\n\t\tblog.Errorf(\"[api-set]failed to parse the biz id, error info is %s\", err.Error())\n\t\treturn nil, params.Err.Errorf(common.CCErrCommParamsNeedInt, \"business id\")\n\t}\n\n\tsetID, err := strconv.ParseInt(pathParams(\"set_id\"), 10, 64)\n\tif nil != err {\n\t\tblog.Errorf(\"[api-set]failed to parse the set id, error info is %s\", err.Error())\n\t\treturn nil, params.Err.Errorf(common.CCErrCommParamsNeedInt, \"set id\")\n\t}\n\n\tobj, err := s.core.ObjectOperation().FindSingleObject(params, common.BKInnerObjIDSet)\n\n\tif nil != err {\n\t\tblog.Errorf(\"failed to search the set, %s\", err.Error())\n\t\treturn nil, err\n\t}\n\n\treturn nil, s.core.SetOperation().DeleteSet(params, obj, bizID, []int64{setID})\n}", "title": "" }, { "docid": "58956fc943664eb599eab029ac1422c0", "score": "0.62363523", "text": "func (e *Exercise) deleteSet() {\n\tif len(e.Sets) == 0 {\n\t\tfmt.Println(\"Nothing to Delete here :)\")\n\t} else {\n\t\te.Sets = e.Sets[:len(e.Sets)-2]\n\t}\n}", "title": "" }, { "docid": "d035cc2a6c48f2abdb3c4cdf39751096", "score": "0.6225095", "text": "func (cc *Conn) DelSet(s *Set) {\n\tcc.mu.Lock()\n\tdefer cc.mu.Unlock()\n\tdata := cc.marshalAttr([]netlink.Attribute{\n\t\t{Type: unix.NFTA_SET_TABLE, Data: []byte(s.Table.Name + \"\\x00\")},\n\t\t{Type: unix.NFTA_SET_NAME, Data: []byte(s.Name + \"\\x00\")},\n\t})\n\tcc.messages = append(cc.messages, netlink.Message{\n\t\tHeader: netlink.Header{\n\t\t\tType: netlink.HeaderType((unix.NFNL_SUBSYS_NFTABLES << 8) | unix.NFT_MSG_DELSET),\n\t\t\tFlags: netlink.Request | netlink.Acknowledge,\n\t\t},\n\t\tData: append(extraHeader(uint8(s.Table.Family), 0), data...),\n\t})\n}", "title": "" }, { "docid": "494acaf2dfb5aa65d0602f28ad7c1538", "score": "0.6100792", "text": "func (runner *runner) DestroySet(set string) error {\n\tif _, err := runner.exec.Command(IPSetCmd, \"destroy\", set).CombinedOutput(); err != nil {\n\t\treturn fmt.Errorf(\"error destroying set %s:, error: %v\", set, err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bea39b3b4ce8c4c606c5b7aae0760895", "score": "0.6034163", "text": "func (r *DeleteChatStickerSet) Method() string {\n\treturn \"deleteChatStickerSet\"\n}", "title": "" }, { "docid": "6a7b0f9147c20c26e8ab4a72457de4fb", "score": "0.59311646", "text": "func (c *Client) StickerDelete(uri string, name string) error {\n\treturn c.Command(\"sticker delete song %s %s\", uri, name).OK()\n}", "title": "" }, { "docid": "89c7cf8bd705a109ad3bc5259e1bd89d", "score": "0.59155446", "text": "func (s Set[T]) RemoveSet(t Set[T]) Set[T] {\n\tfor v := range t {\n\t\tdelete(s, v)\n\t}\n\treturn s\n}", "title": "" }, { "docid": "a4acf08f51037136c1fc70cdd1f54978", "score": "0.5812117", "text": "func DeleteStatefulSet(mdb *mdbv1.MongoDBCommunity) func(*testing.T) {\n\treturn func(t *testing.T) {\n\t\tsts := appsv1.StatefulSet{\n\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\tName: mdb.Name,\n\t\t\t\tNamespace: mdb.Namespace,\n\t\t\t},\n\t\t}\n\t\tif err := e2eutil.TestClient.Delete(context.TODO(), &sts); err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\n\t\tt.Logf(\"StatefulSet %s/%s deleted\", sts.ObjectMeta.Namespace, sts.ObjectMeta.Name)\n\t}\n}", "title": "" }, { "docid": "63cfb47e7a5f48e3cb19f8430271629e", "score": "0.5585867", "text": "func (t *RoutingPolicy_DefinedSets) DeleteTagSet(Name string) {\n\tkey := Name\n\n\tdelete(t.TagSet, key)\n}", "title": "" }, { "docid": "b39f1180654b2259214b32604650b1a7", "score": "0.55748856", "text": "func (cc *ClusterController) delFromClusterSet(obj interface{}) {\n\tcluster := obj.(*federationv1beta1.Cluster)\n\tcc.delFromClusterSetByName(cluster.Name)\n}", "title": "" }, { "docid": "13cfedfebe9f2744372b22d795fd67da", "score": "0.55584997", "text": "func (b *API) GetStickerSet(name string) (*models.StickerSet, error) {\n\tdata, err := b.requester.JSONRequest(\"setMyCommands\", map[string]interface{}{\n\t\t\"name\": name,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar response models.StickerSet\n\terr = json.Unmarshal(data, &response)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &response, nil\n}", "title": "" }, { "docid": "5dfcb1f2a5e0004761cffaff269d0d04", "score": "0.55262995", "text": "func (s *safeIpset) DestroySet(set string) error {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\treturn s.ipset.DestroySet(set)\n}", "title": "" }, { "docid": "837b3074d3a4aa7b9e4d2bd46bab45e2", "score": "0.55241024", "text": "func (qr *QuestionSetRepo) DeleteQuestionSet(ctx context.Context, id string) error {\n\tobjID, err := primitive.ObjectIDFromHex(id)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfilter := bson.M{\"_id\": objID}\n\t_, err = qr.DeleteOne(ctx, filter)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n\n}", "title": "" }, { "docid": "baec2932535319242811eb577ef017a3", "score": "0.5518787", "text": "func (p StatefulSet) Delete() error {\n\treturn p.Client.Delete(p.StatefulSet.Name, nil)\n}", "title": "" }, { "docid": "da9d3d0a8778efe889e3e1f6075f6624", "score": "0.54665077", "text": "func (rcc *Controller) deleteStatefulSet(obj interface{}) {\n\tset, ok := obj.(*apps.StatefulSet)\n\tns := set.GetNamespace()\n\tsetName := set.GetName()\n\n\t// When a delete is dropped, the relist will notice a statefuset in the store not\n\t// in the list, leading to the insertion of a tombstone object which contains\n\t// the deleted key/value.\n\tif !ok {\n\t\ttombstone, ok := obj.(cache.DeletedFinalStateUnknown)\n\t\tif !ok {\n\t\t\tutilruntime.HandleError(fmt.Errorf(\"couldn't get object from tombstone %+v\", obj))\n\t\t\treturn\n\t\t}\n\t\tset, ok = tombstone.Obj.(*apps.StatefulSet)\n\t\tif !ok {\n\t\t\tutilruntime.HandleError(fmt.Errorf(\"tombstone contained object that is not a statefuset %+v\", obj))\n\t\t\treturn\n\t\t}\n\t}\n\n\t// If it has a Redis, that's all that matters.\n\trc := rcc.resolveRedisFromSet(ns, set)\n\tif rc == nil {\n\t\treturn\n\t}\n\tglog.Infof(\"StatefulSet %s/%s deleted through %v.\", ns, setName, utilruntime.GetCaller())\n\trcc.enqueueRedis(rc)\n}", "title": "" }, { "docid": "6d0638994e5830d4297435bd8eddf578", "score": "0.54331994", "text": "func RemoveFromSet(nfti *NFTInterface, tableFamily nftables.TableFamily, proto v1.Protocol, addr string, port uint16,\n\tset string, chain string) error {\n\tsi := nfti.SIv4\n\tipaddr := net.ParseIP(addr).To4()\n\tdataType := nftables.TypeIPAddr\n\tif tableFamily == nftables.TableFamilyIPv6 {\n\t\tsi = nfti.SIv6\n\t\tipaddr = net.ParseIP(addr).To16()\n\t\tdataType = nftables.TypeIP6Addr\n\t}\n\n\tse := []nftables.SetElement{}\n\tra := setActionVerdict(unix.NFT_JUMP, chain)\n\tprotoB := protoByteFromV1Proto(proto)\n\telement, err := nftableslib.MakeConcatElement([]nftables.SetDatatype{nftables.TypeInetProto, dataType, nftables.TypeInetService},\n\t\t[]nftableslib.ElementValue{{InetProto: &protoB}, {IPAddr: ipaddr}, {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(set, se); err != nil {\n\t\tif errors.Is(err, unix.EBUSY) {\n\t\t\t// TODO Add logic to retry, for now just error out\n\t\t\tklog.Errorf(\"RemoveFromSet %s for %s:%s:%d failed with error: %v\", set, proto, addr, 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(\"RemoveFromSet %s does not find entry for %s:%s:%d\", set, proto, addr, port)\n\t\t\treturn nil\n\t\t}\n\t\tklog.Errorf(\"RemoveFromSet %s for %s:%s:%d failed with error: %v\", set, proto, addr, port, errors.Unwrap(err))\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ee8b36b58e8b105e1c93a70c9a986699", "score": "0.5389729", "text": "func (ccc *Controller) deleteStatefulSet(obj interface{}) {\n\tset, ok := obj.(*apps.StatefulSet)\n\tns := set.GetNamespace()\n\tsetName := set.GetName()\n\n\t// When a delete is dropped, the relist will notice a statefuset in the store not\n\t// in the list, leading to the insertion of a tombstone object which contains\n\t// the deleted key/value.\n\tif !ok {\n\t\ttombstone, ok := obj.(cache.DeletedFinalStateUnknown)\n\t\tif !ok {\n\t\t\tutilruntime.HandleError(fmt.Errorf(\"couldn't get object from tombstone %+v\", obj))\n\t\t\treturn\n\t\t}\n\t\tset, ok = tombstone.Obj.(*apps.StatefulSet)\n\t\tif !ok {\n\t\t\tutilruntime.HandleError(fmt.Errorf(\"tombstone contained object that is not a statefuset %+v\", obj))\n\t\t\treturn\n\t\t}\n\t}\n\n\t// If it has a CellCluster, that's all that matters.\n\tcc := ccc.resolveCellClusterFromSet(ns, set)\n\tif cc == nil {\n\t\treturn\n\t}\n\tglog.V(4).Infof(\"StatefulSet %s/%s deleted through %v.\", ns, setName, utilruntime.GetCaller())\n\tccc.enqueueCellCluster(cc)\n}", "title": "" }, { "docid": "3d77303be218055f6ed2c6f4da328ad9", "score": "0.53867435", "text": "func DeleteDeploySet(cli bce.Client, deploySetId string) error {\n\t// Build the request\n\treq := &bce.BceRequest{}\n\treq.SetUri(getDeploySetUriWithId(deploySetId))\n\treq.SetMethod(http.DELETE)\n\n\t// Send request and get response\n\tresp := &bce.BceResponse{}\n\tif err := cli.SendRequest(req, resp); err != nil {\n\t\treturn err\n\t}\n\tif resp.IsFail() {\n\t\treturn resp.ServiceError()\n\t}\n\n\tdefer func() { resp.Body().Close() }()\n\n\treturn nil\n}", "title": "" }, { "docid": "98d5e171b0c75ac0cdb8adefebb2f02c", "score": "0.53632283", "text": "func (c *ClientSet) Del(cl *Client) {\n\tc.byID.Remove(cl.ID)\n\tc.byNick.Remove(NickSort(cl.Nick))\n}", "title": "" }, { "docid": "f2479fe4b3d95f0faf914fd88360c92b", "score": "0.5356282", "text": "func (bot *Engine) GetStickerSet(config GetStickerSetConfig) (StickerSet, error) {\n\tresp, err := bot.Request(config)\n\tif err != nil {\n\t\treturn StickerSet{}, err\n\t}\n\n\tvar stickers StickerSet\n\terr = json.Unmarshal(resp.Result, &stickers)\n\n\treturn stickers, err\n}", "title": "" }, { "docid": "b6c4a10f36df476042dd2127a5a522ef", "score": "0.5352202", "text": "func (c *Client) StickerSet(uri string, name string, value string) error {\n\treturn c.Command(\"sticker set song %s %s %s\", uri, name, value).OK()\n}", "title": "" }, { "docid": "150f29234c15c0ef919c3104c02721d4", "score": "0.5332803", "text": "func (c *FakeImportedServiceSets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {\n\t_, err := c.Fake.\n\t\tInvokes(testing.NewDeleteAction(importedservicesetsResource, c.ns, name), &federationv1.ImportedServiceSet{})\n\n\treturn err\n}", "title": "" }, { "docid": "392f80ffcdecdd4bc770d1e8c148f969", "score": "0.53243935", "text": "func (b *Bot) SetChatStickerSet(req *SetChatStickerSetRequest) (json.RawMessage, error) {\n\treturn b.makeRequest(\"setChatStickerSet\", req)\n}", "title": "" }, { "docid": "13a1d50888eaf8755f0bde5ccfef545d", "score": "0.53034186", "text": "func (client *Client) DeleteTagSet(request *DeleteTagSetRequest) (response *DeleteTagSetResponse, err error) {\n\tresponse = CreateDeleteTagSetResponse()\n\terr = client.DoAction(request, response)\n\treturn\n}", "title": "" }, { "docid": "cb1d7f2c72bbcb854e4e3514af9a0d36", "score": "0.52782506", "text": "func (b *Bot) GetStickerSet(name string) (*StickerSet, error) {\n\tdata, err := b.Raw(\"getStickerSet\", map[string]string{\"name\": name})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar resp struct {\n\t\tResult *StickerSet\n\t}\n\tif err := json.Unmarshal(data, &resp); err != nil {\n\t\treturn nil, wrapError(err)\n\t}\n\treturn resp.Result, nil\n}", "title": "" }, { "docid": "3768e3bccea9ff2a467fa0c571385872", "score": "0.52767813", "text": "func DeleteStatefulSet(clientset *kubernetes.Clientset, namespace string, name string) error {\n\n\tclient := clientset.AppsV1().StatefulSets(getValidNameSpace(namespace))\n\n\tdeletePolicy := metav1.DeletePropagationForeground\n\n\treturn client.Delete(name, &metav1.DeleteOptions{\n\t\tPropagationPolicy: &deletePolicy,\n\t})\n}", "title": "" }, { "docid": "aefd3a4911246c19e525cb1bc28fe552", "score": "0.5266404", "text": "func (rco *RedisClusterOperator) deleteStatefulSet(obj interface{}) {\n\tsts, ok := obj.(*appsv1.StatefulSet)\n\n\t// When a delete is dropped, the relist will notice a pod in the store not\n\t// in the list, leading to the insertion of a tombstone object which contains\n\t// the deleted key/value. Note that this value might be stale. If the statefulSet\n\t// changed labels the new rediscluster will not be woken up till the periodic resync.\n\tif !ok {\n\t\ttombstone, ok := obj.(cache.DeletedFinalStateUnknown)\n\t\tif !ok {\n\t\t\tutilruntime.HandleError(fmt.Errorf(\"Couldn't get object from tombstone %#v\", obj))\n\t\t\treturn\n\t\t}\n\t\tsts, ok = tombstone.Obj.(*appsv1.StatefulSet)\n\t\tif !ok {\n\t\t\tutilruntime.HandleError(fmt.Errorf(\"Tombstone contained object that is not a statefulSet %#v\", obj))\n\t\t\treturn\n\t\t}\n\t}\n\n\trcs := rco.getRedisClustersForStatefulSet(sts)\n\tif rcs == nil {\n\t\treturn\n\t}\n\tglog.V(4).Infof(\"StatefulSet %s deleted.\", sts.Name)\n\trco.enqueueRedisCluster(rcs)\n}", "title": "" }, { "docid": "bc630fe8cfacd606807e17634f418278", "score": "0.52622634", "text": "func (bot *Bot) GetStickerSet(name string, opts *GetStickerSetOpts) (*StickerSet, error) {\n\tv := map[string]string{}\n\tv[\"name\"] = name\n\n\tvar reqOpts *RequestOpts\n\tif opts != nil {\n\t\treqOpts = opts.RequestOpts\n\t}\n\n\tr, err := bot.Request(\"getStickerSet\", v, nil, reqOpts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar s StickerSet\n\treturn &s, json.Unmarshal(r, &s)\n}", "title": "" }, { "docid": "753ca1e9dcc1b065126f15fd431c0c3a", "score": "0.5258033", "text": "func (b *Bot) GetStickerSet(name string) (result APIResponseStickerSet) {\n\t// essential params\n\tparams := map[string]interface{}{\n\t\t\"name\": name,\n\t}\n\n\treturn b.requestResponseStickerSet(\"getStickerSet\", params)\n}", "title": "" }, { "docid": "fd1740a998044c7f1bf1fa6528268d5e", "score": "0.52430713", "text": "func (dm *DataManager) DeleteConfigSet(ctx context.Context, req *pb.DeleteConfigSetReq) (*pb.DeleteConfigSetResp, error) {\n\trtime := time.Now()\n\tlogger.V(2).Infof(\"DeleteConfigSet[%d]| input[%+v]\", req.Seq, req)\n\tresponse := &pb.DeleteConfigSetResp{Seq: req.Seq, ErrCode: pbcommon.ErrCode_E_OK, ErrMsg: \"OK\"}\n\n\tdefer func() {\n\t\tcost := dm.collector.StatRequest(\"DeleteConfigSet\", response.ErrCode, rtime, time.Now())\n\t\tlogger.V(2).Infof(\"DeleteConfigSet[%d]| output[%dms][%+v]\", req.Seq, cost, response)\n\t}()\n\n\taction := configsetaction.NewDeleteAction(dm.viper, dm.smgr, req, response)\n\tdm.executor.Execute(action)\n\n\treturn response, nil\n}", "title": "" }, { "docid": "3edd6185574387e26f8c21a587bf684f", "score": "0.52372766", "text": "func (uw *updateWrap) DeleteStringsFromSet(path string, values ...string) Update {\n\treturn &updateWrap{\n\t\tupdate: uw.update.DeleteStringsFromSet(path, values...),\n\t}\n}", "title": "" }, { "docid": "dc1510e891eaa2df0a8a5d6741e36f5c", "score": "0.52123594", "text": "func (b *Bot) GetStickerSet(name string) (*StickerSet, error) {\n\tparams := map[string]string{\n\t\t\"name\": name,\n\t}\n\n\tresult, err := b.call(\"getStickerSet\", params)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*StickerSet), nil\n}", "title": "" }, { "docid": "ef8abf966414c5fc3a3baab603f69bde", "score": "0.52121496", "text": "func (state *TxSetState) Delete(txSetID string) error {\n\ttxSetStateLogger.Debugf(\"delete() txSetID=[%s]\", txSetID)\n\tif !state.txInProgress() {\n\t\tpanic(\"State can be changed only in context of a tx.\")\n\t}\n\t// Need to lookup the previous value\n\tpreviousStateValue, err := state.Get(txSetID, true)\n\tif err != nil {\n\t\treturn err\n\t}\n\tstate.currentTxSetStateDelta.Delete(txSetID, previousStateValue)\n\treturn nil\n}", "title": "" }, { "docid": "054862fdb3f29781ae59fce1ea049e05", "score": "0.5176613", "text": "func (k Keeper) DeleteValset(ctx sdk.Context, nonce uint64) {\n\tctx.KVStore(k.storeKey).Delete(types.GetValsetKey(nonce))\n}", "title": "" }, { "docid": "993fb4a9a775b400a6cbd6d83890722f", "score": "0.51435465", "text": "func (c *Context) SetChatStickerSet(stickerSetName string) (bool, error) {\n\treturn c.tg.SetChatStickerSet(c.ChatID(), stickerSetName);\n}", "title": "" }, { "docid": "736bd8d970c30199b175f570716b3d17", "score": "0.5140214", "text": "func (s *Set) Remove(c CidChannelPair) {\n\tdelete(s.set, c)\n}", "title": "" }, { "docid": "019f09d7743b29399331b2b44cb2165c", "score": "0.5124251", "text": "func (bot *Bot) SetChatStickerSet(chatId int64, stickerSetName string, opts *SetChatStickerSetOpts) (bool, error) {\n\tv := map[string]string{}\n\tv[\"chat_id\"] = strconv.FormatInt(chatId, 10)\n\tv[\"sticker_set_name\"] = stickerSetName\n\n\tvar reqOpts *RequestOpts\n\tif opts != nil {\n\t\treqOpts = opts.RequestOpts\n\t}\n\n\tr, err := bot.Request(\"setChatStickerSet\", v, nil, reqOpts)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tvar b bool\n\treturn b, json.Unmarshal(r, &b)\n}", "title": "" }, { "docid": "b9c1b5d2a9101d666a0621df14b64db5", "score": "0.5123334", "text": "func (s *PolicySets) RemovePolicySet(setId string) {\n\tlog.WithField(\"setId\", setId).Info(\"Processing removal of Policy set\")\n\tdelete(s.policySetIdToPolicySet, setId)\n}", "title": "" }, { "docid": "6da852d2b2c48c1afca67d090435deb2", "score": "0.5122797", "text": "func (client *Client) RemoveFavoriteSticker(request *RemoveFavoriteStickerRequest) (*Ok, error) {\n\t// Unlock receive function at the end of this function to mark received event as processed\n\tdefer client.Unlock(\"RemoveFavoriteSticker\")\n\tresult, err := client.Send(Request{\n\t\tmeta: meta{\n\t\t\tType: \"removeFavoriteSticker\",\n\t\t},\n\t\tData: map[string]interface{}{\n\t\t\t\"sticker\": request.Sticker,\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": "ac37a0ad063894d3f36aea61d846eed6", "score": "0.5117725", "text": "func (b *Bot) GetStickerSet(ctx context.Context, request *GetStickerSetRequest) (result *StickerSet, err error) {\n\tresult = new(StickerSet)\n\treturn result, b.postResult(ctx, \"getStickerSet\", request, &result)\n}", "title": "" }, { "docid": "4899e69bef37dcf30efd3bd8ff6d4e66", "score": "0.5113752", "text": "func (db *DataBase) DeletePack(user *tg.User, sticker *tg.Sticker) (bool, error) {\n\tlog.Ln(\"Trying to remove all\", sticker.SetName, \"sticker from\", user.ID, \"user\")\n\tif sticker.SetName == \"\" {\n\t\tsticker.SetName = models.SetUploaded\n\t}\n\n\tvar ids []string\n\terr := db.View(func(tx *buntdb.Tx) error {\n\t\treturn tx.AscendKeys(\n\t\t\tfmt.Sprint(\"user:\", user.ID, \":set:\", sticker.SetName, \":*\"),\n\t\t\tfunc(key, val string) bool {\n\t\t\t\tkeys := strings.Split(key, \":\")\n\t\t\t\tids = append(ids, keys[5])\n\t\t\t\treturn true\n\t\t\t},\n\t\t)\n\t})\n\n\tif len(ids) == 0 {\n\t\treturn true, nil\n\t}\n\n\tfor _, id := range ids {\n\t\tvar notExist bool\n\t\tnotExist, err = db.DeleteSticker(user, &tg.Sticker{FileID: id})\n\t\tif err != nil {\n\t\t\treturn notExist, err\n\t\t}\n\t}\n\n\tif err == buntdb.ErrNotFound {\n\t\tlog.Ln(user.ID, \"not found\")\n\t\treturn true, nil\n\t}\n\n\treturn false, err\n}", "title": "" }, { "docid": "bb9423f25a44011cbc41ce4c54b737ef", "score": "0.51059526", "text": "func (b *Bot) SetChatStickerSet(ctx context.Context, request *SetChatStickerSetRequest) (result bool, err error) {\n\treturn result, b.postResult(ctx, \"setChatStickerSet\", request, &result)\n}", "title": "" }, { "docid": "a68cd5c7ba8f79c00df4e76cc4d820cb", "score": "0.50692755", "text": "func (a *AppService) DeleteStatefulSet(d *v1.StatefulSet) {\n\ta.statefulset = nil\n}", "title": "" }, { "docid": "3de67365ca9e2e039f70a20635e5fbbe", "score": "0.5068373", "text": "func (r *RDB) DeleteAggregationSet(ctx context.Context, qname, gname, setID string) error {\n\tvar op errors.Op = \"RDB.DeleteAggregationSet\"\n\tkeys := []string{\n\t\tbase.AggregationSetKey(qname, gname, setID),\n\t\tbase.AllAggregationSets(qname),\n\t}\n\treturn r.runScript(ctx, op, deleteAggregationSetCmd, keys, base.TaskKeyPrefix(qname))\n}", "title": "" }, { "docid": "3b0985a439ac21a8f6587a0e637bff66", "score": "0.5053388", "text": "func (mapOp *riakMapOperation) RemoveFromSet(key string, value []byte) *riakMapOperation {\n\n\tif mapOp.removeFromSets == nil {\n\t\tmapOp.removeFromSets = make(map[string][][]byte)\n\t}\n\tmapOp.removeFromSets[key] = append(mapOp.removeFromSets[key], value)\n\treturn mapOp\n}", "title": "" }, { "docid": "a3a6a4f3af365ecad5cdd12e127a66e9", "score": "0.50468916", "text": "func (client *Client) GetStickerSet(request *GetStickerSetRequest) (*StickerSet, error) {\n\t// Unlock receive function at the end of this function to mark received event as processed\n\tdefer client.Unlock(\"GetStickerSet\")\n\tresult, err := client.Send(Request{\n\t\tmeta: meta{\n\t\t\tType: \"getStickerSet\",\n\t\t},\n\t\tData: map[string]interface{}{\n\t\t\t\"set_id\": request.SetID,\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 UnmarshalStickerSet(result.Data)\n}", "title": "" }, { "docid": "ebacdf040ee664a1ecf0b79b2c9be48f", "score": "0.50440705", "text": "func (client *Client) ChangeStickerSet(request *ChangeStickerSetRequest) (*Ok, error) {\n\t// Unlock receive function at the end of this function to mark received event as processed\n\tdefer client.Unlock(\"ChangeStickerSet\")\n\tresult, err := client.Send(Request{\n\t\tmeta: meta{\n\t\t\tType: \"changeStickerSet\",\n\t\t},\n\t\tData: map[string]interface{}{\n\t\t\t\"set_id\": request.SetID,\n\t\t\t\"is_installed\": request.IsInstalled,\n\t\t\t\"is_archived\": request.IsArchived,\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": "4d2c82ec497b956b8a5d529b9116e221", "score": "0.50420684", "text": "func (dp *DataPlane) RemoveFromSets(setNames []*ipsets.IPSetMetadata, podMetadata *PodMetadata) error {\n\terr := dp.ipsetMgr.RemoveFromSets(setNames, podMetadata.PodIP, podMetadata.PodKey)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"[DataPlane] error while removing from set: %w\", err)\n\t}\n\n\tif dp.shouldUpdatePod() && podMetadata.NodeName == dp.nodeName {\n\t\tklog.Infof(\"[DataPlane] Updating Sets to Remove for pod key %s\", podMetadata.PodKey)\n\n\t\t// lock updatePodCache while reading/modifying or setting the updatePod in the cache\n\t\tdp.updatePodCache.Lock()\n\t\tdefer dp.updatePodCache.Unlock()\n\n\t\tupdatePod := dp.updatePodCache.enqueue(podMetadata)\n\t\tupdatePod.updateIPSetsToRemove(setNames)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f66fc806bc52f4e21f0acf231fabd106", "score": "0.50414896", "text": "func (b *Bot) SetChatStickerSet(chatID ChatID, stickerSetName string) (result APIResponseBool) {\n\t// essential params\n\tparams := map[string]interface{}{\n\t\t\"chat_id\": chatID,\n\t\t\"sticker_set_name\": stickerSetName,\n\t}\n\n\treturn b.requestResponseBool(\"setChatStickerSet\", params)\n}", "title": "" }, { "docid": "75a5bc3bd07e59cc40791c1fa65aae93", "score": "0.5039793", "text": "func (s *SnowflakeSet) Delete(flake discord.Snowflake) bool {\n\ts.mut.Lock()\n\tdefer s.mut.Unlock()\n\n\tif _, ok := s.set[flake]; ok {\n\t\tdelete(s.set, flake)\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "0f869d81265cbc8babaadcaa440bd7d0", "score": "0.50324774", "text": "func (s Set) Remove(str string) {\n\tdelete(s, str)\n}", "title": "" }, { "docid": "3f1e8bf02eb9e841af7371acbc870bce", "score": "0.50210744", "text": "func (mD *MouseButtonDispatcher) RemoveMouseButtonSet(key uint) {\n\tfor i, k := range mD.mouseButtonSets {\n\t\tif k.key == key {\n\t\t\tmD.mouseButtonSets = append(mD.mouseButtonSets[:i], mD.mouseButtonSets[i+1:]...)\n\t\t\tif i < mD.numActiveMouseButtonSets {\n\n\t\t\t\tmD.numActiveMouseButtonSets--\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e50b8c9b79f3787545367ff294b08ed3", "score": "0.49913394", "text": "func Del(shieldID, pointID string) error {\n\treturn Singleton.Del(shieldID, pointID)\n}", "title": "" }, { "docid": "44eadd3bbe07de45bb355c1c2dff7e3b", "score": "0.4981496", "text": "func (s Set) Del(name string) {\n\tdelete(s, name)\n}", "title": "" }, { "docid": "4d45c5f3409d7f6861dca15710a1d0cb", "score": "0.4976609", "text": "func (t *syncset) Remove(key string) {\n\n\tt.Lock()\n\tt.set.Remove(key)\n\tt.Unlock()\n}", "title": "" }, { "docid": "46e0a692819b054c67be05e00d26d70c", "score": "0.49670675", "text": "func (r *Reconciler) cleanClusterSetResource(clustersetName string) error {\n\t//Delete clusterset clusterrole\n\terr := utils.DeleteClusterRole(r.kubeClient, utils.GenerateClustersetClusterroleName(clustersetName, \"admin\"))\n\tif err != nil {\n\t\tklog.Warningf(\"will reconcile since failed to delete clusterrole. clusterset: %v, err: %v\", clustersetName, err)\n\t\treturn err\n\t}\n\terr = utils.DeleteClusterRole(r.kubeClient, utils.GenerateClustersetClusterroleName(clustersetName, \"view\"))\n\tif err != nil {\n\t\tklog.Warningf(\"will reconcile since failed to delete clusterrole. clusterset: %v, err: %v\", clustersetName, err)\n\t\treturn err\n\t}\n\n\t//Delete clusterset which in clustersetMapper\n\tr.clusterSetClusterMapper.DeleteClusterSet(clustersetName)\n\tr.clusterSetNamespaceMapper.DeleteClusterSet(clustersetName)\n\n\treturn nil\n}", "title": "" }, { "docid": "74a7fc21d71d00b35479100ccdfd0d62", "score": "0.49665672", "text": "func (store *managerStore) DeleteDaemonset(ns, name string) error {\n\treturn fmt.Errorf(\"zookeeper store don't support Daemonset, Please switch to the etcd store\")\n}", "title": "" }, { "docid": "43b5ebfc625d41a5a0d92bb2e8a9b9dc", "score": "0.49647468", "text": "func (z *Zone) RemoveRRset(s string, t uint16) error {\n\tz.Lock()\n\tdefer z.Unlock()\n\tzd, ok := z.Names[s]\n\tif !ok {\n\t\treturn nil\n\t}\n\tz.ModTime = time.Now().UTC()\n\tswitch t {\n\tcase TypeRRSIG:\n\t\t// empty all signature maps\n\t\tfor cover, _ := range zd.Signature {\n\t\t\tdelete(zd.Signature, cover)\n\t\t}\n\tdefault:\n\t\t// empty all rr maps\n\t\tfor t, _ := range zd.RR {\n\t\t\tdelete(zd.RR, t)\n\t\t}\n\t}\n\tif len(zd.RR) == 0 && len(zd.Signature) == 0 {\n\t\t// Entire node is empty, remove it from the Zone too\n\t\tdelete(z.Names, s)\n\t\ti := sort.SearchStrings(z.sortedNames.nsecNames, s)\n\t\t// we actually removed something if we are here, so i must be something sensible\n\t\tcopy(z.sortedNames.nsecNames[i:], z.sortedNames.nsecNames[i+1:])\n\t\tz.sortedNames.nsecNames[len(z.sortedNames.nsecNames)-1] = \"\"\n\t\tz.sortedNames.nsecNames = z.sortedNames.nsecNames[:len(z.sortedNames.nsecNames)-1]\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "da02bac1540f2b3149dfc93d2d1e198b", "score": "0.4949336", "text": "func (e *Edge) DeleteConfigSet(ctx context.Context, configSetID int64) error {\n\tconfigSet, err := e.db.GetEdgeConfigSet(configSetID)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to get edge configset, configSetID: %d, err: (%v)\", configSetID, err)\n\t}\n\n\t// If configSet depend on application, can't delete it.\n\tedgeApps, err := e.db.GetEdgeAppByConfigSet(configSet.Name, configSet.ClusterID)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to get releated app\")\n\t}\n\tif len(*edgeApps) > 0 {\n\t\trelatedApps := make([]string, 0)\n\t\tfor _, relatedApp := range *edgeApps {\n\t\t\trelatedApps = append(relatedApps, relatedApp.Name)\n\t\t}\n\t\treturn fmt.Errorf(\"application %s have related this configset\", fmt.Sprint(relatedApps))\n\t}\n\n\tif err = e.db.DeleteEdgeConfigSet(configSetID); err != nil {\n\t\treturn fmt.Errorf(\"failed to delete edge configset, (%v)\", err)\n\t}\n\n\tclusterInfo, err := e.getClusterInfo(ctx, configSet.ClusterID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err = e.db.DeleteEdgeCfgSetItemByCfgID(configSetID); err != nil {\n\t\treturn err\n\t}\n\n\tnsName, err := e.getConfigSetName(configSet.OrgID, configSet.Name)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = e.k8s.DeleteNamespace(clusterInfo.Name, nsName)\n\n\tif err != nil {\n\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "bbc4d36a0d6fe4924a89ec612fed7c53", "score": "0.49488142", "text": "func (client *Client) RemoveRecentSticker(request *RemoveRecentStickerRequest) (*Ok, error) {\n\t// Unlock receive function at the end of this function to mark received event as processed\n\tdefer client.Unlock(\"RemoveRecentSticker\")\n\tresult, err := client.Send(Request{\n\t\tmeta: meta{\n\t\t\tType: \"removeRecentSticker\",\n\t\t},\n\t\tData: map[string]interface{}{\n\t\t\t\"is_attached\": request.IsAttached,\n\t\t\t\"sticker\": request.Sticker,\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": "90a8c94794ed7f72696fd79a179c7cd8", "score": "0.49440554", "text": "func (s Set) Remove(elem string) {\n\tdelete(s, elem)\n}", "title": "" }, { "docid": "499f3aef38693ae0525b64e76dcc8bc0", "score": "0.4937522", "text": "func (mr *MockExtendedK8sClientMockRecorder) DeleteTridentDaemonSet(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DeleteTridentDaemonSet\", reflect.TypeOf((*MockExtendedK8sClient)(nil).DeleteTridentDaemonSet), arg0)\n}", "title": "" }, { "docid": "cb629bb6bf6d8b476640bc87ad32127e", "score": "0.4935365", "text": "func (b *API) SetChatStickerSet(chatID, name string) (bool, error) {\n\tr := map[string]interface{}{\n\t\t\"chat_id\": chatID,\n\t\t\"sticker_set_name\": name,\n\t}\n\n\t_, err := b.requester.JSONRequest(\"setChatStickerSet\", r)\n\n\treturn err == nil, err\n}", "title": "" }, { "docid": "24d2385ddc6b6203086b6d0f37932939", "score": "0.4930945", "text": "func (client *Client) DeleteTagSetWithCallback(request *DeleteTagSetRequest, callback func(response *DeleteTagSetResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *DeleteTagSetResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.DeleteTagSet(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "title": "" }, { "docid": "ff02b6999dc4c8ee8c3d619d1a44ab2d", "score": "0.49202552", "text": "func (c *statefulSetPluses) Delete(name string, options *v1.DeleteOptions) error {\n\treturn c.client.Delete().\n\t\tNamespace(c.ns).\n\t\tResource(\"statefulsetpluses\").\n\t\tName(name).\n\t\tBody(options).\n\t\tDo().\n\t\tError()\n}", "title": "" }, { "docid": "38ed95382c794ab839d1c08b7ce95a3f", "score": "0.4919646", "text": "func (s *Sett) Drop() error {\n\tvar err error\n\tvar deleteKey []string\n\terr = s.db.View(func(txn *badger.Txn) error {\n\t\tit := txn.NewIterator(DefaultIteratorOptions)\n\t\tprefix := []byte(s.table)\n\t\tfor it.Seek(prefix); it.ValidForPrefix(prefix); it.Next() {\n\t\t\titem := it.Item()\n\t\t\tkey := string(item.Key())\n\t\t\tdeleteKey = append(deleteKey, key)\n\t\t}\n\t\tit.Close()\n\t\treturn nil\n\t})\n\terr = s.db.Update(func(txn *badger.Txn) error {\n\t\tfor _, d := range deleteKey {\n\t\t\terr = txn.Delete([]byte(d))\n\t\t\tif err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\treturn err\n\t})\n\treturn err\n}", "title": "" }, { "docid": "a6236888130fdf3899cc02c265de177d", "score": "0.49038988", "text": "func (m *MockExtendedK8sClient) DeleteTridentDaemonSet(arg0 string) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"DeleteTridentDaemonSet\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "e308a7da735191360f7e5e21e78cfa5d", "score": "0.49011564", "text": "func (client TilesetClient) DeleteSender(req *http.Request) (*http.Response, error) {\n return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n }", "title": "" }, { "docid": "8806f8031f81b9fb21347e58b26173fa", "score": "0.48908457", "text": "func DeleteDaemonSet(daemonSetName, namespace string) error {\n\tconst (\n\t\tTimeout = 5 * time.Minute\n\t)\n\n\tlogrus.Infof(\"Deleting daemonset %s\", daemonSetName)\n\tdeletePolicy := metav1.DeletePropagationForeground\n\n\tif err := daemonsetClient.K8sClient.AppsV1().DaemonSets(namespace).Delete(context.TODO(), daemonSetName, metav1.DeleteOptions{\n\t\tPropagationPolicy: &deletePolicy,\n\t}); err != nil {\n\t\tlogrus.Infof(\"The daemonset (%s) deletion is unsuccessful due to %+v\", daemonSetName, err.Error())\n\t}\n\tdsDeleted := false\n\tstart := time.Now()\n\tfor time.Since(start) < Timeout {\n\t\tif !doesDaemonSetExist(daemonSetName, namespace) {\n\t\t\tdsDeleted = true\n\t\t\tbreak\n\t\t}\n\t\ttime.Sleep(waitingTime)\n\t}\n\n\tif !dsDeleted {\n\t\treturn fmt.Errorf(\"timeout waiting for daemonset's to be deleted\")\n\t}\n\n\tlogrus.Infof(\"Successfully cleaned up daemonset %s\", daemonSetName)\n\treturn nil\n}", "title": "" }, { "docid": "d76b979ba08511fb68d215c37bef9305", "score": "0.48883542", "text": "func (l *SyncStringSet) Delete(s string) {\n\tl.mu.Lock()\n\tdefer l.mu.Unlock()\n\n\tdelete(l.m, s)\n}", "title": "" }, { "docid": "3cc9dd88b838fa875d3935114c8f1ba0", "score": "0.4885734", "text": "func (t *Acl) DeleteAclSet(Name string, Type E_OpenconfigAcl_ACL_TYPE) {\n\tkey := Acl_AclSet_Key{\n\t\tName: Name,\n\t\tType: Type,\n\t}\n\n\tdelete(t.AclSet, key)\n}", "title": "" }, { "docid": "905d6a0aac8ff1080470d3721fbf2742", "score": "0.4869065", "text": "func (ts *TemplateServer) DeleteConfigTemplateSet(ctx context.Context, req *pb.DeleteConfigTemplateSetReq) (*pb.DeleteConfigTemplateSetResp, error) {\n\trtime := time.Now()\n\tlogger.V(2).Infof(\"DeleteConfigTemplateSet[%d]| input[%+v]\", req.Seq, req)\n\tresponse := &pb.DeleteConfigTemplateSetResp{Seq: req.Seq, ErrCode: pbcommon.ErrCode_E_OK, ErrMsg: \"OK\"}\n\n\tdefer func() {\n\t\tcost := ts.collector.StatRequest(\"DeleteConfigTemplateSet\", response.ErrCode, rtime, time.Now())\n\t\tlogger.V(2).Infof(\"DeleteConfigTemplateSet[%d]| output[%dms][%+v]\", req.Seq, cost, response)\n\t}()\n\n\taction := templatesetaction.NewDeleteAction(ts.viper, ts.dataMgrCli, req, response)\n\tts.executor.Execute(action)\n\n\treturn response, nil\n}", "title": "" }, { "docid": "f248149aadef2f41d7b22729ce0a92fb", "score": "0.48630622", "text": "func Del(setname, address string, args ...string) error {\n\treturn exec(C.IPSET_CMD_DEL, setname, address, args...)\n}", "title": "" }, { "docid": "f61b2b5020c6132734c9d34107fdb9f2", "score": "0.48590055", "text": "func (c *Controller) statefulSetDeletePod(statefulSet *apps.StatefulSet) error {\n\treturn c.kubeClient.CoreV1().Pods(statefulSet.Namespace).Delete(chopmodels.CreatePodName(statefulSet), newDeleteOptions())\n}", "title": "" }, { "docid": "e9a5b7d6a4b2f5bf1b1bbe7df02f3552", "score": "0.48532295", "text": "func (s TokenSet) Remove(t Token) {\n\tdelete(s, t)\n}", "title": "" }, { "docid": "b521c84162c4077b38ee4bd8c212e57a", "score": "0.48307523", "text": "func (ss *StringSet) Delete(sa ...string) *StringSet {\n\tfor _, s := range sa {\n\t\tdelete(ss.content, s)\n\t}\n\treturn ss\n}", "title": "" }, { "docid": "aeb6ef5c997410a6d17ee0af526e3563", "score": "0.48241812", "text": "func (s StickerRepository) FindStickerSet(filter interface{}) ([]model.StickerSet, error) {\n\tvar res []model.StickerSet\n\terr := s.stickerSet.Find(filter).All(&res)\n\treturn res, err\n}", "title": "" }, { "docid": "ff147c4289dc2313186cb0c03d70f7aa", "score": "0.48113224", "text": "func (b *Bot) SetStickerPositionInSet(sticker string, position int) error {\n\tparams := map[string]string{\n\t\t\"sticker\": sticker,\n\t\t\"position\": strconv.Itoa(position),\n\t}\n\n\t_, err := b.Raw(\"setStickerPositionInSet\", params)\n\treturn err\n}", "title": "" }, { "docid": "4238468133845137a4b186d0a6e72dc5", "score": "0.4809974", "text": "func (m *MockExtendedK8sClient) DeleteDaemonSet(arg0, arg1 string, arg2 bool) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"DeleteDaemonSet\", arg0, arg1, arg2)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "d8a094af813dfa35c4921406ad4e7214", "score": "0.48015633", "text": "func (b *Dog) RemoveSitter(e string, ch chan string) {\n\tif _, ok := b.sitters[e]; ok {\n\t\tfor i := range b.sitters[e] {\n\t\t\tif b.sitters[e][i] == ch {\n\t\t\t\tb.sitters[e] = append(b.sitters[e][:i], b.sitters[e][i+1:]...)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "35d5268007108fb23c79c151407049e3", "score": "0.47981724", "text": "func (mr *MockStatefulSetWriterMockRecorder) DeleteStatefulSet(ctx, key interface{}, opts ...interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\tvarargs := append([]interface{}{ctx, key}, opts...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DeleteStatefulSet\", reflect.TypeOf((*MockStatefulSetWriter)(nil).DeleteStatefulSet), varargs...)\n}", "title": "" }, { "docid": "629a8196d169691cf9a45626cf7aaf0d", "score": "0.47858512", "text": "func (c *FakeWafSQLInjectionMatchSets) Delete(name string, options *v1.DeleteOptions) error {\n\t_, err := c.Fake.\n\t\tInvokes(testing.NewDeleteAction(wafsqlinjectionmatchsetsResource, c.ns, name), &v1alpha1.WafSQLInjectionMatchSet{})\n\n\treturn err\n}", "title": "" }, { "docid": "1094bde5b6d6a611242aa4f66f70a9f8", "score": "0.47792023", "text": "func (mr *MockStatefulSetClientMockRecorder) DeleteStatefulSet(ctx, key interface{}, opts ...interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\tvarargs := append([]interface{}{ctx, key}, opts...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DeleteStatefulSet\", reflect.TypeOf((*MockStatefulSetClient)(nil).DeleteStatefulSet), varargs...)\n}", "title": "" }, { "docid": "25e674f7e7794a2267e49440a3f318c6", "score": "0.47780302", "text": "func (r *ReconcileCommonWebUI) deleteDaemonSet(instance *operatorsv1alpha1.CommonWebUI) {\n\treqLogger := log.WithValues(\"func\", \"deleteDaemonSet\", \"instance.Name\", instance.Name)\n\tdaemonSet := &appsv1.DaemonSet{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: res.DaemonSetName,\n\t\t\tNamespace: res.DefaultNamespace,\n\t\t},\n\t}\n\t// check if the DaemonSet exists\n\terr := r.client.Get(context.TODO(),\n\t\ttypes.NamespacedName{Name: res.DaemonSetName, Namespace: res.DefaultNamespace}, daemonSet)\n\tif err == nil {\n\t\t// DaemonSet found so delete it\n\t\terr := r.client.Delete(context.TODO(), daemonSet)\n\t\tif err != nil {\n\t\t\treqLogger.Error(err, \"Failed to delete old common ui DaemonSet\")\n\t\t} else {\n\t\t\treqLogger.Info(\"Deleted old common ui DaemonSet\")\n\t\t}\n\t} else if !errors.IsNotFound(err) {\n\t\treqLogger.Error(err, \"Failed to get old DaemonSet\")\n\t}\n}", "title": "" } ]
38e3bc3fae1f13856a85ac1956f0ebf4
GetHeight retrieves the maximum height.
[ { "docid": "63bdebeef8abb24643c4980524268721", "score": "0.74538696", "text": "func (m *Model) GetMaxHeight() int {\n\treturn m.maxHeight\n}", "title": "" } ]
[ { "docid": "9288091e7a0e7d9ad04a5494f144c359", "score": "0.75726265", "text": "func (o *TileBounds) GetHeight() int32 {\n\tif o == nil || o.Height == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\treturn *o.Height\n}", "title": "" }, { "docid": "e144cdf47fce27e2dd3875e0427a0091", "score": "0.74638116", "text": "func (c *Config) MaxHeight() int {\n\tc.Mutex.RLock()\n\tdefer c.Mutex.RUnlock()\n\treturn c.Raw.MaxHeight\n}", "title": "" }, { "docid": "e80863ec91cdab6af8eda527d515ecdb", "score": "0.73771435", "text": "func (g *Grid) GetHeight() int {\n\treturn g.Height\n}", "title": "" }, { "docid": "6f9d575f4c251378cbf3504707a5c238", "score": "0.7242616", "text": "func (p *Picture) GetHeight() int {\r\n\treturn p.pixelHeight\r\n}", "title": "" }, { "docid": "d61f98b925581731fd21c0ba36c54078", "score": "0.7195607", "text": "func (Empty) MaxHeight(width, height int) int {\n\treturn 1\n}", "title": "" }, { "docid": "4ba71ed1a99a00dad9f60a8819790da8", "score": "0.7185007", "text": "func (o *FileInfoThumbnail) GetHeight() int32 {\n\tif o == nil || o.Height == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\treturn *o.Height\n}", "title": "" }, { "docid": "2d358077fdb5bf7777d4e2a0e7a42870", "score": "0.7179988", "text": "func (f *Framebuffer) Height() int { return f.fb.Bounds().Max.Y }", "title": "" }, { "docid": "6b6b911c8fffa4fd1871c9cd3de350ac", "score": "0.7172469", "text": "func (t *Link) GetHeight() (v int64) {\n\treturn *t.height.nonNegativeInteger\n\n}", "title": "" }, { "docid": "743579360f4e3906481b593fce9a55e4", "score": "0.7153334", "text": "func (b *BaseElement) GetHeight() int32 {\n\treturn b.h\n}", "title": "" }, { "docid": "8ec9201a2ab5a65fc8b7e2c67e0814da", "score": "0.71483195", "text": "func getHeight() int {\n\tfor {\n\t\theight := go50.GetInt(\"Height: \")\n\t\tif height > 0 && height < 24 {\n\t\t\treturn height\n\t\t}\n\t}\n}", "title": "" }, { "docid": "8da42bab74270942ba05a0aaecffa9d5", "score": "0.7091172", "text": "func GetHeight() int {\n\treturn viper.GetInt(FlagHeight)\n}", "title": "" }, { "docid": "a9405282bfa15a888e98ac608dcdc64e", "score": "0.70892906", "text": "func (r Rectangle) Height() float64 {\n\treturn r.Max.Y - r.Min.Y\n}", "title": "" }, { "docid": "e1103923a9b41ffe8f29ab5029294a21", "score": "0.70775115", "text": "func (self *TraitPixbuf) GetHeight() (return__ int) {\n\tvar __cgo__return__ C.int\n\t__cgo__return__ = C.gdk_pixbuf_get_height(self.CPointer)\n\treturn__ = int(__cgo__return__)\n\treturn\n}", "title": "" }, { "docid": "d3a7af46947e286821339b2924e5c79b", "score": "0.7058782", "text": "func (image *Image2D) GetHeight() int {\n\treturn image.height\n}", "title": "" }, { "docid": "3d7559b29a642edeeb7a9f784be01fa0", "score": "0.70111436", "text": "func (f *Face) Height() int {\n\treturn f.ypixels(int(f.handle.height))\n}", "title": "" }, { "docid": "98dc10878cd49a3e40d91cdfae7cdd3f", "score": "0.69901323", "text": "func (image *JPGImage) GetHeight() float32 {\n\treturn float32(image.height)\n}", "title": "" }, { "docid": "c6163bc174c6673355eea372897ade36", "score": "0.69378066", "text": "func (v *Pixbuf) GetHeight() int {\n\treturn int(C.gdk_pixbuf_get_height(v.Native()))\n}", "title": "" }, { "docid": "5d5d0e75ade1eb44cbc340ff2f01798f", "score": "0.6936965", "text": "func (pgb *ChainDB) GetHeight() (int64, error) {\n\tctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)\n\tdefer cancel()\n\theight, _, _, err := RetrieveBestBlockHeight(ctx, pgb.db)\n\t// If the blocks table is empty, set height to -1.\n\tbb := int64(height)\n\tif err == sql.ErrNoRows {\n\t\tbb = -1\n\t}\n\treturn bb, pgb.replaceCancelError(err)\n}", "title": "" }, { "docid": "e572ba566775dd93c42cc323ba641b2f", "score": "0.6917581", "text": "func (a *Animation) GetHeight() float64 {\n\tif a == nil || a.Height == nil {\n\t\treturn 0.0\n\t}\n\treturn *a.Height\n}", "title": "" }, { "docid": "7d9d7586f3ec489ba50d85a6ea06f1ae", "score": "0.68965346", "text": "func Height() int {\n\tws, err := getWinsize()\n\tif err != nil {\n\t\treturn -1\n\t}\n\treturn int(ws.Row)\n}", "title": "" }, { "docid": "84353a4fd4978fd426f49af2a000ca45", "score": "0.6876576", "text": "func (pc PieChart) GetHeight() int {\n\tif pc.Height == 0 {\n\t\treturn DefaultChartWidth\n\t}\n\treturn pc.Height\n}", "title": "" }, { "docid": "60297adf5742ef3cfca6fe63440ae77d", "score": "0.6864181", "text": "func (lc *FilChain) GetHeight(ctx context.Context) (uint64, error) {\n\th, err := lc.api.ChainHead(ctx)\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(\"get head from lotus node: %s\", err)\n\t}\n\treturn uint64(h.Height()), nil\n}", "title": "" }, { "docid": "7658b8f2fc8cac52d0f7f28f395717f7", "score": "0.6813225", "text": "func (t *Texture) GetHeight() uint16 {\n\treturn t.height\n}", "title": "" }, { "docid": "6a6167cd36a9f44391c2ac669a8a669b", "score": "0.68123984", "text": "func (commit *Commit) GetHeight() int64 {\n\treturn commit.Height\n}", "title": "" }, { "docid": "6a6167cd36a9f44391c2ac669a8a669b", "score": "0.68123984", "text": "func (commit *Commit) GetHeight() int64 {\n\treturn commit.Height\n}", "title": "" }, { "docid": "368d8ec7984cb7150c8d54dfb8d93e59", "score": "0.6787552", "text": "func (s *TXPoolServer) getHeight() uint32 {\n\ts.mu.RLock()\n\tdefer s.mu.RUnlock()\n\treturn s.height\n}", "title": "" }, { "docid": "dcb848785b06b974ef66ad3fc1450f4e", "score": "0.67865026", "text": "func (dim *Dimensions) Height() int64 {\n\treturn dim.height\n}", "title": "" }, { "docid": "17aa67b56a3e6699f2b1aabff66988ed", "score": "0.67784625", "text": "func (b *Bound) Height() float64 {\n\treturn b.ne.Y() - b.sw.Y()\n}", "title": "" }, { "docid": "ce5a637b32c0cee7cecfb8462811bfc3", "score": "0.6767025", "text": "func (env *Environment) getHeight(latestHeight int64, heightPtr *int64) (int64, error) {\n\tif heightPtr != nil {\n\t\theight := *heightPtr\n\t\tif height <= 0 {\n\t\t\treturn 0, fmt.Errorf(\"%w (requested height: %d)\", coretypes.ErrZeroOrNegativeHeight, height)\n\t\t}\n\t\tif height > latestHeight {\n\t\t\treturn 0, fmt.Errorf(\"%w (requested height: %d, blockchain height: %d)\",\n\t\t\t\tcoretypes.ErrHeightExceedsChainHead, height, latestHeight)\n\t\t}\n\t\tbase := env.BlockStore.Base()\n\t\tif height < base {\n\t\t\treturn 0, fmt.Errorf(\"%w (requested height: %d, base height: %d)\", coretypes.ErrHeightNotAvailable, height, base)\n\t\t}\n\t\treturn height, nil\n\t}\n\treturn latestHeight, nil\n}", "title": "" }, { "docid": "502734259391f7ba123789e17eec4753", "score": "0.67481625", "text": "func (rect *PdfRectangle) Height() float64 {\n\treturn math.Abs(rect.Ury - rect.Lly)\n}", "title": "" }, { "docid": "44ae9ab1c3a6187e16548810930d40f8", "score": "0.6746037", "text": "func (c *Canvas) Height() int {\n\treturn c.maxCorner.Y - c.minCorner.Y + 1\n}", "title": "" }, { "docid": "44a1004aac1d47fdb4435f5028e48344", "score": "0.67377084", "text": "func (a *Asset) GetHeight() float64 {\n\tif a == nil || a.Height == nil {\n\t\treturn 0.0\n\t}\n\treturn *a.Height\n}", "title": "" }, { "docid": "4cfb9841a9e2a5da9865c5833259fb88", "score": "0.6719488", "text": "func (self *TraitPixbufAnimation) GetHeight() (return__ int) {\n\tvar __cgo__return__ C.int\n\t__cgo__return__ = C.gdk_pixbuf_animation_get_height(self.CPointer)\n\treturn__ = int(__cgo__return__)\n\treturn\n}", "title": "" }, { "docid": "44e81c326108914f0d8d35846f261ca6", "score": "0.67080826", "text": "func (m *Model) GetHeight() int {\n\treturn m.height\n}", "title": "" }, { "docid": "31f2d0dc2ced7bc66ea39fa6f6c0e0c9", "score": "0.66903144", "text": "func Height() uint64 {\n\n\tglobalData.RLock()\n\tdefer globalData.RUnlock()\n\n\treturn globalData.height\n}", "title": "" }, { "docid": "4868b6d1b1d73ee45affbb22c7423116", "score": "0.6688366", "text": "func (info *ImageInfoType) Height() float64 {\n\treturn info.h / (info.scale * info.dpi / 72)\n}", "title": "" }, { "docid": "1eaf8c200bd47e89fcdbe3962b9cb38d", "score": "0.6686772", "text": "func (lc *LotusChain) GetHeight(ctx context.Context) (uint64, error) {\n\th, err := lc.api.ChainHead(ctx)\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(\"get head from lotus node: %s\", err)\n\t}\n\treturn uint64(h.Height()), nil\n}", "title": "" }, { "docid": "ce81f464dbb06bec9346ad16f9ca3ddb", "score": "0.66853154", "text": "func (rc Rectangle) Height() int {\n\treturn rc.Bottom - rc.Top\n}", "title": "" }, { "docid": "f722a9e2f1357247f5451e3a59f8297b", "score": "0.66747665", "text": "func (r *ImageRef) Height() int {\n\treturn int(r.image.Ysize)\n}", "title": "" }, { "docid": "c731c102219c303d3159c09176f3ee68", "score": "0.6670806", "text": "func (data *Data) GetCntMinMaxHeight() (int, int, int, error) {\n\tdb, err := data.openDb()\n\tdefer data.closeDb(db)\n\tif err != nil {\n\t\tlog.Printf(\"data.openDb Error : %+v\", err)\n\t\treturn -1, -1, -1, err\n\t}\n\tvar cnt int\n\terr = db.QueryRow(\"SELECT COUNT(hash) FROM headers\").Scan(&cnt)\n\tif err != nil {\n\t\tlog.Printf(\"db.QueryRow Error : %+v\", err)\n\t\treturn -1, -1, -1, err\n\t}\n\tif cnt == 0 {\n\t\treturn cnt, -1, -1, nil\n\t}\n\tvar max int\n\tvar min int\n\terr = db.QueryRow(\"SELECT MIN(height), MAX(height) FROM headers\").Scan(&min, &max)\n\tif err != nil {\n\t\tlog.Printf(\"db.QueryRow Error : %+v\", err)\n\t\treturn -1, -1, -1, err\n\t}\n\treturn cnt, min, max, nil\n}", "title": "" }, { "docid": "7e85e43c402d86855671a2e0c5dc2e9a", "score": "0.6651496", "text": "func (c *DataCache) GetHeight() uint32 {\n\tc.mtx.RLock()\n\tdefer c.mtx.RUnlock()\n\treturn c.height\n}", "title": "" }, { "docid": "410abbca8ae8bcd4cae9383ac02f754a", "score": "0.66472435", "text": "func (u *Upstream) GetHeight() uint64 {\n\treturn u.blockHeight\n}", "title": "" }, { "docid": "317e48b5427956feed43ebafcb09ae14", "score": "0.6639327", "text": "func (ws *workingSet) Height() (uint64, error) {\n\treturn ws.height, nil\n}", "title": "" }, { "docid": "0a7969c8bf716e447931e55cc313d716", "score": "0.66316926", "text": "func (g *GitStatusWidget) GetHeight() int {\n\treturn g.renderer.GetHeight()\n}", "title": "" }, { "docid": "e4b88720b86bcf132bde000dd99429c5", "score": "0.66305196", "text": "func getHeight(latestHeight int64, heightPtr *int64) (int64, error) {\n\tif heightPtr != nil {\n\t\theight := *heightPtr\n\t\tif height <= 0 {\n\t\t\treturn 0, fmt.Errorf(\"height must be greater than 0, but got %d\", height)\n\t\t}\n\t\tif height > latestHeight {\n\t\t\treturn 0, fmt.Errorf(\"height %d must be less than or equal to the current blockchain height %d\",\n\t\t\t\theight, latestHeight)\n\t\t}\n\t\tbase := env.BlockStore.Base()\n\t\tif height < base {\n\t\t\treturn 0, fmt.Errorf(\"height %d is not available, lowest height is %d\",\n\t\t\t\theight, base)\n\t\t}\n\t\treturn height, nil\n\t}\n\treturn latestHeight, nil\n}", "title": "" }, { "docid": "15139e5b1203a48b4c2bb71fb8e0a332", "score": "0.6623143", "text": "func GetHeight(ctx Context) (int64, bool) {\n\tval, ok := ctx.Value(contextKeyHeight).(int64)\n\treturn val, ok\n}", "title": "" }, { "docid": "3e581765703521f10ea4a27db108bbe8", "score": "0.6611965", "text": "func (g Grid) Height() int {\n\treturn g.height\n}", "title": "" }, { "docid": "cb2ceb1e286fe47366854e7ed381b932", "score": "0.6607332", "text": "func (win *Window) Height() int {\n\tsize := C.sfRenderWindow_getSize(win.win)\n\treturn int(size.y)\n}", "title": "" }, { "docid": "52959916713ef8a9719ec3c56fba557a", "score": "0.66053355", "text": "func (t Texture3D) GetHeight() int32 {\n\treturn t.height\n}", "title": "" }, { "docid": "f2c9ccbe8c482eb83a3ead93c969d53c", "score": "0.6592403", "text": "func (o *WorkbookChart) GetHeight() AnyOfnumberstringstring {\n\tif o == nil || o.Height == nil {\n\t\tvar ret AnyOfnumberstringstring\n\t\treturn ret\n\t}\n\treturn *o.Height\n}", "title": "" }, { "docid": "e4d37ee6a4e62f4f46d3f440bf3399c5", "score": "0.65714204", "text": "func (g *Graph) Height() uint64 {\n\tg.RLock()\n\theight := g.height\n\tg.RUnlock()\n\n\treturn height\n}", "title": "" }, { "docid": "f2cf8abad026c8e08b32b7ad1d8a7115", "score": "0.656645", "text": "func (h *HeightCache) GetHeight() (height uint64) {\n\th.RLock()\n\theight = h.height\n\th.RUnlock()\n\treturn\n}", "title": "" }, { "docid": "2d2bc542d74f1e872f3a315b1321f6a9", "score": "0.656508", "text": "func (b *BBox) MaxY() int64 {\n\treturn int64(b.handle.yMax)\n}", "title": "" }, { "docid": "3b6aa8cf23d438341a598327366ef755", "score": "0.6547731", "text": "func (rt *recvTxOut) Height() int32 {\n\theight := int32(-1)\n\tif rt.block != nil {\n\t\theight = rt.block.Height\n\t}\n\treturn height\n}", "title": "" }, { "docid": "6b6c1ce545b496533dfd9237f3b680dc", "score": "0.6530141", "text": "func (tex *Image) Height() int {\n\tsize := C.sfTexture_getSize(tex.tex)\n\treturn int(size.y)\n}", "title": "" }, { "docid": "80d080b5d1ff4247cd1a38ab9ad5d846", "score": "0.64961797", "text": "func (k *Kernel) MaxY() int {\n\treturn k.Height\n}", "title": "" }, { "docid": "969b9f18ed82aae598cc09af0a7529e5", "score": "0.6490153", "text": "func (w *Window) Height() int {\n\treturn int(C.ANativeWindow_getHeight(w.cptr()))\n}", "title": "" }, { "docid": "e7c337556b61df8e9617afddd24d0889", "score": "0.6460446", "text": "func GetHeight(T *TreeNode) (height int) {\n\tif T == nil {\n\t\treturn 0\n\t}\n\tleft := GetHeight(T.Left)\n\tright := GetHeight(T.Right)\n\n\treturn Max(left, right)+1\n}", "title": "" }, { "docid": "016ab5ae1299bf79d57077ebadaeff0e", "score": "0.6443932", "text": "func (size *BitmapSize) Height() int16 {\n\treturn int16(size.handle.height)\n}", "title": "" }, { "docid": "aef03e9b771a00f89a4808a4dbeb69b5", "score": "0.6438191", "text": "func (root *TreeNode) getHeight() int64 {\n\tif root != nil {\n\t\treturn root.height\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "7ec121a62f42aa69d9f7b06ad0e6f84c", "score": "0.64317006", "text": "func (image *Image) Height() int {\n\treturn image.height\n}", "title": "" }, { "docid": "fc4aff121ea26bb47db42dc68f886e0b", "score": "0.6426062", "text": "func (me *Image) Height() int {\n\treturn int(me.img.h)\n}", "title": "" }, { "docid": "61b626faf2bd9bc9b7d32926c8bf0f7e", "score": "0.6421632", "text": "func GetHeight(hostURL string, hostPort int) *bytes.Buffer {\n\treturn makeGetRequest(\"getheight\", hostURL, hostPort)\n}", "title": "" }, { "docid": "92c08889a5e02f541965bda51e5327f4", "score": "0.642083", "text": "func (n *Network) LatestHeight() (int64, error) {\n\tif len(n.Validators) == 0 {\n\t\treturn 0, errors.New(\"no validators available\")\n\t}\n\n\tstatus, err := n.Validators[0].RPCClient.Status(context.Background())\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn status.SyncInfo.LatestBlockHeight, nil\n}", "title": "" }, { "docid": "d174639f2dae50c41b3ba304673cffa2", "score": "0.640956", "text": "func (o GoogleCloudRetailV2alphaImageOutput) Height() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v GoogleCloudRetailV2alphaImage) *int { return v.Height }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "0ec7bfc622fa75bc40354ea4ca661984", "score": "0.6407723", "text": "func (cs ClientState) GetLatestHeight() uint64 {\n\treturn uint64(cs.Height)\n}", "title": "" }, { "docid": "aee48e59f88191d735794a956c7a7c07", "score": "0.63918257", "text": "func (x *objectIndex) GetHeight() uint64 {\n\treturn 0\n}", "title": "" }, { "docid": "a93c0286b57fed1d9228cb214ff50afa", "score": "0.63885665", "text": "func (d Dispatcher) LatestBlockHeight() (int, error) {\n\tblock, err := d.GetBC().GetLatestBlock()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treturn int(block.GetHeight()), nil\n}", "title": "" }, { "docid": "589e30c28716b98bc8c4370b722755ce", "score": "0.63787764", "text": "func (w *Window) Height() int {\n\treturn w.height\n}", "title": "" }, { "docid": "84560fd6125bed6b69750981466906b6", "score": "0.63778186", "text": "func (num *number) Height() int {\n\tvar res = num.size * 4 / 5\n\n\tif res%2 == 0 {\n\t\treturn res + 1\n\t}\n\n\treturn res\n}", "title": "" }, { "docid": "c8db3677048272c8b3ac9451a0f833ff", "score": "0.6376138", "text": "func (planet *Planet) GetHeight(x int) int {\n\tfor y := int(planet.Height - 1); y >= 0; y-- {\n\t\tidx := planet.GetTileIndex(x, y)\n\t\tif planet.Layers.Top[idx].TileType != TileTypeNone {\n\t\t\treturn y\n\t\t}\n\t}\n\treturn 0\n}", "title": "" }, { "docid": "eee36b93f70606818e42d652f0825514", "score": "0.6364072", "text": "func (p *PdfiumImplementation) FPDFBitmap_GetHeight(request *requests.FPDFBitmap_GetHeight) (*responses.FPDFBitmap_GetHeight, error) {\n\tp.Lock()\n\tdefer p.Unlock()\n\n\tbitmapHandle, err := p.getBitmapHandle(request.Bitmap)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\theight := C.FPDFBitmap_GetHeight(bitmapHandle.handle)\n\treturn &responses.FPDFBitmap_GetHeight{\n\t\tHeight: int(height),\n\t}, nil\n}", "title": "" }, { "docid": "944bd4d16a03fd074ff0373dbd62929d", "score": "0.6360224", "text": "func (v *StackPanel) Height() int {\n\tif v.orientation == Vertical {\n\t\th := 0\n\t\tfor _, val := range v.heights {\n\t\t\th += val\n\t\t}\n\t\treturn h\n\t}\n\treturn v.height\n}", "title": "" }, { "docid": "1a042e7fb5b7cf2834e98d49d9e7bf84", "score": "0.63497317", "text": "func (s *PageLayout) Height() float64 {\n\treturn s.height\n}", "title": "" }, { "docid": "bf3297d97414232d8fff2074c7fc8a6d", "score": "0.6348248", "text": "func (t *BinaryTree) Height() (int, error) {\n\tif t.root == nil {\n\t\treturn 0, errors.New(\"Tree is empty\")\n\t}\n\n\tvar maxHeight func(bnode *bnode) int\n\n\tmaxHeight = func(bnode *bnode) int {\n\t\tif bnode == nil {\n\t\t\treturn 0\n\t\t}\n\t\tlHeight := maxHeight(bnode.left)\n\t\trHeight := maxHeight(bnode.right)\n\n\t\tif lHeight > rHeight {\n\t\t\treturn lHeight + 1\n\t\t}\n\t\treturn rHeight + 1\n\t}\n\tresult := maxHeight(t.root)\n\treturn result, nil\n}", "title": "" }, { "docid": "ade7a3dd1f2d348fc1374a0a904ac18c", "score": "0.63450646", "text": "func (w *WidgetImplement) Height() int {\n\treturn w.h\n}", "title": "" }, { "docid": "f4a4bb8791968fa3c33b5c00d259fc3b", "score": "0.63305855", "text": "func (b *Block) GetHeight(input *BlockInput) (*BlockHeight, error) {\n\tresp, err := b.c.Request(http.MethodGet, fmt.Sprintf(\"/blocks/%s/height\", input.ID), new(bytes.Buffer), nil)\n\tif err != nil {\n\t\treturn &BlockHeight{}, err\n\t}\n\tdefer resp.Body.Close()\n\n\tvar block *BlockHeight\n\terr = json.NewDecoder(resp.Body).Decode(&block)\n\tif err != nil {\n\t\treturn &BlockHeight{}, err\n\t}\n\treturn block, nil\n}", "title": "" }, { "docid": "097657483211ea82f69f6114f6ee8331", "score": "0.6329543", "text": "func (c *BlockCache) GetLatestHeight() int {\n\tc.mutex.RLock()\n\tdefer c.mutex.RUnlock()\n\tif c.firstBlock == c.nextBlock {\n\t\treturn -1\n\t}\n\treturn c.nextBlock - 1\n}", "title": "" }, { "docid": "93fddc43b20986109bc65f0885876f1c", "score": "0.6326718", "text": "func (c RelativeConstraint) GetHeight() float32 {\n\treturn c.op(c.parent().GetHeight(), c.constant)\n}", "title": "" }, { "docid": "0761bd81ac022c4cfbeffbe7a51bc6f8", "score": "0.6325706", "text": "func (bp RPCBlockProvider) GetBlockHeight() int {\r\n\tvar block int\r\n\terr := bp.Client.Call(\"BlockPropagationHandler.GetBlockHeight\", 0, &block)\r\n\tif err != nil {\r\n\t\tlog.Print(err)\r\n\t}\r\n\treturn block\r\n}", "title": "" }, { "docid": "f4e900ccc0401ba3f63d559bace05d33", "score": "0.6321422", "text": "func (b *BoundingBox2D) height() float64 {\n\n\treturn b.upperCorner.Y - b.lowerCorner.Y\n}", "title": "" }, { "docid": "1f9a9769da0334b99246648954929368", "score": "0.6309756", "text": "func (t *Track) Height() int {\n\treturn t.height\n}", "title": "" }, { "docid": "7b10495ea8ced07492d005236a1b99f5", "score": "0.63079226", "text": "func (s *ImageSpec) TileHeight() int {\n\tret := int(C.ImageSpec_tile_height(s.ptr))\n\truntime.KeepAlive(s)\n\treturn ret\n}", "title": "" }, { "docid": "7258a8f39294b84b3a4073d9941f7614", "score": "0.6299561", "text": "func (bfx *bloomfilterIndexer) Height() (uint64, error) {\n\th, err := bfx.flusher.KVStoreWithBuffer().Get(RangeBloomFilterNamespace, []byte(CurrentHeightKey))\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treturn byteutil.BytesToUint64(h), nil\n}", "title": "" }, { "docid": "6d3ca5370e47e853cf9fe108b94f85dd", "score": "0.6275154", "text": "func (ws *workingSet) Height() uint64 {\n\treturn ws.blkHeight\n}", "title": "" }, { "docid": "ce4a8201e76199ec677f6f25a6eb3bf1", "score": "0.627277", "text": "func (blk *Block) Height() float64 {\n\treturn blk.height\n}", "title": "" }, { "docid": "900ecde49c1def3bd719bac91a5d6dce", "score": "0.62685513", "text": "func (spr *Sprite) Height() int32 {\n\n\treturn spr.height\n}", "title": "" }, { "docid": "1699b6b56e47853b6e3cf494d3e91eee", "score": "0.6268259", "text": "func (o GoogleCloudRetailV2alphaImageResponseOutput) Height() pulumi.IntOutput {\n\treturn o.ApplyT(func(v GoogleCloudRetailV2alphaImageResponse) int { return v.Height }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "414bfb252c24323de2e8633579711cd5", "score": "0.624425", "text": "func (n *NodeMetastate) Height() uint64 {\n\treturn n.LedgerHeight\n}", "title": "" }, { "docid": "751e06b9e59b3b717713701d0c33c7aa", "score": "0.6243157", "text": "func (m *Matrix) Height() int {\n\treturn -1\n}", "title": "" }, { "docid": "39dd39d3a6e7fefa8bdf9ad7575af5ff", "score": "0.623659", "text": "func (o DashboardFreeFormLayoutElementOutput) Height() pulumi.StringOutput {\n\treturn o.ApplyT(func(v DashboardFreeFormLayoutElement) string { return v.Height }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "7ae32800691e0d35bb86999e24521697", "score": "0.62184584", "text": "func (is ImageSurface) Height() int {\n\treturn is.height\n}", "title": "" }, { "docid": "4a9b25568f4524756bfb885438b4ffc6", "score": "0.6215393", "text": "func GetRenderbufferHeight(target GLEnum) int32 {\n\tvar params int32\n\tgl.GetRenderbufferParameteriv(uint32(target), gl.RENDERBUFFER_HEIGHT, &params)\n\treturn params\n}", "title": "" }, { "docid": "6c3ef71b334aae23c4cbd4fe55abe4ec", "score": "0.619862", "text": "func (tree *BinaryTree) Height() int {\n\treturn len(tree.LevelOrderTraversel())\n}", "title": "" }, { "docid": "89e0a27839f3e7c741cdc94dad90124e", "score": "0.61930925", "text": "func (s *ImageSpec) Height() int {\n\tret := int(C.ImageSpec_height(s.ptr))\n\truntime.KeepAlive(s)\n\treturn ret\n}", "title": "" }, { "docid": "c9bfddb84b46ebe660db8bd1ef4ec365", "score": "0.6181899", "text": "func (commit *Commit) Height() int64 {\n\tif len(commit.Precommits) == 0 {\n\t\treturn 0\n\t}\n\treturn commit.FirstPrecommit().Vote.Height\n}", "title": "" }, { "docid": "f4cd1a50289ea98162a60296c4f6410a", "score": "0.61818254", "text": "func (i *InputInlineQueryResultVenue) GetThumbnailHeight() (value int32) {\n\tif i == nil {\n\t\treturn\n\t}\n\treturn i.ThumbnailHeight\n}", "title": "" }, { "docid": "f7edec97934ad089046c38dcf7d82d56", "score": "0.6180956", "text": "func (o DashboardLegendOptionsPtrOutput) Height() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *DashboardLegendOptions) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Height\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "14e73c568911ff4aab8c2987885c1ebc", "score": "0.61755", "text": "func (n *Node) Height() int {\n\tif len(n.Children) == 0 {\n\t\treturn 0\n\t}\n\tvar max int\n\tfor _, c := range n.Children {\n\t\th := c.Height()\n\t\tif max < h {\n\t\t\tmax = h\n\t\t}\n\t}\n\treturn max + 1\n}", "title": "" }, { "docid": "9aa9adaf682609d441f4851e9f7f2304", "score": "0.6173658", "text": "func (b *Buffer) SizeMax() (int, int) {\n\treturn b.maxWidth, b.maxHeight\n}", "title": "" } ]
001aa810b37382c0f275c04baee599f2
InterfaceShutdown returns the value of the "interface_shutdown" field in the mutation.
[ { "docid": "71ff0f3e4da53a1b178803209bb22b61", "score": "0.79039085", "text": "func (m *NetInterfaceMutation) InterfaceShutdown() (r bool, exists bool) {\n\tv := m.interface_shutdown\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" } ]
[ { "docid": "21076a148ebf0f255965a7cf1ffff33c", "score": "0.73525786", "text": "func (m *NetInterfaceMutation) SetInterfaceShutdown(b bool) {\n\tm.interface_shutdown = &b\n}", "title": "" }, { "docid": "b562f0c2582186eb2aae69f17b3c4555", "score": "0.72635275", "text": "func (m *PortChannelInterfaceMutation) PoInterfaceShutdown() (r bool, exists bool) {\n\tv := m.po_interface_shutdown\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "b414b6ee257b4b5b225baae9828d7d0f", "score": "0.7205581", "text": "func (m *NetInterfaceMutation) OldInterfaceShutdown(ctx context.Context) (v bool, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldInterfaceShutdown is only allowed on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldInterfaceShutdown 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 OldInterfaceShutdown: %w\", err)\n\t}\n\treturn oldValue.InterfaceShutdown, nil\n}", "title": "" }, { "docid": "b69560c68c64ec220a1aa4f5a3b487a2", "score": "0.71574634", "text": "func InterfaceShutdown(v bool) predicate.NetInterface {\n\treturn predicate.NetInterface(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldInterfaceShutdown), v))\n\t})\n}", "title": "" }, { "docid": "a091d72605879b3b0151ef3d260bc4fc", "score": "0.71484643", "text": "func (m *NetInterfaceMutation) ResetInterfaceShutdown() {\n\tm.interface_shutdown = nil\n}", "title": "" }, { "docid": "e081a54961151e3e2e4683407aba95e3", "score": "0.69854873", "text": "func (m *PortChannelInterfaceMutation) OldPoInterfaceShutdown(ctx context.Context) (v bool, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldPoInterfaceShutdown is only allowed on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldPoInterfaceShutdown 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 OldPoInterfaceShutdown: %w\", err)\n\t}\n\treturn oldValue.PoInterfaceShutdown, nil\n}", "title": "" }, { "docid": "cfc5691bc944c383fa668fa88b72c554", "score": "0.6569831", "text": "func (m *PortChannelInterfaceMutation) SetPoInterfaceShutdown(b bool) {\n\tm.po_interface_shutdown = &b\n}", "title": "" }, { "docid": "76597d67276457916f275009283d5cc8", "score": "0.6360788", "text": "func (m *PortChannelInterfaceMutation) ResetPoInterfaceShutdown() {\n\tm.po_interface_shutdown = nil\n}", "title": "" }, { "docid": "5000b5ba0870c1be2d507bc48d52e4c4", "score": "0.61650455", "text": "func (self *State) ShutdownI(args ...interface{}) {\n self.Object.Call(\"shutdown\", args)\n}", "title": "" }, { "docid": "c5d45038234837d35210e5e096104a96", "score": "0.61501974", "text": "func InterfaceShutdownEQ(v bool) predicate.NetInterface {\n\treturn predicate.NetInterface(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldInterfaceShutdown), v))\n\t})\n}", "title": "" }, { "docid": "681d8857b988e3c876b90786b7af12fc", "score": "0.56946063", "text": "func (s *BaseangelscriptListener) ExitInterface_(ctx *Interface_Context) {}", "title": "" }, { "docid": "3fe21b02d5d918ace8063e38a7a65713", "score": "0.56901646", "text": "func (m *IPStaticRoutingTableMutation) OnInterfaceCleared() bool {\n\treturn m.clearedon_interface\n}", "title": "" }, { "docid": "0c7fcefb3122e2c5804975a0fd5fde49", "score": "0.5601154", "text": "func (s *BaseGraphQLListener) ExitInterfaceTypeDefinition(ctx *InterfaceTypeDefinitionContext) {}", "title": "" }, { "docid": "3d0f24cb8c348ee26b9075184a409b35", "score": "0.5460664", "text": "func (pcic *PortChannelInterfaceCreate) SetPoInterfaceShutdown(b bool) *PortChannelInterfaceCreate {\n\tpcic.mutation.SetPoInterfaceShutdown(b)\n\treturn pcic\n}", "title": "" }, { "docid": "4bb1681eac3225b07bb91af3bbd03d87", "score": "0.5425688", "text": "func (m *IPStaticRoutingTableMutation) ClearOnInterface() {\n\tm.clearedon_interface = true\n}", "title": "" }, { "docid": "d01748c77cec599977bc2858077ecb70", "score": "0.5392888", "text": "func (m *NetInterfaceMutation) OnPoInterfaceCleared() bool {\n\treturn m.clearedon_po_interface\n}", "title": "" }, { "docid": "3b2c68361a2b25ed36f11a2288f5e1df", "score": "0.5335345", "text": "func (s *BaseIDLListener) ExitInterface_body(ctx *Interface_bodyContext) {}", "title": "" }, { "docid": "e721fd871c3d207113e56229a60b1fb4", "score": "0.5323511", "text": "func (self *State) Shutdown() {\n self.Object.Call(\"shutdown\")\n}", "title": "" }, { "docid": "fe3adffa020923800692717fb98da9d2", "score": "0.5259524", "text": "func InterfaceShutdownNEQ(v bool) predicate.NetInterface {\n\treturn predicate.NetInterface(func(s *sql.Selector) {\n\t\ts.Where(sql.NEQ(s.C(FieldInterfaceShutdown), v))\n\t})\n}", "title": "" }, { "docid": "fe3205f12a72beafe86d535ea6c5e3d3", "score": "0.5232512", "text": "func (s *BaseGraphQLListener) ExitImplementsInterfaces(ctx *ImplementsInterfacesContext) {}", "title": "" }, { "docid": "016894fcf571c477846f1bd054077b22", "score": "0.51963234", "text": "func (x *fastReflection_ResponseEndBlock) Interface() protoreflect.ProtoMessage {\n\treturn (*ResponseEndBlock)(x)\n}", "title": "" }, { "docid": "f5046fed398a7fa82c133a8926319e9a", "score": "0.51571286", "text": "func (s *BaseIDLListener) ExitInterface_type(ctx *Interface_typeContext) {}", "title": "" }, { "docid": "a8df3bad40836dc18bf8008273b43c01", "score": "0.5149102", "text": "func (s *BaseIDLListener) ExitInterface_name(ctx *Interface_nameContext) {}", "title": "" }, { "docid": "fd70ef6d0330f5f536bb78de20e69f7d", "score": "0.51376665", "text": "func (t *Output) Shutdown() {\n\t// Not implemented\n}", "title": "" }, { "docid": "67c8fcc131f988c52dc283235a666b5d", "score": "0.5122724", "text": "func (s *Server) Shutdown() {\n\tlogger.Info(\"Shutting down web interface\")\n\tdefer logger.Info(\"Web interface shut down\")\n\ts.listener.Close()\n\t<-s.done\n}", "title": "" }, { "docid": "ccb19000e6872fb9f52aaa36d01f346c", "score": "0.5096308", "text": "func (e *otelFakeExporter) Shutdown(ctx context.Context) error {\n\treturn nil\n}", "title": "" }, { "docid": "292ea49919484acb9969a23f2d8edcff", "score": "0.5068462", "text": "func (s *Stock) Shutdown() {\n\ts.close <- 1\n}", "title": "" }, { "docid": "5d0306d09577f37824bc20b0f20b577b", "score": "0.50588125", "text": "func (s *BaseGraphQLListener) ExitInterfaceTypeExtension(ctx *InterfaceTypeExtensionContext) {}", "title": "" }, { "docid": "139dc34dddff585983f7e89b33afa256", "score": "0.50370705", "text": "func (s *BaseIDLListener) ExitInterface_decl(ctx *Interface_declContext) {}", "title": "" }, { "docid": "ed6443ea9d4012d43e36ffec4c9a41ab", "score": "0.50298005", "text": "func (h *Httclient) CallShutdown(params GenericIDParams) *Body {\n\treturn h.get(\"/shutdown\", params)\n}", "title": "" }, { "docid": "f9c9ece3910d237f512ef926229f45c2", "score": "0.5003957", "text": "func (m *MockRunner) Shutdown(v0 time.Duration) error {\n\tr0 := m.ShutdownFunc.nextHook()(v0)\n\tm.ShutdownFunc.appendCall(RunnerShutdownFuncCall{v0, r0})\n\treturn r0\n}", "title": "" }, { "docid": "beddf038deb33e4e1f242d11e0863215", "score": "0.49973089", "text": "func (s *stnServer) ReleaseInterface(ctx context.Context, req *stn.STNRequest) (*stn.STNReply, error) {\n\tlog.Println(\"GRPC ReleaseInterface request:\", req)\n\n\t// revert the original interface config\n\terr := s.revertInterface(req.InterfaceName)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn s.grpcReplyError(err), err\n\t}\n\n\treturn s.grpcReplyEmptyOK(), nil\n}", "title": "" }, { "docid": "1097d23e79f857dd168576748f290b2b", "score": "0.4972425", "text": "func (i *FakeInterface) Stop() {\n\tclose(i.eventsCh)\n\tatomic.SwapUint32(&i.closed, 1)\n}", "title": "" }, { "docid": "a9882c3876eba6f4ceb39a973f9a5db4", "score": "0.49720648", "text": "func (d *MockDeleteDSL) Interface(ifaceName string) vppclient.DeleteDSL {\n\tkey := vpp_interfaces.InterfaceKey(ifaceName)\n\td.parent.Values[key] = nil\n\treturn d\n}", "title": "" }, { "docid": "56929ba919d818e85bb0997025ed5dae", "score": "0.4942405", "text": "func (engine *Impl) Shutdown() {\n\t<-engine.shutdown\n}", "title": "" }, { "docid": "3de3661d9be5dd0095cd32885a93b561", "score": "0.49298137", "text": "func (m *NetInterfaceMutation) ClearOnPoInterface() {\n\tm.clearedon_po_interface = true\n}", "title": "" }, { "docid": "22971ba08ff82cd414728344451bf379", "score": "0.4925608", "text": "func (s *BaseIDLListener) ExitInterface_inheritance_spec(ctx *Interface_inheritance_specContext) {}", "title": "" }, { "docid": "9ce5c3d22ba2f55ff911e82a7332ee12", "score": "0.48938313", "text": "func OnShutdown(ctx context.Context, manifest *plugin.Manifest) error {\n\treturn nil\n}", "title": "" }, { "docid": "238256175c36a0aab20683cf3501944d", "score": "0.48745808", "text": "func (m *NetInterfaceMutation) ResetInterfaceName() {\n\tm.interface_name = nil\n}", "title": "" }, { "docid": "9107e03b926dd40154a4a7d607a5cd97", "score": "0.4869858", "text": "func (relay *notifyReturnRelay) Shutdown() error {\n\tdefer close(relay.CallerReturns)\n\treturn nil\n}", "title": "" }, { "docid": "e85490c699a0e732f01531ccea48c006", "score": "0.486641", "text": "func (ui *Ui) Shutdown() {\n\tui.shutdown = true\n}", "title": "" }, { "docid": "955465906933a473ba78fd9821492a37", "score": "0.48536944", "text": "func (p *Publisher) Shutdown() {\n\n\t// TO BE IMPLEMENTED\n}", "title": "" }, { "docid": "083d5111ddb270856716c25ae4117528", "score": "0.4849193", "text": "func (m *IPStaticRoutingTableMutation) ResetOnInterface() {\n\tm.on_interface = nil\n\tm.clearedon_interface = false\n}", "title": "" }, { "docid": "5efb3f82258ff8980f884466517ed078", "score": "0.48413894", "text": "func (s *ScribeHandler) Shutdown(ctx context.Context) (err error) {\n os.Exit(0)\n return nil\n}", "title": "" }, { "docid": "260ec24fdc9d507ed3fc92b06e0f1951", "score": "0.48354948", "text": "func (x *fastReflection_ResponseFlush) Interface() protoreflect.ProtoMessage {\n\treturn (*ResponseFlush)(x)\n}", "title": "" }, { "docid": "94081a3a0ce62eadc66add6ca5df1180", "score": "0.48306853", "text": "func (relay *notifyPublishRelay) Shutdown() error {\n\tclose(relay.CallerConfirmations)\n\treturn nil\n}", "title": "" }, { "docid": "fe8cd81b39fda56d5e046a5ab40b8bad", "score": "0.48305035", "text": "func (i *MockInteropServer) ShutdownChan() <-chan *interop.Shutdown { return nil }", "title": "" }, { "docid": "16623f6c22d3501573d16a008e64f362", "score": "0.4826938", "text": "func (s *BaseIDLListener) ExitInterface_header(ctx *Interface_headerContext) {}", "title": "" }, { "docid": "e66fd3b6042295f5ec12724d99cca434", "score": "0.48241284", "text": "func (a *API) Shutdown() error {\n\ta.mutex.Lock()\n\tdefer a.mutex.Unlock()\n\n\treturn a.Exec(\"shutdown\", a.buffer)\n}", "title": "" }, { "docid": "86b8318ecf77dd64706b521b4cb794cb", "score": "0.4817334", "text": "func (s *SDKServer) Shutdown(ctx context.Context, e *sdk.Empty) (*sdk.Empty, error) {\n\ts.logger.Info(\"Received Shutdown request, adding to queue\")\n\ts.workerqueue.Enqueue(cache.ExplicitKey(stablev1alpha1.Shutdown))\n\treturn e, nil\n}", "title": "" }, { "docid": "f8cdccf875d6d852b660355207b53032", "score": "0.48168698", "text": "func (cg *CGenesis) Shutdown() {\n\t// TODO\n\t// . prevent double calls\n\tgo func() { cg.client.Disconnected(protobase.PUForceTerminate) }()\n}", "title": "" }, { "docid": "913c8d4f7ef634a16c2d755c653cf943", "score": "0.4812013", "text": "func (d *Dict3) Shutdown(input *JsonMessage, output *NoOutput) error {\r\n\tclose = true\r\n\treturn nil\r\n}", "title": "" }, { "docid": "b666e82d15e4326338b334edc8a73d9a", "score": "0.48111445", "text": "func (x *fastReflection_MsgUndelegate) Interface() protoreflect.ProtoMessage {\n\treturn (*MsgUndelegate)(x)\n}", "title": "" }, { "docid": "5a546103c826befe6506ea7a4e7f75fc", "score": "0.48008966", "text": "func Shutdown() error {\n\treturn errorString(C.nvmlShutdown_dl())\n}", "title": "" }, { "docid": "3ca6859ebd8d90f55f888a867c15883f", "score": "0.47824076", "text": "func (e *oidcExtension) Shutdown(context.Context) error {\n\treturn nil\n}", "title": "" }, { "docid": "1354afd93a8f5540a87861af01418add", "score": "0.47735375", "text": "func (x *fastReflection_MsgUndelegateResponse) Interface() protoreflect.ProtoMessage {\n\treturn (*MsgUndelegateResponse)(x)\n}", "title": "" }, { "docid": "0324dcd14ad4b5d87a1fc8ce46a963d7", "score": "0.47722083", "text": "func (s Statistics) Interface() string {\n\treturn C.GoString(&s.wrap.ifname[0])\n}", "title": "" }, { "docid": "682351d27ec56b797ba12bb0ce47d6a0", "score": "0.4766154", "text": "func (client *Client) Shutdown() error {\n\terr := client.Send(ShutdownCommand)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tclient.Close()\n\n\treturn nil\n}", "title": "" }, { "docid": "9e41eefeb84e28d42bd155c5a6a34d06", "score": "0.47609133", "text": "func (emf *emfExporter) Shutdown(ctx context.Context) error {\n\tclose(emf.shutdownChan)\n\temf.pusherWG.Wait()\n\treturn nil\n}", "title": "" }, { "docid": "807bbf81533367cfbd37fd3c59903dc8", "score": "0.47601128", "text": "func (s *stnServer) StealInterface(ctx context.Context, req *stn.STNRequest) (*stn.STNReply, error) {\n\tlog.Println(\"GRPC StealInterface request:\", req)\n\n\t// unconfigure the interface & remember the original config\n\tifData, err := s.unconfigureInterface(req.InterfaceName, req.DhcpEnabled)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn s.grpcReplyError(err), err\n\t}\n\n\t// generate GRPC response\n\tresp := s.grpcReplyData(ifData)\n\tlog.Println(\"Returning GRPC data:\", resp)\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "f87071f0b44cdf816a14afad948ec2f8", "score": "0.47561827", "text": "func (s *Service) Shutdown() {\n\ts.Stop <- os.Signal(os.Interrupt)\n}", "title": "" }, { "docid": "68ffa8c157d3f6c0757e5c5a0098094b", "score": "0.47535437", "text": "func (client *DartClient) Shutdown() {\n\tclient.tickerQuit <- true\n}", "title": "" }, { "docid": "d3ec135a7913d35d174ed8ad43bb04fd", "score": "0.47490966", "text": "func (x *fastReflection_RequestEndBlock) Interface() protoreflect.ProtoMessage {\n\treturn (*RequestEndBlock)(x)\n}", "title": "" }, { "docid": "8ad2a5a51361a6a5233942cf3d49496d", "score": "0.47314742", "text": "func (s *Service) Shutdown(_ context.Context) error {\n\treturn nil\n}", "title": "" }, { "docid": "be1802f73be931c3495f2ecc28b63362", "score": "0.47268865", "text": "func (d *Dynamic) OnFinalShutdown() error {\n\treturn d.stopServer()\n}", "title": "" }, { "docid": "26653009a4b33e10fdaff4eb09df1be5", "score": "0.47220507", "text": "func (nilu *NetInterfaceLayerUpdate) Mutation() *NetInterfaceLayerMutation {\n\treturn nilu.mutation\n}", "title": "" }, { "docid": "c7a28a878716b3b21afe35c9c23f6b70", "score": "0.47103256", "text": "func (wk *Worker) Shutdown(args *ShutdownArgs, res *ShutdownReply) error {\n\tDPrintf(\"Shutdown %s\\n\", wk.name)\n\tres.Njobs = wk.nJobs\n\tres.OK = true\n\twk.nRPC = 1 // OK, because the same thread reads nRPC\n\twk.nJobs-- // Don't count the shutdown RPC\n\treturn nil\n}", "title": "" }, { "docid": "a94f7627d9434601f23873c9eeb1a821", "score": "0.46901238", "text": "func (dsl *DeleteDSL) Interface(interfaceName string) vppclient.DeleteDSL {\n\tdsl.parent.del = append(dsl.parent.del, &interfaces.Interfaces_Interface{\n\t\tName: interfaceName,\n\t})\n\treturn dsl\n}", "title": "" }, { "docid": "a14471862cdc5bb13bbbe4dc802bb1c9", "score": "0.4688878", "text": "func Shutdown() {\n}", "title": "" }, { "docid": "fd3f08442a666dd288b3fd0bac4857d3", "score": "0.468371", "text": "func (a *API) Shutdown() error {\n\t_, err := a.Exec(\"shutdown\")\n\treturn err\n}", "title": "" }, { "docid": "d8aae318b2e1a953b9672d15f14369e0", "score": "0.46791422", "text": "func (cn *ShutdownNotifier) Shutdown() error {\n\tcn.mu.Lock()\n\tif cn.closed {\n\t\tcn.mu.Unlock()\n\t\treturn nil\n\t}\n\n\tcn.closed = true\n\tcn.mu.Unlock()\n\n\tif cn.l != nil {\n\t\tcn.l.mu.Lock()\n\t\tdelete(cn.l.shutdownNotifiers, cn.id)\n\t\tcn.l.mu.Unlock()\n\t}\n\n\tclose(cn.C)\n\n\treturn nil\n}", "title": "" }, { "docid": "e2cf531c5f6e8ad3c45938dbc91188fa", "score": "0.46748552", "text": "func (server *SimulatorController) Shutdown() {\n\tserver.grpcServer.Stop()\n\tserver.listener.Close()\n}", "title": "" }, { "docid": "471ac258c3fc611741462b73d0a07bc6", "score": "0.46744722", "text": "func (o *ObjectWatcher) Shutdown() {\n\tclose(o.quit)\n}", "title": "" }, { "docid": "249da3f7d455bf52e8c62c36d06043d5", "score": "0.4665298", "text": "func (s *SDK) Shutdown() error {\n\t_, err := s.client.Shutdown(s.ctx, &sdk.Empty{})\n\treturn errors.Wrapf(err, \"could not send Shutdown message\")\n}", "title": "" }, { "docid": "e5a8192f0d9813a26d8ba27c0cfeb1da", "score": "0.46606594", "text": "func (a *Amigo) Shutdown() {\n\ta.quit <- true\n}", "title": "" }, { "docid": "c7dfe835ea7ea22786878af804d40908", "score": "0.46569464", "text": "func (pub *Publisher) Shutdown() error {\n\treturn pub.socket.Close()\n}", "title": "" }, { "docid": "6a87fea290efc8970d8f264eb1e25efd", "score": "0.46526054", "text": "func (t *Bfd) DeleteInterface(Id string) {\n\tkey := Id\n\n\tdelete(t.Interface, key)\n}", "title": "" }, { "docid": "f117eb30c0f58693812e38b29f69970b", "score": "0.46365368", "text": "func (ns *NatsRPCServer) Shutdown() error {\n\tclose(ns.stopChan)\n\treturn nil\n}", "title": "" }, { "docid": "1c2898a1419aa968252c7f7147207c3a", "score": "0.4633583", "text": "func (m *NetInterfaceLayerMutation) ResetInterfaceLayer() {\n\tm.interface_layer = nil\n\tm.addinterface_layer = nil\n}", "title": "" }, { "docid": "f7b383885f6fdf4db12c0f65e7f45ba7", "score": "0.4626165", "text": "func (r *RunUnit) Shutdown() {\n\t// debug.PrintStack()\n\tif !r.shuttingDown.Load() {\n\t\tr.shuttingDown.Store(true)\n\t\tr.quit.Q()\n\t}\n}", "title": "" }, { "docid": "c422fe0a92af99fa5b98aafab405d3c4", "score": "0.46228626", "text": "func (t *NetworkInstance_Interface) GetSubinterface() uint32 {\n\tif t == nil || t.Subinterface == nil {\n\t\treturn 0\n\t}\n\treturn *t.Subinterface\n}", "title": "" }, { "docid": "1ed929e37a3c152551cd974ecd4e419b", "score": "0.46226734", "text": "func (evbus *EventBus) Finalize() {\n\tevbus.shutdownSignal = true\n}", "title": "" }, { "docid": "aaa62716499c0a62cdeff0141d50b37f", "score": "0.4621046", "text": "func (n *mockAgent) updateInterface(ctx context.Context, inf *pbTypes.Interface) (*pbTypes.Interface, error) {\n\treturn nil, nil\n}", "title": "" }, { "docid": "6d515882fccdf67f7d049772b4cea8de", "score": "0.46203762", "text": "func (m *NetInterfaceModeMutation) ResetInterfaceMode() {\n\tm.interface_mode = nil\n}", "title": "" }, { "docid": "810dae5e58c426a83396828df7dfbb2a", "score": "0.4611602", "text": "func (t *Interface_Subinterface_Ipv6_Unnumbered_InterfaceRef) GetInterface() string {\n\tif t == nil || t.Interface == nil {\n\t\treturn \"\"\n\t}\n\treturn *t.Interface\n}", "title": "" }, { "docid": "d9e44c4ac7158e7dcaa86d821ba97629", "score": "0.46104184", "text": "func (m *NetInterfaceMutation) InterfaceName() (r string, exists bool) {\n\tv := m.interface_name\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "8517421fec72e12ec5215444c1faa8ac", "score": "0.46035254", "text": "func (Shutdown) Type() string {\n\treturn TypeShutdown\n}", "title": "" }, { "docid": "065b54f321f9ff1a2a5a7fd6a9f98a44", "score": "0.46027732", "text": "func (p *FacebookServiceClient) Shutdown() (err error) {\n\terr = p.SendShutdown()\n\tif err != nil {\n\t\treturn\n\t}\n\treturn\n}", "title": "" }, { "docid": "ba3cb663c90dc7375952d6590cefabb3", "score": "0.45980534", "text": "func (t *NetworkInstance) DeleteInterface(Id string) {\n\tkey := Id\n\n\tdelete(t.Interface, key)\n}", "title": "" }, { "docid": "324f13d46e6d48675cb2e226b4dc3091", "score": "0.45948794", "text": "func (w *Worker) Shutdown() {\n\tfmt.Println(\"SHUTDOWN\")\n\tatomic.StoreInt32(&w.active, 0)\n\tw.rpcListener.Close()\n}", "title": "" }, { "docid": "c8b7ee8d6373aa90c56ba22bd5a4f849", "score": "0.45819372", "text": "func (t *Bfd_Interface_InterfaceRef) GetSubinterface() uint32 {\n\tif t == nil || t.Subinterface == nil {\n\t\treturn 0\n\t}\n\treturn *t.Subinterface\n}", "title": "" }, { "docid": "3e440f593c7ceb8717c84ccf555ad489", "score": "0.45745182", "text": "func (client *XenClient) VIFUnplug(self string) (err error) {\n\t_, err = client.APICall(\"VIF.unplug\", self)\n\tif err != nil {\n\t\treturn\n\t}\n\t// no return result\n\treturn\n}", "title": "" }, { "docid": "a65a705a596d9d3cd4abf2d171e1c4e4", "score": "0.45701912", "text": "func (m *DeviceMutation) ClearInterfaces() {\n\tm.clearedinterfaces = true\n}", "title": "" }, { "docid": "73ac308c248a3670cf7bf3b930a87c4f", "score": "0.4568773", "text": "func ExecuteShutdown(w http.ResponseWriter, r *http.Request) {\n\tswitch r.Method {\n\tcase http.MethodGet:\n\t\tif _, err := fmt.Fprintf(w, \"Server is gracefully shutting down.\"); err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tIsShuttingDown <- true\n\n\tdefault:\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\tlog.Printf(\"Unsupported HTTP method '%v'\", r.Method)\n\t}\n}", "title": "" }, { "docid": "d0f5ee74759f6afbe5708f57011701c0", "score": "0.4556958", "text": "func (u *Device) ReleaseInterface(n uint32) error {\n\te := u.dev.ReleaseInterface(n)\n\treturn e\n}", "title": "" }, { "docid": "ba0b213500a7cd58432348fd0f10679b", "score": "0.45564604", "text": "func (t *Interface_RoutedVlan_Ipv6_Unnumbered_InterfaceRef) GetInterface() string {\n\tif t == nil || t.Interface == nil {\n\t\treturn \"\"\n\t}\n\treturn *t.Interface\n}", "title": "" }, { "docid": "06540c900cb4e392797d28da41d86398", "score": "0.45564586", "text": "func (p *Proxy) Shutdown() {\n\tif atomic.LoadInt32(&p.quit) == 1 {\n\t\treturn\n\t}\n\tatomic.StoreInt32(&p.quit, 1)\n\tp.Listener.Close()\n\tp.handlers.Done()\n}", "title": "" }, { "docid": "19f90ac538d71071eec649b175fc8c8c", "score": "0.45507747", "text": "func (t *NetworkInstance_Interface) GetInterface() string {\n\tif t == nil || t.Interface == nil {\n\t\treturn \"\"\n\t}\n\treturn *t.Interface\n}", "title": "" }, { "docid": "0d28ec0fe25e826fa30b10b7ce4d4a86", "score": "0.4546485", "text": "func (defaultResponseHandler) Shutdown() {}", "title": "" }, { "docid": "edf29971a85351c0b812c0ab12fe1388", "score": "0.45454013", "text": "func (_c *InterfaceClient) Close() error {\n\treturn _c.client.Close()\n}", "title": "" } ]
955b6efa2d1010d2e42e85989725211a
NewRulePushAggDownGather creates a new Transformation PushAggDownGather. The pattern of this rule is: `Aggregation > TiKVSingleGather`.
[ { "docid": "26681b2bdbf8c0a21f0516416599faf4", "score": "0.8594274", "text": "func NewRulePushAggDownGather() Transformation {\n\trule := &PushAggDownGather{}\n\trule.pattern = memo.BuildPattern(\n\t\tmemo.OperandAggregation,\n\t\tmemo.EngineTiDBOnly,\n\t\tmemo.NewPattern(memo.OperandTiKVSingleGather, memo.EngineTiDBOnly),\n\t)\n\treturn rule\n}", "title": "" } ]
[ { "docid": "b5b4459948c0253929ed78273bbf75cf", "score": "0.7151023", "text": "func NewRulePushTopNDownTiKVSingleGather() Transformation {\n\trule := &PushTopNDownTiKVSingleGather{}\n\trule.pattern = memo.BuildPattern(\n\t\tmemo.OperandTopN,\n\t\tmemo.EngineTiDBOnly,\n\t\tmemo.NewPattern(memo.OperandTiKVSingleGather, memo.EngineTiDBOnly),\n\t)\n\treturn rule\n}", "title": "" }, { "docid": "6ac19bf0fccb1fbeff29acd79ccad9a4", "score": "0.6927867", "text": "func NewRulePushLimitDownTiKVSingleGather() Transformation {\n\trule := &PushLimitDownTiKVSingleGather{}\n\trule.pattern = memo.BuildPattern(\n\t\tmemo.OperandLimit,\n\t\tmemo.EngineTiDBOnly,\n\t\tmemo.NewPattern(memo.OperandTiKVSingleGather, memo.EngineTiDBOnly),\n\t)\n\treturn rule\n}", "title": "" }, { "docid": "26d0b5ff3c45066de790fc60c86ae88e", "score": "0.6828411", "text": "func NewRulePushSelDownTiKVSingleGather() Transformation {\n\tany1 := memo.NewPattern(memo.OperandAny, memo.EngineTiKVOrTiFlash)\n\ttg := memo.BuildPattern(memo.OperandTiKVSingleGather, memo.EngineTiDBOnly, any1)\n\tp := memo.BuildPattern(memo.OperandSelection, memo.EngineTiDBOnly, tg)\n\n\trule := &PushSelDownTiKVSingleGather{}\n\trule.pattern = p\n\treturn rule\n}", "title": "" }, { "docid": "798cd9266a09cf36f9cac720fed9283a", "score": "0.66700834", "text": "func NewRulePushSelDownAggregation() Transformation {\n\trule := &PushSelDownAggregation{}\n\trule.pattern = memo.BuildPattern(\n\t\tmemo.OperandSelection,\n\t\tmemo.EngineAll,\n\t\tmemo.NewPattern(memo.OperandAggregation, memo.EngineAll),\n\t)\n\treturn rule\n}", "title": "" }, { "docid": "95b1b0ded7510228bd12804a5dd378ac", "score": "0.5991658", "text": "func NewRulePushLimitDownUnionAll() Transformation {\n\trule := &PushLimitDownUnionAll{}\n\trule.pattern = memo.BuildPattern(\n\t\tmemo.OperandLimit,\n\t\tmemo.EngineTiDBOnly,\n\t\tmemo.NewPattern(memo.OperandUnionAll, memo.EngineTiDBOnly),\n\t)\n\treturn rule\n}", "title": "" }, { "docid": "d8878bdbd6a0b70927215bdf8764384c", "score": "0.5909169", "text": "func NewRulePushSelDownUnionAll() Transformation {\n\trule := &PushSelDownUnionAll{}\n\trule.pattern = memo.BuildPattern(\n\t\tmemo.OperandSelection,\n\t\tmemo.EngineTiDBOnly,\n\t\tmemo.NewPattern(memo.OperandUnionAll, memo.EngineTiDBOnly),\n\t)\n\treturn rule\n}", "title": "" }, { "docid": "2acfab4f4ba0eb5bcbd5135e75020096", "score": "0.58699095", "text": "func NewRulePushTopNDownUnionAll() Transformation {\n\trule := &PushTopNDownUnionAll{}\n\trule.pattern = memo.BuildPattern(\n\t\tmemo.OperandTopN,\n\t\tmemo.EngineTiDBOnly,\n\t\tmemo.NewPattern(memo.OperandUnionAll, memo.EngineTiDBOnly),\n\t)\n\treturn rule\n}", "title": "" }, { "docid": "6e26b1e6eaade7fba974ba426b33abe4", "score": "0.5651709", "text": "func NewRulePushSelDownSort() Transformation {\n\trule := &PushSelDownSort{}\n\trule.pattern = memo.BuildPattern(\n\t\tmemo.OperandSelection,\n\t\tmemo.EngineTiDBOnly,\n\t\tmemo.NewPattern(memo.OperandSort, memo.EngineTiDBOnly),\n\t)\n\treturn rule\n}", "title": "" }, { "docid": "94aa27f5b1ec3a7b36794ef7407ba74f", "score": "0.56407", "text": "func NewRulePushSelDownJoin() Transformation {\n\trule := &PushSelDownJoin{}\n\trule.pattern = memo.BuildPattern(\n\t\tmemo.OperandSelection,\n\t\tmemo.EngineTiDBOnly,\n\t\tmemo.NewPattern(memo.OperandJoin, memo.EngineTiDBOnly),\n\t)\n\treturn rule\n}", "title": "" }, { "docid": "c31b4d32070067d3ae4623e08072802f", "score": "0.553541", "text": "func NewRulePushSelDownWindow() Transformation {\n\trule := &PushSelDownWindow{}\n\trule.pattern = memo.BuildPattern(\n\t\tmemo.OperandSelection,\n\t\tmemo.EngineTiDBOnly,\n\t\tmemo.NewPattern(memo.OperandWindow, memo.EngineAll),\n\t)\n\treturn rule\n}", "title": "" }, { "docid": "8ed6ae25b6d3b339b6ac9b802da2b4df", "score": "0.53480947", "text": "func NewRulePushLimitDownProjection() Transformation {\n\trule := &PushLimitDownProjection{}\n\trule.pattern = memo.BuildPattern(\n\t\tmemo.OperandLimit,\n\t\tmemo.EngineTiDBOnly,\n\t\tmemo.NewPattern(memo.OperandProjection, memo.EngineTiDBOnly),\n\t)\n\treturn rule\n}", "title": "" }, { "docid": "a87b4eddab04038ffcf1e373e8b1da7a", "score": "0.53312796", "text": "func NewRulePushSelDownProjection() Transformation {\n\trule := &PushSelDownProjection{}\n\trule.pattern = memo.BuildPattern(\n\t\tmemo.OperandSelection,\n\t\tmemo.EngineTiDBOnly,\n\t\tmemo.NewPattern(memo.OperandProjection, memo.EngineTiDBOnly),\n\t)\n\treturn rule\n}", "title": "" }, { "docid": "3e3d41a3fc126c0de69a7245c71df134", "score": "0.5319458", "text": "func (*PushSelDownTiKVSingleGather) OnTransform(old *memo.ExprIter) (newExprs []*memo.GroupExpr, eraseOld bool, eraseAll bool, err error) {\n\tsel := old.GetExpr().ExprNode.(*plannercore.LogicalSelection)\n\tsg := old.Children[0].GetExpr().ExprNode.(*plannercore.TiKVSingleGather)\n\tchildGroup := old.Children[0].Children[0].Group\n\tvar pushed, remained []expression.Expression\n\tsctx := sg.SCtx()\n\tpushed, remained = expression.PushDownExprs(sctx.GetSessionVars().StmtCtx, sel.Conditions, sctx.GetClient(), kv.TiKV)\n\tif len(pushed) == 0 {\n\t\treturn nil, false, false, nil\n\t}\n\tpushedSel := plannercore.LogicalSelection{Conditions: pushed}.Init(sctx, sel.SelectBlockOffset())\n\tpushedSelExpr := memo.NewGroupExpr(pushedSel)\n\tpushedSelExpr.Children = append(pushedSelExpr.Children, childGroup)\n\tpushedSelGroup := memo.NewGroupWithSchema(pushedSelExpr, childGroup.Prop.Schema).SetEngineType(childGroup.EngineType)\n\t// The field content of TiKVSingleGather would not be modified currently, so we\n\t// just reference the same tg instead of making a copy of it.\n\t//\n\t// TODO: if we save pushed filters later in TiKVSingleGather, in order to do partition\n\t// pruning or skyline pruning, we need to make a copy of the TiKVSingleGather here.\n\ttblGatherExpr := memo.NewGroupExpr(sg)\n\ttblGatherExpr.Children = append(tblGatherExpr.Children, pushedSelGroup)\n\tif len(remained) == 0 {\n\t\t// `oldSel -> oldTg -> any` is transformed to `newTg -> pushedSel -> any`.\n\t\treturn []*memo.GroupExpr{tblGatherExpr}, true, false, nil\n\t}\n\ttblGatherGroup := memo.NewGroupWithSchema(tblGatherExpr, pushedSelGroup.Prop.Schema)\n\tremainedSel := plannercore.LogicalSelection{Conditions: remained}.Init(sel.SCtx(), sel.SelectBlockOffset())\n\tremainedSelExpr := memo.NewGroupExpr(remainedSel)\n\tremainedSelExpr.Children = append(remainedSelExpr.Children, tblGatherGroup)\n\t// `oldSel -> oldTg -> any` is transformed to `remainedSel -> newTg -> pushedSel -> any`.\n\treturn []*memo.GroupExpr{remainedSelExpr}, true, false, nil\n}", "title": "" }, { "docid": "1eb2276948c056f02aca2149b698ee70", "score": "0.5296319", "text": "func NewRulePushTopNDownProjection() Transformation {\n\trule := &PushTopNDownProjection{}\n\trule.pattern = memo.BuildPattern(\n\t\tmemo.OperandTopN,\n\t\tmemo.EngineTiDBOnly,\n\t\tmemo.NewPattern(memo.OperandProjection, memo.EngineTiDBOnly),\n\t)\n\treturn rule\n}", "title": "" }, { "docid": "71b066460560b6f57fd49a537725e963", "score": "0.52458066", "text": "func NewRulePushSelDownTableScan() Transformation {\n\trule := &PushSelDownTableScan{}\n\tts := memo.NewPattern(memo.OperandTableScan, memo.EngineTiKVOrTiFlash)\n\tp := memo.BuildPattern(memo.OperandSelection, memo.EngineTiKVOrTiFlash, ts)\n\trule.pattern = p\n\treturn rule\n}", "title": "" }, { "docid": "a75b3e08d39a9978474ba7fd46b5d7d6", "score": "0.51412135", "text": "func (r *PushAggDownGather) OnTransform(old *memo.ExprIter) (newExprs []*memo.GroupExpr, eraseOld bool, eraseAll bool, err error) {\n\tagg := old.GetExpr().ExprNode.(*plannercore.LogicalAggregation)\n\taggSchema := old.GetExpr().Group.Prop.Schema\n\tgather := old.Children[0].GetExpr().ExprNode.(*plannercore.TiKVSingleGather)\n\tchildGroup := old.Children[0].GetExpr().Children[0]\n\t// The old Aggregation should stay unchanged for other transformation.\n\t// So we build a new LogicalAggregation for the partialAgg.\n\taggFuncs := make([]*aggregation.AggFuncDesc, len(agg.AggFuncs))\n\tfor i := range agg.AggFuncs {\n\t\taggFuncs[i] = agg.AggFuncs[i].Clone()\n\t}\n\tgbyItems := make([]expression.Expression, len(agg.GroupByItems))\n\tcopy(gbyItems, agg.GroupByItems)\n\n\tpartialPref, finalPref, firstRowFuncMap := plannercore.BuildFinalModeAggregation(agg.SCtx(),\n\t\t&plannercore.AggInfo{\n\t\t\tAggFuncs: aggFuncs,\n\t\t\tGroupByItems: gbyItems,\n\t\t\tSchema: aggSchema,\n\t\t}, true, false)\n\tif partialPref == nil {\n\t\treturn nil, false, false, nil\n\t}\n\t// Remove unnecessary FirstRow.\n\tpartialPref.AggFuncs =\n\t\tplannercore.RemoveUnnecessaryFirstRow(agg.SCtx(), finalPref.GroupByItems, partialPref.AggFuncs, partialPref.GroupByItems, partialPref.Schema, firstRowFuncMap)\n\n\tpartialAgg := plannercore.LogicalAggregation{\n\t\tAggFuncs: partialPref.AggFuncs,\n\t\tGroupByItems: partialPref.GroupByItems,\n\t}.Init(agg.SCtx(), agg.SelectBlockOffset())\n\tpartialAgg.CopyAggHints(agg)\n\n\tfinalAgg := plannercore.LogicalAggregation{\n\t\tAggFuncs: finalPref.AggFuncs,\n\t\tGroupByItems: finalPref.GroupByItems,\n\t}.Init(agg.SCtx(), agg.SelectBlockOffset())\n\tfinalAgg.CopyAggHints(agg)\n\n\tpartialAggExpr := memo.NewGroupExpr(partialAgg)\n\tpartialAggExpr.SetChildren(childGroup)\n\tpartialAggGroup := memo.NewGroupWithSchema(partialAggExpr, partialPref.Schema).SetEngineType(childGroup.EngineType)\n\tgatherExpr := memo.NewGroupExpr(gather)\n\tgatherExpr.SetChildren(partialAggGroup)\n\tgatherGroup := memo.NewGroupWithSchema(gatherExpr, partialPref.Schema)\n\tfinalAggExpr := memo.NewGroupExpr(finalAgg)\n\tfinalAggExpr.SetChildren(gatherGroup)\n\tfinalAggExpr.AddAppliedRule(r)\n\t// We don't erase the old complete mode Aggregation because\n\t// this transformation would not always be better.\n\treturn []*memo.GroupExpr{finalAggExpr}, false, false, nil\n}", "title": "" }, { "docid": "b135fffb7053b81fa8fe32482f67efb2", "score": "0.50085706", "text": "func NewRulePushSelDownIndexScan() Transformation {\n\trule := &PushSelDownIndexScan{}\n\trule.pattern = memo.BuildPattern(\n\t\tmemo.OperandSelection,\n\t\tmemo.EngineTiKVOnly,\n\t\tmemo.NewPattern(memo.OperandIndexScan, memo.EngineTiKVOnly),\n\t)\n\treturn rule\n}", "title": "" }, { "docid": "6da890c81c9bb553ccddac05326d76b7", "score": "0.5005887", "text": "func Pushdown(c *sql.Context, a *analyzer.Analyzer, n sql.Node) (sql.Node, error) {\n\tchanged := false\n\t\n\ttxform := func(old sql.Node) (sql.Node, error) {\n\t\tnode,ok := removeCruft(old)\n\t\tif ok { changed,old = true,node }\n\t\t\n\t\tnode,ok = pushdown(old)\n\t\tif ok { changed,old = true,node }\n\t\t\n\t\t//fmt.Println(\"-\",node)\n\t\t\n\t\treturn old,nil\n\t}\n\t\n\tnn,err := legacy.TransformDownNode(n,txform)\n\t\n\tif err!=nil { return nil,err }\n\tif !changed { return n,nil }\n\t/*\n\tfor i := 1; changed && i<8 ; i++ {\n\t\tchanged = false\n\t\tnn,err = legacy.TransformUpNode(n,txform)\n\t\tif err!=nil { return nil,err }\n\t}\n\t*/\n\t\n\treturn nn,nil\n}", "title": "" }, { "docid": "62be2d98eb5da53f9d81bb906ca45fae", "score": "0.49233073", "text": "func NewRulePushLimitDownOuterJoin() Transformation {\n\trule := &PushLimitDownOuterJoin{}\n\trule.pattern = memo.BuildPattern(\n\t\tmemo.OperandLimit,\n\t\tmemo.EngineTiDBOnly,\n\t\tmemo.NewPattern(memo.OperandJoin, memo.EngineTiDBOnly),\n\t)\n\treturn rule\n}", "title": "" }, { "docid": "b0a5a8aef1865438db1915a2c2270297", "score": "0.4903943", "text": "func NewRulePullSelectionUpApply() Transformation {\n\trule := &PullSelectionUpApply{}\n\trule.pattern = memo.BuildPattern(\n\t\tmemo.OperandApply,\n\t\tmemo.EngineTiDBOnly,\n\t\tmemo.NewPattern(memo.OperandAny, memo.EngineTiDBOnly), // outer child\n\t\tmemo.NewPattern(memo.OperandSelection, memo.EngineTiDBOnly), // inner child\n\t)\n\treturn rule\n}", "title": "" }, { "docid": "e76786f631951954b0c2f00de73301b9", "score": "0.48558283", "text": "func Pullup(deps ...*flow.Flow) *flow.Flow {\n\treturn &flow.Flow{Op: flow.Pullup, Ident: randString(), Deps: deps}\n}", "title": "" }, { "docid": "03fff5100ae815855ffca77dda7beac3", "score": "0.4809826", "text": "func (*PushSelDownAggregation) OnTransform(old *memo.ExprIter) (newExprs []*memo.GroupExpr, eraseOld bool, eraseAll bool, err error) {\n\tsel := old.GetExpr().ExprNode.(*plannercore.LogicalSelection)\n\tagg := old.Children[0].GetExpr().ExprNode.(*plannercore.LogicalAggregation)\n\taggSchema := old.Children[0].Prop.Schema\n\tvar pushedExprs []expression.Expression\n\tvar remainedExprs []expression.Expression\n\tgroupByColumns := expression.NewSchema(agg.GetGroupByCols()...)\n\tfor _, cond := range sel.Conditions {\n\t\tswitch cond.(type) {\n\t\tcase *expression.Constant:\n\t\t\t// Consider SQL list \"select sum(b) from t group by a having 1=0\". \"1=0\" is a constant predicate which should be\n\t\t\t// retained and pushed down at the same time. Because we will get a wrong query result that contains one column\n\t\t\t// with value 0 rather than an empty query result.\n\t\t\tpushedExprs = append(pushedExprs, cond)\n\t\t\tremainedExprs = append(remainedExprs, cond)\n\t\tcase *expression.ScalarFunction:\n\t\t\textractedCols := expression.ExtractColumns(cond)\n\t\t\tcanPush := true\n\t\t\tfor _, col := range extractedCols {\n\t\t\t\tif !groupByColumns.Contains(col) {\n\t\t\t\t\tcanPush = false\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif canPush {\n\t\t\t\tpushedExprs = append(pushedExprs, cond)\n\t\t\t} else {\n\t\t\t\tremainedExprs = append(remainedExprs, cond)\n\t\t\t}\n\t\tdefault:\n\t\t\tremainedExprs = append(remainedExprs, cond)\n\t\t}\n\t}\n\t// If no condition can be pushed, keep the selection unchanged.\n\tif len(pushedExprs) == 0 {\n\t\treturn nil, false, false, nil\n\t}\n\tsctx := sel.SCtx()\n\tchildGroup := old.Children[0].GetExpr().Children[0]\n\tpushedSel := plannercore.LogicalSelection{Conditions: pushedExprs}.Init(sctx, sel.SelectBlockOffset())\n\tpushedGroupExpr := memo.NewGroupExpr(pushedSel)\n\tpushedGroupExpr.SetChildren(childGroup)\n\tpushedGroup := memo.NewGroupWithSchema(pushedGroupExpr, childGroup.Prop.Schema)\n\n\taggGroupExpr := memo.NewGroupExpr(agg)\n\taggGroupExpr.SetChildren(pushedGroup)\n\n\tif len(remainedExprs) == 0 {\n\t\treturn []*memo.GroupExpr{aggGroupExpr}, true, false, nil\n\t}\n\n\taggGroup := memo.NewGroupWithSchema(aggGroupExpr, aggSchema)\n\tremainedSel := plannercore.LogicalSelection{Conditions: remainedExprs}.Init(sctx, sel.SelectBlockOffset())\n\tremainedGroupExpr := memo.NewGroupExpr(remainedSel)\n\tremainedGroupExpr.SetChildren(aggGroup)\n\treturn []*memo.GroupExpr{remainedGroupExpr}, true, false, nil\n}", "title": "" }, { "docid": "46205666dd9b5a7279c8a86afedb325d", "score": "0.47903162", "text": "func (ms *mergeSort) PushGroupBy(groupBy sqlparser.GroupBy) error {\n\treturn ms.input.PushGroupBy(groupBy)\n}", "title": "" }, { "docid": "46205666dd9b5a7279c8a86afedb325d", "score": "0.47903162", "text": "func (ms *mergeSort) PushGroupBy(groupBy sqlparser.GroupBy) error {\n\treturn ms.input.PushGroupBy(groupBy)\n}", "title": "" }, { "docid": "2d612ac6ad1ae3b4f83159f6a09518de", "score": "0.4739364", "text": "func (gcs *GPUCostModel)UnschedAggToSink(jd *JobDescriptor) *ArcDescriptor {\n\treturn &ArcDescriptor{\n\t\tcapLower:0,\n\t\tcapUpper:0,\n\t\tcost:50,\n\t}\n}", "title": "" }, { "docid": "083ebf4e2d20da3893117ec92caa4aef", "score": "0.47076127", "text": "func (r *PushTopNDownTiKVSingleGather) OnTransform(old *memo.ExprIter) (newExprs []*memo.GroupExpr, eraseOld bool, eraseAll bool, err error) {\n\ttopN := old.GetExpr().ExprNode.(*plannercore.LogicalTopN)\n\ttopNSchema := old.Children[0].Group.Prop.Schema\n\tgather := old.Children[0].GetExpr().ExprNode.(*plannercore.TiKVSingleGather)\n\tchildGroup := old.Children[0].GetExpr().Children[0]\n\n\tparticalTopN := plannercore.LogicalTopN{\n\t\tByItems: topN.ByItems,\n\t\tCount: topN.Count + topN.Offset,\n\t}.Init(topN.SCtx(), topN.SelectBlockOffset())\n\tpartialTopNExpr := memo.NewGroupExpr(particalTopN)\n\tpartialTopNExpr.SetChildren(childGroup)\n\tpartialTopNGroup := memo.NewGroupWithSchema(partialTopNExpr, topNSchema).SetEngineType(childGroup.EngineType)\n\n\tgatherExpr := memo.NewGroupExpr(gather)\n\tgatherExpr.SetChildren(partialTopNGroup)\n\tgatherGroup := memo.NewGroupWithSchema(gatherExpr, topNSchema)\n\n\tfinalTopNExpr := memo.NewGroupExpr(topN)\n\tfinalTopNExpr.SetChildren(gatherGroup)\n\tfinalTopNExpr.AddAppliedRule(r)\n\treturn []*memo.GroupExpr{finalTopNExpr}, true, false, nil\n}", "title": "" }, { "docid": "ccb77aba5ce39fc02ba8d063c9817c75", "score": "0.46364385", "text": "func newBvGatherer(fvg *fvGatherer, breakouts interface{}) *bvGatherer {\n\tg := bvGatherer{\n\t\tfvg: fvg,\n\t\tbreakOutList: make(map[ast.Node]struct{}),\n\t}\n\tswitch breakouts := breakouts.(type) {\n\tdefault:\n\t\ttyp := reflect.TypeOf(breakouts)\n\t\tif typ != nil {\n\t\t\tpanic(fmt.Sprintf(\"I just can't coppe. Type of breakouts is: %s\\n\", typ.String()))\n\t\t}\n\t\tpanic(\"wtf\")\n\tcase []ast.Node:\n\t\tfor _, b := range breakouts {\n\t\t\tg.breakOutList[b] = struct{}{}\n\t\t}\n\tcase []ast.Expr:\n\t\tfor _, b := range breakouts {\n\t\t\tvar bNode ast.Node\n\t\t\tbNode = b\n\t\t\tg.breakOutList[bNode] = struct{}{}\n\t\t}\n\t}\n\treturn &g\n}", "title": "" }, { "docid": "c985d8c21dce997f2cce7e43bec8f410", "score": "0.46347353", "text": "func NewRulePushTopNDownOuterJoin() Transformation {\n\trule := &PushTopNDownOuterJoin{}\n\trule.pattern = memo.BuildPattern(\n\t\tmemo.OperandTopN,\n\t\tmemo.EngineTiDBOnly,\n\t\tmemo.NewPattern(memo.OperandJoin, memo.EngineTiDBOnly),\n\t)\n\treturn rule\n}", "title": "" }, { "docid": "03a34dfe6a03e6c32b670fa919812a92", "score": "0.4621917", "text": "func NewPush(lng ipld.NodeGetter, info *dag.Info, remote DagSyncable, pinOnComplete bool) (*Push, error) {\n\tparallelism := defaultPushParallelism\n\tif len(info.Manifest.Nodes) < parallelism {\n\t\tparallelism = len(info.Manifest.Nodes)\n\t}\n\n\tps := &Push{\n\t\tpinOnComplete: pinOnComplete,\n\t\tinfo: info,\n\t\tlng: lng,\n\t\tremote: remote,\n\t\tparallelism: parallelism,\n\t\tblocksCh: make(chan string),\n\t\tprogCh: make(chan dag.Completion),\n\t\tresponses: make(chan ReceiveResponse),\n\t\tretries: make(chan string),\n\t}\n\treturn ps, nil\n}", "title": "" }, { "docid": "b19b78a1fdd1180bd8f80cfa6636ca72", "score": "0.4605092", "text": "func New(t terminal.Terminal, cl client.Client, token string, interval time.Duration) *Gatherer {\n\tg := &Gatherer{\n\t\tk8sClient: cl,\n\t\tqueryInterval: interval,\n\t\tterm: t,\n\t}\n\n\tprometheusClient := GetPrometheusClient(t, cl, token)\n\n\t// Add default queries\n\tg.AddQueries(\n\t\tqueries.QueryClusterCPUUtilisation(prometheusClient),\n\t\tqueries.QueryClusterMemoryUtilisation(prometheusClient),\n\t\tqueries.QueryNodeMemoryUtilisation(prometheusClient),\n\t\tqueries.QueryEtcdMemoryUsage(prometheusClient),\n\t\tqueries.QueryWorkloadCPUUsage(prometheusClient, OLMOperatorNamespace, OLMOperatorWorkload),\n\t\tqueries.QueryWorkloadMemoryUsage(prometheusClient, OLMOperatorNamespace, OLMOperatorWorkload),\n\t\tqueries.QueryOpenshiftKubeAPIMemoryUtilisation(prometheusClient),\n\t\tqueries.QueryWorkloadCPUUsage(prometheusClient, OSAPIServerNamespace, OSAPIServerWorkload),\n\t\tqueries.QueryWorkloadMemoryUsage(prometheusClient, OSAPIServerNamespace, OSAPIServerWorkload),\n\t\tqueries.QueryWorkloadCPUUsage(prometheusClient, cfg.HostOperatorNamespace, cfg.HostOperatorWorkload),\n\t\tqueries.QueryWorkloadMemoryUsage(prometheusClient, cfg.HostOperatorNamespace, cfg.HostOperatorWorkload),\n\t\tqueries.QueryWorkloadCPUUsage(prometheusClient, cfg.MemberOperatorNamespace, cfg.MemberOperatorWorkload),\n\t\tqueries.QueryWorkloadMemoryUsage(prometheusClient, cfg.MemberOperatorNamespace, cfg.MemberOperatorWorkload),\n\t)\n\tg.results = make(map[string]aggregateResult, len(g.mqueries))\n\n\treturn g\n}", "title": "" }, { "docid": "b7bdfdac68d0f242a590e60c6971eaec", "score": "0.45775014", "text": "func NewRuleInjectProjectionBelowAgg() Transformation {\n\trule := &InjectProjectionBelowAgg{}\n\trule.pattern = memo.BuildPattern(\n\t\tmemo.OperandAggregation,\n\t\tmemo.EngineTiDBOnly,\n\t)\n\treturn rule\n}", "title": "" }, { "docid": "729fce75f0b830ab045811adbf552ff8", "score": "0.45503396", "text": "func push(gatherer prometheus.Gatherer, sendChannels []chan parser.Metric) error {\n\tmfs, err := gatherer.Gather()\n\tif err != nil || len(mfs) == 0 {\n\t\treturn err\n\t}\n\t//for metric := range parser.ParseProm(mfs) {\n\t//\tfor channel := range sendChannels {\n\t//\t\tchannel <- metric\n\t//\t}\n\t//}\n\treturn nil\n}", "title": "" }, { "docid": "64ae53158288f1d815c2f68c666f6296", "score": "0.45328116", "text": "func NewUncheckedCollector(inner prometheus.Collector) *UncheckedCollector {\n\treturn &UncheckedCollector{inner: inner}\n}", "title": "" }, { "docid": "81b478996917c80faf9c1aa6c11acaaf", "score": "0.4507041", "text": "func NewPushInfoCollector() *PushInfoCollector {\n\tvar (\n\t\t//\t\tsubSystem = \"push\"\n\t\tpushLabel = []string{\"productid\"}\n\t)\n\n\t//labels := make(prometheus.Labels)\n\t//\tlabels[\"cluster\"] = cluster\n\n\treturn &PushInfoCollector{\n\n\t\tOnline: prometheus.NewGaugeVec(\n\t\t\tprometheus.GaugeOpts{\n\t\t\t\tNamespace: pushNamespace,\n\t\t\t\tName: \"online\",\n\t\t\t\tHelp: \"push online\",\n\t\t\t\t//\t\t\tConstLabels: labels,\n\t\t\t},\n\t\t\t[]string{\"productid\", \"appname\"},\n\t\t),\n\t\tUserAmount: prometheus.NewGaugeVec(\n\t\t\tprometheus.GaugeOpts{\n\t\t\t\tNamespace: pushNamespace,\n\t\t\t\tName: \"user_amount\",\n\t\t\t\tHelp: \"push user amount\",\n\t\t\t\t//\t\t\t\tConstLabels: labels,\n\t\t\t},\n\t\t\tpushLabel,\n\t\t),\n\t\tMSGID: prometheus.NewGaugeVec(\n\t\t\tprometheus.GaugeOpts{\n\t\t\t\tNamespace: pushNamespace,\n\t\t\t\tName: \"msgid\",\n\t\t\t\tHelp: \"push msgid\",\n\t\t\t\t//\t\tConstLabels: labels,\n\t\t\t},\n\t\t\tpushLabel,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "74dbd64b8ddb7e22aa16a3080d0bd4bf", "score": "0.44609836", "text": "func NewGather(options ...GatherOption) Gather {\n\tg := &gather{}\n\tfor _, o := range options {\n\t\to.ApplyConfig(g)\n\t}\n\treturn g\n}", "title": "" }, { "docid": "91cb0634b64d26e0017e1feb04dace51", "score": "0.44004008", "text": "func newGaugeMutation(c config, op Op, opts ...gaugeOption) *GaugeMutation {\n\tm := &GaugeMutation{\n\t\tconfig: c,\n\t\top: op,\n\t\ttyp: TypeGauge,\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": "62e87a0d74cab2ed7ee06eee3234a8e6", "score": "0.43865222", "text": "func NewRuleEliminateOuterJoinBelowAggregation() Transformation {\n\trule := &EliminateOuterJoinBelowAggregation{}\n\trule.pattern = memo.BuildPattern(\n\t\tmemo.OperandAggregation,\n\t\tmemo.EngineTiDBOnly,\n\t\tmemo.NewPattern(memo.OperandJoin, memo.EngineTiDBOnly),\n\t)\n\treturn rule\n}", "title": "" }, { "docid": "d4a698c9df286ac73b795f8daf78e9a5", "score": "0.43201885", "text": "func (r *PushAggDownGather) Match(expr *memo.ExprIter) bool {\n\tif expr.GetExpr().HasAppliedRule(r) {\n\t\treturn false\n\t}\n\tagg := expr.GetExpr().ExprNode.(*plannercore.LogicalAggregation)\n\tfor _, aggFunc := range agg.AggFuncs {\n\t\tif aggFunc.Mode != aggregation.CompleteMode {\n\t\t\treturn false\n\t\t}\n\t}\n\tif agg.HasDistinct() {\n\t\t// TODO: remove this logic after the cost estimation of distinct pushdown is implemented.\n\t\t// If AllowDistinctAggPushDown is set to true, we should not consider RootTask.\n\t\tif !agg.SCtx().GetSessionVars().AllowDistinctAggPushDown {\n\t\t\treturn false\n\t\t}\n\t}\n\tchildEngine := expr.Children[0].GetExpr().Children[0].EngineType\n\tif childEngine != memo.EngineTiKV {\n\t\t// TODO: Remove this check when we have implemented TiFlashAggregation.\n\t\treturn false\n\t}\n\treturn plannercore.CheckAggCanPushCop(agg.SCtx(), agg.AggFuncs, agg.GroupByItems, kv.TiKV)\n}", "title": "" }, { "docid": "71c6bcf37b10383282cde63f962fe693", "score": "0.4305266", "text": "func NewUnsuback() *Unsuback {\n\treturn &Unsuback{}\n}", "title": "" }, { "docid": "6b4395421f3aee0f1c395f1772ca8d30", "score": "0.4286398", "text": "func NewGatherer(opts ...GathererOption) (Gatherer, error) {\n\tcfg := newGathererConfig(opts...)\n\treader := metric.NewManualReader(cfg.manualReaderOptions()...)\n\n\treturn Gatherer{reader}, nil\n}", "title": "" }, { "docid": "d52fcfd5b984d7c816c68ab38a4e95a6", "score": "0.42798173", "text": "func NewAggregationFailurePusher(t mockConstructorTestingTNewAggregationFailurePusher) *AggregationFailurePusher {\n\tmock := &AggregationFailurePusher{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "title": "" }, { "docid": "782c9c78dba52f7e8498fe216b20cc90", "score": "0.42782718", "text": "func NewGathering() *Gathering {\n\treturn &Gathering{}\n}", "title": "" }, { "docid": "746919de18553d2e5c54e648e09d3912", "score": "0.4273881", "text": "func (r *PushLimitDownTiKVSingleGather) OnTransform(old *memo.ExprIter) (newExprs []*memo.GroupExpr, eraseOld bool, eraseAll bool, err error) {\n\tlimit := old.GetExpr().ExprNode.(*plannercore.LogicalLimit)\n\tlimitSchema := old.Children[0].Group.Prop.Schema\n\tgather := old.Children[0].GetExpr().ExprNode.(*plannercore.TiKVSingleGather)\n\tchildGroup := old.Children[0].GetExpr().Children[0]\n\n\tparticalLimit := plannercore.LogicalLimit{\n\t\tCount: limit.Count + limit.Offset,\n\t}.Init(limit.SCtx(), limit.SelectBlockOffset())\n\tpartialLimitExpr := memo.NewGroupExpr(particalLimit)\n\tpartialLimitExpr.SetChildren(childGroup)\n\tpartialLimitGroup := memo.NewGroupWithSchema(partialLimitExpr, limitSchema).SetEngineType(childGroup.EngineType)\n\n\tgatherExpr := memo.NewGroupExpr(gather)\n\tgatherExpr.SetChildren(partialLimitGroup)\n\tgatherGroup := memo.NewGroupWithSchema(gatherExpr, limitSchema)\n\n\tfinalLimitExpr := memo.NewGroupExpr(limit)\n\tfinalLimitExpr.SetChildren(gatherGroup)\n\tfinalLimitExpr.AddAppliedRule(r)\n\treturn []*memo.GroupExpr{finalLimitExpr}, true, false, nil\n}", "title": "" }, { "docid": "b9bb14bfa8fee1259eccb67c8eeec095", "score": "0.42570415", "text": "func NewPushExporter() *PushExporter {\n\tvar exporter *PushExporter\n\texporter = &PushExporter{\n\t\tcollectors: []prometheus.Collector{\n\t\t\tcollectors.NewPushInfoCollector(),\n\t\t},\n\t}\n\treturn exporter\n}", "title": "" }, { "docid": "4a68c766e54fbbb1f4ec9d127abb8b12", "score": "0.41609812", "text": "func NewReducer(reference interface{}) Reducer {\n\treturn NewMerger(reference).(Reducer)\n}", "title": "" }, { "docid": "4549832ca8b684c84be42fea141d6fb9", "score": "0.41557598", "text": "func (muo *MachineUpdateOne) ClearLastPush() *MachineUpdateOne {\n\tmuo.mutation.ClearLastPush()\n\treturn muo\n}", "title": "" }, { "docid": "c5bb0f40329cd1652785e56ccd8f1b9b", "score": "0.4146984", "text": "func NewUnifiedGroupSource()(*UnifiedGroupSource) {\n m := &UnifiedGroupSource{\n DataSource: *NewDataSource(),\n }\n odataTypeValue := \"#microsoft.graph.security.unifiedGroupSource\";\n m.SetOdataType(&odataTypeValue);\n return m\n}", "title": "" }, { "docid": "ea8288c124fdbf1e24924ba9a46c1789", "score": "0.41391218", "text": "func (diceGene *ChanceGene) Unpack() (addNode, addLink, addBias, perturbWeight, nullifyWeight, turnOn, turnOff, bump float64) {\r\n\taddNode = diceGene.AddNode\r\n\taddLink = diceGene.AddLink\r\n\taddBias = diceGene.AddBias\r\n\tperturbWeight = diceGene.PerturbWeight\r\n\tnullifyWeight = diceGene.NullifyWeight\r\n\tturnOn = diceGene.TurnOn\r\n\tturnOff = diceGene.TurnOff\r\n\tbump = diceGene.Bump\r\n\treturn\r\n}", "title": "" }, { "docid": "fdac8f5535370c1c656e53846adfed13", "score": "0.4120987", "text": "func newGroupMutation(c config, op Op, opts ...groupOption) *GroupMutation {\n\tm := &GroupMutation{\n\t\tconfig: c,\n\t\top: op,\n\t\ttyp: TypeGroup,\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": "fdac8f5535370c1c656e53846adfed13", "score": "0.4120987", "text": "func newGroupMutation(c config, op Op, opts ...groupOption) *GroupMutation {\n\tm := &GroupMutation{\n\t\tconfig: c,\n\t\top: op,\n\t\ttyp: TypeGroup,\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": "5c08b681e20325bdce973411bc0799b8", "score": "0.4101326", "text": "func Push(wr *prompbmarshal.WriteRequest) {\n\tvar rctx *relabelCtx\n\trcs := allRelabelConfigs.Load().(*relabelConfigs)\n\tprcsGlobal := rcs.global\n\tif len(prcsGlobal) > 0 || len(labelsGlobal) > 0 {\n\t\trctx = getRelabelCtx()\n\t}\n\ttss := wr.Timeseries\n\tfor len(tss) > 0 {\n\t\t// Process big tss in smaller blocks in order to reduce the maximum memory usage\n\t\ttssBlock := tss\n\t\tif len(tssBlock) > maxRowsPerBlock {\n\t\t\ttssBlock = tss[:maxRowsPerBlock]\n\t\t\ttss = tss[maxRowsPerBlock:]\n\t\t} else {\n\t\t\ttss = nil\n\t\t}\n\t\tif rctx != nil {\n\t\t\ttssBlockLen := len(tssBlock)\n\t\t\ttssBlock = rctx.applyRelabeling(tssBlock, labelsGlobal, prcsGlobal)\n\t\t\tglobalRelabelMetricsDropped.Add(tssBlockLen - len(tssBlock))\n\t\t}\n\t\tfor _, rwctx := range rwctxs {\n\t\t\trwctx.Push(tssBlock)\n\t\t}\n\t\tif rctx != nil {\n\t\t\trctx.reset()\n\t\t}\n\t}\n\tif rctx != nil {\n\t\tputRelabelCtx(rctx)\n\t}\n}", "title": "" }, { "docid": "33a1088636a1a2a50169c89238250de1", "score": "0.40961352", "text": "func (d *DynamicGroups) Push(ctx context.Context, msg interface{}) error {\n\tmsgObj, err := publisher.EncodeObject(&msg)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"publisher is not able to encode message: %v. err: %v\", msg, err)\n\t}\n\n\terr = kafka.PostMessage(transactionID.FromContext(ctx), publisher.RegularKafkaProducer, d.config, &publisher.Message{\n\t\tTopic: d.config.DynamicGroupMonitoringTopic,\n\t\tValue: msgObj,\n\t})\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"sending massage to kafka topic %v filed. err: %s\", d.config.DynamicGroupMonitoringTopic, err.Error())\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a8e51ea10a1ff52493d86ed865b51728", "score": "0.40958744", "text": "func (store *defaultGroupStore) newOutBulkSetMsg() *groupBulkSetMsg {\n\tbsm := <-store.bulkSetState.outFreeMsgChan\n\tif store.msgRing != nil {\n\t\tif r := store.msgRing.Ring(); r != nil {\n\t\t\tif n := r.LocalNode(); n != nil {\n\t\t\t\tbinary.BigEndian.PutUint64(bsm.header, n.ID())\n\t\t\t}\n\t\t}\n\t}\n\tbsm.body = bsm.body[:0]\n\treturn bsm\n}", "title": "" }, { "docid": "ff7f8bbc04113dde1011b80e35dca58b", "score": "0.40818706", "text": "func NewMockUpstreamGroupFinalizer(ctrl *gomock.Controller) *MockUpstreamGroupFinalizer {\n\tmock := &MockUpstreamGroupFinalizer{ctrl: ctrl}\n\tmock.recorder = &MockUpstreamGroupFinalizerMockRecorder{mock}\n\treturn mock\n}", "title": "" }, { "docid": "bd75edbc0e4fdd49a1cdeb4b789b4359", "score": "0.40689233", "text": "func (mu *MachineUpdate) ClearLastPush() *MachineUpdate {\n\tmu.mutation.ClearLastPush()\n\treturn mu\n}", "title": "" }, { "docid": "5a68208bc27e4d590013ca78084e365b", "score": "0.40646055", "text": "func (d *DataFrame) Push(e float64) float64 {\n\td.data[d.pivot] = e\n\td.incrPivot()\n\treturn e\n}", "title": "" }, { "docid": "647ecda0461ec55af293a8b94ea080da", "score": "0.4053236", "text": "func NewAddGroupUM(c tree.RefContext) (tree.GroupHook, error) {\n\treturn &ManageGroupUM{tree.NewBaseHook(\"add-untyped-metadata\", 50), \"UPSERT\"}, nil\n}", "title": "" }, { "docid": "a4ab8954123cecbaf808c69cf0f9556f", "score": "0.4038048", "text": "func NewPusher(host string) Pusher {\n\treturn Pusher{\n\t\thost: host,\n\t\tData: make(chan string),\n\t\tkilledOrder: make(chan interface{}, 2),\n\t\tdeadConfirm: nil,\n\t}\n}", "title": "" }, { "docid": "5bbb5bcada48070b80473eb4a525072a", "score": "0.4034946", "text": "func FzConcatPushDrop(ctx *FzContext, concat *FzStream, chain []FzStream) {\n\tcctx, _ := (*C.fz_context)(unsafe.Pointer(ctx)), cgoAllocsUnknown\n\tcconcat, _ := (*C.fz_stream)(unsafe.Pointer(concat)), cgoAllocsUnknown\n\tcchain, _ := (*C.fz_stream)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&chain)).Data)), cgoAllocsUnknown\n\tC.fz_concat_push_drop(cctx, cconcat, cchain)\n}", "title": "" }, { "docid": "bdca91b23b973fd3e2ed62f4d6451613", "score": "0.4028141", "text": "func NewCollector(batchTime time.Duration) *Collector {\n\tc := &Collector{\n\t\tin: make(chan report.Report),\n\t\tout: make(chan report.Report),\n\t\tadd: make(chan string),\n\t\tremove: make(chan string),\n\t\tquit: make(chan chan struct{}),\n\t}\n\n\tgo c.loop(batchTime)\n\n\treturn c\n}", "title": "" }, { "docid": "f30301eb22dcf0460e4032d1ce44d0bf", "score": "0.39963025", "text": "func (*PushSelDownWindow) OnTransform(old *memo.ExprIter) (newExprs []*memo.GroupExpr, eraseOld bool, eraseAll bool, err error) {\n\tsel := old.GetExpr().ExprNode.(*plannercore.LogicalSelection)\n\twindow := old.Children[0].GetExpr().ExprNode.(*plannercore.LogicalWindow)\n\twindowSchema := old.Children[0].Prop.Schema\n\tchildGroup := old.Children[0].GetExpr().Children[0]\n\tcanBePushed := make([]expression.Expression, 0, len(sel.Conditions))\n\tcanNotBePushed := make([]expression.Expression, 0, len(sel.Conditions))\n\n\t// get partition Columns' Schema\n\tpartitionColsSchema := expression.NewSchema(window.GetPartitionByCols()...)\n\n\tfor _, cond := range sel.Conditions {\n\t\tif expression.ExprFromSchema(cond, partitionColsSchema) {\n\t\t\tcanBePushed = append(canBePushed, cond)\n\t\t} else {\n\t\t\tcanNotBePushed = append(canNotBePushed, cond)\n\t\t}\n\t}\n\t// Nothing can be pushed!\n\tif len(canBePushed) == 0 {\n\t\treturn nil, false, false, nil\n\t}\n\n\t// construct return GroupExpr\n\tnewBottomSel := plannercore.LogicalSelection{Conditions: canBePushed}.Init(sel.SCtx(), sel.SelectBlockOffset())\n\tnewBottomSelExpr := memo.NewGroupExpr(newBottomSel)\n\tnewBottomSelExpr.SetChildren(childGroup)\n\tnewBottomSelGroup := memo.NewGroupWithSchema(newBottomSelExpr, childGroup.Prop.Schema)\n\tnewWindowExpr := memo.NewGroupExpr(window)\n\tnewWindowExpr.SetChildren(newBottomSelGroup)\n\tif len(canNotBePushed) == 0 {\n\t\treturn []*memo.GroupExpr{newWindowExpr}, true, false, nil\n\t}\n\n\tnewWindowGroup := memo.NewGroupWithSchema(newWindowExpr, windowSchema)\n\tnewTopSel := plannercore.LogicalSelection{Conditions: canNotBePushed}.Init(sel.SCtx(), sel.SelectBlockOffset())\n\tnewTopSelExpr := memo.NewGroupExpr(newTopSel)\n\tnewTopSelExpr.SetChildren(newWindowGroup)\n\treturn []*memo.GroupExpr{newTopSelExpr}, true, false, nil\n}", "title": "" }, { "docid": "88ed195e3f5f67477ff68a4e414d6d8b", "score": "0.39920783", "text": "func (q *Queue) Unshift(val encoding.BinaryMarshaler) error {\n\treturn q.q.Unshift(encodeValue(q.t, val))\n}", "title": "" }, { "docid": "06eb9e5a51c6cffdd3d30ea043574aed", "score": "0.39812312", "text": "func (w *Walker[T]) Push(nextElement T) (walker *Walker[T]) {\n\tif !w.pushedElements.Add(nextElement) && !w.revisitElements {\n\t\treturn w\n\t}\n\n\tw.stack.PushBack(nextElement)\n\n\treturn w\n}", "title": "" }, { "docid": "9929a1e1502efe165c0c4c74349182c8", "score": "0.397252", "text": "func NewPusher(queue pkg.Queue) Pusher {\n\tpusher := Pusher{\n\t\tqueue: queue,\n\t\tlimiter: rate.NewLimiter(rate.Every(time.Second), 3),\n\t}\n\treturn pusher\n}", "title": "" }, { "docid": "38916aab0588fe72a26e49ab28e7b889", "score": "0.39615905", "text": "func (ap *AppPulse) NewSink(path dbus.ObjectPath) {\n\tlog.Println(\"one: new sink\", path)\n}", "title": "" }, { "docid": "44d134b5c22cd2f7e626bd139360b3f9", "score": "0.39493597", "text": "func New(cnt int) []Aggregator {\n\taggs := make([]Aggregator, cnt)\n\tfor i := range aggs {\n\t\taggs[i] = Aggregator{\n\t\t\tvalue: unsafe.Pointer(unsetLastValue),\n\t\t}\n\t}\n\treturn aggs\n}", "title": "" }, { "docid": "6cd4e7d230c130f05a0e3e1b06e94633", "score": "0.3946806", "text": "func (ef *execFactory) ConstructGroupBy(\n\tinput exec.Node,\n\tgroupCols []exec.NodeColumnOrdinal,\n\tgroupColOrdering colinfo.ColumnOrdering,\n\taggregations []exec.AggInfo,\n\treqOrdering exec.OutputOrdering,\n) (exec.Node, error) {\n\tinputPlan := input.(planNode)\n\tinputCols := planColumns(inputPlan)\n\tn := &groupNode{\n\t\tplan: inputPlan,\n\t\tfuncs: make([]*aggregateFuncHolder, 0, len(groupCols)+len(aggregations)),\n\t\tcolumns: getResultColumnsForGroupBy(inputCols, groupCols, aggregations),\n\t\tgroupCols: convertOrdinalsToInts(groupCols),\n\t\tgroupColOrdering: groupColOrdering,\n\t\tisScalar: false,\n\t\treqOrdering: ReqOrdering(reqOrdering),\n\t}\n\tfor _, col := range n.groupCols {\n\t\t// TODO(radu): only generate the grouping columns we actually need.\n\t\tf := newAggregateFuncHolder(\n\t\t\tbuiltins.AnyNotNull,\n\t\t\t[]int{col},\n\t\t\tnil, /* arguments */\n\t\t\tfalse, /* isDistinct */\n\t\t)\n\t\tn.funcs = append(n.funcs, f)\n\t}\n\tif err := ef.addAggregations(n, aggregations); err != nil {\n\t\treturn nil, err\n\t}\n\treturn n, nil\n}", "title": "" }, { "docid": "4162c5041f5f27fa0535bb325edf5f7c", "score": "0.3933826", "text": "func (muo *MachineUpdateOne) SetLastPush(t time.Time) *MachineUpdateOne {\n\tmuo.mutation.SetLastPush(t)\n\treturn muo\n}", "title": "" }, { "docid": "30454abc7e1eb11f1a2c54ede142e511", "score": "0.39317158", "text": "func New(desc *export.Descriptor) *Aggregator {\n\treturn &Aggregator{\n\t\tkind: desc.NumberKind(),\n\t\tcurrent: unsetMinMaxSumCount(desc.NumberKind()),\n\t}\n}", "title": "" }, { "docid": "6ba88a413dbc1073abbb0ef42c35b0b9", "score": "0.3930312", "text": "func NewCollector(jaeger *v1.Jaeger) *Collector {\n\treturn &Collector{jaeger: jaeger}\n}", "title": "" }, { "docid": "0a6d54f498a3d5f981e8229b8a3d3691", "score": "0.3926856", "text": "func New(fun, regex, outFmt string, interval, wait uint, out chan []byte) (*Aggregator, error) {\n\tregexObj, err := regexp.Compile(regex)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfn, ok := Funcs[fun]\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"no such aggregation function '%s'\", fun)\n\t}\n\tagg := &Aggregator{\n\t\tfun,\n\t\tfn,\n\t\t// i think it's possible in theory if this chan fills up, a deadlock to occur between table and this, but seems unlikely\n\t\tmake(chan []byte, 2000),\n\t\tout,\n\t\tregex,\n\t\tregexObj,\n\t\toutFmt,\n\t\t[]byte(outFmt),\n\t\tinterval,\n\t\twait,\n\t\tmake([]aggregation, 0, 4),\n\t\tmake(chan bool),\n\t\tmake(chan *Aggregator),\n\t\tmake(chan bool),\n\t}\n\tgo agg.run()\n\treturn agg, nil\n}", "title": "" }, { "docid": "9a3f72cfbcfec2b48d86ce88e08f54ad", "score": "0.39262092", "text": "func (c *Converter) PushNewBuffer() {\n\tc.bufs = append(c.bufs, c.Buf)\n\tc.Buf = &bytes.Buffer{}\n}", "title": "" }, { "docid": "1b6eea645b9115de0c18a927d21de9e8", "score": "0.3925134", "text": "func NewCmdPush(name, fullName string) *cobra.Command {\n\tpo := NewPushOptions()\n\n\tvar pushCmd = &cobra.Command{\n\t\tUse: fmt.Sprintf(\"%s [component name]\", name),\n\t\tShort: \"Push source code to a component\",\n\t\tLong: `Push source code to a component.`,\n\t\tExample: fmt.Sprintf(pushCmdExample, fullName),\n\t\tArgs: cobra.MaximumNArgs(1),\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\todoutil.LogErrorAndExit(po.Complete(name, cmd, args), \"\")\n\t\t\todoutil.LogErrorAndExit(po.Validate(), \"\")\n\t\t\todoutil.LogErrorAndExit(po.Run(), \"\")\n\t\t},\n\t}\n\n\tpushCmd.Flags().StringVarP(&po.local, \"local\", \"l\", \"\", \"Use given local directory as a source for component. (It must be a local component)\")\n\n\t// Add a defined annotation in order to appear in the help menu\n\tpushCmd.Annotations = map[string]string{\"command\": \"component\"}\n\tpushCmd.SetUsageTemplate(odoutil.CmdUsageTemplate)\n\tcompletion.RegisterCommandHandler(pushCmd, completion.ComponentNameCompletionHandler)\n\n\t//Adding `--project` flag\n\tprojectCmd.AddProjectFlag(pushCmd)\n\t//Adding `--application` flag\n\tappCmd.AddApplicationFlag(pushCmd)\n\n\treturn pushCmd\n}", "title": "" }, { "docid": "4ca452e5453e6d00a31cc1146baf8328", "score": "0.39198515", "text": "func (rl *RollupMetric) rollup(inNewData *metrics.RawRenderItem, statName *repr.StatName, seriesType string, highres bool) error {\n\tdefer stats.StatsdSlowNanoTimeFunc(\"writer.rollup.process-time-ns\", time.Now())\n\n\tnewData := inNewData\n\n\tmetric := statName.Key\n\tuid := statName.UniqueIdString()\n\n\trl.log.Debugf(\"Rollup Triggered for %s (%s) in %s\", metric, uid, rl.writer.Driver())\n\n\t// now march through the higher resolutions .. the resolution objects\n\t// is [ resolution, ttl ]\n\tfor _, res := range rl.resolutions {\n\t\tstep := res[0]\n\t\tttl := res[1]\n\t\ttNewData := newData.Copy()\n\t\tif len(newData.Data) == 0 {\n\t\t\trl.log.Warning(\n\t\t\t\t\"Rollup warning: No data points to rollup: start: %d, end: %d, points: %d for %d (%s) @ res: %d\",\n\t\t\t\tnewData.RealStart, newData.RealEnd, len(newData.Data),\n\t\t\t\tstatName.UniqueId(),\n\t\t\t\tstatName.Key,\n\t\t\t\tres,\n\t\t\t)\n\t\t\tcontinue\n\t\t}\n\n\t\t// if the start|End time is 0 then there is trouble w/ the series itself\n\t\t// and attempting a rollup is next to suicide\n\t\tif newData.RealStart == 0 || newData.RealEnd == 0 {\n\t\t\trl.log.Errorf(\n\t\t\t\t\"Rollup failure: Incomming Series Start|End time is 0 (start: %d, end: %d, points: %d), the series is corrupt cannot rollup: %d (%s)\",\n\t\t\t\tnewData.RealStart, newData.RealEnd, len(newData.Data),\n\t\t\t\tstatName.UniqueId(),\n\t\t\t\tstatName.Key,\n\t\t\t)\n\t\t\tstats.StatsdClientSlow.Incr(\"writer.rollup.error\", 1)\n\t\t\tcontinue\n\t\t}\n\n\t\t// resample the current blob into the step we want\n\t\ttNewData.Resample(uint32(step))\n\n\t\terr := rl.writeOne(statName, tNewData, nil, step, ttl, seriesType, highres)\n\t\tif err != nil {\n\t\t\trl.log.Errorf(\"Rollup failure: %v\", err)\n\t\t\tstats.StatsdClientSlow.Incr(\"writer.rollup.error\", 1)\n\t\t\tcontinue\n\t\t}\n\t\tstats.StatsdClientSlow.Incr(\"writer.rollup.ok\", 1)\n\t}\n\n\t// put back into pool\n\tnewData.PutDataIntoPool()\n\tnewData = nil\n\treturn nil\n}", "title": "" }, { "docid": "46f4b96d8a138b14dbd05b5fd5d4850f", "score": "0.39173374", "text": "func (r *PushTopNDownUnionAll) OnTransform(old *memo.ExprIter) (newExprs []*memo.GroupExpr, eraseOld bool, eraseAll bool, err error) {\n\ttopN := old.GetExpr().ExprNode.(*plannercore.LogicalTopN)\n\tunionAll := old.Children[0].GetExpr().ExprNode.(*plannercore.LogicalUnionAll)\n\n\tnewTopN := plannercore.LogicalTopN{\n\t\tCount: topN.Count + topN.Offset,\n\t\tByItems: topN.ByItems,\n\t}.Init(topN.SCtx(), topN.SelectBlockOffset())\n\n\tnewUnionAllExpr := memo.NewGroupExpr(unionAll)\n\tfor _, childGroup := range old.Children[0].GetExpr().Children {\n\t\tnewTopNExpr := memo.NewGroupExpr(newTopN)\n\t\tnewTopNExpr.Children = append(newTopNExpr.Children, childGroup)\n\t\tnewTopNGroup := memo.NewGroupWithSchema(newTopNExpr, childGroup.Prop.Schema)\n\n\t\tnewUnionAllExpr.Children = append(newUnionAllExpr.Children, newTopNGroup)\n\t}\n\n\tnewTopNExpr := memo.NewGroupExpr(topN)\n\tnewUnionAllGroup := memo.NewGroupWithSchema(newUnionAllExpr, unionAll.Schema())\n\tnewTopNExpr.SetChildren(newUnionAllGroup)\n\tnewTopNExpr.AddAppliedRule(r)\n\treturn []*memo.GroupExpr{newTopNExpr}, true, false, nil\n}", "title": "" }, { "docid": "93f4d8e167a2dd3ab1aafa81185328bb", "score": "0.39171022", "text": "func pipelineFromPush(hook *pushHook) *model.Pipeline {\n\tavatar := expandAvatar(\n\t\thook.Repo.HTMLURL,\n\t\tfixMalformedAvatar(hook.Sender.AvatarURL),\n\t)\n\n\tmessage := \"\"\n\tlink := hook.Compare\n\tif len(hook.Commits) > 0 {\n\t\tmessage = hook.Commits[0].Message\n\t} else {\n\t\tmessage = hook.HeadCommit.Message\n\t}\n\n\tif len(hook.Commits) == 1 {\n\t\tlink = hook.Commits[0].URL\n\t}\n\n\treturn &model.Pipeline{\n\t\tEvent: model.EventPush,\n\t\tCommit: hook.After,\n\t\tRef: hook.Ref,\n\t\tLink: link,\n\t\tBranch: strings.TrimPrefix(hook.Ref, \"refs/heads/\"),\n\t\tMessage: message,\n\t\tAvatar: avatar,\n\t\tAuthor: hook.Sender.UserName,\n\t\tEmail: hook.Sender.Email,\n\t\tTimestamp: time.Now().UTC().Unix(),\n\t\tSender: hook.Sender.UserName,\n\t\tChangedFiles: getChangedFilesFromPushHook(hook),\n\t}\n}", "title": "" }, { "docid": "7c0d9b89c2e15b4e211b6ba790c91c00", "score": "0.3907314", "text": "func NewUnstructured(group, kind, version string) *unstructured.Unstructured {\n\tu := &unstructured.Unstructured{}\n\tu.SetGroupVersionKind(schema.GroupVersionKind{\n\t\tGroup: group,\n\t\tKind: kind,\n\t\tVersion: version})\n\treturn u\n}", "title": "" }, { "docid": "0ff7609d6ffbefabf8674d452c35ac8f", "score": "0.3904389", "text": "func New() *Aggregator {\n\treturn &Aggregator{\n\t\tcurrent: unsafe.Pointer(unsetLastValue),\n\t\tcheckpoint: unsafe.Pointer(unsetLastValue),\n\t}\n}", "title": "" }, { "docid": "f623912c541395134b593a28f400693d", "score": "0.39036", "text": "func (s *StatsdSink) PushMetric(m string) {\n\tselect {\n\tcase s.metricQueue <- m:\n\tdefault:\n\t}\n}", "title": "" }, { "docid": "464e86bd8b42f6ff8ef2311f540bc3dc", "score": "0.3900841", "text": "func newGatewayCollector() *GatewayCollector {\n\treturn &GatewayCollector{\n\t\tcounters: make(map[string]*prometheus.CounterVec),\n\t\tgauges: make(map[string]*prometheus.GaugeVec),\n\t\tlabels: make(map[string][]string),\n\t\texpiringMetrics: make(map[string][]*expiringMetricValue),\n\t\tlastUpdate: time.Unix(0, 0),\n\t\tsampleInterval: 0.0,\n\t\tmetricsMu: sync.Mutex{},\n\t}\n}", "title": "" }, { "docid": "39a1f00982bce714f87a5661bca6cb9c", "score": "0.38913178", "text": "func PDFArrayPushDrop(ctx *FzContext, array *PDFObj, obj []PDFObj) {\n\tcctx, _ := (*C.fz_context)(unsafe.Pointer(ctx)), cgoAllocsUnknown\n\tcarray, _ := (*C.pdf_obj)(unsafe.Pointer(array)), cgoAllocsUnknown\n\tcobj, _ := (*C.pdf_obj)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&obj)).Data)), cgoAllocsUnknown\n\tC.pdf_array_push_drop(cctx, carray, cobj)\n}", "title": "" }, { "docid": "aa63085ea9439ab0a11ce993893ddb9e", "score": "0.3888084", "text": "func (dc *XDatasetCollectionTS) Unshift(data XDatasetDef) {\n\tdc.mutex.Lock()\n\tdc.data = append([]XDatasetDef{data}, dc.data...)\n\tdc.mutex.Unlock()\n}", "title": "" }, { "docid": "82541b6a2c7a1f1948d932d815c3809c", "score": "0.3855335", "text": "func TestDemuxNoAggOptionEnabled(t *testing.T) {\n\trequire := require.New(t)\n\n\tnoAggWorkerStreamCheckFrequency = 100 * time.Millisecond\n\n\topts := demuxTestOptions()\n\tmockSerializer := &MockSerializerIterableSerie{}\n\topts.EnableNoAggregationPipeline = true\n\tlog := fxutil.Test[log.Component](t, log.MockModule)\n\tdemux := initAgentDemultiplexer(log, NewForwarderTest(log), opts, \"\")\n\tdemux.statsd.noAggStreamWorker.serializer = mockSerializer // the no agg pipeline will use our mocked serializer\n\n\tgo demux.Run()\n\n\tbatch := testDemuxSamples(t)\n\n\tdemux.SendSamplesWithoutAggregation(batch)\n\ttime.Sleep(200 * time.Millisecond) // give some time for the automatic flush to trigger\n\tdemux.Stop(true)\n\n\t// nothing should be in the time sampler\n\trequire.Len(demux.statsd.workers[0].samplesChan, 0)\n\trequire.Len(mockSerializer.series, 3)\n\n\tfor i := 0; i < len(batch); i++ {\n\t\trequire.Equal(batch[i].Name, mockSerializer.series[i].Name)\n\t\trequire.Len(mockSerializer.series[i].Points, 1)\n\t\trequire.Equal(batch[i].Timestamp, mockSerializer.series[i].Points[0].Ts)\n\t\trequire.ElementsMatch(batch[i].Tags, mockSerializer.series[i].Tags.UnsafeToReadOnlySliceString())\n\t}\n}", "title": "" }, { "docid": "358813bf6e6ae4d350d364be25bf41bb", "score": "0.3852919", "text": "func NewCachedTransactionGather(\n\tgather prometheus.TransactionalGatherer,\n\tcacheInterval time.Duration,\n\tlogger log.Logger,\n) prometheus.TransactionalGatherer {\n\treturn &cachedTransactionGather{\n\t\tgather: gather,\n\t\tnextCollectionTime: time.Now(),\n\t\tcacheInterval: cacheInterval,\n\t\tlogger: logger,\n\t}\n}", "title": "" }, { "docid": "fe91d90a3c6ab0b07c4cc357ebfd2166", "score": "0.38475075", "text": "func (pac *packetType) newAck() *packetType {\n\tpacketPtr := unsafe.Pointer(&pac.data[0])\n\tpacket := C.trudpPacketACKcreateNew(packetPtr)\n\tlength := C.trudpPacketGetHeaderLength(packetPtr)\n\treturn &packetType{trudp: pac.trudp, data: goBytesUnsafe(packet, length),\n\t\tdestoryF: true}\n}", "title": "" }, { "docid": "8944c0281b7ef72f3772081b553edb0f", "score": "0.38431358", "text": "func PushPull(\n\tctx context.Context,\n\tbe *backend.Backend,\n\tclientInfo *db.ClientInfo,\n\tdocInfo *db.DocInfo,\n\treqPack *change.Pack,\n) (*change.Pack, error) {\n\t// TODO: Changes may be reordered or missing during communication on the network.\n\t// We should check the change.pack with checkpoint to make sure the changes are in the correct order.\n\tinitialServerSeq := docInfo.ServerSeq\n\n\t// 01. push changes.\n\tpushedCP, pushedChanges, err := pushChanges(clientInfo, docInfo, reqPack, initialServerSeq)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// 02. pull change pack.\n\trespPack, err := pullPack(ctx, be, clientInfo, docInfo, reqPack, pushedCP, initialServerSeq)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := clientInfo.UpdateCheckpoint(docInfo.ID, respPack.Checkpoint); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// 03. store pushed changes, document info and checkpoint of the client to DB.\n\tif len(pushedChanges) > 0 {\n\t\tif err := be.DB.StoreChangeInfos(ctx, docInfo, initialServerSeq, pushedChanges); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tif err := be.DB.UpdateClientInfoAfterPushPull(ctx, clientInfo, docInfo); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// 04. update and find min synced ticket for garbage collection.\n\t// NOTE Since the client could not receive the PushPull response,\n\t// the requested seq(reqPack) is stored instead of the response seq(resPack).\n\trespPack.MinSyncedTicket, err = be.DB.UpdateAndFindMinSyncedTicket(\n\t\tctx,\n\t\tclientInfo,\n\t\tdocInfo.ID,\n\t\treqPack.Checkpoint.ServerSeq,\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// 05. publish document change event then store snapshot asynchronously.\n\tif reqPack.HasChanges() {\n\t\tbe.AttachGoroutine(func() {\n\t\t\tpublisherID, err := time.ActorIDFromHex(clientInfo.ID.String())\n\t\t\tif err != nil {\n\t\t\t\tlog.Logger.Error(err)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tctx := context.Background()\n\t\t\t// TODO(hackerwins): We need to replace Lock with TryLock.\n\t\t\t// If the snapshot is already being created by another routine, it\n\t\t\t// is not necessary to recreate it, so we can skip it.\n\t\t\tlocker, err := be.Coordinator.NewLocker(\n\t\t\t\tctx,\n\t\t\t\tNewSnapshotKey(reqPack.DocumentKey),\n\t\t\t)\n\t\t\tif err != nil {\n\t\t\t\tlog.Logger.Error(err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif err := locker.Lock(ctx); err != nil {\n\t\t\t\tlog.Logger.Error(err)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tdefer func() {\n\t\t\t\tif err := locker.Unlock(ctx); err != nil {\n\t\t\t\t\tlog.Logger.Error(err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}()\n\n\t\t\tbe.Coordinator.Publish(\n\t\t\t\tctx,\n\t\t\t\tpublisherID,\n\t\t\t\tsync.DocEvent{\n\t\t\t\t\tType: types.DocumentsChangedEvent,\n\t\t\t\t\tPublisher: types.Client{ID: publisherID},\n\t\t\t\t\tDocumentKeys: []*key.Key{reqPack.DocumentKey},\n\t\t\t\t},\n\t\t\t)\n\n\t\t\tif err := storeSnapshot(\n\t\t\t\tctx,\n\t\t\t\tbe,\n\t\t\t\tdocInfo,\n\t\t\t); err != nil {\n\t\t\t\tlog.Logger.Error(err)\n\t\t\t}\n\t\t})\n\t}\n\n\treturn respPack, nil\n}", "title": "" }, { "docid": "29fe6e5ac5027a738c765e703ce41a1a", "score": "0.38410842", "text": "func New(minDelay time.Duration) (*Gatherer, error) {\n\tpath, err := exec.LookPath(\"zpool\")\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"%w: while looking for zpool: %v\", ErrZFSNotAvailable, err)\n\t}\n\n\tgatherer := &Gatherer{\n\t\tzpoolPath: path,\n\t\tminDelay: minDelay,\n\t}\n\n\treturn gatherer, nil\n}", "title": "" }, { "docid": "8fd8894a624cb62492d5b95a5497730c", "score": "0.3837128", "text": "func (g *Golden) push() {\n\tg.lead = append(g.lead, '\\t')\n}", "title": "" }, { "docid": "8f8634e28439b3fb230d5690adf6cb06", "score": "0.3835133", "text": "func MakeUnsubscribe(packetIdentifier uint16, payload []string) Unsubscribe {\n\tp := Unsubscribe{}\n\tremlen := p.calc(packetIdentifier, payload)\n\tpktLen := 1 + p.calc(uint32(remlen)) + remlen\n\n\tp.endecBytes = make([]byte, pktLen)\n\tp.packetIDPos = p.fill(0, TUNSUBSCRIBE<<4|0x02, uint32(remlen))\n\toffset := p.fill(p.packetIDPos, packetIdentifier)\n\tp.topicFilterPoss = make([]int, len(payload))\n\tfor i, filter := range payload {\n\t\tp.topicFilterPoss[i] = offset\n\t\toffset = p.fill(offset, filter)\n\t}\n\n\treturn p\n}", "title": "" }, { "docid": "6e5e90207566f147b6caf33bf76a49d6", "score": "0.38346913", "text": "func (data *GraphData) Push(index int, key string, val *GraphData) (err error) {\n\tswitch data.Dtype {\n\tcase TypeArray:\n\t\tdata.Darray = append(data.Darray, val)\n\tcase TypeObjectArray:\n\t\tif y := len(data.DobjectArray); index >= y {\n\t\t\tif index > y {\n\t\t\t\treturn fmt.Errorf(ErrPushOverflow)\n\t\t\t}\n\t\t\tdata.DobjectArray = append(data.DobjectArray, GraphObject{\n\t\t\t\tkey: val,\n\t\t\t})\n\t\t} else {\n\t\t\tdata.DobjectArray[index][key] = val\n\t\t}\n\tdefault:\n\t\treturn fmt.Errorf(ErrWrongTypeCall,\n\t\t\t\"push\", \"graph data\", data.Dtype,\n\t\t)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6144f28b072f00bc77d1fecd255119e5", "score": "0.38284907", "text": "func NewAggregatorUnit(field string, downSampling *FunctionType, aggregator *FunctionType) *AggregatorUnit {\n\treturn &AggregatorUnit{\n\t\tfield: field,\n\t\tdownSampling: downSampling,\n\t\taggregator: aggregator,\n\t}\n}", "title": "" }, { "docid": "e97db52411cddf02f708ca2864fd02e9", "score": "0.3819958", "text": "func (o GitLabEventsConfigResponseOutput) Push() PushFilterResponseOutput {\n\treturn o.ApplyT(func(v GitLabEventsConfigResponse) PushFilterResponse { return v.Push }).(PushFilterResponseOutput)\n}", "title": "" }, { "docid": "f03ef4e71a606317c9e9564a31d6970f", "score": "0.38119528", "text": "func (o GitLabEventsConfigOutput) Push() PushFilterPtrOutput {\n\treturn o.ApplyT(func(v GitLabEventsConfig) *PushFilter { return v.Push }).(PushFilterPtrOutput)\n}", "title": "" }, { "docid": "7a5c7f7f32f203f550670df4bf545dc9", "score": "0.38095495", "text": "func (p *fifoPolicy) Push(task Task) (int, error) {\n\tpt := paramtable.Get()\n\n\t// Try to merge task if task can merge.\n\tif t := tryIntoMergeTask(task); t != nil {\n\t\tmaxNQ := pt.QueryNodeCfg.MaxGroupNQ.GetAsInt64()\n\t\tif p.queue.tryMerge(t, maxNQ) {\n\t\t\treturn 0, nil\n\t\t}\n\t}\n\n\t// Add a new task into queue.\n\tp.queue.push(task)\n\treturn 1, nil\n}", "title": "" }, { "docid": "98b72cf3d6f9b8ba611543da7eb9bb26", "score": "0.38051352", "text": "func NewCollector(ctx context.Context) *Collector {\n\tc := &Collector{\n\t\tctx: ctx,\n\t\tmessagec: make(chan func(), 16),\n\t\tjobs: make(map[string]*Job),\n\t\taccumulations: make(analyze.Accumulations),\n\t}\n\tgo c.backend()\n\treturn c\n}", "title": "" }, { "docid": "54303adbbae324c8ac54d544196177bf", "score": "0.3804985", "text": "func TestToGCMPayloadUsesMsggroupForCollapseKey(t *testing.T) {\n\tpostData := map[string]string{\n\t\t\"uniqush.payload.gcm\": `{\"message\":{\"aPushType\":{\"foo\":\"bar\",\"other\":\"value\"},\"gcm\":{},\"others\":{\"type\":\"aPushType\"}}}`,\n\t\t\"msggroup\": \"AMsgGroup\",\n\t}\n\tregIds := []string{\"CAFE1-FF\", \"42-607\"}\n\texpectedPayload := `{\"registration_ids\":[\"CAFE1-FF\",\"42-607\"],\"collapse_key\":\"AMsgGroup\",\"time_to_live\":3600,\"data\":{\"message\":{\"aPushType\":{\"foo\":\"bar\",\"other\":\"value\"},\"gcm\":{},\"others\":{\"type\":\"aPushType\"}}}}`\n\ttestToGCMPayload(t, postData, regIds, expectedPayload)\n}", "title": "" }, { "docid": "883021ff5caacc42856710abd825c478", "score": "0.37993258", "text": "func NewPushBackLexer(l lexer.ILexer) *PushBackLexer {\n\treturn &PushBackLexer{\n\t\tLexer: l,\n\t\ttoks: &list.List{},\n\t}\n}", "title": "" }, { "docid": "a4c3f4381061add448587e2e51c7a9d6", "score": "0.37921816", "text": "func NewUpgrader(ctx context.Context, params *chaincfg.Params, db *sql.DB, bg BlockGetter, stakeDB *stakedb.StakeDatabase) *Upgrader {\n\treturn &Upgrader{\n\t\tdb: db,\n\t\tparams: params,\n\t\tbg: bg,\n\t\tstakeDB: stakeDB,\n\t\tctx: ctx,\n\t}\n}", "title": "" }, { "docid": "4728ec404cd8f2559f1455f719465174", "score": "0.3790969", "text": "func newMetricMutation(c config, op Op, opts ...metricOption) *MetricMutation {\n\tm := &MetricMutation{\n\t\tconfig: c,\n\t\top: op,\n\t\ttyp: TypeMetric,\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": "49c2ccf9827d46e7c223d2d3e0057197", "score": "0.3790768", "text": "func newAggregateFuncHolder(\n\tfuncName string, argRenderIdxs []int, arguments tree.Datums, isDistinct bool,\n) *aggregateFuncHolder {\n\tres := &aggregateFuncHolder{\n\t\tfuncName: funcName,\n\t\targRenderIdxs: argRenderIdxs,\n\t\tfilterRenderIdx: tree.NoColumnIdx,\n\t\targuments: arguments,\n\t\tisDistinct: isDistinct,\n\t}\n\treturn res\n}", "title": "" } ]
11f9aa5f257de02be9f12714cd63ece1
DeleteRole deletes role It's safe to call multiple time. It doesn't give error even if respective role doesn't exist
[ { "docid": "f1238472d281382d358306a2c842145e", "score": "0.7072506", "text": "func (d *DatabaseRole) DeleteRole(name string) error {\n\tpath := fmt.Sprintf(\"/v1/%s/roles/%s\", d.path, name)\n\treq := d.vaultClient.NewRequest(\"DELETE\", path)\n\n\t_, err := d.vaultClient.RawRequest(req)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"failed to delete database role %s\", name)\n\t}\n\treturn nil\n}", "title": "" } ]
[ { "docid": "67a4ef3676d8f171c5abfa04d544059f", "score": "0.8400891", "text": "func (s *Service) DeleteRole(roleName string) {\n\n}", "title": "" }, { "docid": "d9b31dab04b9de63b5ed982da66ef219", "score": "0.82430804", "text": "func Delete(w http.ResponseWriter, r *http.Request) {\n\tinf, userErr, sysErr, errCode := api.NewInfo(r, []string{\"name\"}, nil)\n\tif userErr != nil || sysErr != nil {\n\t\tapi.HandleErr(w, r, inf.Tx.Tx, errCode, userErr, sysErr)\n\t\treturn\n\t}\n\tdefer inf.Close()\n\n\ttx := inf.Tx.Tx\n\n\troleName := inf.Params[\"name\"]\n\n\tif roleName == tc.AdminRoleName {\n\t\tapi.HandleErr(w, r, tx, http.StatusBadRequest, cannotModifyAdminError, nil)\n\t\treturn\n\t}\n\n\tassignedUsers := 0\n\tif err := inf.Tx.Get(&assignedUsers, \"SELECT COUNT(id) FROM tm_user WHERE role= (SELECT id FROM role r WHERE r.name=$1)\", roleName); err != nil {\n\t\tapi.HandleErr(w, r, tx, http.StatusInternalServerError, nil, fmt.Errorf(\"role delete counting assigned users: %w\", err))\n\t\treturn\n\t} else if assignedUsers != 0 {\n\t\tapi.HandleErr(w, r, tx, http.StatusBadRequest, fmt.Errorf(\"can not delete a role with %d assigned users\", assignedUsers), nil)\n\t\treturn\n\t}\n\n\trows, err := tx.Query(deleteRoleQuery(), roleName)\n\tif err != nil {\n\t\tapi.HandleErr(w, r, tx, http.StatusInternalServerError, nil, fmt.Errorf(\"deleting role: %w\", err))\n\t\treturn\n\t}\n\trows.Close()\n\talerts := tc.CreateAlerts(tc.SuccessLevel, \"role was deleted.\")\n\tapi.WriteAlerts(w, r, http.StatusOK, alerts)\n\tchangeLogMsg := fmt.Sprintf(\"ROLE: %s, ACTION: Deleted Role\", roleName)\n\tapi.CreateChangeLogRawTx(api.ApiChange, changeLogMsg, inf.User, tx)\n}", "title": "" }, { "docid": "1b156dc8feeefcd5cc10bf74e15efe63", "score": "0.80236053", "text": "func DeleteRole(name string) (err error) {\n\to := orm.NewOrm()\n\t_, err = o.QueryTable(&Role{}).Filter(\"name\", name).Delete()\n\treturn\n}", "title": "" }, { "docid": "39391dc3b8c3aac162290ef25fa03ef6", "score": "0.7916761", "text": "func DeleteRole(role models.Role, id string) (res structs.Response, err error) {\n\tconfig.DB.Where(\"id = ?\", id).Delete(&role)\n\tres.Message = \"role delete success\"\n\treturn\n}", "title": "" }, { "docid": "edd8f855b999c1377f319ccb3a720a12", "score": "0.7884043", "text": "func (r *RestClientImpl) DeleteRole(guildID api.Snowflake, roleID api.Snowflake) (err error) {\n\tcompiledRoute, err := restclient.UpdateRole.Compile(nil, guildID, roleID)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = r.Do(compiledRoute, nil, nil)\n\tif err == nil && api.CacheStrategyNoWs(r.Disgo()) {\n\t\tr.disgo.Cache().UncacheRole(guildID, roleID)\n\t}\n\treturn\n}", "title": "" }, { "docid": "6d90da557d4dce068299d891f3e0ace4", "score": "0.7628435", "text": "func (c *GortClient) RoleDelete(rolename string) error {\n\turl := fmt.Sprintf(\"%s/v2/roles/%s\", c.profile.URL.String(), rolename)\n\n\tresp, err := c.doRequest(\"DELETE\", url, []byte{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn getResponseError(resp)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "544914a99a06860189b23c6a9dffcc0b", "score": "0.76275545", "text": "func deleteRole(w io.Writer, projectID, name string) error {\n\tctx := context.Background()\n\tservice, err := iam.NewService(ctx)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"iam.NewService: %w\", err)\n\t}\n\n\t_, err = service.Projects.Roles.Delete(\"projects/\" + projectID + \"/roles/\" + name).Do()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Projects.Roles.Delete: %w\", err)\n\t}\n\tfmt.Fprintf(w, \"Deleted role: %v\", name)\n\treturn nil\n}", "title": "" }, { "docid": "04b8bb7c7f2b488cc678dcf5598975cc", "score": "0.76248294", "text": "func (h *Handler) deleteRole(c *gin.Context) handlerResponse {\n\n\tdeletedRole, err := h.service.Role.Delete(c.Param(roleParameter), h.who(c))\n\tif err != nil {\n\t\treturn handleError(err)\n\t}\n\treturn handleOK(deletedRole)\n}", "title": "" }, { "docid": "55611ed7e94a76d507267120f8eed5cb", "score": "0.7552697", "text": "func (r *Role) Delete() error {\n\treturn r.Disgo.RestClient().DeleteRole(r.GuildID, r.ID)\n}", "title": "" }, { "docid": "5cd985be4fc0eebde9331297ef164f4d", "score": "0.75093865", "text": "func (f *MySQLRepository) DeleteRole(ID uint) error {\n\tstmt, err := f.db.Prepare(`DELETE FROM Flightlog.Role\n\t\tWHERE Id=? `)\n\n\tif err != nil {\n\t\treturn BadSqlError.NewFromException(err, \"Delete\", \"Role\")\n\t}\n\n\tdefer stmt.Close()\n\n\t_, err = stmt.Exec(ID)\n\n\tif err != nil {\n\t\treturn StatementExecutionError.NewFromException(err, \"INSERT\", \"Role\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "dd1415534d8971dd96aa2465b7ace399", "score": "0.7483429", "text": "func (r *Role) Delete() error {\n\treturn Delete(r.client, getRole(r.Name, r.Namespace, r.labels))\n}", "title": "" }, { "docid": "350c24f3f2a7d1368ec8d053829c7126", "score": "0.7466595", "text": "func DeleteRoles(c *gin.Context) {\n\tuserName := c.Param(\"username\")\n\trole := c.Param(\"role\")\n\tvar user models.User\n\n\tdb := database.InitiateConnection()\n\n\terr := db.Read(\"user\", userName, &user)\n\tif err != nil {\n\t\tlog.Error(err)\n\t\tc.AbortWithError(http.StatusBadRequest, err)\n\t\treturn\n\t}\n\n\tvar index int\n\tfor k, v := range user.Roles {\n\t\tif v.Name == role {\n\t\t\tindex = k\n\t\t\treturn\n\t\t}\n\t}\n\n\tnewRoles := remove(user.Roles, index)\n\tuser.Roles = newRoles\n\n\terr = db.Read(\"user\", userName, user)\n\tif err != nil {\n\t\tlog.Error(err)\n\t\tc.AbortWithError(http.StatusBadRequest, err)\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, gin.H{\"msg\": \"role deleted\"})\n}", "title": "" }, { "docid": "26c092746338dbe334f1663856c2b287", "score": "0.74606186", "text": "func (r RoleRepo) DeleteRole(uuid string) error {\n\tvar role entity.Role\n\terr := r.db.Where(\"uuid = ?\", uuid).Take(&role).Delete(&role).Error\n\tif err != nil {\n\t\tif errors.Is(err, gorm.ErrRecordNotFound) {\n\t\t\treturn exception.ErrorTextUserNotFound\n\t\t}\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5ce347c62f937665fa6797368b2099d8", "score": "0.74559885", "text": "func handleRoleDelete(\n\treqLogger logr.Logger,\n\tcr *kdv1.KubeDirectorCluster,\n\trole *roleInfo,\n) {\n\n\tshared.LogInfof(\n\t\treqLogger,\n\t\tcr,\n\t\tshared.EventReasonRole,\n\t\t\"finishing cleanup on role{%s}\",\n\t\trole.roleStatus.Name,\n\t)\n\tdeleteErr := executor.DeleteStatefulSet(cr.Namespace, role.statefulSet.Name)\n\tif deleteErr == nil || errors.IsNotFound(deleteErr) {\n\t\t// Mark the role status for removal.\n\t\trole.roleStatus.StatefulSet = \"\"\n\t} else {\n\t\tshared.LogErrorf(\n\t\t\treqLogger,\n\t\t\tdeleteErr,\n\t\t\tcr,\n\t\t\tshared.EventReasonRole,\n\t\t\t\"failed to delete StatefulSet{%s}\",\n\t\t\trole.statefulSet.Name,\n\t\t)\n\t}\n}", "title": "" }, { "docid": "06ea61b59620a242dec4f2ab58c04218", "score": "0.74542344", "text": "func (repo *MongoDBRepository) DeleteRole(ID string) error {\n\tif len(ID) == 0 {\n\t\treturn errors.New(\"Invalid ID\")\n\t}\n\n\tfilter := bson.M{\n\t\t\"_id\": ID,\n\t}\n\n\t_, err := repo.col.DeleteOne(context.TODO(), filter)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "7c0c2cb4c1766bad761f849931a5d764", "score": "0.7451993", "text": "func (h AppHandler) RemoveRole(c echo.Context) error {\n\t// Validates JWT token before any other action\n\tca := auth.OpenIDCAuth{}\n\tusername, err := ca.Authenticate(c, h.config)\n\tif err != nil {\n\t\treturn c.JSON(http.StatusUnauthorized,\n\t\t\tmap[string]string{\"result\": \"fail\", \"message\": \"Failed validating JWT\", \"details\": err.Error()})\n\t}\n\n\t// Validates if the user deleting the role has permission to do so\n\tif !contains(h.config.GetStringSlice(\"perm_admin\"), username) {\n\t\treturn c.JSON(http.StatusForbidden,\n\t\t\tmap[string]string{\"result\": \"fail\", \"message\": \"This user can't delete roles\"})\n\t}\n\n\tremoveRoleID := c.Param(\"role\")\n\n\t// Checks if role exists\n\terr = h.permEnforcer.LoadPolicy()\n\tif err != nil {\n\t\treturn c.JSON(http.StatusInternalServerError,\n\t\t\tmap[string]string{\"result\": \"fail\", \"message\": \"Error reading roles\", \"details\": err.Error()})\n\t}\n\troles := h.permEnforcer.GetFilteredPolicy(0, removeRoleID)\n\tvar roleFound bool\n\tvar removeRole types.Role\n\tfor _, role := range roles {\n\t\tif role[0] == removeRoleID {\n\t\t\troleFound = true\n\t\t\tremoveRole = types.Role{\n\t\t\t\tID: role[0],\n\t\t\t\tRemoteUser: role[1],\n\t\t\t\tSourceIP: role[2],\n\t\t\t\tTargetIP: role[3],\n\t\t\t\tActions: role[4],\n\t\t\t}\n\t\t}\n\t}\n\n\tif !roleFound {\n\t\treturn c.JSON(http.StatusNotFound,\n\t\t\tmap[string]string{\"result\": \"fail\", \"message\": \"Role ID not found\"})\n\t}\n\n\t// Removes role if found\n\tcheck, err := h.permEnforcer.RemovePolicySafe(removeRole.ID, removeRole.RemoteUser, removeRole.SourceIP, removeRole.TargetIP, removeRole.Actions)\n\tif err != nil {\n\t\treturn c.JSON(http.StatusInternalServerError,\n\t\t\tmap[string]string{\"result\": \"fail\", \"message\": \"Role cannot be removed\", \"details\": err.Error()})\n\t}\n\tif err == nil && !check {\n\t\treturn c.JSON(http.StatusNotFound,\n\t\t\tmap[string]string{\"result\": \"fail\", \"message\": \"Role ID not found\"})\n\t}\n\n\treturn c.JSON(http.StatusOK, map[string]string{\"result\": \"success\", \"message\": \"Role removed\"})\n}", "title": "" }, { "docid": "41c5f5cfa45e8c00ce2e7168a132f059", "score": "0.743432", "text": "func (s *stubRepository) DeleteRole(roleID uint) error {\n\tdelete(roles, roleID)\n\treturn nil\n}", "title": "" }, { "docid": "5884facdf1ddd41f9beda84e18d40da6", "score": "0.7419465", "text": "func Delete(role string) {\n\te := authorization.GetEnforcer()\n\te.DeleteRole(role)\n}", "title": "" }, { "docid": "addfbcc3ee47d6865ff4de0b1310607e", "score": "0.7342175", "text": "func (b *backend) pathRoleDelete(ctx context.Context, req *logical.Request, d *framework.FieldData) (*logical.Response, error) {\n\tname := d.Get(\"name\").(string)\n\tif name == \"\" {\n\t\treturn logical.ErrorResponse(\"missing name\"), nil\n\t}\n\n\treturn nil, req.Storage.Delete(ctx, \"role/\"+name)\n}", "title": "" }, { "docid": "f7e429529a1cf18e97f6e2ee7dcca177", "score": "0.72945184", "text": "func TestDeleteRole(t *testing.T) {\n\tt.Parallel()\n\n\tttKubectlOptions, kubectlOptions := GetKubectlOptions(t)\n\n\tnamespace := strings.ToLower(random.UniqueId())\n\tk8s.CreateNamespace(t, ttKubectlOptions, namespace)\n\tdefer k8s.DeleteNamespace(t, ttKubectlOptions, namespace)\n\n\tconfigData := createRole(t, ttKubectlOptions, namespace)\n\n\ttestRoleName := getTestRoleName(namespace)\n\terr := DeleteRole(kubectlOptions, namespace, testRoleName)\n\tif err != nil {\n\t\tk8s.KubectlDeleteFromString(t, ttKubectlOptions, configData)\n\t}\n\trequire.NoError(t, err)\n\n\t// Now verify the role was actually deleted in the cluster\n\t// Use terratest to get the role and expect an error\n\tttKubectlOptions.Namespace = namespace\n\temptyRole := &rbacv1.Role{}\n\trole, err := k8s.GetRoleE(t, ttKubectlOptions, testRoleName)\n\trequire.Error(t, err)\n\tassert.Equal(t, role, emptyRole)\n}", "title": "" }, { "docid": "f48367a27b8e419c14daefc6865cb017", "score": "0.7225983", "text": "func (m *Mocker) DeleteRole(guildID discord.GuildID, roleID discord.RoleID) {\n\tm.MockAPI(\"DeleteRole\", http.MethodDelete, \"/guilds/\"+guildID.String()+\"/roles/\"+roleID.String(), nil)\n}", "title": "" }, { "docid": "e644b5985ff19c2c71750094adb4d9ca", "score": "0.71577096", "text": "func (a *Client) DeleteRole(params *DeleteRoleParams) (*DeleteRoleOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewDeleteRoleParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"deleteRole_\",\n\t\tMethod: \"DELETE\",\n\t\tPathPattern: \"/{name}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &DeleteRoleReader{formats: a.formats},\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*DeleteRoleOK), nil\n}", "title": "" }, { "docid": "dcdff0be56382a8e1f0d0beb0f463542", "score": "0.71204555", "text": "func (c *Client) DeleteRole(ctx context.Context, serviceName, roleName string) (*Role, error) {\n\trole := &Role{}\n\t_, err := c.do(ctx, http.MethodDelete, fmt.Sprintf(\"/api/v0/services/%s/roles/%s\", serviceName, roleName), nil, role)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn role, nil\n}", "title": "" }, { "docid": "35caced41fef9ff56d105e26d2e7a8e1", "score": "0.70768607", "text": "func (rs *RoleService) DeleteRole(id uint) (*entity.Role, []error) {\n\n\trl, errs := rs.roleRepo.DeleteRole(id)\n\tif len(errs) > 0 {\n\t\treturn nil, errs\n\t}\n\treturn rl, errs\n}", "title": "" }, { "docid": "d46ef2422f1148dca4bd8dded8bd993c", "score": "0.70598596", "text": "func (a *GCPRole) DeleteRole(name string) (int, error) {\n\tpath := fmt.Sprintf(\"/v1/%s/roleset/%s\", a.gcpPath, name)\n\treq := a.vaultClient.NewRequest(\"DELETE\", path)\n\n\tresp, err := a.vaultClient.RawRequest(req)\n\tif err != nil {\n\t\treturn resp.StatusCode, errors.Wrapf(err, \"failed to delete gcp role %s\", name)\n\t}\n\treturn resp.StatusCode, nil\n}", "title": "" }, { "docid": "568a60159e7c16039955a745328b10b5", "score": "0.7045771", "text": "func DeleteRolesUnauthorized(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.RolesController, roleID int) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/roles/%v\", roleID),\n\t}\n\treq, err := http.NewRequest(\"DELETE\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"role_id\"] = []string{fmt.Sprintf(\"%v\", roleID)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"RolesTest\"), rw, req, prms)\n\tdeleteCtx, _err := app.NewDeleteRolesContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Delete(deleteCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 401 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 401\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "title": "" }, { "docid": "a92d16299e0c321d5b6409f45d714737", "score": "0.7026595", "text": "func (_ValidatorService *ValidatorServiceTransactor) RevokeRole(opts *bind.TransactOpts, role [32]byte, account common.Address) (*types.Transaction, error) {\n\treturn _ValidatorService.contract.Transact(opts, \"revokeRole\", role, account)\n}", "title": "" }, { "docid": "5158dfd33e8085c6d6e9e06b1398af97", "score": "0.69839954", "text": "func (c *Role) delete(name string) error {\n\tlog.Infof(\"deleting the role: %s\", name)\n\treturn util.DeleteRole(c.config.kubeClient, c.config.namespace, name)\n}", "title": "" }, { "docid": "390dbcd5cffa33e91e51ce501f7202d0", "score": "0.69606906", "text": "func (c ClusterRole) Delete() error {\n\treturn Delete(c.client, getClusterRole(c.Name, c.labels))\n}", "title": "" }, { "docid": "252f026e83dc6dd4a27cebb796c0e5b4", "score": "0.6951977", "text": "func (r repository) Delete(ctx context.Context, uuid string) error {\n\trole, err := r.Get(ctx, uuid)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = r.db.With(ctx).Model(&role).WherePK().Delete()\n\treturn err\n}", "title": "" }, { "docid": "cf6486caeae57d5a01c8f0796e97f344", "score": "0.69250065", "text": "func (_AssetManager *AssetManagerTransactor) RevokeRole(opts *bind.TransactOpts, role [32]byte, account common.Address) (*types.Transaction, error) {\n\treturn _AssetManager.contract.Transact(opts, \"revokeRole\", role, account)\n}", "title": "" }, { "docid": "2ce5724b2a66b6b386c626a9e9953218", "score": "0.69090694", "text": "func (r *Resource) DeleteRole(ctx context.Context, id string) error {\n\treturn r.DeleteRoleWithReason(ctx, id, \"\")\n}", "title": "" }, { "docid": "ca83c185fed3e6f8886eb8a5323aa4c0", "score": "0.68846065", "text": "func (_ValidatorService *ValidatorServiceSession) RevokeRole(role [32]byte, account common.Address) (*types.Transaction, error) {\n\treturn _ValidatorService.Contract.RevokeRole(&_ValidatorService.TransactOpts, role, account)\n}", "title": "" }, { "docid": "297d5f78c41f36cd23b8686e510122cf", "score": "0.68365335", "text": "func (_ValidatorService *ValidatorServiceTransactorSession) RevokeRole(role [32]byte, account common.Address) (*types.Transaction, error) {\n\treturn _ValidatorService.Contract.RevokeRole(&_ValidatorService.TransactOpts, role, account)\n}", "title": "" }, { "docid": "d066521550883b7d2f69a5b0f3cfaef9", "score": "0.68324417", "text": "func (inst *RoleN) Delete(ctx context.Context) error {\n\tif inst.roleModel == nil {\n\t\treturn query.ErrModelNotSet\n\t}\n\n\t_, err := inst.roleModel.DeleteById(ctx, inst.Id.Int64)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b6a10622a320e9f2f25d384f369f87c1", "score": "0.6824222", "text": "func DBDeleteRole(dbConn *sql.DB, name string) error {\n\tqueryStr := fmt.Sprintf(\"delete from secrole where name='%s' returning name\", name)\n\t//logit.Info.Println(\"secdb:DeleteRole:\" + queryStr)\n\n\tvar theName string\n\terr := dbConn.QueryRow(queryStr).Scan(&theName)\n\tswitch {\n\tcase err != nil:\n\t\tlogit.Error.Println(err.Error())\n\t\treturn err\n\tdefault:\n\t\tlogit.Info.Println(\"secdb:DeleteRole:role \" + name + \" deleted \")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "384fb55f820c338e11d54de0bb6942a9", "score": "0.6794972", "text": "func (_Bridge *BridgeTransactor) RevokeRole(opts *bind.TransactOpts, role [32]byte, account common.Address) (*types.Transaction, error) {\n\treturn _Bridge.contract.Transact(opts, \"revokeRole\", role, account)\n}", "title": "" }, { "docid": "3e37a820fc36ee15658fe2ee273cf93b", "score": "0.6781543", "text": "func DeleteRolesNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.RolesController, roleID int) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/roles/%v\", roleID),\n\t}\n\treq, err := http.NewRequest(\"DELETE\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"role_id\"] = []string{fmt.Sprintf(\"%v\", roleID)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"RolesTest\"), rw, req, prms)\n\tdeleteCtx, _err := app.NewDeleteRolesContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Delete(deleteCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "title": "" }, { "docid": "754fb92bf1460d0750f493fed450c33f", "score": "0.67313516", "text": "func DeleteUserRole(t *testing.T, client *gophercloud.ServiceClient, tenant *tenants.Tenant, user *users.User, role *roles.Role) {\n\tt.Logf(\"Attempting to remove role %s from user %s in tenant %s\", role.ID, user.ID, tenant.ID)\n\n\terr := roles.DeleteUser(client, tenant.ID, user.ID, role.ID).ExtractErr()\n\tif err != nil {\n\t\tt.Fatalf(\"Unable to remove role\")\n\t}\n\n\tt.Logf(\"Removed role %s from user %s in tenant %s\", role.ID, user.ID, tenant.ID)\n}", "title": "" }, { "docid": "f559cc518c1fee63e013a38e35d8dce2", "score": "0.66926956", "text": "func MenuRolesDelete(w http.ResponseWriter, r *http.Request) {\n\tdb := database.DbConn()\n\tmenurol := r.FormValue(\"ID\")\n\tdelForm, err := db.Prepare(\"DELETE FROM menuusuariosroles WHERE id=?\")\n\tlog.Println(menurol)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\t_, err1 := delForm.Exec(menurol)\n\tif err1 != nil {\n\t\tutil.ErrorApi(err.Error(), w, \"Error borrando datos de menuroles\")\n\t}\n\tlog.Println(\"DELETE\")\n\tdefer db.Close()\n\tvar vrecord model.MenuRolesRecord\n\tvrecord.Result = \"OK\"\n\ta, _ := json.Marshal(vrecord)\n\tw.Write(a)\n\n\thttp.Redirect(w, r, \"/\", 301)\n}", "title": "" }, { "docid": "ff89b93e77f411877efaeb4802e25f54", "score": "0.667893", "text": "func DeleteRole(\n\tk8sClient client.Client,\n\tname, namespace string,\n\towners ...metav1.OwnerReference,\n) error {\n\tresource := types.NamespacedName{\n\t\tName: name,\n\t\tNamespace: namespace,\n\t}\n\n\trole := &rbacv1.Role{}\n\terr := k8sClient.Get(context.TODO(), resource, role)\n\tif errors.IsNotFound(err) {\n\t\treturn nil\n\t} else if err != nil {\n\t\treturn err\n\t}\n\n\tnewOwners := removeOwners(role.OwnerReferences, owners)\n\n\t// Do not delete the object if it does not have the owner that was passed;\n\t// even if the object has no owner\n\tif (len(role.OwnerReferences) == 0 && len(owners) > 0) ||\n\t\t(len(role.OwnerReferences) > 0 && len(role.OwnerReferences) == len(newOwners)) {\n\t\tlogrus.Infof(\"Cannot delete Role %s/%s as it is not owned\",\n\t\t\tnamespace, name)\n\t\treturn nil\n\t}\n\n\tif len(newOwners) == 0 {\n\t\tlogrus.Infof(\"Deleting %s/%s Role\", namespace, name)\n\t\treturn k8sClient.Delete(context.TODO(), role)\n\t}\n\trole.OwnerReferences = newOwners\n\tlogrus.Infof(\"Disowning %s/%s Role\", namespace, name)\n\treturn k8sClient.Update(context.TODO(), role)\n}", "title": "" }, { "docid": "9526e821f9bcb1f7c3f4470ede0be4fc", "score": "0.6674118", "text": "func (_AssetManager *AssetManagerTransactorSession) RevokeRole(role [32]byte, account common.Address) (*types.Transaction, error) {\n\treturn _AssetManager.Contract.RevokeRole(&_AssetManager.TransactOpts, role, account)\n}", "title": "" }, { "docid": "3be2adbf9f5c33bec618a4e17dad9b4f", "score": "0.6672081", "text": "func (_AssetManager *AssetManagerSession) RevokeRole(role [32]byte, account common.Address) (*types.Transaction, error) {\n\treturn _AssetManager.Contract.RevokeRole(&_AssetManager.TransactOpts, role, account)\n}", "title": "" }, { "docid": "0727654f0f95f90ff13c0ceda84cfaad", "score": "0.66457194", "text": "func (c *Role) remove() error {\n\t// compare the old and new role and delete if needed\n\tfor _, oldRole := range c.oldRoles {\n\t\tif _, ok := c.newRoles[oldRole.GetName()]; !ok {\n\t\t\terr := c.delete(oldRole.GetName())\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Annotatef(err, \"unable to delete role %s in namespace %s\", oldRole.GetName(), c.config.namespace)\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5c36c81f1d6074a6b555ecf264168ca7", "score": "0.6643522", "text": "func (s *Staff) RemoveRole() {\n\tvar (\n\t\terr error\n\t\treq removeRoleReq\n\t)\n\n\tif err = json.Unmarshal(s.Ctx.Input.RequestBody, &req); err != nil {\n\t\tlogger.Error(err)\n\t\ts.WriteStatusAndDataJSON(constants.ErrInvalidParam, nil)\n\t}\n\n\tif err = s.Validate(&req); err != nil {\n\t\tlogger.Error(err)\n\t\ts.WriteStatusAndDataJSON(constants.ErrInvalidParam, nil)\n\t}\n\n\tconn, err := mysql.Pool.Get()\n\tif err != nil {\n\t\tlogger.Error(err)\n\t\ts.WriteStatusAndDataJSON(constants.ErrMysql, nil)\n\t}\n\n\tif err = staff.Service.RemoveRole(conn, req.StaffId, req.RoleId); err != nil {\n\t\tlogger.Error(err)\n\t\ts.WriteStatusAndDataJSON(constants.ErrMysql, nil)\n\t}\n\n\ts.WriteStatusAndDataJSON(constants.ErrSucceed, nil)\n}", "title": "" }, { "docid": "2b5010e766728df9490678e8834bab05", "score": "0.66368854", "text": "func (s *ClientService) DeleteRole(ctx context.Context, client *ClientRepresentation, role *RoleRepresentation) error {\n\n\tpath := \"/realms/{realm}/clients/{id}/roles/{role-name}\"\n\n\t_, err := s.client.newRequest(ctx).\n\t\tSetPathParams(map[string]string{\n\t\t\t\"realm\": s.client.Realm,\n\t\t\t\"id\": client.ID,\n\t\t\t\"role-name\": role.Name,\n\t\t}).\n\t\tDelete(path)\n\n\treturn err\n}", "title": "" }, { "docid": "14fac75152ca77e215e47685f1df259a", "score": "0.6577747", "text": "func (roleService *RoleService) AdminDeleteRoleV3(roleId string) error {\n\taccessToken, err := roleService.TokenRepository.GetToken()\n\tif err != nil {\n\t\treturn err\n\t}\n\tparams := &roles.AdminDeleteRoleV3Params{\n\t\tRoleID: roleId,\n\t}\n\t_, badRequest, unauthorized, forbidden, notFound, internalServer, err := roleService.IamService.Roles.AdminDeleteRoleV3(params, client.BearerToken(*accessToken.AccessToken))\n\tif badRequest != nil {\n\t\terrorMsg, _ := json.Marshal(*badRequest.GetPayload())\n\t\tlogrus.Error(string(errorMsg))\n\t\treturn badRequest\n\t}\n\tif unauthorized != nil {\n\t\terrorMsg, _ := json.Marshal(*unauthorized.GetPayload())\n\t\tlogrus.Error(string(errorMsg))\n\t\treturn unauthorized\n\t}\n\tif forbidden != nil {\n\t\terrorMsg, _ := json.Marshal(*forbidden.GetPayload())\n\t\tlogrus.Error(string(errorMsg))\n\t\treturn forbidden\n\t}\n\tif notFound != nil {\n\t\terrorMsg, _ := json.Marshal(*notFound.GetPayload())\n\t\tlogrus.Error(string(errorMsg))\n\t\treturn notFound\n\t}\n\tif internalServer != nil {\n\t\treturn internalServer\n\t}\n\tif err != nil {\n\t\tlogrus.Error(err)\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f12de3ce5452bef48f00f684ff1c2490", "score": "0.65771186", "text": "func DeleteRolesBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.RolesController, roleID int) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/roles/%v\", roleID),\n\t}\n\treq, err := http.NewRequest(\"DELETE\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"role_id\"] = []string{fmt.Sprintf(\"%v\", roleID)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"RolesTest\"), rw, req, prms)\n\tdeleteCtx, _err := app.NewDeleteRolesContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Delete(deleteCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "title": "" }, { "docid": "c42e8a13f31ababe0acd4b8fa2bb9e0a", "score": "0.65738845", "text": "func (b boltUser) RemoveRole(namespace, role string) (err error) {\n b.users.WriteTx(func(bkt *bolt.Bucket) {\n\n // Get namespace bucket\n ns := bkt.Bucket(b.name)\n if ns == nil {\n err = ErrUserDoesNotExist\n return\n }\n\n // Get namespaces bucket\n namespaces, err := ns.CreateBucketIfNotExists([]byte(\"namespaces\"))\n if err != nil {\n return\n }\n\n // Get existing roles and add new\n roles := namespaces.Get([]byte(namespace))\n if len(roles) > 0 {\n\n var list []string\n for _, r := range strings.Split(string(roles), \",\") {\n if r != role {\n list = append(list, r)\n }\n }\n\n // Save roles\n err = namespaces.Put([]byte(namespace), []byte(strings.Join(list, \",\")))\n }\n return\n })\n return\n}", "title": "" }, { "docid": "174de565a0c177dc12e1908216f4ef05", "score": "0.6558628", "text": "func (client *RestClient) DeleteRoleBinding(name string) error {\n\treturn client.delete(roleBindingsPath(client.config.Namespace(), name))\n}", "title": "" }, { "docid": "9b0df2fe67626bebfaaf35002021a265", "score": "0.6528828", "text": "func (a *AuthApiService) DeleteAuthRole(ctx context.Context, authRoleId string) ( *http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/platform/1/auth/roles/{AuthRoleId}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"AuthRoleId\"+\"}\", fmt.Sprintf(\"%v\", authRoleId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\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{\n\t\t\"application/json\",\n\t\t}\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, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\tdefer localVarHttpResponse.Body.Close()\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tbodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)\n\t\treturn localVarHttpResponse, reportError(\"Status: %v, Body: %s\", localVarHttpResponse.Status, bodyBytes)\n\t}\n\n\treturn localVarHttpResponse, err\n}", "title": "" }, { "docid": "28f9437af3932c1baeaf1d8ba025b068", "score": "0.6524635", "text": "func (_Bridge *BridgeSession) RevokeRole(role [32]byte, account common.Address) (*types.Transaction, error) {\n\treturn _Bridge.Contract.RevokeRole(&_Bridge.TransactOpts, role, account)\n}", "title": "" }, { "docid": "7392d32d687b151df4c6f6e479764c1c", "score": "0.65036553", "text": "func (r *IamRoleReconciler) DeleteRole(iamRole *iamv1alpha1.IamRole) error {\n\tlog := r.Log.WithValues(\"role\", iamRole.Name)\n\n\tif _, err := svc.DeleteRole(&iam.DeleteRoleInput{RoleName: aws.String(iamRole.ObjectMeta.Name)}); err != nil {\n\t\tlog.Error(err, \"Error deleting role\")\n\t\treturn err\n\t}\n\n\tlog.Info(\"Role deleted successfully\")\n\n\treturn nil\n}", "title": "" }, { "docid": "0c16fbdadab0147770cd3b3dbb82e821", "score": "0.64986837", "text": "func (_Bridge *BridgeTransactorSession) RevokeRole(role [32]byte, account common.Address) (*types.Transaction, error) {\n\treturn _Bridge.Contract.RevokeRole(&_Bridge.TransactOpts, role, account)\n}", "title": "" }, { "docid": "b2f46af979cecd1dfa752c41e72453ce", "score": "0.6494473", "text": "func DeleteUserRoleRel(o orm.Ormer, id int64) (err error) {\n\tv := UserRoleRel{Id: id}\n\t// ascertain id exists in the database\n\tif err = o.Read(&v); err == nil {\n\t\tvar num int64\n\t\tif num, err = o.Delete(&UserRoleRel{Id: id}); err == nil {\n\t\t\tfmt.Println(\"Number of records deleted in database:\", num)\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "a554e5d367c4ca49789fcba588a0535a", "score": "0.6452686", "text": "func (actor *MleActor) RemoveRole() {\n\tactor.m_role = nil\n}", "title": "" }, { "docid": "486875059cf11bf715589bd76d7c11e7", "score": "0.6449937", "text": "func (c *RoleClient) Delete() *RoleDelete {\n\tmutation := newRoleMutation(c.config, OpDelete)\n\treturn &RoleDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "486875059cf11bf715589bd76d7c11e7", "score": "0.6449937", "text": "func (c *RoleClient) Delete() *RoleDelete {\n\tmutation := newRoleMutation(c.config, OpDelete)\n\treturn &RoleDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "4ff6ce405feb70fdaf327b9318e4af40", "score": "0.6448872", "text": "func (c *Client) DeleteIamRole(id string) error {\n\tlog.Printf(\"[INFO] Deleting IAM role: %s\", id)\n\n\trmRole := DeleteRoleRequest{id}\n\n\tb, err := json.Marshal(struct {\n\t\tDeleteRoleRequest\n\t\tAccountDetails\n\t}{rmRole, c.AccountDetails})\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error encoding IAM delete role JSON: %s\", err)\n\t}\n\n\treq, err := c.NewRequest(b, \"POST\", \"/deleteRole/\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tresp, err := c.http.Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdel := new(DeleteRoleResponse)\n\terr = decodeBody(resp, &del)\n\n\tif err != nil {\n\t\tif reqID := GetRequestID(resp); reqID != \"\" {\n\t\t\treturn fmt.Errorf(\"Error parsing DeleteRole response: [%s] %s\", reqID, err)\n\t\t}\n\n\t\treturn fmt.Errorf(\"Error parsing DeleteRole response: %s\", err)\n\t}\n\n\t// TODO you get an error if you delete an already deleted role, need to revist for checking fail/success\n\tif del.RequestFailed() {\n\t\treturn fmt.Errorf(\"Error deleting role: [%s] %s\", del.BaseResponse.RequestID, strings.Join(del.GetErrors(), \", \"))\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f5bba4b30e9d4ef1dc298d891286255e", "score": "0.6431321", "text": "func DeleteRoleFromUser(userName string, role string, description string) error {\n\tfn := \"DeleteRoleFromUser\"\n\t// First fetch the user ID of the user\n\tclientID, err := FetchIDOfUser(userName)\n\tif err != nil {\n\t\tlogrus.Errorf(\"%s: %v\", fn, err)\n\t\treturn err\n\t}\n\t// Fetch the role ID\n\troleID, err := GetRoleID(role)\n\tif err != nil {\n\t\tlogrus.Errorf(\"%s: %v\", fn, err)\n\t\treturn err\n\t}\n\n\t// Frame the role struct to be assigned\n\tvar kRoles []KeycloakRoleRepresentation\n\tkRole := KeycloakRoleRepresentation{\n\t\tID: roleID,\n\t\tClientRole: false,\n\t\tComposite: false,\n\t\tContainerID: \"master\",\n\t\tDescription: description,\n\t\tName: role,\n\t}\n\tkRoles = append(kRoles, kRole)\n\troleBytes, err := json.Marshal(&kRoles)\n\tif err != nil {\n\t\tlogrus.Errorf(\"%s: %v\", fn, err)\n\t\treturn err\n\t}\n\treqURL := fmt.Sprintf(\"http://%s/auth/admin/realms/master/users/%s/role-mappings/realm\", keycloakEndPoint, clientID)\n\tmethod := \"DELETE\"\n\theaders, err := GetCommonHTTPHeaders(PxCentralAdminUser, PxCentralAdminPwd)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = processHTTPRequest(method, reqURL, headers, strings.NewReader(string(roleBytes)))\n\tif err != nil {\n\t\tlogrus.Errorf(\"%s: %v\", fn, err)\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "27a3ac6ebc097534d240dcaa7ae02b46", "score": "0.64283866", "text": "func (c *Client) DeleteEntityRole(entityID string, role string) error {\n\tresp, err := c.request(http.MethodDelete, fmt.Sprintf(\"/entities/%s:%s\", url.PathEscape(entityID), url.PathEscape(role)), \"application/json\", nil)\n\tif err == nil {\n\t\tresp.Close()\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "95864dd949aef98f7fbbfd9b085a9037", "score": "0.64247143", "text": "func (t *TeamService) RevokeRole(id int, roleID int) error {\n\tresult := new(Team)\n\tendpoint := fmt.Sprintf(\"/api/v2/teams/%d/roles/\", id)\n\tdata := map[string]interface{}{\n\t\t\"id\": roleID,\n\t\t\"disassociate\": \"true\",\n\t}\n\tpayload, err := json.Marshal(data)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tresp, err := t.client.Requester.PostJSON(endpoint, bytes.NewReader(payload), result, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := CheckResponse(resp); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "806abd8b40f49086c2e7c8da80e9a1fe", "score": "0.6417673", "text": "func (a *DirectoryRolesDirectoryRoleApiService) DirectoryRolesDirectoryRoleDeleteDirectoryRole(ctx _context.Context, directoryRoleId string, localVarOptionals *DirectoryRolesDirectoryRoleDeleteDirectoryRoleOpts) (*_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)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/directoryRoles({directoryRole-id})\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"directoryRole-id\"+\"}\", _neturl.QueryEscape(fmt.Sprintf(\"%v\", directoryRoleId)), -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\tif localVarOptionals != nil && localVarOptionals.IfMatch.IsSet() {\n\t\tlocalVarHeaderParams[\"If-Match\"] = parameterToString(localVarOptionals.IfMatch.Value(), \"\")\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 nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn 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 == 0 {\n\t\t\tvar v OdataError\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 localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarHTTPResponse, newErr\n\t\t}\n\t\treturn localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "a64c051918738eb87680ec202f2c8dc9", "score": "0.641732", "text": "func (i *IamClient) DeleteEKSClutserRole(ctx context.Context, prefix string) error {\n\treturn i.DeleteRole(ctx, i.GetEKSRoleName(prefix))\n}", "title": "" }, { "docid": "a07a0dd4e72ff369c6d1f5c7f9a60086", "score": "0.63883513", "text": "func (i *IamClient) DeleteRole(ctx context.Context, rolename string) error {\n\trole, err := i.RoleExists(ctx, rolename)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif role == nil {\n\t\treturn nil\n\t}\n\n\tlist, err := i.svc.ListAttachedRolePoliciesWithContext(ctx, &iam.ListAttachedRolePoliciesInput{\n\t\tRoleName: aws.String(rolename),\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, x := range list.AttachedPolicies {\n\t\t_, err := i.svc.DetachRolePolicyWithContext(ctx, &iam.DetachRolePolicyInput{\n\t\t\tRoleName: aws.String(rolename),\n\t\t\tPolicyArn: x.PolicyArn,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t_, err = i.svc.DeleteRoleWithContext(ctx, &iam.DeleteRoleInput{\n\t\tRoleName: aws.String(rolename),\n\t})\n\n\treturn err\n}", "title": "" }, { "docid": "cf98c0a0fd79a46dd7d8af9e1a30f5c9", "score": "0.6375099", "text": "func (a *Client) DeleteRoleForUser(params *DeleteRoleForUserParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteRoleForUserOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewDeleteRoleForUserParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"deleteRoleForUser\",\n\t\tMethod: \"DELETE\",\n\t\tPathPattern: \"/v1/users/{userId}/roles/{role}\",\n\t\tProducesMediaTypes: []string{\"*/*\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &DeleteRoleForUserReader{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.(*DeleteRoleForUserOK)\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 deleteRoleForUser: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "6dc643232921e7604180d50c15bd5b94", "score": "0.63661915", "text": "func DeleteRolesServiceUnavailable(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.RolesController, roleID int) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/roles/%v\", roleID),\n\t}\n\treq, err := http.NewRequest(\"DELETE\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"role_id\"] = []string{fmt.Sprintf(\"%v\", roleID)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"RolesTest\"), rw, req, prms)\n\tdeleteCtx, _err := app.NewDeleteRolesContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Delete(deleteCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 503 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 503\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "title": "" }, { "docid": "bf99ae07505c25da46e4da81ded9814e", "score": "0.63575006", "text": "func HandleDeleteRoleSuccessfully(t *testing.T) {\n\tth.Mux.HandleFunc(\"/roles/9fe1d3\", func(w http.ResponseWriter, r *http.Request) {\n\t\tth.TestMethod(t, r, \"DELETE\")\n\t\tth.TestHeader(t, r, \"X-Auth-Token\", fake.TokenID)\n\n\t\tw.WriteHeader(http.StatusNoContent)\n\t})\n}", "title": "" }, { "docid": "04986481128b5576e4c6e09546faddff", "score": "0.6340848", "text": "func (backend *JwtBackend) deleteRoleEntry(ctx context.Context, storage logical.Storage, roleName string) error {\n\tif roleName == \"\" {\n\t\treturn fmt.Errorf(\"missing role name\")\n\t}\n\troleName = strings.ToLower(roleName)\n\n\treturn storage.Delete(ctx, fmt.Sprintf(\"role/%s\", roleName))\n}", "title": "" }, { "docid": "94383fb112278482b002ab50d3ed659f", "score": "0.6314308", "text": "func XDeleteIamRole(paramId string, params *viper.Viper) (*gentleman.Response, map[string]interface{}, error) {\n\thandlerPath := \"delete-iam-role\"\n\tif xSubcommand {\n\t\thandlerPath = \"x \" + handlerPath\n\t}\n\n\tserver := viper.GetString(\"server\")\n\tif server == \"\" {\n\t\tserver = xServers()[viper.GetInt(\"server-index\")][\"url\"]\n\t}\n\n\turl := server + \"/iam-role/{id}\"\n\turl = strings.Replace(url, \"{id}\", paramId, 1)\n\n\treq := cli.Client.Delete().URL(url)\n\n\tcli.HandleBefore(handlerPath, params, req)\n\n\tresp, err := req.Do()\n\tif err != nil {\n\t\treturn nil, nil, errors.Wrap(err, \"Request failed\")\n\t}\n\n\tvar decoded map[string]interface{}\n\n\tif resp.StatusCode < 400 {\n\t\tif err := cli.UnmarshalResponse(resp, &decoded); err != nil {\n\t\t\treturn nil, nil, errors.Wrap(err, \"Unmarshalling response failed\")\n\t\t}\n\t} else {\n\t\treturn nil, nil, errors.Errorf(\"HTTP %d: %s\", resp.StatusCode, resp.String())\n\t}\n\n\tafter := cli.HandleAfter(handlerPath, params, resp, decoded)\n\tif after != nil {\n\t\tdecoded = after.(map[string]interface{})\n\t}\n\n\treturn resp, decoded, nil\n}", "title": "" }, { "docid": "ae1e76dad3c019e1a7729aa64e348c0c", "score": "0.628864", "text": "func DeleteRolesNoContent(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.RolesController, roleID int) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) {}\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/roles/%v\", roleID),\n\t}\n\treq, err := http.NewRequest(\"DELETE\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"role_id\"] = []string{fmt.Sprintf(\"%v\", roleID)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"RolesTest\"), rw, req, prms)\n\tdeleteCtx, _err := app.NewDeleteRolesContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Delete(deleteCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 204 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 204\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "title": "" }, { "docid": "2e36851d660977949fedcdd827a3d841", "score": "0.6279713", "text": "func (c *authorizationRoles) Delete(id string) error {\n\tpath := fmt.Sprintf(\"/v3/organizations/%s/roles/%s\", c.organizationID, id)\n\treturn c.client.Delete(path)\n}", "title": "" }, { "docid": "933c10a2411a57e8c3d982cc9fc70bf9", "score": "0.6243653", "text": "func (m *RoleModel) Delete(ctx context.Context, builders ...query.SQLBuilder) (int64, error) {\n\n\tsqlStr, params := m.query.Merge(builders...).AppendCondition(m.applyScope()).Table(m.tableName).ResolveDelete()\n\n\tres, err := m.db.ExecContext(ctx, sqlStr, params...)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn res.RowsAffected()\n\n}", "title": "" }, { "docid": "a550170cb6a09e9849723a2faba47970", "score": "0.6243534", "text": "func (c *RoleClient) DeleteOne(r *Role) *RoleDeleteOne {\n\treturn c.DeleteOneID(r.ID)\n}", "title": "" }, { "docid": "a550170cb6a09e9849723a2faba47970", "score": "0.6243534", "text": "func (c *RoleClient) DeleteOne(r *Role) *RoleDeleteOne {\n\treturn c.DeleteOneID(r.ID)\n}", "title": "" }, { "docid": "a9ab85ea921cb699420939ebf65e69ff", "score": "0.62221366", "text": "func (a *Client) DeleteBlueprinterRole(params *DeleteBlueprinterRoleParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteBlueprinterRoleOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewDeleteBlueprinterRoleParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"delete-blueprinter-role\",\n\t\tMethod: \"DELETE\",\n\t\tPathPattern: \"/platform/infrastructure/blueprinter/roles/{blueprinter_role_id}\",\n\t\tProducesMediaTypes: []string{\"\"},\n\t\tConsumesMediaTypes: []string{\"\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &DeleteBlueprinterRoleReader{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.(*DeleteBlueprinterRoleOK), nil\n\n}", "title": "" }, { "docid": "aef320dac4e636b5190d038d559af196", "score": "0.62145287", "text": "func (k *Kubectl) DeleteRoleBinding(namespace string, role string) error {\n\tout, err := runBinary(kubeCtlCmd, \"--namespace\", namespace, \"delete\", \"rolebinding\", role)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"Kubectl delete rolebinding failed with role %s failed. %s\", role, string(out))\n\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "af61cc2dc6d5c054da3681a1d4318151", "score": "0.61963564", "text": "func (m *Mocker) RemoveRole(guildID discord.GuildID, userID discord.UserID, roleID discord.RoleID) {\n\tm.MockAPI(\"RemoveRole\", http.MethodDelete,\n\t\t\"/guilds/\"+guildID.String()+\"/members/\"+userID.String()+\"/roles/\"+roleID.String(), nil)\n}", "title": "" }, { "docid": "765cdf9fb030dbdff7b64d67cbc1720f", "score": "0.61474675", "text": "func (client *RestClient) DeleteClusterRole(name string) error {\n\treturn client.Delete(ClusterRolesPath(name))\n}", "title": "" }, { "docid": "17600a1df3322429583a69acc482fb65", "score": "0.6032876", "text": "func (_m *RBAC) DeleteRole(ctx context.Context, roleName string) error {\n\tret := _m.Called(ctx, roleName)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(context.Context, string) error); ok {\n\t\tr0 = rf(ctx, roleName)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "158190eb7a8cafbb2f9405c1d9210454", "score": "0.59951204", "text": "func TestRole(t *testing.T) {\n\tvar result Role\n\terr := json.NewDecoder(roleBody).Decode(&result)\n\n\tif err != nil {\n\t\tt.Errorf(\"Error decoding JSON: %s\", err)\n\t}\n\n\tif result.ID != \"ReadOnlyUser\" {\n\t\tt.Errorf(\"Received invalid ID: %s\", result.ID)\n\t}\n\n\tif result.Name != \"User Role\" {\n\t\tt.Errorf(\"Received invalid name: %s\", result.Name)\n\t}\n\n\tif !result.IsPredefined {\n\t\tt.Errorf(\"IsPredefined incorrect for role.\")\n\t}\n\n\tif len(result.AssignedPrivileges) != 1 {\n\t\tt.Errorf(\"Expected 1 assigned privilege, found: %d\", len(result.AssignedPrivileges))\n\t}\n\n\tif result.AssignedPrivileges[0] != LoginPrivilegeType {\n\t\tt.Errorf(\"Expected 'Login' assigned privilege, got: %s\", result.AssignedPrivileges[0])\n\t}\n}", "title": "" }, { "docid": "82894b0b97b3f3493df058eb691157dd", "score": "0.59798044", "text": "func (r *Resource) DeleteRoleWithReason(ctx context.Context, id, reason string) error {\n\te := endpoint.DeleteGuildRole(r.guildID, id)\n\tresp, err := r.client.DoWithHeader(ctx, e, nil, rest.ReasonHeader(reason))\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != http.StatusNoContent {\n\t\treturn discord.NewAPIError(resp)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "567568248f09154cb9a6a324ac6840f9", "score": "0.588919", "text": "func (roleService *RoleService) AdminRemoveRoleAdminV3(roleId string) error {\n\taccessToken, err := roleService.TokenRepository.GetToken()\n\tif err != nil {\n\t\treturn err\n\t}\n\tparams := &roles.AdminRemoveRoleAdminV3Params{\n\t\tRoleID: roleId,\n\t}\n\t_, badRequest, unauthorized, forbidden, notFound, internalServer, err := roleService.IamService.Roles.AdminRemoveRoleAdminV3(params, client.BearerToken(*accessToken.AccessToken))\n\tif badRequest != nil {\n\t\terrorMsg, _ := json.Marshal(*badRequest.GetPayload())\n\t\tlogrus.Error(string(errorMsg))\n\t\treturn badRequest\n\t}\n\tif unauthorized != nil {\n\t\terrorMsg, _ := json.Marshal(*unauthorized.GetPayload())\n\t\tlogrus.Error(string(errorMsg))\n\t\treturn unauthorized\n\t}\n\tif forbidden != nil {\n\t\terrorMsg, _ := json.Marshal(*forbidden.GetPayload())\n\t\tlogrus.Error(string(errorMsg))\n\t\treturn forbidden\n\t}\n\tif notFound != nil {\n\t\terrorMsg, _ := json.Marshal(*notFound.GetPayload())\n\t\tlogrus.Error(string(errorMsg))\n\t\treturn notFound\n\t}\n\tif internalServer != nil {\n\t\treturn internalServer\n\t}\n\tif err != nil {\n\t\tlogrus.Error(err)\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "797c67c824a63cb8a21417a8fb9afeb3", "score": "0.58824795", "text": "func (roleService *RoleService) AdminDeleteRolePermissionV3(roleId, resource string, action int64) error {\n\taccessToken, err := roleService.TokenRepository.GetToken()\n\tif err != nil {\n\t\treturn err\n\t}\n\tparams := &roles.AdminDeleteRolePermissionV3Params{\n\t\tAction: action,\n\t\tResource: resource,\n\t\tRoleID: roleId,\n\t}\n\t_, badRequest, unauthorized, forbidden, notFound, internalServer, err := roleService.IamService.Roles.AdminDeleteRolePermissionV3(params, client.BearerToken(*accessToken.AccessToken))\n\tif badRequest != nil {\n\t\terrorMsg, _ := json.Marshal(*badRequest.GetPayload())\n\t\tlogrus.Error(string(errorMsg))\n\t\treturn badRequest\n\t}\n\tif unauthorized != nil {\n\t\terrorMsg, _ := json.Marshal(*unauthorized.GetPayload())\n\t\tlogrus.Error(string(errorMsg))\n\t\treturn unauthorized\n\t}\n\tif forbidden != nil {\n\t\terrorMsg, _ := json.Marshal(*forbidden.GetPayload())\n\t\tlogrus.Error(string(errorMsg))\n\t\treturn forbidden\n\t}\n\tif notFound != nil {\n\t\terrorMsg, _ := json.Marshal(*notFound.GetPayload())\n\t\tlogrus.Error(string(errorMsg))\n\t\treturn notFound\n\t}\n\tif internalServer != nil {\n\t\treturn internalServer\n\t}\n\tif err != nil {\n\t\tlogrus.Error(err)\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b8cd15c5724ede7e0ee92696479b502f", "score": "0.58680654", "text": "func DeleteUserTenantRole(userID uint, tenantID uint) {\n\tdb.Unscoped().Where(\"user_id = ?\", userID).Where(\"tenant_id = ?\", tenantID).Delete(&UserTenantRole{})\n}", "title": "" }, { "docid": "7be7a9638e58cb13a4344b7e6ff60d05", "score": "0.58597326", "text": "func (rl *sqlroles)delRoleEntry(sqlds *postgreSqlDataStore,\n handle interface{}) error {\n log := logging.GetAppLoggerObj()\n execPtr, err := sqlds.getDBExecFunction(handle)\n if err != nil {\n log.Error(\"Failed to create role table, invalid DB handle err : %s\",\n err)\n return err\n }\n _, err = execPtr(roleDelete, rl.roleType)\n if err != nil {\n log.Trace(\"Failed to delete the role entry from table\")\n return err\n }\n return nil\n}", "title": "" }, { "docid": "650dd22061eadd1886e12b88d2b36092", "score": "0.58478874", "text": "func (rbac *RBAC) RemoveRole(rid RoleID) {\n\trbac.mu.Lock()\n\tdefer rbac.mu.Unlock()\n\n\tdelete(rbac.roles, rid)\n}", "title": "" }, { "docid": "67509d2bfcb3222739825f7c1afbae3a", "score": "0.584738", "text": "func DeleteClusterRole(\n\tk8sClient client.Client,\n\tname string,\n) error {\n\tresource := types.NamespacedName{\n\t\tName: name,\n\t}\n\tclusterRole := &rbacv1.ClusterRole{}\n\terr := k8sClient.Get(context.TODO(), resource, clusterRole)\n\tif errors.IsNotFound(err) {\n\t\treturn nil\n\t} else if err != nil {\n\t\treturn err\n\t}\n\n\t// Do not delete the object if it has an owner\n\tif len(clusterRole.OwnerReferences) > 0 {\n\t\tlogrus.Infof(\"Cannot delete ClusterRole %s as it is owned\", name)\n\t\treturn nil\n\t}\n\n\tlogrus.Infof(\"Deleting %s ClusterRole\", name)\n\treturn k8sClient.Delete(context.TODO(), clusterRole)\n}", "title": "" }, { "docid": "6c3b1350ac79a20cf01cdcdfb3638097", "score": "0.5844977", "text": "func (m *MockroleDeleter) DeleteRole(arg0 string) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"DeleteRole\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "210fa8fced676eaae19f432c30979bff", "score": "0.5838908", "text": "func (o *UserTeamAttributes) UnsetRole() {\n\to.Role.Unset()\n}", "title": "" }, { "docid": "7dd8799bfb32e1e119f30aa075ad8fa3", "score": "0.58333504", "text": "func (c *Client) DeleteRoleMetaData(ctx context.Context, serviceName, roleName, namespace string) error {\n\tvar data struct {\n\t\tSuccess bool `json:\"success\"`\n\t}\n\t_, err := c.do(ctx, http.MethodDelete, fmt.Sprintf(\"/api/v0/services/%s/roles/%s/metadata/%s\", serviceName, roleName, namespace), nil, &data)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !data.Success {\n\t\treturn errors.New(\"mackerel: unexpected response\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "10c7433a8079d96a9836385b637a4645", "score": "0.58307433", "text": "func UpdateRole(role models.Role) (res structs.Response, err error) {\n\tpermissions := role.Permissions\n\tconfig.DB.Model(&role).Association(\"Permissions\").Clear()\n\trole.Permissions = permissions\n\tif err = config.DB.Save(&role).Error; err != nil {\n\t\tres.Message = err.Error()\n\t\treturn\n\t}\n\tres.Message = \"role update success\"\n\treturn\n}", "title": "" }, { "docid": "4ae6a264ca95659a64ba5a22a993a57e", "score": "0.58305615", "text": "func (f *Framework) DeleteNatsServiceRole(nsr *natsv1alpha2.NatsServiceRole) error {\n\t// Delete the service account that backs the NatsServiceRole.\n\t// Avoid erroring if we fail to delete the service account, as it is not the primary intent of this function.\n\t_ = f.KubeClient.CoreV1().ServiceAccounts(nsr.Namespace).Delete(nsr.Name, &metav1.DeleteOptions{})\n\t// Delete the NatsServiceRole with the specified name.\n\treturn f.NatsClient.NatsV1alpha2().NatsServiceRoles(nsr.Namespace).Delete(nsr.Name, &metav1.DeleteOptions{})\n}", "title": "" }, { "docid": "0766cb7277f59e78723bae02121adde3", "score": "0.5824038", "text": "func (m *Model) Delete(ctx context.Context, doorID, roleID int64) error {\n\t_, err := m.db.ExecContext(ctx, queryDelete, doorID, roleID)\n\treturn err\n}", "title": "" }, { "docid": "d97a2024809d9ea3a84c7c0be7b46ad5", "score": "0.57962686", "text": "func (c *Controller) finalizeMongoDBRole(dbRClient database.DatabaseRoleInterface, mRole *api.MongoDBRole) error {\n\terr := dbRClient.DeleteRole(mRole.RoleName())\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to database role\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "67101ad938564be25196bd6fdac5de79", "score": "0.57395595", "text": "func (this *AssignmentPermission) DeleteByRoleId(roleId int) (err error) {\n\tif roleId <= 0 {\n\t\treturn errors.New(\"角色ID不能为空\")\n\t}\n\n\to := orm.NewOrm()\n\t_, err = o.Raw(\"delete from \"+this.TableName()+\" where role_id=?\", roleId).Exec()\n\treturn err\n}", "title": "" }, { "docid": "c154d88f12c040f5efb7a61aa9ea9eb0", "score": "0.5731828", "text": "func DeleteIPRole(client *TwilioIPMessagingClient, serviceSid, sid string) error {\n\treturn client.delete(\"/Services/\" + serviceSid + \"/Roles/\" + sid)\n}", "title": "" }, { "docid": "0740be7c4931c9a18e2ce880f1087bfa", "score": "0.5713029", "text": "func removeDefaultRole(w http.ResponseWriter, r *http.Request, t auth.Token) (err error) {\n\tif !permission.Check(t, permission.PermRoleDefaultDelete) {\n\t\treturn permission.ErrUnauthorized\n\t}\n\n\trolesMap := map[string][]string{}\n\tfor evtName := range permTypes.RoleEventMap {\n\t\troles, _ := InputValues(r, evtName)\n\t\tfor _, roleName := range roles {\n\t\t\trolesMap[roleName] = append(rolesMap[roleName], evtName)\n\t\t}\n\t}\n\tfor roleName, evts := range rolesMap {\n\t\tevt, err := event.New(&event.Opts{\n\t\t\tTarget: event.Target{Type: event.TargetTypeRole, Value: roleName},\n\t\t\tKind: permission.PermRoleDefaultDelete,\n\t\t\tOwner: t,\n\t\t\tRemoteAddr: r.RemoteAddr,\n\t\t\tCustomData: event.FormToCustomData(InputFields(r)),\n\t\t\tAllowed: event.Allowed(permission.PermRoleReadEvents),\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer func() { evt.Done(err) }()\n\t\trole, err := permission.FindRole(roleName)\n\t\tif err != nil {\n\t\t\tif err == permTypes.ErrRoleNotFound {\n\t\t\t\treturn &errors.HTTP{\n\t\t\t\t\tCode: http.StatusBadRequest,\n\t\t\t\t\tMessage: err.Error(),\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn err\n\t\t}\n\t\tfor _, evtName := range evts {\n\t\t\terr = role.RemoveEvent(evtName)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7bf8a1617efeeedaeb71d1548bf605f2", "score": "0.5684017", "text": "func (roleService *RoleService) AdminDeleteRolePermissionsV3(roleId string, body []string) error {\n\taccessToken, err := roleService.TokenRepository.GetToken()\n\tif err != nil {\n\t\treturn err\n\t}\n\tparams := &roles.AdminDeleteRolePermissionsV3Params{\n\t\tBody: body,\n\t\tRoleID: roleId,\n\t}\n\t_, unauthorized, forbidden, notFound, err := roleService.IamService.Roles.AdminDeleteRolePermissionsV3(params, client.BearerToken(*accessToken.AccessToken))\n\tif unauthorized != nil {\n\t\treturn unauthorized\n\t}\n\tif forbidden != nil {\n\t\treturn forbidden\n\t}\n\tif notFound != nil {\n\t\treturn notFound\n\t}\n\tif err != nil {\n\t\tlogrus.Error(err)\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "102824120ef1614c7ae208e0c6f3a742", "score": "0.56697994", "text": "func (r *DeviceAndAppManagementRoleAssignmentRequest) Delete(ctx context.Context) error {\n\treturn r.JSONRequest(ctx, \"DELETE\", \"\", nil, nil)\n}", "title": "" } ]
a0bb7dc0c3d6adee684f80b774ed8db9
Restrict the network connection to the bandwidth limitations of the IOThrottlerPool
[ { "docid": "f3d2a46d6e8ceed22e3a675ca8563cdd", "score": "0.0", "text": "func (p *IOThrottlerPool) AddConn(conn net.Conn) (net.Conn, error) {\n\n\trwCloser, err := p.AddReadWriter(conn)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tthrottledRWC, ok := rwCloser.(*throttledReadWriteCloser)\n\tif !ok {\n\t\tlog.Fatalf(\"Programming error, expecting *throttledReadWriteCloser but got %v\", rwCloser)\n\t}\n\n\treturn &throttledConn{*throttledRWC, conn}, nil\n}", "title": "" } ]
[ { "docid": "15d8e5dba8fc1ab6bf2976b4128c4795", "score": "0.64122075", "text": "func (ipr *ipRate) Limit(service *fastly.Service) error {\n\tipr.Lock()\n\tdefer ipr.Unlock()\n\n\tif !noop && ipr.shouldLimit {\n\t\tif ipr.list.Verbose {\n\t\t\tlogger.Printf(\"Ratelimit exceeded. Queuing block for %s.\\n\", ipr.ip.String())\n\t\t}\n\t\tmsg := limitMessage{service: service, ipRate: ipr, operation: fastly.BatchOperationCreate}\n\t\tlimitCh <- &msg\n\t}\n\n\tif noop && !ipr.limited {\n\t\t// Pretend we limited here. Duplicates some of pushACLUpdates.\n\t\tipr.Strikes++\n\t\tlimitDuration := ipr.list.LimitDuration.multiply(float64(ipr.Strikes))\n\t\tipr.LimitExpire = time.Now().Add(limitDuration.Duration)\n\t\tlogger.Printf(\"NOOP: Would issue limit on IP %s on service %s, for duration of %v.\\n\", ipr.ip.String(), service.Name, limitDuration.Duration)\n\t\t// Pretend we're limited in noop mode so that messages don't spam.\n\t\tipr.limited = true\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "dd59f1fb8510d4101d478e8e5250ab95", "score": "0.62973213", "text": "func FixedWindowRateLimiterMiddleware(windowSize, maxRequest int, redisConnection redis.Cmdable, useIP bool) echo.MiddlewareFunc {\n fwLimiter := FixedWindowRateLimiter{AbstractRateLimiter{\n windowSize: windowSize, maxRequest: maxRequest, redisConnection: redisConnection, useIP: useIP}}\n fwLimiter.AbstractRateLimiter.RateLimiter = fwLimiter\n return fwLimiter.apply()\n}", "title": "" }, { "docid": "bde8c665b74730ae905e637cc9ada8c4", "score": "0.61723226", "text": "func (pool *IOThrottlerPool) SetBandwidth(bandwith Bandwidth) {\n\tpool.bandwidthSettingChan <- bandwith\n}", "title": "" }, { "docid": "5fecca716d7fa7ab5220e9fb35ccca64", "score": "0.6060756", "text": "func limitMiddleware(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tlimiter := limiter.GetLimiter(r.RemoteAddr)\n\t\tif !limiter.Allow() {\n\t\t\thttp.Error(w, http.StatusText(http.StatusTooManyRequests), http.StatusTooManyRequests)\n\t\t\treturn\n\t\t}\n\n\t\tnext.ServeHTTP(w, r)\n\t})\n}", "title": "" }, { "docid": "c90f63438c7f674169c9e77e983456b1", "score": "0.6052107", "text": "func NewIOThrottlerPool(bandwidth Bandwidth) *IOThrottlerPool {\n\n\tpool := &IOThrottlerPool{make(chan Bandwidth), make(chan Bandwidth), make(chan Bandwidth), make(chan int64), make(chan bool)}\n\n\tgo throttlerPoolDriver(pool)\n\n\tpool.bandwidthSettingChan <- bandwidth\n\n\treturn pool\n}", "title": "" }, { "docid": "180b31cb67b5cc285158b7888176fb5c", "score": "0.5999547", "text": "func (tbt *TransmissionBandwidthThrottle) ThrottleConnction(conn net.Conn) net.Conn {\n\n\tlim := tbt.defaultConnBandwidthLimit.Limit()\n\tburst := tbt.defaultConnBandwidthLimit.Burst()\n\t// create new limiter for each connection and store it so\n\t// SetLimits could be applied later on\n\tnewConnBandwidthLimit := rate.NewLimiter(lim, burst)\n\ttbt.addConnection(conn, newConnBandwidthLimit)\n\n\treturn &BandwidthLimitConn{\n\t\tConn: conn,\n\t\tthrottleLimits: tbt,\n\t}\n}", "title": "" }, { "docid": "0fd22ee2376da9b2f9487298b5287fd8", "score": "0.5991506", "text": "func RateLimit(requests int) OptionFn {\n\treturn func(srvr *Server) {\n\t\tsrvr.rateLimitRequests = requests\n\t}\n}", "title": "" }, { "docid": "b3437619dcb13dfc0354405b4ee82d1c", "score": "0.59798545", "text": "func (endpoint *EndPoint) Throttling(r *http.Request) bool {\n\n\tvar limiter = endpoint.normalLimiter\n\n\tif endpoint.botLimiter != nil && crawlerdetect.IsCrawler(r.UserAgent()) {\n\t\tlog.Println(\"Crawler detected\")\n\t\tlimiter = endpoint.botLimiter\n\t}\n\n\tif limiter != nil {\n\t\treturn !limiter.Allow()\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "cd3013c2445d16a56346e246c0cfc8c7", "score": "0.59727687", "text": "func (c *ConcurrentRetrier) Throttle() {\n\tc.throttleInternal()\n}", "title": "" }, { "docid": "74dadcfe37ce6014939e8b0fc42fb38e", "score": "0.59426695", "text": "func Ratelimit() gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\n\t\tt := time.Now()\n\n\t\tpipe := helper.RedisClient().Pipeline()\n\t\thits := pipe.Incr(\"ratelimit::hits::\" + c.ClientIP())\n\t\tbytes := pipe.IncrBy(\"ratelimit::bytes::\"+c.ClientIP(), c.Request.ContentLength)\n\t\tdefer pipe.Close()\n\t\tpipe.Exec()\n\n\t\tratelimitcheck(\"Hits\", hits.Val(), c)\n\t\tratelimitcheck(\"Bytes\", bytes.Val(), c)\n\n\t\tc.Header(\"X-Ratelimit-Latency\", time.Since(t).String())\n\n\t\tc.Next()\n\t}\n}", "title": "" }, { "docid": "a2889f8c8b780577d4523369f12d43ad", "score": "0.5940527", "text": "func (r Rule) RateLimit(p <-chan struct{}, over Overflow, otherwise Rule) Rule {\n\treturn limit(r, acquireChan(p), over, otherwise)\n}", "title": "" }, { "docid": "a01f05268015e92ccaba3fcb822658bf", "score": "0.59333277", "text": "func (r *RateLimiter) Limit(ctx context.Context, lockKey string, f LimitedFunc) (interface{}, error) {\n\tlimiter, _ := r.limitersByKey.LoadOrStore(\n\t\tlockKey,\n\t\trate.NewLimiter(rate.Every(r.refillInterval), r.burst),\n\t)\n\tr.lastAccessedByKey.Store(lockKey, time.Now())\n\n\tif !limiter.(*rate.Limiter).Allow() {\n\t\t// For now, we are only emitting this metric to get an idea of the shape\n\t\t// of traffic.\n\t\tr.requestsDroppedMetric.Inc()\n\t\tif featureflag.RateLimit.IsEnabled(ctx) {\n\t\t\treturn nil, helper.ErrUnavailable(errors.New(\"too many requests\"))\n\t\t}\n\t}\n\n\treturn f()\n}", "title": "" }, { "docid": "8fa2861d13b1a146dcffadf3740442da", "score": "0.5913624", "text": "func RateLimitLB(client *redis.Client, hasher speedbump.RateHasher, max int64) gin.HandlerFunc {\n\tlimiter := speedbump.NewLimiter(client, hasher, max)\n\n\treturn func(c *gin.Context) {\n\t\t// Attempt to perform the request\n\t\tip := GetRequesterAddress(c.Request)\n\t\tok, err := limiter.Attempt(ip)\n\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tif !ok {\n\t\t\tnextTime := time.Now().Add(hasher.Duration())\n\n\t\t\tc.JSON(429, gin.H{\n\t\t\t\t\"status\": \"error\",\n\t\t\t\t\"messages\": []string{\"Rate limit exceeded. Try again in \" + humanize.Time(nextTime)},\n\t\t\t})\n\t\t\tc.Abort()\n\t\t}\n\n\t\tc.Next()\n\n\t\t// After the request\n\t\t// log.Print(ip + \" was limited because it exceeded the max rate\")\n\t}\n}", "title": "" }, { "docid": "883f6a1a16cfecec1204edc1832c1f56", "score": "0.58530223", "text": "func Limiter(handler http.Handler) http.Handler {\n\tlmt := tollbooth.NewLimiter(10, &limiter.ExpirableOptions{\n\t\tExpireJobInterval: 1 * time.Microsecond,\n\t})\n\tlmt.SetIPLookups([]string{\"RemoteAddr\", \"X-Forwarded-For\", \"X-Real-IP\"})\n\t// Set a custom function for rejection.\n\tlmt.SetOnLimitReached(func(w http.ResponseWriter, r *http.Request) { logrus.Errorln(\"A request was rejected\") })\n\treturn tollbooth.LimitHandler(lmt, handler)\n}", "title": "" }, { "docid": "7728eff9d243bf756c2561d6b2c96f99", "score": "0.5846434", "text": "func (l *ApiLimiter) Limit(ctx context.Context, operation string) {\n\tr := l.limiter.Reserve()\n\tif delay := r.Delay(); delay != time.Duration(0) && delay != rate.InfDuration {\n\t\tl.metrics.ObserveRateLimit(operation, delay)\n\t\tl.limiter.Wait(ctx)\n\t}\n}", "title": "" }, { "docid": "5c6876900daabcd0a9380d95dfbe0135", "score": "0.58453643", "text": "func limitTransferRate(w io.Writer) io.Writer {\n\treturn flowrate.NewWriter(w, 1000*1000*1000)\n}", "title": "" }, { "docid": "8ee22a00f9ece675f28b87eeb40a6454", "score": "0.5835449", "text": "func RateLimit(fillInterval time.Duration, capacity int64, quantum int64) XServerOption {\n\treturn func(o *options) {\n\t\to.rc = &rateLimitConf{\n\t\t\tfillInterval: fillInterval,\n\t\t\tcapacity: capacity,\n\t\t\tquantum: quantum,\n\t\t}\n\t}\n}", "title": "" }, { "docid": "fc9d9c7f67613d4a3123815f761efd37", "score": "0.5829083", "text": "func IPRateLimitWithConfig(perMin int, burst int) echo.MiddlewareFunc {\n\n\tlog.Println(\"init\")\n\tstore, err := memstore.New(65536)\n\tif err != nil {\n\t\tlog.Panicf(\"IPRateLimit - ipRateLimiter.Get - err: %v, \", err)\n\t\t//return nil\n\t}\n\n\tquota = throttled.RateQuota{\n\t\tMaxRate: throttled.PerMin(perMin),\n\t\tMaxBurst: burst,\n\t}\n\trateLimiter, err = throttled.NewGCRARateLimiter(store, quota)\n\tif err != nil {\n\t\tlog.Panicf(\"IPRateLimit - ipRateLimiter.Get - err: %v, \", err)\n\t\t//\treturn nil\n\t}\n\n\t// Return middleware handler\n\treturn func(next echo.HandlerFunc) echo.HandlerFunc {\n\t\treturn func(c echo.Context) (err error) {\n\t\t\tip := c.RealIP()\n\n\t\t\tisLimited, RateLimitResult, err := rateLimiter.RateLimit(ip, 1)\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"IPRateLimit - ipRateLimiter.Get - err: %v, %s on %s\", err, ip, c.Request().URL)\n\t\t\t\treturn c.JSON(http.StatusInternalServerError, echo.Map{\n\t\t\t\t\t\"success\": false,\n\t\t\t\t\t\"message\": err,\n\t\t\t\t})\n\t\t\t}\n\n\t\t\th := c.Response().Header()\n\t\t\th.Set(\"X-RateLimit-Limit\", strconv.Itoa(RateLimitResult.Limit))\n\t\t\th.Set(\"X-RateLimit-Remaining\", strconv.Itoa(RateLimitResult.Remaining))\n\t\t\th.Set(\"X-RateLimit-Reset\", strconv.Itoa(int(RateLimitResult.ResetAfter.Milliseconds()/1000)))\n\n\t\t\tif isLimited {\n\t\t\t\tlog.Printf(\"Too Many Requests from %s on %s\", ip, c.Request().URL)\n\t\t\t\treturn c.JSON(http.StatusTooManyRequests, echo.Map{\n\t\t\t\t\t\"success\": false,\n\t\t\t\t\t\"message\": \"Too Many Requests on \" + c.Request().URL.String(),\n\t\t\t\t})\n\t\t\t}\n\n\t\t\treturn next(c)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "efee4655507ba01c54e71898ad6b7c8c", "score": "0.5820297", "text": "func (f *clientPool) setLimits(totalConn int, totalCap uint64) {\n\tf.lock.Lock()\n\tdefer f.lock.Unlock()\n\n\tf.connLimit = totalConn\n\tf.capLimit = totalCap\n\tif f.connectedCap > f.capLimit || f.connectedQueue.Size() > f.connLimit {\n\t\tf.connectedQueue.MultiPop(func(data interface{}, priority int64) bool {\n\t\t\tf.dropClient(data.(*clientInfo), mclock.Now(), true)\n\t\t\treturn f.connectedCap > f.capLimit || f.connectedQueue.Size() > f.connLimit\n\t\t})\n\t}\n}", "title": "" }, { "docid": "b10bb47bf041247f68a3e89d9a0b0eb3", "score": "0.5745313", "text": "func RateLimiter(requestLimitPerMin int) gin.HandlerFunc {\n\tvar ipLimiter = ipratelimiter.NewIPRateLimiter(requestLimitPerMin)\n\treturn func(c *gin.Context) {\n\t\tip := c.ClientIP()\n\t\tlimiter := ipLimiter.GetLimiter(ip)\n\t\tisAllow, statusSnapshot := limiter.Allow()\n\t\tsetHeaders(c, ip, statusSnapshot)\n\t\tif isAllow {\n\t\t\tc.Next()\n\t\t} else {\n\t\t\tc.AbortWithStatus(http.StatusTooManyRequests)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "61ca66bd99689ebf5df4e3cd43b311a1", "score": "0.57431555", "text": "func TestBasicOps(t *testing.T) {\n\tpool := NewIOThrottlerPool(defaultRate, defaultBurst)\n\tassertNotNil(pool, t)\n\tids := pool.GetIDs()\n\tif len(ids) != 0 {\n\t\tt.Fatalf(\"Expecting %v to be not got %v.\", 0, len(ids))\n\t}\n\n\t// make sure we error out looking for a non existent buffer\n\t_, _, err := pool.GetLimitByID(\"reader\")\n\tassertNotNil(err, t)\n\n\t// make sure we can change the global limits\n\tr, b := pool.GetGlobalLimit()\n\tif r != defaultRate {\n\t\tt.Fatalf(\"Expecting %v to be not got %v.\", defaultRate, r)\n\t}\n\tif b != defaultBurst {\n\t\tt.Fatalf(\"Expecting %v to be not got %v.\", defaultBurst, b)\n\t}\n\n\tpool.SetGlobalLimit(defaultRate*2, defaultBurst*2)\n\tr, b = pool.GetGlobalLimit()\n\tif r != defaultRate*2 {\n\t\tt.Fatalf(\"Expecting %v to be not got %v.\", defaultRate*2, r)\n\t}\n\tif b != defaultBurst*2 {\n\t\tt.Fatalf(\"Expecting %v to be not got %v.\", defaultBurst*2, b)\n\t}\n\n\ttest := []byte(\"test\")\n\trc := ioutil.NopCloser(bytes.NewReader(test))\n\treader := pool.NewThrottledReadCloser(rc, defaultRate, defaultBurst, \"reader\")\n\tassertNotNil(reader, t)\n\tids = pool.GetIDs()\n\tif len(ids) != 1 {\n\t\tt.Fatalf(\"Expecting %v to be not got %v.\", 1, len(ids))\n\t}\n\tr, b, err = pool.GetLimitByID(\"reader\")\n\tassertNil(err, t)\n\n\tif r != defaultRate {\n\t\tt.Fatalf(\"Expecting %v to be not got %v.\", defaultRate, r)\n\t}\n\tif b != defaultBurst {\n\t\tt.Fatalf(\"Expecting %v to be not got %v.\", defaultBurst, b)\n\t}\n\terr = pool.SetLimitByID(defaultRate*2, defaultBurst*2, \"reader\")\n\tassertNil(err, t)\n\tr, b, err = pool.GetLimitByID(\"reader\")\n\tassertNil(err, t)\n\n\tif r != defaultRate*2 {\n\t\tt.Fatalf(\"Expecting %v to be not got %v.\", defaultRate*2, r)\n\t}\n\tif b != defaultBurst*2 {\n\t\tt.Fatalf(\"Expecting %v to be not got %v.\", defaultBurst*2, b)\n\t}\n\n\t// make sure we can read the buffer\n\tbuff := make([]byte, 200)\n\tn, err := reader.Read(buff)\n\tassertNil(err, t)\n\tif n != len(test) {\n\t\tt.Fatalf(\"Expecting %v to be not got %v.\", len(test), n)\n\t}\n\n\t//close the buffer and make sure we have no more buffer\n\treader.Close()\n\tids = pool.GetIDs()\n\tif len(ids) != 0 {\n\t\tt.Fatalf(\"Expecting %v to be not got %v.\", 0, len(ids))\n\t}\n\n\t// make sure that the original is closed\n\tn, err = rc.Read(test)\n\tif n != 0 {\n\t\tt.Fatalf(\"Expected to read %v but got %v\", 0, n)\n\t}\n\tassertNotNil(err, t)\n\n\t// add two buffer\n\tr1 := pool.NewThrottledReadCloser(rc, defaultRate, defaultBurst, \"r1\")\n\tassertNotNil(reader, t)\n\tids = pool.GetIDs()\n\tif len(ids) != 1 {\n\t\tt.Fatalf(\"Expecting %v to be not got %v\", 1, len(ids))\n\t}\n\tr2 := pool.NewThrottledReadCloser(rc, defaultRate, defaultBurst, \"r2\")\n\tassertNotNil(reader, t)\n\tids = pool.GetIDs()\n\tif len(ids) != 2 {\n\t\tt.Fatalf(\"Expecting %v to be not got %v\", 2, len(ids))\n\t}\n\n\tpool.SetLimitForAll(defaultRate*2, defaultBurst*2)\n\tr, b, err = pool.GetLimitByID(\"r1\")\n\tassertNil(err, t)\n\n\tif r != defaultRate*2 {\n\t\tt.Fatalf(\"Expecting %v to be not got %v\", defaultRate*2, r)\n\t}\n\tif b != defaultBurst*2 {\n\t\tt.Fatalf(\"Expecting %v to be not got %v\", defaultBurst*2, b)\n\t}\n\tr, b, err = pool.GetLimitByID(\"r2\")\n\tassertNil(err, t)\n\n\tif r != defaultRate*2 {\n\t\tt.Fatalf(\"Expecting %v to be not got %v\", defaultRate*2, r)\n\t}\n\tif b != defaultBurst*2 {\n\t\tt.Fatalf(\"Expecting %v to be not got %v\", defaultBurst*2, b)\n\t}\n\tr2.Close()\n\tids = pool.GetIDs()\n\tif len(ids) != 1 {\n\t\tt.Fatalf(\"Expecting %v to be not got %v\", 1, len(ids))\n\t}\n\tr1.Close()\n\tids = pool.GetIDs()\n\tif len(ids) != 0 {\n\t\tt.Fatalf(\"Expecting %v to be not got %v\", 0, len(ids))\n\t}\n\n\t// make sure we can close net.Conn\n\tclient, server := createTcpPipe(t)\n\tdefer client.Close()\n\tdefer server.Close()\n\trtcp := pool.NewThrottledReadCloser(server, defaultRate, defaultBurst, server.RemoteAddr().String())\n\tids = pool.GetIDs()\n\tif len(ids) != 1 {\n\t\tt.Fatalf(\"Expecting %v to be not got %v\", 1, len(ids))\n\t}\n\tif ids[0] != server.RemoteAddr().String() {\n\t\tt.Fatalf(\"Expecting %v to be not got %v\", server.RemoteAddr().String(), ids[0])\n\t}\n\twtcp := pool.NewThrottledWriteCloser(client, defaultRate, defaultBurst, \"bla\")\n\tids = pool.GetIDs()\n\tif len(ids) != 2 {\n\t\tt.Fatalf(\"Expecting %v to be not got %v\", 2, len(ids))\n\t}\n\trtcp.Close()\n\tids = pool.GetIDs()\n\tif len(ids) != 1 {\n\t\tt.Fatalf(\"Expecting %v to be not got %v\", 1, len(ids))\n\t}\n\tn, err = rtcp.Read(test)\n\tif n != 0 {\n\t\tt.Fatalf(\"Expected to read %v but got %v\", 0, n)\n\t}\n\tassertNotNil(err, t)\n\twtcp.Close()\n\tids = pool.GetIDs()\n\tif len(ids) != 0 {\n\t\tt.Fatalf(\"Expecting %v to be not got %v\", 0, len(ids))\n\t}\n\n\tpool2 := NewIOThrottlerPool(defaultRate, defaultBurst)\n\tassertNotNil(pool2, t)\n\tclient, server = createTcpPipe(t)\n\tdefer client.Close()\n\tdefer server.Close()\n\t// create readwritecloser and close it\n\n\trw := NewThrottledReadWriteCloser(pool, pool2, client, defaultRate, defaultBurst, defaultRate, defaultBurst, \"rw\")\n\tids = pool.GetIDs()\n\tif len(ids) != 1 {\n\t\tt.Fatalf(\"Expecting %v to be not got %v\", 1, len(ids))\n\t}\n\tids = pool2.GetIDs()\n\tif len(ids) != 1 {\n\t\tt.Fatalf(\"Expecting %v to be not got %v\", 1, len(ids))\n\t}\n\trw.Close()\n\tids = pool.GetIDs()\n\tif len(ids) != 0 {\n\t\tt.Fatalf(\"Expecting %v to be not got %v\", 1, len(ids))\n\t}\n\tids = pool2.GetIDs()\n\tif len(ids) != 0 {\n\t\tt.Fatalf(\"Expecting %v to be not got %v\", 1, len(ids))\n\t}\n\n\t// create net.conn throttled\n\tclient, server = createTcpPipe(t)\n\tdefer client.Close()\n\tdefer server.Close()\n\n\tc := NewThrottledThrottledConn(pool, pool2, client, defaultRate, defaultBurst, defaultRate, defaultBurst)\n\tids = pool.GetIDs()\n\tif len(ids) != 1 {\n\t\tt.Fatalf(\"Expecting %v to be not got %v\", 1, len(ids))\n\t}\n\tids = pool2.GetIDs()\n\tif len(ids) != 1 {\n\t\tt.Fatalf(\"Expecting %v to be not got %v\", 1, len(ids))\n\t}\n\tc.Close()\n\tids = pool.GetIDs()\n\tif len(ids) != 0 {\n\t\tt.Fatalf(\"Expecting %v to be not got %v\", 1, len(ids))\n\t}\n\tids = pool2.GetIDs()\n\tif len(ids) != 0 {\n\t\tt.Fatalf(\"Expecting %v to be not got %v\", 1, len(ids))\n\t}\n}", "title": "" }, { "docid": "23cf78b37a9d79252fb4de896f9c0462", "score": "0.5732923", "text": "func (app *virtAPIApp) shouldChangeRateLimiter() {\n\tconfig := app.clusterConfig.GetConfig()\n\tqps := config.APIConfiguration.RestClient.RateLimiter.TokenBucketRateLimiter.QPS\n\tburst := config.APIConfiguration.RestClient.RateLimiter.TokenBucketRateLimiter.Burst\n\tapp.reloadableRateLimiter.Set(flowcontrol.NewTokenBucketRateLimiter(qps, burst))\n\tlog.Log.V(2).Infof(\"setting rate limiter for the API to %v QPS and %v Burst\", qps, burst)\n\tqps = config.WebhookConfiguration.RestClient.RateLimiter.TokenBucketRateLimiter.QPS\n\tburst = config.WebhookConfiguration.RestClient.RateLimiter.TokenBucketRateLimiter.Burst\n\tapp.reloadableWebhookRateLimiter.Set(flowcontrol.NewTokenBucketRateLimiter(qps, burst))\n\tlog.Log.V(2).Infof(\"setting rate limiter for webhooks to %v QPS and %v Burst\", qps, burst)\n}", "title": "" }, { "docid": "ee2adb5d4e8a3148b331ba9114384331", "score": "0.56912684", "text": "func (this *API) RequestsLimit() int { return 0 }", "title": "" }, { "docid": "68b768905f10d7050c06868537329703", "score": "0.5689532", "text": "func (t *LeakyBucket) Limit(ctx context.Context) (time.Duration, error) {\n\tt.mu.Lock()\n\tdefer t.mu.Unlock()\n\tif err := t.locker.Lock(ctx); err != nil {\n\t\treturn 0, err\n\t}\n\tdefer func() {\n\t\tif err := t.locker.Unlock(ctx); err != nil {\n\t\t\tt.logger.Log(err)\n\t\t}\n\t}()\n\tstate, err := t.backend.State(ctx)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tnow := t.clock.Now().UnixNano()\n\tif now < state.Last {\n\t\t// The queue has requests in it: move the current request to the last position + 1.\n\t\tstate.Last += t.rate\n\t} else {\n\t\t// The queue is empty.\n\t\t// The offset is the duration to wait in case the last request happened less than rate duration ago.\n\t\tvar offset int64\n\t\tdelta := now - state.Last\n\t\tif delta < t.rate {\n\t\t\toffset = t.rate - delta\n\t\t}\n\t\tstate.Last = now + offset\n\t}\n\n\twait := state.Last - now\n\tif wait/t.rate > t.capacity {\n\t\treturn time.Duration(wait), ErrLimitExhausted\n\t}\n\tif err = t.backend.SetState(ctx, state); err != nil {\n\t\treturn 0, err\n\t}\n\treturn time.Duration(wait), nil\n}", "title": "" }, { "docid": "2fc5886fbfe8ab6c3a4eb5b51939c61a", "score": "0.56728965", "text": "func RateLimit(rateLimiters []*SlidingWindow, n int, retryDuration time.Duration) {\n\tfor _, rl := range rateLimiters {\n\t\tfor !rl.Allow(int64(n)) {\n\t\t\ttime.Sleep(retryDuration)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2d3437e46d5a5395f88c0d0a401f2cc9", "score": "0.56615305", "text": "func LimitBackend(be restic.Backend, l Limiter) restic.Backend {\n\treturn rateLimitedBackend{\n\t\tBackend: be,\n\t\tlimiter: l,\n\t}\n}", "title": "" }, { "docid": "f08f3357ad941c699e467d933767194e", "score": "0.56572914", "text": "func proxyLimit(t *scraping.Task) int {\n\tif len(t.Jobs) < ProxiesLimit {\n\t\treturn len(t.Jobs)\n\t}\n\n\treturn ProxiesLimit\n}", "title": "" }, { "docid": "56f69b3c71748a8d19cde55957b70e14", "score": "0.5651164", "text": "func LimitRate(n int, duration time.Duration) gin.HandlerFunc {\n\twnd := &window{n, 0, 0, time.Now().Truncate(duration), duration}\n\treturn func(c *gin.Context) {\n\t\terr := wnd.hit()\n\t\tif err != nil {\n\t\t\tc.AbortWithStatusJSON(http.StatusTooManyRequests, gin.H{\n\t\t\t\t\"message\": \"Too Many Requests\",\n\t\t\t})\n\t\t}\n\t\tc.Next()\n\t}\n}", "title": "" }, { "docid": "537b18431335f3c5fbfe0b62a66d9bfb", "score": "0.56503016", "text": "func (app *application) rateLimit(next http.Handler) http.Handler {\n\n\t// Define a client struct to hold the rate limiter and last seen time of each client\n\ttype client struct {\n\t\tlimiter *rate.Limiter\n\t\tlastSeen time.Time\n\t}\n\n\tvar (\n\t\tmu sync.Mutex\n\t\tclients = make(map[string]*client)\n\t)\n\n\t// Launch a background goroutine that removes old entries from the clients map once\n\t// every minute. This is to prevent the clients map from growing indefinitely.\n\tgo func() {\n\t\tfor {\n\t\t\ttime.Sleep(time.Minute)\n\n\t\t\t// Lock the mutex to prevent any rate limiter checks from happening while\n\t\t\t// the cleanup is taking place\n\t\t\tmu.Lock()\n\n\t\t\t// Loop through all the clients. If they haven't been seen in the last 3 minutes,\n\t\t\t// delete the corresponding entry from the map.\n\t\t\tfor ip, client := range(clients) {\n\t\t\t\tif time.Since(client.lastSeen) > 3 * time.Minute {\n\t\t\t\t\tdelete(clients, ip)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Unlock the mutex when the cleanup is complete\n\t\t\tmu.Unlock()\n\t\t}\n\t}()\n\n\t// The function returned closes over the initialized limiter.\n\treturn http.HandlerFunc(func (w http.ResponseWriter, r *http.Request) {\n\t\t// Only carry out the check if rate limiting is enabled\n\t\tif app.config.limiter.enabled {\n\t\t\t// Extract the client's IP address from the request\n\t\t\tip, _, err := net.SplitHostPort(r.RemoteAddr)\n\t\t\tif err != nil {\n\t\t\t\tapp.serverErrorResponse(w, r, err)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Lock the mutex to prevent the following code from being executed concurrently\n\t\t\tmu.Lock()\n\n\t\t\t// Check if IP address already exists in the map.\n\t\t\t// If it doesn't, then initialize a new rate limiter and add the limiter to the map \n\t\t\t// with the IP address as the key.\n\t\t\tif _, found := clients[ip]; !found {\n\t\t\t\tclients[ip] = &client{\n\t\t\t\t\t// Use limiter rps and burst from app config\n\t\t\t\t\tlimiter: rate.NewLimiter(rate.Limit(app.config.limiter.rps), app.config.limiter.burst),\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Update last seen\n\t\t\tclients[ip].lastSeen = time.Now()\n\n\t\t\t// limiter.Allow() checks if one event (request) can happen now.\n\t\t\t// It consumes one token.\n\t\t\t// If no token is available, it returns false.\n\t\t\t// Note that Allow() is protected by a mutex and safe for concurrent use.\n\t\t\tif !clients[ip].limiter.Allow() {\n\t\t\t\tmu.Unlock() // Unlock the mutex\n\t\t\t\tapp.rateLimitExceededResponse(w, r)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Unlock the mutex before calling the next handler in the chain.\n\t\t\t// Importantly, DO NOT defer the unlock of mutex.\n\t\t\t// Else, the mutex will not be unlocked until all the downstream handlers of this middleware have returned.\n\t\t\tmu.Unlock()\n\t\t}\n\n\t\tnext.ServeHTTP(w, r)\n\t})\n}", "title": "" }, { "docid": "62c98697a86338605b507fa5ec75336c", "score": "0.5633788", "text": "func (l *BBR) Allow() (DoneFunc, error) {\n\tif l.shouldDrop() {\n\t\treturn nil, ErrLimitExceed\n\t}\n\tatomic.AddInt64(&l.inFlight, 1)\n\tstart := time.Now().UnixNano()\n\tms := float64(time.Millisecond)\n\treturn func(DoneInfo) {\n\t\t//nolint\n\t\trt := int64(math.Ceil(float64(time.Now().UnixNano()-start)) / ms)\n\t\tl.rtStat.Add(rt)\n\t\tatomic.AddInt64(&l.inFlight, -1)\n\t\tl.passStat.Add(1)\n\t}, nil\n}", "title": "" }, { "docid": "cd3147abb17a53424a7856c5a38034da", "score": "0.5627055", "text": "func (h *HaproxyInstace) SetRateLimit(what string, value uint) error {\n\tswitch what {\n\tcase \"connections\", \"http-compression\", \"sessions\", \"ssl-sessions\":\n\tdefault:\n\t\treturn errors.New(\"Unsupported \\\"what\\\", supported values: \\\"connections\\\", \\\"http-compression\\\", \\\"sessions\\\", \\\"ssl-sessions\\\"\")\n\t}\n\n\tout, err := h.q(\"set rate-limit \" + what + \" global \" + fmt.Sprintf(\"%v\", value))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfmt.Println(out)\n\n\treturn nil\n}", "title": "" }, { "docid": "659ac3d85f824716f4ffe578a694f2de", "score": "0.5613037", "text": "func (b *Breaker) Allow() error {\n\t// The number of requests accepted by the backend\n\taccepts, total := b.summary()\n\t// The number of requests attempted by the application layer(at the client, on top of the adaptive throttling system)\n\trequests := b.k * float64(accepts)\n\t// check overflow requests = K * accepts\n\tif total < b.request || float64(total) < requests {\n\t\tatomic.CompareAndSwapInt32(&b.state, StateOpen, StateClosed)\n\t\treturn nil\n\t}\n\tatomic.CompareAndSwapInt32(&b.state, StateClosed, StateOpen)\n\tdr := math.Max(0, (float64(total)-requests)/float64(total+1))\n\tdrop := b.trueOnProba(dr)\n\tif drop {\n\t\treturn ErrNotAllowed\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "271409b3d40d185d3060de534efa445b", "score": "0.56011945", "text": "func ResourceRateLimiter(ctx iris.Context) {\n\tctxt := ctx.Request().Context()\n\turi := ctx.Request().RequestURI\n\tfor _, val := range config.Data.ResourceRateLimit {\n\t\tresourceLimit := strings.Split(val, \":\")\n\t\tif len(resourceLimit) > 1 && resourceLimit[1] != \"\" {\n\t\t\trLimit, _ := strconv.Atoi(resourceLimit[1])\n\t\t\tresource := strings.Replace(resourceLimit[0], \"{id}\", \"[a-zA-Z0-9._-]+\", -1)\n\t\t\tregex := regexp.MustCompile(resource)\n\t\t\tif regex.MatchString(uri) {\n\t\t\t\tconn, err := common.GetDBConnection(common.InMemory)\n\t\t\t\tif err != nil {\n\t\t\t\t\tl.LogWithFields(ctxt).Error(err.Error())\n\t\t\t\t\tresponse := common.GeneralError(http.StatusInternalServerError, response.InternalError, err.Error(), nil, nil)\n\t\t\t\t\tcommon.SetResponseHeader(ctx, response.Header)\n\t\t\t\t\tctx.StatusCode(http.StatusInternalServerError)\n\t\t\t\t\tctx.JSON(&response.Body)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\t// convert millisecond to second\n\t\t\t\texpiretime := rLimit / 1000\n\t\t\t\tif err = conn.SetExpire(\"ResourceRateLimit\", uri, \"\", expiretime); err != nil {\n\t\t\t\t\terrorMessage := \"too many requests, retry after some time\"\n\t\t\t\t\tl.LogWithFields(ctxt).Error(errorMessage)\n\t\t\t\t\tresponse := common.GeneralError(http.StatusServiceUnavailable, response.RateLimitExceeded, errorMessage, nil, nil)\n\t\t\t\t\tremainTime, _ := conn.TTL(ResourceRateLimit, uri)\n\t\t\t\t\tif remainTime > 0 {\n\t\t\t\t\t\tctx.ResponseWriter().Header().Set(\"Retry-After\", strconv.Itoa(remainTime))\n\t\t\t\t\t}\n\t\t\t\t\tcommon.SetResponseHeader(ctx, response.Header)\n\t\t\t\t\tctx.StatusCode(http.StatusServiceUnavailable)\n\t\t\t\t\tctx.JSON(&response.Body)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tctx.Next()\n}", "title": "" }, { "docid": "0aa12c0535be4ccf96de225379368007", "score": "0.5567445", "text": "func (l *Limiter) AllowN(n int) bool {\n\tok, _ := l.ReserveN(n)\n\treturn ok\n}", "title": "" }, { "docid": "1e8c006a581e4c311452b8ac10880049", "score": "0.5534031", "text": "func RateLimitCircuitBreaker(g *backpressure.Backpressure) autorest.SendDecorator {\n\treturn func(s autorest.Sender) autorest.Sender {\n\t\treturn autorest.SenderFunc(func(r *http.Request) (*http.Response, error) {\n\t\t\t// Check if we can proceed with request. If not, short-circuit here.\n\t\t\tif !g.CanProceed() {\n\t\t\t\treturn nil, microerror.Maskf(tooManyRequestsError, \"retry after %q\", g.RetryAfter())\n\t\t\t}\n\n\t\t\t// Pass the request to next SendDecorator.\n\t\t\tresp, err := s.Do(r)\n\n\t\t\t// Check if rate-limiting has kicked in and Backpressure needs to be\n\t\t\t// updated correspondingly.\n\t\t\tif resp != nil && resp.StatusCode == http.StatusTooManyRequests {\n\t\t\t\tretryAfter, err := httputil.ParseRetryAfter(resp)\n\t\t\t\tif err != nil {\n\t\t\t\t\t// In case parsing fails, it's ok to fall back on default delay.\n\t\t\t\t\tretryAfter = time.Now().UTC().Add(defaultWaitAfterTooManyRequests)\n\t\t\t\t}\n\n\t\t\t\tg.NotBefore(retryAfter)\n\t\t\t\treturn nil, microerror.Maskf(tooManyRequestsError, \"retry after %q\", g.RetryAfter())\n\t\t\t}\n\n\t\t\treturn resp, err\n\t\t})\n\t}\n}", "title": "" }, { "docid": "f31c338f441cbac1604c5a8855911a26", "score": "0.55307865", "text": "func (httpServer *HttpServer) limitConnections(w http.ResponseWriter, remoteAddr string) bool {\n\tif int(atomic.LoadInt32(&httpServer.numClients)+1) > httpServer.config.RPCMaxClients {\n\t\tLogger.log.Infof(\"Max RPC clients exceeded [%d] - \"+\n\t\t\t\"disconnecting client %s\", httpServer.config.RPCMaxClients,\n\t\t\tremoteAddr)\n\t\thttp.Error(w, \"503 Too busy. Try again later.\",\n\t\t\thttp.StatusServiceUnavailable)\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "89955005d5186585444640310a34af43", "score": "0.552871", "text": "func (tbt *TransmissionBandwidthThrottle) SetConnectionBandwidthLimit(connBandwidth float64) {\n\ttbt.limiterLock.Lock()\n\tdefer tbt.limiterLock.Unlock()\n\ttbt.defaultConnBandwidthLimit.SetLimit(rate.Limit(connBandwidth))\n\tfor _, limiter := range tbt.connectionLimitMap {\n\t\t// connectionLimitMap is a slice of connection limit and a server limit\n\t\t// here we only need the connection limiter\n\t\tlimiter[0].SetLimit(rate.Limit(connBandwidth))\n\t}\n}", "title": "" }, { "docid": "7013f7b8c7775817ccf5336b72a2ca3e", "score": "0.5519289", "text": "func (s *Writer) SetRateLimit(bytesPerSec float64) {\n\ts.limiter = rate.NewLimiter(rate.Limit(bytesPerSec), burstLimit)\n\ts.limiter.AllowN(time.Now(), burstLimit) // spend initial burst\n}", "title": "" }, { "docid": "d664369aabcf9d3dcfb82827ead71221", "score": "0.55188316", "text": "func createThrottledLimiter(ctx *context.Context) (err error) {\n\tvar rateLimiter *throttled.GCRARateLimiter\n\trateLimiter, err = throttled.NewGCRARateLimiter(ctx.Store, throttled.RateQuota{MaxRate: defaults.LimiterMaxRate, MaxBurst: defaults.LimiterMaxBurst})\n\tif err != nil {\n\t\treturn\n\t}\n\tctx.HttpRateLimiter = throttled.HTTPRateLimiter{\n\t\tDeniedHandler: nil,\n\t\tError: nil,\n\t\tRateLimiter: rateLimiter,\n\t\tVaryBy: &throttled.VaryBy{Headers: []string{\"RemoteAddr\", \"X-Forwarded-For\", \"X-Real-IP\"}},\n\t}\n\treturn\n}", "title": "" }, { "docid": "366c3036878e1b5aa7f9d8dc326c654f", "score": "0.5516088", "text": "func (rl *RateLimit) SetRateLimit(readBPS, writeBPS int64, packetSize uint64) {\n\tatomic.StoreInt64(&rl.atomicReadBPS, readBPS)\n\tatomic.StoreInt64(&rl.atomicWriteBPS, writeBPS)\n\tatomic.StoreUint64(&rl.atomicPacketSize, packetSize)\n}", "title": "" }, { "docid": "6cd6302a3e161f563af10586d2de08a6", "score": "0.5514205", "text": "func (t *Throttler) Throttle(h http.Handler) http.Handler {\n\treturn t.RateLimit(h)\n}", "title": "" }, { "docid": "20ea540734eb40bc73d6e3e998fc059e", "score": "0.55126476", "text": "func (ipfs *Connector) rateLimiter() {\n\tisRateLimiting := false\n\n\t// TODO: The rate-limiter is configured to start rate-limiting after\n\t// 10 failed requests at a rate of 1 req/s. This should probably be\n\t// configurable.\n\tfor {\n\t\tfailed := ipfs.failedRequests.Load()\n\t\tswitch {\n\t\tcase failed == 0:\n\t\t\tif isRateLimiting {\n\t\t\t\t// This does not print always,\n\t\t\t\t// only when there were several requests\n\t\t\t\t// waiting to read.\n\t\t\t\tlogger.Warning(\"Lifting up rate limit\")\n\t\t\t}\n\t\t\tisRateLimiting = false\n\t\tcase failed > 0 && failed <= 10:\n\t\t\tisRateLimiting = false\n\t\tcase failed > 10:\n\t\t\tif !isRateLimiting {\n\t\t\t\tlogger.Warning(\"Rate-limiting requests to 1req/s\")\n\t\t\t}\n\t\t\tisRateLimiting = true\n\t\t\ttime.Sleep(time.Second)\n\t\t}\n\n\t\t// Send tick\n\t\tselect {\n\t\tcase <-ipfs.ctx.Done():\n\t\t\tclose(ipfs.reqRateLimitCh)\n\t\t\treturn\n\t\tcase ipfs.reqRateLimitCh <- struct{}{}:\n\t\t\t// note that the channel is unbuffered,\n\t\t\t// therefore we will sit here until a method\n\t\t\t// wants to read from us, and they don't if\n\t\t\t// failed == 0.\n\t\t}\n\t}\n}", "title": "" }, { "docid": "fc5a9225141806e41f27556cc47d1ad5", "score": "0.55089587", "text": "func (s *rpcServer) limitConnections(w http.ResponseWriter, remoteAddr string) bool {\n\tif int(atomic.LoadInt32(&s.numClients)+1) > s.cfg.RPCMaxClients {\n\t\trpcsLog.Infof(\"Max RPC clients exceeded [%d] - \"+\n\t\t\t\"disconnecting client %s\", s.cfg.RPCMaxClients,\n\t\t\tremoteAddr)\n\t\thttp.Error(w, \"503 Too busy. Try again later.\",\n\t\t\thttp.StatusServiceUnavailable)\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "ca4c15e1122e0f1763cd5532b7adb082", "score": "0.5508261", "text": "func (instance *ConcurrentPool) Limit() int {\n\treturn instance.limit\n}", "title": "" }, { "docid": "1dbaffb064c29d7735a101f2bc5fa351", "score": "0.54970086", "text": "func adjustedDefaultLimits(cfg config.SwarmConfig) rcmgr.LimitConfig {\n\t// Run checks to avoid introducing regressions\n\tif os.Getenv(\"IPFS_CHECK_RCMGR_DEFAULTS\") != \"\" {\n\t\t// FIXME: Broken. Being tracked in https://github.com/ipfs/go-ipfs/issues/8949.\n\t\tcheckImplicitDefaults()\n\t}\n\tdefaultLimits := rcmgr.DefaultLimits\n\tlibp2p.SetDefaultServiceLimits(&defaultLimits)\n\n\t// Adjust limits\n\t// (based on https://github.com/filecoin-project/lotus/pull/8318/files)\n\t// - if Swarm.ConnMgr.HighWater is too high, adjust Conn/FD/Stream limits\n\n\t// Outbound conns and FDs are set very high to allow for the accelerated DHT client to (re)load its routing table.\n\t// Currently it doesn't gracefully handle RM throttling--once it does we can lower these.\n\t// High outbound conn limits are considered less of a DoS risk than high inbound conn limits.\n\t// Also note that, due to the behavior of the accelerated DHT client, we don't need many streams, just conns.\n\tif minOutbound := 65536; defaultLimits.SystemBaseLimit.ConnsOutbound < minOutbound {\n\t\tdefaultLimits.SystemBaseLimit.ConnsOutbound = minOutbound\n\t}\n\tif minFD := 4096; defaultLimits.SystemBaseLimit.FD < minFD {\n\t\tdefaultLimits.SystemBaseLimit.FD = minFD\n\t}\n\tdefaultLimitConfig := defaultLimits.AutoScale()\n\n\t// Do we need to adjust due to Swarm.ConnMgr.HighWater?\n\tif cfg.ConnMgr.Type == \"basic\" {\n\t\tmaxconns := cfg.ConnMgr.HighWater\n\t\tif 2*maxconns > defaultLimitConfig.System.ConnsInbound {\n\t\t\t// adjust conns to 2x to allow for two conns per peer (TCP+QUIC)\n\t\t\tdefaultLimitConfig.System.ConnsInbound = logScale(2 * maxconns)\n\t\t\tdefaultLimitConfig.System.ConnsOutbound = logScale(2 * maxconns)\n\t\t\tdefaultLimitConfig.System.Conns = logScale(4 * maxconns)\n\n\t\t\tdefaultLimitConfig.System.StreamsInbound = logScale(16 * maxconns)\n\t\t\tdefaultLimitConfig.System.StreamsOutbound = logScale(64 * maxconns)\n\t\t\tdefaultLimitConfig.System.Streams = logScale(64 * maxconns)\n\n\t\t\tif 2*maxconns > defaultLimitConfig.System.FD {\n\t\t\t\tdefaultLimitConfig.System.FD = logScale(2 * maxconns)\n\t\t\t}\n\n\t\t\tdefaultLimitConfig.ServiceDefault.StreamsInbound = logScale(8 * maxconns)\n\t\t\tdefaultLimitConfig.ServiceDefault.StreamsOutbound = logScale(32 * maxconns)\n\t\t\tdefaultLimitConfig.ServiceDefault.Streams = logScale(32 * maxconns)\n\n\t\t\tdefaultLimitConfig.ProtocolDefault.StreamsInbound = logScale(8 * maxconns)\n\t\t\tdefaultLimitConfig.ProtocolDefault.StreamsOutbound = logScale(32 * maxconns)\n\t\t\tdefaultLimitConfig.ProtocolDefault.Streams = logScale(32 * maxconns)\n\n\t\t\tlog.Info(\"adjusted default resource manager limits\")\n\t\t}\n\n\t}\n\n\treturn defaultLimitConfig\n}", "title": "" }, { "docid": "caaade47c80a4f3b50c7ed3c3b5ab007", "score": "0.5483273", "text": "func TestThrottlingWriteGlobal(t *testing.T) {\n\t// One byte a second\n\tpool := NewIOThrottlerPool(1, 1)\n\n\tr, w := io.Pipe()\n\ttw := pool.NewThrottledWriteCloser(w, 100000, 100000, \"r\")\n\tassertNotNil(tw, t)\n\tdata := []byte(\"01234\")\n\telapsedSeconds, err := timeTransfer(data, r, tw)\n\tif elapsedSeconds != int64(len(data)-1) {\n\t\tt.Fatalf(\"Expecting read to take %v seconds but it took %v instead\", int64(len(data)-1), elapsedSeconds)\n\t}\n\tassertNil(err, t)\n\n}", "title": "" }, { "docid": "77066d87e102f9ab13223705030db331", "score": "0.5473044", "text": "func (rateLimiter *RateLimiter) RateLimitRoutine() {\n\n defer rateLimiter.WaitServerDone.Done()\n\n ticker := time.NewTicker(time.Millisecond * 5)\n defer ticker.Stop()\n\n draining := false\n\n messageLoop:\n for ;; {\n updateCount := 0\n select {\n case count := <-rateLimiter.SubmitChan:\n if count == 0 {\n draining = true\n } else if count < 0 {\n break messageLoop\n } else if !draining {\n updateCount = 1\n }\n\n break\n\n case <- ticker.C:\n break\n }\n\n for {\n timestamp := rateLimiter.getCurrentTimestamp()\n if timestamp == rateLimiter.CurrentTimestamp {\n break\n }\n\n rateLimiter.CurrentTimestamp = timestamp\n if rateLimiter.Count <= rateLimiter.CountLimit {\n rateLimiter.Count = 0\n if draining {\n break messageLoop\n }\n } else {\n rateLimiter.Count -= rateLimiter.CountLimit\n clientsToRelease := rateLimiter.Count\n if clientsToRelease > rateLimiter.CountLimit {\n clientsToRelease = rateLimiter.CountLimit\n }\n for i := int64(0); i < clientsToRelease; i++ {\n rateLimiter.ReleaseChan <- 1\n }\n }\n }\n\n if updateCount > 0 {\n rateLimiter.Count ++;\n rateLimiter.TotalCount ++\n if rateLimiter.Count <= rateLimiter.CountLimit {\n rateLimiter.ReleaseChan <- 1\n }\n }\n }\n\n // unblock all go routines blocked by submit/release channel\n close(rateLimiter.ReleaseChan)\n close(rateLimiter.SubmitChan)\n}", "title": "" }, { "docid": "1f9887f9bc2bb9213466f4e309a7ed85", "score": "0.54707444", "text": "func (s *Reader) SetRateLimit(bytesPerSec float64) {\n\ts.limiter = rate.NewLimiter(rate.Limit(bytesPerSec), burstLimit)\n\ts.limiter.AllowN(time.Now(), burstLimit) // spend initial burst\n}", "title": "" }, { "docid": "1f9887f9bc2bb9213466f4e309a7ed85", "score": "0.54707444", "text": "func (s *Reader) SetRateLimit(bytesPerSec float64) {\n\ts.limiter = rate.NewLimiter(rate.Limit(bytesPerSec), burstLimit)\n\ts.limiter.AllowN(time.Now(), burstLimit) // spend initial burst\n}", "title": "" }, { "docid": "14b42ab2fa30a3eba1d9d96f98dec89c", "score": "0.5469162", "text": "func (s *RpcServer) limitConnections(w http.ResponseWriter, remoteAddr string) bool {\n\tif int(atomic.LoadInt32(&s.numClients)+1) > s.config.RPCMaxClients {\n\t\tlog.Info(\"RPC clients exceeded\", \"max\", s.config.RPCMaxClients,\n\t\t\t\"client\", remoteAddr)\n\t\thttp.Error(w, \"503 Too busy. Try again later.\",\n\t\t\thttp.StatusServiceUnavailable)\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "ea93686aaf2acd65122979395d6be8d7", "score": "0.5459442", "text": "func CheckRateLimit(r *http.Request) bool {\n\trateLimitLock.Lock()\n\tip := GetRemoteIP(r)\n\tnow := time.Now().Unix() * RateLimit\n\tif val, ok := rateLimitMap[ip]; ok {\n\t\tif (val + RateLimitBurst) < now {\n\t\t\trateLimitMap[ip] = now - RateLimitBurst\n\t\t}\n\t} else {\n\t\trateLimitMap[ip] = now - RateLimit\n\t}\n\n\trateLimitMap[ip]++\n\trateLimitLock.Unlock()\n\treturn rateLimitMap[ip] <= now\n}", "title": "" }, { "docid": "5b23ed1cbd20f9407388c8c854db47b5", "score": "0.5459411", "text": "func (f *RateLimitedFinder) Limit() int {\n\treturn f.limiter.Burst()\n}", "title": "" }, { "docid": "413fcf12e81a11879ae062100e3601ee", "score": "0.54563266", "text": "func (recv *UnixMountMonitor) SetRateLimit(limitMsec int32) {\n\tc_limit_msec := (C.int)(limitMsec)\n\n\tC.g_unix_mount_monitor_set_rate_limit((*C.GUnixMountMonitor)(recv.native), c_limit_msec)\n\n\treturn\n}", "title": "" }, { "docid": "864176d456c7120d05987427d498f4c7", "score": "0.5443589", "text": "func SetRateLimit(limit time.Duration, burst int) {\n\tlogging.mu.Lock()\n\tlogging.rateLimiter = rate.NewLimiter(rate.Every(limit), burst)\n\tlogging.mu.Unlock()\n}", "title": "" }, { "docid": "dfab336523c2c03dccf7d203f3d42c47", "score": "0.54276294", "text": "func (l *Limiter) Throttle() {\n\tl.m.Lock()\n\tif l.started {\n\t\tfor l.tokens <= 0 {\n\t\t\tl.c.Wait()\n\t\t}\n\t\tl.tokens--\n\t}\n\tl.m.Unlock()\n}", "title": "" }, { "docid": "ae8b96c2a91639fb5f6eb2cb591db3ce", "score": "0.5421106", "text": "func main() {\n // First, basic rate limiting. Suppose we want to limit\n // the handling of incomin requests. We'll serve these\n // requests off a channel of the same name.\n requests := make(chan int, 5)\n for i:= 1; i <= 5; i++ {\n requests <- i\n }\n close(requests)\n\n // The 'limiter' channel will receive a value every 200ms\n // This is the regulator in our rate limiting scheme\n limiter := time.Tick(time.Millisecond * 200)\n\n // By blocking on a receive from the limiter channel before\n // serving each request, we limit ourselves to 1 request\n // every 200 milliseconds\n for req := range requests {\n <-limiter\n fmt.Println(\"request\", req, time.Now())\n }\n\n // We may want to allow short bursts of requests in our rate\n // limiting scheme while preserving the overall rate limit. We\n // can accomplish this by buffering our limiter channle. This\n // burstyLimiter channel will allow bursts of up to 3 events\n burstyLimiter := make(chan time.Time, 3)\n\n // Fill the channel to represent allowed bursting\n for i:= 0; i < 3; i++ {\n burstyLimiter <- time.Now()\n }\n\n // Every 200ms we'll try to add a new value to burstyLimiter,\n // up to its limit of 3\n go func() {\n for t:= range time.Tick(time.Millisecond * 200) {\n burstyLimiter <- t\n }\n }()\n\n // Now simulate 5 more incomin requests. The first 3 of these\n // will benefit from the burst capability of burstyLimiter\n burstyRequests := make(chan int, 5)\n for i := 1; i <= 5; i++ {\n burstyRequests <- i\n }\n close(burstyRequests)\n for req := range burstyRequests {\n <-burstyLimiter\n fmt.Println(\"request\", req, time.Now())\n }\n\n // Running the program, the first batch of requests are handled\n // once every 200 milliseconds\n\n // The second batch of requests we serve the first 3 immediately\n // because of the burstable rate limiting, then serve the remaining\n // 2 with _200ms delays each\n}", "title": "" }, { "docid": "90228cdbbcee5678df3d93fa4f69b8ec", "score": "0.5410934", "text": "func WarningHTTPRequestRateLimited() error {\n\treturn warningHTTPRequestRateLimited\n}", "title": "" }, { "docid": "a56467f852f155bec9f6db55ce5d9f41", "score": "0.5401192", "text": "func RateLimitIP(h http.Handler) http.Handler {\n\tlimiter := NewIPRateLimiter(0.016, 5) // Approximately recovering 1 token per minute\n\tfn := func(w http.ResponseWriter, r *http.Request) {\n\t\tl := limiter.GetLimiter(r.RemoteAddr)\n\t\tif !l.Allow() {\n\t\t\tw.WriteHeader(http.StatusUnauthorized) // Use 401 over 429 due to rate limiting discovery\n\t\t\tLogEntrySetField(r, \"failure_reason\", \"rate_limited_ip\")\n\t\t\t// To avoid leaking information, lets do some useless work.\n\t\t\tbcrypt.GenerateFromPassword([]byte(\"much-wow-such-work\"), 8)\n\t\t\treturn\n\t\t}\n\t\th.ServeHTTP(w, r)\n\t}\n\treturn http.HandlerFunc(fn)\n}", "title": "" }, { "docid": "55b3722bfc0cb9795a741656b4f5b089", "score": "0.54008967", "text": "func TestThrottlingReadGlobal(t *testing.T) {\n\t// One byte a second\n\tpool := NewIOThrottlerPool(1, 1)\n\n\tr, w := io.Pipe()\n\ttr := pool.NewThrottledReadCloser(r, 100000, 100000, \"r\")\n\tassertNotNil(tr, t)\n\tdata := []byte(\"01234\")\n\telapsedSeconds, err := timeTransfer(data, tr, w)\n\tif elapsedSeconds != int64(len(data)-1) {\n\t\tt.Fatalf(\"Expecting read to take %v seconds but it took %v instead\", int64(len(data)-1), elapsedSeconds)\n\t}\n\tassertNil(err, t)\n\n}", "title": "" }, { "docid": "0d2b56c51ea6868688c409ba53180936", "score": "0.538982", "text": "func LimitMiddleware(limiter *config.Limiter) gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\ttollbooth.SetResponseHeaders(limiter, c.Writer)\n\n\t\tif err := tollbooth.LimitByRequest(limiter, c.Request); err != nil {\n\t\t\tc.AbortWithError(err.StatusCode, err)\n\t\t}\n\n\t\tc.Next()\n\t}\n}", "title": "" }, { "docid": "313d762e3fa13db34c4254ed783b67ba", "score": "0.5365911", "text": "func (c *Core) Throttle(tooFast bool) {\n\n\tif tooFast {\n\t\tc.throttle += 10\n\t} else {\n\t\tc.throttle -= 10\n\t}\n}", "title": "" }, { "docid": "b7ff399a5bba00c80e922f32bd21643d", "score": "0.5363678", "text": "func rateLimiting() {\n\tfmt.Printf(\"\\n=== 33 - Rate Limiting ===\\n\\n\")\n\n\trequests := make(chan int, 5)\n\n\tfor i := 1; i <= 5; i++ {\n\t\trequests <- i\n\t}\n\n\tclose(requests)\n\n\tlimiter := time.Tick(200 * time.Millisecond)\n\n\tfor req := range requests {\n\t\t<-limiter\n\t\tfmt.Println(\"request\", req, time.Now())\n\t}\n\n\tburstyLimiter := make(chan time.Time, 3)\n\n\tfor i := 0; i < 3; i++ {\n\t\tburstyLimiter <- time.Now()\n\t}\n\n\tgo func() {\n\t\tfor t := range time.Tick(200 * time.Millisecond) {\n\t\t\tburstyLimiter <- t\n\t\t}\n\t}()\n\n\tburstyRequests := make(chan int, 5)\n\n\tfor i := 1; i <= 5; i++ {\n\t\tburstyRequests <- i\n\t}\n\n\tclose(burstyRequests)\n\n\tfor req := range burstyRequests {\n\t\t<-burstyLimiter\n\t\tfmt.Println(\"Bursty request: \", req, time.Now())\n\t}\n}", "title": "" }, { "docid": "47e17f079b7549c43116a8c71490777b", "score": "0.53600687", "text": "func WithThrottledRoutines(max int) Opt {\n\treturn func(o *Options) {\n\t\to.maxRoutines = max\n\t}\n}", "title": "" }, { "docid": "6c946f01bba50ac5f15df414681976a8", "score": "0.53526604", "text": "func TestConnMeterCacheSize(t *testing.T) {\n\tm := NewConnMeter(time.Hour, 1, 1)\n\n\tallow := m.Allow(host1)\n\tassert.True(t, allow)\n\tallow = m.Allow(host1)\n\tassert.False(t, allow) // Rate-limited\n\n\t// Should kick host 1 out of the cache\n\tallow = m.Allow(host2)\n\tassert.True(t, allow)\n\n\tallow = m.Allow(host1)\n\tassert.True(t, allow) // No longer rate-limited\n}", "title": "" }, { "docid": "037b2746f1b3772146853de15456e88a", "score": "0.5352384", "text": "func (l *Limiter) Limit() int64 {\n\treturn l.limitPerSecond.Load()\n}", "title": "" }, { "docid": "601e01966c675dbce3bc1d2b247aae10", "score": "0.5350028", "text": "func (s *Server) wsLimiter(ip dex.IPKey) *routeLimiter {\n\t// If the ip is a loopback address, this likely indicates a hidden service\n\t// or misconfigured reverse proxy, and it is undesirable for many such\n\t// connections to share a common limiter. To avoid this, return a new\n\t// untracked limiter for such clients.\n\tif ip.IsLoopback() {\n\t\treturn newRouteLimiter()\n\t}\n\n\ts.wsLimiterMtx.Lock()\n\tdefer s.wsLimiterMtx.Unlock()\n\tprefix := ip.PrefixV6()\n\tif prefix != nil { // not ipv4\n\t\tif n := s.v6Prefixes[*prefix]; n > 0 {\n\t\t\tlog.Infof(\"Detected %d active IPv6 connections with same prefix %v\", n, prefix)\n\t\t\t// Consider: Use a prefix-aggregated limiter when n > threshold. If\n\t\t\t// we want to get really sophisticated, we may look into a tiered\n\t\t\t// aggregation algorithm. https://serverfault.com/a/919324/190378\n\t\t\t//\n\t\t\t// ip = *prefix\n\t\t}\n\t}\n\n\tif l := s.wsLimiters[ip]; l != nil {\n\t\tif l.conns >= rpcMaxConnsPerIP {\n\t\t\treturn nil\n\t\t}\n\t\tl.conns++\n\t\tif prefix != nil {\n\t\t\ts.v6Prefixes[*prefix]++\n\t\t}\n\t\tif l.cleaner != nil { // l.conns was zero\n\t\t\tlog.Debugf(\"Restoring active rate limiter for %v\", ip)\n\t\t\t// Even if the timer already fired, we won the race to the lock and\n\t\t\t// incremented conns so the cleaner func will be a no-op.\n\t\t\tl.cleaner.Stop() // false means timer fired already\n\t\t\tl.cleaner = nil\n\t\t}\n\t\treturn l.routeLimiter\n\t}\n\n\tlimiter := newRouteLimiter()\n\ts.wsLimiters[ip] = &ipWsLimiter{\n\t\tconns: 1,\n\t\trouteLimiter: limiter,\n\t}\n\tif prefix != nil {\n\t\ts.v6Prefixes[*prefix]++\n\t}\n\treturn limiter\n}", "title": "" }, { "docid": "e83e0147a639d37bfea1e65d8a5374d0", "score": "0.53458834", "text": "func (rl *rateLimiter) allow(weight int) bool {\n\trl.mu.Lock()\n\tdefer rl.mu.Unlock()\n\tif time.Since(rl.lastTime) < rl.interval {\n\t\tif rl.curCount >= weight {\n\t\t\trl.curCount -= weight\n\t\t\treturn true\n\t\t}\n\t\treturn false\n\t}\n\trl.curCount = rl.maxCount - weight\n\trl.lastTime = time.Now()\n\treturn true\n}", "title": "" }, { "docid": "ae6463f7d79a47cb81f2bc35266ba67b", "score": "0.5343921", "text": "func LimitConcurrentRequests(n int) gin.HandlerFunc {\n\tsem := make(chan struct{}, n)\n\tacquire := func() { sem <- struct{}{} }\n\trelease := func() { <-sem }\n\treturn func(c *gin.Context) {\n\t\tacquire() // before request\n\t\tdefer release() // after request\n\t\tc.Next()\n\t}\n}", "title": "" }, { "docid": "7961c0882771fdd4beda984180075157", "score": "0.5339761", "text": "func Limit(max int) gin.HandlerFunc {\n\tif max <= 0 {\n\t\tlog.Panic(\"max must be more than 0\")\n\t}\n\tsema := make(chan struct{}, max)\n\treturn func(c *gin.Context) {\n\t\tvar called, fulled bool\n\t\tdefer func() {\n\t\t\tif called == false && fulled == false {\n\t\t\t\t<-sema\n\t\t\t}\n\t\t\tif r := recover(); r != nil { // We don't handle panic\n\t\t\t\tpanic(r)\n\t\t\t}\n\t\t}()\n\n\t\tselect {\n\t\tcase sema <- struct{}{}:\n\t\t\tc.Next()\n\t\t\tcalled = true\n\t\t\t<-sema\n\t\tdefault:\n\t\t\tfulled = true\n\t\t\tc.Status(http.StatusBadGateway)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "13534c7977e58f726f30ba5cd6e4cadb", "score": "0.5327483", "text": "func (lim *Limiter) AllowN(now time.Time, n int) bool {\n\treturn lim.reserveN(now, n, 0).ok\n}", "title": "" }, { "docid": "d97f069e3ce6b4942e81b4da32fcab45", "score": "0.53247887", "text": "func (ts *TokenService) RateLimit(userID int, tt TokenType) error {\n\ttokens, err := ts.Datasource.ListByUser(userID, tt)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tnow := time.Now()\n\n\tvar rate []Token\n\tfor _, t := range tokens {\n\t\tif now.Sub(t.RequestedAt) < time.Minute*15 {\n\t\t\trate = append(rate, t)\n\t\t}\n\t}\n\n\tif len(rate) > 3 {\n\t\treturn fmt.Errorf(\"too many tokens of type %s were requested for user %d, not sending mail\", tt, userID)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d350539d5fc004703e72b96a8a64ccdd", "score": "0.53235155", "text": "func RateLimit(lmt *limiter.Limiter) func(next http.Handler) http.Handler {\n\treturn func(next http.Handler) http.Handler {\n\t\tmiddle := func(w http.ResponseWriter, r *http.Request) {\n\t\t\thttpError := tollbooth.LimitByRequest(lmt, w, r)\n\t\t\tif httpError != nil {\n\t\t\t\tlmt.ExecOnLimitReached(w, r)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tnext.ServeHTTP(w, r)\n\t\t}\n\n\t\treturn http.HandlerFunc(middle)\n\t}\n}", "title": "" }, { "docid": "1487ae55e558c98385925edf1e5f72a2", "score": "0.5316019", "text": "func TestConnMeterMaxConnsMet(t *testing.T) {\n\tmeter := NewConnMeter(time.Hour, 1, 3)\n\tfor i := 0; i < 3; i++ {\n\t\tallow := meter.Allow(host1)\n\t\tassert.True(t, allow)\n\t}\n\tallow := meter.Allow(host1)\n\tassert.False(t, allow)\n}", "title": "" }, { "docid": "4b1d0e53db245d02675a74e35f3e56b0", "score": "0.5314547", "text": "func (rateLimiter AbstractRateLimiter) apply() echo.MiddlewareFunc {\n return func(next echo.HandlerFunc) echo.HandlerFunc {\n return func(c echo.Context) error {\n // c.Path() contains the relative URL of the API(without queryparams) which also contains the AUTHID\n key := c.Path()\n if rateLimiter.useIP {\n ip := c.RealIP()\n key += \":\" + ip\n }\n if rateLimiter.hasLimitExceeded(key) {\n return c.JSON(http.StatusTooManyRequests, RateLimitResponse{Message: \"Too many requests\"})\n }\n return next(c)\n }\n }\n}", "title": "" }, { "docid": "f1962b1b1baaa48954e06ef77a45a89d", "score": "0.5308455", "text": "func (r *RateLimiter) RateLimit(next echo.HandlerFunc) echo.HandlerFunc {\n\treturn func(c echo.Context) error {\n\t\t// First check the header for the existence of the Trumail Token\n\t\tif r.token != \"\" {\n\t\t\tif c.Request().Header.Get(AuthToken) == r.token {\n\t\t\t\treturn next(c)\n\t\t\t}\n\t\t}\n\n\t\t// Allocate the users IP and ReqData\n\t\tip := realIP(c)\n\t\trd := r.reqData(ip)\n\n\t\t// Whether the ReqData is expired\n\t\tvalid := rd.start.After(time.Now().Add(-1 * r.interval))\n\n\t\t// If the valid count for this timeframe exceeds the max\n\t\tif valid && rd.count >= r.max {\n\t\t\treturn ErrRateLimitExceeded\n\t\t}\n\n\t\t// If the IPMeta is invalid (expired), store a new one\n\t\tif !valid {\n\t\t\tr.ipMap.Store(ip, NewReqData())\n\t\t}\n\n\t\t// Count a new request and return\n\t\trd.Count()\n\t\treturn next(c)\n\t}\n}", "title": "" }, { "docid": "e8eb4a895e8e945da1dc766ebe539ce6", "score": "0.5306159", "text": "func (recv *FileMonitor) SetRateLimit(limitMsecs int32) {\n\tc_limit_msecs := (C.gint)(limitMsecs)\n\n\tC.g_file_monitor_set_rate_limit((*C.GFileMonitor)(recv.native), c_limit_msecs)\n\n\treturn\n}", "title": "" }, { "docid": "b61ebb8f15c8bc82a43bd203a6324298", "score": "0.52998257", "text": "func (params *Params) adjustRlimit() (err error) {\n\tvar rLimit syscall.Rlimit\n\tvar rLimitTarget uint64\n\n\terr = syscall.Getrlimit(syscall.RLIMIT_NOFILE, &rLimit)\n\tif err != nil {\n\t\tError.Println(\"Error Getting Rlimit \", err)\n\t\terr = fmt.Errorf(\"Unable to get Rlimit: Not able to guarentee throttle performance\")\n\t\treturn\n\t}\n\tInfo.Printf(\"Initial Rlimit.Cur: %d\\n\", rLimit.Cur)\n\tInfo.Printf(\"Initial Rlimit.Max: %d\\n\", rLimit.Max)\n\n\t// Precalculate target values\n\tthrottleHeadroom := float64(params.throttle) * 1.25\n\n\tswitch {\n\t// current rLimit less than desired, but maximum will allow it\n\tcase throttleHeadroom > float64(rLimit.Cur) && throttleHeadroom < float64(rLimit.Max):\n\t\trLimitTarget = uint64(float64(rLimit.Cur) * 1.25)\n\n\t// current limit less than desired, and maximum too low to adjust -\n\t// set rlimit target equal to maximum, throttle will get haircut later\n\tcase throttleHeadroom > float64(rLimit.Cur) && throttleHeadroom > float64(rLimit.Max):\n\t\trLimitTarget = rLimit.Max\n\n\t// target Rlimit is below current Rlimit, return without any adjustments\n\tcase throttleHeadroom < float64(rLimit.Cur):\n\t\treturn\n\n\t}\n\n\trLimitPrevious := rLimit.Cur\n\trLimit.Cur = rLimitTarget\n\n\terr = syscall.Setrlimit(syscall.RLIMIT_NOFILE, &rLimit)\n\tif err != nil {\n\t\tInfo.Println(\"Error Setting Rlimit \", err)\n\t\t// Set throttle to 80% of existing RLimit\n\t\tparams.throttle = int(float64(rLimitPrevious) * 0.8)\n\t\terr = nil\n\t}\n\n\tInfo.Printf(\"Adjusted Rlimit.Cur: %d\\n\", rLimit.Cur)\n\tInfo.Printf(\"Adjusted Rlimit.Max: %d\\n\", rLimit.Max)\n\tInfo.Printf(\"Adjusted throttle: %d\\n\", params.throttle)\n\n\terr = syscall.Getrlimit(syscall.RLIMIT_NOFILE, &rLimit)\n\tif err != nil {\n\t\tError.Println(\"Error Getting Rlimit \", err)\n\t\terr = nil\n\t}\n\n\tif throttleHeadroom > float64(rLimit.Cur) {\n\t\t// Adjust throttle down to 80% of adjusted rLimit\n\t\tparams.throttle = int(float64(rLimit.Cur) * 0.8)\n\t\tInfo.Printf(\"Adjusting throttle to %d due to Rlimit ceiling %d\", params.throttle, rLimit.Cur)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "b673e0682c3a4232bd950d27fb230b94", "score": "0.52979743", "text": "func HostRatelimitRequest(host string) {\n\t_hostRatelimit.Inc(host)\n}", "title": "" }, { "docid": "a937ae2f59728ba2b4a3d6fc00a69d8e", "score": "0.5297554", "text": "func IPRateLimit() echo.MiddlewareFunc {\n\treturn IPRateLimitWithConfig(100, 20)\n}", "title": "" }, { "docid": "c0fb335367210c354a869934d75dcb36", "score": "0.52968866", "text": "func newRateLimiterMiddleware(maxRatePerMinute int) iris.Handler {\n\tstore, err := memstore.New(65536)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tquota := throttled.RateQuota{\n\t\tMaxRate: throttled.PerMin(maxRatePerMinute),\n\t\tMaxBurst: 5,\n\t}\n\n\trateLimiter, err := throttled.NewGCRARateLimiter(store, quota)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\thttpRateLimiter := throttler.RateLimiter{\n\t\tRateLimiter: rateLimiter,\n\t\tVaryBy: &throttled.VaryBy{Path: true},\n\t}\n\n\treturn httpRateLimiter.RateLimit\n}", "title": "" }, { "docid": "f239f8e959c57b0f7e7172d01e6ee775", "score": "0.5292918", "text": "func (p *SingleProducer) SetRateLimit(limitPerSecond int) {\n\tp.rateLimiter = &RateLimiter{\n\t\tStartTime: time.Now(),\n\t\tLimitPerSecond: int64(limitPerSecond),\n\t}\n}", "title": "" }, { "docid": "b9a30d6cd3cca0554657a4a9568262b5", "score": "0.52926815", "text": "func (tsv *TabletServer) SetPoolSize(val int) {\n\tif val <= 0 {\n\t\treturn\n\t}\n\ttsv.qe.conns.SetCapacity(val)\n}", "title": "" }, { "docid": "8064b89a56f024c97f5b3e763eda397e", "score": "0.52876776", "text": "func (r *RingBufferRateLimiter) Allow() bool {\n\tselect {\n\tcase <-r.ticket:\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "457a6c590fa1165f4e170a1489c1a02f", "score": "0.52857244", "text": "func (sw *SlidingWindow) Allow(n int64) bool {\n\tif sw.Limiter.AllowN(time.Now(), n) {\n\t\treturn true\n\t}\n\tif sw.blockingReaders != nil {\n\t\tsw.blockingReaders.Inc()\n\t}\n\treturn false\n}", "title": "" }, { "docid": "2b3557518de46c6aae3dd7edc0eb2294", "score": "0.5265029", "text": "func addTxRateLimiter(endpoint Endpoint, maxRate uint64) error {\n\tvar netPair *NetworkInterfacePair\n\tvar linkName string\n\tswitch ep := endpoint.(type) {\n\tcase *VethEndpoint, *IPVlanEndpoint, *TuntapEndpoint, *MacvlanEndpoint:\n\t\tnetPair = endpoint.NetworkPair()\n\t\tswitch netPair.NetInterworkingModel {\n\t\t// For those endpoints we've already used tcfilter as their inter-networking model,\n\t\t// another ifb redirect will be redundant and confused.\n\t\tcase NetXConnectTCFilterModel:\n\t\t\tlinkName = netPair.VirtIface.Name\n\t\t\tlink, err := netlink.LinkByName(linkName)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn addHTBQdisc(link.Attrs().Index, maxRate)\n\t\tcase NetXConnectMacVtapModel, NetXConnectNoneModel:\n\t\t\tlinkName = netPair.TapInterface.TAPIface.Name\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"Unsupported inter-networking model %v for adding tx rate limiter\", netPair.NetInterworkingModel)\n\t\t}\n\n\tcase *MacvtapEndpoint, *TapEndpoint:\n\t\tlinkName = endpoint.Name()\n\tdefault:\n\t\treturn fmt.Errorf(\"Unsupported endpointType %s for adding tx rate limiter\", ep.Type())\n\t}\n\n\tif err := endpoint.SetTxRateLimiter(); err != nil {\n\t\treturn err\n\t}\n\n\tifbIndex, err := addIFBDevice()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlink, err := netlink.LinkByName(linkName)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := addIFBRedirecting(link.Attrs().Index, ifbIndex); err != nil {\n\t\treturn err\n\t}\n\n\treturn addHTBQdisc(ifbIndex, maxRate)\n}", "title": "" }, { "docid": "54a20e0a2b59eb79685ee276bcc22743", "score": "0.5256499", "text": "func (q *PiggybackBuffer) transmitLimit() float64 {\n\tnodeNum := q.NodeSize()\n\tnodeScale := math.Log2(float64(nodeNum))\n\treturn q.transmitLam * nodeScale\n}", "title": "" }, { "docid": "e06044cedaa32bf3ff0c2952e3e2bcb6", "score": "0.52492505", "text": "func (q *Queue) throttle() {\n\tq.tickermu.Lock()\n\t<-q.ticker.C\n\tq.tickermu.Unlock()\n}", "title": "" }, { "docid": "cef4f00a8a9996730fcf150bcfa5fa59", "score": "0.5232091", "text": "func Limited(ctx context.Context, limit RateLimit, action func() error) func() error {\n\treturn func() error {\n\t\tif err := EnforceLimit(ctx, limit); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn action()\n\t}\n}", "title": "" }, { "docid": "5132ed133acb39888e37c1f9a2dd370c", "score": "0.5230921", "text": "func TestWriteLoadTransferFastNoConstraintServer(t *testing.T) {\n\tnbWorker := 30\n\tpool := NewIOThrottlerPool(10240*1024, 1024*1024)\n\tvar wg sync.WaitGroup\n\tdata := make([]byte, 1024*1024)\n\trand.Read(data)\n\ttransfer := func(wg *sync.WaitGroup, i int) {\n\t\tdefer wg.Done()\n\t\tr, w := io.Pipe()\n\t\ttw := pool.NewThrottledWriteCloser(w, 1024*1024, 1024*1024, fmt.Sprintf(\"%d\", i))\n\t\tassertNotNil(tw, t)\n\t\telapsedSeconds, err := timeTransfer(data, r, tw)\n\t\t// we should finish in a tenth as the top level has 10x bandwith\n\t\tif elapsedSeconds > int64(nbWorker/10) {\n\t\t\tt.Fatalf(\"Expecting read to take %v seconds but it took %v instead\", nbWorker/10, elapsedSeconds)\n\t\t}\n\t\tassertNil(err, t)\n\t}\n\n\tfor i := 0; i < nbWorker; i++ {\n\t\twg.Add(1)\n\t\tgo transfer(&wg, i)\n\t}\n\twg.Wait()\n}", "title": "" }, { "docid": "b98f5fa62fa6975af2e7042a861e0600", "score": "0.5229276", "text": "func (t *Throttler) throttle(instructions *ProxyInstructions) (upstreamStats []*UpstreamStats, retrySeconds int, err error) {\n\tretrySeconds, err = t.throttleTokens(instructions.Tokens)\n\tif err != nil || retrySeconds > 0 {\n\t\treturn nil, retrySeconds, err\n\t}\n\treturn t.throttleUpstreams(instructions.Upstreams)\n}", "title": "" }, { "docid": "bd271123ec03b94302e4a08af5c51021", "score": "0.52263623", "text": "func limiterSystemHandler(reqSec int) func(next http.Handler) http.Handler {\n\tif reqSec <= 0 {\n\t\treturn passThroughHandler\n\t}\n\treturn func(h http.Handler) http.Handler {\n\t\tlmt := tollbooth.NewLimiter(float64(reqSec), nil)\n\t\tfn := func(w http.ResponseWriter, r *http.Request) {\n\t\t\tif httpError := tollbooth.LimitByKeys(lmt, []string{\"system\"}); httpError != nil {\n\t\t\t\thttp.Error(w, http.StatusText(http.StatusTooManyRequests), http.StatusTooManyRequests)\n\t\t\t\treturn\n\t\t\t}\n\t\t\th.ServeHTTP(w, r)\n\t\t}\n\t\treturn http.HandlerFunc(fn)\n\t}\n}", "title": "" }, { "docid": "14b3b81fab8ba0fc4989aae3eaa0c506", "score": "0.5225095", "text": "func (ipr *ipRate) RemoveLimit() {\n\tif !noop {\n\t\tipr.RLock()\n\t\tfor service, _ := range aclByService {\n\t\t\tif ipr.limitedOnService[service.ID] {\n\t\t\t\tmsg := limitMessage{service: service, ipRate: ipr, operation: fastly.BatchOperationDelete}\n\t\t\t\tlimitCh <- &msg\n\t\t\t}\n\t\t}\n\t\tipr.RUnlock()\n\t} else {\n\t\tipr.Lock()\n\t\tlogger.Printf(\"NOOP: Would remove all limits for IP %s.\\n\", ipr.ip.String())\n\t\tipr.limited = false\n\t\tipr.Unlock()\n\t}\n\n}", "title": "" }, { "docid": "ea6cdcc4bd351d7b89ebaf300444e032", "score": "0.5202857", "text": "func Throttle(r sdr.Reader) (sdr.Reader, error) {\n\treturn ThrottleSecondsPerSecond(r, time.Second)\n}", "title": "" }, { "docid": "94e60a6f4734defddfcc5763b7fd3a80", "score": "0.51960504", "text": "func AutoNATServiceRateLimit(global, perPeer int, interval time.Duration) Option {\n\treturn func(cfg *Config) error {\n\t\tcfg.AutoNATConfig.ThrottleGlobalLimit = global\n\t\tcfg.AutoNATConfig.ThrottlePeerLimit = perPeer\n\t\tcfg.AutoNATConfig.ThrottleInterval = interval\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "b12226e37a8303db71cb7bd592522501", "score": "0.51882917", "text": "func (self *RoundRobin) SetCapacity(capacity int) {\n\tself.mu.Lock()\n\tdefer self.mu.Unlock()\n\tnr := make(chan fifoWrapper, capacity)\n\tfor {\n\t\tselect {\n\t\tcase fw := <-self.resources:\n\t\t\tif len(nr) < cap(nr) {\n\t\t\t\tnr <- fw\n\t\t\t} else {\n\t\t\t\tgo fw.resource.Close()\n\t\t\t\tatomic.AddInt64(&self.size, -1)\n\t\t\t}\n\t\t\tcontinue\n\t\tdefault:\n\t\t}\n\t\tbreak\n\t}\n\tself.resources = nr\n}", "title": "" }, { "docid": "5fffc894c1306b1f173cc78933c8227e", "score": "0.5185382", "text": "func (d DefaultRetryer) shouldThrottle(r *request.Request) bool {\n\tswitch r.HTTPResponse.StatusCode {\n\tcase 429:\n\tcase 502:\n\tcase 503:\n\tcase 504:\n\tdefault:\n\t\treturn r.IsErrorThrottle()\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "95633b7c8d891fe7dc357a20d3af8d48", "score": "0.5184716", "text": "func WrapRateLimiting(\n\tclient EthereumClient,\n\tconfig *RateLimiterConfig,\n) EthereumClient {\n\trateLimiter := &rateLimiter{EthereumClient: client}\n\n\tif config.RequestsPerSecondLimit > 0 {\n\t\trateLimiter.limiter = rate.NewLimiter(\n\t\t\trate.Limit(config.RequestsPerSecondLimit),\n\t\t\t1,\n\t\t)\n\t}\n\n\tif config.ConcurrencyLimit > 0 {\n\t\trateLimiter.semaphore = semaphore.NewWeighted(\n\t\t\tint64(config.ConcurrencyLimit),\n\t\t)\n\t}\n\n\tif config.AcquirePermitTimeout > 0 {\n\t\trateLimiter.acquirePermitTimeout = config.AcquirePermitTimeout\n\t} else {\n\t\trateLimiter.acquirePermitTimeout = 5 * time.Minute\n\t}\n\n\treturn rateLimiter\n}", "title": "" }, { "docid": "4f61ea775c42e4eb6e8a805ec0a885ba", "score": "0.51846737", "text": "func (limiter *RateLimiter) Allow(ctx context.Context) bool{\n\treturn limiter.AllowN(ctx, 1)\n}", "title": "" }, { "docid": "efdf81deb846b8c86725e12482ec6192", "score": "0.5183791", "text": "func EnforceLimit(ctx context.Context, limit RateLimit) error {\n\tif LoadBool(limit.blocked) {\n\t\treturn ErrRateLimited\n\t}\n\n\tStoreBool(limit.blocked, true)\n\tgo func() {\n\t\tselect {\n\t\tcase <-time.After(limit.wait):\n\t\tcase <-ctx.Done():\n\t\t}\n\n\t\tStoreBool(limit.blocked, false)\n\t}()\n\n\treturn nil\n}", "title": "" }, { "docid": "ae18c9ca05ce7b4132e22b5758f49b3c", "score": "0.5176066", "text": "func testBytesReadLimitOn(t *testing.T, connector timeoutConnector) error {\n\tfor i := 0; i < 10; i++ {\n\t\tif err := runBytesReadLimitTrial(t, connector, i, readLimitTestConfig.runSingleSend); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tfor i := 0; i < 10; i++ {\n\t\tif err := runBytesReadLimitTrial(t, connector, i, readLimitTestConfig.runMultiSend); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e446d94348a167f7ebaafe02516ac0f8", "score": "0.5169763", "text": "func NewLimiter(max float64) *Limiter {\n\treturn &Limiter{tollbooth.NewLimiter(max, nil)}\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": "941106eff1851209f992c618d6d89124", "score": "0.0", "text": "func (s RepositoryCatalogData) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" } ]
[ { "docid": "b4630d33b70c5844b5e64ade660963a3", "score": "0.65443325", "text": "func (s Member) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b4630d33b70c5844b5e64ade660963a3", "score": "0.65443325", "text": "func (s Member) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "737ca0695297a4f2e748bd8273aaa1b3", "score": "0.65086895", "text": "func (m Member) String() string {\n\tif m.Tenant == \"\" {\n\t\treturn fmt.Sprintf(\"%s=%s\", m.Vendor, m.Value)\n\t}\n\treturn fmt.Sprintf(\"%s@%s=%s\", m.Vendor, m.Tenant, m.Value)\n}", "title": "" }, { "docid": "05b3c2849c763a5cf57fe24b8c1fb11f", "score": "0.65062344", "text": "func (m ClanMember) String() string {\n\tb, _ := json.Marshal(m)\n\treturn string(b)\n}", "title": "" }, { "docid": "d8b0d4b5eacabdfc6d7b3d1ef25353bc", "score": "0.6436401", "text": "func (p *Param) String() string {\n\treturn fmt.Sprintf(\"%v: %v\", p.Key, p.Value)\n}", "title": "" }, { "docid": "b1d6b5994a29dcc33e36e994f65e26fb", "score": "0.6420408", "text": "func (s EnvironmentMember) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b1d6b5994a29dcc33e36e994f65e26fb", "score": "0.6420408", "text": "func (s EnvironmentMember) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "abcd252868fef9e7177d58d3ffbbeadc", "score": "0.63326764", "text": "func (s RecognizedBotMember) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "57f46979e981700a8b820881ba23206e", "score": "0.6297761", "text": "func (p Params) String() string {\n\treturn fmt.Sprintf(`\nCreators: %s\nFee: %d\nCardMagic: %d\n`, p.Creators, p.Fee, p.CardMagic)\n}", "title": "" }, { "docid": "f93b044ea366a4343adb8b50f816dd24", "score": "0.6211278", "text": "func (p Params) String() string {\n\treturn fmt.Sprintf(`Params:\n Quote Symbol:\t\t\t\t\t\t\t\t%s\n Create Pool Fee:\t\t\t\t\t\t\t%s\n Create Pool Deposit:\t\t\t\t\t\t%s\n Yield Native Token Enabled: %v`,\n\t\tp.QuoteSymbol, p.CreatePoolFee, p.CreatePoolDeposit, p.YieldNativeToken)\n}", "title": "" }, { "docid": "40ddcb2b53a3008c8e60b9d187783623", "score": "0.6137413", "text": "func (a APIMethod) String() string {\n\treturn apiMethodToString[a]\n}", "title": "" }, { "docid": "44b6ad6d7b1a2e5e0ec0e4b06b304957", "score": "0.6130453", "text": "func (m *Metric) String() string {\n\t// Begin building parts, expected capacity is length of extra\n\t// fields plus id, desc, dur.\n\tparts := make([]string, 1, len(m.Extra)+3)\n\tparts[0] = m.Name\n\n\t// Description\n\tif _, ok := m.Extra[paramNameDesc]; !ok && m.Desc != \"\" {\n\t\tparts = append(parts, headerEncodeParam(paramNameDesc, m.Desc))\n\t}\n\n\t// Duration\n\tif _, ok := m.Extra[paramNameDur]; !ok && m.Duration > 0 {\n\t\tparts = append(parts, headerEncodeParam(\n\t\t\tparamNameDur,\n\t\t\tstrconv.FormatFloat(float64(m.Duration)/float64(time.Millisecond), 'f', -1, 64),\n\t\t))\n\t}\n\n\t// All remaining extra params\n\tfor k, v := range m.Extra {\n\t\tparts = append(parts, headerEncodeParam(k, v))\n\t}\n\n\treturn strings.Join(parts, \";\")\n}", "title": "" }, { "docid": "f4f4ede478f981b3cfcc4b05c0adc5fa", "score": "0.6103621", "text": "func (s CacheNodeTypeSpecificParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "34b843331ddc750ac67f8fdf0f2857af", "score": "0.6097294", "text": "func (p Parameter) String() string {\n\ts := p.name + \" \" + p.typeName\n\n\treturn strings.TrimSpace(s)\n}", "title": "" }, { "docid": "ecdd9b7b6ea91c2fccfbeb10aaf1ed24", "score": "0.60768765", "text": "func (p Params) String() string {\n\treturn fmt.Sprintf(`Params:\n Unbonding Time: %s\n Max Validators: %d\n Max Entries: %d\n Historical Entries: %d\n Bonded Coin Denom: %s\n MinSelfDelegation: %s`, p.UnbondingTime,\n\t\tp.MaxValidators, p.MaxEntries, p.HistoricalEntries, p.BondDenom, p.MinSelfDelegation)\n}", "title": "" }, { "docid": "85ce395912b475acdf3ad6330161a646", "score": "0.6035306", "text": "func (s ParameterNameValue) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "85ce395912b475acdf3ad6330161a646", "score": "0.6035306", "text": "func (s ParameterNameValue) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "85ce395912b475acdf3ad6330161a646", "score": "0.6035306", "text": "func (s ParameterNameValue) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "49a30d79adad11d67f12f5ce090d9f35", "score": "0.6021694", "text": "func (a AxisMatcher) String() string {\n\treturn fmt.Sprintf(\"%s:%s\", a.Name, a.Value)\n}", "title": "" }, { "docid": "fa3439ba8da6a08bf8c1fe78ff45e9d8", "score": "0.6004918", "text": "func (s NodeGroupMember) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "540636a34adb1a7967a6f8d5aa0c8445", "score": "0.5985108", "text": "func (s UpdateParam) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "460e528051349cd782a432f7823df86a", "score": "0.59219694", "text": "func (o NvmeInitializeAnagrpidsRequest) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "3ffc25a4edc5ca7652c4750de89130eb", "score": "0.58789814", "text": "func (s Parameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3ffc25a4edc5ca7652c4750de89130eb", "score": "0.58789814", "text": "func (s Parameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3ffc25a4edc5ca7652c4750de89130eb", "score": "0.58789814", "text": "func (s Parameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3ffc25a4edc5ca7652c4750de89130eb", "score": "0.58789814", "text": "func (s Parameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3ffc25a4edc5ca7652c4750de89130eb", "score": "0.58789814", "text": "func (s Parameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3815b87970f5ed84eedf754a2150de2c", "score": "0.586802", "text": "func (s MethodSetting) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "2b7066a68e2e5b2f33ad98261c5d38a0", "score": "0.58631635", "text": "func (s *Secret) String() string {\n\treturn fmt.Sprintf(`{\n\tAllowCommand: %t,\n\tEvents: %s,\n\tID: %d,\n\tImages: %s,\n\tName: %s,\n\tOrg: %s,\n\tRepo: %s,\n\tTeam: %s,\n\tType: %s,\n\tValue: %s,\n\tCreatedAt: %d,\n\tCreatedBy: %s,\n\tUpdatedAt: %d,\n\tUpdatedBy: %s,\n}`,\n\t\ts.GetAllowCommand(),\n\t\ts.GetEvents(),\n\t\ts.GetID(),\n\t\ts.GetImages(),\n\t\ts.GetName(),\n\t\ts.GetOrg(),\n\t\ts.GetRepo(),\n\t\ts.GetTeam(),\n\t\ts.GetType(),\n\t\ts.GetValue(),\n\t\ts.GetCreatedAt(),\n\t\ts.GetCreatedBy(),\n\t\ts.GetUpdatedAt(),\n\t\ts.GetUpdatedBy(),\n\t)\n}", "title": "" }, { "docid": "c4239ae0ffea6c331014e098e3bae887", "score": "0.585955", "text": "func (p Params) String() string {\n\tvar sb strings.Builder\n\tsb.WriteString(\"Params: \\n\")\n\tsb.WriteString(fmt.Sprintf(\"FeeIssue: %s\\n\", p.FeeIssue))\n\tsb.WriteString(fmt.Sprintf(\"FeeMint: %s\\n\", p.FeeMint))\n\tsb.WriteString(fmt.Sprintf(\"FeeBurn: %s\\n\", p.FeeBurn))\n\tsb.WriteString(fmt.Sprintf(\"FeeModify: %s\\n\", p.FeeModify))\n\tsb.WriteString(fmt.Sprintf(\"FeeChown: %s\\n\", p.FeeChown))\n\n\treturn sb.String()\n}", "title": "" }, { "docid": "62a17c2597b5192240ada237775a47ee", "score": "0.5838582", "text": "func (p Params) String() string {\n\tvar sb strings.Builder\n\tsb.WriteString(\"Params:\")\n\tsb.WriteString(fmt.Sprintf(\"BannedUsers:%s\\t\", strings.Join(p.BannedUsers, \",\")))\n\n\treturn sb.String()\n}", "title": "" }, { "docid": "c1488e041b84c64951a3d02657269a7b", "score": "0.5837121", "text": "func String(v interface{}) (string, error) {\n\tfields, err := extractFields(nil, v)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tvar s strings.Builder\n\tfor i, field := range fields {\n\t\tif !field.options.noprint {\n\t\t\ts.WriteString(field.envName)\n\t\t\ts.WriteString(\"=\")\n\t\t\ts.WriteString(fmt.Sprintf(\"%v\", field.field.Interface()))\n\t\t\tif i < len(fields)-1 {\n\t\t\t\ts.WriteString(\" \")\n\t\t\t}\n\t\t}\n\t}\n\treturn s.String(), nil\n}", "title": "" }, { "docid": "3779b36a650263d959f0a7c2fc303a46", "score": "0.5833375", "text": "func (p Parameters) String() string {\n\truleList := make([]string, 0, len(p.ChannelRules)+len(p.PeerRules))\n\n\tfor channel, rule := range p.ChannelRules {\n\t\truleList = append(\n\t\t\truleList, fmt.Sprintf(\"Channel: %v: %v\", channel, rule),\n\t\t)\n\t}\n\n\tfor peer, rule := range p.PeerRules {\n\t\truleList = append(\n\t\t\truleList, fmt.Sprintf(\"Peer: %v: %v\", peer, rule),\n\t\t)\n\n\t}\n\n\treturn fmt.Sprintf(\"rules: %v, failure backoff: %v, sweep \"+\n\t\t\"sweep conf target: %v, fees: %v, auto budget: %v, budget \"+\n\t\t\"start: %v, max auto in flight: %v, minimum swap size=%v, \"+\n\t\t\"maximum swap size=%v\", strings.Join(ruleList, \",\"),\n\t\tp.FailureBackOff, p.SweepConfTarget, p.FeeLimit,\n\t\tp.AutoFeeBudget, p.AutoFeeStartDate, p.MaxAutoInFlight,\n\t\tp.ClientRestrictions.Minimum, p.ClientRestrictions.Maximum)\n}", "title": "" }, { "docid": "11c90d6ee574cda9903fc75bee8832a0", "score": "0.5796527", "text": "func (s DBClusterMember) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "ab429420bcc0e75dcb7ca22c09e73967", "score": "0.57778466", "text": "func (s IdentityProviderDetails) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "ab429420bcc0e75dcb7ca22c09e73967", "score": "0.57778466", "text": "func (s IdentityProviderDetails) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "7fa9ae680372df047f172b65f4ed06b4", "score": "0.57527614", "text": "func (s ApiKey) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "046c946d306e2456522c3d724521219d", "score": "0.57500225", "text": "func (o IscsiInitiatorModifyChapParamsRequest) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "1137b4cc55252b3a23e1d088e3c4c11b", "score": "0.573272", "text": "func (p Params) String() string {\n\tvalue, err := json.Marshal(p)\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\treturn string(value)\n}", "title": "" }, { "docid": "c8935f3f25f4152149de71be476d1061", "score": "0.5730272", "text": "func (wf *WithFields) String() string {\n\tvar builder strings.Builder\n\tbuilder.WriteString(\"WithFields(\")\n\tbuilder.WriteString(fmt.Sprintf(\"id=%v\", wf.ID))\n\tbuilder.WriteString(\", existing=\")\n\tbuilder.WriteString(wf.Existing)\n\tbuilder.WriteByte(')')\n\treturn builder.String()\n}", "title": "" }, { "docid": "bfa8ba9f54f2304e03bb38fa28e47412", "score": "0.5729662", "text": "func (p Params) String() string {\n\treturn fmt.Sprintf(`Order Params:\n OrderExpireBlocks: %d\n MaxDealsPerBlock: %d\n FeePerBlock: %s\n TradeFeeRate: %s\n NewOrderMsgGasUnit: %d\n CancelOrderMsgGasUnit: %d`, p.OrderExpireBlocks,\n\t\tp.MaxDealsPerBlock, p.FeePerBlock,\n\t\tp.TradeFeeRate, p.NewOrderMsgGasUnit, p.CancelOrderMsgGasUnit)\n}", "title": "" }, { "docid": "fdcb7c512f5a3219c5207b118956b76b", "score": "0.571792", "text": "func (s AccessLevelFilter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "1609367b5a06d444cb6167c27913e7a9", "score": "0.57112074", "text": "func (p *KVParamInst) String() (string, error) {\n\tif !p.found && p.param.required {\n\t\treturn \"\", RequiredParamNotFound{p.param}\n\t}\n\n\treturn p.value, nil\n}", "title": "" }, { "docid": "d7df7519816a565be014dd5da39cc3f1", "score": "0.56993", "text": "func (s Provider) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "5e2a592f021fbec659f657bd341972b0", "score": "0.5683324", "text": "func (p *Profile) String() string {\n\ts := \"\"\n\tif p.transitional {\n\t\ts = \"Transitional\"\n\t} else {\n\t\ts = \"NonTransitional\"\n\t}\n\tif p.useSTD3Rules {\n\t\ts += \":UseSTD3Rules\"\n\t}\n\tif p.checkHyphens {\n\t\ts += \":CheckHyphens\"\n\t}\n\tif p.checkJoiners {\n\t\ts += \":CheckJoiners\"\n\t}\n\tif p.verifyDNSLength {\n\t\ts += \":VerifyDNSLength\"\n\t}\n\treturn s\n}", "title": "" }, { "docid": "62132f69fac5eea623282741c0a0cce3", "score": "0.5681493", "text": "func (c Params) String() string {\n\tdefer FuncEnding(FuncStarting())\n\tnameFmt := \"%10s: \"\n\tlines := []string{\n\t\tfmt.Sprintf(nameFmt+\"%t\", \"Debug\", debug),\n\t\tfmt.Sprintf(nameFmt+\"%t\", \"Verbose\", c.Verbose),\n\t\tfmt.Sprintf(nameFmt+\"%d\", \"Errors\", len(c.Errors)),\n\t\tfmt.Sprintf(nameFmt+\"%d\", \"Count\", c.Count),\n\t\tfmt.Sprintf(nameFmt+\"%s\", \"Input File\", c.InputFile),\n\t\tfmt.Sprintf(nameFmt+\"%d lines\", \"Input\", len(c.Input)),\n\t\tfmt.Sprintf(nameFmt+\"%d lines\", \"Custom\", len(c.Custom)),\n\t}\n\tif len(c.Errors) > 0 {\n\t\tlines = append(lines, fmt.Sprintf(\"Errors (%d):\", len(c.Errors)))\n\t\terrors := make([]string, len(c.Errors))\n\t\tfor i, err := range c.Errors {\n\t\t\terrors[i] = err.Error()\n\t\t}\n\t\tlines = append(lines, AddLineNumbers(errors, 1)...)\n\t}\n\tif len(c.Input) > 0 {\n\t\tlines = append(lines, fmt.Sprintf(\"Input (%d):\", len(c.Input)))\n\t\tlines = append(lines, AddLineNumbers(c.Input, 0)...)\n\t}\n\tif len(c.Custom) > 0 {\n\t\tlines = append(lines, fmt.Sprintf(\"Custom Input (%d):\", len(c.Custom)))\n\t\tlines = append(lines, AddLineNumbers(c.Custom, 0)...)\n\t}\n\treturn strings.Join(lines, \"\\n\")\n}", "title": "" }, { "docid": "09b6703358d5028baa3775665603a54e", "score": "0.56727076", "text": "func (s JSONMappingParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "62ee10d923b49807859b3bd764f81e15", "score": "0.56706274", "text": "func (s ParameterObject) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "2736e9c185cf23f0a2889d65ab40d3d6", "score": "0.56637627", "text": "func (p KeyValuePair) String() string {\n\tvar f Marshaller = JSONMarshaller{}\n\tif p.marshaller != nil {\n\t\tf = p.marshaller\n\t}\n\n\tbytes, err := f.Marshal(p)\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\treturn string(bytes)\n}", "title": "" }, { "docid": "130dfe5d20bbe494c79830b2110be3ce", "score": "0.5661205", "text": "func (p Params) String() string {\n\treturn \"\"\n}", "title": "" }, { "docid": "000758bf24d880efe842136c39ff3318", "score": "0.56570405", "text": "func (tp *TemplateParams) String() string {\n\treturn strings.Join(tp.flags, \", \")\n}", "title": "" }, { "docid": "9471d87b873d60145f719336066d46b1", "score": "0.5649532", "text": "func (t ParamType) String() string {\n\treturn string(t)\n}", "title": "" }, { "docid": "e4fcd4a95386dc56bb8f1eef3526f20c", "score": "0.5646455", "text": "func (s VgwTelemetry) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "e9d8bad1d9f49792b9478567f90f5c16", "score": "0.56380785", "text": "func (*providerImpl) String() string {\n\treturn \"<Magma EAP-AKA Method Provider>\"\n}", "title": "" }, { "docid": "6e5b320dd95669bf151e7cd1556e77bf", "score": "0.5631104", "text": "func (s UsagePlanKey) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "10df0a2d459108485b7e1ca635abea53", "score": "0.562771", "text": "func (s Stats) String() string {\n\treturn fmt.Sprintf(\n\t\t\"ID: %s\\n\"+\n\t\t\t\"Name: %s\\n\"+\n\t\t\t\"RateLimit: %d\\n\"+\n\t\t\t\"RateLimitRemaining: %d\\n\"+\n\t\t\t\"RateLimitReset: %v\",\n\t\ts.id, s.name, s.RateLimit, s.RateLimitRemaining, s.RateLimitReset,\n\t)\n}", "title": "" }, { "docid": "c491613a0dbf57cdf045506b6be0cb1f", "score": "0.5621938", "text": "func (s RestApi) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "a2809403ae1c50b54893bb2151e19ccb", "score": "0.56185454", "text": "func (s UserInfo) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "a2809403ae1c50b54893bb2151e19ccb", "score": "0.56185454", "text": "func (s UserInfo) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "35d1ed8f5b690bca5dc258e6fd866b5e", "score": "0.5617507", "text": "func (s UpdateAbpV11) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "5822e5f7003d721ec0bd20e96b0a0e21", "score": "0.56124943", "text": "func (s ParameterAttribute) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "e2aeede4448d5bea597fd735211d0834", "score": "0.5607012", "text": "func (o QuotaOnRequest) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "7619a71d63919ee24d771ff98488099b", "score": "0.56053954", "text": "func (s SidewalkAccountInfo) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "37f061fd711936c7a11d7a95bdf4fbde", "score": "0.560386", "text": "func (s UpdateProvisioningParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b3fce364bbeec582691d9c50e7035f2f", "score": "0.56016856", "text": "func (s ServiceInfo) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "aec67e42cbf40ea80c159084848ed1f9", "score": "0.55967146", "text": "func (s UpdateReplicationGroupMemberAction) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "a5e7550a4bfd1a37745858f06b1c536f", "score": "0.5594406", "text": "func (vr VerifyRequest) String() string {\n\treturn fmt.Sprintf(\"id: %d, timestamp: %t, sync: %d, timeout: %d\",\n\t\tvr.ID, vr.Timestamp, vr.Sl, vr.Timeout)\n}", "title": "" }, { "docid": "f0faa8cdc9b3badccbc5269b84efd464", "score": "0.5594397", "text": "func (s *Struct) String() string {\n\treturn fmt.Sprintf(\n\t\t\"%s:{Pos: %s:%d | Size: %d | Optimal: %d | Fields: %d | Ignore: %t}\",\n\t\ts.Name, s.Position.File, s.Position.Line, s.Size, s.OptimalSize,\n\t\tlen(s.Fields), s.Ignore,\n\t)\n}", "title": "" }, { "docid": "7d5a8d01789f95d714ad08a7ed66a3ae", "score": "0.5591101", "text": "func (s CacheParameterGroup) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "0d4dfeb8fd902b515f05c05129702a9a", "score": "0.559039", "text": "func (s OptionGroupMembership) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "0d4dfeb8fd902b515f05c05129702a9a", "score": "0.559039", "text": "func (s OptionGroupMembership) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "acab7979051bcca438ed4fdff33cdcab", "score": "0.5587154", "text": "func (v *SecondService_EchoStructMap_Args) String() string {\n\tif v == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\tvar fields [1]string\n\ti := 0\n\tfields[i] = fmt.Sprintf(\"Arg: %v\", v.Arg)\n\ti++\n\n\treturn fmt.Sprintf(\"SecondService_EchoStructMap_Args{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" }, { "docid": "7f86cd50761eb74c99f3843e8fdf83df", "score": "0.5586386", "text": "func (s setupConsumers) String() string {\n\tres := make([]string, 2)\n\tres[0] = \"Name: \" + reform.Inspect(s.Name, true)\n\tres[1] = \"Enabled: \" + reform.Inspect(s.Enabled, true)\n\treturn strings.Join(res, \", \")\n}", "title": "" }, { "docid": "d713e668abedd315c12ef86d1ee19818", "score": "0.55862826", "text": "func (s EndpointDetails) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d713e668abedd315c12ef86d1ee19818", "score": "0.55862826", "text": "func (s EndpointDetails) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d713e668abedd315c12ef86d1ee19818", "score": "0.55862826", "text": "func (s EndpointDetails) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "8e5503a1a7f97c0882cf5b25b62cea13", "score": "0.55853087", "text": "func (s ModifyDBParameterGroupOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "90f3ed01b8ba372c2bf8862258fa62ad", "score": "0.55845207", "text": "func (pi *ProviderID) String() string {\n\tvar builder strings.Builder\n\tbuilder.WriteString(\"ProviderID(\")\n\tbuilder.WriteString(fmt.Sprintf(\"id=%v\", pi.ID))\n\tbuilder.WriteString(\", created_at=\")\n\tbuilder.WriteString(pi.CreatedAt.Format(time.ANSIC))\n\tbuilder.WriteString(\", updated_at=\")\n\tbuilder.WriteString(pi.UpdatedAt.Format(time.ANSIC))\n\tbuilder.WriteString(\", mturkWorkerID=\")\n\tbuilder.WriteString(pi.MturkWorkerID)\n\tbuilder.WriteByte(')')\n\treturn builder.String()\n}", "title": "" }, { "docid": "9c79efae0c59fae3793b31e51117c275", "score": "0.5582799", "text": "func (pe *Permission) String() string {\n\tvar builder strings.Builder\n\tbuilder.WriteString(\"Permission(\")\n\tbuilder.WriteString(fmt.Sprintf(\"id=%v\", pe.ID))\n\tbuilder.WriteString(\", name=\")\n\tbuilder.WriteString(pe.Name)\n\tbuilder.WriteByte(')')\n\treturn builder.String()\n}", "title": "" }, { "docid": "c67bd540d26e4878c1ca9f4bceb6c296", "score": "0.5577313", "text": "func (s accessMessage) String() string {\n\tif s.Operation == \"set\" {\n\t\treturn console.Colorize(\"Access\",\n\t\t\t\"Access permission for ‘\"+s.Bucket+\"’ is set to ‘\"+string(s.Perms)+\"’\")\n\t}\n\tif s.Operation == \"get\" {\n\t\treturn console.Colorize(\"Access\",\n\t\t\t\"Access permission for ‘\"+s.Bucket+\"’\"+\" is ‘\"+string(s.Perms)+\"’\")\n\t}\n\t// nothing to print\n\treturn \"\"\n}", "title": "" }, { "docid": "f32410e5d0cb674b0643869923c4f33e", "score": "0.5577234", "text": "func (s PrivateRegistryAccessRequest) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "01461ec273b3ef90b7f25b58b0eeed51", "score": "0.55650514", "text": "func (s Get) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "a425fae95ab74fa2978337ee6e96a1bd", "score": "0.5563738", "text": "func (id MemberID) String() string {\n\treturn hex.EncodeToString(id)\n}", "title": "" }, { "docid": "a425fae95ab74fa2978337ee6e96a1bd", "score": "0.5563738", "text": "func (id MemberID) String() string {\n\treturn hex.EncodeToString(id)\n}", "title": "" }, { "docid": "5bf75032f995cb2b53bdbc35bab78bcd", "score": "0.55597377", "text": "func (s ListTeamMembersOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "37a395a0558e1a11482727091976e2ec", "score": "0.5559021", "text": "func (s ChannelMembership) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "7e49ca59f4eead76adab55ccdaa6c8cf", "score": "0.55581504", "text": "func (s UpdateEnvironmentMembershipOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "04f4719f56889d7e33a7bfaa9ed7862f", "score": "0.5555353", "text": "func (w *W) String() string {\n\treturn fmt.Sprintf(\"%v\", w.obj)\n}", "title": "" }, { "docid": "c3bbd5dae6f605d5554fa7ae6f1b15bc", "score": "0.55524075", "text": "func (v *Field) String() string {\n\tif v == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\tvar fields [2]string\n\ti := 0\n\tif v.Name != nil {\n\t\tfields[i] = fmt.Sprintf(\"Name: %v\", *(v.Name))\n\t\ti++\n\t}\n\tif v.Value != nil {\n\t\tfields[i] = fmt.Sprintf(\"Value: %v\", v.Value)\n\t\ti++\n\t}\n\n\treturn fmt.Sprintf(\"Field{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" }, { "docid": "ec79aa1dc38b18b11b950280a73fbaec", "score": "0.5550566", "text": "func (profile FlightProfile) String() string {\r\n\treturn fmt.Sprintf(\"Flight Profile of {%s} with %d data points\", strings.Join(profile.Fields, \", \"), len(profile.Data))\r\n}", "title": "" }, { "docid": "fc75b70ad02a634b15de40bd08893745", "score": "0.5549048", "text": "func (s SkewedInfo) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "2ff57c63a994226ae5259bfa36d0b48a", "score": "0.55454934", "text": "func (s TestInvokeMethodOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "439a24eab52c743a22bf5cbd2adbdef0", "score": "0.55450433", "text": "func (a *Approver) String() string {\n\treturn stringify.Struct(\"Approver\",\n\t\tstringify.StructField(\"referencedMessageID\", a.ReferencedMessageID()),\n\t\tstringify.StructField(\"approverMessageID\", a.ApproverMessageID()),\n\t)\n}", "title": "" }, { "docid": "bb6abe9cdc30d8309a5bfcde627aa2ec", "score": "0.5544198", "text": "func (s InstanceAccessDetails) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "bb6abe9cdc30d8309a5bfcde627aa2ec", "score": "0.55438536", "text": "func (s InstanceAccessDetails) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d9a42dd995b640336b501f132bc80850", "score": "0.55437744", "text": "func (s IdentityUsage) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "06d1f3e758ba6582dcf74835c01e5d88", "score": "0.5543468", "text": "func (s ModifyVerifiedAccessEndpointInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "73286d9d8eba3ed385b34a9b374cb7fe", "score": "0.5539196", "text": "func (s PeeringTgwInfo) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "05ecd1da55bd5d7457487686b6318d0c", "score": "0.55390537", "text": "func (s SourceCredentialsInfo) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "a48b3832281161b8a55fe7d812e70bd7", "score": "0.5538628", "text": "func (s CreateEnvironmentMembershipOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "746359de7e82dc882eb2783865641036", "score": "0.5537457", "text": "func (o *Learningassignmentaggregatequeryrequestfilter) String() string {\n \n o.Clauses = []Learningassignmentaggregatequeryrequestclause{{}} \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "title": "" } ]
250b06cda9fe4572d2da265ab33a5ba1
GetRdsHighWriteReadLatencyDetection returns the RdsHighWriteReadLatencyDetection field value
[ { "docid": "366b541f80e984dcba72b0b9b86b3786", "score": "0.7959403", "text": "func (o *AwsAnomalyDetectionConfig) GetRdsHighWriteReadLatencyDetection() RdsHighWriteReadLatencyDetectionConfig {\n\tif o == nil {\n\t\tvar ret RdsHighWriteReadLatencyDetectionConfig\n\t\treturn ret\n\t}\n\n\treturn o.RdsHighWriteReadLatencyDetection\n}", "title": "" } ]
[ { "docid": "f6cb439a4be06ef5ea3f7a6b0beefb4d", "score": "0.74890864", "text": "func (o *AwsAnomalyDetectionConfig) SetRdsHighWriteReadLatencyDetection(v RdsHighWriteReadLatencyDetectionConfig) {\n\to.RdsHighWriteReadLatencyDetection = v\n}", "title": "" }, { "docid": "da7a6051eac29b87192a0ebe2a9c3b52", "score": "0.7331533", "text": "func (o *RdsHighLatencyThresholds) GetWriteReadLatency() int32 {\n\tif o == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\n\treturn o.WriteReadLatency\n}", "title": "" }, { "docid": "6ad5584a7c67f706dd3a9a3be1c0467d", "score": "0.7158167", "text": "func (o *AwsAnomalyDetectionConfig) GetRdsHighWriteReadLatencyDetectionOk() (*RdsHighWriteReadLatencyDetectionConfig, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.RdsHighWriteReadLatencyDetection, true\n}", "title": "" }, { "docid": "72fad8190bfbdbb95c18359982ce6bf0", "score": "0.66980577", "text": "func (o *AwsAnomalyDetectionConfig) GetRdsHighCpuDetection() RdsHighCpuDetectionConfig {\n\tif o == nil {\n\t\tvar ret RdsHighCpuDetectionConfig\n\t\treturn ret\n\t}\n\n\treturn o.RdsHighCpuDetection\n}", "title": "" }, { "docid": "54fbe2adc613c0b49a8c35b03bbca531", "score": "0.6661146", "text": "func (o *RdsHighLatencyThresholds) GetWriteReadLatencyOk() (*int32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.WriteReadLatency, true\n}", "title": "" }, { "docid": "951ea833d35b32b21d2343b5a4ef3ea3", "score": "0.649579", "text": "func (o *AwsAnomalyDetectionConfig) GetRdsHighMemoryDetection() RdsHighMemoryDetectionConfig {\n\tif o == nil {\n\t\tvar ret RdsHighMemoryDetectionConfig\n\t\treturn ret\n\t}\n\n\treturn o.RdsHighMemoryDetection\n}", "title": "" }, { "docid": "58477b7404546026d9cce11b85bfdc2b", "score": "0.61763", "text": "func NewRdsHighLatencyThresholds(writeReadLatency int32, ) *RdsHighLatencyThresholds {\n\tthis := RdsHighLatencyThresholds{}\n\tthis.WriteReadLatency = writeReadLatency\n\treturn &this\n}", "title": "" }, { "docid": "e13910ef7187b81e0a121339ba73af01", "score": "0.6164153", "text": "func (o *AwsAnomalyDetectionConfig) SetRdsHighCpuDetection(v RdsHighCpuDetectionConfig) {\n\to.RdsHighCpuDetection = v\n}", "title": "" }, { "docid": "910ee22b55c041c238d655fc3dbac8a4", "score": "0.6079061", "text": "func (o *AwsAnomalyDetectionConfig) SetRdsHighMemoryDetection(v RdsHighMemoryDetectionConfig) {\n\to.RdsHighMemoryDetection = v\n}", "title": "" }, { "docid": "a2ae7302a63231cb616bf7d4a167e12f", "score": "0.5995816", "text": "func (o *AwsAnomalyDetectionConfig) GetRdsHighCpuDetectionOk() (*RdsHighCpuDetectionConfig, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.RdsHighCpuDetection, true\n}", "title": "" }, { "docid": "6d653a98357ade12a9276a6421a95ad9", "score": "0.570782", "text": "func (o *RdsHighLatencyThresholds) SetWriteReadLatency(v int32) {\n\to.WriteReadLatency = v\n}", "title": "" }, { "docid": "388a02193790ead770e4b4890e4ee75e", "score": "0.5675608", "text": "func (o *AwsAnomalyDetectionConfig) GetRdsHighMemoryDetectionOk() (*RdsHighMemoryDetectionConfig, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.RdsHighMemoryDetection, true\n}", "title": "" }, { "docid": "0de4a3edfc08df09c048f38c0a269276", "score": "0.504363", "text": "func (c *Config) GetSlowWriteThreshold() float64 {\n\tif c.SlowWriteThreshold <= 0 {\n\t\treturn slowWriteThreshold\n\t}\n\n\treturn c.SlowWriteThreshold\n}", "title": "" }, { "docid": "62d07a74ebd2146ca421673e817d7891", "score": "0.5023238", "text": "func NewRdsHighCpuThresholds(cpuUsagePercentage int32, ) *RdsHighCpuThresholds {\n\tthis := RdsHighCpuThresholds{}\n\tthis.CpuUsagePercentage = cpuUsagePercentage\n\treturn &this\n}", "title": "" }, { "docid": "d10ec721625314a455893f1648155292", "score": "0.501632", "text": "func (o *AwsAnomalyDetectionConfig) GetRdsLowStorageDetection() RdsLowStorageDetectionConfig {\n\tif o == nil {\n\t\tvar ret RdsLowStorageDetectionConfig\n\t\treturn ret\n\t}\n\n\treturn o.RdsLowStorageDetection\n}", "title": "" }, { "docid": "d01a5400aa84769b61049ef58024f28a", "score": "0.48767063", "text": "func (o *VolumeMetricsCollectionGetParams) SetLatencyWrite(latencyWrite *int64) {\n\to.LatencyWrite = latencyWrite\n}", "title": "" }, { "docid": "45e9207e94f04dcbe6fdb475f4afbfb7", "score": "0.48241642", "text": "func checkHigh(dbconnect *sql.DB, in_clockid int64) int64 {\n\n\tvar out_tsn int64\n\n\trow := dbconnect.QueryRow(\"select nodes.checkHigh( $1 )\", in_clockid)\n\tcheckRow(row)\n\n\terr := row.Scan(&out_tsn)\n\n\tcheckErr(\"nodes.checkHigh\", err)\n\n\treturn out_tsn\n}", "title": "" }, { "docid": "92b800a6af80851442451149cbfc47af", "score": "0.47037736", "text": "func (o *VolumeMetricsCollectionGetParams) SetLatencyRead(latencyRead *int64) {\n\to.LatencyRead = latencyRead\n}", "title": "" }, { "docid": "6e3ede3506bb2d02eb1fd64c41e81d8d", "score": "0.4696769", "text": "func ReadLatency(d ...time.Duration) Condition {\n\treturn newConn(func(cn *conn) *conn {\n\t\tdoRead := cn.read\n\t\tdoSetReadDeadline := cn.setReadDeadline\n\t\tdoSetDeadline := cn.setDeadline\n\t\tdoClose := cn.close\n\t\tdl := newDeadline()\n\t\tvar i uint64\n\t\tcn.read = func(b []byte) (int, error) {\n\t\t\tvar latency time.Duration\n\t\t\tif len(d) != 0 {\n\t\t\t\tidx := int((atomic.AddUint64(&i, 1) - 1) % uint64(len(d)))\n\t\t\t\tlatency = d[idx]\n\t\t\t}\n\t\t\terr := dl.Wait(latency)\n\t\t\tif err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t\treturn doRead(b)\n\t\t}\n\t\tcn.setReadDeadline = func(t time.Time) error {\n\t\t\tdl.Reset(t)\n\t\t\treturn doSetReadDeadline(t)\n\t\t}\n\t\tcn.setDeadline = func(t time.Time) error {\n\t\t\tdl.Reset(t)\n\t\t\treturn doSetDeadline(t)\n\t\t}\n\t\tcn.close = func() error {\n\t\t\tdl.Close()\n\t\t\treturn doClose()\n\t\t}\n\t\treturn cn\n\t})\n}", "title": "" }, { "docid": "886a0f2d25a4d895749ff614d70fda81", "score": "0.44967753", "text": "func (o *VolumeCollectionGetParams) SetStatisticsLatencyRawWrite(statisticsLatencyRawWrite *int64) {\n\to.StatisticsLatencyRawWrite = statisticsLatencyRawWrite\n}", "title": "" }, { "docid": "b7d9690937ca3ff142aea273b7df287e", "score": "0.44832656", "text": "func (o DiskUtilizationResponseOutput) TargetReadOpsPerSecond() pulumi.IntOutput {\n\treturn o.ApplyT(func(v DiskUtilizationResponse) int { return v.TargetReadOpsPerSecond }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "7b257bf08fa7fb53b9ce0e21dc248916", "score": "0.4469629", "text": "func (o *VolumeCollectionGetParams) SetMetricLatencyRead(metricLatencyRead *int64) {\n\to.MetricLatencyRead = metricLatencyRead\n}", "title": "" }, { "docid": "343d4846538db390b3cbc816cfaee45a", "score": "0.4468415", "text": "func (o *VolumeCollectionGetParams) SetMetricLatencyWrite(metricLatencyWrite *int64) {\n\to.MetricLatencyWrite = metricLatencyWrite\n}", "title": "" }, { "docid": "ea1e50cf7fbc5fb12029358a28a943c3", "score": "0.44132945", "text": "func (o DiskUtilizationOutput) TargetReadOpsPerSecond() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v DiskUtilization) *int { return v.TargetReadOpsPerSecond }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "4211c38fcd85f8f3566545c9f49a53f9", "score": "0.44055018", "text": "func (o DiskUtilizationPtrOutput) TargetReadOpsPerSecond() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *DiskUtilization) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.TargetReadOpsPerSecond\n\t}).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "cdd0bf64f3d5af77c6b4ea345f58d260", "score": "0.44022793", "text": "func (o *VolumeCollectionGetParams) SetStatisticsLatencyRawRead(statisticsLatencyRawRead *int64) {\n\to.StatisticsLatencyRawRead = statisticsLatencyRawRead\n}", "title": "" }, { "docid": "c59904b110e69f8bc42fe63220a6ea71", "score": "0.44000465", "text": "func (a *AutoDownloadSettingsPresets) GetHigh() (value AutoDownloadSettings) {\n\tif a == nil {\n\t\treturn\n\t}\n\treturn a.High\n}", "title": "" }, { "docid": "c3ff2bc6e39a4ebf3b57f7c31c4fe33c", "score": "0.439512", "text": "func (c *CPU) LoadHigh(n byte) {\n\taddress := 0xFF00 + uint16(n)\n\tc.reg[A] = c.readMemory(address)\n}", "title": "" }, { "docid": "0692bed6a3d5f2911da040c18204902c", "score": "0.4393777", "text": "func SPI_IOC_WR_MAX_SPEED_HZ() uintptr {\n\treturn IOW(SPI_IOC_MAGIC, 4, 4)\n}", "title": "" }, { "docid": "3957b45fbd39a03f9981b11425b018f0", "score": "0.4387959", "text": "func InternetSiteSecurityLevelPMediumHigh() *InternetSiteSecurityLevel {\n\tv := InternetSiteSecurityLevelVMediumHigh\n\treturn &v\n}", "title": "" }, { "docid": "823a8c3d8e72430608aebebf0dfecb87", "score": "0.43790752", "text": "func NewRdsHighLatencyThresholdsWithDefaults() *RdsHighLatencyThresholds {\n\tthis := RdsHighLatencyThresholds{}\n\treturn &this\n}", "title": "" }, { "docid": "b8a051e9bb32ee29ecc8b2adff91cc5e", "score": "0.43692946", "text": "func (hz *Healthz) ReadTimeout() time.Duration {\n\treturn hz.readTimeout\n}", "title": "" }, { "docid": "6173d2ee7ad2087a092518ad8ebe129b", "score": "0.43633607", "text": "func SiteSecurityLevelPMediumHigh() *SiteSecurityLevel {\n\tv := SiteSecurityLevelVMediumHigh\n\treturn &v\n}", "title": "" }, { "docid": "b0353fe06c2bec386b19402e0e1ea86e", "score": "0.43589652", "text": "func (o *AwsAnomalyDetectionConfig) SetRdsLowStorageDetection(v RdsLowStorageDetectionConfig) {\n\to.RdsLowStorageDetection = v\n}", "title": "" }, { "docid": "a98d2eecad109a92129d1ecabd62e30e", "score": "0.43341258", "text": "func (n *Aps_ApsModulePath) SecondarySwitchThreshold() *Aps_ApsModule_SecondarySwitchThresholdPath {\n\treturn &Aps_ApsModule_SecondarySwitchThresholdPath{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"config\", \"secondary-switch-threshold\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "7a5a5952c786016719bc12ddf165b389", "score": "0.4317082", "text": "func (n *Aps_ApsModulePathAny) SecondarySwitchThreshold() *Aps_ApsModule_SecondarySwitchThresholdPathAny {\n\treturn &Aps_ApsModule_SecondarySwitchThresholdPathAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"config\", \"secondary-switch-threshold\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "ca838f107cafc1c0ba57330469404d48", "score": "0.43100962", "text": "func SPI_IOC_RD_MAX_SPEED_HZ() uintptr {\n\treturn IOR(SPI_IOC_MAGIC, 4, 4)\n}", "title": "" }, { "docid": "15eaab75b0399bbbe3e1d09bc19887a2", "score": "0.4306529", "text": "func (db *Database) CheckHigh(in_clockid int64) (out_tsn int64, err error) {\n\n\tdefer func() {\n\n\t\tif r := recover(); r != nil {\n\t\t\t// recover from panic\n\t\t\terr = errors.New(\"error while getting remote high water marks\")\n\n\t\t}\n\n\t}()\n\tout_tsn = checkHigh(db.dbconnect, in_clockid)\n\treturn\n}", "title": "" }, { "docid": "0ca62745085dd330ff37b38747b087ef", "score": "0.42957", "text": "func (o *AwsAnomalyDetectionConfig) GetRdsLowStorageDetectionOk() (*RdsLowStorageDetectionConfig, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.RdsLowStorageDetection, true\n}", "title": "" }, { "docid": "0b6939d4ab8107ad9cc7a6ec36da647c", "score": "0.42748702", "text": "func (jbobject *ServiceStorageProxyMBean) GetRecentReadLatencyHistogramMicros() []int64 {\n\tjret, err := jbobject.CallLongArray(\"getRecentReadLatencyHistogramMicros\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn jret\n}", "title": "" }, { "docid": "022bde8a57f619d7ba833e7920187e81", "score": "0.42669222", "text": "func (jbobject *ServiceStorageProxyMBean) GetRecentReadLatencyMicros() float64 {\n\tjret, err := jbobject.CallDouble(\"getRecentReadLatencyMicros\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn jret\n}", "title": "" }, { "docid": "10d4a05e18fe27c401a27bf34e7b6307", "score": "0.42564324", "text": "func (mtx *PriorityMutex) HighPriorityReadUnlock() {\n\tmtx.highPriorityWaiting.done()\n\tmtx.dataMutex.RUnlock()\n}", "title": "" }, { "docid": "a29064aeac393b5709fd838faa0e99c4", "score": "0.42557302", "text": "func (jbobject *ServiceStorageProxyMBean) GetRecentWriteLatencyMicros() float64 {\n\tjret, err := jbobject.CallDouble(\"getRecentWriteLatencyMicros\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn jret\n}", "title": "" }, { "docid": "1af2495193b99b3287a2c380fef3a1b1", "score": "0.4225755", "text": "func (p *Pipe) rwReadiness() waiter.EventMask {\n\tp.mu.Lock()\n\tdefer p.mu.Unlock()\n\treturn p.rReadinessLocked() | p.wReadinessLocked()\n}", "title": "" }, { "docid": "fabe84e0bc608185c4dd03b8db92967a", "score": "0.419806", "text": "func (p *OptimisticTxnContextProvider) GetStmtReadTS() (uint64, error) {\n\t// If `math.MaxUint64` is used for point get optimization, it is not necessary to activate the txn.\n\t// Just return `math.MaxUint64` to save the performance.\n\tif p.optimizeWithMaxTS {\n\t\treturn math.MaxUint64, nil\n\t}\n\treturn p.baseTxnContextProvider.GetStmtReadTS()\n}", "title": "" }, { "docid": "77e066243a864b5a45fc7ff16af7dc83", "score": "0.4192752", "text": "func (mtx *PriorityMutex) HighPriorityReadLock() {\n\tmtx.highPriorityWaiting.add(1)\n\tmtx.dataMutex.RLock()\n}", "title": "" }, { "docid": "59181a591d7a743c2d2ba7e7132856b5", "score": "0.41786024", "text": "func (o *ResponseTimeDegradationThresholdConfig) GetSlowestResponseTimeThresholdMilliseconds() int32 {\n\tif o == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\n\treturn o.SlowestResponseTimeThresholdMilliseconds\n}", "title": "" }, { "docid": "57909439e1ea0ac9b899a47a7aa0d7d2", "score": "0.41776544", "text": "func (o *CloudSkuVolumeType) GetMaxReadThroughput() float64 {\n\tif o == nil || o.MaxReadThroughput == nil {\n\t\tvar ret float64\n\t\treturn ret\n\t}\n\treturn *o.MaxReadThroughput\n}", "title": "" }, { "docid": "b43f4e9e3793eb512ed35d894fe1694f", "score": "0.4174068", "text": "func (d *Device) GetHighestScanLine() uint16 {\n\t// Last scanline id appears to be backporch/2 + 320/2\n\treturn uint16(math.Ceil(float64(d.vSyncLines)/2)/2) + 160\n}", "title": "" }, { "docid": "5effa7a63f1527f12c2ccab180b740f1", "score": "0.41725293", "text": "func (jbobject *ServiceStorageProxyMBean) GetRecentWriteLatencyHistogramMicros() []int64 {\n\tjret, err := jbobject.CallLongArray(\"getRecentWriteLatencyHistogramMicros\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn jret\n}", "title": "" }, { "docid": "249807539e934abaf728b92f607d0684", "score": "0.4164599", "text": "func (*NoopStorage) ReadDisabledRule(\n\t_ types.OrgID, _ types.RuleID, _ types.ErrorKey,\n) (ctypes.SystemWideRuleDisable, bool, error) {\n\treturn ctypes.SystemWideRuleDisable{}, true, nil\n}", "title": "" }, { "docid": "79ee204d9c427b623ca0b8d7b662a7f9", "score": "0.41551062", "text": "func (h *HOG) GetL2HysThreshold() float64 {\n\treturn float64(C.HOG_GetL2HysThreshold(C.HOG(h.p)))\n}", "title": "" }, { "docid": "62b31f60a82dec3c09f3014639ab8a99", "score": "0.41300657", "text": "func (o DiskUtilizationOutput) TargetReadBytesPerSecond() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v DiskUtilization) *int { return v.TargetReadBytesPerSecond }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "0d81d98c9b2ec340d6dfc52d51d861aa", "score": "0.4118401", "text": "func (o DiskUtilizationResponseOutput) TargetReadBytesPerSecond() pulumi.IntOutput {\n\treturn o.ApplyT(func(v DiskUtilizationResponse) int { return v.TargetReadBytesPerSecond }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "7771a84f2f90ad531494016570a6c76e", "score": "0.41038787", "text": "func (tc *TestCase) TestWriteReadLong() error {\n\tvar killed uint32\n\terrCh := make(chan error)\n\twg := &sync.WaitGroup{}\n\n\tkill := func() {\n\t\tatomic.StoreUint32(&killed, 1)\n\t\twg.Wait()\n\t}\n\n\t// Start writer goroutines.\n\tfor i := 0; i < tc.testCfg.NumWriters; i++ {\n\t\twg.Add(1)\n\t\tgo tc.writerLoop(i, wg, &killed, errCh)\n\t}\n\n\trunTimer := time.NewTimer(tc.testCfg.TestTime)\n\tselect {\n\tcase <-runTimer.C: // Stop the test when the timer expires.\n\t\tkill()\n\t\tlog.Infof(\"test done\")\n\t\treturn nil\n\n\tcase err := <-errCh: // Stop the test when there is an error.\n\t\tkill()\n\t\treturn err\n\t}\n}", "title": "" }, { "docid": "15054624685255aa70c621ca7f99907a", "score": "0.41001767", "text": "func (g *Grpc) GetHighScore(ctx context.Context, input *pbhighscore.GetHighScoreRequest) (*pbhighscore.GetHighScoreResponse, error) {\n\tlog.Info().Msg(\"GetHighScore in m-highscore is called.\")\n\t// HighScore = input.HighScore\n\treturn &pbhighscore.GetHighScoreResponse{\n\t\tHighScore: HighScore,\n\t}, nil\n}", "title": "" }, { "docid": "eb7de3ee01ae9278926e3e75c62e802c", "score": "0.40959895", "text": "func (hz *Healthz) ReadHeaderTimeout() time.Duration {\n\treturn hz.readHeaderTimeout\n}", "title": "" }, { "docid": "8573787fab1f7c2145a14b3af4deb865", "score": "0.4095535", "text": "func (o ExpressRouteCircuitStatsResponseOutput) SecondarybytesOut() pulumi.Float64PtrOutput {\n\treturn o.ApplyT(func(v ExpressRouteCircuitStatsResponse) *float64 { return v.SecondarybytesOut }).(pulumi.Float64PtrOutput)\n}", "title": "" }, { "docid": "e580863ff2ce6aae60f57fae1acbc882", "score": "0.4084418", "text": "func (m *MicrosoftTunnelHealthThreshold) GetHealthyThreshold()(*int64) {\n val, err := m.GetBackingStore().Get(\"healthyThreshold\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*int64)\n }\n return nil\n}", "title": "" }, { "docid": "788e19ae0d1f664c85dfcdc64115f7b0", "score": "0.40730974", "text": "func (s *DHTSensor) readSensor() (Reading, error) {\n\tsensor := fmt.Sprintf(\"DHT%d\", s.Version)\n\treading := NewReading(float32(15.2), float32(39.0), sensor)\n\treturn reading, nil\n}", "title": "" }, { "docid": "43479afb704a0f89500685d78408ce9d", "score": "0.40703943", "text": "func (_TBTCSystem *TBTCSystemSession) GetSeverelyUndercollateralizedThresholdPercent() (uint16, error) {\n\treturn _TBTCSystem.Contract.GetSeverelyUndercollateralizedThresholdPercent(&_TBTCSystem.CallOpts)\n}", "title": "" }, { "docid": "76350aa8ccf285e0e3d4ecf044e27adc", "score": "0.40700507", "text": "func (o ExplainQueryStageResponseOutput) ReadMsMax() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ExplainQueryStageResponse) string { return v.ReadMsMax }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "32d43a9cd98f008f8f4eb5d357f25bd5", "score": "0.4047039", "text": "func (d *Driver) WriteReadWord16(w uint16) uint16 {\n\tif d.err != 0 {\n\t\treturn 0\n\t}\n\td.done.Clear()\n\tp := d.p\n\tp.EditConfig(TwoWire|Tx, ThreeWire|TxRx)\n\tp.EnableIRQ(RxNotEmpty | Err)\n\tp.StoreWord16(w)\n\tif !d.done.Sleep(d.timeout) {\n\t\tp.DisableIRQ(RxNotEmpty | Err)\n\t\td.err = uint32(ErrTimeout) << 16\n\t\treturn 0\n\t}\n\tw = p.LoadWord16()\n\tif _, e := p.Status(); e != 0 {\n\t\td.err = uint32(e) << 8\n\t\treturn 0\n\t}\n\treturn w\n}", "title": "" }, { "docid": "38dc5fee6d2cda1e0f9ec7357d990041", "score": "0.40432358", "text": "func (config Configuration) GetReadTimeout() time.Duration {\n\tif config.ReadTimeout == 0 {\n\t\treturn config.Timeout\n\t}\n\n\treturn config.ReadTimeout\n}", "title": "" }, { "docid": "5d38a18bc4552227aa004ecbd9c68723", "score": "0.40365806", "text": "func GetHaAdvancedLoadWarn(client sophos.ClientInterface, options ...sophos.Option) (val int64, err error) {\n\terr = get(client, \"/api/nodes/ha.advanced.load_warn\", &val, options...)\n\treturn\n}", "title": "" }, { "docid": "ba7248907859fe42c1b4dbde84486b31", "score": "0.4030806", "text": "func (m *Windows10EndpointProtectionConfiguration) GetDefenderEnableLowCpuPriority()(*bool) {\n val, err := m.GetBackingStore().Get(\"defenderEnableLowCpuPriority\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*bool)\n }\n return nil\n}", "title": "" }, { "docid": "e393033133b31f46f99f032dad949344", "score": "0.40155825", "text": "func (o ExpressRouteCircuitStatsResponsePtrOutput) SecondarybytesOut() pulumi.Float64PtrOutput {\n\treturn o.ApplyT(func(v *ExpressRouteCircuitStatsResponse) *float64 {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.SecondarybytesOut\n\t}).(pulumi.Float64PtrOutput)\n}", "title": "" }, { "docid": "d0cd2e78aba9b21faa7d5200338cffcd", "score": "0.40121827", "text": "func (o ExpressRouteCircuitStatsOutput) SecondarybytesOut() pulumi.Float64PtrOutput {\n\treturn o.ApplyT(func(v ExpressRouteCircuitStats) *float64 { return v.SecondarybytesOut }).(pulumi.Float64PtrOutput)\n}", "title": "" }, { "docid": "7349c3da526b6491cf3784da8bdda38f", "score": "0.40076184", "text": "func (o DiskUtilizationPtrOutput) TargetReadBytesPerSecond() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *DiskUtilization) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.TargetReadBytesPerSecond\n\t}).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "87b7ff57a6ae9c387634858abfeabafb", "score": "0.39989275", "text": "func (o FlexibleServerOutput) HighAvailability() FlexibleServerHighAvailabilityPtrOutput {\n\treturn o.ApplyT(func(v *FlexibleServer) FlexibleServerHighAvailabilityPtrOutput { return v.HighAvailability }).(FlexibleServerHighAvailabilityPtrOutput)\n}", "title": "" }, { "docid": "fa7def1b2b98e08c862d421a304e9589", "score": "0.39937633", "text": "func (jbobject *ServiceStorageProxyMBean) GetTotalReadLatencyHistogramMicros() []int64 {\n\tjret, err := jbobject.CallLongArray(\"getTotalReadLatencyHistogramMicros\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn jret\n}", "title": "" }, { "docid": "7a4beab4f4d911f71201e30705be2805", "score": "0.39873147", "text": "func GetPsdHiPortsWeight(client sophos.ClientInterface, options ...sophos.Option) (val int64, err error) {\n\terr = get(client, \"/api/nodes/psd.hi_ports_weight\", &val, options...)\n\treturn\n}", "title": "" }, { "docid": "24444e790be2b30cba8622b2b0a67129", "score": "0.39859185", "text": "func (o *NetworkHighRetransmissionThresholds) GetRetransmissionRatePercentage() int32 {\n\tif o == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\n\treturn o.RetransmissionRatePercentage\n}", "title": "" }, { "docid": "0baba3336d85caa3055b2185843acbf9", "score": "0.39720082", "text": "func (o ExplainQueryStageResponseOutput) ReadRatioMax() pulumi.Float64Output {\n\treturn o.ApplyT(func(v ExplainQueryStageResponse) float64 { return v.ReadRatioMax }).(pulumi.Float64Output)\n}", "title": "" }, { "docid": "c3d5a9e8104721f5152dea2ed20970bf", "score": "0.3964328", "text": "func (m *Windows10EndpointProtectionConfiguration) GetDefenderScanMaxCpuPercentage()(*int32) {\n val, err := m.GetBackingStore().Get(\"defenderScanMaxCpuPercentage\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*int32)\n }\n return nil\n}", "title": "" }, { "docid": "993971fb175c783af8c97a8495b2ff81", "score": "0.39603272", "text": "func (c *CPU) StoreHigh(n byte) {\n\taddress := 0xFF00 + uint16(n)\n\tc.writeMemory(address, c.reg[A])\n}", "title": "" }, { "docid": "c19b39aa2778fc30a977205c766d2fa6", "score": "0.3951218", "text": "func (mn RplidarResponseMeasurementNode) Quality() uint16 {\n\treturn uint16(mn.SyncQuality >> RplidarResponseMeasurementQualityShift)\n}", "title": "" }, { "docid": "376c538ab158c7a312111ef635b13ae1", "score": "0.39411843", "text": "func (lcm *ConnectedMiao) ReadSensor() (*MiaoMiaoPacket, error) {\n\tmp, err := lcm.PollResponse()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif mp.Type == MPLibre {\n\t\treading := CreateMiaoMiaoPacket(mp)\n\t\treturn &reading, err\n\t}\n\treturn nil, fmt.Errorf(\"did not recieve sensor response\")\n}", "title": "" }, { "docid": "2f295b3a03dad9991b7e917b072a3dea", "score": "0.39303654", "text": "func getRemoteHighs(dbconnect *sql.DB) HighWaterMarks {\n\n\t/* select * from stored functions returns 'structure' */\n\trows, err := dbconnect.Query(\"select * from nodes.getRemoteHighs()\")\n\tdefer rows.Close()\n\n\tcheckErr(\"getRemoteHighs\", err)\n\n\treturn rowsToHighWaterMarks(rows)\n}", "title": "" }, { "docid": "833ff59be74b25cb5079ebd34cd91967", "score": "0.39263633", "text": "func (o *VolumeMetricsCollectionGetParams) SetThroughputRead(throughputRead *int64) {\n\to.ThroughputRead = throughputRead\n}", "title": "" }, { "docid": "cccfe8c9a8106918a6c645b14697423c", "score": "0.39262393", "text": "func (db *Database) GetRemoteHighs() (hwms HighWaterMarks, err error) {\n\n\tdefer func() {\n\n\t\tif r := recover(); r != nil {\n\t\t\t// recover from panic\n\t\t\terr = errors.New(\"error while getting remote high water marks\")\n\n\t\t}\n\n\t}()\n\n\thwms = getRemoteHighs(db.dbconnect)\n\treturn hwms, err\n}", "title": "" }, { "docid": "15a1039c41ac5af392addc313bb317ef", "score": "0.3923826", "text": "func (o *ResponseTimeDegradationThresholdConfig) GetResponseTimeThresholdMilliseconds() int32 {\n\tif o == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\n\treturn o.ResponseTimeThresholdMilliseconds\n}", "title": "" }, { "docid": "de71767ca883013449d85f9f42e680ea", "score": "0.39227423", "text": "func (m *Windows10GeneralConfiguration) GetDefenderRequireRealTimeMonitoring()(*bool) {\n return m.defenderRequireRealTimeMonitoring\n}", "title": "" }, { "docid": "a1a9c5101816d2a357747e80e2c47f09", "score": "0.3921037", "text": "func (o *RdsHighCpuThresholds) GetCpuUsagePercentage() int32 {\n\tif o == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\n\treturn o.CpuUsagePercentage\n}", "title": "" }, { "docid": "d8e6460d275b5c403540b7b0972a37e6", "score": "0.3917528", "text": "func (o *AppNodeDataData) GetHealthcheckFreq() string {\n\tif o == nil || o.HealthcheckFreq == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.HealthcheckFreq\n}", "title": "" }, { "docid": "b0377933389ef4a2b78244070fbdb4ec", "score": "0.3916556", "text": "func (m *Windows10GeneralConfiguration) GetDefenderScanMaxCpu()(*int32) {\n return m.defenderScanMaxCpu\n}", "title": "" }, { "docid": "179e68ce7c3c6c9f480f3103b126fa9a", "score": "0.3899925", "text": "func NewRdsHighCpuThresholdsWithDefaults() *RdsHighCpuThresholds {\n\tthis := RdsHighCpuThresholds{}\n\treturn &this\n}", "title": "" }, { "docid": "ef0694a2355ec2fad800f2720cd96d86", "score": "0.3894995", "text": "func (o ExpressRouteCircuitStatsPtrOutput) SecondarybytesOut() pulumi.Float64PtrOutput {\n\treturn o.ApplyT(func(v *ExpressRouteCircuitStats) *float64 {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.SecondarybytesOut\n\t}).(pulumi.Float64PtrOutput)\n}", "title": "" }, { "docid": "3aa7c554e4ffa224bbe9a670f80db2c4", "score": "0.38929188", "text": "func WriteLatency(d ...time.Duration) Condition {\n\treturn newConn(func(cn *conn) *conn {\n\t\tdoWrite := cn.write\n\t\tdoSetWriteDeadline := cn.setWriteDeadline\n\t\tdoSetDeadline := cn.setDeadline\n\t\tdoClose := cn.close\n\t\tdl := newDeadline()\n\t\tvar i uint64\n\t\tcn.write = func(b []byte) (int, error) {\n\t\t\tvar latency time.Duration\n\t\t\tif len(d) != 0 {\n\t\t\t\tidx := int((atomic.AddUint64(&i, 1) - 1) % uint64(len(d)))\n\t\t\t\tlatency = d[idx]\n\t\t\t}\n\t\t\terr := dl.Wait(latency)\n\t\t\tif err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t\treturn doWrite(b)\n\t\t}\n\t\tcn.setWriteDeadline = func(t time.Time) error {\n\t\t\tdl.Reset(t)\n\t\t\treturn doSetWriteDeadline(t)\n\t\t}\n\t\tcn.setDeadline = func(t time.Time) error {\n\t\t\tdl.Reset(t)\n\t\t\treturn doSetDeadline(t)\n\t\t}\n\t\tcn.close = func() error {\n\t\t\tdl.Close()\n\t\t\treturn doClose()\n\t\t}\n\t\treturn cn\n\t})\n}", "title": "" }, { "docid": "b39bbca851e489363f15a6b976681e92", "score": "0.38913295", "text": "func (s *Aps_ApsModule_Ports) GetLineSecondaryOut() *Aps_ApsModule_Ports_LineSecondaryOut {\n\tif s != nil && s.LineSecondaryOut != nil {\n\t\treturn s.LineSecondaryOut\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "49385db940505791ba8400526f1b5d28", "score": "0.38863343", "text": "func (v *TaskListStatus) GetReadLevel() (o int64) {\n\tif v != nil {\n\t\treturn v.ReadLevel\n\t}\n\treturn\n}", "title": "" }, { "docid": "216ec56edf97cc525f10e5ebbd40288d", "score": "0.3885687", "text": "func (d *Device) ReadStatus() uint8 {\n\treturn d.readReg(RESULT_RANGE_STATUS) >> 4\n}", "title": "" }, { "docid": "263c7aafa8ced221fc15089472104002", "score": "0.3885562", "text": "func (_TBTCSystem *TBTCSystemCallerSession) GetSeverelyUndercollateralizedThresholdPercent() (uint16, error) {\n\treturn _TBTCSystem.Contract.GetSeverelyUndercollateralizedThresholdPercent(&_TBTCSystem.CallOpts)\n}", "title": "" }, { "docid": "e9cdd859770230610ff5382afd5e8c74", "score": "0.3884967", "text": "func (client *Client) GetGameHighScores(chatID int64, messageID int64, userID int32) (*GameHighScores, error) {\n\tresult, err := client.SendAndCatch(UpdateData{\n\t\t\"@type\": \"getGameHighScores\",\n\t\t\"chat_id\": chatID,\n\t\t\"message_id\": messageID,\n\t\t\"user_id\": userID,\n\t})\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif result.Data[\"@type\"].(string) == \"error\" {\n\t\treturn nil, fmt.Errorf(\"error! code: %d msg: %s\", result.Data[\"code\"], result.Data[\"message\"])\n\t}\n\n\tvar gameHighScores GameHighScores\n\terr = json.Unmarshal(result.Raw, &gameHighScores)\n\treturn &gameHighScores, err\n\n}", "title": "" }, { "docid": "797bb990b1b47fd390115a78cf1d9bd8", "score": "0.3868699", "text": "func (jbobject *ServiceStorageProxyMBean) GetTotalReadLatencyMicros() int64 {\n\tjret, err := jbobject.CallLong(\"getTotalReadLatencyMicros\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn jret\n}", "title": "" }, { "docid": "16a87c7dc6192f946611a94691187f84", "score": "0.38596395", "text": "func (o *ResponseTimeDegradationThresholdConfig) GetLoadThreshold() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.LoadThreshold\n}", "title": "" }, { "docid": "9f53b02237b835323514075fe2bf4d25", "score": "0.38558605", "text": "func (jbobject *ServiceStorageProxyMBean) GetTotalWriteLatencyHistogramMicros() []int64 {\n\tjret, err := jbobject.CallLongArray(\"getTotalWriteLatencyHistogramMicros\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn jret\n}", "title": "" }, { "docid": "e90af511a9e1c601df0a343646f4b972", "score": "0.3833157", "text": "func (*Frame) ReadHL(header []byte) byte {\n\t// 0101_1111 0000_1111\n\t// 0x0F - 15\n\treturn header[0] & 0x0F\n}", "title": "" }, { "docid": "49817212d48bd56eec9460f2c502a143", "score": "0.3826659", "text": "func (o DiskUtilizationResponseOutput) TargetWriteOpsPerSecond() pulumi.IntOutput {\n\treturn o.ApplyT(func(v DiskUtilizationResponse) int { return v.TargetWriteOpsPerSecond }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "13c2b6c2d23b02bec4aad9a143e70454", "score": "0.38240725", "text": "func WithFullReadStats(f FullReadStatsFunc) ReadOption { return withFullReadStats{f} }", "title": "" } ]
af37406c6000a7cf7646a96596c416ab
ListAllCurrent lists all current keys
[ { "docid": "50bdbaf98d829a8d41e47c8c4b11c998", "score": "0.6737117", "text": "func (s *store) ListAllCurrent() (int64, []types.Record, error) {\n\treturn s.listAllCurrent(0)\n}", "title": "" } ]
[ { "docid": "d943af1d47a6c4235b11257b07e95843", "score": "0.66635096", "text": "func ListAllKeys() error {\n\n\tdb := Connect()\n\n\tif ExistDb(PathDb) {\n\n\t\tfmt.Println(\"Exist\", db)\n\n\t} else {\n\n\t\tfmt.Println(\"Not exist!\")\n\t\tos.Exit(1)\n\t}\n\n\tdb.View(func(tx *bolt.Tx) error {\n\n\t\t// Assume bucket exists and has keys\n\t\tb := tx.Bucket([]byte(Database))\n\n\t\tc := b.Cursor()\n\n\t\tfor k, v := c.First(); k != nil; k, v = c.Next() {\n\n\t\t\tfmt.Printf(\"key=%s, value=%s\\n\", k, v)\n\t\t}\n\n\t\treturn nil\n\t})\n\n\treturn nil\n\n}", "title": "" }, { "docid": "d1abec946967dde6e89b6bd5509fc47b", "score": "0.6653732", "text": "func (kb *Keybase) List() ([]keys.Info, error) {\n\tkb.mx.Lock()\n\tdefer kb.mx.Unlock()\n\treturn kb.kb.List()\n}", "title": "" }, { "docid": "ef89482b62d2e1e6745bc649c9b561ca", "score": "0.65206045", "text": "func (i *Instance) AllKeys() []string {\n\trows, err := i.db.Query(`SELECT key FROM config`)\n\tif err != nil {\n\t\tmultilog.Error(\"config:AllKeys query failed: %s\", errs.JoinMessage(err))\n\t\treturn nil\n\t}\n\tvar keys []string\n\tdefer rows.Close()\n\tfor rows.Next() {\n\t\tvar key string\n\t\trows.Scan(&key)\n\t\tkeys = append(keys, key)\n\t}\n\treturn keys\n}", "title": "" }, { "docid": "d8b723eb8f0bc12255ef2232215da894", "score": "0.650348", "text": "func (s *store) listAllCurrent(leaseId int64) (int64, []types.Record, error) {\n\n\tf := filterutils.NewFilter()\n\tif leaseId == 0 {\n\t\t// rKey == current && revision\n\t\t// This query returns only row entities\n\t\tf.And(\n\t\t\tfilterutils.CurrentKeysOnly(),\n\t\t\tfilterutils.ExcludeEvents(),\n\t\t\tfilterutils.ExcludeSysRecords(),\n\t\t)\n\t} else {\n\t\tf.And(\n\t\t\tfilterutils.CurrentKeysOnly(),\n\t\t\tfilterutils.ExcludeEvents(),\n\t\t\tfilterutils.ExcludeSysRecords(),\n\t\t\tfilterutils.WithLease(fmt.Sprintf(\"%v\", leaseId)),\n\t\t)\n\t}\n\n\to := &storage.QueryOptions{\n\t\tFilter: f.Generate(),\n\t}\n\n\tkeptEntities := []*storage.Entity{}\n\n\tbookKeepingFunc := func(entities []*storage.Entity) {\n\t\tkeptEntities = append(keptEntities, entities...)\n\t}\n\n\tentitiesToRecordsFunc := func() ([]types.Record, error) {\n\t\trecords := make([]types.Record, 0, len(keptEntities))\n\t\tfor _, e := range keptEntities {\n\t\t\trecord, _, err := s.GetIfNeeded(e, true)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\trecords = append(records, record)\n\t\t}\n\t\treturn records, nil\n\t}\n\n\trecords, err := s.execQuery(o, storage.MinimalMetadata, bookKeepingFunc, entitiesToRecordsFunc)\n\tif err != nil {\n\t\treturn 0, nil, err\n\t}\n\tcurrentRev, err := s.rev.Current()\n\tif err != nil {\n\t\treturn 0, nil, err\n\t}\n\n\treturn currentRev, records, nil\n}", "title": "" }, { "docid": "6e5d1badc070b63cad75e16ddf726747", "score": "0.64769644", "text": "func (tcdb *Teocdb) List(key string) (keyList cdb.KeyList, err error) {\n\tvar keyOut string\n\titer := tcdb.session.Query(`\n\t\tSELECT key FROM map WHERE key >= ? and key < ?\n\t\tALLOW FILTERING`,\n\t\tkey, key+\"a\").Iter()\n\tfor iter.Scan(&keyOut) {\n\t\tkeyList.Append(keyOut)\n\t}\n\treturn\n}", "title": "" }, { "docid": "6cf8f38eedc275ae141e7bd9f6d7a19c", "score": "0.6433699", "text": "func (r *reflectorStore) ListKeys() []string {\n\tpanic(\"not implemented\")\n}", "title": "" }, { "docid": "dffd9fa9f9c3bcca079d759096926f5c", "score": "0.6239647", "text": "func LKEYS() []string {\n\treturn globalListCache.keys()\n}", "title": "" }, { "docid": "50518637425a3cd27fec05bcf4211149", "score": "0.6213953", "text": "func (s *DNSControllerScope) AllKeys() []string {\n\ts.mutex.Lock()\n\tdefer s.mutex.Unlock()\n\n\tvar keys []string\n\tfor k := range s.Records {\n\t\tkeys = append(keys, k)\n\t}\n\treturn keys\n}", "title": "" }, { "docid": "788dde17e03dc9e7d347541bccb85a88", "score": "0.61770064", "text": "func (k *KeyStore) List() []string {\n\tvar keys []string\n\tfor k := range k.Values {\n\t\tkeys = append(keys, k)\n\t}\n\treturn keys\n}", "title": "" }, { "docid": "1e11d7d4a6a094ba981c019eb43040e9", "score": "0.6141636", "text": "func (ts *TranslationService) AllTranslationKeys(localeCode string) []string {\n\tts.reloadFilesIfNecessary()\n\treturn ts.i18bundle.LanguageTranslationIDs(localeCode)\n}", "title": "" }, { "docid": "9f19a3c65323e9ca58e2bf22e39bc085", "score": "0.61286855", "text": "func (b LocalInterface) List() [][]byte {\n\tkeys := [][]byte{}\n\tb.View(func(tx *bolt.Tx) error {\n\t\ttx.Bucket(b.Bucket).\n\t\t\tForEach(func(k, v []byte) error {\n\t\t\t\tkeys = append(keys, k)\n\t\t\t\treturn nil\n\t\t\t})\n\t\treturn nil\n\t})\n\treturn keys\n}", "title": "" }, { "docid": "86f018ebbbd0189919a6813fba3e0996", "score": "0.6096871", "text": "func (c *ConsulClient) ListKeys(ctx context.Context, key string) ([]string, error) {\n\tspan, ctx := opentracing.StartSpanFromContext(ctx, \"ConsulClient.ListKeys\")\n\tdefer span.Finish()\n\n\tregistryOperationCount.WithLabelValues(env, \"ListKeys\").Inc()\n\n\tstartTime := time.Now()\n\tdefer func() {\n\t\tregistryOperationTimeTaken.WithLabelValues(env, \"ListKeys\").Observe(time.Now().Sub(startTime).Seconds())\n\t}()\n\n\tkv, _, err := c.client.KV().List(key, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tkeys := []string{}\n\n\tfor _, pair := range kv {\n\t\tkeys = append(keys, pair.Key)\n\t}\n\n\treturn keys, nil\n}", "title": "" }, { "docid": "e1376dd649e458f8b53ec659679ea0e2", "score": "0.6018232", "text": "func (db *MongoDB) ListAPIKeys() ([]APIKey, error) {\n\tcur, err := db.instance.Collection(keyCollection).Find(context.Background(), bson.D{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer db.safeClose(cur)\n\tvar apiKeys []APIKey\n\tfor cur.Next(context.Background()) {\n\t\tvar result APIKey\n\t\tif err := cur.Decode(&result); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tapiKeys = append(apiKeys, result)\n\t\tKnownAPIKeys.Store(result.Key, result.Label) // update cache\n\t\tif result.Admin {\n\t\t\tKnownAdminAPIKeys.Store(result.Key, result.Label) // update cache\n\t\t}\n\t}\n\treturn apiKeys, nil\n}", "title": "" }, { "docid": "4e4a506d02af3c904a6a525ac47f356c", "score": "0.59750247", "text": "func (r *FileSSLKeyResource) ListAll() (*FileSSLKeyConfigList, error) {\n\tvar list FileSSLKeyConfigList\n\tif err := r.c.ReadQuery(BasePath+FileSSLKeyEndpoint, &list); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &list, nil\n}", "title": "" }, { "docid": "6d3b3e04571c3955bf4c853d12b55a15", "score": "0.5965487", "text": "func (ec *EtcdClient) List(prefix string) (keys []string, err error) {\n\tctx, cancel := ec.context()\n\tdefer cancel()\n\tresp, err := ec.c.Get(ctx, prefix, clientv3.WithPrefix())\n\tif err != nil {\n\t\treturn\n\t}\n\tkeys = make([]string, len(resp.Kvs))\n\tfor index, item := range resp.Kvs {\n\t\tkeys[index] = string(item.Key)\n\t}\n\treturn\n}", "title": "" }, { "docid": "29b958eaf57ae83b41d54c5eee16468d", "score": "0.5956465", "text": "func (s *keyVaultKeyLister) List(selector labels.Selector) (ret []*v1alpha1.KeyVaultKey, err error) {\n\terr = cache.ListAll(s.indexer, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1alpha1.KeyVaultKey))\n\t})\n\treturn ret, err\n}", "title": "" }, { "docid": "cb16ecd0c37be174ff6e902d8cbd42be", "score": "0.594951", "text": "func AllKeys() Subspace {\n\treturn subspace{}\n}", "title": "" }, { "docid": "af755e3d4fd6d7e065aa3a9955d632b0", "score": "0.5900791", "text": "func (m *PooledWrapper) AllKeyIds() []string {\n\tm.m.RLock()\n\tdefer m.m.RUnlock()\n\n\tkeys := make([]string, 0, len(m.wrappers)-1)\n\tfor k := range m.wrappers {\n\t\tif k == BaseEncryptor {\n\t\t\tcontinue\n\t\t}\n\t\tkeys = append(keys, k)\n\t}\n\tsort.Strings(keys)\n\treturn keys\n}", "title": "" }, { "docid": "4332abac229f3b40780d28aa1c185cb2", "score": "0.5882312", "text": "func (store KeyValue) list() (keys []DatabaseKey) {\n\tswitch store.Type {\n\n\tcase PERSISTENT:\n\t\t//store.tree.\n\t\tsize := store.tree.Size()\n\t\tresults := make([]DatabaseKey, size, size)\n\t\tfor i := 0; i < store.tree.Size(); i++ {\n\t\t\tkey, _ := store.tree.GetByIndex(i)\n\t\t\tresults[i] = DatabaseKey(key)\n\t\t}\n\t\treturn results\n\n\tdefault:\n\t\tpanic(\"Invalid Op\")\n\t}\n}", "title": "" }, { "docid": "d1b92e1569ea5e87ef645251aced4833", "score": "0.58815205", "text": "func (km *Keystore) List() ([]string, error) {\n\tentries, err := km.ds.Query(query.Query{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tkeys, err := entries.Rest()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar ids []string\n\tfor _, v := range keys {\n\t\tids = append(ids, strings.Split(v.Key, \"/\")[1])\n\t}\n\treturn ids, nil\n}", "title": "" }, { "docid": "904d4a7fa88836e59ba171d865ceca79", "score": "0.5768907", "text": "func (s *SyncStorage) ListKeys(ns string, pattern string) ([]string, error) {\n\tnsPrefix := getNsPrefix(ns)\n\tnsKeys, err := s.getDbBackend(ns).Keys(nsPrefix + pattern)\n\tvar keys []string\n\tif err != nil {\n\t\treturn keys, err\n\t}\n\tfor _, key := range nsKeys {\n\t\tkeys = append(keys, strings.Split(key, nsPrefix)[1])\n\t}\n\treturn keys, err\n}", "title": "" }, { "docid": "d73b0a22c1dfb1f870f47bc3c24f36aa", "score": "0.57623404", "text": "func (s *CRDBStorage) List(prefix string, recursive bool) ([]string, error) {\n\tif recursive {\n\t\treturn nil, fmt.Errorf(\"recursive is not supported in this storage implementation\")\n\t}\n\tctx, cancel := context.WithTimeout(context.Background(), defaultQueryTimeout)\n\tdefer cancel()\n\trows, err := s.DB.QueryContext(ctx, `select \"key\" from certmagic_values where \"key\" like $1 order by \"key\"`, prefix+\"%\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar keys []string\n\tfor rows.Next() {\n\t\tvar key string\n\t\tif err := rows.Scan(&key); err != nil {\n\t\t\tbreak\n\t\t}\n\t\tkeys = append(keys, key)\n\t}\n\tif err := rows.Close(); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := rows.Err(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn keys, nil\n}", "title": "" }, { "docid": "8b6bdbb20115bef2d3123c2af52ed004", "score": "0.5759452", "text": "func (ns *Namespace) ListKeys() []string {\n\tkeys := make([]string, len(ns.ns))\n\tidx := 0\n\tfor k, _ := range ns.ns {\n\t\tkeys[idx] = k\n\t\tidx += 1\n\t}\n\treturn keys\n}", "title": "" }, { "docid": "29c1dd8d4ad84f8a015b805acda9dd25", "score": "0.5757774", "text": "func (defaultStorage) GetKeyList(section string) []string {\n\tpanic(noConfigStorage)\n}", "title": "" }, { "docid": "ff14ed5f439bab012573dd3b59b01572", "score": "0.57281566", "text": "func (s *collectorCache) ListKeys() []string {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\tkeys := make([]string, 0, len(s.collectorMap))\n\tfor k := range s.collectorMap {\n\t\tkeys = append(keys, k)\n\t}\n\treturn keys\n}", "title": "" }, { "docid": "53e0cc18e9e05707aac52d5512c12f42", "score": "0.5714343", "text": "func (cf *Info) GetAllKeys() []string {\n\tkeys := []string{}\n\tfor key := range cf.objInfo {\n\t\tkeys = append(keys, key)\n\t}\n\n\tsort.Strings(keys)\n\treturn keys\n}", "title": "" }, { "docid": "7adef0089d0e39bcdd1219938148e0ce", "score": "0.56849915", "text": "func (s *EtcdStorage) List(ctx context.Context, prefix string) ([]string, error) {\n\tif !strings.HasSuffix(prefix, \"/\") {\n\t\tprefix += \"/\"\n\t}\n\n\tresp, err := s.c.Get(ctx, prefix, etcdclient.WithPrefix())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tkeys := map[string]struct{}{}\n\tfor _, kv := range resp.Kvs {\n\t\tkey := string(kv.Key)\n\n\t\tif strings.HasPrefix(key, prefix) {\n\t\t\tkey = strings.TrimPrefix(key, prefix)\n\t\t\tif len(key) == 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif i := strings.Index(key, \"/\"); i == -1 {\n\t\t\t\tkeys[key] = struct{}{}\n\t\t\t} else {\n\t\t\t\tkeys[key[:i+1]] = struct{}{}\n\t\t\t}\n\t\t}\n\t}\n\n\tkeysList := make([]string, len(keys))\n\ti := 0\n\tfor key := range keys {\n\t\tkeysList[i] = key\n\t\ti++\n\t}\n\n\tsort.Strings(keysList)\n\n\treturn keysList, nil\n}", "title": "" }, { "docid": "61451283f36b595e6c25893c30893c76", "score": "0.5682436", "text": "func (k *FileKeystore) List() ([]string, error) {\n\tk.RLock()\n\tdefer k.RUnlock()\n\n\tkeys := make([]string, 0, len(k.secrets))\n\tfor key := range k.secrets {\n\t\tkeys = append(keys, key)\n\t}\n\n\treturn keys, nil\n}", "title": "" }, { "docid": "9afa58faf21431e05c9072c800381b51", "score": "0.5682041", "text": "func (s *Store) List(_ context.Context, start string, f func(string) error) error {\n\troots, err := listdir(s.dir)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, root := range roots {\n\t\tkeys, err := listdir(filepath.Join(s.dir, root))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, tail := range keys {\n\t\t\tkey, err := decodeKey(root + tail)\n\t\t\tif err != nil || key < start {\n\t\t\t\tcontinue // skip non-key files and keys prior to the start\n\t\t\t} else if err := f(key); errors.Is(err, blob.ErrStopListing) {\n\t\t\t\treturn nil\n\t\t\t} else if err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "00ecaaa8df92e1807b31630277b64f67", "score": "0.56748384", "text": "func (mgr *LocalHashMapDBMgr) LogAllKeys() {\n\tfor k, e := range mgr.memMap {\n\t\tglog.Infof(\"%v: %v\", k, e)\n\t}\n}", "title": "" }, { "docid": "9dc0f88fe5e40723c21ee908ace41f7d", "score": "0.5664417", "text": "func (c *Client) List(prefix string) ([]*store.KVPair, error) {\n\treq := &api.Request{\n\t\tAction: api.List,\n\t\tKey: prefix,\n\t}\n\n\tres, err := c.do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar ls []*store.KVPair\n\tfor _, kv := range res.List {\n\t\tls = append(ls, kvToLibKV(kv))\n\t}\n\tif len(ls) == 0 {\n\t\treturn nil, store.ErrKeyNotFound\n\t}\n\n\treturn ls, nil\n}", "title": "" }, { "docid": "e10425f06571e0929b2f61c0b001884e", "score": "0.56489164", "text": "func (c BasicController) GetAllServiceKeys() []string {\n\treturn c.serviceRepo.GetAllServiceKeys()\n}", "title": "" }, { "docid": "fbf218959ea95f8fa81a470bbf455903", "score": "0.56449544", "text": "func (mod Mod) All() []string {\n\tall := make(map[string]bool)\n\tfor _, p := range mod.Changed {\n\t\tall[p] = true\n\t}\n\tfor _, p := range mod.Added {\n\t\tall[p] = true\n\t}\n\treturn _keys(all)\n}", "title": "" }, { "docid": "fbf218959ea95f8fa81a470bbf455903", "score": "0.56449544", "text": "func (mod Mod) All() []string {\n\tall := make(map[string]bool)\n\tfor _, p := range mod.Changed {\n\t\tall[p] = true\n\t}\n\tfor _, p := range mod.Added {\n\t\tall[p] = true\n\t}\n\treturn _keys(all)\n}", "title": "" }, { "docid": "5d51d811b7b15fe9f7f87776d1420c32", "score": "0.5642517", "text": "func (c *Config) List(name string) (keys []string, err error) {\n\tconfigDir, err := c.configDirectory()\n\tif err != nil {\n\t\treturn\n\t}\n\tdir := path.Join(configDir, name)\n\tfiles, err := ioutil.ReadDir(dir)\n\tif err != nil {\n\t\treturn\n\t}\n\tfor _, file := range files {\n\t\tkeys = append(keys, file.Name())\n\t}\n\tsort.Strings(keys)\n\treturn\n}", "title": "" }, { "docid": "1dc92ccfbc17bffa45d77f074253c4c5", "score": "0.5641444", "text": "func (ks *VRF) ListKeys() (publicKeys []*secp256k1.PublicKey, err error) {\n\tenc, err := ks.Get()\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"while listing db keys\")\n\t}\n\tfor _, enckey := range enc {\n\t\tpublicKeys = append(publicKeys, &enckey.PublicKey)\n\t}\n\treturn publicKeys, nil\n}", "title": "" }, { "docid": "bc76be1c5ce7e86e8276d9fed3b4238d", "score": "0.5618226", "text": "func (rs *RatchetServer) GetKeys() []byte {\n\t// Separate all memory.\n\tkl := make([]byte, len(rs.keylist))\n\tcopy(kl, rs.keylist)\n\treturn kl\n}", "title": "" }, { "docid": "219f2d32d5cb6a32e091103684a92d2e", "score": "0.5617674", "text": "func (v *Vault) ListTransitKeys() {\n\td, err := v.Client.Logical().List(\"transit/keys\")\n\tif err != nil {\n\t\tlog.Fatalf(\"Vault error: %v\", err)\n\t}\n\n\tif d != nil {\n\t\ttable := tablewriter.NewWriter(os.Stdout)\n\t\ttable.SetHeader([]string{\"Key\"})\n\t\tfor _, l := range d.Data[\"keys\"].([]interface{}) {\n\t\t\ttable.Append([]string{l.(string)})\n\t\t}\n\t\ttable.Render()\n\t}\n}", "title": "" }, { "docid": "ea760794d38e02a1b0e8251507741511", "score": "0.56165415", "text": "func (c *KeysClient) List(ctx context.Context, _ *ListKeysInput) ([]*Key, error) {\n\tfullPath := path.Join(\"/\", c.client.AccountName, \"keys\")\n\treqInputs := client.RequestInput{\n\t\tMethod: http.MethodGet,\n\t\tPath: fullPath,\n\t}\n\trespReader, err := c.client.ExecuteRequest(ctx, reqInputs)\n\tif respReader != nil {\n\t\tdefer respReader.Close()\n\t}\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"unable to list keys\")\n\t}\n\n\tvar result []*Key\n\tdecoder := json.NewDecoder(respReader)\n\tif err = decoder.Decode(&result); err != nil {\n\t\treturn nil, errors.Wrap(err, \"unable to decode list keys response\")\n\t}\n\n\treturn result, nil\n}", "title": "" }, { "docid": "36ded31bc87995579d03ea38ad2b439f", "score": "0.55998576", "text": "func (s keyVaultKeyNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.KeyVaultKey, err error) {\n\terr = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1alpha1.KeyVaultKey))\n\t})\n\treturn ret, err\n}", "title": "" }, { "docid": "0202c530d81722b239973220026659f0", "score": "0.55887914", "text": "func (d DBase) Keys(table string) []string {\n\tkeylist, err := d.Store.Keys(table)\n\tCritical(err)\n\treturn keylist\n}", "title": "" }, { "docid": "293580ab6f496da90d73cfa367e8b024", "score": "0.55733037", "text": "func (s *Store) GetKeys() (keyList []string) {\r\n\tif s.parent != nil {\r\n\t\tkeyList = s.parent.GetKeys()\r\n\t} else {\r\n\t\tkeyList = make([]string, 0)\r\n\t}\r\n\r\n\tfor key := range s.store {\r\n\t\tif !utils.Contains(keyList, key) {\r\n\t\t\tkeyList = append(keyList, key)\r\n\t\t}\r\n\t}\r\n\r\n\tsort.Strings(keyList)\r\n\r\n\treturn keyList\r\n}", "title": "" }, { "docid": "20067407638193e3c3911ea47fa43e31", "score": "0.55686945", "text": "func (s *ProjectKeyService) List(organizationSlug string, projectSlug string) ([]ProjectKey, *http.Response, error) {\n\tprojectKeys := new([]ProjectKey)\n\tapiError := new(APIError)\n\tresp, err := s.sling.New().Get(\"projects/\"+organizationSlug+\"/\"+projectSlug+\"/keys/\").Receive(projectKeys, apiError)\n\treturn *projectKeys, resp, relevantError(err, *apiError)\n}", "title": "" }, { "docid": "d002c9c164de8046a9c786043a6c5638", "score": "0.55684954", "text": "func (cs ConsulStorage) List(ctx context.Context, prefix string, recursive bool) ([]string, error) {\n\tvar keysFound []string\n\n\t// get a list of all keys at prefix\n\tkeys, _, err := cs.ConsulClient.KV().Keys(cs.prefixKey(prefix), \"\", ConsulQueryDefaults(ctx))\n\tif err != nil {\n\t\treturn keysFound, err\n\t}\n\n\tif len(keys) == 0 {\n\t\treturn keysFound, fs.ErrNotExist\n\t}\n\n\t// remove default prefix from keys\n\tfor _, key := range keys {\n\t\tif strings.HasPrefix(key, cs.prefixKey(prefix)) {\n\t\t\tkey = strings.TrimPrefix(key, cs.Prefix+\"/\")\n\t\t\tkeysFound = append(keysFound, key)\n\t\t}\n\t}\n\n\t// if recursive wanted, just return all keys\n\tif recursive {\n\t\treturn keysFound, nil\n\t}\n\n\t// for non-recursive split path and look for unique keys just under given prefix\n\tkeysMap := make(map[string]bool)\n\tfor _, key := range keysFound {\n\t\tdir := strings.Split(strings.TrimPrefix(key, prefix+\"/\"), \"/\")\n\t\tkeysMap[dir[0]] = true\n\t}\n\n\tkeysFound = make([]string, 0)\n\tfor key := range keysMap {\n\t\tkeysFound = append(keysFound, path.Join(prefix, key))\n\t}\n\n\treturn keysFound, nil\n}", "title": "" }, { "docid": "89296708b1ae12d2939046090686cde3", "score": "0.5563658", "text": "func Keys() ([]interface{}, error) {\n\treturn defaultCache.Keys()\n}", "title": "" }, { "docid": "4a81e5c65bd0d651482520bb6fdd770c", "score": "0.555852", "text": "func (c *cache) List() []string {\n\tnames := make([]string, len(c.items))\n\n\ti := 0\n\tfor key := range c.items {\n\t\tnames[i] = key\n\t\ti ++\n\t}\n\n\treturn names\n}", "title": "" }, { "docid": "290b3579703a8d4c851b2faa7442d38b", "score": "0.55503535", "text": "func List(ctx context.Context, key string) ([]*mvccpb.KeyValue, int64, error) {\n\tresp, err := Instance().Do(ctx, GET, WithStrKey(key), WithPrefix())\n\tif err != nil {\n\t\treturn nil, 0, err\n\t}\n\treturn resp.Kvs, resp.Count, nil\n}", "title": "" }, { "docid": "52b7f5e2edb6eeff2ab1335acb8e79f5", "score": "0.553763", "text": "func (c *Cache) GetAllKeys() []string {\n\tkeys := make([]string, 0, len(c.cacheByKey))\n\n\tfor k := range c.cacheByKey {\n\t\tkeys = append(keys, k)\n\t}\n\n\treturn keys\n}", "title": "" }, { "docid": "91f2915e2ca36b1b7b78ab7f5913132f", "score": "0.5526464", "text": "func (store KeyValue) FindAll() []DatabaseKey {\n\treturn store.list()\n}", "title": "" }, { "docid": "442973dd29515fceadd63a9df091ce93", "score": "0.55210066", "text": "func (d *Driver) getKeys(ctx context.Context, prefix string, sortResults bool) ([]string, error) {\n\twatcher, err := d.kv.Watch(prefix, nats.MetaOnly(), nats.IgnoreDeletes(), nats.Context(ctx))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer func() {\n\t\terr := watcher.Stop()\n\t\tif err != nil {\n\t\t\tlogrus.Warnf(\"failed to stop %s getKeys watcher\", prefix)\n\t\t}\n\t}()\n\n\tvar keys []string\n\t// grab all matching keys immediately\n\tfor entry := range watcher.Updates() {\n\t\tif entry == nil {\n\t\t\tbreak\n\t\t}\n\t\tkeys = append(keys, entry.Key())\n\t}\n\n\tif sortResults {\n\t\tsort.Strings(keys)\n\t}\n\n\treturn keys, nil\n}", "title": "" }, { "docid": "c1fd8f4cf2b8b2972357532b81d48606", "score": "0.551287", "text": "func PrintAll(c config.Config) error {\n\tlog.Info(\"Opening session for all entries in vault\")\n\tcleartextValues, err := decryptVault(c)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tmenuItems := []string{}\n\tfor key := range cleartextValues {\n\t\tmenuItems = append(menuItems, key)\n\t}\n\n\tprintWithMenu(menuItems, cleartextValues, c.DecryptSessionTimeout)\n\treturn nil\n}", "title": "" }, { "docid": "99ec3290f5e8c1e15e130ab975dee16b", "score": "0.5510338", "text": "func (ks *VRF) ListKeysIncludingArchived() (publicKeys []*secp256k1.PublicKey, err error) {\n\tallKeys, err := ks.orm.FindEncryptedSecretVRFKeysIncludingArchived()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, enckey := range allKeys {\n\t\tpublicKeys = append(publicKeys, &enckey.PublicKey)\n\t}\n\treturn publicKeys, nil\n}", "title": "" }, { "docid": "8ac5a1cc9ba16857bd4f01e42885485b", "score": "0.55064845", "text": "func (g *Graph) listOfKeys() []string {\n\tkeys := make([]string, len(g.Nodes))\n\ti := 0\n\n\tfor k := range g.Nodes {\n\t\tkeys[i] = k\n\t\ti++\n\t}\n\n\treturn keys\n}", "title": "" }, { "docid": "d9168df6aa9908c04826756d89e3901c", "score": "0.54986346", "text": "func (db *memorydb) IterKeys(ctx context.Context) <-chan []byte {\n\tkeys := db.Keys()\n\n\tout := make(chan []byte)\n\tgo func() {\n\t\tdefer close(out)\n\n\t\tfor _, k := range keys {\n\t\t\tselect {\n\t\t\tcase <-ctx.Done():\n\t\t\t\treturn\n\t\t\tcase out <- k:\n\t\t\t}\n\t\t}\n\t}()\n\treturn out\n}", "title": "" }, { "docid": "f7a5318c2e505f530781714f9efdc792", "score": "0.54968005", "text": "func (db *DB) List(key string) ([]string, error) {\n\treturn TreeList(db.repo, db.tree, path.Join(db.scope, key))\n}", "title": "" }, { "docid": "89142ae833fdaa6b9f5bf8bce3369347", "score": "0.54964715", "text": "func (strg *Storage) All() (map[storage.Key]*storage.Value, error) {\n\tstrg.mu.RLock()\n\tdefer strg.mu.RUnlock()\n\treturn strg.items, nil\n}", "title": "" }, { "docid": "4ab8749c762c8197f24b25a2c31bb167", "score": "0.54964656", "text": "func (gtk KeywordedGenericTypeKeeper[T]) GetAll(ctx sdk.Context) (all []T) {\n\tfor _, keyWord := range gtk.KeyWords {\n\t\tall = append(all, gtk.Get(ctx, keyWord))\n\t}\n\treturn\n}", "title": "" }, { "docid": "f8cf44d8979ea817216bf68c77c4f609", "score": "0.5481027", "text": "func (sw *scanWrap) AllWithLastEvaluatedKeyContext(ctx aws.Context, out interface{}) (dynamo.PagingKey, error) {\n\treturn sw.scan.AllWithLastEvaluatedKeyContext(ctx, out)\n}", "title": "" }, { "docid": "d61596fb1161cffe1f740d13bf4e3a30", "score": "0.5473794", "text": "func (c *KeyValueChanger) List() ([]KeyValue, error) {\n\tif c.err != nil {\n\t\treturn nil, c.err\n\t}\n\tvar list []KeyValue\n\terr := c.node.doChildren(func(cn *node) error {\n\t\tlist = append(list, KeyValue{cn.content.key().(string), cn.content.value()})\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn list, nil\n}", "title": "" }, { "docid": "e5feeb00634566c8dad79a73701e4691", "score": "0.5459814", "text": "func LoadAllKeys(ctx context.Context, db gorp.SqlExecutor, projectID int64) ([]sdk.ProjectKey, error) {\n\tquery := gorpmapping.NewQuery(`\n\t\tSELECT *\n\t\tFROM project_key\n\t\tWHERE project_id = $1\n\t\tAND builtin = false\n\t`).Args(projectID)\n\n\treturn getAllKeys(ctx, db, query)\n}", "title": "" }, { "docid": "14485381af076a74f74371d77668191e", "score": "0.5439957", "text": "func (c DirCollector) Keys() []string {\n\tvar keys []string\n\tc.Each(func(_ *VDir, k string, _ func()) {\n\t\tkeys = append(keys, k)\n\t})\n\treturn keys\n}", "title": "" }, { "docid": "accdd5c5d1fab1b06a9d0da81928c43d", "score": "0.5439606", "text": "func (session KeyValueSession) FindAll() []DatabaseKey {\n\treturn session.store.list()\n}", "title": "" }, { "docid": "daafde7ab3da91211b6975ef34226234", "score": "0.5438305", "text": "func (c *AdapterMemory) Keys(ctx context.Context) ([]interface{}, error) {\n\treturn c.data.Keys()\n}", "title": "" }, { "docid": "32e7b3aae410905ede43b28388d63555", "score": "0.54357404", "text": "func (lmem *lockedMemRepo) List() ([]string, error) {\n\tif err := lmem.checkToken(); err != nil {\n\t\treturn nil, err\n\t}\n\tlmem.RLock()\n\tdefer lmem.RUnlock()\n\n\tres := make([]string, 0, len(lmem.mem.keystore))\n\tfor k := range lmem.mem.keystore {\n\t\tres = append(res, k)\n\t}\n\treturn res, nil\n}", "title": "" }, { "docid": "001c3f93bf380cb978d296b2df75c7fa", "score": "0.5433592", "text": "func (k *KV) List(ctx context.Context, namespace, path string) ([]string, error) {\n\tpath, err := getKVPath(namespace, path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn k.b.List(ctx, path)\n}", "title": "" }, { "docid": "15ee9dac0e49d7dbf443606116c2f836", "score": "0.54274666", "text": "func (s *Settings) GetAllKeys() ([]string, error) {\n\tif s.Error != nil {\n\t\treturn nil, fmt.Errorf(\"settings.GetAllKeys :: %s\", s.Error)\n\t}\n\treturn s.Data.AllKeys(), nil\n}", "title": "" }, { "docid": "59d378d623b9b07b15f65336c8716bb3", "score": "0.5423981", "text": "func List() []string {\n\tkeys := []string{}\n\tfor k := range actions {\n\t\tkeys = append(keys, k)\n\t}\n\treturn keys\n}", "title": "" }, { "docid": "82586acc2d323765f0e1933cd741931a", "score": "0.54185987", "text": "func (c *KeyStringValueChanger) List() ([]KeyStringValue, error) {\n\tif c.err != nil {\n\t\treturn nil, c.err\n\t}\n\tvar list []KeyStringValue\n\terr := c.node.doChildren(func(cn *node) error {\n\t\tlist = append(list, KeyStringValue{cn.content.key().(string), cn.content.value().(string)})\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn list, nil\n}", "title": "" }, { "docid": "966054b31cdd083661c43a53d7ce07d2", "score": "0.5410632", "text": "func (m *InmemRepository) ListAll(ctx context.Context) ([]*account.Account, error) {\n\tm.mtx.Lock()\n\tdefer m.mtx.Unlock()\n\n\t// sort map\n\tsortedKeys := make([]account.Num, 0, len(m.accounts))\n\tfor k := range m.accounts {\n\t\tsortedKeys = append(sortedKeys, k)\n\t}\n\n\tsort.Slice(sortedKeys, func(i, j int) bool {\n\t\treturn sortedKeys[i] < sortedKeys[j]\n\t})\n\n\taccounts := make([]*account.Account, 0, len(m.accounts))\n\tfor _, v := range sortedKeys {\n\t\taccounts = append(accounts, m.accounts[v])\n\t}\n\n\treturn accounts, nil\n}", "title": "" }, { "docid": "4849860299c3280e4a2181c5f45ebd9b", "score": "0.5393895", "text": "func (c *Cache) Keys() ([]interface{}, error) {\n\treturn c.adapter.Keys(c.getCtx())\n}", "title": "" }, { "docid": "6df8b34136a3f7efe623024a33246b3b", "score": "0.5391189", "text": "func (digitalocean *DigitalOcean) ListKeys() ([]godo.Key, error) {\n\topt := &godo.ListOptions{\n\t\tPage: 1,\n\t\tPerPage: 200,\n\t}\n\n\tclient, err := DigitalOceanClient()\n\n\tkeys, _, err := client.client.Keys.List(client.context, opt)\n\n\treturn keys, err\n}", "title": "" }, { "docid": "cd2f18bb43c517b552230cd3f2d143e5", "score": "0.53900504", "text": "func ListAllForPrefix(db *badger.DB, sk StorageKey, id string) ([]string, error) {\n\ttotal := make([]string, 0, 20)\n\n\tpfx := MakeKey(sk, id)\n\topts := badger.DefaultIteratorOptions\n\topts.PrefetchValues = false\n\topts.Prefix = pfx\n\terr := db.View(func(tx *badger.Txn) error {\n\t\tit := tx.NewIterator(opts)\n\t\tdefer it.Close()\n\t\tfor it.Seek(pfx); it.ValidForPrefix(pfx); it.Next() {\n\t\t\tkeybuf := it.Item().Key()\n\t\t\tk := string(keybuf[len(pfx):])\n\t\t\ttotal = append(total, string(k))\n\t\t}\n\t\treturn nil\n\t})\n\n\treturn total, err\n}", "title": "" }, { "docid": "662c2e94ad2776cbb29e0be6975ff8db", "score": "0.53893864", "text": "func (s *Store) Keys() []string {\n\ts.access.RLock()\n\tdefer s.access.RUnlock()\n\n\tcpy := make([]string, len(s.data))\n\ti := 0\n\tfor key, _ := range s.data {\n\t\tcpy[i] = key\n\t\ti++\n\t}\n\treturn cpy\n}", "title": "" }, { "docid": "064637ba13332725eb4ed5587a771f10", "score": "0.53880316", "text": "func (c *Conn) listKeys(prefix string, keyType int) ([]string, error) {\n\tkeys := []string{}\n\n\tlister := c.bucket.List(&blob.ListOptions{\n\t\tDelimiter: \"/\",\n\t\tPrefix: prefix,\n\t})\n\tfor {\n\t\tobj, err := lister.Next(c.ctx)\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t}\n\n\t\tif err != nil {\n\t\t\tc.Log.Errorf(\"Failed to get next blob err=%v\", err)\n\t\t\treturn keys, err\n\t\t}\n\n\t\tswitch keyType {\n\t\tcase ListKeyBoth:\n\t\tcase ListKeyFile:\n\t\t\tif obj.IsDir {\n\t\t\t\tcontinue\n\t\t\t}\n\t\tcase ListKeyDir:\n\t\t\tif !obj.IsDir {\n\t\t\t\tcontinue\n\t\t\t}\n\t\tdefault:\n\t\t\tc.Log.Warningf(\"Invalid keyType=%d, Ignored\", keyType)\n\t\t\tcontinue\n\t\t}\n\n\t\tkeys = append(keys, obj.Key)\n\t}\n\treturn keys, nil\n}", "title": "" }, { "docid": "cab69ed0b11f215cdc958c01cb031a6a", "score": "0.53861356", "text": "func (l *Labels) Keys() []string {\n\treturn l.keys\n}", "title": "" }, { "docid": "64e3675a7d58a016cd10e2b0e8b778fb", "score": "0.53856117", "text": "func (f *FileStore) List() ([]string, error) {\n\tkeys := make([]string, 0)\n\tfiles, err := f.filesystem.ReadDir(f.directoryPath)\n\tif err != nil {\n\t\treturn keys, err\n\t}\n\tfor _, f := range files {\n\t\tif !strings.HasPrefix(f.Name(), tmpPrefix) {\n\t\t\tkeys = append(keys, f.Name())\n\t\t}\n\t}\n\treturn keys, nil\n}", "title": "" }, { "docid": "8f11c01857467b2921c87916a056c235", "score": "0.5384477", "text": "func (q apiKeyQuery) All() (APIKeySlice, error) {\n\tvar o []*APIKey\n\n\terr := q.Bind(&o)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"models: failed to assign all query results to APIKey slice\")\n\t}\n\n\tif len(apiKeyAfterSelectHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterSelectHooks(queries.GetExecutor(q.Query)); err != nil {\n\t\t\t\treturn o, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn o, nil\n}", "title": "" }, { "docid": "06e0bb5911ba75d0a7f3d8990e946a4e", "score": "0.53839093", "text": "func (fs *FileStore) Keys() []string {\n\ts := fs.getDirContents(\"\")\n\tsort.Strings(s)\n\treturn s\n}", "title": "" }, { "docid": "a83a8bbf301e2c169c02574b7f5718b6", "score": "0.53798044", "text": "func (c *LRUCache) PrintAll() {\n\tc.mutex.RLock()\n\tdefer c.mutex.RUnlock()\n\tfor e := c.cacheList.Front(); e != nil; e = e.Next() {\n\t\tfmt.Printf(\"[%v, %v] \", e.Value.(*entry).key, e.Value.(*entry).value)\n\t}\n\tfmt.Println()\n\treturn\n}", "title": "" }, { "docid": "396d71153a937e8b331d6f7f4017e84f", "score": "0.5377992", "text": "func (p *Provider) ListKeysWithContext(ctx context.Context, dir string, recursive bool) ([]*provider.KVPair, error) {\n\treturn p.listWithContext(ctx, dir, recursive, nil, nil)\n}", "title": "" }, { "docid": "39e690a31f3edb966a4a12623027fdad", "score": "0.5377224", "text": "func (obj *StringMap) Keys() *StringList {\n\tproxyResult := /*pr4*/ C.vssc_string_map_keys(obj.cCtx)\n\n\truntime.KeepAlive(obj)\n\n\treturn NewStringListWithCtx(unsafe.Pointer(proxyResult)) /* r6 */\n}", "title": "" }, { "docid": "49b80adae7b2071a6e5efa6f2c38412f", "score": "0.5374038", "text": "func (bd BoltDB) All(bucket, offset string, limit int) []string {\n\t//Negative numbers defaults to MAX_LIMIT too.\n\tif limit <= 0 {\n\t\tlimit = LIMIT\n\t}\n\t// string array to copy all keys\n\tdata := make([]string, 0)\n\tbd.db.View(func(tx *bolt.Tx) error {\n\t\tb := tx.Bucket([]byte(bucket))\n\t\tc := b.Cursor()\n\n\t\t// If offset exists we Seek for the key and start there, first item otherwise\n\t\tstart, _ := c.First()\n\t\tif offset != \"\" {\n\t\t\tstart, _ = c.Seek([]byte(offset))\n\t\t}\n\n\t\tfor k := start; k != nil; k, _ = c.Next() {\n\t\t\tdata = append(data, string(k))\n\t\t\tif len(data) == limit {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\treturn nil\n\t})\n\treturn data\n}", "title": "" }, { "docid": "3dee31a5af83553a0cfa7ec77b05509f", "score": "0.5372316", "text": "func GetKeys(c *gin.Context) {\n\tstore := c.MustGet(\"store\").(*Store)\n\n\tc.JSON(http.StatusOK, store.Keys())\n}", "title": "" }, { "docid": "ddb2d1435aa5f7a044b411e8964c40b8", "score": "0.537153", "text": "func skykeylistcmd() {\n\tskykeysString, err := skykeyListKeys(httpClient, skykeyShowPrivateKeys)\n\tif err != nil {\n\t\tdie(\"Failed to get all skykeys:\", err)\n\t}\n\tfmt.Print(skykeysString)\n}", "title": "" }, { "docid": "067d0467ff91c57b0144d91ee45d1b3f", "score": "0.53709304", "text": "func (s *V3Backend) List(ctx context.Context, key string) ([]args.Pair, error) {\n\tresp, err := s.Client.Get(ctx, key, etcd.WithPrefix())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(resp.Kvs) == 0 {\n\t\treturn nil, errors.New(fmt.Sprintf(\"'%s' not found\", key))\n\t}\n\tresult := make([]args.Pair, 0)\n\tfor _, node := range resp.Kvs {\n\t\tresult = append(result, args.Pair{Key: string(node.Key), Value: node.Value})\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "6f020ac6cdf11850b1dffd9899c4028e", "score": "0.53687143", "text": "func (rpcMethod *RPCMethod) listKeys(response *ResponseParameters) error {\n\n\t//open a read transaction\n\trpcMethod.rpcServer.boltDB.View(func(tx *bolt.Tx) error {\n\t\tvar cursor *bolt.Cursor\n\t\tcursor = tx.Cursor()\n\n\t\t//append to reselt the list of buckets\n\t\tresponse.Result = make([]interface{}, 0, 10)\n\t\tfor k, _ := cursor.First(); k != nil; k, _ = cursor.Next() {\n\t\t\trpcMethod.rpcServer.logger.Println(\"BUCKET \", string(k))\n\t\t\tresponse.Result = append(response.Result, string(k))\n\t\t}\n\n\t\treturn nil\n\t})\n\n\tresponse.Error = nil\n\n\treturn nil\n\n}", "title": "" }, { "docid": "6f020ac6cdf11850b1dffd9899c4028e", "score": "0.53687143", "text": "func (rpcMethod *RPCMethod) listKeys(response *ResponseParameters) error {\n\n\t//open a read transaction\n\trpcMethod.rpcServer.boltDB.View(func(tx *bolt.Tx) error {\n\t\tvar cursor *bolt.Cursor\n\t\tcursor = tx.Cursor()\n\n\t\t//append to reselt the list of buckets\n\t\tresponse.Result = make([]interface{}, 0, 10)\n\t\tfor k, _ := cursor.First(); k != nil; k, _ = cursor.Next() {\n\t\t\trpcMethod.rpcServer.logger.Println(\"BUCKET \", string(k))\n\t\t\tresponse.Result = append(response.Result, string(k))\n\t\t}\n\n\t\treturn nil\n\t})\n\n\tresponse.Error = nil\n\n\treturn nil\n\n}", "title": "" }, { "docid": "db7020f97aaee1589771f6bc60a23764", "score": "0.5368118", "text": "func (c *SyncCollector) Keys() []string {\n\tvar keys []string\n\tc.Each(func(_ interface{}, k string, _ func()) {\n\t\tkeys = append(keys, k)\n\t})\n\treturn keys\n}", "title": "" }, { "docid": "815030ba50923c546d0c34fd4460bcff", "score": "0.53594023", "text": "func (kc KVSClient) ListKeys(ctx context.Context, key string) (res responses.KeysResponse, err errors.EdgeX) {\n\tpath := utils.EscapeAndJoinPath(common.ApiKVSRoute, common.Key, key)\n\tqueryParams := url.Values{}\n\tqueryParams.Set(common.KeyOnly, common.ValueTrue)\n\terr = utils.GetRequest(ctx, &res, kc.baseUrl, path, queryParams)\n\tif err != nil {\n\t\treturn res, errors.NewCommonEdgeXWrapper(err)\n\t}\n\treturn res, nil\n}", "title": "" }, { "docid": "c00d561828191b0e675b11a26d2da16e", "score": "0.53489214", "text": "func ListKeys(ctx context.Context, accountName string) (documentdb.DatabaseAccountListKeysResult, error) {\n\tdbAccountClient := getDatabaseAccountClient()\n\treturn dbAccountClient.ListKeys(ctx, config.GroupName(), accountName)\n}", "title": "" }, { "docid": "a6cebede7c9ee50a0410f261df820297", "score": "0.5346617", "text": "func getKeys() []string {\n\tvar pressed = []string{}\n\tfor key, name := range keyNames {\n\t\tif ebiten.IsKeyPressed(key) {\n\t\t\tpressed = append(pressed, name)\n\t\t}\n\t}\n\treturn pressed\n}", "title": "" }, { "docid": "b3c9824e4cdd3dd7f9eaaf6efcfe2ab5", "score": "0.5333201", "text": "func ( handle * MemcacheClient) GetAllKey( ) ([]string ,error){\n\treturn nil,nil\n}", "title": "" }, { "docid": "8ddb733812782893ef140e5f41ca8040", "score": "0.5330433", "text": "func (c *ConsulDB) ReadAll(prefix string) ([]string, error) {\n\tkv := c.consulClient.KV()\n\n\tpairs, _, err := kv.List(prefix, nil)\n\n\tif len(pairs) == 0 {\n\t\treturn []string{\"\"}, err\n\t}\n\n\tvar res []string\n\n\tfor _, keypair := range pairs {\n\t\tres = append(res, keypair.Key)\n\t}\n\n\treturn res, err\n}", "title": "" }, { "docid": "01cc5c80e632e9d78150088c0967958f", "score": "0.53282654", "text": "func (c DeferDirCollector) Keys() []string {\n\tvar keys []string\n\tc.Each(func(_ func() *VDir, k string, _ func()) {\n\t\tkeys = append(keys, k)\n\t})\n\treturn keys\n}", "title": "" }, { "docid": "1178a5121ea6b7f9e5d7ef6686efcb82", "score": "0.53253245", "text": "func (cache *Cache) Keys () []string {\n keys := make([]string, len(cache.FilePrints))\n n := 0;\n for k := range cache.FilePrints { keys[n] = k; n++ }\n if len(keys) > 1 { sort.Strings(keys) }\n return keys\n}", "title": "" }, { "docid": "aa649d4d3add4422ad3133d9276affe4", "score": "0.53239", "text": "func (m *OrderedMap) Keys() []string { return m.keys }", "title": "" }, { "docid": "0b287e98b972735c918c097ef5b821e2", "score": "0.53213805", "text": "func (s *store) Keys() []string {\n\ts.worldMu.Lock()\n\tdefer s.worldMu.Unlock()\n\treturn s.hashMap.Keys()\n}", "title": "" }, { "docid": "a71696dec8d52d69cc68787c20d02cb8", "score": "0.5317484", "text": "func GetKeys() (keys []string, err error) {\n\treturn DefaultCache.GetKeys()\n}", "title": "" }, { "docid": "0da97f5a5ac37a9b786a5eb1cbfde981", "score": "0.5315985", "text": "func (d *Database) ListKeys(prefix string, limit int64, marker string) (keys []cmk.Key, err error) {\n\n\titer := d.database.NewIterator(util.BytesPrefix([]byte(prefix)), nil)\n\n\tvar count int64 = 0\n\n\tpastMarker := false\n\n\tfor count < limit && iter.Next() {\n\n\t\t// Exclude tags\n\t\tif strings.Contains(string(iter.Key()), \"/tag/\") {\n\t\t\tcontinue\n\t\t}\n\n\t\t// If there's a marker, and we're not already past it, and the current item does not match the marker:\n\t\tif marker != \"\" && !pastMarker && marker != string(iter.Key()) {\n\t\t\tcontinue\n\t\t}\n\n\t\tpastMarker = true\n\n\t\tkey, err := unmarshalKey(iter.Value())\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// Delete key if it has expired\n\t\tif key.GetMetadata().DeletionDate != 0 && key.GetMetadata().DeletionDate < time.Now().Unix() {\n\t\t\td.DeleteObject(key.GetArn())\n\t\t\tcontinue\n\t\t}\n\n\t\tkeys = append(keys, key)\n\n\t\tcount++\n\t}\n\n\titer.Release()\n\terr = iter.Error()\n\n\tif marker != \"\" && !pastMarker {\n\t\terr = &InvalidMarkerExceptionError{}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "27476da7afed6de0fc15db6ed7b86486", "score": "0.5315537", "text": "func (ds *DataStore) GetAllKeys() []uint64 {\n\tds.dataStoreLock.RLock()\n\tdefer ds.dataStoreLock.RUnlock()\n\tkeys := make([]uint64, 0)\n\tfor k := range ds.kvSet {\n\t\tkeys = append(keys, k)\n\t}\n\treturn keys\n}", "title": "" } ]
c078250f2438763b7c7b962d39041fa0
Manage by daemon commands or run the daemon
[ { "docid": "f094dee75eadee02f9e5793cc0f0791d", "score": "0.0", "text": "func (service *Service) Manage() (string, error) {\n\n\tusage := \"Usage: cron_job install | remove | start | stop | status\"\n\t// If received any kind of command, do it\n\tif len(os.Args) > 1 {\n\t\tcommand := os.Args[1]\n\t\tswitch command {\n\t\tcase \"install\":\n\t\t\treturn service.Install()\n\t\tcase \"remove\":\n\t\t\treturn service.Remove()\n\t\tcase \"start\":\n\t\t\treturn service.Start()\n\t\tcase \"stop\":\n\t\t\t// No need to explicitly stop cron since job will be killed\n\t\t\treturn service.Stop()\n\t\tcase \"status\":\n\t\t\treturn service.Status()\n\t\tdefault:\n\t\t\treturn usage, nil\n\t\t}\n\t}\n\t// Set up channel on which to send signal notifications.\n\t// We must use a buffered channel or risk missing the signal\n\t// if we're not ready to receive when the signal is sent.\n\tinterrupt := make(chan os.Signal, 1)\n\tsignal.Notify(interrupt, os.Interrupt, os.Kill, syscall.SIGTERM)\n\n\t// Create a new cron manager\n\tc := cron.New()\n\t// Run makefile every min\n\tc.AddFunc(\"* * * * * *\", makeFile)\n\tc.Start()\n\t// Waiting for interrupt by system signal\n\tkillSignal := <-interrupt\n\tstdlog.Println(\"Got signal:\", killSignal)\n\treturn \"Service exited\", nil\n}", "title": "" } ]
[ { "docid": "a69e83ac35dde9b6569db7f5fa3695da", "score": "0.70134854", "text": "func daemonRun(ctx *cli.Context) (err error) {\n\tcfg := config.New()\n\n\t// ensure daemon user\n\tif !isDaemonUser(&cfg) {\n\t\terr = errors.New(ErrNotDaemon)\n\t\treturn\n\t}\n\n\t// construct and run daemon\n\t// server := daemon.New(&cfg)\n\t// return server.Serve()\n\treturn\n}", "title": "" }, { "docid": "0d48d868580aef7e50c398dab4ceedea", "score": "0.64643365", "text": "func DaemonHandler(cmd *CmdMessage) error {\n if !cmd.Conn.owner.IsAuthorised() {\n return errors.New(\"Logging in is required before using this handler\")\n }\n if !cmd.Conn.owner.IsUser() {\n return daemonUpdateInfo(cmd)\n }\n\n daemonId, ok := cmd.Data[\"daemon_id\"].(string)\n if !ok {\n return errors.New(\"wrong daemon_id supplied\")\n }\n\n daemons := cmd.Conn.owner.GetOrg().Daemons\n daemon, ok := daemons[daemonId]\n if !ok {\n return errors.New(\"daemon not found: \" + daemonId)\n }\n\n sendDaemonMessage(daemon.owner.(*Daemon), cmd.Conn)\n return nil\n}", "title": "" }, { "docid": "bb5852962b205c1a7b6f48b7ab6677d1", "score": "0.63525665", "text": "func (service *Service) Manage() (string, error) {\n\n\tusage := \"Usage: pwd-daemon install | remove | start | stop | status\"\n\n\t// if received any kind of command, do it\n\t// else just run the daemon on the console\n\tif len(os.Args) > 1 {\n\t\tcommand := os.Args[1]\n\t\tswitch command {\n\t\tcase \"install\":\n\t\t\treturn service.Install()\n\t\tcase \"remove\":\n\t\t\treturn service.Remove()\n\t\tcase \"start\":\n\t\t\treturn service.Start()\n\t\tcase \"stop\":\n\t\t\treturn service.Stop()\n\t\tcase \"status\":\n\t\t\treturn service.Status()\n\t\tcase \"version\":\n\t\t\treturn version, nil\n\t\tdefault:\n\t\t\treturn usage, nil\n\t\t}\n\t}\n\t// Set up channel on which to send signal notifications.\n\t// We must use a buffered channel or risk missing the signal\n\t// if we're not ready to receive when the signal is sent.\n\tinterrupt := make(chan os.Signal, 1)\n\tsignal.Notify(interrupt, os.Interrupt, os.Kill, syscall.SIGTERM)\n\n\t// Set up listener for defined host and port\n\tlistener, err := net.Listen(\"tcp\", port)\n\tif err != nil {\n\t\treturn \"Possibly was a problem with the port binding\", err\n\t}\n\n\t// set up channel on which to send accepted connections\n\tlisten := make(chan net.Conn, 100)\n\tgo acceptConnection(listener, listen)\n\n\tpasswords := make(map[string]string)\n\t// loop work cycle with accept connections or interrupt\n\t// by system signal\n\tfor {\n\t\tselect {\n\t\tcase conn := <-listen:\n\t\t\tgo handleClient(conn, passwords)\n\n\t\tcase killSignal := <-interrupt:\n\t\t\tstdlog.Println(\"Got signal:\", killSignal)\n\t\t\tstdlog.Println(\"Stoping listening on \", listener.Addr())\n\t\t\tlistener.Close()\n\t\t\tif killSignal == os.Interrupt {\n\t\t\t\treturn \"Daemon was interrupted by system signal\", nil\n\t\t\t}\n\t\t\treturn \"Daemon was killed\", nil\n\t\t}\n\t}\n}", "title": "" }, { "docid": "97d49b37f06a19a1d64fd989eb5b8ff9", "score": "0.63076633", "text": "func (inst *MgoInstance) run() error {\n\tif inst.server != nil {\n\t\tpanic(\"mongo server is already running\")\n\t}\n\n\tmgoport := strconv.Itoa(inst.port)\n\tmgoargs := []string{\n\t\t\"--dbpath\", inst.dir,\n\t\t\"--port\", mgoport,\n\t\t\"--nssize\", \"1\",\n\t\t\"--noprealloc\",\n\t\t\"--smallfiles\",\n\t\t\"--nohttpinterface\",\n\t\t\"--oplogSize\", \"10\",\n\t\t\"--ipv6\",\n\t\t\"--setParameter\", \"enableTestCommands=1\",\n\t}\n\tif runtime.GOOS != \"windows\" {\n\t\tmgoargs = append(mgoargs, \"--nounixsocket\")\n\t}\n\tif inst.EnableAuth {\n\t\tmgoargs = append(mgoargs,\n\t\t\t\"--auth\",\n\t\t\t\"--keyFile\", filepath.Join(inst.dir, \"keyfile\"),\n\t\t)\n\t}\n\tif inst.certs != nil {\n\t\tmgoargs = append(mgoargs,\n\t\t\t\"--sslMode\", \"requireSSL\",\n\t\t\t\"--sslPEMKeyFile\", filepath.Join(inst.dir, \"server.pem\"),\n\t\t\t\"--sslPEMKeyPassword=ignored\")\n\t}\n\n\tmongopath, version, err := installedMongod.Get()\n\tif err != nil {\n\t\treturn err\n\t}\n\tlogger.Debugf(\"using mongod at: %q (version=%s)\", mongopath, version)\n\n\tif version.Compare(useJournalMongoVersion) == -1 {\n\t\tmgoargs = append(mgoargs, \"--nojournal\")\n\t}\n\tif version.Compare(storageEngineMongoVersion) >= 0 {\n\t\tstorageEngine := os.Getenv(\"JUJU_MONGO_STORAGE_ENGINE\")\n\t\tif storageEngine == \"\" {\n\t\t\tstorageEngine = defaultMongoStorageEngine\n\t\t}\n\t\tmgoargs = append(mgoargs, \"--storageEngine\", storageEngine)\n\t}\n\n\tif inst.Params != nil {\n\t\tmgoargs = append(mgoargs, inst.Params...)\n\t}\n\tif mongopath == \"/usr/lib/juju/bin/mongod\" || mongopath == \"/usr/lib/juju/mongo3.2/bin/mongod\" {\n\t\tinst.WithoutV8 = true\n\t}\n\tserver := exec.Command(mongopath, mgoargs...)\n\tout, err := server.StdoutPipe()\n\tif err != nil {\n\t\treturn err\n\t}\n\tserver.Stderr = server.Stdout\n\texited := make(chan struct{})\n\tstarted := make(chan error)\n\tlistening := make(chan error, 1)\n\tgo func() {\n\t\terr := <-started\n\t\tif err != nil {\n\t\t\tclose(listening)\n\t\t\tclose(exited)\n\t\t\treturn\n\t\t}\n\t\t// Wait until the server is listening.\n\t\tvar buf bytes.Buffer\n\t\tprefix := fmt.Sprintf(\"mongod:%v\", mgoport)\n\t\tif readUntilMatching(prefix, io.TeeReader(out, &buf), waitingForConnectionsRe) {\n\t\t\tlistening <- nil\n\t\t} else {\n\t\t\terr := fmt.Errorf(\"mongod failed to listen on port %v\", mgoport)\n\t\t\tif strings.Contains(buf.String(), \"addr already in use\") {\n\t\t\t\terr = addrAlreadyInUseError{err}\n\t\t\t}\n\t\t\tlistening <- err\n\t\t}\n\t\t// Capture the last 100 lines of output from mongod, to log\n\t\t// in the event of unclean exit.\n\t\tlines := readLastLines(prefix, io.MultiReader(&buf, out), 100)\n\t\terr = server.Wait()\n\t\texitErr, _ := err.(*exec.ExitError)\n\t\tif err == nil || exitErr != nil && exitErr.Exited() {\n\t\t\t// mongodb has exited without being killed, so print the\n\t\t\t// last few lines of its log output.\n\t\t\tlogger.Errorf(\"mongodb has exited without being killed\")\n\t\t\tfor _, line := range lines {\n\t\t\t\tlogger.Errorf(\"mongod: %s\", line)\n\t\t\t}\n\t\t}\n\t\tclose(exited)\n\t}()\n\tinst.exited = exited\n\terr = server.Start()\n\tstarted <- err\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = <-listening\n\tclose(listening)\n\tif err != nil {\n\t\treturn err\n\t}\n\tinst.server = server\n\n\treturn nil\n}", "title": "" }, { "docid": "52df83f69146f8a11115e826d4f11173", "score": "0.62952876", "text": "func daemonStart(ctx *cli.Context) (err error) {\n\tcfg := config.New()\n\n\t// ensure admin user\n\tif !isDaemonUser(&cfg) {\n\t\terr = errors.New(ErrNotAdmin)\n\t\treturn\n\t}\n\n\t//TODO\n\n\treturn\n}", "title": "" }, { "docid": "d9e885979e6b36fdb096f81506c9f758", "score": "0.62111557", "text": "func runDaemon(args *args, client *histweet.TwitterClient) error {\n\tinterval := time.Duration(args.Interval)\n\tif interval < minDaemonInterval {\n\t\treturn fmt.Errorf(\"The minimum daemon interal is %d\", minDaemonInterval)\n\t}\n\n\tticker := time.NewTicker(interval * time.Second)\n\n\tfmt.Printf(\"\\nRunning in daemon mode (interval = %ds)...\\n\", interval)\n\n\tfor {\n\t\tselect {\n\t\tcase <-ticker.C:\n\t\t\terr := runSingle(args, client)\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatalf(\"Failed: %s\", err.Error())\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f5c21b47884ac6ff540dd87e4f0c181b", "score": "0.6210029", "text": "func (service *Service) Manage() (string, error) {\n\t//defer saveHeapProfile()\n\tusage := \"Usage: myservice install | remove | start | stop | status\"\n\n\t// if received any kind of command, do it\n\tif len(os.Args) > 1 {\n\t\tcommand := os.Args[1]\n\t\tswitch command {\n\t\tcase \"install\":\n\t\t\treturn service.Install()\n\t\tcase \"remove\":\n\t\t\treturn service.Remove()\n\t\tcase \"start\":\n\t\t\treturn service.Start()\n\t\tcase \"stop\":\n\t\t\treturn service.Stop()\n\t\tcase \"status\":\n\t\t\treturn service.Status()\n\t\tdefault:\n\t\t\treturn usage, nil\n\t\t}\n\t}\n\n\tstdlog.Println(\"Starting daemon:\", path.Base(os.Args[0]))\n\n\t// read the configuration\n\tfile, err := os.Open(\"/etc/\" + path.Base(os.Args[0]) + \".json\")\n\tif err != nil {\n\t\tfile, err = os.Open(\"./\" + path.Base(os.Args[0]) + \".json\")\n\t\tif err != nil {\n\t\t\treturn \"Could not open configuration file\", err\n\t\t}\n\t}\n\tjsondec := json.NewDecoder(file)\n\tconfig := config.Configuration{}\n\terr = jsondec.Decode(&config)\n\tif err != nil {\n\t\treturn \"Could not decode configuration file\", err\n\t}\n\n\t//force backend values to environement varialbles if present\n\ts := reflect.ValueOf(&config.Backend).Elem()\n\tnumfields := s.NumField()\n\tfor i := 0; i < numfields; i++ {\n\t\tf := s.Field(i)\n\t\tif f.CanSet() {\n\t\t\t//exported field\n\t\t\tenvname := strings.ToUpper(s.Type().Name() + \"_\" + s.Type().Field(i).Name)\n\t\t\tenvval := os.Getenv(envname)\n\t\t\tif len(envval) > 0 {\n\t\t\t\t//environment variable set with name\n\t\t\t\tswitch ftype := f.Type().Name(); ftype {\n\t\t\t\tcase \"string\":\n\t\t\t\t\tf.SetString(envval)\n\t\t\t\tcase \"int\":\n\t\t\t\t\tval, err := strconv.ParseInt(envval, 10, 64)\n\t\t\t\t\tif err == nil {\n\t\t\t\t\t\tf.SetInt(val)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\terr = config.Backend.Init(stdlog, errlog)\n\tif err != nil {\n\t\treturn \"Could not initialize backend\", err\n\t}\n\tdefer config.Backend.Disconnect()\n\n\t// Set up channel on which to send signal notifications.\n\t// We must use a buffered channel or risk missing the signal\n\t// if we're not ready to receive when the signal is sent.\n\tinterrupt := make(chan os.Signal, 1)\n\tsignal.Notify(interrupt, os.Interrupt, os.Kill, syscall.SIGTERM)\n\n\t// Set up a channel to recieve the metrics\n\tmetrics := make(chan []backend.Point)\n\tfinders := make(chan backend.HostStuct)\n\n\t// Set up a ticker to collect metrics at givent interval\n\tticker := time.NewTicker(time.Second * time.Duration(config.Interval))\n\tdefer ticker.Stop()\n\n\ttickerFinder := time.NewTicker(time.Second * time.Duration(config.Interval) )//* 20\n\tdefer tickerFinder.Stop()\n\n\tpollerTicker := time.NewTicker(time.Second * time.Duration(config.Interval) )//* 20\n\tdefer pollerTicker.Stop()\n\n\t// Start retriveing and sending metrics\n\tstdlog.Println(\"Retrieving metrics\")\n\tfor _, kvm := range config.Kvms {\n\t\tgo queryKvm(*kvm, config, &metrics)\n\t\tgo queryKvmHost(*kvm, &finders)\n\n\t}\n\tfor {\n\t\tselect {\n\t\tcase values := <-metrics:\n\t\t\tconfig.Backend.SendMetrics(values)\n\t\t\tstdlog.Printf(\"Sent %d metrics to backend\", len(values))\n\t\tcase values := <-finders:\n\t\t\turl := fmt.Sprintf(\"%s%s?api_key=%s&host=%s&ip=%s\", config.Backend.KongHost, config.Backend.HostUrl, config.Backend.ApiKey, values.Host, config.Backend.PollerTags.PollerIp)\n\t\t\tconfig.Backend.SendHost(values.Infos, url)\n\t\t\tstdlog.Printf(\"Sent %d host info to backend\", len(values.Infos))\n\t\tcase <-ticker.C:\n\t\t\tstdlog.Println(\"Retrieving hosts\")\n\t\t\tfor _, kvm := range config.Kvms {\n\t\t\t\tgo queryKvm(*kvm, config, &metrics)\n\t\t\t}\n\t\tcase <-tickerFinder.C:\n\t\t\tstdlog.Println(\"Retrieving metrics\")\n\t\t\tfor _, kvm := range config.Kvms {\n\t\t\t\tgo queryKvmHost(*kvm, &finders)\n\t\t\t}\n\t\tcase <-pollerTicker.C:\n\t\t\tstdlog.Println(\"pollerTicker metrics\")\n\t\t\turl := fmt.Sprintf(\"%s%s?api_key=%s\", config.Backend.KongHost, config.Backend.PollerUrl, config.Backend.ApiKey)\n\t\t\tconfig.Backend.SendPollerMetrics(url)\n\n\t\tcase killSignal := <-interrupt:\n\t\t\tstdlog.Println(\"Got signal:\", killSignal)\n\t\t\tif killSignal == os.Interrupt {\n\t\t\t\treturn \"Daemon was interruped by system signal\", nil\n\t\t\t}\n\t\t\treturn \"Daemon was killed\", nil\n\t\t}\n\t}\n\n\t// never happen, but need to complete code\n\treturn usage, nil\n}", "title": "" }, { "docid": "5ffde2650300f6196f003e084f9dfda3", "score": "0.6207256", "text": "func main() {\n\troot := &cobra.Command{\n\t\tUse: os.Args[0],\n\t\tShort: \"Sia Daemon v\" + build.Version,\n\t\tLong: \"Sia Daemon v\" + build.Version,\n\t\tRun: startDaemonCmd,\n\t}\n\n\troot.AddCommand(&cobra.Command{\n\t\tUse: \"version\",\n\t\tShort: \"Print version information\",\n\t\tLong: \"Print version information about the Sia Daemon\",\n\t\tRun: versionCmd,\n\t})\n\n\t// Set default values, which have the lowest priority.\n\troot.PersistentFlags().StringVarP(&globalConfig.Siad.RequiredUserAgent, \"agent\", \"A\", \"Sia-Agent\", \"required substring for the user agent\")\n\troot.PersistentFlags().BoolVarP(&globalConfig.Siad.Explorer, \"explorer\", \"E\", false, \"whether or not to run an explorer in the daemon\")\n\troot.PersistentFlags().StringVarP(&globalConfig.Siad.HostAddr, \"host-addr\", \"H\", \":9982\", \"which port the host listens on\")\n\troot.PersistentFlags().StringVarP(&globalConfig.Siad.ProfileDir, \"profile-directory\", \"P\", \"profiles\", \"location of the profiling directory\")\n\troot.PersistentFlags().StringVarP(&globalConfig.Siad.APIaddr, \"api-addr\", \"a\", \"localhost:9980\", \"which host:port the API server listens on\")\n\troot.PersistentFlags().StringVarP(&globalConfig.Siad.SiaDir, \"sia-directory\", \"d\", \"\", \"location of the sia directory\")\n\troot.PersistentFlags().BoolVarP(&globalConfig.Siad.NoBootstrap, \"no-bootstrap\", \"n\", false, \"disable bootstrapping on this run\")\n\troot.PersistentFlags().BoolVarP(&globalConfig.Siad.Profile, \"profile\", \"p\", false, \"enable profiling\")\n\troot.PersistentFlags().StringVarP(&globalConfig.Siad.RPCaddr, \"rpc-addr\", \"r\", \":9981\", \"which port the gateway listens on\")\n\n\t// Parse cmdline flags, overwriting both the default values and the config\n\t// file values.\n\troot.Execute()\n}", "title": "" }, { "docid": "c75955147d44260a044989d3024cbee3", "score": "0.61995614", "text": "func Daemon(ctx *cli.Context) {\n\tcfg, err := config.NewClient(ctx.String(\"prefix\"), ctx.StringSlice(\"etcd\"))\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\nretry:\n\tglobal, err := cfg.GetGlobal()\n\tif err != nil {\n\t\tlog.Errorf(\"Could not retrieve global configuration: %v. Retrying in 1 second\", err)\n\t\ttime.Sleep(time.Second)\n\t\tgoto retry\n\t}\n\n\tdc := &DaemonConfig{Config: cfg, Global: global, Hostname: ctx.String(\"host-label\")}\n\tdc.setDebug()\n\n\tglobalChan := make(chan *watch.Watch)\n\tdc.Config.WatchGlobal(globalChan)\n\tgo dc.watchAndSetGlobal(globalChan)\n\tgo info.HandleDebugSignal()\n\n\tdc.signalSnapshot()\n\tdc.updatePolicies()\n\tdc.loop()\n}", "title": "" }, { "docid": "86fceb0f69a67b69f928f1f38be1ac70", "score": "0.6115886", "text": "func DaemonAction(c *cli.Context) error {\n\tlog.Infoln(\"Starting Nebula daemon...\")\n\n\t// Load configuration file\n\tctx, conf, err := config.FillContext(c)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"filling context with configuration\")\n\t}\n\tc.Context = ctx\n\n\t// Acquire database handle\n\tvar dbh *sql.DB\n\tif !c.Bool(\"dry-run\") {\n\t\tif dbh, err = db.Open(c.Context); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Start prometheus metrics endpoint\n\tif err = metrics.RegisterCrawlMetrics(); err != nil {\n\t\treturn err\n\t}\n\tif err = metrics.RegisterMonitorMetrics(); err != nil {\n\t\treturn err\n\t}\n\tif err = metrics.ListenAndServe(conf.PrometheusHost, conf.PrometheusPort); err != nil {\n\t\treturn errors.Wrap(err, \"initialize metrics\")\n\t}\n\t_ = dbh\n\n\treturn errors.New(\"this command isn't implemented yet :/\")\n}", "title": "" }, { "docid": "5751d6883f80d45da5588a1cbde0dff9", "score": "0.60833234", "text": "func runDaemon() (*exec.Cmd, error) {\n\tos.Remove(\"/var/run/docker.pid\")\n\texec.Command(\"rm\", \"-rf\", \"/var/lib/docker/containers\").Run()\n\tcmd := exec.Command(DOCKERPATH, \"-d\")\n\toutPipe, err := cmd.StdoutPipe()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terrPipe, err := cmd.StderrPipe()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif err := cmd.Start(); err != nil {\n\t\treturn nil, err\n\t}\n\tgo func() {\n\t\tio.Copy(os.Stdout, outPipe)\n\t}()\n\tgo func() {\n\t\tio.Copy(os.Stderr, errPipe)\n\t}()\n\treturn cmd, nil\n}", "title": "" }, { "docid": "d73950845d37fb8f20d9221bb14452e5", "score": "0.6069661", "text": "func (service *Service) Manage( ) (string, error) {\n\n\n\tusage := \"Usage:default[/etc/CarbonProxy.ini] myservice install | remove | start | stop | status | checkconfig | help \"\n\t// if received any kind of command, do it\n\tif len(os.Args) > 1 {\n\t\tcommand := os.Args[1]\n\t\tswitch command {\n\t\tcase \"install\":\n\t\t\treturn service.Install()\n\t\tcase \"remove\":\n\t\t\treturn service.Remove()\n\t\tcase \"start\":\n\t\t\treturn service.Start()\n\t\tcase \"stop\":\n\t\t\treturn service.Stop()\n\t\tcase \"status\":\n\t\t\treturn service.Status()\n\t\tcase \"help\":\n\t\t\treturn usage, nil\n\t\tcase \"checkconfig\":\n\t\t\treturn checkConfig()\n\t\tdefault:\n\t\t\treturn usage, nil\n\t\t}\n\t}\n\n\t// Do something, call your goroutines, etc\n\n\t// Set up channel on which to send signal notifications.\n\t// We must use a buffered channel or risk missing the signal\n\t// if we're not ready to receive when the signal is sent.\n\tinterrupt := make(chan os.Signal, 1)\n\tsignal.Notify(interrupt, os.Interrupt, os.Kill, syscall.SIGTERM)\n\n\tgo reConnect(true)\n\t//fmt.Print(\"\\\"asdfasdf\\\"\")\n\t// prepare server\n\tnetBufferQueue = make(chan server.PacketQueue, MaxPacketQueueSize)\n\n\tserverObj, err := server.NewServer(*hostIP, *listenPort, netBufferQueue)\n\tif err != nil {\n\t\tlog.Info(\"host:\",*hostIP,\":\",*listenPort,\" create server failed! err(\",err,\")\")\n\t\treturn usage, nil\n\t}\n\n\t// boot server\n\trerr := serverObj.Run()\n\n\tif rerr != nil {\n\t\tlog.Info(\"host:\",*hostIP,\":\",strconv.Itoa(*listenPort),\" start server failed! err(\",rerr,\")\")\n\t\treturn usage, nil\n\t}\n\n\t// 启动多个处理线程\n\ti := 0 \n\tfor i < *threadCount - 1{\n\t\tgo readChannelAndSend()\n\t\ti = i + 1\n\t}\n\n\tvar leaderBufferQueue = make(chan server.PacketQueue)\n\tleaderServer, err := server.NewServer(*hostIP, *leaderPort, leaderBufferQueue)\n\tif err != nil {\n\t\tlog.Info(\"host:\",*hostIP,\":\",strconv.Itoa(*leaderPort),\" create leader server failed! err(\",err,\")\")\n\t\treturn usage, err\n\t}else{\n\t\tlog.Info(\"host:\",*hostIP,\":\",strconv.Itoa(*leaderPort),\" create leader server success! err(\",err,\")\")\n\t}\n\trerr = leaderServer.Run()\n\n\tif rerr != nil {\n\t\tlog.Info(\"host:\",*hostIP,\":\",strconv.Itoa(*leaderPort),\" start leader server failed! err(\",rerr,\")\")\n\t\treturn usage, rerr\n\t}else{\n\t\tlog.Info(\"host:\",*hostIP,\":\",strconv.Itoa(*leaderPort),\" start leader server success! err(\",rerr,\")\")\n\t}\n\n\t//timer := time.Tick(10 * time.Millisecond)\n\t//for _ = range timer {\n\tfor {\n\t\tselect {\n\t\t// Receive Packet\n\t\tcase p := <-leaderBufferQueue:\n\n\t\t\tleaderServer.Notify(p.Connection,[]byte(processCMD(string(p.Packet[:]))))\n\n\t\t}\n\t}\n\n\t// never happen, but need to complete code\n\treturn usage, nil\n}", "title": "" }, { "docid": "89c5338633f826fb8a609afe24d3e421", "score": "0.606812", "text": "func Run() int {\n\tvals := config.Init(viper.New())\n\tlogger := logrus.New()\n\tlogger.Level = logrus.DebugLevel\n\n\t// rootCmd is the root cobra command for the daemon.\n\trootCmd := &cobra.Command{\n\t\tUse: strings.ToLower(appname),\n\t\tShort: description,\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\tfmt.Println(\"Use the help command to list all commands.\")\n\t\t},\n\t}\n\trootCmd.AddCommand(\n\t\t&cobra.Command{\n\t\t\tUse: \"version\",\n\t\t\tShort: \"Print the version of the application\",\n\t\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\t\tfmt.Printf(\"%s v%s\\n\", appname, gitTag)\n\t\t\t\tfmt.Println(\"Build Date:\", timestamp)\n\t\t\t\tfmt.Println(\"Commit:\", commitHash)\n\t\t\t},\n\t\t},\n\t\t&cobra.Command{\n\t\t\tUse: \"server\",\n\t\t\tShort: \"Start the server\",\n\t\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\t\treturn runServer(logger, vals)\n\t\t\t},\n\t\t},\n\t\t// TODO: add more commands here as needed.\n\t)\n\tif err := rootCmd.Execute(); err != nil {\n\t\tlogger.WithError(err).Error()\n\t\treturn 1\n\t}\n\treturn 0\n}", "title": "" }, { "docid": "4770188c6b99fa06b8803c8d7da6b785", "score": "0.60410684", "text": "func DaemonRun() {\n\t// resolve the udp server address\n\tserverAddr, err := net.ResolveUDPAddr(\"udp\", LocalAddr)\n\tif err != nil {\n\t\tErrorLogger.Println(\"Can't resolve address:\", err.Error())\n\t\tos.Exit(1)\n\t}\n\n\tconn, err := net.ListenUDP(\"udp\", serverAddr)\n\tif err != nil {\n\t\tErrorLogger.Println(\"Failed to start server:\", err.Error())\n\t}\n\t// output server info\n\tInfoLogger.Println(\"Server Started at:\", serverAddr.String(),\n\t\t\", Unique ID:\", LocalUniqueID,\n\t\t\", IntroducerMode:\", IntroducerMode,\n\t\t\", DebugMode:\", DebugMode,\n\t\t\", GossipMode:\", GossipMode)\n\t// close connect after finishing main\n\tdefer conn.Close()\n\n\t// create channels for taking messages and commands\n\tmessages := make(chan Message, 10)\n\tgo readMessage(conn, messages) // read messages from UDP\n\tcommand := make(chan Command)\n\tgo readCommand(command) // read command from user\n\n\tgo RunHeartBeat()\n\n\t// continuously, handle messages and commands, and\n\tfor {\n\t\tCheckFailure()\n\t\tselect {\n\t\tcase message := <-messages:\n\t\t\thandleMessage(message)\n\t\tcase command := <-command:\n\t\t\thandleCommand(command)\n\t\tdefault:\n\t\t\ttime.Sleep(SleepPeriod * time.Millisecond)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a6ee5be8c8996f976397a6e668f9c739", "score": "0.6027809", "text": "func runDaemon() {\n\tLog(\"Starting Cloudmanic Backup In Daemon Mode: Backing up every \" + os.Getenv(\"HOURS_BETWEEN_BACKUPS\") + \" Hours.\")\n\n\t// Get the duration\n\tdur, _ := strconv.ParseInt(os.Getenv(\"HOURS_BETWEEN_BACKUPS\"), 10, 64)\n\n\t// Setup jobs we need to run\n\tgocron.Every(uint64(dur)).Hours().Do(runFullBackup)\n\n\t// function Start start all the pending jobs\n\t<-gocron.Start()\n}", "title": "" }, { "docid": "59be82e7466c1b920478b695ad9937ec", "score": "0.6022875", "text": "func WithDaemon(daemonImplObject Daemon,\n\t// modifier func(daemonServerCommand *cmdr.Command) *cmdr.Command,\n\topts ...Opt,\n) cmdr.ExecOption {\n\n\tpd = &Program{\n\t\tConfig: &service.Config{\n\t\t\tName: \"the-daemon\",\n\t\t\tDisplayName: \"The Daemon\",\n\t\t\tDescription: \"The Daemon/Service here\",\n\t\t},\n\t\tdaemon: daemonImplObject,\n\t\t// Service: nil,\n\t\t// Logger: nil,\n\t\t// Command: nil,\n\t\t// exit: make(chan struct{}),\n\t\t// done: make(chan struct{}),\n\t}\n\n\tif dio, ok := daemonImplObject.(interface{ Config() *service.Config }); ok {\n\t\tpd.Config = dio.Config()\n\t}\n\n\t// set appname with daemon name\n\tos.Setenv(\"APPNAME\", pd.Config.Name)\n\t// logrus.Printf(\"set appname with daemon name: %q\", pd.Config.Name)\n\n\tif len(pd.Config.Arguments) == 0 {\n\t\tpd.Config.Arguments = []string{\"server\", \"run\", \"--in-daemon\"}\n\t}\n\tif pd.Config.Option == nil {\n\t\tpd.Config.Option = make(service.KeyValue)\n\t}\n\n\tfor _, opt := range opts {\n\t\topt()\n\t}\n\n\treturn func(w *cmdr.ExecWorker) {\n\t\tw.AddOnBeforeXrefBuilding(func(root *cmdr.RootCommand, args []string) {\n\n\t\t\tif pd.modifier != nil {\n\t\t\t\troot.SubCommands = append(root.SubCommands, pd.modifier(DaemonServerCommand))\n\t\t\t} else {\n\t\t\t\troot.SubCommands = append(root.SubCommands, DaemonServerCommand)\n\t\t\t}\n\n\t\t\t// prefix = strings.Join(append(cmdr.RxxtPrefix, \"server\"), \".\")\n\t\t\t// prefix = \"server\"\n\n\t\t\tattachPreAction(root, pd.preActions...)\n\t\t\tattachPostAction(root, pd.postActions...)\n\n\t\t\tif err := cmdrPrepare(pd.daemon, root); err != nil {\n\t\t\t\tlogrus.Fatal(err)\n\t\t\t}\n\n\t\t})\n\t}\n}", "title": "" }, { "docid": "65e4ffa0e4260d150585b3607205ae64", "score": "0.59867334", "text": "func main() {\n\t// set the Agent flavor\n\tflavor.SetFlavor(flavor.Dogstatsd)\n\tconfig.Datadog.AddConfigPath(DefaultConfPath)\n\n\tisIntSess, err := svc.IsAnInteractiveSession()\n\tif err != nil {\n\t\tfmt.Printf(\"failed to determine if we are running in an interactive session: %v\\n\", err)\n\t}\n\tif !isIntSess {\n\t\t// confPath = DefaultConfPath\n\t\trunService(false)\n\t\treturn\n\t}\n\tdefer log.Flush()\n\n\tif err = app.SecurityAgentCmd.Execute(); err != nil {\n\t\tlog.Error(err)\n\t\tos.Exit(-1)\n\t}\n}", "title": "" }, { "docid": "6eb93352958d596cf91e189cb92192be", "score": "0.5941453", "text": "func (d *MenderShellDaemon) Run() error {\n\td.setupLogging()\n\n\tlog.Trace(\"daemon Run starting\")\n\tu, err := user.Lookup(d.username)\n\tif err == nil && u == nil {\n\t\treturn errors.New(\"unknown error while getting a user id\")\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\n\td.homeDir = u.HomeDir\n\n\td.uid, err = strconv.ParseUint(u.Uid, 10, 32)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\td.gid, err = strconv.ParseUint(u.Gid, 10, 32)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlog.Trace(\"mender-connect connecting to dbus\")\n\n\tdbusAPI, err := dbus.GetDBusAPI()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t//dbus main loop, required.\n\tloop := dbusAPI.MainLoopNew()\n\tgo dbusAPI.MainLoopRun(loop)\n\tdefer dbusAPI.MainLoopQuit(loop)\n\n\t//new dbus client\n\tclient, err := mender.NewAuthClient(dbusAPI)\n\tif err != nil {\n\t\tlog.Errorf(\"mender-shall dbus failed to create client, error: %s\", err.Error())\n\t\treturn err\n\t}\n\n\t//connection to dbus\n\terr = client.Connect(mender.DBusObjectName, mender.DBusObjectPath, mender.DBusInterfaceName)\n\tif err != nil {\n\t\tlog.Errorf(\"mender-shall dbus failed to connect, error: %s\", err.Error())\n\t\treturn err\n\t}\n\n\tjwtToken, serverURL, err := client.GetJWTToken()\n\tif err != nil {\n\t\tlog.Warnf(\"call to GetJWTToken on the Mender D-Bus API failed: %v\", err)\n\t}\n\td.serverUrl = serverURL\n\n\tlog.Tracef(\"GetJWTToken().len=%d\", len(jwtToken))\n\tif len(jwtToken) < 1 {\n\t\tlog.Info(\"waiting for JWT token (waitForJWTToken)\")\n\t\tjwtToken, err = d.waitForJWTToken(client)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\td.authorized = true\n\t} else {\n\t\td.authorized = true\n\t}\n\tlog.Tracef(\"mender-connect got len(JWT)=%d\", len(jwtToken))\n\n\terr = connectionmanager.Connect(ws.ProtoTypeShell,\n\t\td.serverUrl,\n\t\td.deviceConnectUrl,\n\t\tjwtToken,\n\t\td.skipVerify,\n\t\td.serverCertificate,\n\t\t0,\n\t\td.ctx,\n\t)\n\tif err != nil {\n\t\tlog.Errorf(\"error on connecting, probably interrupted: %s\", err.Error())\n\t\treturn err\n\t}\n\n\tgo d.messageLoop()\n\tgo d.dbusEventLoop(client)\n\tgo d.eventLoop()\n\n\tlog.Trace(\"mender-connect entering main loop.\")\n\tfor {\n\t\tif d.shouldStop() {\n\t\t\tbreak\n\t\t}\n\n\t\tif d.shouldPrintStatus() {\n\t\t\td.outputStatus()\n\t\t}\n\n\t\tif d.timeToSweepSessions() {\n\t\t\tshellStoppedCount, sessionStoppedCount, totalExpiredLeft, err := session.MenderSessionTerminateExpired()\n\t\t\tif err != nil {\n\t\t\t\tlog.Errorf(\"main-loop: failed to terminate some expired sessions, left: %d\",\n\t\t\t\t\ttotalExpiredLeft)\n\t\t\t} else if sessionStoppedCount != 0 {\n\t\t\t\tlog.Infof(\"main-loop: stopped %d sessions, %d shells, expired sessions left: %d\",\n\t\t\t\t\tshellStoppedCount, sessionStoppedCount, totalExpiredLeft)\n\t\t\t}\n\t\t}\n\n\t\ttime.Sleep(time.Second)\n\t}\n\n\tlog.Trace(\"mainLoop: returning\")\n\treturn nil\n}", "title": "" }, { "docid": "bd92e8a680f59765dd1f26e84b34ad73", "score": "0.5878598", "text": "func NewCommand() *cobra.Command {\n\n\tvar cmd = &cobra.Command{\n\t\tUse: \"daemon\",\n\t\tShort: \"Last.Backend Open-source PaaS\",\n\t\tLong: `Open-source system for automating deployment, scaling, and management of containerized applications.`,\n\t\tRunE: func(cmd *cobra.Command, args []string) (err error) {\n\n\t\t\tvar cfg = config.Config{}\n\n\t\t\t// short-circuit on help\n\t\t\thelp, err := cmd.Flags().GetBool(\"help\")\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrapf(err, \"\\\"help\\\" flag is non-bool, programmer error, please correct\")\n\t\t\t}\n\t\t\tif help {\n\t\t\t\treturn cmd.Help()\n\t\t\t}\n\n\t\t\tcfgFile, err := cmd.Flags().GetString(\"config\")\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrapf(err, \"\\\"config\\\" flag is non-string, programmer error, please correct\")\n\t\t\t}\n\n\t\t\tprintFlags(cmd.Flags())\n\n\t\t\tvar (\n\t\t\t\tsigs = make(chan os.Signal)\n\t\t\t)\n\n\t\t\tif cfgFile != \"\" {\n\t\t\t\tif err := SetConfigFromFile(cfgFile, &cfg); err != nil {\n\t\t\t\t\treturn errors.Wrapf(err, \"can not be set server config from file\")\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif err := SetConfigFromEnvs(&cfg); err != nil {\n\t\t\t\treturn errors.Wrapf(err, \"can not be set server config from envs\")\n\t\t\t}\n\n\t\t\tif err := SetConfigFromFlags(cmd.Flags(), &cfg); err != nil {\n\t\t\t\treturn errors.Wrapf(err, \"can not be set server config from flags\")\n\t\t\t}\n\n\t\t\tapp, err := daemon.New(cfg)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrapf(err, \"can not init daemon process\")\n\t\t\t}\n\t\t\tif err := app.Run(); err != nil {\n\t\t\t\treturn errors.Wrapf(err, \"can not run daemon process\")\n\t\t\t}\n\n\t\t\tfor {\n\t\t\t\tselect {\n\t\t\t\tcase <-sigs:\n\t\t\t\t\tapp.Stop()\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t}\n\n\t\t},\n\t}\n\n\tcmd.PersistentFlags().BoolP(\"help\", \"h\", false, fmt.Sprintf(\"Help for %s\", cmd.Name()))\n\n\tcmd.Flags().StringP(\"config\", \"c\", \"\", \"set config path\")\n\tcmd.Flags().Bool(\"agent\", false, \"Only agent mode\")\n\tcmd.Flags().Bool(\"no-schedule\", false, \"Disable schedule mode\")\n\tcmd.Flags().StringP(\"access-token\", \"\", \"\", \"Access token to NodeClient server\")\n\tcmd.Flags().StringP(\"bind-address\", \"\", config.DefaultBindServerAddress, \"Bind address for listening\")\n\tcmd.Flags().UintP(\"bind-port\", \"\", config.DefaultBindServerPort, \"Bind address for listening\")\n\tcmd.Flags().BoolP(\"tls-verify\", \"\", false, \"Enable check tls for NodeClient server\")\n\tcmd.Flags().StringP(\"tls-cert-file\", \"\", \"\", \"TLS cert file path\")\n\tcmd.Flags().StringP(\"tls-private-key-file\", \"\", \"\", \"TLS private key file path\")\n\tcmd.Flags().StringP(\"tls-ca-file\", \"\", \"\", \"TLS certificate authority file path\")\n\tcmd.Flags().StringP(\"vault-token\", \"\", \"\", \"Vault access token\")\n\tcmd.Flags().StringP(\"vault-endpoint\", \"\", \"\", \"Vault access endpoint\")\n\tcmd.Flags().StringP(\"domain-internal\", \"\", config.DefaultInternalDomain, \"Default external domain for cluster\")\n\tcmd.Flags().StringP(\"domain-external\", \"\", \"\", \"Internal domain name for cluster\")\n\tcmd.Flags().StringP(\"services-cidr\", \"\", config.DefaultCIDR, \"Services IP CIDR for internal IPAM service\")\n\tcmd.Flags().StringP(\"root-dir\", \"\", \"\", \"Set root directory (Default: /var/lib/lastbackend/)\")\n\tcmd.Flags().StringP(\"storage-driver\", \"\", \"\", \"Set storage driver (Default: overlay)\")\n\tcmd.Flags().StringP(\"node-bind-address\", \"\", config.DefaultBindServerAddress, \"Set bind address for NodeClient server\")\n\tcmd.Flags().UintP(\"node-bind-port\", \"\", config.DefaultBindServerPort, \"Set listening port binding for NodeClient server\")\n\tcmd.Flags().BoolP(\"node-tls-verify\", \"\", false, \"Enable check tls for NodeClient server\")\n\tcmd.Flags().StringP(\"node-tls-ca-file\", \"\", \"\", \"Set path to ca file for NodeClient server\")\n\tcmd.Flags().StringP(\"node-tls-cert-file\", \"\", \"\", \"Set path to cert file for NodeClient server\")\n\tcmd.Flags().StringP(\"node-tls-private-key-file\", \"\", \"\", \"Set path to key file for NodeClient server\")\n\tcmd.Flags().StringP(\"api-address\", \"\", \"\", \"Set endpoint for rest client\")\n\tcmd.Flags().BoolP(\"api-tls-verify\", \"\", false, \"Enable check tls for rest client\")\n\tcmd.Flags().StringP(\"api-tls-ca-file\", \"\", \"\", \"Set path to ca file for rest client\")\n\tcmd.Flags().StringP(\"api-tls-cert-file\", \"\", \"\", \"Set path to cert file for rest client\")\n\tcmd.Flags().StringP(\"api-tls-private-key-file\", \"\", \"\", \"Set path to key file rest client\")\n\tcmd.Flags().StringP(\"manifest-dir\", \"\", \"\", \"Set directory path to manifest\")\n\n\treturn cmd\n}", "title": "" }, { "docid": "0db91b5cb3d63548c098d9e4a583d577", "score": "0.587786", "text": "func main() {\n\tserver.StartCommand()\n}", "title": "" }, { "docid": "e3a96d2e7f0360f226d26094f31173cf", "score": "0.58724135", "text": "func runDaemonsetCheck(ctx context.Context) error {\n\n\t// Deploy Daemonset\n\tlog.Infoln(\"Running daemonset deploy...\")\n\terr := deploy(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// remove the daemonset and block until completed\n\tlog.Infoln(\"Running daemonset removal...\")\n\terr = remove(ctx, daemonSetName)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "0f53edab052a25bfd3e8099af535b7f8", "score": "0.58678234", "text": "func main() {\n\tcntxt := &daemon.Context{}\n\tcntxt = rconf.GetDeamonConfig()\n\tworkercfg := &worker.WConfig{}\n\tworkercfg = rconf.GetWorkerConfig()\n\n\tfmt.Println(cntxt.LogFileName)\n\tfmt.Println(workercfg.WorkerSleepTime)\n\t/*\n\t \td, err := cntxt.Reborn()\n\t \tif err != nil {\n\t \t\tlog.Fatal(\"Unable to run: \", err)\n\t \t}\n\t \tif d != nil {\n\t \t\treturn\n\t \t}\n\t \tdefer cntxt.Release()\n\n\t \tlog.Print(\"- - - - - - - - - - - - - - -\")\n\t \tlog.Print(\"daemon started\")\n\n\t \tserveHTTP()\n\t }\n\n\t func serveHTTP() {\n\t \thttp.HandleFunc(\"/\", httpHandler)\n\t \thttp.ListenAndServe(\"127.0.0.1:8080\", nil)\n\t }\n\n\t func httpHandler(w http.ResponseWriter, r *http.Request) {\n\t \tlog.Printf(\"request from %s: %s %q\", r.RemoteAddr, r.Method, r.URL)\n\t \tfmt.Fprintf(w, \"go-daemon: %q\", html.EscapeString(r.URL.Path))*/\n}", "title": "" }, { "docid": "6a0242233f5f6a021b316c37f8c2c09b", "score": "0.5863713", "text": "func runCommand(args []string) {\n\t// update is a special command that runs in the Go shell\n\tif args[0] == \"update\" {\n\t\trunUpdateCommand(args)\n\t}\n\n\trunCoreCommand(args)\n}", "title": "" }, { "docid": "fc37a0ada341f527ba35054fe594e0b8", "score": "0.586292", "text": "func run(host, port, version, keyPath, certDir, userDir string) {\n\tdaemonVersion = version\n\tif keyPath != \"\" {\n\t\tauth.DaemonGithubKeyLocation = keyPath\n\t}\n\tif certDir != \"\" {\n\t\tsslDirectory = certDir\n\t}\n\tif userDir != \"\" {\n\t\tuserDatabasePath = userDir\n\t}\n\n\tvar (\n\t\tdaemonSSLCert = path.Join(sslDirectory, \"daemon.cert\")\n\t\tdaemonSSLKey = path.Join(sslDirectory, \"daemon.key\")\n\t)\n\n\t// Download build tools\n\tcli, err := docker.NewEnvClient()\n\tif err != nil {\n\t\tprintln(err.Error())\n\t\tprintln(\"Failed to start Docker client - shutting down daemon.\")\n\t\treturn\n\t}\n\tprintln(\"Downloading build tools...\")\n\tgo downloadDeps(cli)\n\n\t// Check if the cert files are available.\n\tprintln(\"Checking for existing SSL certificates in \" + sslDirectory + \"...\")\n\t_, err = os.Stat(daemonSSLCert)\n\tcertNotPresent := os.IsNotExist(err)\n\t_, err = os.Stat(daemonSSLKey)\n\tkeyNotPresent := os.IsNotExist(err)\n\n\t// If they are not available, generate new ones.\n\tif keyNotPresent && certNotPresent {\n\t\tprintln(\"No certificates found - generating new ones...\")\n\t\terr = crypto.GenerateCertificate(daemonSSLCert, daemonSSLKey, host+\":\"+port, \"RSA\")\n\t\tif err != nil {\n\t\t\tprintln(err.Error())\n\t\t\treturn\n\t\t}\n\t}\n\n\twebPrefix := \"/web/\"\n\thandler, err := auth.NewPermissionsHandler(\n\t\tuserDatabasePath, host, 120,\n\t)\n\tif err != nil {\n\t\tprintln(err.Error())\n\t\treturn\n\t}\n\tdefer handler.Close()\n\n\t// Inertia web\n\thandler.AttachPublicHandler(\n\t\twebPrefix,\n\t\thttp.StripPrefix(\n\t\t\twebPrefix, http.FileServer(http.Dir(\"/daemon/inertia-web\")),\n\t\t),\n\t)\n\n\t// GitHub webhook endpoint\n\thandler.AttachPublicHandlerFunc(\"/webhook\", gitHubWebHookHandler)\n\n\t// CLI API endpoints\n\thandler.AttachUserRestrictedHandlerFunc(\"/status\", statusHandler)\n\thandler.AttachUserRestrictedHandlerFunc(\"/logs\", logHandler)\n\thandler.AttachAdminRestrictedHandlerFunc(\"/up\", upHandler)\n\thandler.AttachAdminRestrictedHandlerFunc(\"/down\", downHandler)\n\thandler.AttachAdminRestrictedHandlerFunc(\"/reset\", resetHandler)\n\thandler.AttachAdminRestrictedHandlerFunc(\"/env\", envHandler)\n\n\t// Root \"ok\" endpoint\n\thandler.AttachPublicHandlerFunc(\"/\", func(w http.ResponseWriter, r *http.Request) {\n\t\tw.WriteHeader(http.StatusOK)\n\t})\n\n\t// Serve daemon on port\n\tprintln(\"Serving daemon on port \" + port)\n\tfmt.Println(http.ListenAndServeTLS(\n\t\t\":\"+port,\n\t\tdaemonSSLCert,\n\t\tdaemonSSLKey,\n\t\thandler,\n\t))\n}", "title": "" }, { "docid": "f506a2592ade0a5ac2df7da1641ee7dc", "score": "0.5810015", "text": "func run() error {\n\treturn beatCmd.Execute()\n}", "title": "" }, { "docid": "f506a2592ade0a5ac2df7da1641ee7dc", "score": "0.5810015", "text": "func run() error {\n\treturn beatCmd.Execute()\n}", "title": "" }, { "docid": "1402e7bc610d56bed2058f2f0a4b7588", "score": "0.578434", "text": "func serviceCommand(name string) error {\n\tm, err := mgr.Connect()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer m.Disconnect()\n\ts, err := m.OpenService(exec.ServiceName)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer s.Close()\n\tswitch name {\n\tcase \"remove\":\n\t\treturn s.Delete()\n\tcase \"start\":\n\t\treturn s.Start()\n\tcase \"stop\":\n\t\t_, err := s.Control(svc.Stop)\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "74c9ce40350342a30ae5b926e81c61dd", "score": "0.5773591", "text": "func (s *Supervisor) Run() {\n\ts.keepRunning = true\n\n\trestartDelay := minRestartDelay\n\n\tfor s.keepRunning {\n\t\ts.cmd = exec.Command(s.Options.Command, s.Options.Args...)\n\t\tconfigureSysProcAttr(s.cmd)\n\t\ts.cmd.Env = append(os.Environ(), s.Options.Env...)\n\n\t\tif s.Options.Dir != \"\" {\n\t\t\ts.cmd.Dir = s.Options.Dir\n\t\t}\n\n\t\tvar afterRun []func()\n\n\t\tif outputFile, closeFile, err := getOutputFile(s.Options.RedirectStdout); err == nil {\n\t\t\ts.cmd.Stdout = outputFile\n\t\t\tafterRun = append(afterRun, closeFile)\n\t\t} else {\n\t\t\ts.logger.Error(\"cannot setup stdout redirection\", zap.Error(err), zap.String(\"target\", s.Options.RedirectStdout.string()))\n\t\t}\n\n\t\tif outputFile, closeFile, err := getOutputFile(s.Options.RedirectStderr); err == nil {\n\t\t\ts.cmd.Stderr = outputFile\n\t\t\tafterRun = append(afterRun, closeFile)\n\t\t} else {\n\t\t\ts.logger.Error(\"cannot setup stderr redirection\", zap.Error(err), zap.String(\"target\", s.Options.RedirectStderr.string()))\n\t\t}\n\n\t\tstart := time.Now()\n\t\terr := s.cmd.Start()\n\n\t\tfailedAtStart := false\n\t\tif err != nil {\n\t\t\ts.logger.Error(\"failed to start process\", zap.Error(err))\n\t\t\tfailedAtStart = true\n\t\t} else {\n\t\t\ts.logger.Info(\"process started\", zap.Int(\"pid\", s.cmd.Process.Pid))\n\n\t\t\terr = s.cmd.Wait()\n\t\t}\n\n\t\tduration := time.Now().Sub(start)\n\n\t\tfor _, fn := range afterRun {\n\t\t\tfn()\n\t\t}\n\n\t\tif err != nil {\n\t\t\tif !failedAtStart {\n\t\t\t\ts.logger.Error(\"process exited with error\", zap.Error(err), zap.Duration(\"duration\", duration))\n\t\t\t}\n\t\t} else {\n\t\t\ts.logger.Info(\"process exited\", zap.Duration(\"duration\", duration))\n\t\t}\n\n\t\tif !s.keepRunning {\n\t\t\tbreak\n\t\t}\n\n\t\tswitch s.Options.RestartPolicy {\n\t\tcase RestartAlways:\n\t\t\tbreak\n\t\tcase RestartOnFailure:\n\t\t\tif err == nil {\n\t\t\t\ts.keepRunning = false\n\t\t\t}\n\t\t\tbreak\n\t\tcase RestartNever:\n\t\t\ts.keepRunning = false\n\t\t\tbreak\n\t\t}\n\n\t\tif s.keepRunning {\n\t\t\tif restartDelay > minRestartDelay && (err == nil || duration > durationToResetRestartDelay) {\n\t\t\t\ts.logger.Info(\"resetting restart delay\", zap.Duration(\"delay\", minRestartDelay))\n\t\t\t\trestartDelay = minRestartDelay\n\t\t\t}\n\n\t\t\tif err != nil {\n\t\t\t\ts.logger.Info(\"process will restart\", zap.Duration(\"wait_delay\", restartDelay))\n\t\t\t\ttime.Sleep(restartDelay)\n\t\t\t\trestartDelay = increaseRestartDelay(restartDelay)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2799c7a14f447f6d2364eb5a7c244449", "score": "0.57690114", "text": "func main() {\n\tservice:= os.Args[1]\n\tprocessRunning, pid, _ := isEventConsumerRunning(EventConsumer)\n\tif(service == \"start\") {\n\t\tif(processRunning == true) {\n\t\t\tfmt.Fprintf(os.Stdout, \"Process %s is already running with pid %d. You may want to kill or restart process...\\n\", EventConsumer, pid)\n\t\t} else {\n\t\t\tstartEventConsumer()\n\t\t}\n\t}\n\tif(service == \"stop\") {\n\t\tif(processRunning == true) {\n\t\t\tstopEventConsumer(pid)\n\t\t} else {\n\t\t\tfmt.Fprintf(os.Stdout, \" !! No instance of '%s' is running.\", EventConsumer)\n\t\t}\n\t}\n\tif(service == \"restart\") {\n\t\tif(processRunning == true) {\n\t\t\tstopEventConsumer(pid)\n\t\t}\n\t\tstartEventConsumer()\n\t}\n\tif(service == \"status\") {\n\t\tif(processRunning == true) {\n\t\t\tfmt.Fprintf(os.Stdout, \"Process %s is running with pid %d.\\n\", EventConsumer, pid)\n\t\t} else {\n\t\t\tfmt.Fprintf(os.Stdout, \"No instance of '%s' is running..\", EventConsumer)\n\t\t}\n\t}\n\tfmt.Println(\"\\n\")\n}", "title": "" }, { "docid": "23a7039d41a047131a87205434bbd1db", "score": "0.5768175", "text": "func (a *App) run() {\n\n\tc := make(chan os.Signal, 1)\n\tsignal.Notify(c, os.Interrupt)\n\tgo func() {\n\t\tfor sig := range c {\n\t\t\tif sig.String() == \"interrupt\" {\n\t\t\t\tshutDown()\n\t\t\t}\n\t\t}\n\t}()\n\n\tinfo := cmd.ServiceInfo{Name: a.serviceName, Short: a.shortDescription, Long: a.longDescription, Version: a.version}\n\tcmd.Execute(&info, startUp)\n}", "title": "" }, { "docid": "797d3affb88e6ff01eff2572d23d9c22", "score": "0.57611114", "text": "func doService(name string, action string) error {\n\tcmd := exec.Command(\"service\", name, action)\n\terr := cmd.Run()\n\treturn err\n}", "title": "" }, { "docid": "0fec7054ade9d77d0b9a4b0ffe260aca", "score": "0.57487684", "text": "func main() {\n\targs := parseFlags(os.Args, setupGlobalFlags)\n\tif len(args) == 0 {\n\t\terrorExit(\"Please specify a command.\")\n\t}\n\tcmd := args[0]\n\n\tsaveCwd()\n\n\t// These commands do not require working directory or configuration\n\tswitch cmd {\n\tcase \"init\":\n\t\tinitCmd(parseFlags(args, noFlags))\n\t\tos.Exit(0)\n\tcase \"help\":\n\t\thelpCmd(parseFlags(args, noFlags))\n\t\tos.Exit(0)\n\t}\n\n\t// All other commands need a working directory and minimal configuration\n\n\tresolveWorkDir()\n\topenLog()\n\tloadConfig()\n\n\tswitch cmd {\n\tcase \"config\":\n\t\tconfigCmd(parseFlags(args, noFlags))\n\tcase \"keys\":\n\t\tkeysCmd(parseFlags(args, noFlags))\n\tcase \"hosts\":\n\t\thostsCmd(parseFlags(args, noFlags))\n\tcase \"host\":\n\t\thostCmd(parseFlags(args, noFlags))\n\tcase \"lxcs\":\n\t\tlxcsCmd(parseFlags(args, noFlags))\n\tcase \"lxc\":\n\t\tlxcCmd(parseFlags(args, noFlags))\n\tcase \"dns\":\n\t\tdnsCmd(parseFlags(args, noFlags))\n\tcase \"backups\":\n\t\tbackupsCmd(parseFlags(args, noFlags))\n\tdefault:\n\t\terrorExit(\"Invalid command: %s\", cmd)\n\t}\n}", "title": "" }, { "docid": "fdc50440e957e5c3c5a6353f5bf954b5", "score": "0.5732256", "text": "func RunAllDaemons(ctx context.Context) error {\r\n\tloader := modes.GetDaemonLoader()\r\n\r\n\treturn loader.Load(ctx)\r\n", "title": "" }, { "docid": "ed530f215684c2e46de699bba5b6452e", "score": "0.5731355", "text": "func execute(d common.Daemon, doneC chan struct{}) {\n\td.Start()\n\tclose(doneC)\n}", "title": "" }, { "docid": "a596c96b92a2f2f7aab6d5f9eac55aab", "score": "0.57152134", "text": "func main() {\n\tdialer, err := conn.UnixDialer()\n\tif err != nil {\n\t\tlog.Fatal(\"Cannot find Scoot Daemon address\", err)\n\t}\n\tcli, err := cli.NewCliClient(conn.NewCachingDialer(dialer))\n\tif err != nil {\n\t\tlog.Fatal(\"Cannot initalize Scoot CLI: \", err)\n\t}\n\terr = cli.Exec()\n\tif err != nil {\n\t\tlog.Fatal(\"error running scootcl \", err)\n\t}\n}", "title": "" }, { "docid": "1f11a1522aecf9b2061edcfaa3ac704a", "score": "0.5714344", "text": "func runCommand(cmd *cobra.Command, args []string) {\n\tentry.Start()\n}", "title": "" }, { "docid": "a719ac4a1f49145f59b748a67ed86d32", "score": "0.5708548", "text": "func Run(commands []string, out chan string, retirements chan *Retired, ctl chan MuxdCtl) {\n\toutSync := make(chan int)\n\touts := make([]chan string, len(commands))\n\tretirementsProxy := make(chan *Retired, len(commands) + 1)\n\n\t// launch daemons\n\tfor i, c := range commands {\n\t\tcmd := exec.Command(c)\n\t\tif DEBUG {\n\t\t\tlog.Printf(\"%d (%s) execing\\n\", i, c)\n\t\t}\n\t\tcmdOut, err := cmd.StdoutPipe()\n\t\tif err != nil {\n\t\t\tretirementsProxy <- &Retired{i, err}\n\t\t\tcontinue\n\t\t}\n\t\tbufCmdOut := bufio.NewReader(cmdOut)\n\t\tif DEBUG {\n\t\t\tlog.Printf(\"%d (%s) starting\\n\", i, c)\n\t\t}\n\t\terr = cmd.Start()\n\t\tif err != nil {\n\t\t\tretirementsProxy <- &Retired{i, err}\n\t\t\tcontinue\n\t\t}\n\t\tif DEBUG {\n\t\t\tlog.Printf(\"%d (%s) started\\n\", i, c)\n\t\t}\n\t\touts[i] = make(chan string, 1)\n\t\tgo collectOutput(i, bufCmdOut, outs[i], outSync, retirementsProxy)\n\t}\n\n\t// mux output\n\tmuxed := make([]string, len(commands))\n\tretired := 0\n\tfor {\n\t\tselect {\n\t\tcase r := <-retirementsProxy:\n\t\t\tretirements <- r\n\t\t\tretired += 1\n\t\t\tif DEBUG {\n\t\t\t\tlog.Printf(\"retired => %d; len(commands) => %d\\n\", retired, len(commands))\n\t\t\t}\n\t\t\tif retired == len(commands) {\n\t\t\t\tctl <- AllRetired\n\t\t\t\treturn\n\t\t\t}\n\t\tcase i := <-outSync:\n\t\t\tif DEBUG {\n\t\t\t\tlog.Printf(\"got sync %d\\n\", i)\n\t\t\t}\n\t\t\tmuxed[i] = <-outs[i]\n\t\t\tif DEBUG {\n\t\t\t\tlog.Printf(\"sending line '%v'\\n\", muxed)\n\t\t\t}\n\t\t\tout <- strings.Join(muxed, \" \")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "d9ef4502ffbd01962a7900fab15e39c8", "score": "0.56778926", "text": "func (a App) Daemonize() {\n\tnullFile, err := os.OpenFile(os.DevNull, os.O_RDWR, 0)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tos.Exit(1)\n\t}\n\n\tvar daemonFile *os.File\n\tif a.daemonLogFileName != \"\" && a.logDir != \"\" {\n\t\tdaemonFile, err = os.OpenFile(filepath.Join(a.logDir, a.daemonLogFileName), os.O_WRONLY|os.O_CREATE|os.O_APPEND, a.daemonLogFileMode)\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t\tos.Exit(1)\n\t\t}\n\t} else {\n\t\tdaemonFile = nullFile\n\t}\n\n\tif err := a.Daemon.Daemonize(\n\t\ta.homeDir, // workDir\n\t\tnullFile, // inFile\n\t\tdaemonFile, // outFIle\n\t\tdaemonFile, // errFile\n\t); err != nil {\n\t\tfmt.Println(err)\n\t\tos.Exit(1)\n\t}\n}", "title": "" }, { "docid": "f62ec52286bc333bbe0cb738a6d22a4e", "score": "0.56736875", "text": "func (s *Sidecar) RunDaemon(ctx context.Context) error {\n\terr := workloadapi.WatchX509Context(ctx, &x509Watcher{sidecar: s}, workloadapi.WithAddr(\"unix://\"+s.config.AgentAddress))\n\tif err != nil && !errors.Is(err, context.Canceled) {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d13994db6891cace163827ee38d061f3", "score": "0.56597877", "text": "func (h Handler) Execute(args []string, requests <-chan svc.ChangeRequest, changes chan<- svc.Status) (ssec bool, errno uint32) {\n\t// In all circumstances, indicate that we're stopping when we exit\n\tdefer func() {\n\t\tchanges <- svc.Status{State: svc.StopPending}\n\t}()\n\n\t// Track progress\n\tvar checkpoint uint32\n\n\t// Indicate to the system that we're starting up\n\tcheckpoint = sendProgress(changes, checkpoint)\n\n\th.log(\"Program Arguments: %#v\", os.Args)\n\n\t// Check for errors in the arguments provided by the OS\n\tif h.ConfErr != nil {\n\t\th.log(\"Invalid Program Arguments: %v\", h.ConfErr)\n\t\treturn false, 1\n\t}\n\n\t// Parse arguments provided by the service manager\n\tif len(args) > 0 {\n\t\th.Name = args[0]\n\t}\n\tif len(args) > 1 {\n\t\targs = args[1:]\n\t\th.log(\"Service Arguments: %#v\", args)\n\t\tvar cmd ServiceCmd\n\t\tparser := kong.Must(&cmd)\n\t\tif _, err := parser.Parse(args); err != nil {\n\t\t\th.log(\"Invalid Service Arguments: %v\", err)\n\t\t\treturn false, 1\n\t\t}\n\t\t/*\n\t\t\t} else if command != enforceCmd.FullCommand() {\n\t\t\t\th.log(\"Invalid Service Command: %s\", command)\n\t\t\t\treturn false, 1\n\t\t\t}\n\t\t*/\n\t\tif cmd.Server != \"\" {\n\t\t\th.Conf.Server = cmd.Server\n\t\t}\n\t\tif cmd.Passive {\n\t\t\th.Conf.Passive = true\n\t\t}\n\t}\n\tcheckpoint = sendProgress(changes, checkpoint)\n\n\t// Determine how to invoke a UI process within a session\n\texecutable, err := os.Executable()\n\tif err != nil {\n\t\th.log(\"Failed to query executable: %v\", err)\n\t\treturn false, 1\n\t}\n\tuiCommand := enforcer.Command{\n\t\tPath: executable,\n\t\tArgs: []string{\"ui\"},\n\t}\n\tcheckpoint = sendProgress(changes, checkpoint)\n\n\t// Examine the environment\n\tenvironment, err := buildEnvironment()\n\tif err != nil {\n\t\th.log(\"Failed to collect environment: %v\\n\", err)\n\t\treturn false, 1\n\t}\n\tcheckpoint = sendProgress(changes, checkpoint)\n\n\t// Prepare a guardian client\n\tclient := newClient(h.Conf.Server)\n\tcheckpoint = sendProgress(changes, checkpoint)\n\n\t// Determine the policy cache directory\n\tpolDir, err := cacheDir()\n\tif err != nil {\n\t\th.log(\"Failed to locate cache directory: %v\\n\", err)\n\t}\n\n\t// Prepare a filesystem policy provider that can act as a policy cache\n\tvar cache policy.Cache\n\tif polDir != \"\" {\n\t\tprov := fsprov.New(polDir)\n\t\tdefer prov.Close()\n\t\tcache = prov\n\t}\n\n\t// Prepare the service\n\tservice := enforcer.New(client, time.Second, time.Minute, uiCommand, environment, cache, h.Conf.Passive, h.Logger)\n\tcheckpoint = sendProgress(changes, checkpoint)\n\n\t// Start the service\n\tif err := service.Start(); err != nil {\n\t\th.log(\"Failed to start service: %v.\", err)\n\t\treturn false, 1\n\t}\n\n\t// Stop the service when we exit\n\tdefer service.Stop()\n\n\t// Switch to the running state\n\tchanges <- svc.Status{State: svc.Running, Accepts: cmdsAccepted}\n\n\t// Main service loop\n\tfor {\n\t\treq := <-requests\n\t\tswitch req.Cmd {\n\t\tcase svc.Interrogate:\n\t\t\tchanges <- req.CurrentStatus\n\t\t\t// Testing deadlock from https://code.google.com/p/winsvc/issues/detail?id=4\n\t\t\ttime.Sleep(100 * time.Millisecond)\n\t\t\tchanges <- req.CurrentStatus\n\t\tcase svc.Stop, svc.Shutdown:\n\t\t\tchanges <- svc.Status{State: svc.StopPending}\n\t\t\th.log(\"Service shutting down.\")\n\t\t\treturn false, 0\n\t\tcase svc.Pause:\n\t\t\tchanges <- svc.Status{State: svc.Paused, Accepts: cmdsAccepted}\n\t\t\th.log(\"Service paused.\")\n\t\t\tservice.Stop()\n\t\tcase svc.Continue:\n\t\t\tchanges <- svc.Status{State: svc.Running, Accepts: cmdsAccepted}\n\t\t\th.log(\"Service unpaused.\")\n\t\t\tservice.Start()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "464226767dd73aaddbcaa96d11e0d24f", "score": "0.565798", "text": "func main() {\n\tdaemon := false\n\n\targumentsProvided := os.Args[1:]\n\tif len(argumentsProvided) == 0 {\n\t\tdaemon = true\n\t}\n\n\tvar err error\n\tvar args arguments\n\n\tif !daemon {\n\t\targs, err = validate(argumentsProvided)\n\t} else {\n\t\targs, err = readTheConfigurations()\n\t}\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tvar text *http.Response\n\tvar errr error\n\n\tif args.isQuote {\n\t\ttext, errr = data.GetQuote()\n\t} else {\n\t\ttext, errr = data.GetWord()\n\t}\n\n\tif errr != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Print(text)\n}", "title": "" }, { "docid": "43a6661c757e015060198435a83e8c31", "score": "0.5656092", "text": "func main() {\n\tswitch os.Args[1] {\n\tcase \"run\":\n\t\trun()\n\tcase \"child\":\n\t\tchild()\n\tdefault:\n\t\tpanic(\"bad command!\")\n\t}\n}", "title": "" }, { "docid": "e6a16bb332142ec9fe12c435e26e6c16", "score": "0.5655372", "text": "func main() {\n\texec := e.Instance\n\tdefer exec.Run()\n\n\texec.Task(\"onStart\", func() {\n\t\texec.Set(\"startTime\", time.Now())\n\t}).Private()\n\n\texec.Task(\"onEnd\", func() {\n\t\texec.Println(fmt.Sprintf(\"Finished in %s!\", time.Since(exec.Get(\"startTime\").Time()).String()))\n\t}).Private()\n\n\ttype F struct {\n\t\tF func() interface{}\n\t}\n\n\tstage := exec.NewArgument(\"stage\", \"Provide the running stage\")\n\tstage.Default = \"qa\"\n\tstage.Type = e.String\n\n\texec.AddArgument(stage)\n\n\t//run always on the server set by stage dynamically\n\t//exec.OnServers(func() []string {\n\t//\treturn []string{exec.GetArgument(\"stage\").String()}\n\t//})\n\n\targ2 := exec.NewArgument(\"arg2\", \"Provide the arg2\")\n\targ2.Default = \"test\"\n\n\texec.AddArgument(arg2)\n\n\texec.Set(\"env\", \"prod\")\n\n\texec.Set(\"bin/mysql\", \"mysql default\")\n\n\texec.Set(\"test\", func() interface{} { return \"text\" })\n\n\texec.Set(\"functest\", F{F: func() interface{} {\n\t\treturn \"date\"\n\t}})\n\n\texec.Set(\"localUser\", exec.Local(\"git config --get %s\", \"user.name\"))\n\n\texec.\n\t\tServer(\"prod1\", \"root@domain.com\").\n\t\tAddRole(\"prod\").\n\t\tSet(\"bin/mysql\", \"mysql prod\")\n\n\texec.\n\t\tServer(\"prod2\", \"root@domain.com\").\n\t\tAddRole(\"prod\").\n\t\tSet(\"bin/mysql\", \"mysql prod\")\n\n\texec.\n\t\tServer(\"qa\", \"root@domain.com\").\n\t\tKey(\"~/.ssh/id_rsa\").\n\t\tAddRole(\"qa\").\n\t\tSet(\"bin/mysql\", \"mysql qa\")\n\n\texec.\n\t\tServer(\"stage\", \"root@domain.com\").\n\t\tAddRole(\"stage\")\n\n\topt1 := exec.NewOption(\"opt1\", \"test\")\n\topt2 := exec.NewOption(\"opt2\", \"test\")\n\n\texec.\n\t\tTask(\"upload\", func() {\n\t\t\texec.Remote(\"ls -la /\")\n\t\t\texec.Upload(\"test.txt\", \"~/test.txt\")\n\t\t}).\n\t\tOnServers(func() []string {\n\t\t\treturn []string{\"prod1\"}\n\t\t})\n\n\texec.\n\t\tTask(\"download\", func() {\n\t\t\texec.Remote(\"ls -la /\")\n\t\t\texec.Download(\"~/test.txt\", \"test.txt\")\n\t\t}).\n\t\tOnServers(func() []string {\n\t\t\treturn []string{\"prod1\"}\n\t\t})\n\n\texec.\n\t\tTask(\"test1\", func() {\n\t\t\t//fmt.Println(exec.TaskContext.GetOption(\"opt1\").ToString())\n\t\t\texec.Remote(\"echo Git user is: \" + exec.Get(\"localUser\").String())\n\t\t\texec.Remote(\"ls -la /\")\n\t\t\tfmt.Println(exec.TaskContext.GetArgument(\"stage\"))\n\t\t\tfmt.Println(exec.TaskContext.GetArgument(\"arg2\"))\n\t\t}).\n\t\tShortDescription(\"Running test1 task\").\n\t\tAddOption(opt1)\n\n\texec.\n\t\tTask(\"test2\", func() {\n\t\t\texec.Remote(\"ls -la ~\")\n\t\t}).\n\t\tShortDescription(\"Running test2 task\").\n\t\tAddOption(opt2)\n\n\texec.\n\t\tTask(\"test3\", func() {\n\t\t\texec.Remote(\"ls -la ~/.ssh\")\n\t\t}).\n\t\tShortDescription(\"Running test3 task\")\n\n\t//should avoid using RunLocal in a task that will run in a stage with multiple servers associated!\n\texec.\n\t\tTask(\"local\", func() {\n\t\t\texec.Local(\"ls -la ~/Public; ls -la /Users/\")\n\t\t\texec.Local(\"docker\")\n\t\t}).\n\t\tOnce().\n\t\tShortDescription(\"Running local task\")\n\n\texec.\n\t\tTask(\"yarn\", func() {\n\t\t\texec.Local(\"yarn\")\n\t\t})\n\n\texec.\n\t\tTask(\"docker\", func() {\n\t\t\texec.Local(\"docker stats\")\n\t\t})\n\n\texec.\n\t\tTask(\"docker-remote\", func() {\n\t\t\texec.Remote(\"docker\")\n\t\t}).\n\t\tOnServers(func() []string {\n\t\t\treturn []string{\"prod1\"}\n\t\t})\n\n\texec.\n\t\tTask(\"get\", func() {\n\t\t\texec.Remote(fmt.Sprintf(\"%s\", exec.Get(\"bin/mysql\").String()))\n\t\t\tfmt.Println(exec.TaskContext.GetArgument(\"stage\"))\n\t\t\tfmt.Println(exec.TaskContext.GetArgument(\"arg2\"))\n\t\t}).\n\t\tShortDescription(\"Testing get in different servers contexts\")\n\n\texec.\n\t\tTask(\"get2\", func() {\n\t\t\texec.Remote(fmt.Sprintf(\"%s\", exec.Get(\"functest\").Value().(F).F()))\n\t\t}).\n\t\tShortDescription(\"Testing get2 in different servers contexts\")\n\n\texec.\n\t\tTask(\"get3\", func() {\n\t\t\texec.Println(exec.Get(\"test\").String())\n\t\t}).\n\t\tShortDescription(\"Testing get3 in different servers contexts\").\n\t\tRemoveArgument(\"stage\")\n\n\texec.\n\t\tTaskGroup(\"deploy1\", \"test1\", \"test2\").\n\t\tShortDescription(\"Deploy code 1\")\n\n\texec.\n\t\tTaskGroup(\"deploy2\", \"local\", \"test3\").\n\t\tShortDescription(\"Deploy code 2\")\n\n\texec.\n\t\tTaskGroup(\"deploy3\", \"get\").\n\t\tShortDescription(\"Deploy code 3\")\n\n\texec.\n\t\tTask(\"onservers:a\", func() {\n\t\t\texec.RemoteRunIfNoBinary(\"docker\", []string{\n\t\t\t\t\"echo 'a'\",\n\t\t\t\t\"echo 'b'\",\n\t\t\t})\n\t\t}).\n\t\tOnServers(func() []string {\n\t\t\treturn []string{\"prod1\", \"prod2\"}\n\t\t})\n\n\texec.\n\t\tTask(\"onservers:b\", func() {\n\t\t\texec.RemoteRunIfNoBinary(\"wget\", []string{\n\t\t\t\t\"echo 'a'\",\n\t\t\t\t\"echo 'b'\",\n\t\t\t})\n\t\t}).\n\t\tOnServers(func() []string {\n\t\t\treturn []string{\"prod1\", \"prod2\"}\n\t\t})\n\n\texec.\n\t\tTask(\"onservers:c\", func() {\n\t\t\texec.RemoteRunIfNoBinary(\"docker\", []string{\n\t\t\t\t\"echo 'a'\",\n\t\t\t\t\"echo 'b'\",\n\t\t\t})\n\t\t}).\n\t\tOnlyOnServers([]string{\"prod1\"})\n\n\texec.\n\t\tTask(\"servercontext:host\", func() {\n\t\t\tfmt.Println(exec.ServerContext.Name, exec.ServerContext.GetHost())\n\t\t}).\n\t\tOnServers(func() []string {\n\t\t\treturn []string{\"prod1\", \"prod2\"}\n\t\t})\n\n\texec.\n\t\tTask(\"onservers:read\", func() {\n\t\t\tfmt.Printf(\"`%s`\\n\", exec.Remote(\"git config --get %s\", \"user.name\").String())\n\t\t}).\n\t\tOnServers(func() []string {\n\t\t\treturn []string{\"prod1\"}\n\t\t})\n\n\texec.\n\t\tTask(\"ask\", func() {\n\t\t\tresponse := exec.Ask(\"How are you?\", \"better\")\n\n\t\t\tcolor.Yellow(\"Your response is `%s`\", response)\n\t\t}).\n\t\tOnServers(func() []string {\n\t\t\treturn []string{\"prod1\"}\n\t\t})\n\n\texec.\n\t\tTask(\"ask-confirmation\", func() {\n\t\t\tresponse := exec.AskWithConfirmation(\"Would you like to give it a shot?\", true)\n\n\t\t\tcolor.Yellow(\"Your response is `%t`\", response)\n\n\t\t\tresponse = exec.AskWithConfirmation(\"Would you like to give it a shot again?\", false)\n\n\t\t\tcolor.Yellow(\"Your response is `%t`\", response)\n\t\t}).\n\t\tOnServers(func() []string {\n\t\t\treturn []string{\"prod1\"}\n\t\t})\n\n\texec.\n\t\tTask(\"ask-choices\", func() {\n\t\t\tresponse := exec.AskWithChoices(\"What are your choices?\", map[string]interface{}{\n\t\t\t\t\"default\": []string{\n\t\t\t\t\t\"agent\",\n\t\t\t\t},\n\t\t\t\t\"choices\": []string{\n\t\t\t\t\t\"agent\",\n\t\t\t\t\t\"tty\",\n\t\t\t\t\t\"ssh\",\n\t\t\t\t},\n\t\t\t})\n\n\t\t\tcolor.Yellow(\"Your responses are `%v`\", response)\n\t\t}).\n\t\tOnServers(func() []string {\n\t\t\treturn []string{\"prod1\"}\n\t\t})\n\n\texec.Before(\"test3\", \"local\")\n\texec.Before(\"get3\", \"test3\")\n\texec.Before(\"get3\", \"local\")\n\texec.After(\"local\", \"onservers:a\")\n\texec.After(\"local\", \"get3\")\n\texec.After(\"onservers:a\", \"local\")\n}", "title": "" }, { "docid": "d22cd126f3e8cb26589ab752ee677848", "score": "0.56383806", "text": "func (c *WorkerConf) Run() error {\n\tvar err error\n\n\t// Initialize\n\tc.StartedTs = time.Now().Unix()\n\tif c.Id == \"\" {\n\t\t// Allow users to pass in existing ids to re-use old worker configs\n\t\tc.Id = bson.NewObjectId()\n\t}\n\n\tif c.Daemon {\n\t\tpath, err := osext.Executable()\n\t\tif err != nil {\n\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\"err\": err.Error(),\n\t\t\t}).Error(\"Problem getting executable path\")\n\t\t\treturn err\n\t\t}\n\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"path\": path,\n\t\t}).Debug(\"Path to current executable is\")\n\n\t\tcmd := exec.Command(path, \"worker\")\n\t\tif len(c.Tags) != 0 {\n\t\t\tcmd.Args = append(cmd.Args, \"--tags\")\n\t\t\tcmd.Args = append(cmd.Args, strings.Join(c.Tags, \",\"))\n\t\t}\n\t\tif c.Id != \"\" {\n\t\t\tcmd.Args = append(cmd.Args, \"--id\")\n\t\t\tcmd.Args = append(cmd.Args, c.Id.Hex())\n\t\t}\n\t\tif c.Logfile != \"\" {\n\t\t\tcmd.Args = append(cmd.Args, \"--logfile\")\n\t\t\tcmd.Args = append(cmd.Args, c.Logfile)\n\t\t}\n\t\tif c.CheckInterval != 0 {\n\t\t\tcmd.Args = append(cmd.Args, \"--checkinterval\")\n\t\t\tcmd.Args = append(cmd.Args, fmt.Sprintf(\"%f\", c.CheckInterval))\n\t\t}\n\n\t\tif cmd.SysProcAttr != nil {\n\t\t\tcmd.SysProcAttr.Setpgid = true\n\t\t} else {\n\t\t\tcmdAttrs := &syscall.SysProcAttr{}\n\t\t\tcmdAttrs.Setpgid = true\n\t\t\tcmd.SysProcAttr = cmdAttrs\n\t\t}\n\n\t\t// FIXME: Redirect the first couple seconds of stdout here to check that process started ok\n\t\tcmd.Start()\n\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"tags\": c.Tags,\n\t\t\t\"pid\": cmd.Process.Pid,\n\t\t\t\"checkInterval\": c.CheckInterval,\n\t\t\t\"logfile\": c.Logfile,\n\t\t}).Info(\"Starting daemonized executable\")\n\n\t} else {\n\t\t// Calculate adjusted check time, in seconds\n\t\tif c.CheckInterval < 0.5 {\n\t\t\tc.CheckInterval = 0.5\n\t\t}\n\n\t\t// Handle clean shutdown\n\t\tshutdownChan := make(chan os.Signal, 1)\n\t\tsignal.Notify(shutdownChan, os.Interrupt)\n\t\tsignal.Notify(shutdownChan, syscall.SIGTERM)\n\t\tgo func() {\n\t\t\t<-shutdownChan\n\t\t\t// Register the worker as stopped\n\t\t\tmaxShutdownRetries := 10\n\t\t\tnShutdownRetries := 0\n\t\t\tlog.Warn(\"Received shutdown signal; attempting to set worker to 'stopped'\")\n\t\t\terr = c.Stop()\n\t\t\tfor err != nil && nShutdownRetries < maxShutdownRetries {\n\t\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\t\"err\": err.Error(),\n\t\t\t\t\t\"nattempts\": nShutdownRetries,\n\t\t\t\t\t\"retryDelay\": c.CheckIntervalMs(),\n\t\t\t\t}).Error(\"Problem updating worker to the 'stopped' state\")\n\t\t\t\ttime.Sleep(c.CheckIntervalMs())\n\t\t\t}\n\t\t\tif nShutdownRetries < maxShutdownRetries {\n\t\t\t\tlog.Info(\"Successfully registered worker as 'stopped'.\")\n\t\t\t} else {\n\t\t\t\t// Worker will exit when it checks its 'stopped' setting\n\t\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\t\"nattempts\": nShutdownRetries,\n\t\t\t\t}).Info(\"Failed to register worker as 'stopped'. Will exit anyway.\")\n\t\t\t}\n\t\t}()\n\n\t\tc.Pid = os.Getpid()\n\n\t\terr = c.SetLogfileName()\n\t\tif err != nil {\n\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\"err\": err.Error(),\n\t\t\t}).Fatal(\"Failed to set logfile name\")\n\t\t}\n\n\t\t// Setup logfile; closes when process exits\n\t\tvar f *os.File\n\t\tf, err = os.Create(c.Logfile)\n\t\tif err != nil {\n\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\"logfile\": c.Logfile,\n\t\t\t\t\"error\": err.Error(),\n\t\t\t}).Fatal(\"Failed to create worker logfile\")\n\t\t}\n\t\tdefer f.Close()\n\n\t\t// Log json output to file\n\t\t// All logs before this go to stdout\n\t\tlog.SetFormatter(&log.JSONFormatter{})\n\t\tlog.SetOutput(f)\n\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"tags\": c.Tags,\n\t\t\t\"pid\": c.Pid,\n\t\t\t\"id\": c.Id.Hex(),\n\t\t\t\"checkInterval\": c.CheckInterval,\n\t\t\t\"logfile\": c.Logfile,\n\t\t}).Info(\"Starting executable\")\n\n\t\t// FIXME: Fire off heatbeat in a goroutine\n\t\t// - checks if worker should be paused or shut down\n\t\t// - do this instead of sending a signal from the parent process\n\t\t// - keep track of last heartbeat\n\t\t// - last task run should be searchable via the tasks\n\t\tgo func() {\n\t\t\t// Will stop when worker process shuts down\n\t\t\treturn\n\t\t}()\n\n\t\tc.MustRegister()\n\t\tc.ProcessTasks()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "dbcc99c2a48af0bfbf5d60437da8c98e", "score": "0.5636461", "text": "func (s *Server) Run(args *RunArgs, reply *RunResponse) (err error) {\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tlog.Crit(\"panic\", \"msg\", r)\n\t\t\terr = fmt.Errorf(\"Server error: %v\", r)\n\t\t}\n\t}()\n\n\tif args.Name == \"\" {\n\t\t// Name it after the program, but avoid collisions by checking.\n\t\tprog := filepath.Base(args.Program)\n\t\tif srvc := s.getService(prog); srvc == nil {\n\t\t\targs.Name = prog\n\t\t} else if srvc.Conf.Temp && !srvc.Running() {\n\t\t\t// Colliding with an ended temporary service, just replace it.\n\t\t\tif err := s.removeService(prog); err == nil {\n\t\t\t\targs.Name = prog\n\t\t\t}\n\t\t}\n\n\t\t// If either that didn't work, append a number to name\n\t\tif args.Name == \"\" {\n\t\t\tnextProg := prog\n\t\t\tfor i := 1; i <= 50 && s.getService(nextProg) != nil; i++ {\n\t\t\t\tnextProg = fmt.Sprintf(\"%s-%d\", prog, i)\n\t\t\t}\n\t\t\tif s.getService(nextProg) != nil {\n\t\t\t\treturn fmt.Errorf(\"Failed to name the service\")\n\t\t\t}\n\t\t\targs.Name = nextProg\n\t\t}\n\t}\n\n\tconf := config.Service{\n\t\tName: args.Name,\n\t\tProgram: args.Program,\n\t\tArgs: args.Args,\n\t\tDir: args.Dir,\n\t\tEnv: args.Env,\n\n\t\tTemp: true,\n\t\tCleanAfter: args.CleanAfter,\n\t}\n\tif err := conf.Sanitize(); err != nil {\n\t\treturn err\n\t}\n\n\tserv, err := service.New(conf)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := s.addService(serv, false); err != nil {\n\t\treturn fmt.Errorf(\"Failed to add service (%s): %v\", conf.Name, err)\n\t}\n\n\t// Update after creating, but before changing its state\n\tselect {\n\tcase s.serviceUpdates <- serv.Info():\n\tdefault:\n\t}\n\n\tlog.Debug(\"Running service\", \"service\", serv.Conf.Name)\n\tif err := serv.Start(s.serviceUpdates); err != nil {\n\t\treturn err\n\t}\n\n\treply.Service = serv.Info()\n\treturn nil\n}", "title": "" }, { "docid": "6247ac1596f359b8e26396ea3e3a157e", "score": "0.563322", "text": "func main() {\n\tapp := cli.NewApp()\n\tapp.Name = \"SimonWang00\"\n\tapp.Version = \"1.0.0\"\n\tapp.Email = \"simon_wang00@163.com\"\n\tapp.Commands = []cli.Command{\n\t\t{\n\t\t\tName: \"prot\",\n\t\t\tAliases: []string{\"p\"},\n\t\t\tUsage: \"用户端口\",\n\t\t\tBefore: func(c *cli.Context) error {\n\t\t\t\tfmt.Println(\"Before\")\n\t\t\t\treturn nil\n\t\t\t},\n\t\t\tAction: func(c *cli.Context) {\n\t\t\t\tfmt.Println(\"Action\")\n\t\t\t\tfmt.Println(c.Args().First())\n\t\t\t},\n\t\t\tAfter: func(c *cli.Context) error {\n\t\t\t\tfmt.Println(\"After\")\n\t\t\t\treturn nil\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tName: \"isdebug\",\n\t\t\tAliases: []string{\"p\"},\n\t\t\tUsage: \"is debug\",\n\t\t\tBefore: func(c *cli.Context) error {\n\t\t\t\tfmt.Println(\"Before\")\n\t\t\t\treturn nil\n\t\t\t},\n\t\t\tAction: func(c *cli.Context) {\n\t\t\t\tfmt.Println(\"Action\")\n\t\t\t\tfmt.Println(c.Args().First())\n\t\t\t},\n\t\t\tAfter: func(c *cli.Context) error {\n\t\t\t\tfmt.Println(\"After\")\n\t\t\t\treturn nil\n\t\t\t},\n\t\t},\n\t}\n\n\tif err := app.Run(os.Args); err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "bc33f16dbcca68128e08e4fd769bee5a", "score": "0.563049", "text": "func (dn *Daemon) Run(stopCh <-chan struct{}, exitCh <-chan error) error {\n\tif utils.ClusterType == utils.ClusterTypeOpenshift {\n\t\tglog.V(0).Infof(\"Run(): start daemon. openshiftFlavor: %s\", dn.openshiftContext.OpenshiftFlavor)\n\t} else {\n\t\tglog.V(0).Infof(\"Run(): start daemon.\")\n\t}\n\n\tif dn.useSystemdService {\n\t\tglog.V(0).Info(\"Run(): daemon running in systemd mode\")\n\t}\n\t// Only watch own SriovNetworkNodeState CR\n\tdefer utilruntime.HandleCrash()\n\tdefer dn.workqueue.ShutDown()\n\n\tif !dn.useSystemdService {\n\t\thostManager := host.NewHostManager(dn.useSystemdService)\n\t\thostManager.TryEnableRdma()\n\t\thostManager.TryEnableTun()\n\t\thostManager.TryEnableVhostNet()\n\t\terr := systemd.CleanSriovFilesFromHost(utils.ClusterType == utils.ClusterTypeOpenshift)\n\t\tif err != nil {\n\t\t\tglog.Warningf(\"failed to remove all the systemd sriov files error: %v\", err)\n\t\t}\n\t}\n\n\tif err := dn.tryCreateUdevRuleWrapper(); err != nil {\n\t\treturn err\n\t}\n\n\tvar timeout int64 = 5\n\tdn.mu = &sync.Mutex{}\n\tinformerFactory := sninformer.NewFilteredSharedInformerFactory(dn.client,\n\t\ttime.Second*15,\n\t\tnamespace,\n\t\tfunc(lo *metav1.ListOptions) {\n\t\t\tlo.FieldSelector = \"metadata.name=\" + dn.name\n\t\t\tlo.TimeoutSeconds = &timeout\n\t\t},\n\t)\n\n\tinformer := informerFactory.Sriovnetwork().V1().SriovNetworkNodeStates().Informer()\n\tinformer.AddEventHandler(cache.ResourceEventHandlerFuncs{\n\t\tAddFunc: dn.enqueueNodeState,\n\t\tUpdateFunc: func(old, new interface{}) {\n\t\t\tdn.enqueueNodeState(new)\n\t\t},\n\t})\n\n\tcfgInformerFactory := sninformer.NewFilteredSharedInformerFactory(dn.client,\n\t\ttime.Second*30,\n\t\tnamespace,\n\t\tfunc(lo *metav1.ListOptions) {\n\t\t\tlo.FieldSelector = \"metadata.name=\" + \"default\"\n\t\t},\n\t)\n\n\tcfgInformer := cfgInformerFactory.Sriovnetwork().V1().SriovOperatorConfigs().Informer()\n\tcfgInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{\n\t\tAddFunc: dn.operatorConfigAddHandler,\n\t\tUpdateFunc: dn.operatorConfigChangeHandler,\n\t})\n\n\trand.Seed(time.Now().UnixNano())\n\tnodeInformerFactory := informers.NewSharedInformerFactory(dn.kubeClient,\n\t\ttime.Second*15,\n\t)\n\tdn.nodeLister = nodeInformerFactory.Core().V1().Nodes().Lister()\n\tnodeInformer := nodeInformerFactory.Core().V1().Nodes().Informer()\n\tnodeInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{\n\t\tAddFunc: dn.nodeAddHandler,\n\t\tUpdateFunc: dn.nodeUpdateHandler,\n\t})\n\tgo cfgInformer.Run(dn.stopCh)\n\tgo nodeInformer.Run(dn.stopCh)\n\ttime.Sleep(5 * time.Second)\n\tgo informer.Run(dn.stopCh)\n\tif ok := cache.WaitForCacheSync(stopCh, cfgInformer.HasSynced, nodeInformer.HasSynced, informer.HasSynced); !ok {\n\t\treturn fmt.Errorf(\"failed to wait for caches to sync\")\n\t}\n\n\tglog.Info(\"Starting workers\")\n\t// Launch one worker to process\n\tgo wait.Until(dn.runWorker, time.Second, stopCh)\n\tglog.Info(\"Started workers\")\n\n\tfor {\n\t\tselect {\n\t\tcase <-stopCh:\n\t\t\tglog.V(0).Info(\"Run(): stop daemon\")\n\t\t\treturn nil\n\t\tcase err, more := <-exitCh:\n\t\t\tglog.Warningf(\"Got an error: %v\", err)\n\t\t\tif more {\n\t\t\t\tdn.refreshCh <- Message{\n\t\t\t\t\tsyncStatus: syncStatusFailed,\n\t\t\t\t\tlastSyncError: err.Error(),\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn err\n\t\tcase <-time.After(30 * time.Second):\n\t\t\tglog.V(2).Info(\"Run(): period refresh\")\n\t\t\tif err := dn.tryCreateUdevRuleWrapper(); err != nil {\n\t\t\t\tglog.V(2).Info(\"Could not create udev rule: \", err)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "6793d1c599fec0622d5b40193846aeeb", "score": "0.56267923", "text": "func daemonInstall(ctx *cli.Context) (err error) {\n\t// ensure root\n\tif !isRootUser() {\n\t\terr = errors.New(ErrNotRoot)\n\t\treturn\n\t}\n\n\t// create daemon user\n\t// set daemon user's home location\n\t// create daemon config\n\t// register startup\n\n\treturn\n}", "title": "" }, { "docid": "80e22467ebc0095b480a9b9d9e4e16a9", "score": "0.55979586", "text": "func run(cmd *exec.Cmd) error {\n\tcmdStr := strings.Join(cmd.Args, \" \")\n\tif cmd.Dir != \"\" {\n\t\tlog.Debug(\"running [%s] in directory %s\", cmdStr, cmd.Dir)\n\t} else {\n\t\tlog.Debug(\"running [%s]\", cmdStr)\n\t}\n\treturn cmd.Run()\n}", "title": "" }, { "docid": "53780e01dc2d3cecd736f5b8640c8b95", "score": "0.55955935", "text": "func Server(cfg *config.Config) *cli.Command {\n\treturn &cli.Command{\n\t\tName: \"server\",\n\t\tUsage: fmt.Sprintf(\"start %s extension without runtime (unsupervised mode)\", cfg.Service.Name),\n\t\tCategory: \"server\",\n\t\tBefore: func(c *cli.Context) error {\n\t\t\terr := parser.ParseConfig(cfg)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Printf(\"%v\", err)\n\t\t\t\tos.Exit(1)\n\t\t\t}\n\t\t\treturn err\n\t\t},\n\t\tAction: func(c *cli.Context) error {\n\t\t\tlogger := logging.Configure(cfg.Service.Name, cfg.Log)\n\t\t\terr := tracing.Configure(cfg, logger)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tgr := run.Group{}\n\t\t\tctx, cancel := defineContext(cfg)\n\n\t\t\tdefer cancel()\n\n\t\t\tgr.Add(func() error {\n\t\t\t\ts, err := ocdav.Service(\n\t\t\t\t\tocdav.Name(cfg.HTTP.Namespace+\".\"+cfg.Service.Name),\n\t\t\t\t\tocdav.Version(version.String),\n\t\t\t\t\tocdav.Context(ctx),\n\t\t\t\t\tocdav.Logger(logger.Logger),\n\t\t\t\t\tocdav.Address(cfg.HTTP.Addr),\n\t\t\t\t\tocdav.FilesNamespace(cfg.FilesNamespace),\n\t\t\t\t\tocdav.WebdavNamespace(cfg.WebdavNamespace),\n\t\t\t\t\tocdav.SharesNamespace(cfg.SharesNamespace),\n\t\t\t\t\tocdav.Timeout(cfg.Timeout),\n\t\t\t\t\tocdav.Insecure(cfg.Insecure),\n\t\t\t\t\tocdav.PublicURL(cfg.PublicURL),\n\t\t\t\t\tocdav.Prefix(cfg.HTTP.Prefix),\n\t\t\t\t\tocdav.GatewaySvc(cfg.Reva.Address),\n\t\t\t\t\tocdav.JWTSecret(cfg.TokenManager.JWTSecret),\n\t\t\t\t\tocdav.ProductName(cfg.Status.ProductName),\n\t\t\t\t\tocdav.Product(cfg.Status.Product),\n\t\t\t\t\tocdav.Version(cfg.Status.Version),\n\t\t\t\t\tocdav.VersionString(cfg.Status.VersionString),\n\t\t\t\t\tocdav.Edition(cfg.Status.Edition),\n\t\t\t\t\t// ocdav.FavoriteManager() // FIXME needs a proper persistence implementation\n\t\t\t\t\t// ocdav.LockSystem(), // will default to the CS3 lock system\n\t\t\t\t\t// ocdav.TLSConfig() // tls config for the http server\n\t\t\t\t)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\treturn s.Run()\n\t\t\t}, func(err error) {\n\t\t\t\tlogger.Info().Err(err).Str(\"server\", c.Command.Name).Msg(\"Shutting down server\")\n\t\t\t\tcancel()\n\t\t\t})\n\n\t\t\tdebugServer, err := debug.Server(\n\t\t\t\tdebug.Logger(logger),\n\t\t\t\tdebug.Context(ctx),\n\t\t\t\tdebug.Config(cfg),\n\t\t\t)\n\n\t\t\tif err != nil {\n\t\t\t\tlogger.Info().Err(err).Str(\"server\", \"debug\").Msg(\"Failed to initialize server\")\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tgr.Add(debugServer.ListenAndServe, func(_ error) {\n\t\t\t\tcancel()\n\t\t\t})\n\n\t\t\treturn gr.Run()\n\t\t},\n\t}\n}", "title": "" }, { "docid": "1eb31d584fb1c7217a4d0b91c9109c44", "score": "0.55931175", "text": "func main() {\n\tif err := rootCommand().Execute(); err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "1425258a14c495b8739956466958ae6c", "score": "0.5591719", "text": "func daemonStop(ctx *cli.Context) (err error) {\n\tcfg := config.New()\n\n\t// ensure admin user\n\tif !isDaemonUser(&cfg) {\n\t\terr = errors.New(ErrNotAdmin)\n\t\treturn\n\t}\n\n\t//TODO\n\n\treturn\n}", "title": "" }, { "docid": "7c4302f635f74e38239caef2e7da09da", "score": "0.5589423", "text": "func addStartCommand(ctx context.Context, dic *di.Container, app *App) {\n\tapp.Commands = append(app.Commands, &cli.Command{\n\t\tName: \"start\",\n\t\tUsage: \"Starts \" + appDefaultUsage,\n\t\tAction: func(cc *cli.Context) error {\n\t\t\t// provide cli context\n\t\t\tif err := dic.Provide(func() *cli.Context { return cc }); err != nil {\n\t\t\t\treturn ErrProvideCliContext(err)\n\t\t\t}\n\n\t\t\treturn invokeServices(dic)\n\t\t},\n\t\tAfter: func(cc *cli.Context) error {\n\t\t\t<-cc.Done() // wait while context canceled\n\n\t\t\tctx.Cancel()\n\t\t\tctx.WgWait() // wait while all workers finished\n\n\t\t\tlog.Println(\"Application shutdown complete\")\n\n\t\t\treturn nil\n\t\t},\n\t})\n}", "title": "" }, { "docid": "10c8444521d7d98bdca6f73ff36c4b49", "score": "0.55832213", "text": "func main(hs []tool.Handler, i int, args tool.Data) {\n\t// The first argument in the list is a path.\n\t// If it's missing use an empty string instead.\n\tp := args.GetDefault(0, \"\")\n\n\t// Determine import path and absolute path of the project to run.\n\timp, err := importpath.Clean(p)\n\tif err != nil {\n\t\tlog.Error.Panic(err)\n\t}\n\tdir, err := importpath.ToPath(imp)\n\tif err != nil {\n\t\tlog.Error.Panic(err)\n\t}\n\n\t// Prepare a path of configuration file.\n\tcf := filepath.Join(dir, ConfigFile)\n\n\t// Start a user tasks runner and instances controller.\n\tgo instanceController()\n\n\t// Start a configuration file watcher.\n\tgo configDaemon(imp, cf)\n\n\t// Show user friendly errors and terminate subprograms\n\t// in case of panics.\n\tdefer func() {\n\t\tchannel <- message{\n\t\t\taction: \"exit\",\n\t\t}\n\t\t<-stopped\n\t\tlog.Trace.Panicln(\"Application has been terminated.\")\n\t}()\n\n\t// Execute all commands from the requested directory.\n\tcurr, _ := os.Getwd()\n\tos.Chdir(dir) // pushd\n\tdefer func() {\n\t\t// Going back to the initial directory.\n\t\tos.Chdir(curr) // popd\n\t}()\n\n\t// Load the configuration.\n\treloadConfig()\n\n\t// Cleaning up after we are done.\n\tsignal.Notify(notify, os.Interrupt, syscall.SIGTERM)\n\t<-notify\n}", "title": "" }, { "docid": "2f33966b5361ef65703a24dd26c5c751", "score": "0.55766594", "text": "func (h *HAproxy) run(command string) error {\n\n\tcmd := exec.Command(\"/bin/bash\", \"-c\", command)\n\tstdout := &bytes.Buffer{}\n\tstderr := &bytes.Buffer{}\n\tcmd.Stdout = stdout\n\tcmd.Stderr = stderr\n\n\t// The end effect of this signal handling requirement is that we can only run _one_\n\t// command at a time. This is totally fine for HAproxy.\n\th.sigLock.Lock()\n\tdefer h.sigLock.Unlock()\n\n\tif !h.signalsHandled {\n\t\tlog.Info(\"Setting up signal handlers\")\n\t\th.swallowSignals()\n\t\th.signalsHandled = true\n\t}\n\n\terr := cmd.Run()\n\n\tif err != nil {\n\t\terr = fmt.Errorf(\"Error running '%s': %s\\n%s\\n%s\", command, err, stdout, stderr)\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "ac161dff5761611a07aa74dc36f3f378", "score": "0.5566318", "text": "func run(opts *options) error {\n\n\t// Logging setup\n\tif err := customSetupLogging(*opts.logLevel, opts.logEncoder); err != nil {\n\t\treturn setupErrorf(setupLog, err, \"Unable to setup the logger\")\n\t}\n\n\t// Print version information\n\tif opts.printVersion {\n\t\tversion.PrintVersionWriter(os.Stdout, \"text\")\n\t\treturn nil\n\t}\n\tversion.PrintVersionLogs(setupLog)\n\n\tif opts.profilingEnabled {\n\t\tsetupLog.Info(\"Starting datadog profiler\")\n\t\tif err := profiler.Start(\n\t\t\tprofiler.WithVersion(version.Version),\n\t\t\tprofiler.WithProfileTypes(profiler.CPUProfile, profiler.HeapProfile),\n\t\t); err != nil {\n\t\t\treturn setupErrorf(setupLog, err, \"unable to start datadog profiler\")\n\t\t}\n\n\t\tdefer profiler.Stop()\n\t}\n\n\t// Dispatch CLI flags to each package\n\tsecrets.SetSecretBackendCommand(opts.secretBackendCommand)\n\tsecrets.SetSecretBackendArgs(opts.secretBackendArgs)\n\n\trenewDeadline := opts.leaderElectionLeaseDuration / 2\n\tretryPeriod := opts.leaderElectionLeaseDuration / 4\n\n\trestConfig := ctrl.GetConfigOrDie()\n\trestConfig.UserAgent = \"datadog-operator\"\n\tmgr, err := ctrl.NewManager(restConfig, config.ManagerOptionsWithNamespaces(setupLog, ctrl.Options{\n\t\tScheme: scheme,\n\t\tMetricsBindAddress: opts.metricsAddr,\n\t\tHealthProbeBindAddress: \":8081\",\n\t\tPort: 9443,\n\t\tLeaderElection: opts.enableLeaderElection,\n\t\tLeaderElectionID: \"datadog-operator-lock\",\n\t\tLeaderElectionResourceLock: opts.leaderElectionResourceLock,\n\t\tLeaseDuration: &opts.leaderElectionLeaseDuration,\n\t\tRenewDeadline: &renewDeadline,\n\t\tRetryPeriod: &retryPeriod,\n\t}))\n\tif err != nil {\n\t\treturn setupErrorf(setupLog, err, \"Unable to start manager\")\n\n\t}\n\n\t// Custom setup\n\tcustomSetupHealthChecks(setupLog, mgr, &opts.maximumGoroutines)\n\tcustomSetupEndpoints(opts.pprofActive, mgr)\n\n\tcreds, err := config.NewCredentialManager().GetCredentials()\n\tif err != nil && opts.datadogMonitorEnabled {\n\t\treturn setupErrorf(setupLog, err, \"Unable to get credentials for DatadogMonitor\")\n\t}\n\n\toptions := controllers.SetupOptions{\n\t\tSupportExtendedDaemonset: controllers.ExtendedDaemonsetOptions{\n\t\t\tEnabled: opts.supportExtendedDaemonset,\n\t\t\tMaxPodUnavailable: opts.edsMaxPodUnavailable,\n\t\t\tCanaryDuration: opts.edsCanaryDuration,\n\t\t\tCanaryReplicas: opts.edsCanaryReplicas,\n\t\t\tCanaryAutoPauseEnabled: opts.edsCanaryAutoPauseEnabled,\n\t\t\tCanaryAutoPauseMaxRestarts: opts.edsCanaryAutoPauseMaxRestarts,\n\t\t\tCanaryAutoFailEnabled: opts.edsCanaryAutoFailEnabled,\n\t\t\tCanaryAutoFailMaxRestarts: opts.edsCanaryAutoFailMaxRestarts,\n\t\t\tMaxPodSchedulerFailure: opts.edsMaxPodSchedulerFailure,\n\t\t},\n\t\tSupportCilium: opts.supportCilium,\n\t\tCreds: creds,\n\t\tDatadogAgentEnabled: opts.datadogAgentEnabled,\n\t\tDatadogMonitorEnabled: opts.datadogMonitorEnabled,\n\t\tOperatorMetricsEnabled: opts.operatorMetricsEnabled,\n\t\tV2APIEnabled: opts.v2APIEnabled,\n\t}\n\n\tif err = controllers.SetupControllers(setupLog, mgr, options); err != nil {\n\t\treturn setupErrorf(setupLog, err, \"Unable to start controllers\")\n\t}\n\n\tif opts.webhookEnabled && opts.datadogAgentEnabled {\n\t\tif err = (&datadoghqv2alpha1.DatadogAgent{}).SetupWebhookWithManager(mgr); err != nil {\n\t\t\treturn setupErrorf(setupLog, err, \"unable to create webhook\", \"webhook\", \"DatadogAgent\")\n\t\t}\n\t}\n\n\t// +kubebuilder:scaffold:builder\n\n\tsetupLog.Info(\"starting manager\")\n\tif err := mgr.Start(ctrl.SetupSignalHandler()); err != nil {\n\t\treturn setupErrorf(setupLog, err, \"Problem running manager\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "59f17c8a53ff5ec531d261a5512fd707", "score": "0.55630845", "text": "func (cmd *commandHelp) run() error {\n\tprintHelp()\n\n\treturn nil\n}", "title": "" }, { "docid": "f7b378a9c8e76b37b8782ddd9c94f346", "score": "0.55422056", "text": "func (s *Starter) Run() error {\n\tif s.Version {\n\t\tshowVersion()\n\t\treturn nil\n\t}\n\tif s.Help {\n\t\tshowHelp()\n\t\treturn nil\n\t}\n\tif err := s.openLogFile(); err != nil {\n\t\treturn err\n\t}\n\tif s.Restart {\n\t\treturn s.restart()\n\t}\n\tif s.Stop {\n\t\treturn s.stop()\n\t}\n\tif s.Daemonize {\n\t\ts.logf(\"WARNING: --daemonize is UNIMPLEMENTED\")\n\t}\n\tif s.Command == \"\" {\n\t\treturn errors.New(\"command is required\")\n\t}\n\n\tctx, cancel := context.WithCancel(context.Background())\n\ts.ctx = ctx\n\ts.cancel = cancel\n\tdefer s.Close()\n\n\t// block reload during start up\n\ts.lockReload()\n\n\t// start background goroutines\n\tgo s.waitSignal()\n\tif s.EnableAutoRestart {\n\t\tgo s.autoRestarter()\n\t}\n\n\tif err := s.openPidFile(); err != nil {\n\t\treturn err\n\t}\n\n\tif err := s.listen(); err != nil {\n\t\tif err == errShutdown {\n\t\t\treturn nil\n\t\t}\n\t\treturn err\n\t}\n\n\t// start first generation\n\tw, err := s.startWorker()\n\tif err != nil {\n\t\tif err == errShutdown {\n\t\t\treturn nil\n\t\t}\n\t\treturn err\n\t}\n\tw.Watch()\n\n\t// enable reload\n\ts.unlockReload()\n\n\ts.wgWorker.Wait()\n\ts.wg.Wait()\n\treturn nil\n}", "title": "" }, { "docid": "4a9d0e251cd504bc0b56ad04fc789de9", "score": "0.5540439", "text": "func (job JobNode) runCommand(ch chan<- Data, httpAddr string, store fsm.Store) {\n\tURI := resources.UnmarsharlYaml(resources.ReadFileBytes(getHome() + \"/odin-config.yml\")).Mongo.Address\n\tos.Setenv(\"ODIN_EXEC_ENV\", \"True\")\n\tos.Setenv(\"ODIN_MONGODB\", URI)\n\tvar cmd *exec.Cmd\n\tif job.Lang == \"go\" {\n\t\tcmd = exec.Command(job.File)\n\t} else {\n\t\tcmd = exec.Command(job.Lang, job.File)\n\t}\n\tcmd.SysProcAttr = &syscall.SysProcAttr{}\n\tcmd.SysProcAttr.Credential = &syscall.Credential{Uid: job.UID, Gid: job.GID}\n\tdata, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\tfmt.Println(cmd.Stderr)\n\t}\n\tif job.Links != \"\" {\n\t\tlinks := strings.Split(job.Links, \",\")\n\t\tjobs.RunLinks(links, job.UID, httpAddr, store)\n\t}\n\tjob.logger(ch, data, err, store)\n}", "title": "" }, { "docid": "419373055faad312cdbab3b7def36997", "score": "0.553348", "text": "func Daemonize(nochdir, noclose bool) (*os.Process, error) {\n\tdaemonizeState := os.Getenv(\"_GOLANG_DAEMONIZE_FLAG\")\n\tswitch daemonizeState {\n\tcase \"\":\n\t\tsyscall.Umask(0)\n\t\tos.Setenv(\"_GOLANG_DAEMONIZE_FLAG\", \"1\")\n\tcase \"1\":\n\t\tsyscall.Setsid()\n\t\tos.Setenv(\"_GOLANG_DAEMONIZE_FLAG\", \"2\")\n\tcase \"2\":\n\t\tos.Setenv(\"_GOLANG_DAEMONIZE_FLAG\", \"\")\n\t\treturn nil, nil\n\t}\n\n\tvar attrs os.ProcAttr\n\n\tif !nochdir {\n\t\tattrs.Dir = \"/\"\n\t}\n\n\tif noclose {\n\t\tattrs.Files = []*os.File{os.Stdin, os.Stdout, os.Stderr}\n\t} else {\n\t\tf, err := os.Open(\"/dev/null\")\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tattrs.Files = []*os.File{f, f, f}\n\t}\n\n\texe, err := realpath.Realpath(os.Args[0])\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tp, err := os.StartProcess(exe, os.Args, &attrs)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn p, nil\n}", "title": "" }, { "docid": "9a65b15a58c990c99fa4e8c394bd2970", "score": "0.55324006", "text": "func main() {\n\tswitch os.Args[1] {\n\tcase \"run\":\n\t\trun()\n\tdefault:\n\t\tpanic(\"Unknow command\")\n\t}\n}", "title": "" }, { "docid": "ae598614ad8e33fc31de440849603a5a", "score": "0.55312836", "text": "func (CommandService) runCommand(name string, args ...string) error {\n\tcmd := exec.Command(name, args...)\n\tcmd.SysProcAttr = &syscall.SysProcAttr{\n\t\tSetpgid: true,\n\t}\n\tcmd.Env = os.Environ()\n\treturn cmd.Run()\n}", "title": "" }, { "docid": "d1144233f945c3f0f903eabcc0c7adbe", "score": "0.553", "text": "func Run(version, buildDate string) {\n\thelpPtr := flag.Bool(\"help\", false, \"\")\n\tversionPtr := flag.Bool(\"version\", false, \"\")\n\n\tflag.Usage = func() {\n\t\tfmt.Fprint(os.Stderr,\n\t\t\t`Usage: pfms COMMAND [arg...]\n or: pfms -help\n or: pfms -version\nOptions:\n -help Print usage\n -version Print version and build date\nCommands:\n serve [PORT] \n Start a server (default port `+DefaultPort+`)\n adduser NAME PSWD TYPE [EMAIL]\n Add a new user to the system. Arguments:\n NAME - nickname\n PSWD - password\n TYPE - 0(demo), 1(registered) or 2(admin)\n EMAIL - user's email to reset a password`, \"\\n\")\n\t}\n\n\tflag.Parse()\n\n\tif *helpPtr {\n\t\tflag.Usage()\n\t\tos.Exit(0)\n\t}\n\n\tif *versionPtr {\n\t\tfmt.Fprintf(os.Stderr, \"Personal Finance Management System\\nVersion: %s\\nBuild date: %s\\n\", version, buildDate)\n\t\tos.Exit(0)\n\t}\n\n\tif len(os.Args) > 1 {\n\t\tc, ok := commands[os.Args[1]]\n\t\tif ok {\n\t\t\terr := c.Execute(os.Args[2:])\n\t\t\tif err != nil {\n\t\t\t\tfmt.Fprintln(os.Stderr, err.Error())\n\t\t\t\tos.Exit(1)\n\t\t\t}\n\t\t\tos.Exit(0)\n\t\t}\n\t\tfmt.Fprintf(os.Stderr, \"command provided but not defined: %s\\n\", os.Args[1])\n\t}\n\n\tflag.Usage()\n\n\t// If a command is not found we exit with a status 2 to match the behavior\n\t// of flag.Parse() with flag.ExitOnError when parsing an invalid flag.\n\tos.Exit(2)\n}", "title": "" }, { "docid": "0201667206df19b5f5eda19339565bcf", "score": "0.55219656", "text": "func (d *Daemon) RunMyst() error {\n\tpaths := []string{\n\t\td.cfg.OpenVPNPath,\n\t\t\"/usr/bin\",\n\t\t\"/bin\",\n\t\t\"/usr/sbin\",\n\t\t\"/sbin\",\n\t\t\"/usr/local/bin\",\n\t}\n\tvar stdout, stderr bytes.Buffer\n\tcmd := exec.Cmd{\n\t\tPath: d.cfg.MystPath,\n\t\tArgs: []string{\n\t\t\td.cfg.MystPath,\n\t\t\t\"--openvpn.binary\", d.cfg.OpenVPNPath,\n\t\t\t\"--mymysterium.enabled=false\",\n\t\t\t\"--ui.enable=false\",\n\t\t\t\"daemon\",\n\t\t},\n\t\tEnv: []string{\n\t\t\t\"HOME=\" + d.cfg.MystHome,\n\t\t\t\"PATH=\" + strings.Join(paths, \":\"),\n\t\t},\n\t\tStdout: &stdout,\n\t\tStderr: &stderr,\n\t}\n\tif err := cmd.Start(); err != nil {\n\t\treturn err\n\t}\n\n\terr := runWithSuccessTimeout(cmd.Wait, 5*time.Second)\n\tif err != nil {\n\t\tlog.Printf(\"myst output [err=%s]:\\n%s\\n%s\\n\", err, stderr.String(), stdout.String())\n\t\treturn err\n\t}\n\n\tpid := cmd.Process.Pid\n\tif err := ioutil.WriteFile(pidFile, []byte(strconv.Itoa(pid)), 0700); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "32663a97d63c97426d44981859ea2c36", "score": "0.55164516", "text": "func main() {\n\tif err := cmd.Run(); err != nil {\n\t\tlog.Fatalf(\"%v\", err)\n\t}\n}", "title": "" }, { "docid": "89226fe0e4ecd720ecf8db5cf097463b", "score": "0.55154467", "text": "func main() {\n\tcmd.Register(\"version\", cmdVersion)\n\tcmd.Register(\"nodes\", cmdNodes)\n\tcmd.Register(\"pods\", cmdPods)\n\tcmd.Register(\"watchsvc\", cmdWatchSvc)\n\tcmd.Register(\"watchpod\", cmdWatchPod)\n\tcmd.Register(\"watchnodes\", cmdWatchNodes)\n\tcmd.Register(\"cidr\", cmdCIDR)\n\tcmd.Register(\"kernelroutes\", cmdKernelRoutes)\n\tcmd.Register(\"mtu\", cmdMTU)\n\tcmd.Register(\"k8smtu\", cmdK8sMTU)\n\tcmd.Register(\"daemon\", cmdDaemon)\n\tos.Exit(cmd.Run(version))\n}", "title": "" }, { "docid": "d1753c104816141839694fdcb7587000", "score": "0.55101955", "text": "func main() {\n\tflag.Parse()\n\n\tgracefulExitOnCTRLC()\n\n\t/*\n\t\tDetermine what operating mode we're in\n\t*/\n\tswitch {\n\tcase len(*_ConnectURL) != 0 && len(*_RootDir) != 0: // Prefer network connection with ambiguous conditions\n\t\tfmt.Printf(\"Network connection to %s specified, ignoring rootDir %s\\n\",\n\t\t\t*_ConnectURL, *_RootDir)\n\t\tfallthrough\n\tcase len(*_ConnectURL) != 0 && len(*_RootDir) == 0:\n\t\tsplits := strings.Split(*_ConnectURL, \":\")\n\t\tif len(splits) != 2 {\n\t\t\tfmt.Printf(\"Incorrect URL, need \\\"hostname:port\\\", have: %s\\n\", *_ConnectURL)\n\t\t\tos.Exit(1)\n\t\t}\n\t\tbaseURL = \"http://\" + *_ConnectURL + \"/\"\n\t\tlocalMode = false\n\tcase len(*_ConnectURL) == 0 && len(*_RootDir) != 0: // Local connection\n\t\tlocalMode = true\n\tdefault:\n\t\tfmt.Println(\"One of serverURL or rootDir must be specified\")\n\t\tos.Exit(1)\n\t}\n\n\tif localMode {\n\t\tfmt.Printf(\"Running in local mode on directory: %s\\n\", *_RootDir)\n\t\tinitCatalog, initWALCache, backgroundSync, WALBypass := true, true, false, true\n\t\tutils.InstanceConfig.WALRotateInterval = 5\n\t\texecutor.NewInstanceSetup(*_RootDir, initCatalog, initWALCache, backgroundSync, WALBypass)\n\t} else {\n\t\tfmt.Printf(\"Running in network connection mode to: %s\\n\", *_ConnectURL)\n\t}\n\n\trl, err := setupCommandHistory()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer rl.Close()\n\n\t/*\n\t\tCommand processing loop\n\t*/\n\tfor {\n\t\tline, err := rl.Readline()\n\t\tif err != nil { // io.EOF, readline.ErrInterrupt\n\t\t\tbreak\n\t\t}\n\t\tline = strings.Trim(line, \" \")\n\t\tswitch {\n\t\tcase strings.HasPrefix(line, \"\\\\timing\"):\n\t\t\ttimingForSQL = !timingForSQL\n\t\tcase strings.HasPrefix(line, \"\\\\show\"):\n\t\t\tprocessQuery(line)\n\t\tcase strings.HasPrefix(line, \"\\\\trim\"):\n\t\t\tprocessTrim(line)\n\t\tcase strings.HasPrefix(line, \"\\\\gaps\"):\n\t\t\tprocessGapFinder(line)\n\t\tcase strings.HasPrefix(line, \"\\\\load\"):\n\t\t\tprocessLoad(line)\n\t\tcase strings.HasPrefix(line, \"\\\\create\"):\n\t\t\tprocessCreate(line)\n\t\tcase strings.HasPrefix(line, \"\\\\help\") || strings.HasPrefix(line, \"\\\\?\"):\n\t\t\tprocessHelp(line)\n\t\tcase line == \"help\":\n\t\t\tusage(rl.Stderr())\n\t\tcase line == \"\\\\stop\", line == \"\\\\quit\", line == \"\\\\q\", line == \"exit\":\n\t\t\tos.Exit(0)\n\t\tcase line == \"\", line == \" \":\n\t\t\tcontinue\n\t\tdefault:\n\t\t\t/*\n\t\t\t\tSQL Statement - send it to the system\n\t\t\t*/\n\t\t\tprocessSQL(line)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "aa51c169959c4d5d5dc1d8ae21ccfe35", "score": "0.5487049", "text": "func run() (err os.Error) {\n\tvar arg StartArg\n\tvar pathbase = \"/tmp/xproc\"\n\td := gob.NewDecoder(os.Stdin)\n\td.Decode(&arg)\n\t/* make sure the directory exists and then do the private name space mount */\n\n\n\n\tos.Mkdir(pathbase, 0700)\n\tif DoPrivateMount == true {\n\t\tunshare()\n\t\t_ = unmount(pathbase)\n\t\terr := privatemount(pathbase)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\n\tfor _, s := range arg.cmds {\n\t\t_, err := writeitout(os.Stdin, s.name, s.fi)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\n\n\tn, err := connect(arg.Lserver)\n\tif err != nil {\n\t\treturn\n\t}\n\tf := []*os.File{n, n, n}\n\texecpath := pathbase + arg.Args[0]\n\tif arg.LocalBin {\n\t\texecpath = arg.Args[0]\n\t}\n\t_, err := os.ForkExec(execpath, arg.Args, arg.Env, pathbase, f)\n\tn.Close()\n\tif err != nil {\n\t\treturn\n\t}\n\tgo waiter()\n\treturn\n}", "title": "" }, { "docid": "fd76d094ffe553d75d3dffd748349486", "score": "0.54836005", "text": "func main() {\n\tif err := cmd.RootCmd.Execute(); err != nil {\n\t\tos.Exit(1)\n\t}\n}", "title": "" }, { "docid": "e6df8686fb0a17f0060ddd01ab33c896", "score": "0.547168", "text": "func invokeServiceCmd(cp adminPeer, cmd serviceSignal) (err error) {\n\tswitch cmd {\n\tcase serviceRestart, serviceStop:\n\t\terr = cp.cmdRunner.SignalService(cmd)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "143ff8864ad1097e7022af471f64bad7", "score": "0.54654026", "text": "func (c *Command) run(args []string) error {\n\n\t// If we have arguments, process them\n\tif len(args) > 0 {\n\t\t// Check for subcommand\n\t\tsubcommand := c.subCommandsMap[args[0]]\n\t\tif subcommand != nil {\n\t\t\treturn subcommand.run(args[1:])\n\t\t}\n\n\t\t// Parse flags\n\t\terr := c.parseFlags(args)\n\t\tif err != nil {\n\t\t\tif c.app.errorHandler != nil {\n\t\t\t\treturn c.app.errorHandler(c.commandPath, err)\n\t\t\t}\n\t\t\treturn fmt.Errorf(\"Error: %s\\nSee '%s --help' for usage\", err, c.commandPath)\n\t\t}\n\n\t\t// Help takes precedence\n\t\tif c.helpFlag {\n\t\t\tc.PrintHelp()\n\t\t\treturn nil\n\t\t}\n\t}\n\n\t// Do we have an action?\n\tif c.actionCallback != nil {\n\t\treturn c.actionCallback()\n\t}\n\n\t// If we haven't specified a subcommand\n\t// check for an app level default command\n\tif c.app.defaultCommand != nil {\n\t\t// Prevent recursion!\n\t\tif c.app.defaultCommand != c {\n\t\t\t// only run default command if no args passed\n\t\t\tif len(args) == 0 {\n\t\t\t\treturn c.app.defaultCommand.run(args)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Nothing left we can do\n\tc.PrintHelp()\n\n\treturn nil\n}", "title": "" }, { "docid": "4213fdaf4a1d74314f2e3bdd92b4f1d6", "score": "0.54600954", "text": "func main() {\n\tapp := cli.NewApp()\n\n\tapp.Name = \"extended-network-manager\"\n\tapp.Usage = \"Rancher Extended Network Manager\"\n\tapp.Version = \"0.1.0\"\n\tapp.UsageText = \"extended-network-manager [command] [options]\"\n\n\tapp.Commands = []cli.Command{\n\t\t{\n\t\t\tName: \"run\",\n\t\t\tAliases: []string{\"r\"},\n\t\t\tUsage: \"run rancher extended-network-manager service\",\n\t\t\tAction: func(c *cli.Context) error {\n\t\t\t\tenmControllerName = c.String(\"controller\")\n\t\t\t\tenmProviderName = c.String(\"provider\")\n\n\t\t\t\tenmc = controller.GetController(enmControllerName)\n\n\t\t\t\tif enmc == nil {\n\t\t\t\t\tlog.Fatalf(\"Unable to find controller by name %s\", enmControllerName)\n\t\t\t\t}\n\n\t\t\t\tenmp = provider.GetProvider(enmProviderName)\n\n\t\t\t\tif enmp == nil {\n\t\t\t\t\tlog.Fatalf(\"Unable to find provider by name %s\", enmProviderName)\n\t\t\t\t}\n\n\t\t\t\tenmc.Run(enmp)\n\t\t\t\treturn nil\n\t\t\t},\n\t\t\tFlags: []cli.Flag{\n\t\t\t\tcli.StringFlag{\n\t\t\t\t\tName: \"controller\",\n\t\t\t\t\tValue: \"rancher\",\n\t\t\t\t\tUsage: \"controller name\",\n\t\t\t\t},\n\t\t\t\tcli.StringFlag{\n\t\t\t\t\tName: \"provider\",\n\t\t\t\t\tValue: \"pipework\",\n\t\t\t\t\tUsage: \"provicer name\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\tapp.Run(os.Args)\n}", "title": "" }, { "docid": "e8ca98b3900ca3edbef9f018cde852fb", "score": "0.5458456", "text": "func runPostStartCommandsForMinikubeNoneDriver() {\n\tuserName := os.Getenv(\"USER\")\n\thomeDir := os.Getenv(\"HOME\")\n\tcommands := []string{\n\t\t\"mv /root/.kube \" + homeDir + \"/.kube\",\n\t\t\"chown -R \" + userName + \" \" + homeDir + \"/.kube\",\n\t\t\"chgrp -R \" + userName + \" \" + homeDir + \"/.kube\",\n\t\t\"mv /root/.minikube \" + homeDir + \"/.minikube\",\n\t\t\"chown -R \" + userName + \" \" + homeDir + \"/.minikube\",\n\t\t\"chgrp -R \" + userName + \" \" + homeDir + \"/.minikube\",\n\t}\n\n\tfor _, command := range commands {\n\t\tfmt.Printf(\"Running %q\\n\", command)\n\t\toutput, err := execCommand(command)\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"Running %q failed. Error: %+v\\n\", command, err)\n\t\t} else {\n\t\t\tfmt.Printf(\"Run %q successfully. Output: %s\\n\", command, output)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2d71012d349368429020b05d90569a97", "score": "0.54528725", "text": "func (s *Service) Run() {\n\tflag.Usage = s.Usage\n\tflag.Parse()\n\targs := flag.Args()\n\tif len(args) == 0 && s.defaultCommand != \"\" {\n\t\targs = append([]string{s.defaultCommand}, args...)\n\t}\n\tif len(args) == 0 {\n\t\ts.Usage()\n\t\tBootPrintln()\n\t\treturn\n\t}\n\terr := s.RunCommand(args[0], args[1:]...)\n\tif isUserError(err) {\n\t\tfmt.Printf(\"error: %s\\n\", err.Error())\n\t} else if err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "327129080255be920fe9f7e16689d1ee", "score": "0.5442308", "text": "func (dm *Daemon) Run() error {\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tlogger.Errorf(\"recover:%v\\n stack:%v\", r, string(debug.Stack()))\n\t\t}\n\n\t\tlogger.Info(\"Daemon closed\")\n\t}()\n\n\terrC := make(chan error, 5)\n\twg := sync.WaitGroup{}\n\n\t// start visor\n\twg.Add(1)\n\tgo func() {\n\t\tdefer wg.Done()\n\t\tif err := dm.Visor.Run(); err != nil {\n\t\t\terrC <- err\n\t\t}\n\t}()\n\n\twg.Add(1)\n\tgo func() {\n\t\tdefer wg.Done()\n\t\tif err := dm.Pex.Run(); err != nil {\n\t\t\terrC <- err\n\t\t}\n\t}()\n\n\twg.Add(1)\n\tgo func() {\n\t\tdefer wg.Done()\n\t\tif dm.Config.DisableIncomingConnections {\n\t\t\tif err := dm.Pool.RunOffline(); err != nil {\n\t\t\t\terrC <- err\n\t\t\t}\n\t\t} else {\n\t\t\tif err := dm.Pool.Run(); err != nil {\n\t\t\t\terrC <- err\n\t\t\t}\n\t\t}\n\t}()\n\n\t// TODO -- run blockchain stuff in its own goroutine\n\tblockInterval := time.Duration(dm.Visor.Config.Config.BlockCreationInterval)\n\t// blockchainBackupTicker := time.Tick(self.Visor.Config.BlockchainBackupRate)\n\tblockCreationTicker := time.NewTicker(time.Second * blockInterval)\n\tif !dm.Visor.Config.Config.IsMaster {\n\t\tblockCreationTicker.Stop()\n\t}\n\n\tunconfirmedRefreshTicker := time.Tick(dm.Visor.Config.Config.UnconfirmedRefreshRate)\n\tunconfirmedRemoveInvalidTicker := time.Tick(dm.Visor.Config.Config.UnconfirmedRemoveInvalidRate)\n\tblocksRequestTicker := time.Tick(dm.Visor.Config.BlocksRequestRate)\n\tblocksAnnounceTicker := time.Tick(dm.Visor.Config.BlocksAnnounceRate)\n\n\tprivateConnectionsTicker := time.Tick(dm.Config.PrivateRate)\n\tcullInvalidTicker := time.Tick(dm.Config.CullInvalidRate)\n\toutgoingConnectionsTicker := time.Tick(dm.Config.OutgoingRate)\n\t// clearOldPeersTicker := time.Tick(dm.Peers.Config.CullRate)\n\trequestPeersTicker := time.Tick(dm.Pex.Config.RequestRate)\n\tclearStaleConnectionsTicker := time.Tick(dm.Pool.Config.ClearStaleRate)\n\tidleCheckTicker := time.Tick(dm.Pool.Config.IdleCheckRate)\n\n\t// Connect to trusted peers\n\tif !dm.Config.DisableOutgoingConnections {\n\t\twg.Add(1)\n\t\tgo func() {\n\t\t\tdefer wg.Done()\n\t\t\tdm.connectToTrustPeer()\n\t\t}()\n\t}\n\n\tvar err error\n\tvar elapser = elapse.NewElapser(daemonRunDurationThreshold, logger)\n\nloop:\n\tfor {\n\t\telapser.CheckForDone()\n\t\tselect {\n\t\tcase <-dm.quitC:\n\t\t\tbreak loop\n\n\t\tcase <-cullInvalidTicker:\n\t\t\t// Remove connections that failed to complete the handshake\n\t\t\telapser.Register(\"cullInvalidTicker\")\n\t\t\tif !dm.Config.DisableNetworking {\n\t\t\t\tdm.cullInvalidConnections()\n\t\t\t}\n\n\t\tcase <-requestPeersTicker:\n\t\t\t// Request peers via PEX\n\t\t\telapser.Register(\"requestPeersTicker\")\n\t\t\tif dm.Pex.Config.Disabled {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif dm.Pex.IsFull() {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tm := NewGetPeersMessage()\n\t\t\tif err := dm.Pool.Pool.BroadcastMessage(m); err != nil {\n\t\t\t\tlogger.Error(err)\n\t\t\t}\n\n\t\tcase <-clearStaleConnectionsTicker:\n\t\t\t// Remove connections that haven't said anything in a while\n\t\t\telapser.Register(\"clearStaleConnectionsTicker\")\n\t\t\tif !dm.Config.DisableNetworking {\n\t\t\t\tdm.Pool.clearStaleConnections()\n\t\t\t}\n\n\t\tcase <-idleCheckTicker:\n\t\t\t// Sends pings as needed\n\t\t\telapser.Register(\"idleCheckTicker\")\n\t\t\tif !dm.Config.DisableNetworking {\n\t\t\t\tdm.Pool.sendPings()\n\t\t\t}\n\n\t\tcase <-outgoingConnectionsTicker:\n\t\t\t// Fill up our outgoing connections\n\t\t\telapser.Register(\"outgoingConnectionsTicker\")\n\t\t\ttrustPeerNum := len(dm.Pex.Trusted())\n\t\t\tif !dm.Config.DisableOutgoingConnections &&\n\t\t\t\tdm.outgoingConnections.Len() < (dm.Config.OutgoingMax+trustPeerNum) &&\n\t\t\t\tdm.pendingConnections.Len() < dm.Config.PendingMax {\n\t\t\t\tdm.connectToRandomPeer()\n\t\t\t}\n\n\t\tcase <-privateConnectionsTicker:\n\t\t\t// Always try to stay connected to our private peers\n\t\t\t// TODO (also, connect to all of them on start)\n\t\t\telapser.Register(\"privateConnectionsTicker\")\n\t\t\tif !dm.Config.DisableOutgoingConnections {\n\t\t\t\tdm.makePrivateConnections()\n\t\t\t}\n\n\t\tcase r := <-dm.onConnectEvent:\n\t\t\t// Process callbacks for when a client connects. No disconnect chan\n\t\t\t// is needed because the callback is triggered by HandleDisconnectEvent\n\t\t\t// which is already select{}ed here\n\t\t\telapser.Register(\"dm.onConnectEvent\")\n\t\t\tif dm.Config.DisableNetworking {\n\t\t\t\tlogger.Error(\"There should be no connect events\")\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tdm.onConnect(r)\n\n\t\tcase de := <-dm.onDisconnectEvent:\n\t\t\telapser.Register(\"dm.onDisconnectEvent\")\n\t\t\tif dm.Config.DisableNetworking {\n\t\t\t\tlogger.Error(\"There should be no disconnect events\")\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tdm.onDisconnect(de)\n\n\t\tcase r := <-dm.connectionErrors:\n\t\t\t// Handle connection errors\n\t\t\telapser.Register(\"dm.connectionErrors\")\n\t\t\tif dm.Config.DisableNetworking {\n\t\t\t\tlogger.Error(\"There should be no connection errors\")\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tdm.handleConnectionError(r)\n\n\t\tcase r := <-dm.Pool.Pool.SendResults:\n\t\t\t// Process message sending results\n\t\t\telapser.Register(\"dm.Pool.Pool.SendResults\")\n\t\t\tif dm.Config.DisableNetworking {\n\t\t\t\tlogger.Error(\"There should be nothing in SendResults\")\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tdm.handleMessageSendResult(r)\n\n\t\tcase m := <-dm.messageEvents:\n\t\t\t// Message handlers\n\t\t\telapser.Register(\"dm.messageEvents\")\n\t\t\tif dm.Config.DisableNetworking {\n\t\t\t\tlogger.Error(\"There should be no message events\")\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tdm.processMessageEvent(m)\n\n\t\tcase req := <-dm.Gateway.requests:\n\t\t\t// Process any pending RPC requests\n\t\t\telapser.Register(\"dm.Gateway.requests\")\n\t\t\treq.Func()\n\n\t\tcase <-blockCreationTicker.C:\n\t\t\t// Create blocks, if master chain\n\t\t\telapser.Register(\"blockCreationTicker.C\")\n\t\t\tif dm.Visor.Config.Config.IsMaster {\n\t\t\t\tsb, err := dm.Visor.CreateAndPublishBlock(dm.Pool)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlogger.Errorf(\"Failed to create block: %v\", err)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\t// Not a critical error, but we want it visible in logs\n\t\t\t\thead := sb.Block.Head\n\t\t\t\tlogger.Critical().Infof(\"Created and published a new block, version=%d seq=%d time=%d\", head.Version, head.BkSeq, head.Time)\n\t\t\t}\n\n\t\tcase <-unconfirmedRefreshTicker:\n\t\t\telapser.Register(\"unconfirmedRefreshTicker\")\n\t\t\t// Get the transactions that turn to valid\n\t\t\tvalidTxns, err := dm.Visor.RefreshUnconfirmed()\n\t\t\tif err != nil {\n\t\t\t\tlogger.Errorf(\"dm.Visor.RefreshUnconfirmed failed: %v\", err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// Announce these transactions\n\t\t\tdm.Visor.AnnounceTxns(dm.Pool, validTxns)\n\n\t\tcase <-unconfirmedRemoveInvalidTicker:\n\t\t\telapser.Register(\"unconfirmedRemoveInvalidTicker\")\n\t\t\t// Remove transactions that become invalid (violating hard constraints)\n\t\t\tremovedTxns, err := dm.Visor.RemoveInvalidUnconfirmed()\n\t\t\tif err != nil {\n\t\t\t\tlogger.Errorf(\"dm.Visor.RemoveInvalidUnconfirmed failed: %v\", err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif len(removedTxns) > 0 {\n\t\t\t\tlogger.Infof(\"Remove %d txns from pool that began violating hard constraints\", len(removedTxns))\n\t\t\t}\n\n\t\tcase <-blocksRequestTicker:\n\t\t\telapser.Register(\"blocksRequestTicker\")\n\t\t\tdm.Visor.RequestBlocks(dm.Pool)\n\n\t\tcase <-blocksAnnounceTicker:\n\t\t\telapser.Register(\"blocksAnnounceTicker\")\n\t\t\tdm.Visor.AnnounceBlocks(dm.Pool)\n\n\t\tcase err = <-errC:\n\t\t\tbreak loop\n\t\t}\n\t}\n\n\twg.Wait()\n\n\treturn err\n}", "title": "" }, { "docid": "a593cbbfc0a7cf153053067b6991556a", "score": "0.54383254", "text": "func (cnt *Container) run() error {\n\tif cnt.exists() {\n\t\tif !cnt.running() {\n\t\t\treturn cnt.start()\n\t\t}\n\t} else {\n\t\tif err := cnt.create(); err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn cnt.start()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f28db8309ed5d846d01289c7b7eabef3", "score": "0.543711", "text": "func main() {\n\terr := Cmd().Run(os.Args)\n\tif err != nil {\n\t\tlogrus.Fatalf(\"%+v\", err)\n\t}\n}", "title": "" }, { "docid": "c49909ab0457f130ef7b6aadbd1881dc", "score": "0.5436851", "text": "func main() {\n\t//cmd := exec.Command(\"ls\") // just run system command\n\n\tif runtime.GOOS == \"darwin\" {\n\t\tfmt.Println(\"Apple!\")\n\t\tcmd := exec.Command(\"ls\", \"-al\", \"/tmp\") // just run system command\n\t\t// output terminal info\n\t\tcmd.Stdout = os.Stdout\n\t\tcmd.Stderr = os.Stderr\n\n\t\te := cmd.Run()\n\t\tCheckError(e)\n\t} else {\n\t\tfmt.Println(\">>>\")\n\t\tcmd := exec.Command(\"whoami\") // just run system command\n\t\t// output terminal info\n\t\tcmd.Stdout = os.Stdout\n\t\tcmd.Stderr = os.Stderr\n\n\t\te := cmd.Run()\n\t\tCheckError(e)\n\t}\n\n\n}", "title": "" }, { "docid": "657ee376905dc54831c9e9ea57b179c8", "score": "0.5428784", "text": "func main() {\n\tvar (\n\t\terr error\n\t)\n\n\tif len(os.Args) < 2 {\n\t\terr = errors.New(\"You must pass a sub-command - either 'client' or 'server'\")\n\t\tfmt.Println(err)\n\t\tos.Exit(1)\n\t}\n\n\tcmds := []Runner{\n\t\tNewClientCommand(),\n\t\tNewServerCommand(),\n\t}\n\n\tsubcommand := os.Args[1]\n\tfor _, cmd := range cmds {\n\t\tif cmd.Name() == subcommand {\n\t\t\tcmd.Init(os.Args[2:])\n\t\t\terr = cmd.Run()\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err)\n\t\t\t\tos.Exit(1)\n\t\t\t}\n\t\t\tos.Exit(0)\n\t\t}\n\t}\n\n\terr = fmt.Errorf(\"Unknown subcommand: %s - must be either 'client' or 'server'\", subcommand)\n\tfmt.Println(err)\n\tos.Exit(1)\n\n}", "title": "" }, { "docid": "9ae2855e32ea7bf84ad68f2884a58b6f", "score": "0.54284936", "text": "func Run() (string, error) {\n\tipc := rpc.NewIpcManager()\n\tcmd, err := cmdline.Parse(os.Args[1:])\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tcmd, err = applySpecialConventions(cmd)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tswitch cmd.Name {\n\tcase cmdline.VERSION_COMMAND.Name():\n\t\treturn \"h2d version \" + http2client.VERSION + \" build date \" + http2client.BUILD_DATE + \".\", nil\n\tcase cmdline.START_COMMAND.Name():\n\t\treturn \"\", startDaemon(ipc, cmdline.DUMP_OPTION.IsSet(cmd.Options))\n\tcase cmdline.WIRETAP_COMMAND.Name():\n\t\treturn \"\", wiretap.Run(cmd.Args[0], cmd.Args[1])\n\tdefault:\n\t\tif !ipc.IsListening() {\n\t\t\tif cmdline.STOP_COMMAND.Name() == cmd.Name {\n\t\t\t\treturn \"\", fmt.Errorf(\"h2d is not running.\")\n\t\t\t} else {\n\t\t\t\tfmt.Fprintf(os.Stderr, \"h2d is not running. Starting h2d as a background process.\\n\")\n\t\t\t\terr = runDaemonShellCommand()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn \"\", fmt.Errorf(\"Failed. In order to start the background process manually, run '%v'.\", cmdline.StartCmd)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tres := sendCommand(cmd, ipc)\n\t\tif res.Error != nil {\n\t\t\treturn res.Message, fmt.Errorf(\"%v\", *res.Error)\n\t\t} else {\n\t\t\treturn res.Message, nil\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ea882730e3f54820775f29fbd843882b", "score": "0.54282594", "text": "func (monitor *Monitor) Control() error {\n\ttelegram := &monitor.Config.Telegram\n\n\tif telegram.Token == \"\" || telegram.ContactID == 0 {\n\t\treturn fmt.Errorf(\"Error Telegram configuration\")\n\t}\n\n\tbot, err := tgbotapi.NewBotAPI(telegram.Token)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif logrus.GetLevel() == logrus.DebugLevel {\n\t\tbot.Debug = true\n\t}\n\n\tu := tgbotapi.NewUpdate(0)\n\tu.Timeout = 60\n\n\tupdates, err := bot.GetUpdatesChan(u)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor update := range updates {\n\t\tif update.Message == nil {\n\t\t\tlogrus.Error(\"Message is null\")\n\t\t\tcontinue\n\t\t}\n\n\t\tif !update.Message.IsCommand() {\n\t\t\tcontinue\n\t\t}\n\n\t\tisAdmin := false\n\t\tfor _, name := range telegram.AdminList {\n\t\t\tif update.Message.From.UserName == name {\n\t\t\t\tisAdmin = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif !isAdmin {\n\t\t\tlogrus.Errorf(\n\t\t\t\t\"Access denied to exec '%s' from %s (%s)\",\n\t\t\t\tupdate.Message.Text,\n\t\t\t\tupdate.Message.From.UserName,\n\t\t\t\tupdate.Message.Chat.Type,\n\t\t\t)\n\t\t\tcontinue\n\t\t}\n\n\t\tcommand := update.Message.Command()\n\t\tcommandArgs := update.Message.CommandArguments()\n\t\tchatID := update.Message.Chat.ID\n\n\t\tswitch command {\n\t\tcase \"adm\", \"admin\", \"admins\":\n\t\t\tbot.Send(tgbotapi.NewMessage(chatID, strings.Join(monitor.Config.Telegram.AdminList, \" \")))\n\t\tcase \"srvadd\", \"service-add\":\n\t\t\twords := strings.Fields(commandArgs)\n\t\t\tif len(words) == 0 {\n\t\t\t\tbot.Send(tgbotapi.NewMessage(chatID, \"Empty service name.\"))\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\terr = monitor.AddService(words[0], true)\n\t\t\tif err != nil {\n\t\t\t\tbot.Send(tgbotapi.NewMessage(chatID, err.Error()))\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tbot.Send(tgbotapi.NewMessage(chatID, \"Done.\"))\n\t\tcase \"srvdel\", \"service-del\", \"service-delete\":\n\t\t\twords := strings.Fields(commandArgs)\n\t\t\tif len(words) == 0 {\n\t\t\t\tbot.Send(tgbotapi.NewMessage(chatID, \"Empty service name.\"))\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\terr = monitor.DeleteService(commandArgs)\n\t\t\tif err != nil {\n\t\t\t\tbot.Send(tgbotapi.NewMessage(chatID, err.Error()))\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tbot.Send(tgbotapi.NewMessage(chatID, \"Done.\"))\n\t\tcase \"sh\", \"bash\", \"shell\", \"exec\", \"run\":\n\t\t\tExecAndNotice(bot, chatID, commandArgs)\n\t\tcase \"srv\", \"service\":\n\t\t\tExecAndNotice(bot, chatID, fmt.Sprintf(\"%s %s\", \"service\", commandArgs))\n\t\tcase \"bc\", \"calc\":\n\t\t\tExecAndNotice(bot, chatID, fmt.Sprintf(\"echo '%s' | bc\", commandArgs))\n\t\tcase \"w\", \"who\":\n\t\t\tExecAndNotice(bot, chatID, \"who\")\n\t\tcase \"up\", \"uptime\":\n\t\t\tExecAndNotice(bot, chatID, \"uptime\")\n\t\tcase \"st\", \"srvst\", \"status\":\n\t\t\tpref := \"\"\n\t\t\tstatus := \"\"\n\t\t\tfor _, service := range monitor.ServiceList {\n\t\t\t\tif commandArgs != \"\" && commandArgs != service.Name {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tstate := StateEmojiON\n\t\t\t\tif service.CurrentState == false {\n\t\t\t\t\tstate = StateEmojiOFF\n\t\t\t\t}\n\n\t\t\t\tsource := \"\"\n\t\t\t\tif service.IsDynamic {\n\t\t\t\t\tsource = DinamicEmojiPrefix\n\t\t\t\t}\n\n\t\t\t\tstatus += pref + fmt.Sprintf(\"%s %s%s\", state, service.Name, source)\n\t\t\t\tpref = \"\\n\"\n\t\t\t}\n\t\t\tbot.Send(tgbotapi.NewMessage(chatID, status))\n\t\tcase \"v\", \"vote\":\n\t\t\tbot.Send(tgbotapi.NewMessage(chatID, GetVote()))\n\t\tcase \"rld\", \"reload\":\n\t\t\tmonitor.Configure()\n\t\tcase \"ver\", \"version\":\n\t\t\tbot.Send(tgbotapi.NewMessage(\n\t\t\t\tchatID,\n\t\t\t\tfmt.Sprintf(\n\t\t\t\t\tVersionMessageMask,\n\t\t\t\t\tgomonversion.Version,\n\t\t\t\t\tgomonversion.GitCommit,\n\t\t\t\t\truntime.GOOS,\n\t\t\t\t\truntime.GOARCH,\n\t\t\t\t\tgomonversion.BuildTime,\n\t\t\t\t),\n\t\t\t))\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d6f8bb53b4aff864acfb69b5270f097e", "score": "0.5426887", "text": "func dfcinit() {\n\tflag.Parse()\n\n\tif clivars.conffile == \"\" {\n\t\tfmt.Fprintf(os.Stderr, \"Missing configuration file - must be provided via command line\\n\")\n\t\tfmt.Fprintf(os.Stderr, \"Usage: ... -role=<proxy|target> -config=<json> ...\\n\")\n\t\tos.Exit(2)\n\t}\n\tif err := initconfigparam(); err != nil {\n\t\tglog.Fatalf(\"Failed to initialize, config %q, err: %v\", clivars.conffile, err)\n\t}\n\n\t// init daemon\n\tctx.rg = &rungroup{\n\t\trunarr: make([]runner, 0, 4),\n\t\trunmap: make(map[string]runner),\n\t}\n\tassert(clivars.role == xproxy || clivars.role == xtarget, \"Invalid flag: role=\"+clivars.role)\n\tif clivars.role == xproxy {\n\t\tp := &proxyrunner{}\n\t\tp.initSI()\n\t\tctx.rg.add(p, xproxy)\n\t\tctx.rg.add(&proxystatsrunner{}, xproxystats)\n\t\tctx.rg.add(newproxykalive(p), xproxykalive)\n\t\tctx.rg.add(newmetasyncer(p), xmetasyncer)\n\t} else {\n\t\tt := &targetrunner{}\n\t\tt.initSI()\n\t\tctx.rg.add(t, xtarget)\n\t\tctx.rg.add(&storstatsrunner{}, xstorstats)\n\t\tctx.rg.add(newtargetkalive(t), xtargetkalive)\n\n\t\t// iostat is required: ensure that it is installed and its version is right\n\t\tif err := checkIostatVersion(); err != nil {\n\t\t\tglog.Exit(err)\n\t\t}\n\t\tctx.rg.add(newIostatRunner(), xiostat)\n\n\t\tctx.rg.add(&atimerunner{\n\t\t\tchstop: make(chan struct{}, 4),\n\t\t\tchfqn: make(chan string, chfqnSize),\n\t\t\tatimemap: &atimemap{fsToFilesMap: make(map[string]map[string]time.Time, atimeCacheFlushThreshold)},\n\t\t\tchGetAtime: make(chan string),\n\t\t\tchSendAtime: make(chan accessTimeResponse),\n\t\t}, xatime)\n\n\t\tctx.rg.add(\n\t\t\tnewFSHealthChecker(&ctx.mountpaths, &ctx.config.FSChecker, t.fqn2workfile),\n\t\t\txfshealthchecker)\n\n\t\t// for mountpath definition, see fspath2mpath()\n\t\tctx.mountpaths.Available = make(map[string]*mountPath, len(ctx.config.FSpaths))\n\t\tctx.mountpaths.Disabled = make(map[string]*mountPath, len(ctx.config.FSpaths))\n\t\tif testingFSPpaths() {\n\t\t\tglog.Infof(\"Warning: configuring %d fspaths for testing\", ctx.config.TestFSP.Count)\n\t\t\tt.testCachepathMounts()\n\t\t} else {\n\t\t\tt.fspath2mpath()\n\t\t\tt.checkIfAllFSIDsAreUnique()\n\t\t}\n\t\tctx.mountpaths.Lock()\n\t\tctx.mountpaths.cloneAndUnlock() // available mpaths => ro slice\n\t}\n\tctx.rg.add(&sigrunner{}, xsignal)\n}", "title": "" }, { "docid": "e30d1f6516d273d8bb79b2d14ff3a033", "score": "0.5425859", "text": "func (m *Main) Run(args ...string) error {\n\t// Create logger.\n\tm.logger = log.New(m.Stdout, \"\", log.LstdFlags)\n\n\t// Parse command line flags.\n\topt, err := m.ParseFlags(args...)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Set up advertised address and default peer set.\n\tadvertiseAddr := MergeHostPort(opt.Host, opt.Addr)\n\tif len(opt.Peers) == 0 {\n\t\topt.Peers = []string{advertiseAddr}\n\t}\n\n\t// Create a slice of peers with their HTTP address set instead.\n\thttpPeers, err := SetPortSlice(opt.Peers, opt.Addr)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"set port slice: %s\", err)\n\t}\n\n\t// if there is a discoverd process already running on this\n\t// address perform a deployment by starting a proxy DNS server\n\t// and shutting down the old discoverd job\n\tvar deploy *dd.Deployment\n\tvar shutdownInfo dt.ShutdownInfo\n\n\ttarget := fmt.Sprintf(\"http://%s:1111\", opt.Host)\n\tm.logger.Println(\"checking for existing discoverd process at\", target)\n\tif err := discoverd.NewClientWithHTTP(target, &http.Client{}).Ping(); err == nil {\n\t\tm.logger.Println(\"discoverd responding at\", target, \"taking over\")\n\n\t\t// update DISCOVERD environment variable so that the default\n\t\t// discoverd client connects to the instance we intend to replace.\n\t\tos.Setenv(\"DISCOVERD\", target)\n\t\tdiscoverd.DefaultClient = discoverd.NewClient()\n\n\t\tdeploy, err = dd.NewDeployment(\"discoverd\")\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tm.logger.Println(\"Created deployment\")\n\t\tif err := deploy.MarkPerforming(advertiseAddr, 60); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tm.logger.Println(\"marked\", advertiseAddr, \"as performing in deployent\")\n\t\taddr, resolvers := waitHostDNSConfig()\n\t\tif opt.DNSAddr != \"\" {\n\t\t\taddr = opt.DNSAddr\n\t\t}\n\t\tif len(opt.Recursors) > 0 {\n\t\t\tresolvers = opt.Recursors\n\t\t}\n\t\tm.logger.Println(\"starting proxy DNS server\")\n\t\tif err := m.openDNSServer(addr, resolvers, httpPeers); err != nil {\n\t\t\treturn fmt.Errorf(\"Failed to start DNS server: %s\", err)\n\t\t}\n\t\tm.logger.Printf(\"discoverd listening for DNS on %s\", addr)\n\n\t\tshutdownInfo, err = discoverd.NewClientWithURL(target).Shutdown()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tm.logger.Println(\"failed to contact existing discoverd server, starting up without takeover\")\n\t}\n\n\t// Open listener.\n\tln, err := net.Listen(\"tcp4\", opt.Addr)\n\tif err != nil {\n\t\treturn err\n\t}\n\tm.ln = ln\n\n\t// Multiplex listener to store and http api.\n\tstoreLn, httpLn := server.Mux(ln)\n\n\t// Open store if we are not proxying.\n\tif err := m.openStore(opt.DataDir, storeLn, advertiseAddr, opt.Peers); err != nil {\n\t\treturn fmt.Errorf(\"Failed to open store: %s\", err)\n\t}\n\n\t// Notify user that we're proxying if the store wasn't initialized.\n\tif m.store == nil {\n\t\tfmt.Fprintln(m.Stderr, \"advertised address not in peer set, joining as proxy\")\n\t}\n\n\t// Wait for the store to catchup before switching to local store if we are doing a deployment\n\tif m.store != nil && shutdownInfo.LastIndex > 0 {\n\t\tfor m.store.LastIndex() < shutdownInfo.LastIndex {\n\t\t\tm.logger.Println(\"Waiting for store to catchup, current:\", m.store.LastIndex(), \"target:\", shutdownInfo.LastIndex)\n\t\t\ttime.Sleep(100 * time.Millisecond)\n\t\t}\n\t}\n\n\t// If we already started the DNS server as part of a deployment above,\n\t// and we have an initialized store, just switch from the proxy store\n\t// to the initialized store.\n\t//\n\t// Else if we have a DNS address, start a DNS server right away.\n\t//\n\t// Otherwise wait for the host network to come up and then start a DNS\n\t// server.\n\tif m.dnsServer != nil && m.store != nil {\n\t\tm.dnsServer.SetStore(m.store)\n\t} else if opt.DNSAddr != \"\" {\n\t\tif err := m.openDNSServer(opt.DNSAddr, opt.Recursors, httpPeers); err != nil {\n\t\t\treturn fmt.Errorf(\"Failed to start DNS server: %s\", err)\n\t\t}\n\t\tm.logger.Printf(\"discoverd listening for DNS on %s\", opt.DNSAddr)\n\t} else if opt.WaitNetDNS {\n\t\tgo func() {\n\t\t\taddr, resolvers := waitHostDNSConfig()\n\t\t\tif err := m.openDNSServer(addr, resolvers, httpPeers); err != nil {\n\t\t\t\tlog.Fatalf(\"Failed to start DNS server: %s\", err)\n\t\t\t}\n\t\t\tm.logger.Printf(\"discoverd listening for DNS on %s\", addr)\n\n\t\t\t// Notify webhook.\n\t\t\tif opt.Notify != \"\" {\n\t\t\t\tm.Notify(opt.Notify, \"\", addr)\n\t\t\t}\n\t\t}()\n\t}\n\n\tif err := m.openHTTPServer(httpLn, opt.Peers); err != nil {\n\t\treturn fmt.Errorf(\"Failed to start HTTP server: %s\", err)\n\t}\n\n\tif deploy != nil {\n\t\tif err := deploy.MarkDone(advertiseAddr); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tm.logger.Println(\"marked\", advertiseAddr, \"as done in deployment\")\n\t}\n\n\t// Notify user that the servers are listening.\n\tm.logger.Printf(\"discoverd listening for HTTP on %s\", opt.Addr)\n\n\t// FIXME(benbjohnson): Join to cluster.\n\n\t// Wait for leadership.\n\tif err := m.waitForLeader(LeaderTimeout); err != nil {\n\t\treturn err\n\t}\n\n\t// Notify URL that discoverd is running.\n\thttpAddr := ln.Addr().String()\n\thost, port, _ := net.SplitHostPort(httpAddr)\n\tif host == \"0.0.0.0\" {\n\t\thttpAddr = net.JoinHostPort(os.Getenv(\"EXTERNAL_IP\"), port)\n\t}\n\tm.Notify(opt.Notify, \"http://\"+httpAddr, opt.DNSAddr)\n\tgo discoverd.NewClientWithURL(\"http://\"+httpAddr).AddServiceAndRegister(\"discoverd\", httpAddr)\n\n\treturn nil\n}", "title": "" }, { "docid": "dac612723da941b509579f6be37108e3", "score": "0.5421979", "text": "func Run() {\n\tflag.Parse()\n\n\taction := flag.Arg(0)\n\n\tswitch action {\n\tcase \"account\":\n\t\tusername := flag.Arg(1)\n\t\temail := flag.Arg(2)\n\t\tcmdAccount(username, email)\n\t\tbreak\n\tcase \"add\":\n\t\tname := flag.Arg(1)\n\t\thostnameOrPort := flag.Arg(2)\n\t\tport := flag.Arg(3)\n\t\tcmdAdd(name, hostnameOrPort, port)\n\t\tbreak\n\tcase \"create\":\n\t\tcmdCreate()\n\t\tbreak\n\tcase \"get\":\n\t\tname := flag.Arg(1)\n\t\tcmdGet(name)\n\t\tbreak\n\tcase \"help\":\n\t\thelp()\n\t\tbreak\n\tcase \"id\":\n\t\tname := flag.Arg(1)\n\t\tcmdID(name)\n\t\tbreak\n\tcase \"ip\":\n\t\tcmdIP()\n\t\tbreak\n\tcase \"list\":\n\t\tcmdList()\n\t\tbreak\n\tcase \"login\":\n\t\tauthToken := flag.Arg(1)\n\t\tcmdLogin(authToken)\n\t\tbreak\n\tcase \"logout\":\n\t\tcmdLogout()\n\t\tbreak\n\tcase \"me\":\n\t\tcmdMe()\n\t\tbreak\n\tcase \"name\":\n\t\tid := flag.Arg(1)\n\t\tname := flag.Arg(2)\n\t\tcmdName(id, name)\n\t\tbreak\n\tcase \"serve\":\n\t\tport := flag.Arg(1)\n\t\tif port == \"\" {\n\t\t\tport = \"8080\"\n\t\t}\n\t\tServeAPI(port)\n\t\tos.Exit(0)\n\t\tbreak\n\tcase \"proxy\":\n\t\tServeProxy()\n\t\tos.Exit(0)\n\t\tbreak\n\tcase \"start\":\n\t\tid := flag.Arg(1)\n\t\tcmdStart(id)\n\t\tbreak\n\tdefault:\n\t\tfmt.Println(\"Command not found.\")\n\t}\n}", "title": "" }, { "docid": "bf11227c2b120630d115caa3d5040e6d", "score": "0.54204863", "text": "func main() {\n\tif err := rootCmd.Execute(); err != nil {\n\t\tfmt.Println(err)\n\t\tos.Exit(1)\n\t}\n}", "title": "" }, { "docid": "05ad3a46ee0c12186e2af0fc3bc5e0d4", "score": "0.5412403", "text": "func main() {\n\t_ = cmd.Execute()\n}", "title": "" }, { "docid": "f07621056c9ea5ad9abc854ab66c4ba9", "score": "0.5409552", "text": "func worker(ctx *cli.Context) error {\n\tolPath, err := getOlPath(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// if `./ol new` not previously run, do that init now\n\tif _, err := os.Stat(olPath); os.IsNotExist(err) {\n\t\tfmt.Printf(\"no OL directory found at %s\\n\", olPath)\n\t\tif err := initOLDir(olPath); err != nil {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tfmt.Printf(\"using existing OL directory at %s\\n\", olPath)\n\t}\n\n\tconfPath := filepath.Join(olPath, \"config.json\")\n\toverrides := ctx.String(\"options\")\n\tif overrides != \"\" {\n\t\toverridesPath := confPath + \".overrides\"\n\t\terr = overrideOpts(confPath, overridesPath, overrides)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tconfPath = overridesPath\n\t}\n\n\tif err := common.LoadConf(confPath); err != nil {\n\t\treturn err\n\t}\n\n\t// should we run as a background process?\n\tdetach := ctx.Bool(\"detach\")\n\n\tif detach {\n\t\t// stdout+stderr both go to log\n\t\tlogPath := filepath.Join(olPath, \"worker.out\")\n\t\tf, err := os.Create(logPath)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tattr := os.ProcAttr{\n\t\t\tFiles: []*os.File{nil, f, f},\n\t\t}\n\t\tcmd := []string{}\n\t\tfor _, arg := range os.Args {\n\t\t\tif arg != \"-d\" && arg != \"--detach\" {\n\t\t\t\tcmd = append(cmd, arg)\n\t\t\t}\n\t\t}\n\t\tbinPath, err := exec.LookPath(os.Args[0])\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tproc, err := os.StartProcess(binPath, cmd, &attr)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tdied := make(chan error)\n\t\tgo func() {\n\t\t\t_, err := proc.Wait()\n\t\t\tdied <- err\n\t\t}()\n\n\t\tfmt.Printf(\"Starting worker: pid=%d, port=%s, log=%s\\n\", proc.Pid, common.Conf.Worker_port, logPath)\n\n\t\tvar ping_err error\n\n\t\tfor i := 0; i < 300; i++ {\n\t\t\t// check if it has died\n\t\t\tselect {\n\t\t\tcase err := <-died:\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\treturn fmt.Errorf(\"worker process %d does not a appear to be running, check worker.out\", proc.Pid)\n\t\t\tdefault:\n\t\t\t}\n\n\t\t\t// is the worker still alive?\n\t\t\terr := proc.Signal(syscall.Signal(0))\n\t\t\tif err != nil {\n\n\t\t\t}\n\n\t\t\t// is it reachable?\n\t\t\turl := fmt.Sprintf(\"http://localhost:%s/pid\", common.Conf.Worker_port)\n\t\t\tresponse, err := http.Get(url)\n\t\t\tif err != nil {\n\t\t\t\tping_err = err\n\t\t\t\ttime.Sleep(100 * time.Millisecond)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tdefer response.Body.Close()\n\n\t\t\t// are we talking with the expected PID?\n\t\t\tbody, err := ioutil.ReadAll(response.Body)\n\t\t\tpid, err := strconv.Atoi(strings.TrimSpace(string(body)))\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"/pid did not return an int :: %s\", err)\n\t\t\t}\n\n\t\t\tif pid == proc.Pid {\n\t\t\t\tfmt.Printf(\"ready\\n\")\n\t\t\t\treturn nil // server is started and ready for requests\n\t\t\t} else {\n\t\t\t\treturn fmt.Errorf(\"expected PID %v but found %v (port conflict?)\", proc.Pid, pid)\n\t\t\t}\n\t\t}\n\n\t\treturn fmt.Errorf(\"worker still not reachable after 30 seconds :: %s\", ping_err)\n\t} else {\n\t\tif err := server.Main(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn fmt.Errorf(\"this code should not be reachable!\")\n}", "title": "" }, { "docid": "c37d14e67d4d991ae8779d07cb771f6c", "score": "0.54086417", "text": "func main() {\n\tif err := cmd.RootCmd.Execute(); err != nil {\n\t\tcmd.RootCmd.Println(err)\n\t\tos.Exit(1)\n\t}\n}", "title": "" }, { "docid": "ab895ad8a9fa428c2753fc9e41df1a1b", "score": "0.5403611", "text": "func (r *Reloader) Daemonize() error {\n\ts := service{r: r}\n\treturn svc.Run(s, syscall.SIGTERM, syscall.SIGINT)\n}", "title": "" }, { "docid": "77f486058cff07ca40e0d63c9e3f3ba7", "score": "0.539", "text": "func (state *State) run(args []string) {\n\tcmd := state.getCommand(args[0])\n\tcmd(state, args[1:]...)\n}", "title": "" }, { "docid": "5ef7f1e6a8e0d9d835db2e7d69254d0a", "score": "0.5389771", "text": "func (c *Collector) runDaemon() {\n\tdefer close(c.daemonClosed)\n\n\tcollect := make(chan struct{}, 1)\n\tif c.cfg.daemonRunOnStart {\n\t\tcollect <- struct{}{}\n\t}\n\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-c.daemonCtx.Done():\n\t\t\t\treturn\n\t\t\tcase <-time.After(c.cfg.daemonFrequency):\n\t\t\t\tcollect <- struct{}{}\n\t\t\t}\n\t\t}\n\t}()\n\n\tfor {\n\t\tselect {\n\t\tcase <-c.daemonCtx.Done():\n\t\t\tlog.Infof(\"closing daemon\")\n\t\t\treturn\n\t\tcase <-collect:\n\t\t\ttotalImported := c.collectTargets(c.daemonCtx)\n\t\t\tif totalImported > 0 {\n\t\t\t\tc.notifySubscribers()\n\t\t\t}\n\t\t\tlog.Infof(\"daemon finished importing %d records\", totalImported)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1b1d469b16378a53a99faf3090172f7a", "score": "0.5386558", "text": "func main() {\n\tswitch os.Args[1] {\n\tcase \"run\":\n\t\trun()\n\tcase \"child\":\n\t\tchild()\n\tdefault:\n\t\tpanic(\"help?\")\n\t}\n}", "title": "" }, { "docid": "d048f60ba6aa98da22bc92f1e89dc0db", "score": "0.53849924", "text": "func main() {\n\tcmd := newRootCmd(os.Args[1:])\n\tif err := cmd.Execute(); err != nil {\n\t\tos.Exit(1)\n\t}\n}", "title": "" }, { "docid": "5303c634c7a913fab079c963e38a8af4", "score": "0.538344", "text": "func persistentPreRun(cmd *cobra.Command, args []string) {\n\n\tif Config.Twilio.APIKey == \"\" {\n\t\tlog.Fatal(\"Twilio API Key is a required argument\")\n\t}\n\n\tif Config.Twilio.SID == \"\" {\n\t\tlog.Fatal(\"Twilio SID is a required argument\")\n\t}\n\n\tif Config.Server.FQDN == \"\" {\n\t\tlog.Fatal(\"The fully qualified domain name (FQDN) of your catfacts server is a required argument\")\n\t}\n\n\tif Config.Twilio.Number == \"\" {\n\t\tlog.Fatal(\"A valid Twilio FROM number is a required argument\")\n\t}\n\n\tif Config.Twilio.MsgIntervalSeconds == 0 {\n\t\tConfig.Twilio.MsgIntervalSeconds = 30\n\t}\n\n\tif Config.Server.Port == \"\" {\n\t\tConfig.Server.Port = \":8080\"\n\t} else {\n\t\tConfig.Server.Port = \":\" + Config.Server.Port\n\t}\n\n\tfor i := 0; i < len(Config.Server.Admins); i++ {\n\t\tvalid, formatted := validateNumber(Config.Server.Admins[i])\n\t\tif valid {\n\t\t\tConfig.Server.Admins[i] = formatted\n\t\t}\n\t\tlog.WithFields(logrus.Fields{\n\t\t\t\"Raw\": Config.Server.Admins[i],\n\t\t\t\"Valid\": valid,\n\t\t\t\"Formatted\": formatted,\n\t\t\t\"Parsed\": Config.Server.Admins,\n\t\t}).Debug(\"Parsing authorized server administrators\")\n\t}\n}", "title": "" }, { "docid": "e3d136036155b2c0c5064dcbcfd7a21b", "score": "0.53703874", "text": "func main() {\n\tcommands2.Execute()\n}", "title": "" }, { "docid": "94b36b76337b402e80f5f08dae6f93b3", "score": "0.5370218", "text": "func (tk *timekeeper) run() {\n\n\t//main timekeeper loop\nloop:\n\tfor {\n\t\tselect {\n\n\t\tcase cmd, ok := <-tk.supvCmdch:\n\t\t\tif ok {\n\t\t\t\tif cmd.GetMsgType() == TK_SHUTDOWN {\n\t\t\t\t\tcommon.Infof(\"Timekeeper::run Shutting Down\")\n\t\t\t\t\ttk.supvCmdch <- &MsgSuccess{}\n\t\t\t\t\tbreak loop\n\t\t\t\t}\n\t\t\t\ttk.handleSupervisorCommands(cmd)\n\t\t\t} else {\n\t\t\t\t//supervisor channel closed. exit\n\t\t\t\tbreak loop\n\t\t\t}\n\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3a4a1abfc2c16604d6b72e0cabd69d9c", "score": "0.53697264", "text": "func main() {\n\tswitch os.Args[1] {\n\tcase \"run\":\n\t\trun(os.Args[2:])\n\tcase \"client\":\n\t\tclient(os.Args[2:])\n\tdefault:\n\t\tpanic(\"What?!\")\n\t}\n}", "title": "" }, { "docid": "432df0dcffe092beb57057358c4b4e28", "score": "0.53694314", "text": "func main() {\n\tcmd.Execute()\n}", "title": "" }, { "docid": "432df0dcffe092beb57057358c4b4e28", "score": "0.53694314", "text": "func main() {\n\tcmd.Execute()\n}", "title": "" }, { "docid": "432df0dcffe092beb57057358c4b4e28", "score": "0.53694314", "text": "func main() {\n\tcmd.Execute()\n}", "title": "" }, { "docid": "432df0dcffe092beb57057358c4b4e28", "score": "0.53694314", "text": "func main() {\n\tcmd.Execute()\n}", "title": "" } ]
d3590e59d06d83ba77a5448bfcc11df3
blockWrap will add left/right padding and wrap the text in the block
[ { "docid": "54fb3fb8f64a484c8579794b41988e18", "score": "0.7536197", "text": "func blockWrap(line, padding string, width int) string {\n\t// NOTE: We need to adjust width to reflect padding on right\n\twidth = width - len(padding)\n\tif len(padding)+len(line) <= width {\n\t\treturn padding + line\n\t}\n\tbuf := []string{}\n\twords := strings.Split(line, \" \")\n\tl := 0\n\tfor _, word := range words {\n\t\tif l+len(word) < width {\n\t\t\tif len(buf) > 0 {\n\t\t\t\tbuf = append(buf, \" \", word)\n\t\t\t\tl += len(word) + 1\n\t\t\t} else {\n\t\t\t\tbuf = append(buf, padding, word)\n\t\t\t\tl += len(padding) + len(word)\n\t\t\t}\n\t\t} else {\n\t\t\tbuf = append(buf, \"\\n\", padding, word)\n\t\t\tl = len(padding) + len(word)\n\t\t}\n\t}\n\treturn strings.Join(buf, \"\") + \"\\n\"\n}", "title": "" } ]
[ { "docid": "fb036bfd269e9320f82842f404e8b920", "score": "0.6123445", "text": "func (DefaulLineWrapperContext) WrapWidth() int { return WrapWidth }", "title": "" }, { "docid": "8c718ebfbfd23f65d984e09649f50f64", "score": "0.58372974", "text": "func WrapBlock(begin, end rune, elems ...io.WriterTo) BlockDeclr {\n\treturn BlockDeclr{\n\t\tRuneBegin: begin,\n\t\tRuneEnd: end,\n\t\tBlock: WritersTo(elems),\n\t}\n}", "title": "" }, { "docid": "6fd40bd4ea38609a107ad708cf982f59", "score": "0.57269067", "text": "func wrap(i, w int, s string) string {\n\tif w == 0 {\n\t\treturn strings.Replace(s, \"\\n\", \"\\n\"+strings.Repeat(\" \", i), -1)\n\t}\n\n\t// space between indent i and end of line width w into which\n\t// we should wrap the text.\n\twrap := w - i\n\n\tvar r, l string\n\n\t// Not enough space for sensible wrapping. Wrap as a block on\n\t// the next line instead.\n\tif wrap < 24 {\n\t\ti = 16\n\t\twrap = w - i\n\t\tr += \"\\n\" + strings.Repeat(\" \", i)\n\t}\n\t// If still not enough space then don't even try to wrap.\n\tif wrap < 24 {\n\t\treturn strings.Replace(s, \"\\n\", r, -1)\n\t}\n\n\t// Try to avoid short orphan words on the final line, by\n\t// allowing wrapN to go a bit over if that would fit in the\n\t// remainder of the line.\n\tslop := 5\n\twrap = wrap - slop\n\n\t// Handle first line, which is indented by the caller (or the\n\t// special case above)\n\tl, s = wrapN(wrap, slop, s)\n\tr = r + strings.Replace(l, \"\\n\", \"\\n\"+strings.Repeat(\" \", i), -1)\n\n\t// Now wrap the rest\n\tfor s != \"\" {\n\t\tvar t string\n\n\t\tt, s = wrapN(wrap, slop, s)\n\t\tr = r + \"\\n\" + strings.Repeat(\" \", i) + strings.Replace(t, \"\\n\", \"\\n\"+strings.Repeat(\" \", i), -1)\n\t}\n\n\treturn r\n}", "title": "" }, { "docid": "13598e8dc9473c75e2b5870d3012721c", "score": "0.56783235", "text": "func wrap(lineWidth int, text string) string {\n\treturn wrapText(text, lineWidth)\n}", "title": "" }, { "docid": "af7277d27411a562b4794235c46977d7", "score": "0.5589688", "text": "func (t *Text) Wrap(charLimit int, vertInc float64) []*Text {\n\tst := t.text.String()\n\toutlen := len(st) / charLimit\n\tif len(st)%charLimit != 0 {\n\t\toutlen++\n\t}\n\tout := make([]*Text, outlen)\n\tstart := 0\n\tvertical := 0.0\n\tfor i := range out {\n\t\tif start+charLimit <= len(st) {\n\t\t\tout[i] = t.d.NewText(st[start:start+charLimit], t.X(), t.Y()+vertical)\n\t\t} else {\n\t\t\tout[i] = t.d.NewText(st[start:], t.X(), t.Y()+vertical)\n\t\t}\n\t\tstart += charLimit\n\t\tvertical += vertInc\n\t}\n\treturn out\n}", "title": "" }, { "docid": "f237dd7929b0613117853cf5d95d6bd7", "score": "0.5537808", "text": "func WordWrap(d ui.Drawer, text string, bounds geom.Rectangle) {\n\twords := strings.Fields(text)\n\tif len(words) == 0 {\n\t\treturn\n\t}\n\n\tleft := bounds.Min.X\n\twp := bounds.Min\n\n\tfor _, word := range words {\n\t\tspword := \" \" + word\n\t\twsz := d.TextSize(spword)\n\n\t\tif wp.X+wsz.X > bounds.Max.X || word == \"[br]\" {\n\t\t\twp.Y += wsz.Y * 1.5\n\t\t\tif wp.Y > bounds.Max.Y {\n\t\t\t\treturn\n\t\t\t}\n\t\t\twp.X = left\n\t\t\tif word == \"[br]\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\tif wp.X == left {\n\t\t\tspword = word\n\t\t}\n\n\t\twsz = d.Draw(spword, wp)\n\t\twp.X += wsz.X\n\t}\n}", "title": "" }, { "docid": "0b21a56227f12a898890f256f6ced4ad", "score": "0.5525344", "text": "func (t *Text) Wrap(charLimit int, vertInc float64) []*Text {\n\tst := t.text.String()\n\toutlen := len(st) / charLimit\n\tif len(st)%charLimit != 0 {\n\t\toutlen++\n\t}\n\tout := make([]*Text, outlen)\n\tstart := 0\n\tvertical := 0.0\n\tfor i := range out {\n\t\tif start+charLimit <= len(st) {\n\t\t\tout[i] = t.d.NewStrText(st[start:start+charLimit], t.X(), t.Y()+vertical)\n\t\t} else {\n\t\t\tout[i] = t.d.NewStrText(st[start:], t.X(), t.Y()+vertical)\n\t\t}\n\t\tstart += charLimit\n\t\tvertical += vertInc\n\t}\n\treturn out\n}", "title": "" }, { "docid": "1fc7a3503215aa32b63904b11e7a26f5", "score": "0.5525141", "text": "func Wrap(e *echo.Echo) {\n\tWrapGroup(\"\", e.Group(\"\"))\n}", "title": "" }, { "docid": "ee55bf4f07e4153ea6b9a772e340c52d", "score": "0.5478791", "text": "func (c *Canvas) TextWrap(x, y, size, width float32, s string, fillcolor color.RGBA) {\n\tx, y = dimen(x, y, c.Width, c.Height)\n\tsize = pct(size, c.Width)\n\twidth = pct(width, c.Width)\n\tc.AbsTextWrap(x, y, size, width, s, fillcolor)\n}", "title": "" }, { "docid": "3fabea22590653e68010d98e893c6c3f", "score": "0.541779", "text": "func C4APrettyPrintBlock( InitialStr, MainContent string, MaxWidth int ) string {\n // We do a pretty print of the description based on a limit. That way, our\n // text lines are of equal width\n Buffer := fmt.Sprintf( InitialStr )\n Words := strings.Fields( MainContent )\n WordIndex := 0\n Indent := len( strings.Trim(InitialStr, \"\\n\") )\n\n // We loop until we have the full content of the description\n NbrCharacters := Indent\n for ;; {\n\n // If the word cannot fit on the width, we print it on its own line\n // without breaking it appart\n if Indent + len(Words[WordIndex]) >= MaxWidth {\n Buffer = fmt.Sprintf(\"%s%s\", Buffer, Words[WordIndex])\n WordIndex++\n }\n\n // The second loop is for each line\n for ; NbrCharacters < MaxWidth ; {\n\n // We've reached the end of the line\n if WordIndex >= len(Words) {\n break\n } else if NbrCharacters + len(Words[WordIndex]) + 1 > MaxWidth {\n break\n }\n\n Buffer = fmt.Sprintf(\"%s %s\", Buffer, Words[WordIndex])\n NbrCharacters += 1 + len(Words[WordIndex])\n WordIndex++\n }\n\n // If it's the last line, we can break the loop right now\n if WordIndex >= len(Words) {\n break\n }\n\n // After finishing a line, we reset the number of characters to the indenting\n NbrCharacters = Indent\n\n // Because we know there is another line, we add a \"\\n\" and an indention\n Buffer = fmt.Sprintf( \"%s\\n%s\", Buffer, strings.Repeat(\" \", Indent) )\n }\n\n return Buffer\n}", "title": "" }, { "docid": "85b6276da2766d2ee429d3a0369bf464", "score": "0.53870726", "text": "func (h *TextHandler) wrap(indent string, s string, maxWidth int) {\n\tw := 0\n\tfor _, f := range strings.Fields(s) {\n\t\tif w > 0 && w+len(f)+1 > maxWidth {\n\t\t\t// line would be too long with this word\n\t\t\th.print(\"\\n\")\n\t\t\tw = 0\n\t\t}\n\t\tif w == 0 {\n\t\t\t// first field on line, indent\n\t\t\tw = h.print(indent)\n\t\t} else {\n\t\t\t// not first word, space separate\n\t\t\tw += h.print(\" \")\n\t\t}\n\t\t// now write the word\n\t\tw += h.print(f)\n\t}\n}", "title": "" }, { "docid": "406ca4d71fa05742e6901e93abbb2533", "score": "0.5276343", "text": "func (e *HTMLTextArea) Wrap(v string) *HTMLTextArea {\n\te.a[\"wrap\"] = v\n\treturn e\n}", "title": "" }, { "docid": "67676c30d8cb870919b2ea3b2c54df50", "score": "0.5220096", "text": "func (sr *SlackReport) generateTextBlock(input string) slack.Block {\n\t// Ensure block text is within Slack api limits\n\tif len(input) > 3000 {\n\t\tinput = input[:2985] + \"...\\n<TRUNCATED>\"\n\t}\n\tb := slack.NewTextBlockObject(\"mrkdwn\", input, false, false)\n\treturn slack.NewSectionBlock(b, nil, nil)\n}", "title": "" }, { "docid": "f6788777f6e9b55d6e653dffdc9bb9fa", "score": "0.5173486", "text": "func (l *Label) textWrap() fyne.TextWrap {\n\treturn l.Wrapping\n}", "title": "" }, { "docid": "e6d78000d282816b9cdd13daecfa8f31", "score": "0.5102582", "text": "func wrap(s string, indent int) string {\n\tif indent > 3 {\n\t\tindent = 3\n\t}\n\n\twrapped := text.Wrap(s, maxLine)\n\tlines := strings.SplitN(wrapped, \"\\n\", 2)\n\tif len(lines) == 1 {\n\t\treturn lines[0]\n\t}\n\n\tif (maxLine - indentLen(indent)) <= 0 {\n\t\tpanic(\"too much indentation\")\n\t}\n\n\trest := strings.Join(lines[1:], \" \")\n\twrapped = text.Wrap(rest, maxLine-indentLen(indent))\n\treturn lines[0] + \"\\n\" + text.Indent(wrapped, makeIndent(indent))\n}", "title": "" }, { "docid": "b02aa88a0015b1a56e8d3d684749a074", "score": "0.50857085", "text": "func (v *TextView) SetPixelsInsideWrap(px int) {\n\tC.gtk_text_view_set_pixels_inside_wrap(v.native(), C.gint(px))\n}", "title": "" }, { "docid": "1b6d6778b94086f7e08b5b235a60bb82", "score": "0.5068554", "text": "func Wrap(err error, fileline string, text string) error {\n\treturn WrapFormat(err, fileline, text)\n}", "title": "" }, { "docid": "50d9778e47103c729507adf6da30cf87", "score": "0.50381374", "text": "func setNoWrap(panel gwu.Panel) {\n\tcount := panel.CompsCount()\n\tfor i := count - 1; i >= 0; i-- {\n\t\tpanel.CompAt(i).Style().SetWhiteSpace(gwu.WHITE_SPACE_NOWRAP)\n\t}\n}", "title": "" }, { "docid": "6232caed169ac768bfc60d75ae5d5762", "score": "0.50339407", "text": "func WrapText(desc string, maxWidth, titleLength int) string {\n\tif desc == \"\" {\n\t\treturn \"---\"\n\t}\n\tdesc = strings.ReplaceAll(desc, \"\\n\", \" \")\n\n\twidth, _, err := term.GetSize(0)\n\tif err != nil {\n\t\treturn breakString(desc, maxWidth, titleLength)\n\t}\n\n\tif maxWidth <= width {\n\t\treturn breakString(desc, maxWidth, titleLength)\n\t}\n\treturn breakString(desc, width, titleLength)\n}", "title": "" }, { "docid": "1889e6509f9665923b561d8c62320225", "score": "0.5030581", "text": "func (c *Colorable) Wrap(str string, style Style) string {\n\treturn fmt.Sprintf(\"%s%s%s\", c.format(style), str, resetFormat())\n}", "title": "" }, { "docid": "070ed2fe10414be0a4740d15fa5965b1", "score": "0.5026893", "text": "func wrapAtLength(s string, pad int) string {\n\twrapped := text.Wrap(s, maxLineLength-pad)\n\tlines := strings.Split(wrapped, \"\\n\")\n\tfor i, line := range lines {\n\t\tlines[i] = strings.Repeat(\" \", pad) + line\n\t}\n\treturn strings.Join(lines, \"\\n\")\n}", "title": "" }, { "docid": "ae6202cfc866e79fd90b35486cb1254f", "score": "0.5019687", "text": "func (v *Layout) SetWrap(wrap WrapMode) {\n\tC.pango_layout_set_wrap(v.native(), C.PangoWrapMode(wrap))\n}", "title": "" }, { "docid": "7d741a8a30506bc24d8468254bb61b24", "score": "0.50029916", "text": "func (t *StrChain) Wrap(w int) *StrChain {\n\tt.v = Wrap(t.v, w)\n\treturn t\n}", "title": "" }, { "docid": "5fb5e82226cd1e0110e9060e25ebeded", "score": "0.5001358", "text": "func word_wrap(text string, lineWidth int) string {\n\twords := strings.Fields(strings.TrimSpace(text))\n\tfmt.Println(len(words))\n\tif len(words) == 0 {\n\t\treturn text\n\t}\n\twrapped := words[0]\n\tspaceLeft := lineWidth - len(wrapped)\n\tfor _, word := range words[1:] {\n\t\tif len(word)+1 > spaceLeft {\n\t\t\twrapped += \"\\n\" + word\n\t\t\tspaceLeft = lineWidth - len(word)\n\t\t} else {\n\t\t\twrapped += \" \" + word\n\t\t\tspaceLeft -= 1 + len(word)\n\t\t}\n\t}\n\tfmt.Println(strings.Split(wrapped,\"\\n\"))\n\n\treturn wrapped\n\n}", "title": "" }, { "docid": "a132b94dc27a6927447dd354dfef195d", "score": "0.49940428", "text": "func ByteWrapBlock(begin, end []byte, elems ...io.WriterTo) ByteBlockDeclr {\n\treturn ByteBlockDeclr{\n\t\tBlockBegin: begin,\n\t\tBlockEnd: end,\n\t\tBlock: WritersTo(elems),\n\t}\n}", "title": "" }, { "docid": "271240bacd2807a32e58e032f151ec7a", "score": "0.49439877", "text": "func ColorWrap(text string, style string) string {\n\tif style == \"\" {\n\t\treturn text\n\t}\n\tcode, resetCode := ansiCodesForWrapping(style)\n\treturn code + text + resetCode\n}", "title": "" }, { "docid": "2a13a46549aef094b191456d3a22603a", "score": "0.48095024", "text": "func wrapMessage(width int, message string) string {\n\tmLen := getMessageLength(message)\n\tsideAdder := (width - mLen - 2) / 2\n\tfor i := 0; i < sideAdder; i++ {\n\t\tmessage = \" \" + message + \" \"\n\t}\n\tif (sideAdder*2+mLen)+2 != width {\n\t\treturn \"*\" + message + \" *\"\n\t}\n\treturn \"*\" + message + \"*\"\n}", "title": "" }, { "docid": "662bc9d6f04fde31f65fd472ab79362b", "score": "0.48049062", "text": "func wrap(str string, width int) []string {\n\tvar out []string\n\n\tlines := strings.Split(str, \"\\n\")\n\n\tfor _, l := range lines {\n\n\t\twords := strings.Split(l, \" \")\n\t\tif len(words) == 0 {\n\t\t\treturn out\n\t\t}\n\n\t\t// current line we are making\n\t\tcurrent := words[0]\n\n\t\t// # spaces left before the end\n\t\tremaining := width - len(current)\n\n\t\tfor _, word := range words[1:] {\n\t\t\tif len(word)+1 > remaining {\n\t\t\t\tout = append(out, current)\n\t\t\t\tcurrent = word\n\t\t\t\tremaining = width - len(word)\n\t\t\t} else {\n\t\t\t\tcurrent += \" \" + word\n\t\t\t\tremaining -= 1 + len(word)\n\t\t\t}\n\t\t}\n\n\t\tout = append(out, current)\n\t}\n\n\treturn out\n}", "title": "" }, { "docid": "e6c7a8b5a0efb8b28e5079e87b3db686", "score": "0.48030353", "text": "func (DefaulLineWrapperContext) Padding() string { return \"\" }", "title": "" }, { "docid": "ac8740c713aaaea404952cca993242f9", "score": "0.4794849", "text": "func Pad(block []byte, padding int, padWith byte) []byte {\n\tif len(block) == padding {\n\t\treturn block\n\t}\n\tif len(block) > padding {\n\t\tpanic(fmt.Errorf(\"Your block of size '%v' is of greater length than your padding length '%v'\", len(block), padding))\n\t}\n\tnewBlock := make([]byte, padding)\n\tfor i := 0; i < len(block); i++ {\n\t\tnewBlock[i] = block[i]\n\n\t}\n\tfor i := len(block); i < padding; i++ {\n\t\tnewBlock[i] = padWith\n\n\t}\n\treturn newBlock\n}", "title": "" }, { "docid": "1b16707f5d4e45169ce1b3b93a4c4ea1", "score": "0.4782464", "text": "func wordWrap(line string, width int) string {\n\tif len(line) <= width {\n\t\treturn line\n\t}\n\tbuf := []string{}\n\twords := strings.Split(line, \" \")\n\tl := 0\n\tfor _, word := range words {\n\t\tif l+len(word) < width {\n\t\t\tif len(buf) > 0 {\n\t\t\t\tbuf = append(buf, \" \", word)\n\t\t\t\tl += len(word) + 1\n\t\t\t} else {\n\t\t\t\tbuf = append(buf, word)\n\t\t\t\tl += len(word)\n\t\t\t}\n\t\t} else {\n\t\t\tbuf = append(buf, \"\\n\", word)\n\t\t\tl = 0\n\t\t}\n\t}\n\treturn strings.Join(buf, \"\") + \"\\n\"\n}", "title": "" }, { "docid": "b2a994ca7dd60c8e65a5bcd3c5d9263f", "score": "0.477371", "text": "func WordWrap(input string, lineWidth int) string {\n\twords := strings.Fields(strings.TrimSpace(input))\n\tif len(words) == 0 {\n\t\treturn input\n\t}\n\n\twrapped := words[0]\n\tremainingRoom := lineWidth - len(wrapped)\n\n\tfor _, word := range words[1:] {\n\n\t\tif len(word)+1 > remainingRoom {\n\t\t\twrapped += \"\\n\" + word\n\t\t\tremainingRoom = lineWidth - len(word)\n\t\t\tcontinue\n\t\t}\n\n\t\twrapped += \" \" + word\n\t\tremainingRoom -= 1 + len(word)\n\t}\n\treturn wrapped\n}", "title": "" }, { "docid": "00113d0a5c718d05a538c9e3e4ab0eb2", "score": "0.47669142", "text": "func NewPageBlockEmbedded(uRL string, hTML string, posterPhoto *Photo, width int32, height int32, caption RichText, isFullWidth bool, allowScrolling bool) *PageBlockEmbedded {\n\tpageBlockEmbeddedTemp := PageBlockEmbedded{\n\t\ttdCommon: tdCommon{Type: \"pageBlockEmbedded\"},\n\t\tURL: uRL,\n\t\tHTML: hTML,\n\t\tPosterPhoto: posterPhoto,\n\t\tWidth: width,\n\t\tHeight: height,\n\t\tCaption: caption,\n\t\tIsFullWidth: isFullWidth,\n\t\tAllowScrolling: allowScrolling,\n\t}\n\n\treturn &pageBlockEmbeddedTemp\n}", "title": "" }, { "docid": "41fd0d42404844409c091cab822a49d0", "score": "0.47411588", "text": "func (_this *HTMLTextAreaElement) Wrap() string {\n\tvar ret string\n\tvalue := _this.Value_JS.Get(\"wrap\")\n\tret = (value).String()\n\treturn ret\n}", "title": "" }, { "docid": "3588fa2b5a8f9d9c383b2f4f60bd2694", "score": "0.47348917", "text": "func textWrapper(label string, x1, x2 int) (labels []string) {\r\n\tlabels = make([]string, 0)\r\n\t//The number of characters that can be held in a line\r\n\tcharactersHeld := (x2 - x1) / textWidth\r\n\r\n\t//Keeping a constant loop until break\r\n\t//Can do a for loop and the x:characters held chop off but decided to reslice instead as its just easier\r\n\tfor true {\r\n\t\t//If the line can hold more characters then the label can\r\n\t\tif charactersHeld > len(label) {\r\n\t\t\tlabels = append(labels, label)\r\n\t\t\tbreak\r\n\t\t} else {\r\n\t\t\tlabels = append(labels, label[:charactersHeld])\r\n\t\t\tlabel = label[charactersHeld:]\r\n\t\t}\r\n\t}\r\n\r\n\treturn labels\r\n}", "title": "" }, { "docid": "aaac15a4e415ee7642c82106a9bbbf0b", "score": "0.4729705", "text": "func Render(template *gdk.Drawable, width, height int, blocks []squarify.Block, meta []squarify.Meta, style *Style) *gdk.Pixmap {\n\n\tround := func(block squarify.Block, i int) (X, Y, W, H int) {\n\t\t// Convert floating point coords to int.\n\t\tX = int(math.Floor(block.X))\n\t\tY = int(math.Floor(block.Y))\n\t\tW = int(math.Floor(block.W))\n\t\tH = int(math.Floor(block.H))\n\t\treturn\n\t}\n\n\tpixmap := gdk.NewPixmap(template, width, height, -1)\n\n\t// Fill whole space with bg color\n\tgc.SetClipRectangle(0, 0, width, height)\n\tgc.SetForeground(style.BgColor)\n\tgc.SetBackground(style.BgColor)\n\tpixmap.GetDrawable().DrawRectangle(gc, true, 0, 0, width, height)\n\n\tfilesNum := 0\n\t// Draw all blocks\n\tfor i, block := range blocks {\n\t\t// Don't draw the placeholder (non-directory) blocks.\n\t\t/*\n\t\t if block.TreeSizer == nil {\n\t\t continue\n\t\t }*/\n\n\t\tmeta := meta[i]\n\t\tcolor := style.ColorByDepth[meta.Depth%len(style.ColorByDepth)]\n\n\t\tx, y, w, h := round(block, i)\n\n\t\tgc.SetClipRectangle(x, y, w+1, h+1)\n\n\t\t// Fill block\n\t\tgc.SetForeground(color)\n\t\tpixmap.GetDrawable().DrawRectangle(gc, true, x, y, w, h)\n\n\t\t// Draw border\n\t\tgc.SetForeground(style.BorderColor)\n\t\tpixmap.GetDrawable().DrawRectangle(gc, false, x, y, w, h)\n\n\t\t// Draw title\n\t\tif block.TreeSizer != nil {\n\t\t\tdir := &block.TreeSizer.(*dirtree.Node).Info\n\t\t\tstyle.TitleLayout.SetText(dir.Basename + \" (\" + sh.FancySize(dir.Size) + \")\")\n\t\t\tstyle.TitleLayout.SetWidth(w * pango.SCALE)\n\t\t\tpixmap.GetDrawable().DrawLayout(gc, x+1, y+1, style.TitleLayout)\n\t\t} else {\n\t\t\tstyle.TitleLayout.SetText(\"<files \" + strconv.Itoa(filesNum) + \">\")\n\t\t\tstyle.TitleLayout.SetWidth(w * pango.SCALE)\n\t\t\tpixmap.GetDrawable().DrawLayout(gc, x+1, y+1, style.TitleLayout)\n\t\t\tfilesNum += 1\n\t\t}\n\t}\n\n\treturn pixmap\n}", "title": "" }, { "docid": "074576861d218838deee85ebae52d1ef", "score": "0.4703856", "text": "func (font *Font) GetWrap(text string, wrapLimit float32) (float32, []string) {\n\tvar width, currentWidth float32\n\tvar lines, currentLine []string\n\n\tfor _, word := range strings.Split(text, \" \") {\n\t\twordWidth := font.GetWidth(word)\n\t\tif currentWidth+wordWidth > wrapLimit {\n\t\t\tif len(currentLine) > 0 {\n\t\t\t\tlines = append(lines, strings.Join(currentLine, \" \"))\n\t\t\t\twidth = float32(math.Max(float64(currentWidth), float64(width)))\n\t\t\t}\n\t\t\tcurrentLine = []string{word}\n\t\t\tcurrentWidth = wordWidth\n\t\t} else {\n\t\t\tcurrentLine = append(currentLine, word)\n\t\t\tcurrentWidth += wordWidth\n\t\t}\n\t}\n\n\tlines = append(lines, strings.Join(currentLine, \" \"))\n\twidth = float32(math.Max(float64(currentWidth), float64(width)))\n\n\treturn width, lines\n}", "title": "" }, { "docid": "8c323701f98f524740748e5d50201db3", "score": "0.46934658", "text": "func handlerAddBlock(w http.ResponseWriter, r *http.Request) {\n fmt.Fprintf(w, \"<h1>%s</h1><div>%s</div>\", \"Add new block\", \"test\")\n}", "title": "" }, { "docid": "7e86a8b11aab303ec0e6015339e6312e", "score": "0.46884742", "text": "func ProcessTextBlockPDFItem(pdf *gofpdf.Fpdf, textBlockItem PdfContentItem, pdfSettings PdfFields) (err error) {\n\n\tfont := FetchTextFormattingFromRecipe(textBlockItem.Font)\n\n\tpdf.SetFont(font.Family, font.Style, font.Size)\n\tpdf.SetTextColor(font.Colour.R, font.Colour.G, font.Colour.B)\n\tpdf.SetFillColor(font.CellFill.Colour.R, font.CellFill.Colour.G, font.CellFill.Colour.B)\n\tpdf.SetDrawColor(font.CellBorders.Colour.R, font.CellBorders.Colour.G, font.CellBorders.Colour.B)\n\n\t//Settings the x and y position for the text, and making position 0 equivalent to the margin that we've set\n\tpdf.SetXY(textBlockItem.XPosition+pdfSettings.PdfSettings.PageLeftAndRightMargins, textBlockItem.YPosition+pdfSettings.PdfSettings.PageTopMargin)\n\n\tpdf.MultiCell(textBlockItem.Width, font.Size+font.LineSpacing, textBlockItem.Text, font.CellBorders.Style, font.Alignment, font.CellFill.Filled)\n\n\treturn err\n}", "title": "" }, { "docid": "7b66b89bb51ddb1fc3c1937798c81eb5", "score": "0.46871924", "text": "func Wrap(str string, width int) []string {\n\t// We should never really wrap with width set to 1, but if we get\n\t// called with width set to 1 we'll just return a slice of the given\n\t// string.\n\tif width == 1 {\n\t\treturn []string{str}\n\t}\n\n\t// If the length of the string is shorter than the width we'll return\n\t// it immediately.\n\tif len(str) <= width {\n\t\treturn []string{str}\n\t}\n\n\t// Split the string on spaces, if the length of the splitted array is\n\t// equal to 1 it means that we don't have any spaces so we can return\n\t// the string right away.\n\twords := strings.Split(str, \" \")\n\tif len(words) == 1 {\n\t\treturn []string{str}\n\t}\n\n\tvar r []string\n\tvar b strings.Builder\n\tfor _, w := range words {\n\t\t// The string exists and the length of the current string +\n\t\t// the length of the word that we are currently processing\n\t\t// exceeds the line width, that means it's time to wrap, so\n\t\t// we'll append the current string and reset the string\n\t\t// builder.\n\t\tif b.Len() > 0 && b.Len()+len(w) >= width {\n\t\t\tr = append(r, b.String())\n\t\t\tb.Reset()\n\t\t}\n\n\t\t// If we have an empty string we'll just write the current\n\t\t// word to the string builder. If not, we'll write a space and\n\t\t// the current word to the string.\n\t\tif b.Len() == 0 {\n\t\t\tfmt.Fprintf(&b, \"%s\", w)\n\t\t} else {\n\t\t\tfmt.Fprintf(&b, \" %s\", w)\n\t\t}\n\t}\n\n\t// We have started to build a string that never got added within the\n\t// loop, so let's add it.\n\tif b.Len() > 0 {\n\t\tr = append(r, b.String())\n\t}\n\n\treturn r\n}", "title": "" }, { "docid": "cfe045d7c4c6720e330f7a6d4c03b282", "score": "0.4681006", "text": "func New(d *font.Drawer, lines []string, opts *Options) TextBlock {\n\tspacing := fixed.I(int(float64(d.Face.Metrics().Height.Ceil()) * opts.spacing()))\n\tspaces := fixed.I(0)\n\tif len(lines) > 0 {\n\t\tspaces = fixed.Int26_6(len(lines) - 1)\n\t}\n\theight := d.Face.Metrics().Height * fixed.Int26_6(len(lines)) // heaight of all lines\n\theight += (spacing - d.Face.Metrics().Height) * spaces // height of all spaces\n\n\tvar width fixed.Int26_6\n\tfor _, str := range lines {\n\t\tif size := d.MeasureString(str); size > width {\n\t\t\twidth = size\n\t\t}\n\t}\n\n\treturn &textBlock{\n\t\td: d,\n\t\twidth: width / 2,\n\t\theight: height / 2,\n\t\tlines: lines,\n\t\tspacing: spacing,\n\t\topts: opts,\n\t}\n}", "title": "" }, { "docid": "389a23a8742b2356e3217c80beb76ab3", "score": "0.4662718", "text": "func (c *Canvas) AbsTextWrap(x, y, size, width float32, s string, fillcolor color.RGBA) {\n\tdefer op.Push(c.Context.Ops).Pop()\n\top.TransformOp{}.Offset(f32.Point{X: x, Y: y - size}).Add(c.Context.Ops) // shift to use baseline\n\tl := material.Label(material.NewTheme(gofont.Collection()), unit.Px(size), s)\n\tl.Color = fillcolor\n\tc.Context.Constraints.Max.X = int(width)\n\tl.Layout(c.Context)\n\tc.Context.Constraints.Max.X = int(c.Width) // restore width...\n}", "title": "" }, { "docid": "989bbe04bc3b10b44e00364f3c2e3b29", "score": "0.46509662", "text": "func BreakParagraph(para *Paragraph, box *frame.Box) ([]frame.Container, error) {\n\t//\n\t// TODO\n\t// find all children with align=left or align=right and collect their boxes\n\t// there should be an API for this in frame/layout.\n\t//\n\t//leftAlign, rightAlign := collectFloatBoxes(pbox)\n\t//parshape := OutlineParshape(pbox, leftAlign, rightAlign)\n\tparshape := OutlineParshape(box, nil, nil)\n\tif parshape == nil {\n\t\tT().Errorf(\"could not create a parshape for principal box\")\n\t}\n\tcursor := linebreak.NewFixedWidthCursor(khipu.NewCursor(para.Khipu), 10*dimen.BP, 0)\n\tbreakpoints, err := firstfit.BreakParagraph(cursor, parshape, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tT().Debugf(\"text broken up with %d breaks: %v\", len(breakpoints), breakpoints)\n\t//\n\t// TODO\n\t// assemble the broken line segments into anonymous line boxes\n\tT().Debugf(\" |---------+---------+---------+---------+---------50--------|\")\n\tj := int64(0)\n\tvar lines []frame.Container\n\tfor i := 1; i < len(breakpoints); i++ {\n\t\tpos := breakpoints[i].Position()\n\t\tT().Debugf(\"%3d: %s\", i, para.Khipu.Text(j, pos))\n\t\tl := pos - j\n\t\tindent := dimen.Dimen(0) // TODO derive from parshape\n\t\tlinebox := NewLineBox(para.Khipu, breakpoints[i].Position(), l, indent)\n\t\tlinebox.Box.W = box.W\n\t\tlines = append(lines, linebox)\n\t\t//linebox.AppendToPrincipalBox(pbox)\n\t\tj = breakpoints[i].Position()\n\t}\n\t//\n\treturn lines, nil\n}", "title": "" }, { "docid": "fa9f9aaa8d6bc9ec3b4ba029e18d211e", "score": "0.4635849", "text": "func (i *Installer) ShowWrapped(texts ...string) {\n\tfor _, text := range texts {\n\t\ttext = strings.Trim(text, \"\\n\") // Drop leading and trailing newlines\n\t\tfor _, para := range strings.Split(text, \"\\n\") { // Preserve newlines in the text\n\t\t\tfor _, line := range doWordWrap(para, \"\", 79) { // But wrap text too\n\t\t\t\ti.show.Println(line)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "971ccd47be207663f1bb20b9688bde11", "score": "0.46332794", "text": "func padblock(buf []byte, n int) []byte {\n\tmissing := n - len(buf)\n\tif missing <= 0 {\n\t\treturn buf\n\t}\n\tif missing == 1 {\n\t\treturn append(buf, 0x80) // 0x80 = 10000000b\n\t}\n\treturn append(append(buf, 0x80), make([]byte, missing-1)...)\n}", "title": "" }, { "docid": "5b5db228cd5a179e6bd91c80b643de85", "score": "0.46247715", "text": "func BuildPaddingBlock(byteNum int, blockSize int) (padding []byte) {\n\tfor i := 1; i <= blockSize; i++ {\n\t\tif (i >= blockSize-byteNum) && (byteNum <= blockSize) {\n\t\t\tpadding = append(padding, byte(byteNum+1))\n\t\t} else {\n\t\t\tpadding = append(padding, byte(0))\n\t\t}\n\t}\n\treturn padding\n}", "title": "" }, { "docid": "0ddfbc23af1d9789913d50a7fdfb6eb5", "score": "0.46239215", "text": "func lineWrap(s string, w int) string {\n\tr := strings.NewReader(s)\n\tl := make([]byte, w)\n\tb := bytes.NewBuffer(make([]byte, 0, len(s)*65/64))\n\n\tfor {\n\t\tn, err := r.Read(l)\n\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\t// Would indicate a bug in StringReader\n\t\t\tpanic(err)\n\t\t}\n\n\t\tb.Write(l[:n])\n\t\tb.WriteString(\"\\n\")\n\t}\n\n\treturn string(b.Bytes())\n}", "title": "" }, { "docid": "3d76b8db29f53f307ba09f95a2270658", "score": "0.4603727", "text": "func (r *Renderer) BlockCode(out *bytes.Buffer, text []byte, lang string) {\n\n\t// If the language isn't specified, fallback on the standard processor.\n\tif len(lang) == 0 {\n\t\tr.Html.BlockCode(out, text, lang)\n\t\treturn\n\t}\n\n\tvar stderr bytes.Buffer\n\n\tcmd := exec.Command(\"pygmentize\", \"-l\"+lang, \"-fhtml\")\n\tcmd.Stdin = bytes.NewReader(text)\n\tcmd.Stdout = out\n\tcmd.Stderr = &stderr\n\n\tif err := cmd.Run(); err != nil {\n\t\tlog.Err(err, \"When running pygmentize\")\n\t}\n}", "title": "" }, { "docid": "876afe5e67e2b91e18dcc6bd15479615", "score": "0.45934948", "text": "func (c *Colors) wrap(s string) string {\n\treturn c.format() + s + c.unformat()\n}", "title": "" }, { "docid": "9e5d43b7c582bf6acbb36ab509d116e4", "score": "0.4584662", "text": "func Wrap(v ...interface{}) *Element {\n\treturn NewElement(\"wrapper\", v...)\n}", "title": "" }, { "docid": "b477a5b65b31583944a7cbb76aec75db", "score": "0.4577888", "text": "func (p *Page) Wrap() *Page {\n\texamples := make([]*Example, len(p.Examples))\n\tfor i, eg := range p.Examples {\n\t\texamples[i] = &Example{\n\t\t\tDesc: green + eg.Desc + reset,\n\t\t\tLine: matchVariable.ReplaceAllString(eg.Line, bold+\"$1\"+reset),\n\t\t}\n\t}\n\treturn &Page{\n\t\tpath: p.path,\n\t\tName: p.Name,\n\t\tDescs: p.Descs,\n\t\tExamples: examples,\n\t}\n}", "title": "" }, { "docid": "b543b84e756a6a57604ce52f11883529", "score": "0.45579666", "text": "func (r *fmdRenderer) BlockCode(out *bytes.Buffer, text []byte, lang string) {\n\n\t// If we are looking for the meta block at the end, any block could be it.\n\tif r.metaAtEnd {\n\t\tr.haveMeta = true\n\t\tr.metaBytes = text\n\t\tr.metaLang = lang\n\t\tr.metaBuffer.Reset()\n\t\tr.bfRenderer.BlockCode(&r.metaBuffer, text, lang)\n\t\treturn\n\t}\n\t// We may already have one block, but only if it's the header title.\n\tif r.blocks == 0 || (r.blocks == 1 && r.headerTitle != \"\") {\n\t\tif !r.haveMeta {\n\t\t\tr.haveMeta = true\n\t\t\tr.metaBytes = text\n\t\t\tr.metaLang = lang\n\t\t\treturn\n\t\t}\n\t}\n\tr.incrementBlocks(out)\n\tr.bfRenderer.BlockCode(out, text, lang)\n}", "title": "" }, { "docid": "1be586a3a6eb609b0810da14abd83669", "score": "0.45423254", "text": "func Wrap(s string, n int) string {\n\tif i := strings.IndexByte(s, '\\n'); i >= 0 {\n\t\treturn Wrap(s[:i], n) + \"\\n\" + Wrap(s[i+1:], n)\n\t}\n\tif len(s) <= n {\n\t\treturn s\n\t}\n\treturn s[:n] + \"\\n\" + Wrap(s[n:], n)\n}", "title": "" }, { "docid": "24056f09a25f6e7d9c3c6f5920f90a57", "score": "0.45360345", "text": "func encryptBlock(xk []uint16, dst, src []byte) {\n\t// Convert the bytes into words\n\tr0, r1, r2, r3 :=\n\t\tuint16(src[0])|uint16(src[1])<<8,\n\t\tuint16(src[2])|uint16(src[3])<<8,\n\t\tuint16(src[4])|uint16(src[5])<<8,\n\t\tuint16(src[6])|uint16(src[7])<<8\n\n\t// Performs 5 mixing, 1 mashing, 6 mixing, 1 mashing, 5 mixing rounds\n\tfor i := 0; i < 16; i++ {\n\t\tr0 = r0 + xk[4*i] + (r3 & r2) + ((^r3) & r1)\n\t\tr0 = r0<<1 | r0>>(15) // rotate left\n\n\t\tr1 = r1 + xk[4*i+1] + (r0 & r3) + ((^r0) & r2)\n\t\tr1 = r1<<2 | r1>>(14) // rotate left\n\n\t\tr2 = r2 + xk[4*i+2] + (r1 & r0) + ((^r1) & r3)\n\t\tr2 = r2<<3 | r2>>(13) // rotate left\n\n\t\tr3 = r3 + xk[4*i+3] + (r2 & r1) + ((^r2) & r0)\n\t\tr3 = r3<<5 | r3>>(11) // rotate left\n\n\t\t// Mashing rounds\n\t\tif i == 4 || i == 10 {\n\t\t\tr0 = r0 + xk[r3&63]\n\t\t\tr1 = r1 + xk[r0&63]\n\t\t\tr2 = r2 + xk[r1&63]\n\t\t\tr3 = r3 + xk[r2&63]\n\t\t}\n\t}\n\n\t// Convert the words back into bytes\n\tdst[1], dst[0] = uint8(r0>>8), uint8(r0&0xff)\n\tdst[3], dst[2] = uint8(r1>>8), uint8(r1&0xff)\n\tdst[5], dst[4] = uint8(r2>>8), uint8(r2&0xff)\n\tdst[7], dst[6] = uint8(r3>>8), uint8(r3&0xff)\n}", "title": "" }, { "docid": "37767d9b9c91d88bab6aac23409cae3b", "score": "0.4523146", "text": "func (ctx *Context) CodeBlock(content string, lang string) (formatted string) {\n\treturn \"```\" + lang + \"\\n\" + content + \"\\n```\"\n}", "title": "" }, { "docid": "a28b2952dbd91e599c2226acdf9de835", "score": "0.4522562", "text": "func newBlock(size int) *block {\n\treturn &block{runs: rle.NewRunList(), size: size}\n}", "title": "" }, { "docid": "f937473b48c8e0df932decd9c9b98b36", "score": "0.45141095", "text": "func (d *documentConstructor) inlineBlockCheck() {\n\tif !d.blockCheck() {\n\t\td.push(NewParagraph())\n\t}\n}", "title": "" }, { "docid": "806fe4042e401b27b561205255f926de", "score": "0.45021063", "text": "func scrollWrap(buf []byte, content []byte, tick uint32) uint32 {\n\tlength := uint32(len(content))\n\twidth := uint32(len(buf))\n\tgap := uint32(width / 2)\n\tn := 0\n\tif length <= width {\n\t\tn = copy(buf, content)\n\t\tcopy(buf[n:], spaceBytes)\n\t\treturn uint32(n)\n\t}\n\n\toffset := tick % (length + gap)\n\tif offset < length {\n\t\tn = copy(buf, content[offset:])\n\t} else {\n\t\tgap = gap - (offset - length)\n\t}\n\tn += copy(buf[n:], spaceBytes[:gap])\n\tn += copy(buf[n:], content[0:])\n\treturn uint32(n)\n}", "title": "" }, { "docid": "35006ff9e1e9017b72810fb4876ffb64", "score": "0.44988498", "text": "func NewWrapWriter(w io.Writer, width int, dec RuneChunkDecoder, enc RuneEncoder) *WrapWriter {\n\tret := &WrapWriter{\n\t\tw: w,\n\t\truneDecoder: dec,\n\t\twidth: runePos(width),\n\t\tlineTerm: []byte(\"\\n\"),\n\t\tparagraphSep: \"\\n\",\n\t\tprevState: stateWordWrap,\n\t\tprevRune: LineSeparator,\n\t\tlineBuf: byteRuneBuffer{enc: enc},\n\t}\n\tret.resetLine()\n\treturn ret\n}", "title": "" }, { "docid": "995fa74777a8ba0c2c7579efe43a4005", "score": "0.44953287", "text": "func Wrap(err error, wrappers ...Wrapper) error {\n\treturn WrapSkipping(err, 1, wrappers...)\n}", "title": "" }, { "docid": "185a520d8d60c9e0c8394005bb404430", "score": "0.44910526", "text": "func (w *Text) SetWordWrap(isWrap bool) {\r\n\tw.Candy().Guify(\"gtk_text_set_word_wrap\", w, isWrap)\r\n}", "title": "" }, { "docid": "bd681c30249b487c817714247361d5d8", "score": "0.4486486", "text": "func markupToBlocks(text string) []*Block {\n\treturn []*Block{NewTextBlock(text)}\n}", "title": "" }, { "docid": "7f122b9c6c0d45f725eb7e79f39e4846", "score": "0.44841173", "text": "func padLeft16Times(text string) string {\n padCnt := aes.BlockSize - len(text) % aes.BlockSize\n if padCnt % aes.BlockSize == 0 {\n return text\n } else {\n return strings.Repeat(\"0\", padCnt) + text\n }\n}", "title": "" }, { "docid": "8445ced63b86aa91915b617b152a60c7", "score": "0.44625", "text": "func Wrap(err error, v Vice, text string) error {\n\treturn skip.Wrap(err, skip.Vice(v), 1, text)\n}", "title": "" }, { "docid": "52ad258ddc5242dcc49e0f4343ba5cf8", "score": "0.44587666", "text": "func (_this *HTMLTextAreaElement) SetWrap(value string) {\n\tinput := value\n\t_this.Value_JS.Set(\"wrap\", input)\n}", "title": "" }, { "docid": "9491e46aefe88efeac04dac1986b4ff3", "score": "0.44572043", "text": "func NewPageBlockPreformatted(text RichText, language string) *PageBlockPreformatted {\n\tpageBlockPreformattedTemp := PageBlockPreformatted{\n\t\ttdCommon: tdCommon{Type: \"pageBlockPreformatted\"},\n\t\tText: text,\n\t\tLanguage: language,\n\t}\n\n\treturn &pageBlockPreformattedTemp\n}", "title": "" }, { "docid": "e9ca2b9e9c5264fc15c7f65aa36555eb", "score": "0.4456111", "text": "func formatBlock(b *tfschema.Block, format string) (string, error) {\n\tf, err := formatter.NewBlockFormatter(b, format)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn f.Format()\n}", "title": "" }, { "docid": "5a7b067a5f01192ac7874defa87cfba9", "score": "0.4449453", "text": "func wrappingArea(length float64, width float64, height float64) int {\n\tfrontArea := length * width\n\tsideArea := width * height\n\ttopArea := height * length\n\tbonusArea := math.Min(frontArea, math.Min(sideArea, topArea))\n\treturn int(2*(frontArea+sideArea+topArea) + bonusArea)\n}", "title": "" }, { "docid": "73cc397ed6c061ff249a767deee88e0f", "score": "0.44448957", "text": "func (f FmtFunc) Wrap(t *testing.T, format string, args ...interface{}) FmtFunc {\n\treturn func(wrappedFormat string, wrappedArgs ...interface{}) {\n\t\tif t != nil {\n\t\t\tt.Helper()\n\t\t}\n\t\tf(fmt.Sprintf(format, append(args, wrappedFormat)...), wrappedArgs...)\n\t}\n}", "title": "" }, { "docid": "9cc6ab89e3e5b7869e92f3a943aae824", "score": "0.44437927", "text": "func (w *rfc3394KeyWrap) initializeForWrap(plaintext []byte) {\n\tw.n = len(plaintext) / 8\n\n\tw.iv = make([]byte, 8)\n\tfor i := 0; i < 8; i++ {\n\t\tw.iv[i] = 0xa6 // default IV = 0xa6a6a6a6a6a6a6a6\n\t}\n\n\tw.r = make([][]byte, w.n)\n\tfor i := 0; i < w.n; i++ {\n\t\tw.r[i] = make([]byte, 8)\n\t\tcopy(w.r[i], plaintext[8*i:8*(1+i)])\n\t}\n}", "title": "" }, { "docid": "002b70b5a637f7fbf5ff2c16026c9ecf", "score": "0.44392884", "text": "func PadMsg(message []byte, blockLen int) []byte {\n\n\tpadLen := (blockLen - (len(message) % blockLen))\n\n\tif padLen == 0 {\n\t\treturn message\n\t}\n\n\tpadding := make([]byte, padLen)\n\tfor i := 0; i < padLen; i++ {\n\t\tpadding[i] = byte(padLen)\n\t}\n\n\tmessage = append(message, padding...)\n\n\treturn message\n\n}", "title": "" }, { "docid": "b4153a552037edeea7d1f5472a1a93fa", "score": "0.44300002", "text": "func NewPageBlockParagraph(text RichText) *PageBlockParagraph {\n\tpageBlockParagraphTemp := PageBlockParagraph{\n\t\ttdCommon: tdCommon{Type: \"pageBlockParagraph\"},\n\t\tText: text,\n\t}\n\n\treturn &pageBlockParagraphTemp\n}", "title": "" }, { "docid": "b880351fa2f8f534c949c196216faf40", "score": "0.44277304", "text": "func DebugLevelWrap(l int) DebugLevel {\n\treturn DebugLevel(l % 6)\n}", "title": "" }, { "docid": "19bc70eec8f70e5eda9d8706dcef9e03", "score": "0.44242445", "text": "func EncryptBlock(key Key, buf []byte) {\n\tdata0 := binary.LittleEndian.Uint32(buf[0:4])\n\tdata1 := binary.LittleEndian.Uint32(buf[4:8])\n\tdelta := uint32(0x61C88647)\n\tsum := uint32(0)\n\tfor i := 0; i < numRounds; i++ {\n\t\tdata0 += (((data1 << 4) ^ (data1 >> 5)) + data1) ^ (sum + key[sum&3])\n\t\tsum -= delta\n\t\tdata1 += (((data0 << 4) ^ (data0 >> 5)) + data0) ^ (sum + key[(sum>>11)&3])\n\t}\n\tbinary.LittleEndian.PutUint32(buf[0:4], data0)\n\tbinary.LittleEndian.PutUint32(buf[4:8], data1)\n}", "title": "" }, { "docid": "f9c7f80a5a6a02ceb50e658f0b45e1a0", "score": "0.4415178", "text": "func WrapUp() {\n}", "title": "" }, { "docid": "5dd34ee73a54f2b28784109e70b876ad", "score": "0.4408416", "text": "func (su stringUtil) FixedWidthLeftAligned(text string, width int) string {\n\tif width < len(text) {\n\t\treturn text[0:width]\n\t}\n\tfixedToken := fmt.Sprintf(\"%%-%ds\", width)\n\treturn fmt.Sprintf(fixedToken, text)\n}", "title": "" }, { "docid": "f0b2c3710a6349bd758c84d145643530", "score": "0.4405377", "text": "func (t *TextView) SetWrap(wrap bool) *TextView {\n\tif t.wrap != wrap {\n\t\tt.resetIndex() // This invalidates the entire index.\n\t}\n\tt.wrap = wrap\n\treturn t\n}", "title": "" }, { "docid": "23f0ee7ff931cbe0c561bf124fda765f", "score": "0.43796057", "text": "func Test_Wrap_(t *testing.T) {\n\t//\n\t// Wrap(i64 int64) Fixed64\n\t//\n\ttest := func(i64 int64, want Fixed64) {\n\t\tlabel := fmt.Sprintf(\"<-L%d: Wrap(%d) =\", testLine(), i64)\n\t\tgot := Wrap(i64)\n\t\ttestGot(label, got, want, func(erm string) { t.Error(erm) })\n\t}\n\ttest(-1, Fixed64{-1})\n\ttest(0, Fixed64{0})\n\ttest(1, Fixed64{1})\n\ttest(NaN, Fixed64{NaN})\n}", "title": "" }, { "docid": "6e4ca0a693ae5c7048875465b6433073", "score": "0.43722206", "text": "func Wrap(err error, v Vice, skip uint, text string) error {\n\tif err == nil {\n\t\treturn nil\n\t}\n\treturn wrapped(&wrapError{sealError{err: err, msg: text}}, v, skip)\n}", "title": "" }, { "docid": "d157794068fb519a2c8642ade77de5a8", "score": "0.437048", "text": "func runBlockCSITest(helper *clients.TestClient, k8sh *utils.K8sHelper, s *suite.Suite, namespace string) {\n\tpodName := \"block-test\"\n\tpoolName := \"replicapool\"\n\tstorageClassName := \"rook-ceph-block\"\n\tblockName := \"block-pv-claim\"\n\tpodNameWithPVRetained := \"block-test-retained\"\n\tpoolNameRetained := \"replicapoolretained\"\n\tstorageClassNameRetained := \"rook-ceph-block-retained\"\n\tblockNameRetained := \"block-pv-claim-retained\"\n\n\tclusterInfo := client.AdminTestClusterInfo(namespace)\n\tdefer blockTestDataCleanUp(helper, k8sh, s, clusterInfo, poolName, storageClassName, blockName, podName, true)\n\tdefer blockTestDataCleanUp(helper, k8sh, s, clusterInfo, poolNameRetained, storageClassNameRetained, blockNameRetained, podNameWithPVRetained, true)\n\tlogger.Infof(\"Block Storage End to End Integration Test - create, mount, write to, read from, and unmount\")\n\tlogger.Infof(\"Running on Rook Cluster %s\", namespace)\n\n\tlogger.Infof(\"Step 0 : Get Initial List Block\")\n\tinitBlockImages, _ := helper.BlockClient.ListAllImages(clusterInfo)\n\tassert.Equal(s.T(), 0, len(initBlockImages), \"there should not already be any images in the pool\")\n\n\tlogger.Infof(\"step 1: Create block storage\")\n\terr := helper.BlockClient.CreatePoolAndStorageClass(defaultNamespace, poolName, storageClassName, \"Delete\")\n\trequire.NoError(s.T(), err)\n\terr = helper.BlockClient.CreatePVC(defaultNamespace, blockName, storageClassName, \"ReadWriteOnce\", \"1M\")\n\trequire.NoError(s.T(), err)\n\n\trequire.NoError(s.T(), retryBlockImageCountCheck(helper, clusterInfo, 1), \"Make sure a new block is created\")\n\terr = helper.BlockClient.CreatePoolAndStorageClass(defaultNamespace, poolNameRetained, storageClassNameRetained, \"Retain\")\n\trequire.NoError(s.T(), err)\n\terr = helper.BlockClient.CreatePVC(defaultNamespace, blockNameRetained, storageClassNameRetained, \"ReadWriteOnce\", \"1M\")\n\trequire.NoError(s.T(), err)\n\trequire.NoError(s.T(), retryBlockImageCountCheck(helper, clusterInfo, 2), \"Make sure another new block is created\")\n\tlogger.Infof(\"Block Storage created successfully\")\n\trequire.True(s.T(), k8sh.WaitUntilPVCIsBound(defaultNamespace, blockName), \"Make sure PVC is Bound\")\n\trequire.True(s.T(), k8sh.WaitUntilPVCIsBound(defaultNamespace, blockNameRetained), \"Make sure PVC with reclaimPolicy:Retain is Bound\")\n\n\tlogger.Infof(\"step 2: Mount block storage\")\n\tcreatePodWithBlock(helper, k8sh, s, namespace, storageClassName, podName, blockName)\n\tcreatePodWithBlock(helper, k8sh, s, namespace, storageClassName, podNameWithPVRetained, blockNameRetained)\n\n\tlogger.Infof(\"step 3: Write to block storage\")\n\tmessage := \"Smoke Test Data for Block storage\"\n\tfilename := \"bsFile1\"\n\terr = k8sh.WriteToPod(\"\", podName, filename, message)\n\tassert.NoError(s.T(), err)\n\tlogger.Infof(\"Write to Block storage successfully\")\n\n\tlogger.Infof(\"step 4: Read from block storage\")\n\terr = k8sh.ReadFromPod(\"\", podName, filename, message)\n\tassert.NoError(s.T(), err)\n\tlogger.Infof(\"Read from Block storage successfully\")\n\n\tlogger.Infof(\"step 5: Restart the OSDs to confirm they are still healthy after restart\")\n\trestartOSDPods(k8sh, s, namespace)\n\n\tlogger.Infof(\"step 6: Read from block storage again\")\n\terr = k8sh.ReadFromPod(\"\", podName, filename, message)\n\tassert.NoError(s.T(), err)\n\tlogger.Infof(\"Read from Block storage successfully\")\n\n\tlogger.Infof(\"step 7: Mount same block storage on a different pod. Should not be allowed\")\n\totherPod := \"block-test2\"\n\terr = helper.BlockClient.CreateClientPod(getCSIBlockPodDefinition(otherPod, blockName, defaultNamespace, storageClassName, false))\n\tassert.NoError(s.T(), err)\n\n\t// ** FIX: WHY IS THE RWO VOLUME NOT BEING FENCED??? The second pod is starting successfully with the same PVC\n\t//require.True(s.T(), k8sh.IsPodInError(otherPod, defaultNamespace, \"FailedMount\", \"Volume is already attached by pod\"), \"make sure block-test2 pod errors out while mounting the volume\")\n\t//logger.Infof(\"Block Storage successfully fenced\")\n\n\tlogger.Infof(\"step 8: Delete fenced pod\")\n\terr = k8sh.DeletePod(k8sutil.DefaultNamespace, otherPod)\n\trequire.NoError(s.T(), err)\n\trequire.True(s.T(), k8sh.IsPodTerminated(otherPod, defaultNamespace), \"make sure block-test2 pod is terminated\")\n\tlogger.Infof(\"Fenced pod deleted successfully\")\n\n\tlogger.Infof(\"step 9: Unmount block storage\")\n\terr = k8sh.DeletePod(k8sutil.DefaultNamespace, podName)\n\trequire.NoError(s.T(), err)\n\terr = k8sh.DeletePod(k8sutil.DefaultNamespace, podNameWithPVRetained)\n\trequire.NoError(s.T(), err)\n\trequire.True(s.T(), k8sh.IsPodTerminated(podName, defaultNamespace), \"make sure block-test pod is terminated\")\n\trequire.True(s.T(), k8sh.IsPodTerminated(podNameWithPVRetained, defaultNamespace), \"make sure block-test-retained pod is terminated\")\n\tlogger.Infof(\"Block Storage unmounted successfully\")\n\n\tlogger.Infof(\"step 10: Deleting block storage\")\n\tdeletePVC(helper, k8sh, s, clusterInfo, blockName, \"Delete\")\n\tdeletePVC(helper, k8sh, s, clusterInfo, blockNameRetained, \"Retain\")\n\n\tlogger.Infof(\"step 11: Delete storage classes and pools\")\n\terr = helper.PoolClient.DeletePool(helper.BlockClient, clusterInfo, poolName)\n\tassert.NoError(s.T(), err)\n\terr = helper.PoolClient.DeletePool(helper.BlockClient, clusterInfo, poolNameRetained)\n\tassert.NoError(s.T(), err)\n\terr = helper.BlockClient.DeleteStorageClass(storageClassName)\n\tassert.NoError(s.T(), err)\n\terr = helper.BlockClient.DeleteStorageClass(storageClassNameRetained)\n\tassert.NoError(s.T(), err)\n}", "title": "" }, { "docid": "d036dd245e328e6ebf5fa9aae1af8c28", "score": "0.43700978", "text": "func PadBlock(buffer []byte, blocksize int) []byte {\n\tbufferLength := len(buffer)\n\tpaddedBlockCount := bufferLength/blocksize + 1\n\tspareByteCount := bufferLength % blocksize\n\tfillInByteCount := blocksize - spareByteCount\n\n\tpaddedBuffer := make([]byte, paddedBlockCount*blocksize)\n\n\tcopy(paddedBuffer, buffer)\n\n\tfor i := 0; i < fillInByteCount; i++ {\n\t\tpaddedBuffer[bufferLength+i] = byte(fillInByteCount)\n\t}\n\n\treturn paddedBuffer\n}", "title": "" }, { "docid": "6d5ad01e1c25feb6ebcaff226fee708f", "score": "0.43651056", "text": "func Wrap(s string) string {\n\treturn wordwrap.String(s, wrapAt)\n}", "title": "" }, { "docid": "bf25e24ac5343f04c643155e63551a4e", "score": "0.43556058", "text": "func TestEncryptBlock(t *testing.T) {\n\tc := MakeCryptoCommon(kbfscodec.NewMsgpack())\n\n\tcryptKey := makeFakeBlockCryptKey(t)\n\n\tblock := TestBlock{50}\n\texpectedEncodedBlock, err := c.codec.Encode(block)\n\trequire.NoError(t, err)\n\n\tplainSize, encryptedBlock, err := c.EncryptBlock(&block, cryptKey)\n\trequire.NoError(t, err)\n\trequire.Equal(t, len(expectedEncodedBlock), plainSize)\n\n\tpaddedBlock := checkSecretboxOpen(t, encryptedBlock.encryptedData, cryptKey.Data())\n\tencodedBlock, err := c.depadBlock(paddedBlock)\n\trequire.NoError(t, err)\n\trequire.Equal(t, expectedEncodedBlock, encodedBlock)\n}", "title": "" }, { "docid": "eb3848fca2c8dc508f5fbac3171aae80", "score": "0.43552056", "text": "func (h HelperContext) BlockWith(ctx *Context) (string, error) {\n\tnev := newEvalVisitor(h.evalVisitor.template, ctx)\n\tnev.blockParams = h.evalVisitor.blockParams\n\tdd := nev.VisitProgram(h.evalVisitor.curBlock.Program)\n\tswitch tp := dd.(type) {\n\tcase string:\n\t\treturn tp, nil\n\tcase error:\n\t\treturn \"\", errors.WithStack(tp)\n\tcase nil:\n\t\treturn \"\", nil\n\tdefault:\n\t\treturn \"\", errors.WithStack(errors.Errorf(\"unknown return value %T %+v\", dd, dd))\n\t}\n}", "title": "" }, { "docid": "8c1e4ea7a49cae820e7a770c489311c4", "score": "0.43493962", "text": "func addLogMessage(testingmode bool, blockLogBuilders []*strings.Builder, height int) func(string) {\n\tif testingmode {\n\t\tblockLogBuilders[height] = &strings.Builder{}\n\t\treturn func(x string) {\n\t\t\t(*blockLogBuilders[height]).WriteString(x)\n\t\t\t(*blockLogBuilders[height]).WriteString(\"\\n\")\n\t\t}\n\t}\n\treturn func(x string) {}\n}", "title": "" }, { "docid": "8b558425dd8deae1294b0d5e8b3c728f", "score": "0.43407157", "text": "func (g *Graph) newBlock() {\n\tindex := len(g.Blocks)\n\tg.ActiveBlock = NewBlock(index, g.Setup.StartContent, g.Setup.EndContent, g.Setup.LoopContent)\n\tg.Blocks = append(g.Blocks, g.ActiveBlock)\n}", "title": "" }, { "docid": "9c487d3191fe75e1aef3286a2a0a267f", "score": "0.4331532", "text": "func (h HelperContext) Block() (string, error) {\n\treturn h.BlockWith(h.Context)\n}", "title": "" }, { "docid": "8d58bdb3c6735348d0b3ada332fd38e8", "score": "0.4331278", "text": "func (v *Layout) GetWrap() WrapMode {\n\tc := C.pango_layout_get_wrap(v.native())\n\treturn WrapMode(c)\n}", "title": "" }, { "docid": "2a40cf089f2d20438081e8cbc4bf9bf7", "score": "0.43181756", "text": "func Wrap(text string, err error) error {\n\treturn fmt.Errorf(\"%s:(%w)\", text, err)\n}", "title": "" }, { "docid": "afeb2bea680dbf07ec350182a7054896", "score": "0.43172303", "text": "func (v *TextView) SetWrapMode(wrapMode WrapMode) {\n\tC.gtk_text_view_set_wrap_mode(v.native(), C.GtkWrapMode(wrapMode))\n}", "title": "" }, { "docid": "0fe5816fd9a54c7f0250a4eac24e032e", "score": "0.4316978", "text": "func WordWrap(src []byte, length int, prefix string, indent string) []byte {\n\tout := bytes.Buffer{}\n\t// TODO: do something about counting tab size\n\tprefixLen := len(prefix)\n\tindentLen := len(indent)\n\tout.WriteString(prefix)\n\tif length <= 1 {\n\t\tlength = 1 << 23\n\t}\n\tcol := prefixLen\n\twords := bytes.Fields(src)\n\tfor i, word := range words {\n\t\t// if word is so big, just add it an call it a day\n\t\tif len(word) >= length-indentLen {\n\t\t\tif i != 0 {\n\t\t\t\tout.WriteByte(' ')\n\t\t\t\tcol++\n\t\t\t}\n\t\t\tout.Write(word)\n\t\t\tcol += len(word)\n\t\t\tcontinue\n\t\t}\n\t\tif len(word)+col+1 < length {\n\t\t\tif i != 0 {\n\t\t\t\tout.WriteByte(' ')\n\t\t\t\tcol++\n\t\t\t}\n\t\t\tout.Write(word)\n\t\t\tcol += len(word)\n\t\t\tcontinue\n\t\t}\n\t\t// word overflows\n\t\tout.WriteByte('\\n')\n\t\tout.WriteString(indent)\n\t\tout.Write(word)\n\t\tcol = indentLen + len(word)\n\t}\n\treturn out.Bytes()\n}", "title": "" }, { "docid": "edb9b601a89afeff5cdc61a7b7394e35", "score": "0.43145576", "text": "func (w *rfc3394KeyWrap) Wrap(keydata []byte) (ciphertext []byte, err error) {\n\n\tif len(keydata)%8 != 0 {\n\t\treturn nil, errors.New(\"Keydata must be a multiply of 64 bits\")\n\t}\n\n\tw.initializeForWrap(keydata)\n\n\tif err = w.calculateIntermediateValuesForWrap(); err == nil {\n\t\tciphertext = w.outputWrap()\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "89c33ceaf3963c26a9ac7fa21aeeac6c", "score": "0.4300456", "text": "func (s *BaseSprite) BlockRender(bg *Surface) {\n\tif s.Visible {\n\t\tif len(s.BlockCostumes) > s.CurrentCostume {\n\t\t\tsurf := s.BlockCostumes[s.CurrentCostume]\n\t\t\tbg.Blit(*surf, s.X, s.Y)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e2be032a1c8315fda8696eef55e21763", "score": "0.42955506", "text": "func (p *depPrinter) wrap(s string, color int) string {\n\tif !p.colorize {\n\t\treturn s\n\t}\n\treturn fmt.Sprintf(\"%s[%dm%s%s[0m\", escape, color, s, escape)\n}", "title": "" }, { "docid": "6a677630755368994e0fee16093850bf", "score": "0.4287015", "text": "func (l *lifter) translateBlock(block *BasicBlock) (*ir.BasicBlock, error) {\n\tblockName := fmt.Sprintf(\"block_%08X\", uint32(block.Entry()))\n\tllBlock := ir.NewBlock(blockName)\n\tfor _, inst := range block.insts {\n\t\tllInst, err := l.translateInst(inst)\n\t\tif err != nil {\n\t\t\treturn nil, errors.WithStack(err)\n\t\t}\n\t\t// TODO: handle terminators.\n\t\tllBlock.Insts = append(llBlock.Insts, llInst)\n\t}\n\treturn llBlock, nil\n}", "title": "" }, { "docid": "dd05af2df950479e09e3f2def0689cbc", "score": "0.42821202", "text": "func TestBlockPadding(t *testing.T) {\n\tvar c CryptoCommon\n\tf := func(b []byte) bool {\n\t\tpadded, err := c.padBlock(b)\n\t\tif err != nil {\n\t\t\tt.Logf(\"padBlock err: %s\", err)\n\t\t\treturn false\n\t\t}\n\t\tn := len(padded)\n\t\tif n <= len(b) {\n\t\t\tt.Logf(\"padBlock padded block len %d <= input block len %d\", n, len(b))\n\t\t\treturn false\n\t\t}\n\t\t// len of slice without uint32 prefix:\n\t\th := n - 4\n\t\tif h&(h-1) != 0 {\n\t\t\tt.Logf(\"padBlock padded block len %d not a power of 2\", h)\n\t\t\treturn false\n\t\t}\n\t\treturn true\n\t}\n\n\terr := quick.Check(f, nil)\n\trequire.NoError(t, err)\n}", "title": "" }, { "docid": "21d97d60a52570a7fd627c60ad6020cb", "score": "0.42808852", "text": "func (sp *SimpleParser) block() Interpreter {\n\tlines := make([]Interpreter, 0, 20)\n\tfor sp.currToken.Type != \"EOF\" {\n\t\tn := len(lines)\n\t\tif len(lines) == cap(lines) {\n\t\t\ttemp := make([]Interpreter, n, n+20)\n\t\t\tcopy(temp, lines)\n\t\t\tlines = temp\n\t\t}\n\t\tlines = lines[:n+1]\n\t\tif sp.currToken.Value == \"if\" {\n\t\t\tlines[n] = sp.ifblock()\n\t\t} else {\n\t\t\tlines[n] = sp.line()\n\t\t}\n\t}\n\treturn &BlockNode{lines}\n}", "title": "" }, { "docid": "ffdea8884c4e38d50d840d62ea5cdd27", "score": "0.4266742", "text": "func (w *WrapWriter) Width() int { return int(w.width) }", "title": "" }, { "docid": "a32b7862b8cf5441f9506f54b9e12f23", "score": "0.42619213", "text": "func SetupSymmetricCipherBlock(key []byte) cipher.Block {\n\tblock, err := aes.NewCipher(key)\n\tif err != nil {\n\t\tlog.Fatalf(\"Provided key is corrupted.\")\n\t}\n\treturn block\n}", "title": "" }, { "docid": "666787e1209668a2aa0a2bf83bb676a6", "score": "0.4258559", "text": "func centerAlignText(line string, width int) string {\n\tif len(line) >= width {\n\t\treturn line\n\t}\n\tpadLength := (width - len(line)) / 2\n\treturn strings.Repeat(\" \", padLength) + line\n}", "title": "" } ]
00410598bacaf9316b2c6b889aa96480
GoString 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": "ba91afaaa90f631889e71266e19c3663", "score": "0.0", "text": "func (s VideoMetadata) GoString() string {\n\treturn s.String()\n}", "title": "" } ]
[ { "docid": "c5e8d267363625188a2b0af1c416955a", "score": "0.6003519", "text": "func String(v interface{}) (string, error) {\n\tfields, err := extractFields(nil, v)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tvar s strings.Builder\n\tfor i, fld := range fields {\n\t\tif fld.Options.Noprint {\n\t\t\tcontinue\n\t\t}\n\n\t\ts.WriteString(flagUsage(fld))\n\t\ts.WriteString(\"=\")\n\t\tv := fmt.Sprintf(\"%v\", fld.Field.Interface())\n\n\t\tswitch {\n\t\tcase fld.Options.Mask:\n\t\t\ts.WriteString(maskVal(v))\n\n\t\tdefault:\n\t\t\ts.WriteString(v)\n\t\t}\n\n\t\tif i < len(fields)-1 {\n\t\t\ts.WriteString(\"\\n\")\n\t\t}\n\t}\n\n\treturn s.String(), nil\n}", "title": "" }, { "docid": "d4f4feb57ed4078a049e446401200967", "score": "0.5986417", "text": "func (p parameter) String() string {\n\treturn p.Key().String()\n}", "title": "" }, { "docid": "b4630d33b70c5844b5e64ade660963a3", "score": "0.59674877", "text": "func (s Member) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b4630d33b70c5844b5e64ade660963a3", "score": "0.59674877", "text": "func (s Member) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "e25c579deb5766c76d2a372d64e7bb7f", "score": "0.5920716", "text": "func (s RequestBypassInterfaceStruct) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "0c7ad72c2f5abf275d2a0886e28199a3", "score": "0.5882879", "text": "func (p *Param) String() string {\n\treturn p.Name\n}", "title": "" }, { "docid": "22b2a07f7f4afb1c31bdad8f9ce29a79", "score": "0.58784", "text": "func (p *Parameter) String() string {\n\t// Hack to get the reader to not throw errors in creating string representative of parameters\n\tcode := jen.Func().Id(\"_\").Params(p.Code()).Block()\n\ts := code.GoString()\n\ts = strings.TrimPrefix(s, \"func _(\")\n\ts = strings.TrimSuffix(s, \") {}\")\n\t// -----\n\treturn s\n}", "title": "" }, { "docid": "7422e92ddcee98e4ae227fd7e12e513f", "score": "0.5856808", "text": "func (s GroupMember) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "7422e92ddcee98e4ae227fd7e12e513f", "score": "0.5856808", "text": "func (s GroupMember) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "34d2bb568fd179affe29ec214e0665db", "score": "0.5834938", "text": "func String() string {\n\treturn fmt.Sprintf(\"%s v%v %s\", Name, Version, Additional)\n}", "title": "" }, { "docid": "54e9d695b9de96e285f059bf2671eb55", "score": "0.5797035", "text": "func (p Params) String() string {\n\treturn string(ModuleCdc.MustMarshalBinaryLengthPrefixed(&p))\n}", "title": "" }, { "docid": "f4f4ede478f981b3cfcc4b05c0adc5fa", "score": "0.57968473", "text": "func (s CacheNodeTypeSpecificParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "38456e3a48979bbab5f5103284b26c4e", "score": "0.57492065", "text": "func (s BypassInterface) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "acab7979051bcca438ed4fdff33cdcab", "score": "0.5749183", "text": "func (v *SecondService_EchoStructMap_Args) String() string {\n\tif v == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\tvar fields [1]string\n\ti := 0\n\tfields[i] = fmt.Sprintf(\"Arg: %v\", v.Arg)\n\ti++\n\n\treturn fmt.Sprintf(\"SecondService_EchoStructMap_Args{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" }, { "docid": "a8ddb8c6b19270de166546042c64e695", "score": "0.57476366", "text": "func (m Member) String() string {\n\treturn m.Name + \" \" + m.Type.String()\n}", "title": "" }, { "docid": "2525b6952dd7669572f80cd91f491d95", "score": "0.5742345", "text": "func StringForStruct(typeName string, attributes ...string) string {\n\tvar builder StringBuilder\n\n\tbuilder.Write(typeName, \"{\")\n\tfor i, attr := range attributes {\n\t\tif i > 0 {\n\t\t\tif i&1 == 0 {\n\t\t\t\tbuilder.Write(\", \")\n\t\t\t} else {\n\t\t\t\tbuilder.Write(\": \")\n\t\t\t}\n\t\t}\n\t\tbuilder.Write(attr)\n\t}\n\tbuilder.Byte('}')\n\n\treturn builder.String()\n}", "title": "" }, { "docid": "67a78d4f9e24d3d61a3aefcfdf2f360f", "score": "0.5732269", "text": "func (p API) String() string {\n\treturn fmt.Sprintf(\n\t\t\"api key: '%s', api url: '%s', hostname: '%s', plugin: '%s', timeout: %s,\"+\n\t\t\t\" disable ssl verify: %t, proxy url: '%s', ssl cert filepath: '%s'\",\n\t\tp.Key[:4]+\"...\",\n\t\tp.URL,\n\t\tp.Hostname,\n\t\tp.Plugin,\n\t\tp.Timeout,\n\t\tp.DisableSSLVerify,\n\t\tp.ProxyURL,\n\t\tp.SSLCertFilepath,\n\t)\n}", "title": "" }, { "docid": "2ce29d2c405fefa5672180d3d62b7ac2", "score": "0.5701186", "text": "func (s RequestTranslationStruct) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "7fdd9d07690703691d426379ec8d9a7a", "score": "0.5695592", "text": "func (s MemberFrameworkAttributes) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "87ab51636a597ba6e1e567cad7e82f0d", "score": "0.5693126", "text": "func (s RequestVpnGatewayStruct) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "a42fc74d7802ce4635ebf87cda782f1f", "score": "0.56867045", "text": "func String(k, v string) Field {\n\treturn zap.String(k, v)\n}", "title": "" }, { "docid": "e8521db3a320a6453fa167795cf50cdb", "score": "0.56804544", "text": "func (s TeamMember) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "fc3f1155f252d88806b0bd68f6d5defe", "score": "0.5673786", "text": "func (p *Param) String() string {\n\tswitch value := p.Value.(type) {\n\tcase string:\n\t\treturn value\n\tcase []string:\n\t\treturn strings.Join(value, \"\")\n\tcase nil, interface{}, []interface{}: // TODO: Figure out parsing to string\n\t\treturn \"\"\n\tdefault:\n\t\treturn fmt.Sprintf(\"%v\", value)\n\t}\n}", "title": "" }, { "docid": "85ce395912b475acdf3ad6330161a646", "score": "0.5671175", "text": "func (s ParameterNameValue) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "eb455905db6cfae92d7813a73f42f7e8", "score": "0.56670535", "text": "func StructToString(si interface{}) string {\n\trval := reflect.ValueOf(si).Elem()\n\ttipe := rval.Type()\n\n\tfmt.Println(rval,tipe,rval.NumField())\n\n\tvar buffer bytes.Buffer\n\tbuffer.WriteString(\"{ \")\n\tfor i := 0; i < rval.NumField(); i++ {\n\t\ttf := tipe.Field(i)\n\t\tif !rval.FieldByName(tf.Name).CanSet() {\n\t\t\tcontinue // skip unexported fields\n\t\t}\n\t\tvar fStr string\n\t\ttagv := tf.Tag.Get(SecretTag)\n\t\tif tagv == \"password\" || tagv == \"username\" {\n\t\t\tfStr = fmt.Sprintf(\"%s:**** \", tf.Name)\n\t\t} else if tagv == \"url\" {\n\t\t\tval, ok := rval.Field(i).Interface().(string)\n\t\t\tif ok {\n\t\t\t\tval = GetMaskedURL(val)\n\t\t\t\tfStr = fmt.Sprintf(\"%s:%v \", tf.Name, val)\n\t\t\t} else {\n\t\t\t\tfStr = fmt.Sprintf(\"%s:%v \", tf.Name, rval.Field(i).Interface())\n\t\t\t}\n\t\t} else {\n\t\t\tfStr = fmt.Sprintf(\"%s:%v \", tf.Name, rval.Field(i).Interface())\n\t\t}\n\t\tbuffer.WriteString(fStr)\n\t}\n\tbuffer.WriteString(\" }\")\n\treturn buffer.String()\n}", "title": "" }, { "docid": "0e140aec87299966617e844b407c8dbd", "score": "0.5661115", "text": "func (s *StructField) String() string {\n\tcode := s.Code()\n\t// Hack to get the reader to not panic in struct fields\n\tfakeStruct := jen.Type().Id(\"_\").Struct(code)\n\tstr := fakeStruct.GoString()\n\tstr = strings.TrimPrefix(str, \"type _ struct {\\n\\t\")\n\tstr = strings.TrimSuffix(str, \"\\n}\")\n\t// -----\n\treturn prepareLines(str)\n}", "title": "" }, { "docid": "4e908c28d5ec6e9e11362b54c63d02e0", "score": "0.56591266", "text": "func String(x interface{}) string {\n\t// TODO string\n\tb, e := json.Marshal(x)\n\tif e == nil {\n\t\treturn string(b)\n\t} else {\n\t\treturn f(\"%+v\", x)\n\t}\n}", "title": "" }, { "docid": "67c6b2c17784f217e7874d36b9dd433c", "score": "0.5630355", "text": "func (a AdminPriv) String() string {\n\tja, _ := json.Marshal(a)\n\treturn string(ja)\n}", "title": "" }, { "docid": "7d25457a006edc37216b672b52731c92", "score": "0.56255376", "text": "func (s NiftyModifyWebProxyAttributeInput) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "947af2e687894d6d29a03e631290b565", "score": "0.5619238", "text": "func (s CognitoMemberDefinition) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "947af2e687894d6d29a03e631290b565", "score": "0.5619238", "text": "func (s CognitoMemberDefinition) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "cb441578d57de763e1c50f65a4543aa0", "score": "0.5615366", "text": "func (v *TestService_Call_Args) String() string {\n\tif v == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\tvar fields [1]string\n\ti := 0\n\tfields[i] = fmt.Sprintf(\"Key: %v\", v.Key)\n\ti++\n\n\treturn fmt.Sprintf(\"TestService_Call_Args{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" }, { "docid": "9d53a81fca8a505cf3bcd3cd59ee19e5", "score": "0.56078935", "text": "func (s RequestOptionStruct) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "e39ae9035e5f4005912871aa486b5a51", "score": "0.55973077", "text": "func (w Waypoint) String() string {\n\tjw, _ := json.Marshal(w)\n\treturn string(jw)\n}", "title": "" }, { "docid": "aac925659d9c89e6d5d4ea1feca8e02d", "score": "0.55868053", "text": "func (s RequestAdditionalAttributesStruct) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "3c09f01faf7212d1e36ab983e7879f3e", "score": "0.55858296", "text": "func String(cmp *mcmp.Component, name string, opts ...ParamOption) *string {\n\tvar s string\n\tAddParam(cmp, Param{Name: name, IsString: true, Into: &s}, opts...)\n\treturn &s\n}", "title": "" }, { "docid": "8421ac307988f24d28ed1a0cb4cc5c59", "score": "0.55760413", "text": "func (s structure) String() string {\n\treturn fmt.Sprintf(\"{%s %d}\", s.Key, s.Int)\n}", "title": "" }, { "docid": "fa3439ba8da6a08bf8c1fe78ff45e9d8", "score": "0.5574062", "text": "func (s NodeGroupMember) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "06f41396cfdb3a84a0a6e9c62ecba48b", "score": "0.55648345", "text": "func (ca checkArg) String() string {\n\treturn fmt.Sprintf(\"{uid: %s, username: %s, kid: %s, sibkeys: %v, subkeys: %v}\",\n\t\tca.uid, ca.username, ca.kid, ca.sibkeys, ca.subkeys)\n}", "title": "" }, { "docid": "0401611b39a66e199e441825ff238575", "score": "0.55630034", "text": "func String(params ...interface{}) string {\n\treturn spew.Sprintf(\"%v\", params)\n}", "title": "" }, { "docid": "561b9b907b133c3923f5de71f6700336", "score": "0.55602914", "text": "func (v *SecondService_EchoStructSet_Args) String() string {\n\tif v == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\tvar fields [1]string\n\ti := 0\n\tfields[i] = fmt.Sprintf(\"Arg: %v\", v.Arg)\n\ti++\n\n\treturn fmt.Sprintf(\"SecondService_EchoStructSet_Args{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" }, { "docid": "529a571c912e15b44aa8108b1dae511c", "score": "0.5556715", "text": "func (w Waypoints) String() string {\n\tjw, _ := json.Marshal(w)\n\treturn string(jw)\n}", "title": "" }, { "docid": "6ad638632b65fcafbd649a28b0d792ad", "score": "0.5555018", "text": "func accessString(param spec.Parameter, op *spec.Operation) string {\n\t_, makePointer, err := ParamToType(param)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"unexpected error building parameter: %s\", err))\n\t}\n\tpointer := \"\"\n\tif makePointer {\n\t\tpointer = \"*\"\n\t}\n\n\tsingle, _ := SingleStringPathParameter(op)\n\tif single {\n\t\treturn fmt.Sprintf(\"%s%s\", pointer, param.Name)\n\t}\n\treturn fmt.Sprintf(\"%si.%s\", pointer, utils.CamelCase(param.Name, true))\n}", "title": "" }, { "docid": "25324a870c0919e99ee63b5ec24a200c", "score": "0.55517983", "text": "func (s MemberGroup) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "757f8c625b42d3482ed24fcf69ec5e32", "score": "0.55481863", "text": "func (s NiftyModifyWebProxyAttributeOutput) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "ae636ca84c47b7e852912e63ff8f5589", "score": "0.5540424", "text": "func (a AdminPrivs) String() string {\n\tja, _ := json.Marshal(a)\n\treturn string(ja)\n}", "title": "" }, { "docid": "f5f07891825e96c1ce8df4d3823ccadb", "score": "0.55400115", "text": "func (vp VotingParams) String() string {\n\tout, _ := yaml.Marshal(vp)\n\treturn string(out)\n}", "title": "" }, { "docid": "890967c1fcdfd02677a9d92afb8302f5", "score": "0.5539566", "text": "func (v *FooStruct) String() string {\n\tif v == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\tvar fields [7]string\n\ti := 0\n\tfields[i] = fmt.Sprintf(\"FooString: %v\", v.FooString)\n\ti++\n\tif v.FooI32 != nil {\n\t\tfields[i] = fmt.Sprintf(\"FooI32: %v\", *(v.FooI32))\n\t\ti++\n\t}\n\tif v.FooI16 != nil {\n\t\tfields[i] = fmt.Sprintf(\"FooI16: %v\", *(v.FooI16))\n\t\ti++\n\t}\n\tif v.FooDouble != nil {\n\t\tfields[i] = fmt.Sprintf(\"FooDouble: %v\", *(v.FooDouble))\n\t\ti++\n\t}\n\tif v.FooBool != nil {\n\t\tfields[i] = fmt.Sprintf(\"FooBool: %v\", *(v.FooBool))\n\t\ti++\n\t}\n\tif v.FooMap != nil {\n\t\tfields[i] = fmt.Sprintf(\"FooMap: %v\", v.FooMap)\n\t\ti++\n\t}\n\tif v.Message != nil {\n\t\tfields[i] = fmt.Sprintf(\"Message: %v\", v.Message)\n\t\ti++\n\t}\n\n\treturn fmt.Sprintf(\"FooStruct{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" }, { "docid": "d9508c7da3435545c727f34b49abd5ce", "score": "0.5532387", "text": "func (s RequestFilterStruct) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "daae94d4318c9d0961b297f98ea10f59", "score": "0.55304515", "text": "func (v *SimpleService_Call_Args) 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(\"Arg: %v\", v.Arg)\n\ti++\n\tif v.I64Optional != nil {\n\t\tfields[i] = fmt.Sprintf(\"I64Optional: %v\", *(v.I64Optional))\n\t\ti++\n\t}\n\tif v.TestUUID != nil {\n\t\tfields[i] = fmt.Sprintf(\"TestUUID: %v\", *(v.TestUUID))\n\t\ti++\n\t}\n\n\treturn fmt.Sprintf(\"SimpleService_Call_Args{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" }, { "docid": "daae94d4318c9d0961b297f98ea10f59", "score": "0.55304515", "text": "func (v *SimpleService_Call_Args) 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(\"Arg: %v\", v.Arg)\n\ti++\n\tif v.I64Optional != nil {\n\t\tfields[i] = fmt.Sprintf(\"I64Optional: %v\", *(v.I64Optional))\n\t\ti++\n\t}\n\tif v.TestUUID != nil {\n\t\tfields[i] = fmt.Sprintf(\"TestUUID: %v\", *(v.TestUUID))\n\t\ti++\n\t}\n\n\treturn fmt.Sprintf(\"SimpleService_Call_Args{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" }, { "docid": "daae94d4318c9d0961b297f98ea10f59", "score": "0.55304515", "text": "func (v *SimpleService_Call_Args) 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(\"Arg: %v\", v.Arg)\n\ti++\n\tif v.I64Optional != nil {\n\t\tfields[i] = fmt.Sprintf(\"I64Optional: %v\", *(v.I64Optional))\n\t\ti++\n\t}\n\tif v.TestUUID != nil {\n\t\tfields[i] = fmt.Sprintf(\"TestUUID: %v\", *(v.TestUUID))\n\t\ti++\n\t}\n\n\treturn fmt.Sprintf(\"SimpleService_Call_Args{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" }, { "docid": "684d02ea5411f43ccbfebe7ad31efe7e", "score": "0.55280143", "text": "func String(v string) *structpb.Value {\n\treturn &structpb.Value{\n\t\tKind: &structpb.Value_StringValue{\n\t\t\tStringValue: v,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "3ffc25a4edc5ca7652c4750de89130eb", "score": "0.5521966", "text": "func (s Parameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3ffc25a4edc5ca7652c4750de89130eb", "score": "0.5521966", "text": "func (s Parameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3ffc25a4edc5ca7652c4750de89130eb", "score": "0.5521966", "text": "func (s Parameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3ffc25a4edc5ca7652c4750de89130eb", "score": "0.5521966", "text": "func (s Parameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d4a5f9801967f366a83c3a7cd907c242", "score": "0.54950535", "text": "func (s NiftyModifyVpnGatewayAttributeInput) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "fea6b1db8f7c88035ae711e8ab461794", "score": "0.549008", "text": "func (s OriginGroupMember) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "ae9e90e6f257976eed312960f9400457", "score": "0.548646", "text": "func (g ParameterType) String() string {\n\treturn g.Name()\n}", "title": "" }, { "docid": "82c3d0a792d19150397fd96e3012e401", "score": "0.54862905", "text": "func (value ZValue) String() (string) {\n\treturn value.ReflectValue().String()\n}", "title": "" }, { "docid": "faab7da9e253b8fa9489d7f186c64b6d", "score": "0.54714394", "text": "func (s GroupMembers) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "16ebf20c7c6abbd05126652738d11eb1", "score": "0.5469883", "text": "func (s RequestSourceStruct) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "630ac36c865044e5a6d1fee3ae016f9c", "score": "0.5467234", "text": "func (s *myFlag) String() string {\n\t// FIXME deal with non string types.\n\treturn s.fieldValue.String()\n}", "title": "" }, { "docid": "a4b1019d8be3075e68b5e0f5b023fe6e", "score": "0.5462476", "text": "func (a *API) String() string {\n\tb, err := json.MarshalIndent(a, \"\", \" \")\n\tif err != nil {\n\t\tpanic(err) // should not happen because of our closed model\n\t}\n\treturn string(b)\n}", "title": "" }, { "docid": "70654039945d2320f4eee3aa3a793d94", "score": "0.54617304", "text": "func (s KeyValuePair) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "f686bbb8a007fff028458e46efc6c7b8", "score": "0.545575", "text": "func (e MAV_PARAM_TYPE) String() string {\n\tbyts, err := e.MarshalText()\n\tif err == nil {\n\t\treturn string(byts)\n\t}\n\treturn strconv.FormatInt(int64(e), 10)\n}", "title": "" }, { "docid": "ab66a767551ab4d7b7f8e4f3293ea242", "score": "0.5452119", "text": "func (s NiftyModifyVpnGatewayAttributeOutput) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "b6f479214244e07cb7eb28cffe30059c", "score": "0.5451896", "text": "func (o LunSetAttributeRequest) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "d777c46b6e854c7c38e5e0de726c20e9", "score": "0.545031", "text": "func (s RequestOutboundInterfaceStruct) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "0dea6f5bd697f18ced020135f873618e", "score": "0.54497766", "text": "func (p Params) String() string {\n\treturn fmt.Sprintf(`Params:\n Unbonding Time : %s\n Max Validators : %d\n Max Validators Extending : %d\n Max Validators Extending Speed : %d\n Next Extending Time : %d\n Max Entries : %d\n Bonded Coin Denom : %s\n Max Lever : %s`,\n p.UnbondingTime,\n p.MaxValidators,\n p.MaxValidatorsExtending,\n p.MaxValidatorsExtendingSpeed,\n p.NextExtendingTime,\n p.MaxEntries,\n p.BondDenom,\n p.MaxLever)\n}", "title": "" }, { "docid": "4abcfcd520d2e00b0d733c5fbcfd9010", "score": "0.54492", "text": "func (obj *ServerInfoImpl) String() string {\n\tvar buffer bytes.Buffer\n\tbuffer.WriteString(\"ServerInfoImpl:{\")\n\tbuffer.WriteString(fmt.Sprintf(\"CacheInfo: '%+v'\", obj.cacheInfo))\n\tbuffer.WriteString(fmt.Sprintf(\", DatabaseInfo: '%+v'\", obj.databaseInfo))\n\tbuffer.WriteString(fmt.Sprintf(\", MemoryInfo: '%+v'\", obj.memoryInfo))\n\tbuffer.WriteString(fmt.Sprintf(\", NetListenersInfo: '%+v'\", obj.netListenersInfo))\n\tbuffer.WriteString(fmt.Sprintf(\", ServerStatusInfo: '%+v'\", obj.serverStatusInfo))\n\tbuffer.WriteString(fmt.Sprintf(\", TransactionsInfo: '%+v'\", obj.transactionsInfo))\n\tbuffer.WriteString(\"}\")\n\treturn buffer.String()\n}", "title": "" }, { "docid": "3604a1d12813ce519872a998508d98c7", "score": "0.5448932", "text": "func (s GetMembersOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3604a1d12813ce519872a998508d98c7", "score": "0.5448932", "text": "func (s GetMembersOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "0385bd60ab79aacf4851dab1d485440e", "score": "0.54489183", "text": "func (id MemberId) String() string {\n\tcomponents := []string{\n\t\tfmt.Sprintf(\"Subscription: %q\", id.SubscriptionId),\n\t\tfmt.Sprintf(\"Resource Group Name: %q\", id.ResourceGroupName),\n\t\tfmt.Sprintf(\"Fleet Name: %q\", id.FleetName),\n\t\tfmt.Sprintf(\"Member Name: %q\", id.MemberName),\n\t}\n\treturn fmt.Sprintf(\"Member (%s)\", strings.Join(components, \"\\n\"))\n}", "title": "" }, { "docid": "ae06eed0022323b8058a8a620b0ad401", "score": "0.5441416", "text": "func (u Update) String() string {\n\treturn structToString(u)\n}", "title": "" }, { "docid": "13a7627d253470f80df7e3b18c59a35c", "score": "0.5436313", "text": "func (p Plan) String() string {\n\tjp, _ := json.Marshal(p)\n\treturn string(jp)\n}", "title": "" }, { "docid": "e3f7f7812feb12cacdda205e9b7725d4", "score": "0.5428663", "text": "func (o VserverGetIterRequestDesiredAttributes) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "c04d762f357c8b7f57d535bd08c07a19", "score": "0.54139084", "text": "func (b *BoundParam) String() string {\n\treturn fmt.Sprintf(\"$.%s\", b.Path)\n}", "title": "" }, { "docid": "c0e9bd551f9b16d95c27055e063cc7c2", "score": "0.5404076", "text": "func (s RequestGroupsStruct) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "70140ac87aff30abd20b69092ccac057", "score": "0.5400872", "text": "func (o Params) String() (l string) {\n\tfor i, prm := range o {\n\t\tif i > 0 {\n\t\t\tl += \",\\n\"\n\t\t}\n\t\tl += io.Sf(\"{\")\n\t\tl += io.Sf(`\"n\":%q, `, prm.N)\n\t\tl += io.Sf(`\"v\":%v, `, prm.V)\n\t\tl += io.Sf(`\"min\":%v, `, prm.Min)\n\t\tl += io.Sf(`\"max\":%v, `, prm.Max)\n\t\tl += io.Sf(`\"s\":%v, `, prm.S)\n\t\tl += io.Sf(`\"d\":%q, `, prm.D)\n\t\tl += io.Sf(`\"u\":%q, `, prm.U)\n\t\tl += io.Sf(`\"adj\":%v, `, prm.Adj)\n\t\tl += io.Sf(`\"dep\":%v, `, prm.Dep)\n\t\tl += io.Sf(`\"extra\":%q, `, prm.Extra)\n\t\tl += io.Sf(`\"inact\":%v, `, prm.Inact)\n\t\tl += io.Sf(`\"setdef\":%v`, prm.SetDef)\n\t\tl += io.Sf(\"}\")\n\t}\n\treturn\n}", "title": "" }, { "docid": "c5975aa68ab73d934cc70d8a40075c15", "score": "0.53930557", "text": "func (ig *IgnoreStruct) String() string {\n\treturn ig.json\n}", "title": "" }, { "docid": "252b578b02445495faf7c8a1d0cc0396", "score": "0.53927225", "text": "func (s HITLayoutParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "7810f5262bc9faa785879a38fa9b775d", "score": "0.53914297", "text": "func (s MemberDefinition) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "7810f5262bc9faa785879a38fa9b775d", "score": "0.53914297", "text": "func (s MemberDefinition) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "103f00800eac7485622a6111384cd89f", "score": "0.53888965", "text": "func (v *V) String() string {\n\tswitch v.valueType {\n\tdefault:\n\t\treturn \"\"\n\tcase jsonparser.Null:\n\t\treturn \"null\"\n\tcase jsonparser.Number:\n\t\treturn string(v.valueBytes)\n\tcase jsonparser.String:\n\t\tif false == v.status.parsed {\n\t\t\tvar e error\n\t\t\tv.value.str, v.valueBytes, e = parseString(v.valueBytes)\n\t\t\tif nil == e {\n\t\t\t\tv.status.parsed = true\n\t\t\t}\n\t\t}\n\t\treturn v.value.str\n\tcase jsonparser.Boolean:\n\t\treturn formatBool(v.value.boolean)\n\tcase jsonparser.Object:\n\t\treturn v.packObjChildren()\n\tcase jsonparser.Array:\n\t\treturn v.packArrChildren()\n\t}\n}", "title": "" }, { "docid": "5f047f1fc1cabe8d55d0bd53bd27a7b2", "score": "0.53833824", "text": "func (wrapper vmoduleConfigurationPFlag) String() string {\n\tif wrapper.value == nil {\n\t\treturn \"\"\n\t}\n\tvar patterns []string\n\tfor _, item := range *wrapper.value {\n\t\tpatterns = append(patterns, fmt.Sprintf(\"%s=%d\", item.FilePattern, item.Verbosity))\n\t}\n\treturn strings.Join(patterns, \",\")\n}", "title": "" }, { "docid": "6321e4b6a8ec079e073e44de9d33877a", "score": "0.5375933", "text": "func (p ParamType) String() string {\n\tswitch p {\n\tcase Unchecked:\n\t\treturn \"param\"\n\tcase UncheckedOneOrMore:\n\t\treturn \"param...\"\n\tcase S3Obj:\n\t\treturn \"s3://bucket[/object]\"\n\tcase S3SimpleObj:\n\t\treturn \"s3://bucket/object\"\n\tcase S3Dir:\n\t\treturn \"s3://bucket[/object]/\"\n\tcase S3ObjOrDir:\n\t\treturn \"s3://bucket[/object][/]\"\n\tcase S3WildObj:\n\t\treturn \"s3://bucket/wild/*/obj*\"\n\tcase FileObj:\n\t\treturn \"filename\"\n\tcase Dir:\n\t\treturn \"directory\"\n\tcase FileOrDir:\n\t\treturn \"file-or-directory\"\n\tcase OptionalDir:\n\t\treturn \"[directory]\"\n\tcase OptionalFileOrDir:\n\t\treturn \"[file-or-directory]\"\n\tcase Glob:\n\t\treturn \"glob-pattern*\"\n\tdefault:\n\t\treturn \"unknown\"\n\t}\n}", "title": "" }, { "docid": "a8e2b09a16c77f32418306f68fb15c6c", "score": "0.5375553", "text": "func (args *CallArgs) String() string {\n\t// Todo: There is currently a bug with hexutil.Big when the value its nil, printing would trigger an exception\n\treturn fmt.Sprintf(\"CallArgs{From:%v, To:%v, Gas:%v,\"+\n\t\t\" Data:%v, AccessList:%v}\",\n\t\targs.From,\n\t\targs.To,\n\t\targs.Gas,\n\t\targs.Data,\n\t\targs.AccessList)\n}", "title": "" }, { "docid": "6d3360f4e72b7fae79ac9c76212a4195", "score": "0.5372159", "text": "func (p Params) String() string {\n\treturn js.Value(p).Call(\"toString\").String()\n}", "title": "" }, { "docid": "b9d97878d151e4ecce328096f2855449", "score": "0.5371881", "text": "func (s TemplateParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "30554a699d8073fcb4e0ebb8da3ae6a3", "score": "0.5371425", "text": "func (v *structV) String() string {\n\tres := \"{\";\n\tfor i, v := range *v {\n\t\tif i > 0 {\n\t\t\tres += \", \"\n\t\t}\n\t\tres += v.String();\n\t}\n\treturn res + \"}\";\n}", "title": "" }, { "docid": "e02abd781c4a9da866c52985627a778b", "score": "0.537078", "text": "func (p *Params) String() string {\n\treturn fmt.Sprintf(\"[%v, %v]\", p.password, p.expirationDuration)\n}", "title": "" }, { "docid": "dbade7ee1753eb1fdd72af772e529075", "score": "0.536763", "text": "func (s ParameterMapEntry) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b97895ab172f3c3bfc19eea555032fed", "score": "0.53671443", "text": "func (s VirtualGateway) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "0c845f1abf0a4ca8dd6ada0950e9f936", "score": "0.53669965", "text": "func (v StructureType) String() string {\n switch v {\n case 0: \n return \"Structure\"\n case 1: \n return \"StructureWithOptionalFields\"\n case 2: \n return \"Union\"\n default:\n return \"\"\n }\n}", "title": "" }, { "docid": "bbaee1c6d54770a26bbe0c65c67dca94", "score": "0.5365385", "text": "func (s *StarlarkStruct) String() string {\n\treturn fmt.Sprint(s.fields)\n}", "title": "" }, { "docid": "dfaff91134ee6a26b6b3f9f29e63c93a", "score": "0.53625137", "text": "func (o AggrSnapmirrorAttributesType) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "11a4e7851f5e03cc5470dce5aef81d39", "score": "0.5360891", "text": "func (s GetMembersInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "11a4e7851f5e03cc5470dce5aef81d39", "score": "0.5360891", "text": "func (s GetMembersInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "2cada81761099ad7ed182cbdc2a209f4", "score": "0.5359732", "text": "func (p Params) String() string {\n\tvar sb strings.Builder\n\tsb.WriteString(\"Params: \\n\")\n\tsb.WriteString(fmt.Sprintf(\"MaxMemoCharacters: %d\\n\", p.MaxMemoCharacters))\n\tsb.WriteString(fmt.Sprintf(\"TxSigLimit: %d\\n\", p.TxSigLimit))\n\tsb.WriteString(fmt.Sprintf(\"FeeMultiplier: %v\\n\", p.FeeMultiplier))\n\treturn sb.String()\n}", "title": "" } ]
6d5a0977008edd7e13804862e11a10ae
Evict( eviction policy.Eviction) error
[ { "docid": "16f3416740a75f1fc2151779b8fa4d0e", "score": "0.6382031", "text": "func Evict_117(c coreclient.PodInterface) {\n\tc.Evict(&policyapi.Eviction{})\n}", "title": "" } ]
[ { "docid": "f1c4733550dc5cb1b96fbf306363229d", "score": "0.70335853", "text": "func (pd *pollDesc) evict() {\n\tif pd.runtimeCtx == 0 {\n\t\treturn\n\t}\n\truntime_pollUnblock(pd.runtimeCtx)\n}", "title": "" }, { "docid": "304adaa8f3f91f8a2e1992315203431d", "score": "0.6982487", "text": "func (c *failureCache) evict() {\n\tvar key string\n\tfor k := range c.data {\n\t\tkey = k\n\t\tbreak\n\t}\n\tdelete(c.data, key)\n}", "title": "" }, { "docid": "23a51ab51dcda6502363bf067d4b2a04", "score": "0.679373", "text": "func (c *cache) evict() {\n\tfor i := range c.entries {\n\t\tif c.entries[i].inserted.Add(c.ttl).Before(time.Now()) {\n\t\t\tdelete(c.entries, i)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "993750f1d20eb8289de1c0765d582854", "score": "0.6677584", "text": "func (c *LRUCache) evict() {\n\telem := c.lru.Back()\n\tif elem == nil {\n\t\treturn\n\t}\n\t// remove item at the end of lru list\n\tc.lru.Remove(elem)\n\tdelete(c.cache, elem.Value.(*Pair).key)\n}", "title": "" }, { "docid": "22b0b3848598b70242eca6aa2eb3565d", "score": "0.6526977", "text": "func Evict_118(c coreclient.PodInterface) {\n\tc.Evict(context.TODO(), &policyapi.Eviction{})\n}", "title": "" }, { "docid": "962ab0a9f8495daeff6a4b93637922fa", "score": "0.6467692", "text": "func (c *ptrCache) evict() {\n\tvar key string\n\tfor k := range c.data {\n\t\tkey = k\n\t\tbreak\n\t}\n\tdelete(c.data, key)\n}", "title": "" }, { "docid": "46e6739e165c076fd028d7822dbf64d0", "score": "0.63966215", "text": "func (o *orchestrator) onCacheEvicted(key string, resource cache.Resource) {\n\t// TODO Potential for improvements here to handle the thundering herd\n\t// problem: https://github.com/envoyproxy/xds-relay/issues/71\n\tmetrics.OrchestratorCacheEvictSubscope(o.scope, key).Counter(metrics.OrcheestratorCacheEvictCount).Inc(1)\n\tmetrics.OrchestratorCacheEvictSubscope(o.scope, key).Counter(\n\t\tmetrics.OrchestratorOnCacheEvictedRequestCount).Inc(int64(getLength(resource.Requests)))\n\to.logger.With(\"aggregated_key\", key).Debug(context.Background(), \"cache eviction called\")\n\to.downstreamResponseMap.deleteAll(resource.Requests)\n\to.upstreamResponseMap.delete(key)\n}", "title": "" }, { "docid": "bad6b363d28b5b8e33af5af0fd43c8d6", "score": "0.63041407", "text": "func (c *SideInputCache) evictElement(ctx context.Context) {\n\tdeleted := false\n\t// Select a key from the cache at random\n\tfor k := range c.cache {\n\t\t// Do not evict an element if it's currently valid\n\t\tif !c.isValid(k.tok) {\n\t\t\tdelete(c.cache, k)\n\t\t\tc.metrics.Evictions++\n\t\t\tdeleted = true\n\t\t\tbreak\n\t\t}\n\t}\n\t// Nothing is deleted if every side input is still valid. Clear\n\t// out a random entry and record the in-use eviction\n\tif !deleted {\n\t\tfor k := range c.cache {\n\t\t\tdelete(c.cache, k)\n\t\t\tc.metrics.InUseEvictions++\n\t\t\tbreak\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3db1440b6bba8fe1e5cf8b2685f34bea", "score": "0.6269294", "text": "func PoolEvict(ctx context.Context, rpcClient UnaryInvoker, req *PoolEvictReq) error {\n\tpbReq := &mgmtpb.PoolEvictReq{\n\t\tSys: req.getSystem(rpcClient),\n\t\tId: req.ID,\n\t\tHandles: req.Handles,\n\t}\n\treq.setRPC(func(ctx context.Context, conn *grpc.ClientConn) (proto.Message, error) {\n\t\treturn mgmtpb.NewMgmtSvcClient(conn).PoolEvict(ctx, pbReq)\n\t})\n\n\trpcClient.Debugf(\"Evict DAOS pool request: %s\\n\", pbUtil.Debug(pbReq))\n\tur, err := rpcClient.InvokeUnaryRPC(ctx, req)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn errors.Wrap(ur.getMSError(), \"pool evict failed\")\n}", "title": "" }, { "docid": "dedb54a77bd2902b9cdec176b57871d2", "score": "0.61939794", "text": "func (lru *leastRecentlyUsedCache) managedEvict() {\n\t// Check whether any eviction needs to happen. Nothing to do if not.\n\tlru.mu.Lock()\n\tif uint64(len(lru.nodes)) <= lru.staticSize {\n\t\tlru.mu.Unlock()\n\t\treturn\n\t}\n\t// Grab the current tail to evict it.\n\tnode := lru.tail\n\t// Set the previous node's next to nil.\n\tnode.prev.next = nil\n\t// Set the previous node to the new tail.\n\tlru.tail = node.prev\n\tdelete(lru.nodes, node.index)\n\tlru.mu.Unlock()\n\n\t// Once the lru has been updated, get the node's data removed from the\n\t// stream buffer.\n\tlru.staticStreamBuffer.callRemoveDataSection(node.index)\n}", "title": "" }, { "docid": "6b4b594e6aa45e333dd0ef3e9a18f7c9", "score": "0.61774564", "text": "func (l *LRUCache) evict(node *Node) {\n\thtmp := l.head\n\tl.head.prev = node\n\tnode.next = l.head\n\tl.head.next = nil\n\tl.head = node\n\n\tdelete(l.cache, l.tail.key)\n\tl.tail = htmp\n}", "title": "" }, { "docid": "4fe0af2e5b7115569f1e4c4096488b9e", "score": "0.6173364", "text": "func (c *Cache) tryEvict(rec *Record) {\n\tif !rec.m.TryLock() {\n\t\treturn\n\t}\n\tdefer rec.m.Unlock()\n\n\tswitch rec.state {\n\tcase active:\n\t\t// Mark the record as idle, if it's still idle on the next tick we'll\n\t\t// remove it.\n\t\trec.state = idle\n\n\t\tif logging.IsDebug(c.Logger) {\n\t\t\tlogging.Debug(\n\t\t\t\tc.Logger,\n\t\t\t\t\"cache record %s marked idle [%p]\",\n\t\t\t\trec.id,\n\t\t\t\trec,\n\t\t\t)\n\t\t}\n\n\tcase idle:\n\t\t// It's still idle, meaning it hasn't been acquired since the last tick.\n\t\tif c.remove(rec) {\n\t\t\tif logging.IsDebug(c.Logger) {\n\t\t\t\tlogging.Debug(\n\t\t\t\t\tc.Logger,\n\t\t\t\t\t\"cache record %s removed (evicted) [%p]\",\n\t\t\t\t\trec.id,\n\t\t\t\t\trec,\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e5a77c796452fbce082f3255debd32df", "score": "0.61219114", "text": "func TestEviction(t *testing.T) {\n\t// put 5 items in a cache with maxEntries = 3\n\tc := clock.New(3)\n\tfor i := 0; i < 4; i++ {\n\t\tc.Put(i, i)\n\t}\n\n\tif _, ok := c.Get(0); ok {\n\t\tt.Error(\"Key 0 should have been evicted\")\n\t}\n\n\t// access key 1 so it is not the next victim\n\tc.Get(1)\n\n\tc.Put(4, 4)\n\tif _, ok := c.Get(2); ok {\n\t\tt.Error(\"Key 2 should have been evicted\")\n\t}\n\t// key 1 must still be on th cache\n\tif _, ok := c.Get(1); !ok {\n\t\tt.Error(\"Key 1 should not have been evicted\")\n\t}\n}", "title": "" }, { "docid": "90a57786ad36569b2ebdde17d6825cbc", "score": "0.6109694", "text": "func (ic *InodeCache) evict(foreground bool) {\n\tvar count int\n\n\tfor i := 0; i < MinInodeCacheEvictNum; i++ {\n\t\telement := ic.lruList.Back()\n\t\tif element == nil {\n\t\t\treturn\n\t\t}\n\n\t\t// For background eviction, if all expired items have been evicted, just return\n\t\t// But for foreground eviction, we need to evict at least MinInodeCacheEvictNum inodes.\n\t\t// The foreground eviction, does not need to care if the inode has expired or not.\n\t\tinfo := element.Value.(*proto.InodeInfo)\n\t\tif !foreground && !inodeExpired(info) {\n\t\t\treturn\n\t\t}\n\n\t\tic.lruList.Remove(element)\n\t\tdelete(ic.cache, info.Inode)\n\t\tcount++\n\t}\n\n\t// For background eviction, we need to continue evict all expired items from the cache\n\tif foreground {\n\t\treturn\n\t}\n\n\tfor i := 0; i < MaxInodeCacheEvictNum; i++ {\n\t\telement := ic.lruList.Back()\n\t\tif element == nil {\n\t\t\tbreak\n\t\t}\n\t\tinfo := element.Value.(*proto.InodeInfo)\n\t\tif !inodeExpired(info) {\n\t\t\tbreak\n\t\t}\n\t\tic.lruList.Remove(element)\n\t\tdelete(ic.cache, info.Inode)\n\t\tcount++\n\t}\n}", "title": "" }, { "docid": "5b003411955fd814fbfef06fb7620b72", "score": "0.60126454", "text": "func (s *Shard) Evict() {\n\ts.Lock()\n\tent := s.dlist.Back()\n\tif ent == nil {\n\t\ts.Unlock()\n\t\treturn\n\t}\n\ts.dlist.Remove(ent)\n\tdelete(s.items, ent.Value.(*node).key)\n\tatomic.AddInt32(&s.length, -1)\n\ts.Unlock()\n}", "title": "" }, { "docid": "dc2eecc51c46ac73ee94bb1019af57fb", "score": "0.59731334", "text": "func (c *Cache) Evict(req *http.Request) error {\n\tkey, _, err := c.Match(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn c.EvictKey(key)\n}", "title": "" }, { "docid": "2b468aa6a2568d0843568869b0a65ff2", "score": "0.5952717", "text": "func (c *LRUCache) evict(n *node) {\n\n\t//check if head/tail\n\tif n == c.tail {\n\t\tc.tail = n.child\n\t}\n\tif n == c.head {\n\t\tc.head = n.parent\n\t}\n\n\t// remap nodes on either side\n\tif n.parent != nil {\n\t\tn.parent.child = n.child\n\t}\n\tif n.child != nil {\n\t\tn.child.parent = n.parent\n\t}\n\n}", "title": "" }, { "docid": "3f6b23c977e11a9daf64f87213dc6fa0", "score": "0.5942851", "text": "func (m *memberlist) Evict(address string) {\n\tif m.local.Address == address {\n\t\t// We should not evict ourselves from the memberlist. This should not be reached, but we will make noise in the logs\n\t\tm.logger.Error(\"ringpop tried to evict the local member from the memberlist, action has been prevented\")\n\t\treturn\n\t}\n\n\tm.RemoveMember(address)\n}", "title": "" }, { "docid": "9928486a047a75c1fdf6cb28b3c54c8c", "score": "0.5928498", "text": "func (pool *SeriesPool) EvictCache() int {\n\t// we wipe the whole prefix instead of pool.lru.Clear since that is not concurrent\n\treturn pool.lru.DeletePrefix(poolPrefix)\n}", "title": "" }, { "docid": "9b75e1db133978b1446607b069c8faee", "score": "0.5890766", "text": "func (c *Cache) onEvicted(key, value interface{}) {\n\tentry := value.(*CacheEntry)\n\tc.currentSizeBytes -= entry.size\n}", "title": "" }, { "docid": "852a5f12f90d33cd90bb5efb52a1ac4c", "score": "0.5874358", "text": "func evictPod(ctx context.Context, client k8s.Interface, name, namespace string, options *metav1.DeleteOptions) error {\n\n\tconst (\n\t\tEvictionKind = \"Eviction\"\n\t\tPolicyGroupVersion = \"policy/v1beta1\"\n\t)\n\n\teviction := &policy.Eviction{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tAPIVersion: PolicyGroupVersion,\n\t\t\tKind: EvictionKind,\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: name,\n\t\t\tNamespace: namespace,\n\t\t},\n\t\tDeleteOptions: options,\n\t}\n\n\t// Receive events for the Pod before evicting it\n\twatcher, err := client.CoreV1().Pods(namespace).Watch(metav1.ListOptions{\n\t\tFieldSelector: fields.OneTermEqualSelector(api.ObjectNameField, name).String(),\n\t})\n\tif apierrors.IsNotFound(err) {\n\t\treturn nil\n\t} else if err != nil {\n\t\treturn errors.Wrap(err, \"failed to watch pod\")\n\t}\n\tdefer watcher.Stop()\n\n\t// try multiple times to evict the pod\n\tfor {\n\t\tif err := client.CoreV1().Pods(namespace).Evict(eviction); err == nil {\n\t\t\tlog.Printf(\"Created Eviction for Pod %s/%s\", namespace, name)\n\t\t\tbreak\n\t\t} else if apierrors.IsNotFound(err) {\n\t\t\treturn nil\n\t\t} else if !apierrors.IsTooManyRequests(err) {\n\t\t\treturn err\n\t\t}\n\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn ctx.Err()\n\t\tcase <-time.After(2 * time.Second):\n\t\t}\n\t}\n\n\tfor {\n\t\tselect {\n\t\tcase ev, ok := <-watcher.ResultChan():\n\t\t\tif !ok {\n\t\t\t\treturn errors.New(\"watch channel closed\")\n\t\t\t}\n\t\t\tif ev.Type == watch.Deleted {\n\t\t\t\tlog.Printf(\"%s/%s evicted\", namespace, name)\n\t\t\t\treturn nil\n\t\t\t}\n\t\tcase <-ctx.Done():\n\t\t\treturn ctx.Err()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e2094542d5bdf7ca4c533259f5f80a39", "score": "0.57799786", "text": "func (m *smapX) evictIC() {\n\tif m.ICCount() <= meta.DfltCountIC {\n\t\treturn\n\t}\n\tfor sid, si := range m.Pmap {\n\t\tif sid == m.Primary.ID() || !m.IsIC(si) {\n\t\t\tcontinue\n\t\t}\n\t\tm.clearNodeFlags(sid, meta.SnodeIC)\n\t\tbreak\n\t}\n}", "title": "" }, { "docid": "533acdc5e3e8160fc2a6cdeaf4726eae", "score": "0.5773891", "text": "func (svc *mgmtSvc) PoolEvict(ctx context.Context, req *mgmtpb.PoolEvictReq) (*mgmtpb.PoolEvictResp, error) {\n\tif err := svc.checkLeaderRequest(req); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(req.Handles) == 0 {\n\t\t// If we're not evicting a set of handles, then we shouldn't bother with trying\n\t\t// to batch up the requests from multiple agents.\n\t\treturn svc.evictPoolConnections(ctx, req)\n\t}\n\n\tmsg, err := svc.submitBatchRequest(ctx, req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn msg.(*mgmtpb.PoolEvictResp), nil\n}", "title": "" }, { "docid": "aeedbf4712c48fa7896f98098a7837d0", "score": "0.5730136", "text": "func (n *Node) SelfEvict() error {\n\treturn n.selfEvict.SelfEvict()\n}", "title": "" }, { "docid": "19e2fea38a6e2ab183b81340f0de53b1", "score": "0.5619328", "text": "func (h *hostMemoryManager) tryEviction() {\n\t// Check if eviction should be triggered\n\tif (h.totalMemorySize - h.getManagedSpaceUsage() - h.getUnmanagedSpaceUsage()) < 0 {\n\t\tutils.GetLogger().Debugf(\"UnmanagedMem: %d + ManagedMem: %d is larger than totalMem: %d! Eviction is triggered.\",\n\t\t\th.getUnmanagedSpaceUsage(), h.getManagedSpaceUsage(), h.totalMemorySize)\n\t\t// Init all columnar priority batches.\n\t\tgpq := h.initialGlobalPriorityQueue()\n\t\t// Pop from globalPriorityQueueWithLock and do eviction\n\t\tfor (h.totalMemorySize-h.getManagedSpaceUsage()-h.getUnmanagedSpaceUsage()) < 0 && !gpq.isEmpty() {\n\t\t\tglobalPriorityItem := gpq.pop()\n\n\t\t\tbatchPriority := globalPriorityItem.priority\n\t\t\tcolumnBatchInfos := globalPriorityItem.value\n\t\t\tcolumnIt := globalPriorityItem.it\n\n\t\t\ttableSchema, err := h.memStore.GetSchema(columnBatchInfos.table)\n\n\t\t\ttableSchema.RLock()\n\t\t\tpreloadingDays := tableSchema.Schema.Columns[batchPriority.columnID].Config.PreloadingDays\n\t\t\ttableSchema.RUnlock()\n\n\t\t\tisPreloadingDays := isPreloadingBatch(batchPriority.batchID, preloadingDays)\n\n\t\t\tif isPreloadingDays {\n\t\t\t\tutils.GetReporter(columnBatchInfos.table, batchPriority.shardID).\n\t\t\t\t\tGetCounter(utils.PreloadingZoneEvicted).Inc(1)\n\t\t\t\tutils.GetLogger().With(\n\t\t\t\t\t\"table\", columnBatchInfos.table,\n\t\t\t\t\t\"shard\", batchPriority.shardID,\n\t\t\t\t\t\"batch\", batchPriority.batchID,\n\t\t\t\t\t\"column\", batchPriority.columnID,\n\t\t\t\t).Warn(\"Column in preloading zone is evicted\")\n\t\t\t}\n\n\t\t\tok, err := h.memStore.TryEvictBatchColumn(columnBatchInfos.table, batchPriority.shardID, int32(batchPriority.batchID), batchPriority.columnID)\n\t\t\tif ok {\n\t\t\t\tutils.GetLogger().Debugf(\"Successfully evict batch from memstore: table %s, shardID %d, batchID %d, columnID %d, size %d\",\n\t\t\t\t\tcolumnBatchInfos.table, batchPriority.shardID, batchPriority.batchID, batchPriority.columnID, batchPriority.size)\n\t\t\t} else {\n\t\t\t\tutils.GetLogger().Debugf(\"Failed to evict batch from memstore: table %s, shardID %d, batchID %d, columnID %d, size %d, errors: %s\",\n\t\t\t\t\tcolumnBatchInfos.table, batchPriority.shardID, batchPriority.batchID, batchPriority.columnID, batchPriority.size, err)\n\t\t\t}\n\n\t\t\t// Adding the corresponding next batch into priority queue.\n\t\t\tif columnIt.Next() {\n\t\t\t\tgpq.pushBatchIntoGlobalPriorityQueue(h, columnBatchInfos, batchPriority.columnID, columnIt)\n\t\t\t}\n\t\t}\n\n\t\t// Still cannot meet the memory constraints even after evictions.\n\t\tif h.totalMemorySize-h.getManagedSpaceUsage()-h.getUnmanagedSpaceUsage() < 0 {\n\t\t\tutils.GetRootReporter().GetCounter(utils.MemoryOverflow).Inc(1)\n\t\t\tutils.GetLogger().Warn(\"Still cannot meet the memory constraints even after evictions\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b5de5c5c0538ab1a1eec8439a63ade2c", "score": "0.5588059", "text": "func (c *LFUPlugin) evict(count int) {\n\tentry := c.freqList.Front()\n\tfor i := 0; i < count; {\n\t\tif entry == nil {\n\t\t\treturn\n\t\t} else {\n\t\t\tfor item, _ := range entry.Value.(*freqEntry).items {\n\t\t\t\tif i >= count {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tc.removeItem(item)\n\t\t\t\ti++\n\t\t\t}\n\t\t\tentry = entry.Next()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1d27ba00be7cbf6027ec185c622463ec", "score": "0.5582505", "text": "func (c *Cache) Evict(key string) (errOut error) {\n\tvar err error\n\tkey, err = parseKey(key)\n\tif err != nil {\n\t\treturn err\n\t}\n\tlock, err := c.lock(key)\n\tif err != nil {\n\t\treturn err\n\t}\n\tunlocked := false\n\tdefer func() {\n\t\tif unlocked {\n\t\t\treturn\n\t\t}\n\t\terrOut = errors.Join(errOut, lock.Close())\n\t}()\n\tdir := filepath.Join(c.Root, key)\n\tinfo, err := os.Stat(dir)\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\treturn nil\n\t\t}\n\t\treturn err\n\t}\n\tif !info.IsDir() {\n\t\treturn errors.New(\"not a directory\")\n\t}\n\terr = os.RemoveAll(dir)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Unlock early to get around a Windows issue where you can't delete a locked file.\n\tunlocked = true\n\terr = lock.Close()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn os.Remove(c.lockfile(key))\n}", "title": "" }, { "docid": "f2a472d27412e63a36b331c4beb5465a", "score": "0.55767405", "text": "func (lctx *lructx) evictFQN(fqn string) error {\n\tbucket, objname, err := cluster.ResolveFQN(fqn, lctx.bmdowner)\n\tif err != nil {\n\t\tglog.Errorf(\"Evicting %q with error: %v\", fqn, err)\n\t\tif e := os.Remove(fqn); e != nil {\n\t\t\treturn fmt.Errorf(\"nested error: %v and %v\", err, e)\n\t\t}\n\t\tglog.Infof(\"LRU: removed %q\", fqn)\n\t\treturn nil\n\t}\n\tuname := cluster.Uname(bucket, objname)\n\tlctx.namelocker.Lock(uname, true)\n\tdefer lctx.namelocker.Unlock(uname, true)\n\n\tif err := os.Remove(fqn); err != nil {\n\t\treturn err\n\t}\n\tglog.Infof(\"LRU: evicted %s/%s\", bucket, objname)\n\treturn nil\n}", "title": "" }, { "docid": "bf17a7fc4775b335a860cda5a688d50f", "score": "0.5574922", "text": "func OrchestratorCacheEvictSubscope(parent tally.Scope, aggregatedKey string) tally.Scope {\n\treturn parent.SubScope(ScopeOrchestratorCacheEvict).Tagged(map[string]string{TagName: aggregatedKey})\n}", "title": "" }, { "docid": "626812436ef6c4c006a8bb8b61f6de58", "score": "0.55692613", "text": "func (c *Cache) StopEviction() {\n\tc.Lock()\n\tdefer c.Unlock()\n\n\tif c.ticker != nil {\n\t\tc.ticker.Stop()\n\t\tc.ticker = nil\n\t}\n}", "title": "" }, { "docid": "e2409521e225086498aa0597c1ec555c", "score": "0.55691564", "text": "func (b *ArchiveBatch) evict(columnID int, blocking bool) common.ArchiveVectorParty {\n\tb.Lock()\n\tdefer b.Unlock()\n\n\tif columnID >= len(b.Columns) {\n\t\treturn nil\n\t}\n\n\trawVP := b.Columns[columnID]\n\tif rawVP == nil {\n\t\treturn nil\n\t}\n\n\tvp := rawVP.(common.ArchiveVectorParty)\n\tif !vp.WaitForUsers(blocking) {\n\t\treturn nil\n\t}\n\n\tb.Columns[columnID] = nil\n\tvp.SafeDestruct()\n\tb.Shard.HostMemoryManager.ReportManagedObject(\n\t\tb.Shard.Schema.Schema.Name, b.Shard.ShardID, int(b.BatchID), columnID, 0)\n\treturn vp\n}", "title": "" }, { "docid": "efb3eb9b60758dcf32ec6b70cc5266f1", "score": "0.55290157", "text": "func TestCacheFileEvict(t *testing.T) {\n\ttmpdir, err := ioutil.TempDir(\"\", \"cphash-test\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdefer os.RemoveAll(tmpdir)\n\te := New(Config{CachesInMem: 3, CachesOnDisk: 10, CacheDir: tmpdir, PowMode: ModeTest})\n\n\tworkers := 8\n\tepochs := 100\n\tvar wg sync.WaitGroup\n\twg.Add(workers)\n\tfor i := 0; i < workers; i++ {\n\t\tgo verifyTest(&wg, e, i, epochs)\n\t}\n\twg.Wait()\n}", "title": "" }, { "docid": "36f6137f29138933b103b00e70d07fe2", "score": "0.5463182", "text": "func (o *AssetConnectionControlMessageAllOf) SetEvict(v bool) {\n\to.Evict = &v\n}", "title": "" }, { "docid": "f7df5286c5179c3f7f783e02b4a272b4", "score": "0.5460314", "text": "func (p *idlePool) Evict(dur time.Duration) {\n\tp.Lock()\n\tdefer p.Unlock()\n\tdeadline := time.Now().Add(-dur)\n\tfor i, t := range p.times {\n\t\te := p.elems[i]\n\t\tif e == nil || t.After(deadline) {\n\t\t\tcontinue\n\t\t}\n\t\te.Close()\n\t\tp.elems[i] = nil\n\t}\n\treturn\n}", "title": "" }, { "docid": "07549274f02bf3dd6b70c6a3f3cc7ebb", "score": "0.54599833", "text": "func (b *repositoryBucket) evictStale() {\n\tnow := b.clock.Now()\n\tarr := b.list[:0]\n\n\tfor _, entry := range b.list {\n\t\tif entry.evictOn.Before(now) {\n\t\t\tcontinue\n\t\t}\n\t\tarr = append(arr, entry)\n\t}\n\n\tb.list = arr\n}", "title": "" }, { "docid": "25331f533c68719992ae10b85a129e4d", "score": "0.5453815", "text": "func (dynT *dynamicTable) evict(n uint32) {\n\tif n == 0 {\n\t\treturn\n\t}\n\tif n >= dynT.length() {\n\t\tdynT.HeaderFields = make([]*HeaderField, 0)\n\t\treturn\n\t}\n\n\t// Evicts n number of entries\n\tdynT.HeaderFields = dynT.HeaderFields[:dynT.length()-n]\n}", "title": "" }, { "docid": "052bd5d5c5024462f6a5e12f635635ea", "score": "0.5445156", "text": "func (cf *CF) evict(row uint32, f byte) byte {\n\tcf.rnd = rnd(cf.rnd)\n\n\t// random bucket\n\tbucket := cf.rnd & 3\n\te := cf.t[row][bucket]\n\tcf.t[row][bucket] = f\n\n\treturn e\n}", "title": "" }, { "docid": "593bb74cc9f82c1a0917add2c29a477a", "score": "0.54149777", "text": "func (evictor *SOCKEvictor) doEvictions() {\n\tmemLimitMB := common.Conf.Limits.Mem_mb\n\n\t// how many sandboxes could we spin up, given available mem?\n\tfreeSandboxes := evictor.mem.getAvailableMB() / memLimitMB\n\n\t// how many sandboxes would we like to be able to spin up,\n\t// without waiting for more memory?\n\tfreeGoal := 1 + ((evictor.mem.totalMB/memLimitMB)-2)*FREE_SANDBOXES_PERCENT_GOAL/100\n\n\t// how many shoud we try to evict?\n\t//\n\t// TODO: consider counting in-flight evictions. This will be\n\t// a bit tricky, as the evictions may be of sandboxes in paused\n\t// states with reduced memory limits\n\tevictCount := freeGoal - freeSandboxes\n\n\tevictCap := CONCURRENT_EVICTIONS - evictor.evicting.Len()\n\tif evictCap < evictCount {\n\t\tevictCount = evictCap\n\t}\n\n\t// try evicting the desired number, starting with the paused queue\n\tfor evictCount > 0 && evictor.prioQueues[0].Len() > 0 {\n\t\tevictor.evictFront(evictor.prioQueues[0], false)\n\t\tevictCount -= 1\n\t}\n\n\t// we don't like to evict running containers, because that\n\t// interrupts requests, but we do if necessary to keep the\n\t// system moving (what if all lambdas hanged forever?)\n\t//\n\t// TODO: create some parameters to better control eviction in\n\t// this state\n\tif freeSandboxes <= 0 && evictor.evicting.Len() == 0 {\n\t\tevictor.printf(\"WARNING! Critically low on memory, so evicting an active Sandbox\")\n\t\tif evictor.prioQueues[1].Len() > 0 {\n\t\t\tevictor.evictFront(evictor.prioQueues[1], true)\n\t\t}\n\t}\n\n\t// we never evict from prioQueues[2+], because those have\n\t// descendents with lower priority that should be evicted\n\t// first\n}", "title": "" }, { "docid": "3ed58887127c916f0c5b2c2418a6536b", "score": "0.5384791", "text": "func TestOnEvict(t *testing.T) {\n\tch := make(chan int, 5)\n\tonEvict := func(k, v interface{}) {\n\t\tch <- k.(int)\n\t}\n\tc := clock.New(5, clock.OnEvict(onEvict))\n\n\tfor i := 0; i < 10; i++ {\n\t\tc.Put(i, i)\n\t}\n\n\tevicted := make(map[int]bool)\n\tfor i := 0; i < 5; i++ {\n\t\tevicted[<-ch] = true\n\t}\n\n\tfor i := 0; i < 5; i++ {\n\t\tif _, ok := evicted[i]; !ok {\n\t\t\tt.Errorf(\"onEvict not called for key %v\", i)\n\t\t}\n\t}\n\n}", "title": "" }, { "docid": "49fd4dff4c5bfc728913b732ccaf918e", "score": "0.53680104", "text": "func (c *cache) OnEvicted(f func(string, any)) {\n\tc.mu.Lock()\n\tc.onEvicted = f\n\tc.mu.Unlock()\n}", "title": "" }, { "docid": "a6e0a516cfbbcce8cff4460c849978b0", "score": "0.5346964", "text": "func (c *fileCache) removeOldest() {\n\tent := c.evictList.Back()\n\tif ent != nil {\n\t\tc.removeElement(ent)\n\t}\n}", "title": "" }, { "docid": "da45a30a45c64d7bb405f3d24d3475f2", "score": "0.52988577", "text": "func (c *LruCache) removeOldest() {\n\tent := c.evictList.Back()\n\tif ent != nil {\n\t\tc.removeElement(ent)\n\t}\n}", "title": "" }, { "docid": "630f5c4929e45e880ba89c347b50a170", "score": "0.5294393", "text": "func TestEvictEntries(t *testing.T) {\n\t// Create a SigCache instance.\n\tnumTxns := len(block432100.Transactions) + len(block432100.STransactions)\n\tsigCache, err := NewSigCache(uint(numTxns + 1))\n\tif err != nil {\n\t\tt.Fatalf(\"error creating NewSigCache: %v\", err)\n\t}\n\n\t// Add random signatures to the SigCache for each transaction in block432100.\n\tfor _, tx := range block432100.Transactions {\n\t\tmsg, sig, key := genRandomSig(t)\n\t\tsigCache.Add(*msg, sig, key, tx)\n\t}\n\tfor _, stx := range block432100.STransactions {\n\t\tmsg, sig, key := genRandomSig(t)\n\t\tsigCache.Add(*msg, sig, key, stx)\n\t}\n\n\t// Add another random signature that is not related to a transaction in\n\t// block432100.\n\tmsg, sig, key := genRandomSig(t)\n\tsigCache.Add(*msg, sig, key, msgTx113875_1())\n\n\t// Validate the number of entries that should exist in the SigCache before\n\t// eviction.\n\twantLength := numTxns + 1\n\tgotLength := len(sigCache.validSigs)\n\tif gotLength != wantLength {\n\t\tt.Fatalf(\"Incorrect number of entries before eviction: \"+\n\t\t\t\"gotLength: %d, wantLength: %d\", gotLength, wantLength)\n\t}\n\n\t// Evict entries for block432100.\n\tsigCache.evictEntries(&block432100)\n\n\t// Validate that entries related to block432100 have been removed and that\n\t// entries unrelated to block432100 have not been removed.\n\twantLength = 1\n\tgotLength = len(sigCache.validSigs)\n\tif gotLength != wantLength {\n\t\tt.Errorf(\"Incorrect number of entries after eviction: \"+\n\t\t\t\"gotLength: %d, wantLength: %d\", gotLength, wantLength)\n\t}\n\tsigCopy, _ := ecdsa.ParseDERSignature(sig.Serialize())\n\tkeyCopy, _ := secp256k1.ParsePubKey(key.SerializeCompressed())\n\tif !sigCache.Exists(*msg, sigCopy, keyCopy) {\n\t\tt.Errorf(\"previously added item not found in signature cache\")\n\t}\n}", "title": "" }, { "docid": "b17ba2469bf0e7849121ef39187d9725", "score": "0.5286223", "text": "func (evictor *SOCKEvictor) evictFront(queue *list.List, force bool) {\n\tfront := queue.Front()\n\tsb := front.Value.(Sandbox)\n\n\tevictor.printf(\"Evict Sandbox %v\", sb.ID())\n\tevictor.move(sb, evictor.evicting)\n\n\t// destroy async (we'll know when it's done, because\n\t// we'll see a evDestroy event later on our chan)\n\tgo func() {\n\t\tt := common.T0(\"evict\")\n\t\tif force {\n\t\t\tsb.Destroy(\"forced eviction\")\n\t\t} else {\n\t\t\tsb.DestroyIfPaused(\"idle eviction\")\n\t\t}\n\t\tt.T1()\n\t}()\n}", "title": "" }, { "docid": "3097fa1cd241dadf9fcfa2c6c7dacc60", "score": "0.5263077", "text": "func (c *Container) removeOldestElement() {\n\tent := c.evictList.Back()\n\tif ent != nil {\n\t\tc.removeElement(ent)\n\t}\n}", "title": "" }, { "docid": "689805f1a7c9bebd7e30a907dfe2aabd", "score": "0.5248211", "text": "func (c *LRU[K, V]) removeOldest() {\n\tent := c.evictList.Back()\n\tif ent != nil {\n\t\tc.removeElement(ent)\n\t}\n}", "title": "" }, { "docid": "d268ace0371951a99962922386f8aca2", "score": "0.5234128", "text": "func (o *AssetConnectionControlMessageAllOf) HasEvict() bool {\n\tif o != nil && o.Evict != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "01fcbac0988627a51d5f0def9c115e4f", "score": "0.5228976", "text": "func (fe *FakeEvictor) Evict(p *v1.Pod, reason string) error {\n\tfe.Lock()\n\tdefer fe.Unlock()\n\n\tfmt.Println(\"PodName: \", p.Name)\n\tkey := fmt.Sprintf(\"%v/%v\", p.Namespace, p.Name)\n\tfe.evicts = append(fe.evicts, key)\n\n\tfe.Channel <- key\n\n\treturn nil\n}", "title": "" }, { "docid": "6f199b1409c0b0e234594d9f87038c97", "score": "0.52212536", "text": "func (c *Cache) removeElement(e *list.Element) {\n\tc.evictList.Remove(e)\n\tkv := e.Value.(*entry)\n\tif bucket, ok := c.items[string(kv.bucket)]; ok {\n\t\tdelete(bucket, string(kv.key))\n\t\tc.size -= uint64(kv.Size())\n\t\tc.count--\n\t\tif c.onEvict != nil {\n\t\t\tc.onEvict(kv.bucket, kv.key, kv.value)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "19fde39c842a5c4173d628d1d53708c1", "score": "0.5214807", "text": "func (s *SQLiteSuite) TestEviction(c *C) {\n\tcomment := Commentf(\"Expected all events to be evicted.\")\n\tnode := \"test-node\"\n\tevents := []*pb.TimelineEvent{pb.NewNodeHealthy(s.clock.Now(), node)}\n\tvar expected []*pb.TimelineEvent\n\n\ttest.WithTimeout(func(ctx context.Context) {\n\t\tc.Assert(s.timeline.RecordEvents(ctx, events), IsNil)\n\n\t\t// Advance clock and evict all events before this time.\n\t\ts.clock.Advance(time.Second)\n\t\tc.Assert(s.timeline.evictEvents(ctx, s.clock.Now()), IsNil)\n\n\t\tactual, err := s.timeline.GetEvents(ctx, nil)\n\t\tc.Assert(err, IsNil)\n\t\tc.Assert(actual, test.DeepCompare, expected, comment)\n\t})\n}", "title": "" }, { "docid": "ac5074b5478d4e23308e09bb1bad67db", "score": "0.5213645", "text": "func (c *cache) OnEvicted(f func(string, interface{})) {\n\tc.mu.Lock()\n\tc.onEvicted = f\n\tc.mu.Unlock()\n}", "title": "" }, { "docid": "46d8331571365f6cceda9d63152abd20", "score": "0.5204386", "text": "func (c *Cache) removeOldest() {\n\tent := c.evictList.Back()\n\tif ent != nil {\n\t\tatomic.AddInt64(&c.stats.RemoveOldestCount, 1)\n\t\tc.removeElement(ent)\n\t}\n}", "title": "" }, { "docid": "8c5040705f7afb72532ff23e8977271d", "score": "0.5189368", "text": "func (b *ArchiveBatch) TryEvict(columnID int) common.ArchiveVectorParty {\n\treturn b.evict(columnID, false)\n}", "title": "" }, { "docid": "dae03dffc7ea6ddee050b0b851037974", "score": "0.5174403", "text": "func (c *LruCache) removeElement(e *list.Element) {\n\tc.currentSize -= e.Value.(*entry).value.Size\n\tc.evictList.Remove(e)\n\tkv := e.Value.(*entry)\n\tdelete(c.items, kv.key)\n\tif c.onEvict != nil {\n\t\tc.onEvict(kv.key)\n\t}\n}", "title": "" }, { "docid": "89d045fe6396072de5255a73efbcac00", "score": "0.5168512", "text": "func (c *Cache) EvictKey(key string) error {\n\treturn c.fs.Remove(key)\n}", "title": "" }, { "docid": "e731c74295c0c64bd554710713ebe709", "score": "0.5140073", "text": "func (self *LRU) removeOldest() {\n\tent := self.evictList.Back()\n\tif ent != nil {\n\t\tself.removeElement(ent)\n\t}\n}", "title": "" }, { "docid": "02c59198f7b97827bcf201a0a5b6a648", "score": "0.5125409", "text": "func (c *lru) removeElement(e *list.Element) {\n\tc.evictList.Remove(e)\n\tkv := e.Value.(*entry)\n\tdelete(c.items, kv.key)\n\tc.sizeBytes -= sizeOfEntry(kv)\n}", "title": "" }, { "docid": "dca2085fd43b20d57ba554422a0cc512", "score": "0.5123527", "text": "func (client *ExtentClient) EvictStream(inode uint64) error {\n\tclient.streamerLock.Lock()\n\ts, ok := client.streamers[inode]\n\tif !ok {\n\t\tclient.streamerLock.Unlock()\n\t\treturn nil\n\t}\n\terr := s.IssueEvictRequest()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ts.done <- struct{}{}\n\treturn nil\n}", "title": "" }, { "docid": "0baf2ff1d82736f05719525ee125c41c", "score": "0.51193506", "text": "func (cc *CollabCache) invalidator() {\n\tticker := time.NewTicker(time.Duration(1) * time.Second)\n\n\tfor {\n\t\tselect {\n\t\tcase time := <-ticker.C:\n\t\t\t{\n\t\t\t\tnow := time.Unix() * 1000\n\n\t\t\t\t// Priority is the expiration time. PQueue is sorted by lowest expiration time\n\t\t\t\t// Theoretically item could be different than the popped value. But popped value must have even lower expiration.\n\t\t\t\t// Since this thread is currently the sole Popper we also don't risk popping an empty PQueue\n\t\t\t\tfor item := cc.pqueue.Peek(); item != nil && int64(item.priority) <= now; item = cc.pqueue.Peek() {\n\t\t\t\t\tcc.invalidate(cc.pqueue.Pop().value.(string)) // items are strings corresponding to key names\n\t\t\t\t}\n\t\t\t}\n\t\tcase <-cc.quitChannel:\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a266d2225df712de6aedd07c68f9b6c2", "score": "0.51171803", "text": "func podEvictionArg(expectedPodToEvict *apiv1.Pod) func(eviction *policy.Eviction) bool {\n\treturn func(eviction *policy.Eviction) bool {\n\t\tif expectedPodToEvict.Name != eviction.ObjectMeta.Name {\n\t\t\treturn false\n\t\t}\n\t\tif expectedPodToEvict.Namespace != eviction.ObjectMeta.Namespace {\n\t\t\treturn false\n\t\t}\n\t\treturn true\n\t}\n}", "title": "" }, { "docid": "37bbb5c12818e496bf66246de05f2e06", "score": "0.5105124", "text": "func (r *RevOrder) onEvictedCallback(key lru.Key, value interface{}) {\n\tid := key.(string)\n\tDebug(\"evict id: %s\", id)\n\n\t// This should never happen: the oldest key (entity ID) is still being\n\t// reordered. If maxEntities is tiny (< 10), then maybe this is just bad luck,\n\t// but more than likely we'll never receive the out-of-order revs, which\n\t// indicates a serious problem: we lost revs.\n\tif re, reordering := r.reorder[id]; reordering {\n\t\tmsg1 := fmt.Sprintf(\"Entity %s evicted from the LRU cache because\"+\n\t\t\t\" it is the oldest entity but still waiting to receive revisions\"+\n\t\t\t\" > %d. Received revisions:\", id, re.qR)\n\t\tfor _, b := range re.buf {\n\t\t\tmsg1 += fmt.Sprintf(\" %d\", b.EntityRev)\n\t\t}\n\t\tmsg2 := fmt.Sprintf(\". This is a rare edge case that indicates some revisions\"+\n\t\t\t\" were not received or extremely delayed. Increasing maxEntities and replaying\"+\n\t\t\t\" the CDC feed from a time before entity %s revision %d could fix this problem.\"+\n\t\t\t\" Please file a bug at https://github.com/square/etre\",\n\t\t\tid, re.qR)\n\t\tpanic(msg1 + msg2)\n\t}\n}", "title": "" }, { "docid": "b5460f837b2c1acf01975d19cde936b2", "score": "0.5098439", "text": "func (c *lru) removeOldest() {\n\tent := c.evictList.Back()\n\tif ent != nil {\n\t\tc.removeElement(ent)\n\t}\n}", "title": "" }, { "docid": "32d6680a5ea43008e789aa23ebbc9501", "score": "0.50817466", "text": "func (dynT *dynamicTable) evictionCheck() bool {\n\t// Calculate how many entires needs to be removed\n\tvar n uint32 // Number of entries to remove\n\n\t// As long as the size is larger than max size, remove an entry.\n\t// Read RFC7541 4.3 and 4.4 for more details\n\tfor dynT.size > dynT.maxSize && n < dynT.length() {\n\t\tdynT.size -= dynT.HeaderFields[dynT.length()-1-n].size()\n\t\tn++\n\t}\n\tdynT.evict(n)\n\treturn n > 0\n}", "title": "" }, { "docid": "895de6b39d8cd85fb764d37b2e372747", "score": "0.50605255", "text": "func (c *fileCache) removeElement(e *list.Element) {\n\tc.evictList.Remove(e)\n\tkv, ok := e.Value.(*entry)\n\tif ok {\n\t\tdelete(c.items, kv.key)\n\t\tc.sizeBytes -= sizeOfEntry(kv)\n\t\tsyscall.Unlink(kv.value)\n\t}\n}", "title": "" }, { "docid": "5d17f1fdc037fd9666579aa96fb6fb71", "score": "0.50577354", "text": "func (t *DeleteTask) run() {\n\tc := t.c\n\tif !c.EnableEvict() {\n\t\treturn\n\t}\n\tnode := t.node\n\tif node.inWindow() {\n\t\tc.accessOrderWindowDeque().Remove(node)\n\t\tc.windowWeightedSize -= node.weight\n\t} else if node.inMainProbation() {\n\t\tc.accessOrderProbationDeque().Remove(node)\n\t} else {\n\t\tc.accessOrderProtectedDeque().Remove(node)\n\t\tc.mainProtectedWeightedSize -= node.weight\n\t}\n}", "title": "" }, { "docid": "b8cc4a3a670334e949745e9959b959ce", "score": "0.5056853", "text": "func (ib *Buffer) evictFinalizedSegment(seg *Segment) *changepointspb.Segment {\n\tfor i, v := range ib.HotBuffer.Verdicts {\n\t\tif v.CommitPosition > int(seg.EndPosition) {\n\t\t\tib.HotBuffer.Verdicts = ib.HotBuffer.Verdicts[i:]\n\t\t\tbreak\n\t\t}\n\t}\n\tfor i, v := range ib.ColdBuffer.Verdicts {\n\t\tif v.CommitPosition > int(seg.EndPosition) {\n\t\t\tif i > 0 {\n\t\t\t\tib.IsColdBufferDirty = true\n\t\t\t}\n\t\t\tib.ColdBuffer.Verdicts = ib.ColdBuffer.Verdicts[i:]\n\t\t\tbreak\n\t\t}\n\t}\n\tresult := &changepointspb.Segment{\n\t\tState: changepointspb.SegmentState_FINALIZED,\n\t\tFinalizedCounts: seg.Counts,\n\t\tHasStartChangepoint: seg.HasStartChangepoint,\n\t\tStartPosition: seg.StartPosition,\n\t\tStartHour: seg.StartHour,\n\t\tEndPosition: seg.EndPosition,\n\t\tEndHour: seg.EndHour,\n\t\tStartPositionLowerBound_99Th: seg.StartPositionLowerBound99Th,\n\t\tStartPositionUpperBound_99Th: seg.StartPositionUpperBound99Th,\n\t\tMostRecentUnexpectedResultHour: seg.MostRecentUnexpectedResultHourAllVerdicts,\n\t}\n\treturn result\n}", "title": "" }, { "docid": "2874611b75493b7d1ee34249872b2d06", "score": "0.50405985", "text": "func freeEntry(d *Deployed) {\n\t// it's already idle, nothing to do\n\tif d.idle {\n\t\treturn\n\t}\n\t// it's not idle and not terminated, so keep it!\n\tif d.status != pb.DeploymentStatus_TERMINATED {\n\t\treturn\n\t}\n\n\t// it's too soon after process terminated, we keep it around for a bit\n\tif time.Since(d.finished) < (time.Duration(*idleReaper) * time.Second) {\n\t\treturn\n\t}\n\tif d.logger != nil {\n\t\td.logger.Flush()\n\t\td.logger = nil\n\t}\n\n\tos.RemoveAll(d.workingDir)\n\td.idle = true\n\tfmt.Printf(\"Reclaimed %s\\n\", d.toString())\n\n}", "title": "" }, { "docid": "213d9f73ca758ddc1091b69323bc16ec", "score": "0.50337684", "text": "func (self *LRU) removeElement(e *list.Element) {\n\tself.evictList.Remove(e)\n\tkv := e.Value.(*entry)\n\tdelete(self.items, kv.key)\n\tif self.onEvict != nil {\n\t\tself.onEvict(kv.key, kv.value)\n\t}\n}", "title": "" }, { "docid": "30e15083ea12f10749c71282bd1d9d15", "score": "0.50206333", "text": "func (c *postingsListLRUShard) removeOldest() {\n\tent := c.evictList.Back()\n\tif ent != nil {\n\t\tc.removeElement(ent)\n\t}\n}", "title": "" }, { "docid": "b1d55dfdf766918024105032b74a1136", "score": "0.50202817", "text": "func (br *BrokerBatchRows) EvictOutOfTimeRange(behind, ahead int64) (evicted int) {\n\t// check metric timestamp if in acceptable time range\n\tnow := fasttime.UnixMilliseconds()\n\tfor idx := 0; idx < br.Len(); idx++ {\n\t\tif (behind > 0 && br.rows[idx].m.Timestamp() < now-behind) ||\n\t\t\t(ahead > 0 && br.rows[idx].m.Timestamp() > now+ahead) {\n\t\t\tbr.rows[idx].IsOutOfTimeRange = true\n\t\t\tevicted++\n\t\t}\n\t}\n\treturn evicted\n}", "title": "" }, { "docid": "7897f3bcaf342e461461101cb9f1427d", "score": "0.5018695", "text": "func (cc *CollabCache) invalidate(key string) {\n\tif cc.isLocked(key) {\n\t\treturn\n\t}\n\n\tcc.lock.Lock(key)\n\tdefer cc.lock.Unlock(key)\n\n\t// Allow 10 ms for deletion - once deleted this doesn't matter\n\tif !cc.isLocked(key) && cc.tryLock(key, 10) {\n\t\t// Theoretically if it fell asleep we would have problem\n\t\tdelete(cc.cache, key)\n\t}\n}", "title": "" }, { "docid": "994d23e3832b9e6cc46dd7cbb7d38393", "score": "0.5015669", "text": "func (self *LRU) Purge() {\n\tself.mu.Lock()\n\tdefer self.mu.Unlock()\n\n\tfor k, v := range self.items {\n\t\tif self.onEvict != nil {\n\t\t\tself.onEvict(k, v.Value.(*entry).value)\n\t\t}\n\t\tdelete(self.items, k)\n\t}\n\tself.evictList.Init()\n}", "title": "" }, { "docid": "16413d7587e1f46e8f73636f12372fdf", "score": "0.5004351", "text": "func (mgr *adaptiveQueueManager) shouldSoftEvict(sqlhash int32) bool {\n\tif len(mgr.evictedSqlhash) == 0 {\n\t\tif logger.GetLogger().V(logger.Verbose) {\n\t\t\tlogger.GetLogger().Log(logger.Verbose, \"shouldsoftevict emptyhash true\")\n\t\t}\n\t\treturn false\n\t}\n\n\t//\n\t// random threshold.\n\t//\n\tprobability := GetConfig().SoftEvictionProbability\n\tif probability == 0 {\n\t\treturn false\n\t}\n\tif probability < 100 {\n\t\trandom := rand.Intn(100)\n\t\tif logger.GetLogger().V(logger.Verbose) {\n\t\t\tlogger.GetLogger().Log(logger.Verbose, \"shouldsoftevict probability >\", probability, random)\n\t\t}\n\t\tif random >= probability {\n\t\t\treturn false\n\t\t}\n\t}\n\t//\n\t// not on blacklist\n\t//\n\tlastEvictTime := mgr.evictedSqlhash[sqlhash]\n\tif logger.GetLogger().V(logger.Verbose) {\n\t\tlogger.GetLogger().Log(logger.Verbose, \"shouldsoftevict hashmatch >0\", lastEvictTime)\n\t}\n\tif lastEvictTime == 0 {\n\t\treturn false\n\t}\n\t//\n\t// sqlhash has been on blacklist for too long.\n\t//\n\tjailtime := int64(GetConfig().SoftEvictionEffectiveTimeMs)\n\tvar now = time.Now().UnixNano() / int64(time.Millisecond)\n\tif logger.GetLogger().V(logger.Verbose) {\n\t\tlogger.GetLogger().Log(logger.Verbose, \"shouldsoftevict jailtime >-\", lastEvictTime, now, jailtime)\n\t}\n\tif lastEvictTime < (now - jailtime) {\n\t\t//\n\t\t// remove from blacklist. next saturation recovery will pick and add a new slow sql.\n\t\t//\n\t\tdelete(mgr.evictedSqlhash, sqlhash)\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "6a94705ae6aef4a1b7b4f46406f8983b", "score": "0.49835837", "text": "func (lru *leastRecentlyUsedCache) callEvictAll() {\n\t// Record the head of the lru and then wipe everything clean.\n\tlru.mu.Lock()\n\thead := lru.head\n\tlru.head = nil\n\tlru.tail = nil\n\tlru.nodes = make(map[uint64]*leastRecentlyUsedCacheNode)\n\tlru.mu.Unlock()\n\n\t// Loop through the linked list and release every index.\n\tfor head != nil {\n\t\tlru.staticStreamBuffer.callRemoveDataSection(head.index)\n\t\thead = head.next\n\t}\n}", "title": "" }, { "docid": "c7dae5cf23f1755866d9d8c02856dcc8", "score": "0.49709606", "text": "func (c *cache) evictedKeyHandler(key, val interface{}) {\n\t// remove record in the client -> key mapping\n\tcVal, ok := val.(cacheVal)\n\tif !ok {\n\t\tpanic(\"]evictedKeyHandler] unpexpected type of cache value\")\n\t}\n\tc.ckm.del(cVal.clientID, key.(string))\n}", "title": "" }, { "docid": "abe36aa6fcb84510eb352025c625d37a", "score": "0.49629027", "text": "func (h *hostMemoryManager) TriggerEviction() {\n\tgo func() { h.evictionJobChan <- struct{}{} }()\n}", "title": "" }, { "docid": "b98d00da5a023918f595aed46d35c32b", "score": "0.4956872", "text": "func (eq *evictionQueue) pop() string {\n\tif eq.q.Len() > 0 {\n\t\treturn heap.Pop(&eq.q).(*evictionData).key\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "739e88a65916e848cb421a26e4ba8495", "score": "0.4953149", "text": "func (c *configCache) expire(key cacheKey) {\n\tlogrus.Infof(msgCacheExpire, fmt.Sprintf(\"%+v\", key))\n\n\tif entry, _ := c.syncMap.Load(key); entry != nil {\n\t\tentry.(*cacheEntry).ttl.Stop()\n\t\tc.syncMap.Delete(key)\n\t}\n}", "title": "" }, { "docid": "eba7bf9804796179a44e2ca370e7c2f6", "score": "0.49473688", "text": "func (cache *Cache) invalidator(invalTopic, appName string) {\n\tinvalSubName := invalTopic + \"-\" + appName\n\tinvalCh, _, err := cache.pubsub.Subscribe(invalTopic, invalSubName, pubsub.Fanout)\n\tif err != nil {\n\t\tlog.Fatal().Err(err).\n\t\t\tMsg(\"unable to subscribe to cache invalidation topic '\" + invalTopic + \"'\")\n\t}\n\n\tfor {\n\t\tidJSON := <-invalCh\n\t\tvar id string\n\t\terr := json.Unmarshal(idJSON, &id)\n\t\tif err != nil {\n\t\t\tlog.Error().Err(err).\n\t\t\t\tMsg(\"decoding cache invalidation message\")\n\t\t\tcontinue\n\t\t}\n\t\tcache.Delete(string(id))\n\t}\n}", "title": "" }, { "docid": "a9de923c619f4d1270dedd6b3070b1b4", "score": "0.49459556", "text": "func (c *LRUCache[T]) EvictableSize() Byte {\n\treturn c.evictableSize\n}", "title": "" }, { "docid": "86b9e6502ddaed63dc2c384b952afd4c", "score": "0.4941801", "text": "func (c *Container) removeElement(e *list.Element) {\n\tc.evictList.Remove(e)\n\titm := e.Value.(*item)\n\tdelete(c.elements, itm.key)\n}", "title": "" }, { "docid": "51aa44b4205f08fcc2affbcaa98546b5", "score": "0.49316165", "text": "func (m *Memory) removeExpired() int {\n\t// In mirror mode, don't expire any elements. This allows the cache to setup\n\t// a watch and expire elements as the events roll in.\n\tif m.Mirror {\n\t\treturn 0\n\t}\n\n\tremoved := 0\n\tnow := m.Clock().Now().UTC()\n\tfor {\n\t\tif len(*m.heap) == 0 {\n\t\t\tbreak\n\t\t}\n\t\titem := m.heap.PeekEl()\n\t\tif now.Before(item.Expires) {\n\t\t\tbreak\n\t\t}\n\t\tm.heap.PopEl()\n\t\tm.tree.Delete(item)\n\t\tm.Debugf(\"Removed expired %v %v item.\", string(item.Key), item.Expires)\n\t\tremoved++\n\n\t\tevent := backend.Event{\n\t\t\tType: types.OpDelete,\n\t\t\tItem: backend.Item{\n\t\t\t\tKey: item.Key,\n\t\t\t},\n\t\t}\n\t\tif !m.EventsOff {\n\t\t\tm.buf.Emit(event)\n\t\t}\n\t}\n\tif removed > 0 {\n\t\tm.Debugf(\"Removed %v expired items.\", removed)\n\t}\n\treturn removed\n}", "title": "" }, { "docid": "bd0eac69d1411b5a1afd2b89091dd4de", "score": "0.49304083", "text": "func (s *Seeker) invalidateDeployment(name string) {\n\tlog.Debugf(\"Invalidating cache for deployment (%s)\", name)\n\tc := s.vmcache\n\tdep, found := c.deployments[name]\n\tif !found {\n\t\tpanic(fmt.Sprintf(\"Tried to delete cache for unknown deployment: %s\", name))\n\t}\n\t//Delete each ip from the actual cache\n\tfor _, host := range dep.hosts {\n\t\tdelete(c.data, host)\n\t}\n\t//Delete the cache record for this deployment because it's not cached anymore\n\tdelete(c.deployments, name)\n}", "title": "" }, { "docid": "b6ca9782d7c373c57e6f0df77ef37d05", "score": "0.4911543", "text": "func (d *Desc) MaybeEvict() bool {\n\td.Lock()\n\tdefer d.Unlock()\n\n\tif d.C == nil {\n\t\treturn true\n\t}\n\tif d.rCnt != 0 {\n\t\treturn false\n\t}\n\tif d.ChunkLastTime == model.Earliest {\n\t\t// This must never happen.\n\t\tpanic(\"ChunkLastTime not populated for evicted chunk\")\n\t}\n\td.C = nil\n\tOps.WithLabelValues(Evict).Inc()\n\tatomic.AddInt64(&NumMemChunks, -1)\n\treturn true\n}", "title": "" }, { "docid": "58ff4fc544a16ca802c136c949fe5ea7", "score": "0.4885882", "text": "func (c *LRU[K, V]) SetEvictCallback(onEvict EvictCallback[K, V]) *LRU[K, V] {\n\tc.onEvict = onEvict\n\treturn c\n}", "title": "" }, { "docid": "5bfacd27e0f9e5eef592804e141ae8db", "score": "0.48840255", "text": "func (l *slruCache) remove(en *entry) *entry {\n\tif en.accessList == nil {\n\t\treturn nil\n\t}\n\tl.cache.delete(en)\n\tif en.listID == protectedSegment {\n\t\tl.protectedLs.Remove(en.accessList)\n\t} else {\n\t\tl.probationLs.Remove(en.accessList)\n\t}\n\ten.accessList = nil\n\treturn en\n}", "title": "" }, { "docid": "c589e81bdd0be5b85cb8750f70792629", "score": "0.48839283", "text": "func TestSigCacheAddEvictEntry(t *testing.T) {\n\t// Create a sigcache that can hold up to 100 entries.\n\tsigCacheSize := uint(100)\n\tsigCache, err := NewSigCache(sigCacheSize)\n\tif err != nil {\n\t\tt.Fatalf(\"error creating NewSigCache: %v\", err)\n\t}\n\n\t// Create test tx.\n\ttx := msgTx113875_1()\n\n\t// Fill the sigcache up with some random sig triplets.\n\tfor i := uint(0); i < sigCacheSize; i++ {\n\t\tmsg, sig, key := genRandomSig(t)\n\n\t\tsigCache.Add(*msg, sig, key, tx)\n\t\tsigCopy, _ := ecdsa.ParseDERSignature(sig.Serialize())\n\t\tkeyCopy, _ := secp256k1.ParsePubKey(key.SerializeCompressed())\n\t\tif !sigCache.Exists(*msg, sigCopy, keyCopy) {\n\t\t\tt.Errorf(\"previously added item not found in signature \" +\n\t\t\t\t\"cache\")\n\t\t}\n\t}\n\n\t// The sigcache should now have sigCacheSize entries within it.\n\tif uint(len(sigCache.validSigs)) != sigCacheSize {\n\t\tt.Fatalf(\"sigcache should now have %v entries, instead it has %v\",\n\t\t\tsigCacheSize, len(sigCache.validSigs))\n\t}\n\n\t// Add a new entry, this should cause eviction of a randomly chosen\n\t// previous entry.\n\tmsgNew, sigNew, keyNew := genRandomSig(t)\n\tsigCache.Add(*msgNew, sigNew, keyNew, tx)\n\n\t// The sigcache should still have sigCache entries.\n\tif uint(len(sigCache.validSigs)) != sigCacheSize {\n\t\tt.Fatalf(\"sigcache should now have %v entries, instead it has %v\",\n\t\t\tsigCacheSize, len(sigCache.validSigs))\n\t}\n\n\t// The entry added above should be found within the sigcache.\n\tsigNewCopy, _ := ecdsa.ParseDERSignature(sigNew.Serialize())\n\tkeyNewCopy, _ := secp256k1.ParsePubKey(keyNew.SerializeCompressed())\n\tif !sigCache.Exists(*msgNew, sigNewCopy, keyNewCopy) {\n\t\tt.Fatalf(\"previously added item not found in signature cache\")\n\t}\n}", "title": "" }, { "docid": "aed1402bda6956a28df20cc5a5f590ba", "score": "0.4883396", "text": "func (c *LRU[K, V]) Purge() {\n\tfor k, v := range c.items {\n\t\tif c.onEvict != nil {\n\t\t\tc.onEvict(k, v.Value.(*entry[K, V]).value)\n\t\t}\n\t\tdelete(c.items, k)\n\t}\n\tc.evictList.Init()\n}", "title": "" }, { "docid": "9aee17ca97766a39b62ff0a12e634a1e", "score": "0.488078", "text": "func (lctx *lructx) onelru(wg *sync.WaitGroup) {\n\tdefer wg.Done()\n\n\tlctx.heap = &fileInfoMinHeap{}\n\theap.Init(lctx.heap)\n\tif err := lctx.evictSize(); err != nil {\n\t\treturn\n\t}\n\tif lctx.totsize < minevict {\n\t\tglog.Infof(\"%s: below threshold, nothing to do\", lctx.bucketdir)\n\t\treturn\n\t}\n\tglog.Infof(\"%s: evicting %s\", lctx.bucketdir, cmn.B2S(lctx.totsize, 2))\n\n\tif err := filepath.Walk(lctx.bucketdir, lctx.walk); err != nil {\n\t\ts := err.Error()\n\t\tif strings.Contains(s, \"xaction\") {\n\t\t\tglog.Infof(\"%s: stopping traversal: %s\", lctx.bucketdir, s)\n\t\t} else {\n\t\t\tglog.Errorf(\"%s: failed to traverse, err: %v\", lctx.bucketdir, err)\n\t\t}\n\t\treturn\n\t}\n\tif err := lctx.evict(); err != nil {\n\t\tglog.Errorf(\"%s: failed to evict, err: %v\", lctx.bucketdir, err)\n\t}\n}", "title": "" }, { "docid": "a5c1d1201a32c7eca2704afa3a56b4e1", "score": "0.4867084", "text": "func ExampleLoadingCache_Delete() {\n\t// make expirable cache (30m TTL) with up to 10 keys. Set callback on eviction event\n\tc, err := NewExpirableCache(MaxKeys(10), TTL(time.Minute*30), OnEvicted(func(key string, value interface{}) {\n\t\tfmt.Println(\"key \" + key + \" evicted\")\n\t}))\n\tif err != nil {\n\t\tpanic(\"can' make cache\")\n\t}\n\tdefer c.Close()\n\n\t// try to get from cache and because mykey is not in will put it\n\t_, _ = c.Get(\"mykey\", func() (interface{}, error) {\n\t\treturn \"myval-1\", nil\n\t})\n\n\tc.Delete(\"mykey\")\n\tfmt.Println(\"stats: \" + c.Stat().String())\n\t// Output: key mykey evicted\n\t// stats: {hits:0, misses:1, ratio:0.00, keys:0, size:0, errors:0}\n}", "title": "" }, { "docid": "bfa1f6ef952f6cb1bd91be21e9bf761b", "score": "0.48623386", "text": "func (ts *timeSeriesStore) shouldBeEvicted() bool {\n\treturn ts.lastAccessedAt+(time.Duration(getTagsIDTTL())*time.Millisecond).Nanoseconds() < time.Now().UnixNano()\n}", "title": "" }, { "docid": "82d10a4618953d3ef4d34d260340573d", "score": "0.4862058", "text": "func (c *Container) Purge() {\n\tc.Lock()\n\tdefer c.Unlock()\n\tif c.opts.enableLRU {\n\t\tfor key := range c.elements {\n\t\t\tdelete(c.elements, key)\n\t\t}\n\t\tc.evictList.Init()\n\t} else {\n\t\tfor key := range c.items {\n\t\t\tdelete(c.items, key)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "61972f5144b1816878ecde9a84fae4ff", "score": "0.48521227", "text": "func (_obj *WCache) EraseKV(Req *RemoveKVReq, _opt ...map[string]string) (ret int32, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = Req.WriteBlock(_os, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\tctx := context.Background()\n\terr = _obj.s.Tars_invoke(ctx, 0, \"eraseKV\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\t_is := codec.NewReader(tools.Int8ToByte(_resp.SBuffer))\n\terr = _is.Read_int32(&ret, 0, true)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\t_obj.setMap(len(_opt), _resp, _context, _status)\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "title": "" }, { "docid": "07af9b35669fbc2fa9e20050efee396c", "score": "0.4838873", "text": "func TestSigCacheAddEvictEntry(t *testing.T) {\n\t// Create a sigcache that can hold up to 100 entries.\n\tsigCacheSize := uint(100)\n\tsigCache := NewSigCache(sigCacheSize)\n\n\t// Fill the sigcache up with some random sig triplets.\n\tfor i := uint(0); i < sigCacheSize; i++ {\n\t\tmsg, sig, key, err := genRandomSig()\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"unable to generate random signature test data\")\n\t\t}\n\n\t\tsigCache.Add(*msg, sig.Serialize(), key.SerializeCompressed())\n\n\t\tsigCopy, err := ecdsa.ParseSignature(sig.Serialize())\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"unable to parse sig: %v\", err)\n\t\t}\n\t\tkeyCopy, err := btcec.ParsePubKey(key.SerializeCompressed())\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"unable to parse key: %v\", err)\n\t\t}\n\t\tif !sigCache.Exists(*msg, sigCopy.Serialize(), keyCopy.SerializeCompressed()) {\n\t\t\tt.Errorf(\"previously added item not found in signature\" +\n\t\t\t\t\"cache\")\n\t\t}\n\t}\n\n\t// The sigcache should now have sigCacheSize entries within it.\n\tif uint(len(sigCache.validSigs)) != sigCacheSize {\n\t\tt.Fatalf(\"sigcache should now have %v entries, instead it has %v\",\n\t\t\tsigCacheSize, len(sigCache.validSigs))\n\t}\n\n\t// Add a new entry, this should cause eviction of a randomly chosen\n\t// previous entry.\n\tmsgNew, sigNew, keyNew, err := genRandomSig()\n\tif err != nil {\n\t\tt.Fatalf(\"unable to generate random signature test data\")\n\t}\n\tsigCache.Add(*msgNew, sigNew.Serialize(), keyNew.SerializeCompressed())\n\n\t// The sigcache should still have sigCache entries.\n\tif uint(len(sigCache.validSigs)) != sigCacheSize {\n\t\tt.Fatalf(\"sigcache should now have %v entries, instead it has %v\",\n\t\t\tsigCacheSize, len(sigCache.validSigs))\n\t}\n\n\t// The entry added above should be found within the sigcache.\n\tsigNewCopy, _ := ecdsa.ParseSignature(sigNew.Serialize())\n\tkeyNewCopy, _ := btcec.ParsePubKey(keyNew.SerializeCompressed())\n\tif !sigCache.Exists(*msgNew, sigNewCopy.Serialize(), keyNewCopy.SerializeCompressed()) {\n\t\tt.Fatalf(\"previously added item not found in signature cache\")\n\t}\n}", "title": "" }, { "docid": "bb29ed71bf9a7e07c6aaf24a1e9cef99", "score": "0.48323736", "text": "func (ib *Buffer) EvictionRange() (shouldEvict bool, endIndex int) {\n\tif len(ib.ColdBuffer.Verdicts) <= ib.ColdBufferCapacity {\n\t\treturn false, 0\n\t}\n\tif len(ib.HotBuffer.Verdicts) > 0 {\n\t\tpanic(\"hot buffer is not empty during eviction\")\n\t}\n\treturn true, len(ib.ColdBuffer.Verdicts) - ib.ColdBufferCapacity - 1\n}", "title": "" }, { "docid": "394743b04793a3803a3b493c8ee9d9ce", "score": "0.48282495", "text": "func (ib *Buffer) evictFinalizingSegment(endPos int, seg *Segment) (evicted *changepointspb.Segment, remaining *Segment) {\n\tevictedCount := segmentCounts(0, endPos, ib.ColdBuffer.Verdicts)\n\tremainingCount := segmentCounts(endPos+1, seg.EndIndex, ib.ColdBuffer.Verdicts)\n\tevictedMostRecentHour := mostRecentUnexpectedResultHour(0, endPos, ib.ColdBuffer.Verdicts)\n\tremainingMostRecentHour := mostRecentUnexpectedResultHour(endPos+1, seg.EndIndex, ib.ColdBuffer.Verdicts)\n\tib.ColdBuffer.Verdicts = ib.ColdBuffer.Verdicts[endPos+1:]\n\tib.IsColdBufferDirty = true\n\t// Evicted segment.\n\tevicted = &changepointspb.Segment{\n\t\tState: changepointspb.SegmentState_FINALIZING,\n\t\tFinalizedCounts: evictedCount,\n\t\tHasStartChangepoint: seg.HasStartChangepoint,\n\t\tStartPosition: seg.StartPosition,\n\t\tStartHour: seg.StartHour,\n\t\tMostRecentUnexpectedResultHour: evictedMostRecentHour,\n\t}\n\n\t// Remaining segment.\n\tremaining = &Segment{\n\t\tStartIndex: 0,\n\t\tEndIndex: seg.EndIndex - endPos - 1,\n\t\tCounts: remainingCount,\n\t\tEndPosition: seg.EndPosition,\n\t\tEndHour: seg.EndHour,\n\t\tMostRecentUnexpectedResultHourAllVerdicts: remainingMostRecentHour,\n\t}\n\n\treturn evicted, remaining\n}", "title": "" }, { "docid": "d34e51c5f167e1b268d2751058fb9c5c", "score": "0.48204497", "text": "func (c *LRU[K, V]) removeElement(e *list.Element) {\n\tc.evictList.Remove(e)\n\tkv := e.Value.(*entry[K, V])\n\tdelete(c.items, kv.key)\n\tif c.onEvict != nil {\n\t\tc.onEvict(kv.key, kv.value)\n\t}\n}", "title": "" }, { "docid": "9eab600618296c5a106db05ea1611b1e", "score": "0.481686", "text": "func (idx *Index) IsEvicted() bool {\n\treturn idx.evictedStatus != AllLoaded\n}", "title": "" }, { "docid": "f5302622e4d19a61bce44993aaaefaa5", "score": "0.48160255", "text": "func (be *CachedBlobEntry) invalidate(ctx context.Context) error {\n\tif err := be.invalidateInternal(ctx); err != nil {\n\t\tbe.mu.Lock()\n\t\tbe.validlen = 0\n\t\tbe.updateState(CacheEntryErrored)\n\t\tgo be.CloseWithLogErr(abandonAndClose)\n\t\tbe.progressCond.Broadcast()\n\t\tbe.mu.Unlock()\n\t\tif !cancellable.IsCancelledErr(err) {\n\t\t\tzap.S().Errorf(\"Failed to invalidate entry \\\"%s\\\". err: %v\", be.blobpath, err)\n\t\t}\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "628b33ceafd54fd0d3f4dbb14af94762", "score": "0.48001483", "text": "func (idx *Index) EvictAllStats() {\n\tidx.Histogram.Buckets = nil\n\tidx.CMSketch = nil\n\tidx.TopN = nil\n\tidx.StatsLoadedStatus.evictedStatus = AllEvicted\n}", "title": "" } ]
2ddf23bb6da4a0394bd2bb42615a1bce
/ GetDocumentDocumentIDHistoryfull gets document history Returns the history of a document.
[ { "docid": "45ead4bc674fe1dbf26e9f1379f55236", "score": "0.82483137", "text": "func (a *Client) GetDocumentDocumentIDHistoryfull(params *GetDocumentDocumentIDHistoryfullParams) (*GetDocumentDocumentIDHistoryfullOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetDocumentDocumentIDHistoryfullParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"GetDocumentDocumentIDHistoryfull\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/document/{document_id}/historyfull\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\", \"application/x-www-form-urlencoded\", \"multipart/form-data\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &GetDocumentDocumentIDHistoryfullReader{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.(*GetDocumentDocumentIDHistoryfullOK)\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 GetDocumentDocumentIDHistoryfull: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" } ]
[ { "docid": "21ccded7e86e818fd46323ec5957a236", "score": "0.5628118", "text": "func (db *Database) GetRevWithHistory(docid, revid string, maxHistory int, historyFrom []string, attachmentsSince []string, showExp bool) (Body, error) {\n\tvar doc *document\n\tvar body Body\n\tvar revisions Body\n\tvar inChannels base.Set\n\tvar err error\n\trevIDGiven := (revid != \"\")\n\tif revIDGiven {\n\t\t// Get a specific revision body and history from the revision cache\n\t\t// (which will load them if necessary, by calling revCacheLoader, above)\n\t\tbody, revisions, inChannels, err = db.revisionCache.Get(docid, revid)\n\t\tif body == nil {\n\t\t\tif err == nil {\n\t\t\t\terr = base.HTTPErrorf(404, \"missing\")\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t\tif maxHistory == 0 {\n\t\t\trevisions = nil\n\t\t}\n\t} else {\n\t\t// No rev ID given, so load doc and get its current revision:\n\t\tif doc, err = db.GetDoc(docid); doc == nil {\n\t\t\treturn nil, err\n\t\t}\n\t\trevid = doc.CurrentRev\n\t\tif body, err = db.getRevision(doc, revid); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif doc.hasFlag(channels.Deleted) {\n\t\t\tbody[\"_deleted\"] = true\n\t\t}\n\t\tif maxHistory != 0 {\n\t\t\trevisions = encodeRevisions(doc.History.getHistory(revid))\n\t\t}\n\t\tinChannels = doc.History[revid].Channels\n\t}\n\n\tif revisions != nil {\n\t\ttrimEncodedRevisionsToAncestor(revisions, historyFrom, maxHistory)\n\t}\n\n\t// Authorize the access:\n\tif db.user != nil {\n\t\tif err := db.user.AuthorizeAnyChannel(inChannels); err != nil {\n\t\t\tif !revIDGiven {\n\t\t\t\treturn nil, base.HTTPErrorf(403, \"forbidden\")\n\t\t\t}\n\t\t\t// On access failure, return (only) the doc history and deletion/removal\n\t\t\t// status instead of returning an error. For justification see the comment in\n\t\t\t// the getRevFromDoc method, below\n\t\t\tdeleted, _ := body[\"_deleted\"].(bool)\n\t\t\tredactedBody := Body{\"_id\": docid, \"_rev\": revid}\n\t\t\tif deleted {\n\t\t\t\tredactedBody[\"_deleted\"] = true\n\t\t\t} else {\n\t\t\t\tredactedBody[\"_removed\"] = true\n\t\t\t}\n\t\t\tif revisions != nil {\n\t\t\t\tredactedBody[\"_revisions\"] = revisions\n\t\t\t}\n\t\t\treturn redactedBody, nil\n\t\t}\n\t}\n\n\tif !revIDGiven {\n\t\tif deleted, _ := body[\"_deleted\"].(bool); deleted {\n\t\t\treturn nil, base.HTTPErrorf(404, \"deleted\")\n\t\t}\n\t}\n\n\t// Add revision metadata:\n\tif revisions != nil {\n\t\tbody[\"_revisions\"] = revisions\n\t}\n\n\tif showExp {\n\t\t// If doc is nil (we got the rev from the rev cache), look up the doc to find the exp on the doc\n\t\tif doc == nil {\n\t\t\tif doc, err = db.GetDoc(docid); doc == nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\tif doc.Expiry != nil && !doc.Expiry.IsZero() {\n\t\t\tbody[\"_exp\"] = doc.Expiry.Format(time.RFC3339)\n\t\t}\n\t}\n\n\t// Add attachment bodies:\n\tif attachmentsSince != nil && len(BodyAttachments(body)) > 0 {\n\t\tminRevpos := 1\n\t\tif len(attachmentsSince) > 0 {\n\t\t\tif doc == nil { // if rev was in the cache, we don't have the document struct yet\n\t\t\t\tif doc, err = db.GetDoc(docid); doc == nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t}\n\t\t\tancestor := doc.History.findAncestorFromSet(revid, attachmentsSince)\n\t\t\tif ancestor != \"\" {\n\t\t\t\tminRevpos, _ = ParseRevID(ancestor)\n\t\t\t\tminRevpos++\n\t\t\t}\n\t\t}\n\t\tbody, err = db.loadBodyAttachments(body, minRevpos)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn body, nil\n}", "title": "" }, { "docid": "d767f9ac4d8464e568f6d071f25e459b", "score": "0.55876714", "text": "func (d *HistoryReader) GetHistory() []byte {\n\thistory := make([]byte,d.size)\n\tbeginning := d.end + d.capacity - d.size\n\tfor i:=uint(0); i<d.size; i++ {\n\t\thistory[i] = d.buffer[(beginning+i)%d.capacity]\n\t}\n\treturn history\n}", "title": "" }, { "docid": "6e7089fe915010fca4bd503a9e754c36", "score": "0.5504637", "text": "func (f *UploadsServiceGetUploadDocumentsForPathFunc) History() []UploadsServiceGetUploadDocumentsForPathFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]UploadsServiceGetUploadDocumentsForPathFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "a2f21090c66c0667d2159ac000b47c01", "score": "0.5372677", "text": "func (f *AutoIndexingServiceGetIndexByIDFunc) History() []AutoIndexingServiceGetIndexByIDFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]AutoIndexingServiceGetIndexByIDFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "7e374b9c783dd6e391f40bf749c8e812", "score": "0.531813", "text": "func (f *OrgStoreGetByIDFunc) History() []OrgStoreGetByIDFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]OrgStoreGetByIDFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "10fc50abac362e683b583aab93e95285", "score": "0.53112525", "text": "func (f *AccessTokenStoreGetByIDFunc) History() []AccessTokenStoreGetByIDFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]AccessTokenStoreGetByIDFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "15fd06fee69b742795d318c2fb038005", "score": "0.5304035", "text": "func (f *SearchContextsStoreGetSearchContextRepositoryRevisionsFunc) History() []SearchContextsStoreGetSearchContextRepositoryRevisionsFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]SearchContextsStoreGetSearchContextRepositoryRevisionsFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "354ccbc13791b76ee9babc41657fb430", "score": "0.52514136", "text": "func (f *AutoIndexingServiceGetUnsafeDBFunc) History() []AutoIndexingServiceGetUnsafeDBFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]AutoIndexingServiceGetUnsafeDBFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "f782d6fbde6a26a7a075d3570030d317", "score": "0.52503866", "text": "func (in RevisionHistories) LastRevisionHistory() RevisionHistory {\n\treturn in[len(in)-1]\n}", "title": "" }, { "docid": "60f1d3b12e526e9a0eb14bfaf6118b37", "score": "0.52335584", "text": "func (f *AutoIndexingServiceGetIndexesByIDsFunc) History() []AutoIndexingServiceGetIndexesByIDsFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]AutoIndexingServiceGetIndexesByIDsFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "13148ec823276f37b4b988d2f5eafeb1", "score": "0.52117276", "text": "func (f *SearchContextsStoreCreateSearchContextWithRepositoryRevisionsFunc) History() []SearchContextsStoreCreateSearchContextWithRepositoryRevisionsFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]SearchContextsStoreCreateSearchContextWithRepositoryRevisionsFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "d0b4ef0f61d2d719a8512c0296ede8c3", "score": "0.52055675", "text": "func (f *LSIFStoreReferencesFunc) History() []LSIFStoreReferencesFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]LSIFStoreReferencesFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "479bf21988510d2ae7e2f9f213689c06", "score": "0.5186979", "text": "func (s mongoStg) HistoryGet(ctx context.Context, profid string) ([]*model.Change, error) {\n\t// check permissions\n\tif err := requestAccess(ctx, profid); err != nil {\n\t\treturn nil, err\n\t}\n\n\tchanges := &ChangesDB{}\n\terr := s.getByID(ctx, profid, changes, confirm(nil))\n\treturn changes.Model(), err\n}", "title": "" }, { "docid": "714924d46d44dcc02a349b37a7695bd8", "score": "0.5153274", "text": "func (f *SearchContextsStoreSetSearchContextRepositoryRevisionsFunc) History() []SearchContextsStoreSetSearchContextRepositoryRevisionsFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]SearchContextsStoreSetSearchContextRepositoryRevisionsFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "f865961009d29d7c53dd2f65dafd3ab3", "score": "0.514728", "text": "func (f *ExternalServiceStoreGetByIDFunc) History() []ExternalServiceStoreGetByIDFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]ExternalServiceStoreGetByIDFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "dfe4b041d8991d2caa78b6b93f9552cd", "score": "0.5146584", "text": "func GetHistoryByLabelID(ctx context.Context, labelID string) ([]*model.LabelRevisionDoc, error) {\n\tctx, cancel := context.WithTimeout(ctx, db.Timeout)\n\tdefer cancel()\n\tfilter := bson.M{\"label_id\": labelID}\n\treturn getHistoryByLabelID(ctx, filter)\n}", "title": "" }, { "docid": "4bc97c40ace919627ed365251ec29a39", "score": "0.5137099", "text": "func (f *SearchContextsStoreUpdateSearchContextWithRepositoryRevisionsFunc) History() []SearchContextsStoreUpdateSearchContextWithRepositoryRevisionsFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]SearchContextsStoreUpdateSearchContextWithRepositoryRevisionsFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "116fc54c9e571a8bddbb673e64e02283", "score": "0.51097876", "text": "func (f *DBStoreGetDumpByIDFunc) History() []DBStoreGetDumpByIDFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]DBStoreGetDumpByIDFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "ab05e83a3b041a9c7e8e9b150cc63109", "score": "0.51052326", "text": "func (f *DBStoreGetOldestCommitDateFunc) History() []DBStoreGetOldestCommitDateFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]DBStoreGetOldestCommitDateFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "d40441d61d9c4e92d327ad2503057f5e", "score": "0.50942004", "text": "func (f *UserCredentialsStoreGetByIDFunc) History() []UserCredentialsStoreGetByIDFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]UserCredentialsStoreGetByIDFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "615666df3c186345278f936f3032db9f", "score": "0.50935805", "text": "func (f *SearchContextsStoreGetAllRevisionsForReposFunc) History() []SearchContextsStoreGetAllRevisionsForReposFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]SearchContextsStoreGetAllRevisionsForReposFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "3bd1d216e7be9e99ca2c49169181c838", "score": "0.5077491", "text": "func (f *OrgStoreHandleFunc) History() []OrgStoreHandleFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]OrgStoreHandleFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "cbd77db3d4cc8d21b2b9875c450ac74d", "score": "0.5040969", "text": "func (c *Client) History() goa.Endpoint {\n\tvar (\n\t\tencodeRequest = EncodeHistoryRequest(c.encoder)\n\t\tdecodeResponse = DecodeHistoryResponse(c.decoder, c.RestoreResponseBody)\n\t)\n\treturn func(ctx context.Context, v interface{}) (interface{}, error) {\n\t\treq, err := c.BuildHistoryRequest(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.HistoryDoer.Do(req)\n\t\tif err != nil {\n\t\t\treturn nil, goahttp.ErrRequestError(\"ChronosAPI\", \"history\", err)\n\t\t}\n\t\treturn decodeResponse(resp)\n\t}\n}", "title": "" }, { "docid": "faf0cfea0cd010345ff54f4a3bc1768d", "score": "0.50131834", "text": "func (f *AccessTokenStoreHardDeleteByIDFunc) History() []AccessTokenStoreHardDeleteByIDFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]AccessTokenStoreHardDeleteByIDFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "afbfee27fc6f68ed396077eb3260dfc1", "score": "0.50083345", "text": "func getHistory(id string, db *bolt.DB) ([]Entry, error) {\n\thistory := []Entry{}\n\thistoryBytes, err := getDataBytes(id, \"history\", db)\n\tjson.Unmarshal(historyBytes, &history)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn history, nil\n}", "title": "" }, { "docid": "033f5c0dc70a0d5ce6f780c0c8f2f1a6", "score": "0.50073874", "text": "func (f *SearchContextsStoreHandleFunc) History() []SearchContextsStoreHandleFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]SearchContextsStoreHandleFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "0cfef1d99bba41fefaa402e071ca6e14", "score": "0.49963346", "text": "func (f *AccessTokenStoreDeleteByIDFunc) History() []AccessTokenStoreDeleteByIDFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]AccessTokenStoreDeleteByIDFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "ebf6b31b7927f7d14afa713038a7ec27", "score": "0.49901184", "text": "func (f *SearchContextsStoreGetSearchContextFunc) History() []SearchContextsStoreGetSearchContextFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]SearchContextsStoreGetSearchContextFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "9a4aff067fc47c02a8f761b3853227f8", "score": "0.499006", "text": "func (f *AccessTokenStoreHandleFunc) History() []AccessTokenStoreHandleFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]AccessTokenStoreHandleFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "6d6f02b1b5fed730f06917e35baa39f9", "score": "0.49624172", "text": "func (f *DBStoreGetIndexesFunc) History() []DBStoreGetIndexesFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]DBStoreGetIndexesFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "02770aee8f9ba000ad2f61846654bb52", "score": "0.4944515", "text": "func (f *AutoIndexingServiceGetIndexesFunc) History() []AutoIndexingServiceGetIndexesFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]AutoIndexingServiceGetIndexesFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "a4efb959e98b4289ba0e257f26568ef1", "score": "0.49434283", "text": "func (p *Proxy) GetHistory(w http.ResponseWriter, r *http.Request) {\n\n\tticker := r.URL.Query().Get(av.QuerySymbol)\n\tif ticker == \"\" {\n\t\thttp.Error(w, \"ticker required\", http.StatusBadRequest)\n\t\treturn\n\t}\n\n\t// Get record from db\n\titem, err := p.db.Get(ticker)\n\tif err != nil {\n\t\tif err == mgo.ErrNotFound {\n\t\t\tw.WriteHeader(http.StatusNotFound)\n\t\t\tw.Write([]byte(\"No history for \" + ticker))\n\t\t\tp.lg.Info(\"Return no history\", zap.Error(err), zap.String(\"ticker\", ticker))\n\t\t} else {\n\t\t\thttp.Error(w, \"Internal server error\", http.StatusInternalServerError)\n\t\t\t// p.lg.Error(\"Return err to client\", zap.Error(err), zap.String(\"ticker\", ticker))\n\t\t\tCaptureError(err, sentry.LevelError, p.lg, map[string]interface{}{\"ticker\": ticker})\n\t\t}\n\t\treturn\n\t}\n\n\t// Send history to client\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tfor _, i := range item.Ohlcv {\n\t\tw.Write(i.Data)\n\t}\n\tw.WriteHeader(http.StatusOK)\n}", "title": "" }, { "docid": "47fc61b57ff9a4769e3efc98b922fd17", "score": "0.49184045", "text": "func (c *ChatManager) History(numLines int) []byte {\n\treturn c.history.messages(numLines)\n}", "title": "" }, { "docid": "eb52a42e64fc65c1391f641cc638b48d", "score": "0.4910417", "text": "func (f *OrgStoreGetByUserIDFunc) History() []OrgStoreGetByUserIDFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]OrgStoreGetByUserIDFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "9b473ed8702de6e2c07d2284bdbb5a4e", "score": "0.49018523", "text": "func (db Database) GetDocRev(id string) *string {\n req, err := db.couch.newRequest(\"HEAD\", db.Name + \"/\" + id, nil)\n if err != nil {\n log.Println(\"[ERROR]\", err)\n return nil\n }\n\tif db.couch.client.Jar != nil {\n\t\tfor _, cookie := range db.couch.client.Jar.Cookies(req.URL) {\n\t\t\treq.AddCookie(cookie)\n\t\t}\n\t}\n // send the request\n resp, err := db.couch.client.Do(req)\n if err != nil {\n log.Println(\"[ERROR]\", err)\n return nil\n } else if err == nil && db.couch.client.Jar != nil {\n\t\tdb.couch.client.Jar.SetCookies(req.URL, resp.Cookies())\n\t}\n // don't forget to close the bodies\n if req.Body != nil {\n defer req.Body.Close()\n }\n defer resp.Body.Close()\n\n // the Etag header contains the revision\n etag := resp.Header[\"Etag\"]\n if len(etag) > 0 {\n return &etag[0]\n }\n\n return nil\n}", "title": "" }, { "docid": "e80ed34a0e3b5760d11d71daa8b9e084", "score": "0.49002805", "text": "func (f *AccessTokenStoreLookupFunc) History() []AccessTokenStoreLookupFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]AccessTokenStoreLookupFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "8b2d91a0bd0937dd4c6d5764be3ec5d3", "score": "0.4882405", "text": "func (f *SearchContextsStoreDeleteSearchContextFunc) History() []SearchContextsStoreDeleteSearchContextFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]SearchContextsStoreDeleteSearchContextFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "527a66c795d3261e2dff5f8f2fe10f14", "score": "0.48814964", "text": "func (r *repository) GetJobHistory(ctx context.Context, id uint64) (*models.JobHistory, error) {\n\tm := models.JobHistory{ID: id}\n\terr := r.DB.WithContext(ctx).Model(&m).Where(filJobID, id).\n\t\tRelation(\"Company\").\n\t\tRelation(\"Department\").\n\t\tFirst()\n\t//pg returns error when no rows in the result set\n\tif err == pg.ErrNoRows {\n\t\treturn nil, nil\n\t}\n\treturn &m, err\n}", "title": "" }, { "docid": "a36f6c1453b148878923ef059623ce2f", "score": "0.486727", "text": "func (f *AutoIndexingServiceRepositoryIDsWithConfigurationFunc) History() []AutoIndexingServiceRepositoryIDsWithConfigurationFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]AutoIndexingServiceRepositoryIDsWithConfigurationFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "090aedd1672db26df35ca1e0948b4d08", "score": "0.48552212", "text": "func GetLastDocument(ctx context.Context, api *eos.API, contract eos.AccountName) (Document, error) {\n\tvar docs []Document\n\tvar request eos.GetTableRowsRequest\n\trequest.Code = string(contract)\n\trequest.Scope = string(contract)\n\trequest.Table = \"documents\"\n\trequest.Reverse = true\n\trequest.Limit = 1\n\trequest.JSON = true\n\tresponse, err := api.GetTableRows(ctx, request)\n\tif err != nil {\n\t\tlog.Println(\"Error with GetTableRows: \", err)\n\t\treturn Document{}, err\n\t}\n\n\terr = response.JSONToStructs(&docs)\n\tif err != nil {\n\t\tlog.Println(\"Error with JSONToStructs: \", err)\n\t\treturn Document{}, err\n\t}\n\treturn docs[0], nil\n}", "title": "" }, { "docid": "666d70687e6abb1e69f43d7e92250aef", "score": "0.485229", "text": "func (f *DBStorePackageReferencePagerFunc) History() []DBStorePackageReferencePagerFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]DBStorePackageReferencePagerFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "6a0b858d4095bceee27ff22fd1815d4e", "score": "0.48424593", "text": "func (f *GitserverClientRefDescriptionsFunc) History() []GitserverClientRefDescriptionsFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]GitserverClientRefDescriptionsFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "6a0b858d4095bceee27ff22fd1815d4e", "score": "0.48424593", "text": "func (f *GitserverClientRefDescriptionsFunc) History() []GitserverClientRefDescriptionsFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]GitserverClientRefDescriptionsFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "fc0cf5d92aa97e743b1342a0664bdda1", "score": "0.48344034", "text": "func (f *GitserverClientResolveRevisionFunc) History() []GitserverClientResolveRevisionFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]GitserverClientResolveRevisionFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "afc2e75d2ced48b70e2b04722dff55ae", "score": "0.48193985", "text": "func (f *WorkerStoreHandleFunc) History() []WorkerStoreHandleFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]WorkerStoreHandleFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "807ef8c67f775620453193e7f73f8127", "score": "0.48146075", "text": "func (f *DBStoreHasCommitFunc) History() []DBStoreHasCommitFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]DBStoreHasCommitFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "f55fc040900407684f4d6211ac188ade", "score": "0.4814098", "text": "func (c *RestChannel) History(params *PaginateParams) (*PaginatedResult, error) {\n\tpath := c.baseURL + \"/history\"\n\trst, err := newPaginatedResult(c.options, paginatedRequest{typ: msgType, path: path, params: params, query: query(c.client.get), logger: c.logger(), respCheck: checkValidHTTPResponse})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn rst, nil\n}", "title": "" }, { "docid": "3bb73aab7c48f10c21a2aaa20a919ce4", "score": "0.48134285", "text": "func (f *DBStoreHasRepositoryFunc) History() []DBStoreHasRepositoryFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]DBStoreHasRepositoryFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "f650979c48bd0f0bfd013eb98eaa1421", "score": "0.48130053", "text": "func (f *OrgStoreDeleteFunc) History() []OrgStoreDeleteFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]OrgStoreDeleteFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "0bfa526df8a0b01ed4effc5dd7ed99a3", "score": "0.4807714", "text": "func (f *AccessTokenStoreCreateFunc) History() []AccessTokenStoreCreateFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]AccessTokenStoreCreateFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "d3e10231b72490675485075c684c0b47", "score": "0.48061606", "text": "func (s *SmartContract) clientHistory(APIstub shim.ChaincodeStubInterface, args []string) sc.Response {\n\n\tresultsIterator, err := APIstub.GetHistoryForKey(args[0])\n\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\tdefer resultsIterator.Close()\n\n\tvar buffer bytes.Buffer\n\tbuffer.WriteString(\"[\")\n\n\tbArrayMemberAlreadyWritten := false\n\n\tfor resultsIterator.HasNext() {\n\n\t\tqueryResponse, err := resultsIterator.Next()\n\t\tif err != nil {\n\t\t\treturn shim.Error(err.Error())\n\t\t}\n\t\tif bArrayMemberAlreadyWritten == true {\n\t\t\tbuffer.WriteString(\",\")\n\t\t}\n\n\t\tjson.Marshal(queryResponse)\n\n\t\t// Some extra historical fields\n\t\tbuffer.WriteString(\"{\\\"TxId\\\":\")\n\t\tbuffer.WriteString(\"\\\"\")\n\t\tbuffer.WriteString(string(queryResponse.TxId))\n\t\tbuffer.WriteString(\"\\\"\")\n\t\tbuffer.WriteString(\",\\\"TxTS\\\":\")\n\t\tbuffer.WriteString(\"\\\"\")\n\t\tbuffer.WriteString(time.Unix(queryResponse.Timestamp.Seconds, 0).Format(time.RFC3339))\n\t\tbuffer.WriteString(\"\\\"\")\n\t\tbuffer.WriteString(\",\\\"IsDelete\\\":\")\n\t\tbuffer.WriteString(strconv.FormatBool(queryResponse.IsDelete))\n\n\t\t// Record the body of JSON object, so we write as-is\n\t\tbuffer.WriteString(\", \\\"Record\\\":\")\n\t\tbuffer.WriteString(string(queryResponse.Value))\n\n\t\tbuffer.WriteString(\"}\")\n\n\t\tbArrayMemberAlreadyWritten = true\n\t}\n\tbuffer.WriteString(\"]\")\n\n\tfmt.Printf(\"- historyClient:\\n%s\\n\", buffer.String())\n\n\treturn shim.Success(buffer.Bytes())\n}", "title": "" }, { "docid": "53ea43e88cdec75efeed51b2a1b805f2", "score": "0.47999594", "text": "func (f *LSIFStoreRangesFunc) History() []LSIFStoreRangesFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]LSIFStoreRangesFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "1d3e76bc1da74ced7e1d06aec46318df", "score": "0.47960082", "text": "func (f *PhabricatorStoreHandleFunc) History() []PhabricatorStoreHandleFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]PhabricatorStoreHandleFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "4765e852822f69a5d414e28d7ef6becc", "score": "0.47920272", "text": "func (db *DB) GetDocumentRev(id string) (string, error) {\n\treturn db.Rev(id)\n}", "title": "" }, { "docid": "398d796bebce1cb9d5ac3e1f88b10cca", "score": "0.47875935", "text": "func (f *AccessTokenStoreGetByTokenFunc) History() []AccessTokenStoreGetByTokenFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]AccessTokenStoreGetByTokenFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "cec05e948e150d372b1abff334a4c25e", "score": "0.47842732", "text": "func (f *UserCredentialsStoreHandleFunc) History() []UserCredentialsStoreHandleFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]UserCredentialsStoreHandleFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "221de8327f79bc425825315a1b27093d", "score": "0.4782816", "text": "func (f *UserCredentialsStoreGetByScopeFunc) History() []UserCredentialsStoreGetByScopeFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]UserCredentialsStoreGetByScopeFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "ef91b412161d4fb876899855cb278575", "score": "0.47767204", "text": "func (db *Database) Get(docid string) (Body, error) {\n\treturn db.GetRevWithHistory(docid, \"\", 0, nil, nil, false)\n}", "title": "" }, { "docid": "b9996000f47e22b7581a3b00fb786fe1", "score": "0.47651434", "text": "func GetAndAddHistory(ctx context.Context,\n\tlabelID string, labels map[string]string, kvs []*model.KVDoc, domain string, project string) (int, error) {\n\tctx, cancel := context.WithTimeout(ctx, db.Timeout)\n\tdefer cancel()\n\tr, err := label.GetLatestLabel(ctx, labelID)\n\tif err != nil {\n\t\tif err == db.ErrRevisionNotExist {\n\t\t\topenlogging.Warn(fmt.Sprintf(\"label revision not exists, create first label revision\"))\n\t\t\tr = &model.LabelRevisionDoc{\n\t\t\t\tLabelID: labelID,\n\t\t\t\tLabels: labels,\n\t\t\t\tDomain: domain,\n\t\t\t\tRevision: 0,\n\t\t\t}\n\t\t} else {\n\t\t\topenlogging.Error(fmt.Sprintf(\"get latest [%s] in [%s],err: %s\",\n\t\t\t\tlabelID, domain, err.Error()))\n\t\t\treturn 0, err\n\t\t}\n\n\t}\n\tr.Revision, err = AddHistory(ctx, r, labelID, kvs)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treturn r.Revision, nil\n}", "title": "" }, { "docid": "4b926da9a5372e90e61bc9354c7668cc", "score": "0.47528628", "text": "func (f *OrgStoreCountFunc) History() []OrgStoreCountFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]OrgStoreCountFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "8ab53a9d07251241377cd1edd56679f7", "score": "0.47492656", "text": "func (f *OrgStoreCreateFunc) History() []OrgStoreCreateFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]OrgStoreCreateFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "4e74e252c9e6d44e81e99f2bef659655", "score": "0.47481304", "text": "func (f *DBStoreRepoNameFunc) History() []DBStoreRepoNameFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]DBStoreRepoNameFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "f75da6598a4703aa24397291fd11fcab", "score": "0.47475535", "text": "func (f *DBStoreGetPackageFunc) History() []DBStoreGetPackageFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]DBStoreGetPackageFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "1b0afe81030d0c2daa6214de490f98ba", "score": "0.47471905", "text": "func (f *LSIFStoreDefinitionsFunc) History() []LSIFStoreDefinitionsFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]LSIFStoreDefinitionsFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "826293c0d671fac7916c1741e949dbb3", "score": "0.4741216", "text": "func (f *AccessTokenStoreCreateInternalFunc) History() []AccessTokenStoreCreateInternalFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]AccessTokenStoreCreateInternalFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "4df75d0439515df894115b2501566647", "score": "0.47399303", "text": "func (f *AccessTokenStoreCountFunc) History() []AccessTokenStoreCountFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]AccessTokenStoreCountFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "3630c70dbe0bdf4a7b70449cee03b0a1", "score": "0.47381333", "text": "func (c *immuClient) History(ctx context.Context, req *schema.HistoryRequest) (sl *schema.Entries, err error) {\n\tif !c.IsConnected() {\n\t\treturn nil, errors.FromError(ErrNotConnected)\n\t}\n\n\tstart := time.Now()\n\tdefer c.Logger.Debugf(\"history finished in %s\", time.Since(start))\n\n\treturn c.ServiceClient.History(ctx, req)\n}", "title": "" }, { "docid": "34350d6fb259e2207a96d8dc3cc7eb20", "score": "0.4737452", "text": "func (f *OrgStoreUpdateFunc) History() []OrgStoreUpdateFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]OrgStoreUpdateFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "2e3231eab49b480a3be2269a9129de4f", "score": "0.4729555", "text": "func (r *ClientService) History(clientId string) *ClientHistoryCall {\n\tc := &ClientHistoryCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.urlParams_.Set(\"clientId\", clientId)\n\treturn c\n}", "title": "" }, { "docid": "eaebadebc1cc6a864c9678437801aec1", "score": "0.47285408", "text": "func (f *SearchContextsStoreCountSearchContextsFunc) History() []SearchContextsStoreCountSearchContextsFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]SearchContextsStoreCountSearchContextsFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "08fe12c88c83147231bba228a56f15e1", "score": "0.471879", "text": "func (app *Application) History(pk ProjectKey, ch Channel) ([]Message, error) {\n\n\tif string(ch) == \"\" {\n\t\treturn []Message{}, ErrInvalidMessage\n\t}\n\n\tchOpts, err := app.channelOpts(pk, ch)\n\tif err != nil {\n\t\treturn []Message{}, err\n\t}\n\n\tif chOpts.HistorySize <= 0 || chOpts.HistoryLifetime <= 0 {\n\t\treturn []Message{}, ErrNotAvailable\n\t}\n\n\tchID := app.channelID(pk, ch)\n\n\thistory, err := app.engine.history(chID)\n\tif err != nil {\n\t\treturn []Message{}, ErrInternalServerError\n\t}\n\treturn history, nil\n}", "title": "" }, { "docid": "e657a96b2a2f9d31ce2b46b0bdcafacd", "score": "0.47171456", "text": "func GetHistoryForKey(stub shim.ChaincodeStubInterface, key string) (*bytes.Buffer, error) {\n\thistoryIterator, err := stub.GetHistoryForKey(key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer historyIterator.Close()\n\n\t// buffer is a JSON array containing historic values for the key\n\tvar buffer bytes.Buffer\n\tbuffer.WriteString(\"[\")\n\n\tbArrayMemberAlreadyWritten := false\n\tfor historyIterator.HasNext() {\n\t\tvar response *queryresult.KeyModification\n\t\tresponse, err = historyIterator.Next()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\t// Add a comma before array members, suppress it for the first array member\n\t\tif bArrayMemberAlreadyWritten == true {\n\t\t\tbuffer.WriteString(\",\")\n\t\t}\n\t\tbuffer.WriteString(\"{\\\"TxId\\\":\")\n\t\tbuffer.WriteString(\"\\\"\")\n\t\tbuffer.WriteString(response.TxId)\n\t\tbuffer.WriteString(\"\\\"\")\n\n\t\t// If it was a delete operation on a given key, then there is no value on the key anymore.\n\t\t// So only write the response.Value as-is when it was not a delete operation.\n\t\tif !response.IsDelete {\n\t\t\tbuffer.WriteString(\", \\\"Value\\\":\")\n\t\t\tbuffer.WriteString(string(response.Value))\n\t\t}\n\n\t\tbuffer.WriteString(\", \\\"Timestamp\\\":\")\n\t\tbuffer.WriteString(\"\\\"\")\n\t\tbuffer.WriteString(time.Unix(response.Timestamp.Seconds, int64(response.Timestamp.Nanos)).String())\n\t\tbuffer.WriteString(\"\\\"\")\n\n\t\tbuffer.WriteString(\", \\\"IsDelete\\\":\")\n\t\tbuffer.WriteString(\"\\\"\")\n\t\tbuffer.WriteString(strconv.FormatBool(response.IsDelete))\n\t\tbuffer.WriteString(\"\\\"\")\n\n\t\tbuffer.WriteString(\"}\")\n\t\tbArrayMemberAlreadyWritten = true\n\t}\n\tbuffer.WriteString(\"]\")\n\n\treturn &buffer, nil\n}", "title": "" }, { "docid": "cd6169c2a8df9bdd92531a1778ee08c5", "score": "0.47054005", "text": "func (f *StoreVersionFunc) History() []StoreVersionFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]StoreVersionFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "2ab0438a2a37461f22e9fed2b30a3f10", "score": "0.47035176", "text": "func (f *GitserverClientCommitDateFunc) History() []GitserverClientCommitDateFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]GitserverClientCommitDateFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "780e7d297adef2a01715ba63474905c7", "score": "0.46998477", "text": "func (r *checkImpl) History(p schema.CheckHistoryFieldResolverParams) (interface{}, error) {\n\tcheck := p.Source.(*types.Check)\n\thistory := check.History\n\n\tlength := clampInt(p.Args.First, 0, len(history))\n\treturn history[0:length], nil\n}", "title": "" }, { "docid": "05fd50a247cf8b001f0f8bcc9c82dd58", "score": "0.46987626", "text": "func (f *SearchContextsStoreDoneFunc) History() []SearchContextsStoreDoneFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]SearchContextsStoreDoneFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "4f0e921585c73c20074ea0a372f7070a", "score": "0.46931732", "text": "func (f *OrgStoreGetOrgsWithRepositoriesByUserIDFunc) History() []OrgStoreGetOrgsWithRepositoriesByUserIDFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]OrgStoreGetOrgsWithRepositoriesByUserIDFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "bead0af308f368c8097f9709ed35e1f6", "score": "0.46888772", "text": "func Get(searchInterface *search.Searcher) (*History, error) {\n\tc, err := searchInterface.GetTotalHistoryCount()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\thc, err := searchInterface.QueryHistory(c)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\th := History{IUpdateHistoryEntryCollection: hc}\n\n\tcount, err := h.Count()\n\tif err != nil {\n\t\th.Close()\n\t\treturn nil, err\n\t}\n\n\th.Entries = make([]*Entry, 0)\n\tfor i := 0; i < count; i++ {\n\t\titem, err := oleutil.GetProperty(h.IUpdateHistoryEntryCollection, \"item\", i)\n\t\tif err != nil {\n\t\t\th.Close()\n\t\t\treturn nil, err\n\t\t}\n\t\titemd := item.ToIDispatch()\n\n\t\tuh, err := New(itemd)\n\t\tif err != nil {\n\t\t\titemd.Release()\n\t\t\th.Close()\n\t\t\treturn nil, fmt.Errorf(\"errors in update enumeration: %v\", err)\n\t\t}\n\n\t\t// Weed out random invalid entries that show up for some reason.\n\t\tif uh.Operation != 0 {\n\t\t\th.Entries = append(h.Entries, uh)\n\t\t}\n\t}\n\n\treturn &h, nil\n}", "title": "" }, { "docid": "21b7a4966d1fa7da9b08a60a6180d02e", "score": "0.468637", "text": "func (f *WorkerStoreMarkCompleteFunc) History() []WorkerStoreMarkCompleteFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]WorkerStoreMarkCompleteFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "c99e5261f77a8012c936a2eb5295087b", "score": "0.46840152", "text": "func (f *SearchContextsStoreListSearchContextsFunc) History() []SearchContextsStoreListSearchContextsFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]SearchContextsStoreListSearchContextsFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "e6f21237a52f4ef43d5eb53ad556e45d", "score": "0.46809196", "text": "func (f *WorkerStoreUpdateExecutionLogEntryFunc) History() []WorkerStoreUpdateExecutionLogEntryFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]WorkerStoreUpdateExecutionLogEntryFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "70002f47766836942e7b83decd798a78", "score": "0.46804193", "text": "func (r *ClientService) History(clientId string) *ClientHistoryCall {\n\tc := &ClientHistoryCall{s: r.s, opt_: make(map[string]interface{})}\n\tc.clientId = clientId\n\treturn c\n}", "title": "" }, { "docid": "7bab563afebd434c2b88b3afda5fb887", "score": "0.46754324", "text": "func (s *HistoryService) GetHistory(ctx context.Context, opts *HistoryParameters) (HistoryResponse, error) {\n\tvar hr HistoryResponse\n\turl := fmt.Sprintf(\"%s/history\", s.client.BaseURL)\n\tu, err := addOptions(url, opts)\n\tif err != nil {\n\t\treturn hr, err\n\t}\n\treq, err := http.NewRequest(\"GET\", u, nil)\n\tif err != nil {\n\t\treturn hr, err\n\t}\n\tvar records [][]string\n\tif err := s.client.makeRequest(ctx, req, &records); err != nil {\n\t\treturn hr, err\n\t}\n\tfor _, record := range records[1:] {\n\t\thr.Results = append(hr.Results, HistoryItem{\n\t\t\tTenantID: record[0],\n\t\t\tMacAddress: record[1],\n\t\t\tDeviceType: record[2],\n\t\t\tCampusID: record[3],\n\t\t\tBuildingID: record[4],\n\t\t\tFloorID: record[5],\n\t\t\tFloorHierarchy: record[6],\n\t\t\tCoordinateX: record[7],\n\t\t\tCoordinateY: record[8],\n\t\t\tSourceTimestamp: record[9],\n\t\t\tMaxDetectedApMac: record[10],\n\t\t\tMaxDetectedBand: record[11],\n\t\t\tDetectingControllers: record[12],\n\t\t\tFirstActiveAt: record[13],\n\t\t\tLocatedSinceActiveCount: record[14],\n\t\t\tChangedOn: record[15],\n\t\t\tManufacturer: record[16],\n\t\t\tAssociated: record[17],\n\t\t\tMaxDetectedRssi: record[18],\n\t\t\tSsid: record[19],\n\t\t\tUsername: record[20],\n\t\t\tAssociatedApMac: record[21],\n\t\t\tAssociatedApRssi: record[22],\n\t\t\tMaxDetectedSlot: record[23],\n\t\t\tIPAddress: record[24],\n\t\t\tStaticDevice: record[25],\n\t\t\tRecordType: record[26],\n\t\t\tComputeType: record[27],\n\t\t\tSource: record[28],\n\t\t\tMacHashed: record[29],\n\t\t})\n\t}\n\treturn hr, nil\n}", "title": "" }, { "docid": "48e45fe7cfb643672e675df373327218", "score": "0.46744177", "text": "func (f *DependenciesServiceInsertPackageRepoRefsFunc) History() []DependenciesServiceInsertPackageRepoRefsFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]DependenciesServiceInsertPackageRepoRefsFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "a9787b4c2a769d173ac54ebc7c0028ac", "score": "0.46720114", "text": "func (d *Dao) LastOneHistory(c context.Context, mid int64) (point int64, err error) {\n\trow := d.db.QueryRow(c, _lastOneHistory, mid)\n\tif err = row.Scan(&point); err != nil {\n\t\tif err == xsql.ErrNoRows {\n\t\t\terr = nil\n\t\t} else {\n\t\t\terr = errors.WithStack(err)\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "cf1cef3e913a8e8be593f776b454a33b", "score": "0.46719092", "text": "func (d *DB) GetLatestDocument(did string) (string, error) {\n\ttext := \"\"\n\tr := d.db.QueryRow(\"SELECT text FROM documentrevision WHERE uuid = $1 AND revision = (SELECT revision FROM document WHERE uuid = $1)\", did)\n\terr := r.Scan(&text)\n\tif err == sql.ErrNoRows {\n\t\treturn \"\", ErrDocumentNotFound\n\t} else if err != nil {\n\t\treturn \"\", err\n\t}\n\treturn text, nil\n}", "title": "" }, { "docid": "1805211214e89d3a374d88eb7ff44d9d", "score": "0.46702108", "text": "func (f *AutoIndexingServiceNumRepositoriesWithCodeIntelligenceFunc) History() []AutoIndexingServiceNumRepositoriesWithCodeIntelligenceFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]AutoIndexingServiceNumRepositoriesWithCodeIntelligenceFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "658402d06885e01cfab8a23402899a3a", "score": "0.46676487", "text": "func (t *Relauncher) History() History {\n\tt.mutex.RLock()\n\tdefer t.mutex.RUnlock()\n\treturn t.history\n}", "title": "" }, { "docid": "1b457161130a02d6807d23a40ab33e33", "score": "0.46666086", "text": "func (f *DBStoreMarkRepositoryAsDirtyFunc) History() []DBStoreMarkRepositoryAsDirtyFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]DBStoreMarkRepositoryAsDirtyFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "b575de9bc75bd9a29cf222266d073f0a", "score": "0.46577418", "text": "func (f *AccessTokenStoreWithFunc) History() []AccessTokenStoreWithFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]AccessTokenStoreWithFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "20efe6c388cf287a8fd60e2e7881310d", "score": "0.4656817", "text": "func (m *LocationHistory) GetDocumentName()string{\n\treturn \"location_history\"\n}", "title": "" }, { "docid": "bbd5698f96074124cf1e7ed0819e15c6", "score": "0.46530765", "text": "func (f *DBStoreDirtyRepositoriesFunc) History() []DBStoreDirtyRepositoriesFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]DBStoreDirtyRepositoriesFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "1d0cf98bdca5146d7487dab23ee7e92a", "score": "0.46525034", "text": "func (f *HandlerHandleRPCFunc) History() []HandlerHandleRPCFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]HandlerHandleRPCFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "8643c717bd8312d9833d469d2fa38917", "score": "0.46468636", "text": "func NewHistory(idsSize, msgsSize int) *History {\n\tif idsSize < msgsSize {\n\t\tpanic(\"IDs buffer has to be at least as big as the message buffer\")\n\t}\n\treturn &History{\n\t\tids: newFifoCache(idsSize),\n\t\tmsgs: newFifoCache(msgsSize),\n\t}\n}", "title": "" }, { "docid": "fadf37e9ee97a672ec085a937a22ba4a", "score": "0.46463895", "text": "func (h *Header) History() string {\n\tcard := h.Get(\"HISTORY\")\n\tif card != nil {\n\t\treturn card.Value.(string)\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "9d34b4363046c176659c0d46fe19541e", "score": "0.46444482", "text": "func (f *AutoIndexingServiceQueueIndexesForPackageFunc) History() []AutoIndexingServiceQueueIndexesForPackageFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]AutoIndexingServiceQueueIndexesForPackageFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "5ae8f8f83121037353235da220bd4718", "score": "0.4643537", "text": "func (f *SearchContextsStoreTransactFunc) History() []SearchContextsStoreTransactFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]SearchContextsStoreTransactFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "e974d631ae9738b3a52992195f97a07c", "score": "0.46344045", "text": "func (f *StoreDownFunc) History() []StoreDownFuncCall {\n\tf.mutex.Lock()\n\thistory := make([]StoreDownFuncCall, len(f.history))\n\tcopy(history, f.history)\n\tf.mutex.Unlock()\n\n\treturn history\n}", "title": "" }, { "docid": "0be2b749bde3ee50e1a43f8c02468087", "score": "0.4633053", "text": "func (s *Subscriptions) ListHistory(w http.ResponseWriter, r *http.Request) {\n\tid := r.Context().Value(subscriptionIDKey).(data.ID)\n\thistory, err := s.dao.GetSubscriptionHistoryByID(id)\n\tif err != nil {\n\t\ts.l.Infof(\"unable to fetch history data: %s\", err)\n\t\thttp.Error(w, \"unable to fetch history data\", http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\ts.respondWithJSON(history, w)\n\ts.l.Debugf(\"subscriptions listHistory: %+v\", history)\n}", "title": "" }, { "docid": "8d30c962fdbfbb0c9cf5c88ca0a0417e", "score": "0.4631162", "text": "func (o *OsmDB) GetRelationHistory(id int64) (*osm.Relations, error) {\n\tquery := fmt.Sprintf(`\n\tSELECT\n\t\tid, \n\t\tvisible, \n\t\tversion, \n\t\t\"user\",\n\t\tuid,\n\t\tchangeset,\n\t\ttimestamp,\n\t\tCOALESCE(to_json(tags), '[]') AS tags,\n\t\tCOALESCE(to_json(members), '[]') AS members\n\tFROM get_relation_history_by_id(%v)`, id)\n\n\trows, err := o.db.Query(query)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\n\trelations := &osm.Relations{}\n\tfor rows.Next() {\n\t\tvar user sql.NullString\n\t\tvar userID sql.NullInt64\n\t\trelation := &osm.Relation{}\n\t\terr := rows.Scan(\n\t\t\t&relation.ID,\n\t\t\t&relation.Visible,\n\t\t\t&relation.Version,\n\t\t\t&user,\n\t\t\t&userID,\n\t\t\t&relation.ChangesetID,\n\t\t\t&relation.Timestamp,\n\t\t\t&relation.Tags,\n\t\t\t&relation.Members,\n\t\t)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif userID.Valid {\n\t\t\trelation.UserID = &userID.Int64\n\t\t\tif user.Valid {\n\t\t\t\trelation.User = &user.String\n\t\t\t}\n\t\t}\n\n\t\t*relations = append(*relations, relation)\n\t}\n\n\treturn relations, nil\n}", "title": "" } ]
d229664c00d6f12afd6951fda09ee9eb
/ Sets the shape data that defines its shape and size. The data to be passed depends on the kind of shape created [method shape_get_type].
[ { "docid": "8b0d8841e98cf91b82d1612b68283af7", "score": "0.70835423", "text": "func (o *physics2DServer) ShapeSetData(shape *RID, data *Variant) {\n\tlog.Println(\"Calling Physics2DServer.ShapeSetData()\")\n\n\t// Build out the method's arguments\n\tgoArguments := make([]reflect.Value, 2, 2)\n\tgoArguments[0] = reflect.ValueOf(shape)\n\tgoArguments[1] = reflect.ValueOf(data)\n\n\t// Call the parent method.\n\n\to.callParentMethod(o.baseClass(), \"shape_set_data\", goArguments, \"\")\n\n\tlog.Println(\" Function successfully completed.\")\n\n}", "title": "" } ]
[ { "docid": "ff97065d811e0730fb66daaf38d18109", "score": "0.7098469", "text": "func (o *physicsServer) ShapeSetData(shape *RID, data *Variant) {\n\tlog.Println(\"Calling PhysicsServer.ShapeSetData()\")\n\n\t// Build out the method's arguments\n\tgoArguments := make([]reflect.Value, 2, 2)\n\tgoArguments[0] = reflect.ValueOf(shape)\n\tgoArguments[1] = reflect.ValueOf(data)\n\n\t// Call the parent method.\n\n\to.callParentMethod(o.baseClass(), \"shape_set_data\", goArguments, \"\")\n\n\tlog.Println(\" Function successfully completed.\")\n\n}", "title": "" }, { "docid": "c4e0e3bbb8262f3f518b7e25309622c1", "score": "0.6290718", "text": "func (ap *AP) SetShape(s ...int) {\n\tif !ap.fin {\n\t\t// scalars are a special case, we don't want to remove it completely\n\t\tif len(s) == 0 {\n\t\t\tap.shape = ap.shape[:0]\n\t\t\tap.strides = ap.strides[:0]\n\t\t\treturn\n\t\t}\n\n\t\tif ap.shape != nil {\n\t\t\tReturnInts(ap.shape)\n\t\t\tap.shape = nil\n\t\t}\n\t\tif ap.strides != nil {\n\t\t\tReturnInts(ap.strides)\n\t\t\tap.strides = nil\n\t\t}\n\t\tap.shape = Shape(s).Clone()\n\t\tap.strides = ap.calcStrides()\n\t}\n}", "title": "" }, { "docid": "be4f27f3121d94758d0a47dd22fee9c6", "score": "0.61574155", "text": "func (mat *Matrix) SetShape(newShape []int) {\n\tmat.shape = newShape\n\n}", "title": "" }, { "docid": "a605b8647be801f94dbfa5f56ffbba8e", "score": "0.5887929", "text": "func (s DataShapeString) DataShape() (shape DataShape, err error) {\n\tshape, found := dataShapeStrings[strings.ToLower(string(s))]\n\tif !found {\n\t\terr = fmt.Errorf(\"Unknown data shape specification (%s)\", s)\n\t}\n\treturn\n}", "title": "" }, { "docid": "07cbf2d97d958b1bcde704d1ca05e353", "score": "0.58672225", "text": "func (d *DataCube) Shape() Shape {\n\treturn Shape{d.w, d.l, d.h}\n}", "title": "" }, { "docid": "e5321651b4c724d3cc706ba1dba022ed", "score": "0.5861682", "text": "func (o *Physics2DShapeQueryParameters) SetShape(shape *Resource) {\n\tlog.Println(\"Calling Physics2DShapeQueryParameters.SetShape()\")\n\n\t// Build out the method's arguments\n\tgoArguments := make([]reflect.Value, 1, 1)\n\tgoArguments[0] = reflect.ValueOf(shape)\n\n\t// Call the parent method.\n\n\to.callParentMethod(o.baseClass(), \"set_shape\", goArguments, \"\")\n\n\tlog.Println(\" Function successfully completed.\")\n\n}", "title": "" }, { "docid": "7b4a3d5bde77ccd965c1a0a3f53c0257", "score": "0.56681204", "text": "func (s DataShape) ShapeDimensions() int8 {\n\tif s.shape == nil {\n\t\treturn 0\n\t}\n\treturn int8(len(s.shape))\n}", "title": "" }, { "docid": "dd1d04ed7995d7a2ca40f1333d4f46a3", "score": "0.56598204", "text": "func (window *Window) SetShape(shape *Surface, shape_mode *WindowShapeMode) (retval int) {\n var tmp_shape_mode *C.SDL_WindowShapeMode; if shape_mode != nil { x := toCFromWindowShapeMode(*shape_mode); tmp_shape_mode = &x }\n retval = int(C.SDL_SetWindowShape((*C.SDL_Window)(window), (*C.SDL_Surface)(shape), (*C.SDL_WindowShapeMode)(tmp_shape_mode)))\n return\n}", "title": "" }, { "docid": "1af62c43957fd6762dc56488deeb9812", "score": "0.54956275", "text": "func (o *physicsServer) AreaSetShape(area *RID, shapeIdx int64, shape *RID) {\n\tlog.Println(\"Calling PhysicsServer.AreaSetShape()\")\n\n\t// Build out the method's arguments\n\tgoArguments := make([]reflect.Value, 3, 3)\n\tgoArguments[0] = reflect.ValueOf(area)\n\tgoArguments[1] = reflect.ValueOf(shapeIdx)\n\tgoArguments[2] = reflect.ValueOf(shape)\n\n\t// Call the parent method.\n\n\to.callParentMethod(o.baseClass(), \"area_set_shape\", goArguments, \"\")\n\n\tlog.Println(\" Function successfully completed.\")\n\n}", "title": "" }, { "docid": "d57c3d724fb87984c7cd70ee5d5e581f", "score": "0.5456182", "text": "func (o *physicsServer) BodySetShape(body *RID, shapeIdx int64, shape *RID) {\n\tlog.Println(\"Calling PhysicsServer.BodySetShape()\")\n\n\t// Build out the method's arguments\n\tgoArguments := make([]reflect.Value, 3, 3)\n\tgoArguments[0] = reflect.ValueOf(body)\n\tgoArguments[1] = reflect.ValueOf(shapeIdx)\n\tgoArguments[2] = reflect.ValueOf(shape)\n\n\t// Call the parent method.\n\n\to.callParentMethod(o.baseClass(), \"body_set_shape\", goArguments, \"\")\n\n\tlog.Println(\" Function successfully completed.\")\n\n}", "title": "" }, { "docid": "aba11e938c624182d86156935f0a5e91", "score": "0.5403257", "text": "func (o *physics2DServer) AreaSetShape(area *RID, shapeIdx int64, shape *RID) {\n\tlog.Println(\"Calling Physics2DServer.AreaSetShape()\")\n\n\t// Build out the method's arguments\n\tgoArguments := make([]reflect.Value, 3, 3)\n\tgoArguments[0] = reflect.ValueOf(area)\n\tgoArguments[1] = reflect.ValueOf(shapeIdx)\n\tgoArguments[2] = reflect.ValueOf(shape)\n\n\t// Call the parent method.\n\n\to.callParentMethod(o.baseClass(), \"area_set_shape\", goArguments, \"\")\n\n\tlog.Println(\" Function successfully completed.\")\n\n}", "title": "" }, { "docid": "5d4ffc5e5f8ccfa27777805ec323e58f", "score": "0.5383704", "text": "func (o *physics2DServer) BodySetShape(body *RID, shapeIdx int64, shape *RID) {\n\tlog.Println(\"Calling Physics2DServer.BodySetShape()\")\n\n\t// Build out the method's arguments\n\tgoArguments := make([]reflect.Value, 3, 3)\n\tgoArguments[0] = reflect.ValueOf(body)\n\tgoArguments[1] = reflect.ValueOf(shapeIdx)\n\tgoArguments[2] = reflect.ValueOf(shape)\n\n\t// Call the parent method.\n\n\to.callParentMethod(o.baseClass(), \"body_set_shape\", goArguments, \"\")\n\n\tlog.Println(\" Function successfully completed.\")\n\n}", "title": "" }, { "docid": "4a4df755712f4ac7c8a03d6be8470e56", "score": "0.52850187", "text": "func (o *visualServer) CanvasOccluderPolygonSetShape(occluderPolygon *RID, shape *PoolVector2Array, closed bool) {\n\tlog.Println(\"Calling VisualServer.CanvasOccluderPolygonSetShape()\")\n\n\t// Build out the method's arguments\n\tgoArguments := make([]reflect.Value, 3, 3)\n\tgoArguments[0] = reflect.ValueOf(occluderPolygon)\n\tgoArguments[1] = reflect.ValueOf(shape)\n\tgoArguments[2] = reflect.ValueOf(closed)\n\n\t// Call the parent method.\n\n\to.callParentMethod(o.baseClass(), \"canvas_occluder_polygon_set_shape\", goArguments, \"\")\n\n\tlog.Println(\" Function successfully completed.\")\n\n}", "title": "" }, { "docid": "b8cf11f04cd1126f8a375b3da7918b3b", "score": "0.5230535", "text": "func (d *Dense[T]) SetData(data float.Slice) {\n\tv := float.SliceValueOf[T](data)\n\tif len(v) != len(d.data) {\n\t\tpanic(fmt.Sprintf(\"mat: incompatible data size, expected %d, actual %d\", len(d.data), len(v)))\n\t}\n\tcopy(d.data, v)\n}", "title": "" }, { "docid": "f75901e9152d134e45bd2e07015a708a", "score": "0.52301645", "text": "func (client BaseClient) CreateShapeMethod(ctx context.Context, input ShapeType) (result SetObjectType, err error) {\n if tracing.IsEnabled() {\n ctx = tracing.StartSpan(ctx, fqdn + \"/BaseClient.CreateShapeMethod\")\n defer func() {\n sc := -1\n if result.Response.Response != nil {\n sc = result.Response.Response.StatusCode\n }\n tracing.EndSpan(ctx, sc, err)\n }()\n }\n if err := validation.Validate([]validation.Validation{\n { TargetValue: input,\n Constraints: []validation.Constraint{\t{Target: \"input.Name\", Name: validation.Null, Rule: true, Chain: nil },\n \t{Target: \"input.MatchRule\", Name: validation.Null, Rule: false ,\n Chain: []validation.Constraint{\t{Target: \"input.MatchRule.ShapeID\", Name: validation.Null, Rule: true, Chain: nil },\n \t{Target: \"input.MatchRule.Type\", Name: validation.Null, Rule: true, Chain: nil },\n }}}}}); err != nil {\n return result, validation.NewError(\".BaseClient\", \"CreateShapeMethod\", err.Error())\n }\n\n req, err := client.CreateShapeMethodPreparer(ctx, input)\n if err != nil {\n err = autorest.NewErrorWithError(err, \".BaseClient\", \"CreateShapeMethod\", nil , \"Failure preparing request\")\n return\n }\n\n resp, err := client.CreateShapeMethodSender(req)\n if err != nil {\n result.Response = autorest.Response{Response: resp}\n err = autorest.NewErrorWithError(err, \".BaseClient\", \"CreateShapeMethod\", resp, \"Failure sending request\")\n return\n }\n\n result, err = client.CreateShapeMethodResponder(resp)\n if err != nil {\n err = autorest.NewErrorWithError(err, \".BaseClient\", \"CreateShapeMethod\", resp, \"Failure responding to request\")\n }\n\n return\n }", "title": "" }, { "docid": "3636f106f3842015392fe956da64df58", "score": "0.51586586", "text": "func (i *Memory) fillShape(out chan interface{}, quit chan error, n pkg.Composer, excludes []bool) {\n\tvar (\n\t\torig = reflect.ValueOf(i.shape)\n\t\tcpy = reflect.New(orig.Type()).Elem()\n\t)\n\tfor {\n\t\tvar (\n\t\t\tfield reflect.StructField\n\t\t\tcol = n.Parent()\n\t\t)\n\t\tcId, _, _ := col.Id()\n\t\tif i.src.Null()[cId] {\n\t\t\tgoto next\n\t\t}\n\n\t\tif alias, ok := i.alias[cId]; ok {\n\t\t\tfield = alias\n\t\t} else {\n\t\t\tquit <- errors.New(fmt.Sprintf(\"output/Memory: alias not found for column %d\", cId))\n\t\t}\n\t\tif pkg.IsNil(n.Value()) {\n\t\t\tgoto next\n\t\t\t// if cpy.FieldByIndex(field.Index).Type().Kind() == reflect.Ptr {\n\t\t\t// \tcpy.FieldByIndex(field.Index).Set(nil)\n\t\t\t// }\n\t\t}\n\t\t// make sure n.Value is the same type as the field\n\t\tswitch n.Value().(type) {\n\t\tcase string:\n\t\t\tif field.Type.Kind() == reflect.String {\n\t\t\t\tcpy.FieldByIndex(field.Index).SetString(n.Value().(string))\n\t\t\t}\n\t\tcase float64:\n\t\t\tif field.Type.Kind() == reflect.Float64 {\n\t\t\t\tcpy.FieldByIndex(field.Index).SetFloat(n.Value().(float64))\n\t\t\t}\n\t\tcase float32:\n\t\t\tif field.Type.Kind() == reflect.Float32 {\n\t\t\t\tcpy.FieldByIndex(field.Index).Set(reflect.ValueOf(n.Value().(float32)))\n\t\t\t}\n\t\tcase bool:\n\t\t\tif field.Type.Kind() == reflect.Bool {\n\t\t\t\tcpy.FieldByIndex(field.Index).SetBool(n.Value().(bool))\n\t\t\t}\n\t\tcase time.Time:\n\t\t\tif field.Type.Kind() != reflect.Struct {\n\t\t\t\tcpy.FieldByIndex(field.Index).SetInt(n.Value().(time.Time).Unix())\n\t\t\t} else {\n\t\t\t\tcpy.FieldByIndex(field.Index).Set(reflect.ValueOf(n.Value()))\n\t\t\t}\n\t\tcase int64:\n\t\t\tif field.Type.Kind() == reflect.Int64 {\n\t\t\t\tcpy.FieldByIndex(field.Index).SetInt(n.Value().(int64))\n\t\t\t}\n\t\tcase int32:\n\t\t\tif field.Type.Kind() == reflect.Int32 {\n\t\t\t\tcpy.FieldByIndex(field.Index).Set(reflect.ValueOf(n.Value().(int32)))\n\t\t\t}\n\t\tcase int16:\n\t\t\tif field.Type.Kind() == reflect.Int16 {\n\t\t\t\tcpy.FieldByIndex(field.Index).Set(reflect.ValueOf(n.Value().(int16)))\n\t\t\t}\n\t\tcase int8:\n\t\t\tif field.Type.Kind() == reflect.Int8 {\n\t\t\t\tcpy.FieldByIndex(field.Index).Set(reflect.ValueOf(n.Value().(int8)))\n\t\t\t}\n\t\tcase uint64:\n\t\t\tif field.Type.Kind() == reflect.Uint64 {\n\t\t\t\tcpy.FieldByIndex(field.Index).SetUint(n.Value().(uint64))\n\t\t\t}\n\t\tcase uint32:\n\t\t\tif field.Type.Kind() == reflect.Uint32 {\n\t\t\t\tcpy.FieldByIndex(field.Index).Set(reflect.ValueOf(n.Value().(uint32)))\n\t\t\t}\n\t\tcase uint16:\n\t\t\tif field.Type.Kind() == reflect.Uint16 {\n\t\t\t\tcpy.FieldByIndex(field.Index).Set(reflect.ValueOf(n.Value().(uint16)))\n\t\t\t}\n\t\tcase uint8:\n\t\t\tif field.Type.Kind() == reflect.Uint8 {\n\t\t\t\tcpy.FieldByIndex(field.Index).Set(reflect.ValueOf(n.Value().(uint8)))\n\t\t\t}\n\t\tdefault:\n\t\t\tquit <- errors.New(\"output/Memory: unknown type, supported types are: string, float64, int64, bool, time.Time\")\n\t\t}\n\tnext:\n\t\tif n.Next() != nil {\n\t\t\tn = n.Next()\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n\tout <- cpy.Interface()\n}", "title": "" }, { "docid": "71b730233c7d7a21eb92dce73e47719b", "score": "0.5034026", "text": "func (s DataShape) ShapeDimension(axis uint8) (uint8, error) {\n\tif s.shape == nil {\n\t\treturn 0, fmt.Errorf(\"Cannot request ShapeDimension from nil DataShape\")\n\t}\n\tif len(s.shape) <= int(axis) {\n\t\treturn 0, fmt.Errorf(\"Illegal dimension requested from DataShape: %d\", axis)\n\t}\n\treturn s.shape[axis], nil\n}", "title": "" }, { "docid": "cca2a53832d93fc93195f92b320d8866", "score": "0.50271446", "text": "func (client BaseClient) UpdateShapeMethod(ctx context.Context, ID string, model ShapeType) (result SetObjectType, err error) {\n if tracing.IsEnabled() {\n ctx = tracing.StartSpan(ctx, fqdn + \"/BaseClient.UpdateShapeMethod\")\n defer func() {\n sc := -1\n if result.Response.Response != nil {\n sc = result.Response.Response.StatusCode\n }\n tracing.EndSpan(ctx, sc, err)\n }()\n }\n if err := validation.Validate([]validation.Validation{\n { TargetValue: model,\n Constraints: []validation.Constraint{\t{Target: \"model.Name\", Name: validation.Null, Rule: true, Chain: nil },\n \t{Target: \"model.MatchRule\", Name: validation.Null, Rule: false ,\n Chain: []validation.Constraint{\t{Target: \"model.MatchRule.ShapeID\", Name: validation.Null, Rule: true, Chain: nil },\n \t{Target: \"model.MatchRule.Type\", Name: validation.Null, Rule: true, Chain: nil },\n }}}}}); err != nil {\n return result, validation.NewError(\".BaseClient\", \"UpdateShapeMethod\", err.Error())\n }\n\n req, err := client.UpdateShapeMethodPreparer(ctx, ID, model)\n if err != nil {\n err = autorest.NewErrorWithError(err, \".BaseClient\", \"UpdateShapeMethod\", nil , \"Failure preparing request\")\n return\n }\n\n resp, err := client.UpdateShapeMethodSender(req)\n if err != nil {\n result.Response = autorest.Response{Response: resp}\n err = autorest.NewErrorWithError(err, \".BaseClient\", \"UpdateShapeMethod\", resp, \"Failure sending request\")\n return\n }\n\n result, err = client.UpdateShapeMethodResponder(resp)\n if err != nil {\n err = autorest.NewErrorWithError(err, \".BaseClient\", \"UpdateShapeMethod\", resp, \"Failure responding to request\")\n }\n\n return\n }", "title": "" }, { "docid": "111d67bb5db3e767c56ef963c330d84b", "score": "0.50158876", "text": "func (mft testInput) shape(t *testing.T, verify bool) (string, error) {\n\tbuffer := mft.populateBuffer()\n\n\tfont := mft.fontOpts.loadFont(t)\n\terr := mft.shaper.shape(font, buffer, verify)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn buffer.serialize(font, mft.format), nil\n}", "title": "" }, { "docid": "4243601401ae322d8e8317f319005bef", "score": "0.5011715", "text": "func (ap *AP) Shape() Shape { return ap.shape }", "title": "" }, { "docid": "d22c74dd840188623ac704b0751dedfd", "score": "0.49932992", "text": "func (p Struct) SetData(i uint16, v []byte) error {\n\tif v == nil {\n\t\treturn p.SetPtr(i, Ptr{})\n\t}\n\td, err := NewData(p.seg, v)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn p.SetPtr(i, d.List.ToPtr())\n}", "title": "" }, { "docid": "82b142678d0fc62170d623d6c193594d", "score": "0.4975", "text": "func (rc *RouteCreate) SetData(i *interface{}) *RouteCreate {\n\trc.mutation.SetData(i)\n\treturn rc\n}", "title": "" }, { "docid": "b0311888266e69f36a646a59b1fed8c2", "score": "0.4948608", "text": "func (rcv *Tensor) Shape(obj *TensorDim, j int) bool {\n\to := flatbuffers.UOffsetT(rcv._tab.Offset(8))\n\tif o != 0 {\n\t\tx := rcv._tab.Vector(o)\n\t\tx += flatbuffers.UOffsetT(j) * 4\n\t\tx = rcv._tab.Indirect(x)\n\t\tobj.Init(rcv._tab.Bytes, x)\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "c032ff3a059ccdbb478a334941cdcc04", "score": "0.49332523", "text": "func (o *physics2DServer) BodySetShapeMetadata(body *RID, shapeIdx int64, metadata *Variant) {\n\tlog.Println(\"Calling Physics2DServer.BodySetShapeMetadata()\")\n\n\t// Build out the method's arguments\n\tgoArguments := make([]reflect.Value, 3, 3)\n\tgoArguments[0] = reflect.ValueOf(body)\n\tgoArguments[1] = reflect.ValueOf(shapeIdx)\n\tgoArguments[2] = reflect.ValueOf(metadata)\n\n\t// Call the parent method.\n\n\to.callParentMethod(o.baseClass(), \"body_set_shape_metadata\", goArguments, \"\")\n\n\tlog.Println(\" Function successfully completed.\")\n\n}", "title": "" }, { "docid": "dd52a2c667abfa43e06aa8945212c7fd", "score": "0.49219936", "text": "func newShape(shapetype ShapeType) (Shape, error) {\n\tswitch shapetype {\n\tcase NULL:\n\t\treturn new(Null), nil\n\tcase POINT:\n\t\treturn new(Point), nil\n\tcase POLYLINE:\n\t\treturn new(PolyLine), nil\n\tcase POLYGON:\n\t\treturn new(Polygon), nil\n\tcase MULTIPOINT:\n\t\treturn new(MultiPoint), nil\n\tcase POINTZ:\n\t\treturn new(PointZ), nil\n\tcase POLYLINEZ:\n\t\treturn new(PolyLineZ), nil\n\tcase POLYGONZ:\n\t\treturn new(PolygonZ), nil\n\tcase MULTIPOINTZ:\n\t\treturn new(MultiPointZ), nil\n\tcase POINTM:\n\t\treturn new(PointM), nil\n\tcase POLYLINEM:\n\t\treturn new(PolyLineM), nil\n\tcase POLYGONM:\n\t\treturn new(PolygonM), nil\n\tcase MULTIPOINTM:\n\t\treturn new(MultiPointM), nil\n\tcase MULTIPATCH:\n\t\treturn new(MultiPatch), nil\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"Unsupported shape type: %v\", shapetype)\n\t}\n}", "title": "" }, { "docid": "6f51fc6b99a7f72c61f2506327e5624f", "score": "0.4921176", "text": "func BytesToDataShape(b []byte) (s DataShape, err error) {\n\tif b == nil {\n\t\terr = fmt.Errorf(\"Cannot convert nil to DataShape!\")\n\t\treturn\n\t}\n\tif len(b) != DataShapeBytes {\n\t\terr = fmt.Errorf(\"Cannot convert %d bytes to DataShape\", len(b))\n\t\treturn\n\t}\n\ts = DataShape{dims: uint8(b[0])}\n\tshapeLen := int(b[1])\n\ts.shape = make([]uint8, shapeLen)\n\tfor i := 0; i < shapeLen; i++ {\n\t\ts.shape[i] = b[i+2]\n\t}\n\treturn\n}", "title": "" }, { "docid": "f3f259b05fee2aad728ac82e3878ce7b", "score": "0.48854783", "text": "func (d *DrawShape) drawShape(x [5]float32, y [5]float32) {\n\tfmt.Println(\"Drawing Shape\")\n}", "title": "" }, { "docid": "b693cedf73b9ff7f597c9089ecdb41d0", "score": "0.4847498", "text": "func (o *Physics2DShapeQueryParameters) SetShapeRid(shape *RID) {\n\tlog.Println(\"Calling Physics2DShapeQueryParameters.SetShapeRid()\")\n\n\t// Build out the method's arguments\n\tgoArguments := make([]reflect.Value, 1, 1)\n\tgoArguments[0] = reflect.ValueOf(shape)\n\n\t// Call the parent method.\n\n\to.callParentMethod(o.baseClass(), \"set_shape_rid\", goArguments, \"\")\n\n\tlog.Println(\" Function successfully completed.\")\n\n}", "title": "" }, { "docid": "c3c18d6fcbb6731d8860a26668c23094", "score": "0.48304296", "text": "func (row *DataRow) SetDataSize(size int) {\n\tbinary.BigEndian.PutUint32(row.output[:DATA_ROW_LENGTH_BUF_SIZE], uint32(size))\n}", "title": "" }, { "docid": "93e3d74b377a6b5331ef6a86246d4372", "score": "0.48238483", "text": "func ListDataShapes() (shapes []string) {\n\tshapes = []string{}\n\tfor key, _ := range dataShapeStrings {\n\t\tshapes = append(shapes, string(key))\n\t}\n\treturn\n}", "title": "" }, { "docid": "1471a8c3f0038572735c485d36888ccc", "score": "0.4770212", "text": "func (st ShapeType)MarshalJSON() ([]byte, error){\n objectMap := make(map[string]interface{})\n if(st.ID != nil) {\n objectMap[\"id\"] = st.ID\n }\n if(st.Version != nil) {\n objectMap[\"version\"] = st.Version\n }\n if(st.Name != nil) {\n objectMap[\"name\"] = st.Name\n }\n if(st.Description != nil) {\n objectMap[\"description\"] = st.Description\n }\n if(st.Properties != nil) {\n objectMap[\"properties\"] = st.Properties\n }\n if(st.Labels != nil) {\n objectMap[\"labels\"] = st.Labels\n }\n if(st.IsMdmShape != nil) {\n objectMap[\"isMdmShape\"] = st.IsMdmShape\n }\n if(st.MatchRule != nil) {\n objectMap[\"matchRule\"] = st.MatchRule\n }\n if(st.MergeRule != nil) {\n objectMap[\"mergeRule\"] = st.MergeRule\n }\n if(st.CompareRule != nil) {\n objectMap[\"compareRule\"] = st.CompareRule\n }\n if(st.CopiedFromSchemaID != nil) {\n objectMap[\"copiedFromSchemaId\"] = st.CopiedFromSchemaID\n }\n if(st.CreatedAt != nil) {\n objectMap[\"createdAt\"] = st.CreatedAt\n }\n if(st.CreatedBy != nil) {\n objectMap[\"createdBy\"] = st.CreatedBy\n }\n if(st.UpdatedAt != nil) {\n objectMap[\"updatedAt\"] = st.UpdatedAt\n }\n if(st.UpdatedBy != nil) {\n objectMap[\"updatedBy\"] = st.UpdatedBy\n }\n if(st.DeletedAt != nil) {\n objectMap[\"deletedAt\"] = st.DeletedAt\n }\n if(st.DeletedBy != nil) {\n objectMap[\"deletedBy\"] = st.DeletedBy\n }\n return json.Marshal(objectMap)\n }", "title": "" }, { "docid": "8c657fe3038741c9e7f0381f5f4b642f", "score": "0.4766341", "text": "func (s *Response) SetData(value interface{}) error {\n\tstore := map[string]interface{}{}\n\tif s.Store == nil {\n\t\ts.Store = map[string]interface{}{}\n\t}\n\tif !structs.IsStruct(value) {\n\t\treturn errors.New(\"response: required parameter should be a struct\")\n\t}\n\tstx := structs.New(value)\n\tstx.FillMap(store)\n\tfor k, v := range store {\n\t\ts.Store[snaker.CamelToSnake(k)] = v\n\t}\n\ts.Done = true\n\treturn nil\n}", "title": "" }, { "docid": "29036e62c779a3f16b6904db75c1a65c", "score": "0.47595093", "text": "func (lg *Graph) SetData(data []float32) {\r\n\r\n\tlg.data = data\r\n\tlg.updateData()\r\n}", "title": "" }, { "docid": "d5136f3fe1511e6bc7c1599de288d76b", "score": "0.4756449", "text": "func (o *physicsServer) ShapeGetData(shape *RID) *Variant {\n\tlog.Println(\"Calling PhysicsServer.ShapeGetData()\")\n\n\t// Build out the method's arguments\n\tgoArguments := make([]reflect.Value, 1, 1)\n\tgoArguments[0] = reflect.ValueOf(shape)\n\n\t// Call the parent method.\n\n\tgoRet := o.callParentMethod(o.baseClass(), \"shape_get_data\", goArguments, \"*Variant\")\n\n\treturnValue := goRet.Interface().(*Variant)\n\n\tlog.Println(\" Got return value: \", returnValue)\n\treturn returnValue\n\n}", "title": "" }, { "docid": "92500eab06ab510485d221d4170f91d9", "score": "0.4747728", "text": "func (b Batch) SetData(tag string, data interface{}) {\n\tb[tag] = data\n}", "title": "" }, { "docid": "d8b36eb897291669d93a0e6c7788b446", "score": "0.4725046", "text": "func (o *physics2DServer) ShapeGetData(shape *RID) *Variant {\n\tlog.Println(\"Calling Physics2DServer.ShapeGetData()\")\n\n\t// Build out the method's arguments\n\tgoArguments := make([]reflect.Value, 1, 1)\n\tgoArguments[0] = reflect.ValueOf(shape)\n\n\t// Call the parent method.\n\n\tgoRet := o.callParentMethod(o.baseClass(), \"shape_get_data\", goArguments, \"*Variant\")\n\n\treturnValue := goRet.Interface().(*Variant)\n\n\tlog.Println(\" Got return value: \", returnValue)\n\treturn returnValue\n\n}", "title": "" }, { "docid": "44398ae1e58fee137fbc33e03f884ead", "score": "0.47202575", "text": "func (ctx *Lay_context) Lay_set_size(item Lay_id, size Lay_vec2) {\n\tpitem := ctx.Lay_get_item(item)\n\tpitem.size = size\n\tflags := pitem.flags\n\tif size[0] == 0 {\n\t\tflags &= ^LAY_ITEM_HFIXED\n\t} else {\n\t\tflags |= LAY_ITEM_HFIXED\n\t}\n\tif size[1] == 0 {\n\t\tflags &= ^LAY_ITEM_VFIXED\n\t} else {\n\t\tflags |= LAY_ITEM_VFIXED\n\t}\n\tpitem.flags = flags\n}", "title": "" }, { "docid": "4890f8e71ad625b12e6357dc42fb10fe", "score": "0.469881", "text": "func (d *Data) SetLength() {\n\tif param := d.NetworkAppearance; param != nil {\n\t\tparam.SetLength()\n\t}\n\tif param := d.RoutingContext; param != nil {\n\t\tparam.SetLength()\n\t}\n\tif param := d.ProtocolData; param != nil {\n\t\tparam.SetLength()\n\t}\n\tif param := d.CorrelationID; param != nil {\n\t\tparam.SetLength()\n\t}\n\n\td.Header.Length = uint32(d.MarshalLen())\n}", "title": "" }, { "docid": "2e9f86c320ada4c96fc4fa3906a7c3d6", "score": "0.46534687", "text": "func WithShape(shp ...int) engine.NodeConsOpt {\n\treturn engine.WithShape(shp...)\n}", "title": "" }, { "docid": "eea8736ada6ec56bfe25cba989b86159", "score": "0.4637085", "text": "func (m *Matrix) ReShape(r, c int) {\n\tif len(m.data) == 0 {\n\t\tlog.Panic(\"internal data is empty\")\n\t}\n\tswitch {\n\tcase r > 0 && c > 0:\n\t\tif r*c != len(m.data) {\n\t\t\tlog.Panic(\"invalid numbers\")\n\t\t}\n\t\tm.rows, m.cols = r, c\n\tcase r == -1 && c > 0:\n\t\tif (len(m.data))%c != 0 {\n\t\t\tlog.Panic(\"invalid columns number\")\n\t\t}\n\t\tm.rows = len(m.data) / c\n\t\tm.cols = c\n\tcase r > 0 && c == -1:\n\t\tif len(m.data)%r != 0 {\n\t\t\tlog.Panic(\"invalid rows number\")\n\t\t}\n\t\tm.rows = r\n\t\tm.cols = len(m.data) / r\n\tdefault:\n\t\tlog.Panic(\"invalid rows or columns number\")\n\t}\n}", "title": "" }, { "docid": "3751e5d25ae66286700cc71d37c81946", "score": "0.4634105", "text": "func (d *Dense[_]) Shape() []int {\n\treturn d.shape\n}", "title": "" }, { "docid": "94c157f3addb6fcdbfb92fcb5796861b", "score": "0.4629793", "text": "func (o *ImageTexture) SetData(image *Image) {\n\tlog.Println(\"Calling ImageTexture.SetData()\")\n\n\t// Build out the method's arguments\n\tgoArguments := make([]reflect.Value, 1, 1)\n\tgoArguments[0] = reflect.ValueOf(image)\n\n\t// Call the parent method.\n\n\to.callParentMethod(o.baseClass(), \"set_data\", goArguments, \"\")\n\n\tlog.Println(\" Function successfully completed.\")\n\n}", "title": "" }, { "docid": "581aa0519d478a6921d83c3416259ce1", "score": "0.45896295", "text": "func (a *Array64) Shape() []int {\n\tif a.HasErr() {\n\t\treturn nil\n\t}\n\n\tres := make([]int, len(a.shape), len(a.shape))\n\tcopy(res, a.shape)\n\treturn res\n}", "title": "" }, { "docid": "ae9b185f7270ade17e8a99348426c54d", "score": "0.45885444", "text": "func (b *Box) WriteShape(w io.Writer) error {\n\ts := fmt.Sprintf(\"fill ~%d ~%d ~%d ~%d ~%d ~%d %s\\n\",\n\t\tb.corner1.X, b.corner1.Y, b.corner1.Z,\n\t\tb.corner2.X, b.corner2.Y, b.corner2.Z,\n\t\tb.surface)\n\t_, err := w.Write([]byte(s))\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d0b7ecb6abecb0d89edc15d49b025806", "score": "0.45861393", "text": "func (client BaseClient) CreateShapeMethodPreparer(ctx context.Context, input ShapeType) (*http.Request, error) {\n preparer := autorest.CreatePreparer(\n autorest.AsContentType(\"application/json-patch+json; charset=utf-8\"),\n autorest.AsPost(),\n autorest.WithBaseURL(client.BaseURI),\n autorest.WithPath(\"/v1/shapes\"),\n autorest.WithJSON(input))\n return preparer.Prepare((&http.Request{}).WithContext(ctx))\n }", "title": "" }, { "docid": "4e56071fbe5ed464dd95e04ed4cd611d", "score": "0.45639873", "text": "func (cate *Category) SetData(stream io.Reader) FoulError {\n\tdecoder := json.NewDecoder(stream)\n\terr := decoder.Decode(&cate)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\terrF := cate.insertIntoDB()\n\tif errF != nil {\n\t\treturn errF\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "375b65619e5bce8b40b89f95ef16df67", "score": "0.45554942", "text": "func SetData(data []byte) {\n\tif setDataCallback.Type().String() == \"undefined\" {\n\t\treturn\n\t}\n\tsetDataCallback.Invoke(string(data))\n}", "title": "" }, { "docid": "bb33def0a9c4a2a93adc235d79b431ab", "score": "0.4552868", "text": "func (o *CollisionObject2D) ShapeOwnerAddShape(ownerId int64, shape *Shape2D) {\n\tlog.Println(\"Calling CollisionObject2D.ShapeOwnerAddShape()\")\n\n\t// Build out the method's arguments\n\tgoArguments := make([]reflect.Value, 2, 2)\n\tgoArguments[0] = reflect.ValueOf(ownerId)\n\tgoArguments[1] = reflect.ValueOf(shape)\n\n\t// Call the parent method.\n\n\to.callParentMethod(o.baseClass(), \"shape_owner_add_shape\", goArguments, \"\")\n\n\tlog.Println(\" Function successfully completed.\")\n\n}", "title": "" }, { "docid": "4976f23fe784f8324eef580c80ad14c3", "score": "0.45523715", "text": "func (impl *GraphicsImpl) BufferData(target graphics.Enum, size int, data unsafe.Pointer, usage graphics.Enum) {\n\tgles.BufferData(gles.Enum(target), gles.SizeiPtr(size), gles.Void(data), gles.Enum(usage))\n}", "title": "" }, { "docid": "8b3758b7d58ad40ef8f60e0c8c9006ec", "score": "0.45506155", "text": "func (inputTensor *Struct) GetShape() []uint {\n\treturn inputTensor.shape\n}", "title": "" }, { "docid": "8ae258f21e92231e8a04ee555f07d9f5", "score": "0.45328617", "text": "func (gd *GDataImpl) Set(m string, g General) {\n\tgd.Name = m\n\tgd.Data = g\n}", "title": "" }, { "docid": "a59460dc7644548b4b7d571106d4d56a", "score": "0.4532514", "text": "func (o *CollisionObject) ShapeOwnerAddShape(ownerId int64, shape *Shape) {\n\tlog.Println(\"Calling CollisionObject.ShapeOwnerAddShape()\")\n\n\t// Build out the method's arguments\n\tgoArguments := make([]reflect.Value, 2, 2)\n\tgoArguments[0] = reflect.ValueOf(ownerId)\n\tgoArguments[1] = reflect.ValueOf(shape)\n\n\t// Call the parent method.\n\n\to.callParentMethod(o.baseClass(), \"shape_owner_add_shape\", goArguments, \"\")\n\n\tlog.Println(\" Function successfully completed.\")\n\n}", "title": "" }, { "docid": "85909138eb6489b49d11cbc5828eb7af", "score": "0.4532471", "text": "func (o *physicsServer) ShapeCreate(aType int64) *RID {\n\tlog.Println(\"Calling PhysicsServer.ShapeCreate()\")\n\n\t// Build out the method's arguments\n\tgoArguments := make([]reflect.Value, 1, 1)\n\tgoArguments[0] = reflect.ValueOf(aType)\n\n\t// Call the parent method.\n\n\tgoRet := o.callParentMethod(o.baseClass(), \"shape_create\", goArguments, \"*RID\")\n\n\treturnValue := goRet.Interface().(*RID)\n\n\tlog.Println(\" Got return value: \", returnValue)\n\treturn returnValue\n\n}", "title": "" }, { "docid": "0b0b9d44fe27b67fc45780313f7ca94a", "score": "0.45267114", "text": "func (a *Client) Size(ctx context.Context, params *SizeParams) (*SizeCreated, error) {\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"Size\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/dataset/data/size\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &SizeReader{formats: a.formats},\n\t\tAuthInfo: a.authInfo,\n\t\tContext: ctx,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*SizeCreated), nil\n\n}", "title": "" }, { "docid": "ab6c51dedc963f5de2cd8960717e7a40", "score": "0.4515085", "text": "func (cc *ConfigurationCreate) SetData(s string) *ConfigurationCreate {\n\tcc.mutation.SetData(s)\n\treturn cc\n}", "title": "" }, { "docid": "bdb46f61ae19c0f3d6ed43c14f69aaa0", "score": "0.45094958", "text": "func (s MutableStoreBlobParams) DataSchema() wasmtypes.ScMutableBytes {\n\treturn wasmtypes.NewScMutableBytes(s.Proxy.Root(ParamDataSchema))\n}", "title": "" }, { "docid": "7bae5bdf3057e6382a945684303d84d6", "score": "0.4509396", "text": "func (c *Circle) Shape() ShapeType {\n\treturn c.shape_type\n}", "title": "" }, { "docid": "5691077eb980db09901c923dc96f695c", "score": "0.45088902", "text": "func (r *Resolver) SetData(ctx context.Context, data interface{}) error {\n\treturn r.o.SetData(ctx, data)\n}", "title": "" }, { "docid": "8f4399330601b72d479d9a115720faf4", "score": "0.44897762", "text": "func (self *RenderWindow) DrawShape(shape Shape*) void {\n return C.sfRenderWindow_DrawShape(self.Cref, shape.Cref)\n}", "title": "" }, { "docid": "2c1a1b3d88f628b6298cf48105b4bb08", "score": "0.44896135", "text": "func (self *Request) SetData(data proto.Message) {\n\tself.unmarshaledData = data\n}", "title": "" }, { "docid": "36771707c649f273d871c36f621a4590", "score": "0.44791913", "text": "func (gtfs Gtfs) Shape(route *Route, dir Direction) (*Shape, error) {\n\n\trows, err := gtfs.conn.Query(\n\t\t`SELECT\n shape_pt_lat, shape_pt_lon FROM shapes WHERE shape_id =\n (SELECT DISTINCT shape_id FROM trips WHERE direction_id = ? and route_id = ? LIMIT 1)\n ORDER BY\n shape_pt_sequence ASC`,\n\t\tdir,\n\t\troute.Id(),\n\t)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer rows.Close()\n\tshape := NewShape()\n\tshape.dir = dir\n\tvar lat, lon float64\n\n\tfor rows.Next() {\n\t\terr := rows.Scan(&lat, &lon)\n\t\tif err != nil {\n\t\t\trows.Close()\n\t\t\treturn nil, err\n\t\t}\n\n\t\tp := geo.NewPoint(lon, lat)\n\t\tshape.Push(p)\n\t}\n\n\tshape.Transform(geo.Mercator.Project)\n\n\treturn shape, nil\n}", "title": "" }, { "docid": "79a58d6e2375d2844598c8d2df617cea", "score": "0.44653368", "text": "func (v Vector) SetData(data []float64) {\n\tcopy(v.slice, data)\n}", "title": "" }, { "docid": "211c37920c73405355fe68f49030d20a", "score": "0.4458646", "text": "func (input *CellInput) SetData(key, val interface{}) {\n\tif input.data == nil {\n\t\tinput.data = make(map[interface{}]interface{})\n\t}\n\tinput.data[key] = val\n}", "title": "" }, { "docid": "211c37920c73405355fe68f49030d20a", "score": "0.4458646", "text": "func (input *CellInput) SetData(key, val interface{}) {\n\tif input.data == nil {\n\t\tinput.data = make(map[interface{}]interface{})\n\t}\n\tinput.data[key] = val\n}", "title": "" }, { "docid": "f07fe84f605a7e78408880434ce0f146", "score": "0.4455704", "text": "func (o *Image) CreateFromData(width int64, height int64, useMipmaps bool, format int64, data *PoolByteArray) {\n\tlog.Println(\"Calling Image.CreateFromData()\")\n\n\t// Build out the method's arguments\n\tgoArguments := make([]reflect.Value, 5, 5)\n\tgoArguments[0] = reflect.ValueOf(width)\n\tgoArguments[1] = reflect.ValueOf(height)\n\tgoArguments[2] = reflect.ValueOf(useMipmaps)\n\tgoArguments[3] = reflect.ValueOf(format)\n\tgoArguments[4] = reflect.ValueOf(data)\n\n\t// Call the parent method.\n\n\to.callParentMethod(o.baseClass(), \"create_from_data\", goArguments, \"\")\n\n\tlog.Println(\" Function successfully completed.\")\n\n}", "title": "" }, { "docid": "0c74a47e19a22f9e2f3bb45e001c3796", "score": "0.4442667", "text": "func (ma *Model) SetData(data map[interface{}]interface{}) error {\n\tif ma.IsStatic() {\n\t\treturn fmt.Errorf(ErrorCannotModifyStaticModel)\n\t}\n\tma.data = data\n\treturn nil\n}", "title": "" }, { "docid": "dbcf2094987349660f67923f5307550c", "score": "0.44341493", "text": "func (d *Dimension) Set(value string) error {\n\tparts := strings.Split(value, \"x\")\n\n\th, e := strconv.Atoi(parts[0])\n\tif e != nil {\n\t\treturn errors.New(\"Error parsing height: expect HxW where H and W are integers\")\n\t}\n\n\tw, f := strconv.Atoi(parts[1])\n\tif f != nil {\n\t\treturn errors.New(\"Error parsing width: expect HxW where H and W are integers\")\n\t}\n\n\t*d = Dimension{h, w}\n\n\treturn nil\n}", "title": "" }, { "docid": "93051406cf8e0cce57dec83d50437d54", "score": "0.44261196", "text": "func (is *IdentityState) SetKeyData(keytype KeyType, data []byte) error {\n\tif len(data) > cap(is.Keydata) {\n\t\tis.Keydata = make([]byte, len(data))\n\t}\n\tis.Keytype = keytype\n\tcopy(is.Keydata, data)\n\n\treturn nil\n}", "title": "" }, { "docid": "a8b5601d6d726122f1db0f0fb1dfc2d3", "score": "0.44259855", "text": "func (client BaseClient) UpdateShapeMethodPreparer(ctx context.Context, ID string, model ShapeType) (*http.Request, error) {\n pathParameters := map[string]interface{} {\n \"id\": autorest.Encode(\"path\",ID),\n }\n\n preparer := autorest.CreatePreparer(\n autorest.AsContentType(\"application/json-patch+json; charset=utf-8\"),\n autorest.AsPut(),\n autorest.WithBaseURL(client.BaseURI),\n autorest.WithPathParameters(\"/v1/shapes/{id}\",pathParameters),\n autorest.WithJSON(model))\n return preparer.Prepare((&http.Request{}).WithContext(ctx))\n }", "title": "" }, { "docid": "4048725310405fe4e6d3bdf1df56c3b1", "score": "0.44252557", "text": "func (g *Geometry) Save(data *interface{}, datasize *C.int) error {\n\t//FMOD_RESULT F_API FMOD_Geometry_Save(FMOD_GEOMETRY *geometry, void *data, int *datasize);\n\treturn ErrNoImpl\n}", "title": "" }, { "docid": "65b0d8848ab1234d4e271c8a65d6eb18", "score": "0.44189212", "text": "func (r *Resolver) SetDataPath(ctx context.Context, path []string, data interface{}) error {\n\treturn r.o.SetDataPath(ctx, path, data)\n}", "title": "" }, { "docid": "2968ac9daa6e14ebb473b45a51b8be59", "score": "0.44187", "text": "func (fn *FlowNode) SetData(data interface{}) {\n\tif data == nil {\n\t\tdelete(nodeData, fn.cnode)\n\t\treturn\n\t}\n\tnodeData[fn.cnode] = data\n}", "title": "" }, { "docid": "51b406cdb33917209c44337138a487de", "score": "0.44170496", "text": "func (t *Tensor) Shape() []int64 {\n\treturn t.shape\n}", "title": "" }, { "docid": "36022530f467879495a050cbd49c746f", "score": "0.4414129", "text": "func (m *Matrix) Shape() Shape {\n\ts := make(Shape, 2)\n\ts[0] = m.rows\n\ts[1] = m.cols\n\treturn s\n}", "title": "" }, { "docid": "8a1e7fba4794e21387a30b14c0c3cee5", "score": "0.44088587", "text": "func NewShape(t ShapeType) Shape {\n\n\tswitch t {\n\tcase Circle:\n\t\treturn &circle{}\n\tcase Square:\n\t\treturn &square{}\n\tcase Rectangle:\n\t\treturn &rectangle{}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "5a21dd30aadb4f347309b330ae7ddd3e", "score": "0.43977505", "text": "func (table *Table) SetData(tableData [][]*Cell, numOfHeaderRows int) {\n\ttable.tableData = tableData\n\ttable.numOfHeaderRows = numOfHeaderRows\n\ttable.rendered = numOfHeaderRows\n\n\tnumOfColumns := len(tableData[0])\n\tfont := tableData[0][0].font\n\tfor _, row := range tableData {\n\t\tdiff := numOfColumns - len(row)\n\t\tfor i := 0; i < diff; i++ {\n\t\t\trow = append(row, NewCell(font, \"\"))\n\t\t}\n\t}\n}", "title": "" }, { "docid": "0d8ea6158b14aab1a83cea0b6bcf5416", "score": "0.43959346", "text": "func (p *Parameter) DataType(typeName string) *Parameter {\n\tp.data.DataType = typeName\n\treturn p\n}", "title": "" }, { "docid": "35270d043129b98142f9c5ee334d7f59", "score": "0.4395718", "text": "func (m Member) Shape() *Shape {\n\treturn m.ShapeRef.Shape()\n}", "title": "" }, { "docid": "d56ffbe52cd983558ffd278b4e3fc00c", "score": "0.43897095", "text": "func (s DataShape) Equals(s2 DataShape) bool {\n\tif s.dims == s2.dims && len(s.shape) == len(s2.shape) {\n\t\tfor i, dim := range s.shape {\n\t\t\tif s2.shape[i] != dim {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "a02e29b498efcd734d72e6d994913a37", "score": "0.43813726", "text": "func (self ConvexShape) Setposition(position Vector2f) {\n\tC.sfConvexShape_setPosition(self.Cref, position.Cref)\n}", "title": "" }, { "docid": "5eb53b8b30a5412fc7c65adc83e2be33", "score": "0.4360687", "text": "func (sm ShapeMaker) MakeShape() Shape {\n\treturn sm.Shape.Clone()\n}", "title": "" }, { "docid": "04d310c720f4e705256627e0e2e32486", "score": "0.4358663", "text": "func (s IdxScheme) Shape(strides []int, size int) []int {\n\tif f, ok := schemeShapeFuncs[s]; ok {\n\t\treturn f(strides, size)\n\t}\n\n\tpanic(errorc.New(\"invalid strided indexing scheme\"))\n}", "title": "" }, { "docid": "1d0e7374477a6ba9cc06adb53f6e6552", "score": "0.43440115", "text": "func (t *TensorDesc) Set(dataType DataType, dims, strides []int) error {\n\tif len(dims) != len(strides) {\n\t\tpanic(\"dims and stride length mismatch\")\n\t}\n\tcDims := make([]C.int, len(dims))\n\tcStrides := make([]C.int, len(strides))\n\tfor i, x := range dims {\n\t\tcDims[i] = safeIntToC(x)\n\t}\n\tfor i, x := range strides {\n\t\tcStrides[i] = safeIntToC(x)\n\t}\n\tstatus := C.cudnnSetTensorNdDescriptor(t.desc, dataType.cValue(),\n\t\tsafeIntToC(len(dims)), (*C.int)(&cDims[0]), (*C.int)(&cStrides[0]))\n\truntime.KeepAlive(t)\n\treturn newError(\"cudnnSetTensorNdDescriptor\", status)\n}", "title": "" }, { "docid": "b544a467e627ee554300bfc07753c8fd", "score": "0.43415016", "text": "func validateData(dataPointX, dataPointY []float64) error {\n\tif len(dataPointX) == 0 || len(dataPointY) == 0 {\n\t\treturn EmptyInput\n\t}\n\n\tif len(dataPointX) != len(dataPointY) {\n\t\treturn SizeErr\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "040d9a1c4573952d3bd20c395b0e643f", "score": "0.43411526", "text": "func (s DataShape) Bytes() []byte {\n\tb := make([]byte, DataShapeBytes)\n\tb[0] = byte(s.dims)\n\tb[1] = byte(len(s.shape))\n\tfor i := 0; i < len(s.shape); i++ {\n\t\tb[i+2] = s.shape[i]\n\t}\n\treturn b\n}", "title": "" }, { "docid": "f5a469f2157467abfd9d2225eeb2ab33", "score": "0.4340987", "text": "func (rk4 *Rk4) Set(stepSize complex128, system System) error {\n\t//if stepSize <= 0 {\n\tif real(stepSize) <= 0 && imag(stepSize) <= 0.0 {\n\t\treturn &Error{\"Can't use negative or null step size for Rk4 stepper.\"}\n\t} else {\n\t\trk4.stepSize = stepSize\n\t\trk4.system = system\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "9e33e7787f5972fc54c752cd220f0f88", "score": "0.43310872", "text": "func (m *Attachment) SetSize(value *int32)() {\n m.size = value\n}", "title": "" }, { "docid": "096ef2dde31f5594cb4e61761dc29daa", "score": "0.4330468", "text": "func (self ConvexShape) Setorigin(x, y float32) { \n C.sfConvexShape_setOrigin(self.Cref, C.sfVector2f {\n\t\tC.float(x), C.float(y),\n\t})\n}", "title": "" }, { "docid": "202d14bd343062ddddc494da67c426ca", "score": "0.4329918", "text": "func (i OneloginAppsParsable) HCLShape() interface{} {\n\treturn &AppData{}\n}", "title": "" }, { "docid": "b4093519f21c36eba4ba1e3be5abbbfb", "score": "0.432471", "text": "func (me *Size) Set(size *Size) {\n\tme.SetSize(size.Width, size.Height)\n}", "title": "" }, { "docid": "a6a694895532a300fab3a8005c05de5e", "score": "0.43202597", "text": "func dataSize(data interface{}) int {\n\tvar size int\n\tswitch data.(type) {\n\tcase int8, *int8, uint8, *uint8:\n\t\tsize = binary.ByteSize\n\tcase int16, *int16, uint16, *uint16:\n\t\tsize = binary.ShortSize\n\tcase Triad, *Triad:\n\t\tsize = TriadSize\n\tcase int32, *int32, uint32, *uint32:\n\t\tsize = binary.IntSize\n\tcase int64, *int64, uint64, *uint64:\n\t\tsize = binary.LongSize\n\tcase float32, *float32:\n\t\tsize = binary.FloatSize\n\tcase float64, *float64:\n\t\tsize = binary.DoubleSize\n\t}\n\n\treturn size\n}", "title": "" }, { "docid": "f513f69b98e536c4d2b744fc507a6949", "score": "0.43114093", "text": "func (s ImmutableStoreBlobParams) DataSchema() wasmtypes.ScImmutableBytes {\n\treturn wasmtypes.NewScImmutableBytes(s.Proxy.Root(ParamDataSchema))\n}", "title": "" }, { "docid": "25e35e9bed5d1c46d52a43e21ef07b79", "score": "0.43108347", "text": "func (f *EnvFile) SetData(data map[string]string) *EnvFile {\n\tif f.Err() == nil {\n\t\tf.data = data\n\t}\n\n\treturn f\n}", "title": "" }, { "docid": "b53b767381c9d66e8288ad244ef71d9b", "score": "0.43103096", "text": "func (m *mysqlBoundValue) SetData(newData []byte, setting config.ColumnEncryptionSetting) error {\n\t// means that we set encrypted data\n\tif !bytes.Equal(m.data, newData) {\n\t\tm.paramType = base_mysql.TypeBlob\n\t\tm.data = newData\n\t}\n\n\tif setting == nil {\n\t\treturn nil\n\t}\n\n\t// In case of tokenization happened, even if the driver sent value as Tiny\n\t// we need to update mysql types in the result packet to Long/LongLong as Acra supports only int32/int64 tokenization\n\t// also mysql cast less sized type to higher one automatically.\n\tswitch m.format {\n\tcase base.BinaryFormat:\n\t\tswitch setting.GetTokenType() {\n\t\tcase tokens.TokenType_Int32:\n\t\t\tm.paramType = base_mysql.TypeLong\n\t\tcase tokens.TokenType_Int64:\n\t\t\tm.paramType = base_mysql.TypeLongLong\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "517d76f3f3e00ee4fc6619db2280273d", "score": "0.43002683", "text": "func (o *physicsServer) AreaSetShapeTransform(area *RID, shapeIdx int64, transform *Transform) {\n\tlog.Println(\"Calling PhysicsServer.AreaSetShapeTransform()\")\n\n\t// Build out the method's arguments\n\tgoArguments := make([]reflect.Value, 3, 3)\n\tgoArguments[0] = reflect.ValueOf(area)\n\tgoArguments[1] = reflect.ValueOf(shapeIdx)\n\tgoArguments[2] = reflect.ValueOf(transform)\n\n\t// Call the parent method.\n\n\to.callParentMethod(o.baseClass(), \"area_set_shape_transform\", goArguments, \"\")\n\n\tlog.Println(\" Function successfully completed.\")\n\n}", "title": "" }, { "docid": "4506fe6fa3d22b2a5f1d5352c87f1494", "score": "0.43000874", "text": "func (i *VM) SetDataPath(path []string, value interface{}) error {\n\n\t// Reset the heap ptr before patching the vm to try and keep any\n\t// new allocations safe from subsequent heap resets on eval.\n\terr := i.setHeapState(i.evalHeapPtr)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvalueAddr, err := i.toRegoJSON(value, true)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tpathAddr, err := i.toRegoJSON(path, true)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tresult, err := i.valueAddPath(i.dataAddr, pathAddr, valueAddr)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// We don't need to free the value, assume it is \"owned\" as part of the\n\t// overall data object now.\n\t// We do need to free the path\n\n\t_, err = i.free(pathAddr)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Update the eval heap pointer to accommodate for any new allocations done\n\t// while patching.\n\ti.evalHeapPtr, err = i.getHeapState()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terrc := result.ToI32()\n\tif errc != 0 {\n\t\treturn fmt.Errorf(\"unable to set data value for path %v, err=%d\", path, errc)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "fcb25b8db8d7a9710257dd1943e92c2e", "score": "0.42962155", "text": "func (_m *FilterState) SetData(name string, value string, stateType statetype.Type, lifeSpan lifespan.Type) {\n\t_m.Called(name, value, stateType, lifeSpan)\n}", "title": "" }, { "docid": "e9b78f148279a41adb317cf86ca1807e", "score": "0.42895398", "text": "func (ref *ShapeRef) Shape() *Shape {\n\tif ref == nil {\n\t\treturn nil\n\t}\n\treturn service.Shapes[ref.ShapeName]\n}", "title": "" }, { "docid": "1a8b808c190412fb674ab079d9493d2b", "score": "0.42869642", "text": "func (o *physicsServer) BodySetShapeTransform(body *RID, shapeIdx int64, transform *Transform) {\n\tlog.Println(\"Calling PhysicsServer.BodySetShapeTransform()\")\n\n\t// Build out the method's arguments\n\tgoArguments := make([]reflect.Value, 3, 3)\n\tgoArguments[0] = reflect.ValueOf(body)\n\tgoArguments[1] = reflect.ValueOf(shapeIdx)\n\tgoArguments[2] = reflect.ValueOf(transform)\n\n\t// Call the parent method.\n\n\to.callParentMethod(o.baseClass(), \"body_set_shape_transform\", goArguments, \"\")\n\n\tlog.Println(\" Function successfully completed.\")\n\n}", "title": "" }, { "docid": "d16047628cf3115049a2f9d0eac31dde", "score": "0.42853695", "text": "func (r *Request) SetData(data []byte) {\n\tr.Data = data\n}", "title": "" } ]